Vertical domain term extraction method and device, equipment and medium
By performing sentence-partitioning and word-partitioning processing on the input text, combined with the matching and semantic similarity calculation of the vertical field term library, the problem of large language models insufficient understanding of vertical field terms is solved, and the accuracy of term extraction is improved.
Patent Information
- Application Number
- CN202411900440.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-23
- Publication Date
- 2025-04-15
AI Technical Summary
There is a method for extracting vertical domain terms based on large language models. The base model lacks understanding of vertical domain terms, resulting in low accuracy of extraction results.
By performing sentence- and word-partitioning processing on the input text, candidate terms matching the vertical domain termbase are selected, and the extraction results are output through semantic similarity calculation and merging.
Improve the accuracy of vertical field term extraction, ensure that the extracted terms match the actual vertical field term, and enhance the model's understanding of vertical field terminology.
Smart Images

Figure CN119830904A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of term extraction, and in particular to a method, device, equipment and medium for extracting vertical field terms. Background Art
[0002] Keyword extraction is one of the most basic tasks in natural language processing. In vertical application scenarios, the extraction of professional terms or technical labels is also a common business requirement. Human natural language expressions are very diverse, and traditional methods are difficult to cope with them well. Large language models have powerful emergence capabilities, a general understanding of natural language, and extremely high cross-domain capabilities and flexibility.
[0003] Existing vertical field terminology extraction methods based on large language models are usually based on the keyword extraction capabilities of the large language model itself, combined with prompt word engineering and vertical field background knowledge to complete the vertical field terminology extraction task. However, there is usually a certain difference in word segmentation granularity between vertical field terms and general keywords, and the base model does not have sufficient understanding of vertical field terms, resulting in technical problems such as low accuracy of extraction results. Summary of the invention
[0004] In view of the above analysis, the embodiments of the present invention aim to provide a method, apparatus, device and medium for extracting vertical field terms, so as to solve one or more of the above problems existing in the prior art.
[0005] The object of the present invention is achieved in that:
[0006] The first aspect of the present invention provides a method for extracting vertical field terms, including:
[0007] Feed the input text into the pre-trained large language model;
[0008] Segment processing is performed on the input text to obtain multiple sub-texts;
[0009] Performing word segmentation processing on the subtext to obtain a candidate term set;
[0010] The candidate terms in the candidate term set that match the vertical field term library are screened, merged, and output as extraction results.
[0011] Furthermore, the sentence segmentation processing of the input text includes: dividing the input text into a plurality of sub-texts, and removing stop words in each sub-text.
[0012] Furthermore, the word segmentation processing of the sub-texts includes: segmenting the sub-texts based on a vertical field term library and a word segmentation tool to obtain first-granularity candidate terms for each sub-text, and splicing them into a first-granularity candidate term set; further segmenting the words by analyzing the parts of speech of the candidate terms in the first-granularity candidate term set to obtain keywords for each sub-text, combining the keyword set of each sub-text into second-granularity candidate terms according to term combination rules, and splicing them into a second-granularity candidate term set; the first-granularity candidate term set and the second-granularity candidate term set constitute the candidate term set.
[0013] Furthermore, the screening of candidate terms in the candidate term set that match the vertical field term library includes: vectorizing the candidate term set and the vertical field term library; calculating the semantic similarity between the candidate terms in the vectorized candidate term set and the terms in the vertical field term library; marking the candidate terms whose semantic similarity is greater than a preset threshold as vertical field-related terms.
[0014] Furthermore, after the merging, the output is an extraction result, including: calculating the semantic relevance between all vertical field related terms, merging the vertical field related terms whose semantic relevance is greater than a relevance threshold, and outputting the merged terms as the extraction result.
[0015] Furthermore, the pre-training process of the large language model includes: performing hierarchical word segmentation on each original term in the vertical field term library, and marking the word segmentation results as first-granularity terms and second-granularity terms according to the granularity; splicing the original terms, first-granularity terms, and second-granularity terms into a word segmentation granularity preference alignment dataset; and using the word segmentation granularity preference alignment dataset to fine-tune the large language model.
[0016] Furthermore, it also includes: dynamically updating the vertical field terminology library according to user feedback, and using the updated terminology library and user feedback data to incrementally fine-tune the large language model.
[0017] A second aspect of the present invention provides a device for extracting vertical field terms, including:
[0018] Input module, used to feed input text into the pre-trained large language model;
[0019] A sentence processing module, used for performing sentence processing on the input text to obtain multiple sub-texts;
[0020] A word segmentation processing module, used for performing word segmentation processing on the subtext to obtain a candidate term set;
[0021] The output module is used to screen the candidate terms in the candidate term set that match the vertical field term library, merge them, and output them as extraction results.
[0022] According to a third aspect of the present invention, there is provided an electronic device, comprising a memory and a processor, wherein the memory stores a computer program, and when the computer program is executed by the processor, the method for extracting vertical field terms as described in any one of the embodiments is implemented.
[0023] A fourth aspect of the present invention provides a computer-readable storage medium having a computer program stored thereon, wherein the computer program, when executed by a processor, implements the method for extracting vertical field terms as described in any one of the embodiments.
[0024] Compared with the prior art, the present invention can achieve at least one of the following beneficial effects:
[0025] The method for extracting vertical field terms provided by the present invention first performs sentence segmentation processing on the input text, then performs word segmentation processing, and then screens out candidate terms that match the vertical field term library in the word segmentation results, thereby extracting vertical field terms with higher accuracy. BRIEF DESCRIPTION OF THE DRAWINGS
[0026] In order to more clearly illustrate the embodiments of this specification or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments recorded in the embodiments of this specification. For ordinary technicians in this field, other drawings can also be obtained based on these drawings.
[0027] Figure 1 A flowchart of a method for extracting vertical domain terms provided in Example 1 of the present invention;
[0028] Figure 2 A schematic diagram of a device for extracting vertical domain terms provided in Example 2 of the present invention;
[0029] Figure 3 This is a schematic diagram of the electronic device architecture provided in Example 3 of the present invention. DETAILED DESCRIPTION
[0030] In order to make the purpose, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. It should be noted that, in the absence of conflict, the embodiments and features in the embodiments disclosed in this disclosure can be combined, separated, interchanged and / or rearranged with each other. Based on the embodiments in the present invention, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present invention.
[0031] Example 1
[0032] A specific embodiment of the present invention, as Figure 1 As shown, a method for extracting vertical domain terms is disclosed, comprising the following steps:
[0033] S1. Input text into the pre-trained large language model.
[0034] For example, input text such as: "According to the project construction requirements, the landscaping area needs to immediately lay Bermuda turf after completing the backfilling of planting soil, while ensuring that the turf is at the same height as the surrounding area. After laying, it is necessary to further check the flatness of the turf joints and use the caulking process to repair them in order to achieve an effect that is both beautiful and practical. The construction team emphasizes that every step of the backfilling of planting soil and the laying of turf must be carried out strictly in accordance with the specifications, especially the subsequent caulking of the finished product. Specified materials need to be used to complete the final construction to ensure the quality and life of the overall landscape."
[0035] S2. Segment the input text to obtain multiple sub-texts.
[0036] In this embodiment, step S2 specifically includes: dividing the input text into multiple sub-texts, and removing stop words in each sub-text.
[0037] Specifically, the input text can be divided into sentences according to punctuation marks and semantic pause points, and stop words with no semantic value can be removed, such as "according to", "need", "of", etc. Taking the input text in S1 as an example, after sentence division and stop word removal, the sub-text obtained is as follows:
[0038] Subtext 1: Bermuda turf is laid after the landscaping area is backfilled with planting soil.
[0039] Subtext 2: The turf is of the same height as the surrounding area.
[0040] Sub-text 3: After laying, check the flatness of the turf joints, repair the joints with caulking technology, and ensure the aesthetic and practical effects.
[0041] Subtext 4: The construction team emphasized that every step, including backfilling of planting soil and laying of turf, must be strictly regulated.
[0042] Subtext 5: Subsequent finished product caulking treatment, selection of specified materials, final construction, and overall landscape quality and life.
[0043] S3. Perform word segmentation on the subtext to obtain a set of candidate terms.
[0044] In this embodiment, step S3 specifically includes:
[0045] S301, segmenting the subtexts based on a vertical domain term library and a segmentation tool to obtain first-granularity candidate terms for each subtext, and splicing them into a first-granularity candidate term set;
[0046] Specifically, the first granularity is coarse-grained, which aims to retain semantically complete terms and can quickly screen out possible terms to reduce the interference of irrelevant words. The subtexts are segmented by Jieba or THULAC word segmentation tools and compared with the vertical domain terminology library to obtain coarse-grained candidate terms for each subtext. For example, in the subtext of S2, subtexts 2 and 4 do not contain terms in the vertical domain terminology library, so these two subtexts are removed. The results of word segmentation of the remaining subtexts are as follows:
[0047] ["After backfilling with planting soil", "Bermuda turf laying"], ["Turf joint flatness", "Caulking process repair"], ["Finished product caulking treatment", "Overall landscape quality and life"];
[0048] And spliced into a first-granularity candidate term set: ["after planting soil backfill", "Bermuda turf laying", "turf joint flatness", "caulking process repair", "finished product caulking treatment", "overall landscape quality life"].
[0049] S302, by analyzing the parts of speech of the candidate terms in the first granularity candidate term set, further segmenting the words, obtaining the keywords of each subtext, combining the keyword set of each subtext into the second granularity candidate terms according to the term combination rule, and splicing them into the second granularity candidate term set;
[0050] Specifically, the second granularity is fine-grained, which aims to refine the analysis and merge the terms by further decomposing the first granularity candidate terms, and obtain the following keywords through word segmentation:
[0051] ["planting soil","backfill","after","bermuda","sod","laying"],["sod","joint","flatness","inspection","caulking","workmanship","repairing"],["finished","caulking","treatment","specify","material","construction"];
[0052] According to the term combination rules, such as the structure of noun + verb, the above keywords are combined and concatenated into the following second-granularity candidate term set:
[0053] [“After backfilling with planting soil”, “Bermuda turf laying”, “Turf joint flatness”, “Caulking process repair”, “Finished product caulking treatment”, “Overall landscape quality and life span”].
[0054] S303: The first granularity candidate term set and the second granularity candidate term set constitute the candidate term set.
[0055] S4. Filter the candidate terms in the candidate term set that match the vertical field term library, merge them, and output them as extraction results.
[0056] In this embodiment, step S4 specifically includes:
[0057] S401, vectorizing the candidate term set and the vertical field term base;
[0058] Specifically, pre-trained models such as BERT and Word2Vec can be used to perform word vectorization on the candidate term set and the terms in the vertical field term library. For each candidate term, it is encoded into a vector representation of a fixed length, and the same processing is performed on the terms in the vertical field term library to facilitate the subsequent calculation of semantic similarity.
[0059] S402, calculating the semantic similarity between the candidate terms in the vectorized candidate term set and the terms in the vertical field term library;
[0060] Specifically, the cosine similarity between the candidate term vector and the term vector in the vertical domain term library is calculated to determine the degree of semantic similarity. For example, for the candidate term "Bermuda turf laying", the term with the closest semantics is screened out as "Bermuda" by comparing the cosine similarity with the terms in the term library.
[0061] S403, marking candidate terms whose semantic similarity is greater than a preset threshold as vertical field related terms;
[0062] Specifically, candidate terms with semantic similarity greater than a preset threshold, such as 0.8, are marked as vertical field-related terms. The preset threshold can be adjusted according to actual conditions to ensure that only high-quality candidate terms enter subsequent processing. For example, for "caulking process repair", if its similarity with "caulking process" in the terminology library is 0.85, it will be marked as a vertical field-related term.
[0063] S404: Calculate the semantic relevance between all vertical field related terms, merge the vertical field related terms whose semantic relevance is greater than the relevance threshold, and output the merged terms as extraction results.
[0064] Exemplarily, when merging, the terms with the highest semantic relevance can be preferentially selected as representative terms. For example, for "turf seam flatness" and "turf seam treatment", if their semantic relevance is 0.9, they are merged into "turf seam treatment", and all merged results are output as the final extraction results.
[0065] In this embodiment, the pre-training process of the large language model includes:
[0066] Perform hierarchical word segmentation on each original term in the vertical domain term library, and mark the word segmentation results as first-granularity terms and second-granularity terms according to the granularity; concatenate the original terms, first-granularity terms and second-granularity terms into a word segmentation granularity preference alignment dataset; use the word segmentation granularity preference alignment dataset to fine-tune the large language model.
[0067] In some embodiments, further comprising:
[0068] The vertical domain terminology library is dynamically updated according to user feedback, and the large language model is incrementally fine-tuned using the updated terminology library and user feedback data.
[0069] Compared with the prior art, the method for extracting vertical field terms provided in this embodiment first performs sentence segmentation on the input text, then performs word segmentation on the input text, and then screens out candidate terms in the word segmentation results that match the vertical field term library, thereby extracting vertical field terms with higher accuracy.
[0070] Example 2
[0071] This embodiment provides a device for extracting vertical domain terms, such as Figure 2 As shown, including:
[0072] Input module, used to feed input text into the pre-trained large language model;
[0073] A sentence processing module, used for performing sentence processing on the input text to obtain multiple sub-texts;
[0074] A word segmentation processing module, used for performing word segmentation processing on the subtext to obtain a candidate term set;
[0075] The output module is used to screen the candidate terms in the candidate term set that match the vertical field term library, merge them, and output them as extraction results.
[0076] Example 3
[0077] This embodiment provides an electronic device, such as Figure 3 As shown, it includes a memory and a processor, the memory stores a computer program, and when the computer program is executed by the processor, the method for extracting vertical field terms as described in any of the above embodiments is implemented.
[0078] Example 4
[0079] This embodiment provides a computer-readable storage medium having a computer program stored thereon. When the program is executed by a processor, the method for extracting vertical field terms as described in any of the above embodiments is implemented.
[0080] Computer readable storage media include permanent and non-permanent, removable and non-removable media that can be implemented by any method or technology to store information. Information can be computer readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer readable media does not include temporary computer readable media (transitory media), such as modulated data signals and carrier waves.
[0081] The professionals should further realize that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented by electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described in the above description according to the function. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professionals and technicians can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of the present invention.
[0082] The steps of the method or algorithm described in conjunction with the embodiments disclosed herein may be implemented using hardware, a software module executed by a processor, or a combination of the two. The software module may be placed in a random access memory (RAM), a memory, a read-only memory (ROM), an electrically programmable ROM, an electrically erasable programmable ROM, a register, a hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art.
[0083] The specific implementation methods described above further illustrate the objectives, technical solutions and beneficial effects of the present invention in detail. It should be understood that the above description is only a specific implementation method of the present invention and is not intended to limit the scope of protection of the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present invention should be included in the scope of protection of the present invention.
Claims
1. A method for extracting vertical domain terms, characterized in that: include: Feed the input text into the pre-trained large language model; Segment processing is performed on the input text to obtain multiple sub-texts; Performing word segmentation processing on the subtext to obtain a candidate term set; The candidate terms in the candidate term set that match the vertical field term library are screened, merged, and output as extraction results.
2. The method for extracting vertical domain terms according to claim 1, characterized in that: The sentence segmentation processing of the input text includes: The input text is divided into a plurality of sub-texts, and stop words in each sub-text are removed.
3. The method for extracting vertical domain terms according to claim 2, characterized in that: The word segmentation processing of the subtext includes: Segmenting the subtexts based on a vertical domain term library and a word segmentation tool to obtain first-granularity candidate terms for each subtext, and splicing them into a first-granularity candidate term set; By analyzing the parts of speech of the candidate terms in the first granularity candidate term set, further segmenting the words, obtaining the keywords of each sub-text, combining the keyword set of each sub-text into the second granularity candidate terms according to the term combination rule, and splicing them into the second granularity candidate term set; The first granularity candidate term set and the second granularity candidate term set constitute the candidate term set.
4. The method for extracting vertical domain terms according to claim 3, characterized in that: The step of screening the candidate terms in the candidate term set that match the vertical field term library includes: Vectorizing the candidate term set and the vertical field term base; Calculate the semantic similarity between the candidate terms in the vectorized candidate term set and the terms in the vertical domain term library; Candidate terms with semantic similarity greater than a preset threshold are marked as vertical field related terms.
5. The method for extracting vertical domain terms according to claim 4, characterized in that: After the merging, the output is the extraction result, including: The semantic relevance between all vertical field related terms is calculated, the vertical field related terms whose semantic relevance is greater than the relevance threshold are merged, and the merged terms are output as the extraction results.
6. The method for extracting vertical domain terms according to claim 1, characterized in that: The pre-training process of the large language model includes: Perform hierarchical word segmentation on each original term in the vertical domain term library, and mark the word segmentation results as first-granularity terms and second-granularity terms according to the granularity; Concatenate the original terms, the first-granularity terms, and the second-granularity terms into a word segmentation granularity preference alignment dataset; The large language model is fine-tuned using the word segmentation granularity preference alignment dataset.
7. The method for extracting vertical domain terms according to any one of claims 1 to 6, characterized in that: Also includes: The vertical domain terminology library is dynamically updated according to user feedback, and the large language model is incrementally fine-tuned using the updated terminology library and user feedback data.
8. A device for extracting vertical domain terms, characterized in that: The device comprises: Input module, used to feed input text into the pre-trained large language model; A sentence processing module, used for performing sentence processing on the input text to obtain multiple sub-texts; A word segmentation processing module, used for performing word segmentation processing on the subtext to obtain a candidate term set; The output module is used to screen the candidate terms in the candidate term set that match the vertical field term library, merge them, and output them as extraction results.
9. An electronic device, characterized in that: It includes a memory and a processor, the memory stores a computer program, and when the computer program is executed by the processor, the method for extracting vertical field terms as described in any one of claims 1 to 7 is implemented.
10. A storage medium, characterized in that: A computer program is stored thereon, and when the program is executed by a processor, the method for extracting vertical field terms as described in any one of claims 1-7 is implemented.