A text label marking method, device and system

By obtaining target words from the text to be labeled, and using a tag generation model and various similarity calculation methods to generate and match tags, the problem of time-consuming and labor-intensive traditional manual tag classification is solved, achieving efficient and comprehensive text annotation, and improving the utilization of knowledge resources and the accuracy of querying.

CN119646215BActive Publication Date: 2026-01-02CCTEG COAL MINING RES INST
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411679015.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-11-21
Publication Date
2026-01-02
Estimated Expiration
2044-11-21

AI Technical Summary

Technical Problem

Traditional manual labeling and classification methods are time-consuming and labor-intensive, making it difficult to guarantee the consistency and comprehensiveness of labels, thus limiting the effective utilization and sharing of knowledge resources.

Method used

The target words are obtained from the text to be labeled. Initial tags are generated using a tag generation model. The similarity values ​​between the initial tags and candidate tags in the thesaurus are calculated using multiple similarity calculation methods. The similarity values ​​are then normalized and sorted to determine the order of matching methods. The matching is performed sequentially until the target candidate tags are obtained, and the text is then labeled.

Benefits of technology

It improves the efficiency and comprehensiveness of text annotation and tagging, enhances the accuracy of text retrieval or querying, and makes full use of knowledge resources.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119646215B_ABST
    Figure CN119646215B_ABST
Patent Text Reader

Abstract

The present disclosure relates to a text label annotation method, device and system. The method comprises: obtaining a target word from a text to be annotated, generating an initial label of the target word according to a label library by using a label generation model, calculating similarity values between the initial label and each candidate label in a synonym library by using multiple similarity calculation methods, obtaining multiple similarity values, normalizing the multiple similarity values, sorting the multiple similarity values after normalization to obtain a first order, determining a second order of multiple matching modes according to the first order, and matching the initial label with the candidate labels in the synonym library according to the matching mode corresponding to the second order in sequence until at least one target candidate label is obtained, and annotating the target word by using the initial label and the at least one target candidate label. The present scheme improves the comprehensiveness of the text label.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present disclosure relates to the technical field of data processing, and particularly relates to a text label annotation method, device and system. BACKGROUND

[0002] In the related art, knowledge resources such as stored scientific research reports or technical materials need to be classified by tags so as to facilitate querying and searching, and thus the knowledge resources can be effectively utilized and shared. However, the traditional manual tag classification method not only consumes time and effort, but also cannot guarantee the consistency and comprehensiveness of the tags, thereby limiting the effective utilization and sharing of the knowledge resources. SUMMARY

[0003] To overcome the problems in the related art, the present disclosure provides a text label annotation method, device and system.

[0004] According to a first aspect of an embodiment of the present disclosure, a text label annotation method is provided, comprising:

[0005] obtaining a target word from a text to be annotated;

[0006] generating an initial label of the target word according to a label library by using a label generation model; the label library is a label library associated with a field to which the text to be annotated belongs;

[0007] calculating similarity values between the initial label and each candidate label in a synonym library by using multiple similarity calculation methods, to obtain multiple similarity values;

[0008] performing normalization processing on the multiple similarity values, and sorting the multiple similarity values after the normalization processing to obtain a first order;

[0009] determining a second order of multiple matching methods according to the first order;

[0010] matching the initial label and the candidate labels in the synonym library according to the matching methods corresponding to the second order in sequence until at least one target candidate label is obtained;

[0011] annotating the target word by using the initial label and the at least one target candidate label.

[0012] In some embodiments of the present disclosure, the normalization processing on the multiple similarity values comprises:

[0013] In a case where the multiple similarity calculation methods include a first method, the similarity value corresponding to the first method is normalized by using the following formula:

[0014]

[0015] wherein, tf idf h(Test[n]) is a similarity value obtained by using a first method to calculate the similarity of the n th candidate label in the synonym library, a is a normalized similarity value corresponding to the first method; the first method is to calculate the similarity value by using a term frequency-inverse document frequency (TF-IDF) algorithm;

[0016] In the case where the plurality of similarity calculation methods includes a second method, the similarity value corresponding to the first method is normalized by using the following formula:

[0017]

[0018] wherein, levenshtein hash(Test[n]) is a similarity value obtained by using a second method to calculate the similarity of the n th candidate label in the synonym library, b is a normalized similarity value corresponding to the second method, length(n) is the length of the n th candidate label; the second method is to calculate the similarity value by using an edit distance algorithm.

[0019] In some embodiments of the present disclosure, the second order of the plurality of matching methods is determined according to the first order, including:

[0020] obtaining a mapping relationship between the plurality of similarity calculation methods and the plurality of matching methods;

[0021] determining a second order of the plurality of matching methods according to the mapping relationship and the first order; wherein, the plurality of similarity calculation methods include a TF-IDF algorithm, an edit distance algorithm, a cosine similarity algorithm and a Jaccard similarity algorithm; the matching methods include synonym matching, exact matching, fuzzy matching and semantic matching; the mapping relationship is that the TF-IDF algorithm corresponds to synonym matching, the edit distance algorithm corresponds to exact matching, the cosine similarity algorithm corresponds to fuzzy matching, and the Jaccard similarity algorithm corresponds to semantic matching.

[0022] In some embodiments of the present disclosure, the initial label is matched with the candidate labels in the synonym library according to the matching method corresponding to the second order in sequence until at least one target candidate label is obtained, including:

[0023] determining a current matching method from the plurality of matching methods according to the second order;

[0024] matching the initial label with the candidate labels in the synonym library according to the current matching method to obtain a matching result; the matching result includes whether the matching is successful and the matched candidate label;

[0025] in the case that the matching result is a match, determining the matched candidate label as the target candidate label;

[0026] in the case that the matching result is a match, determining the matched candidate label as the target candidate label;

[0027] in the case that the matching result is a match, determining the matched candidate label as the target candidate label;

[0028] In some embodiments of the present disclosure, the plurality of matching manners includes fuzzy matching, and the matching of the initial label with the candidate labels in the synonym library according to the current matching manner to obtain a matching result comprises:

[0029] in the case that the current matching manner is fuzzy matching, calculating, for each candidate label in the synonym library, a comprehensive similarity value of the initial label and the candidate label according to the following formula:

[0030]

[0031] wherein, Target is the comprehensive similarity value, a is a similarity value calculated in a first manner, b is a similarity value calculated in a second manner, c is a similarity value calculated in a third manner, d is a similarity value calculated in a fourth manner, λ1 is a weight value corresponding to the first manner, λ2 is a weight value corresponding to the second manner, λ3 is a weight value corresponding to the third manner, and λ4 is a weight value corresponding to the fourth manner;

[0032] in the case that the comprehensive similarity value satisfies a first preset condition, determining the candidate label as the target candidate label.

[0033] In some embodiments of the present disclosure, the determination of the candidate label as the target candidate label in the case that the comprehensive similarity value satisfies the first preset condition comprises:

[0034] calculating a similarity mean value x according to the following formula:

[0035]

[0036] wherein, n is the number of candidate labels in the synonym library.

[0037] In a case that the Target<=x, the similarity level of the candidate label is determined by using a plurality of first intervals;

[0038] In a case that the Target>x, the similarity level of the candidate label is determined by using a plurality of second intervals;

[0039] In a case that the similarity level meets a second preset condition, the candidate label is determined as a target candidate label; wherein, the interval range corresponding to a first interval in which the similarity level meets the second preset condition is greater than the interval range corresponding to a second interval in which the similarity level meets the second preset condition.

[0040] According to a second aspect of the embodiments of the present disclosure, a text label annotation apparatus is provided, comprising:

[0041] An acquisition unit is configured to acquire a target word from a text to be annotated;

[0042] A generation unit is configured to generate an initial label of the target word according to a label library by using a label generation model; the label library is a label library associated with a field to which the text to be annotated belongs;

[0043] A calculation unit is configured to calculate similarity values between the initial label and each candidate label in a synonym library by using a plurality of similarity calculation manners, to obtain a plurality of similarity values;

[0044] An ordering unit is configured to perform normalization processing on the plurality of similarity values, and sort the plurality of similarity values after the normalization processing, to obtain a first order;

[0045] A determination unit is configured to determine a second order of a plurality of matching manners according to the first order;

[0046] A matching unit is configured to match the initial label and the candidate labels in the synonym library according to the matching manners corresponding to the second order in sequence, until at least one target candidate label is obtained;

[0047] An annotation unit is configured to annotate the target word by using the initial label and the at least one target candidate label.

[0048] According to a third aspect of the embodiments of the present disclosure, an electronic device comprises a memory, a processor, and a computer program stored on the memory and executable on the processor, and the processor implements the method according to any one of the first aspect when executing the computer program.

[0049] According to a fourth aspect of the embodiments of the present disclosure, a computer readable storage medium is provided, and the computer readable storage medium stores a computer program, and the computer program is executable on a processor to implement the method according to any one of the first aspect.

[0050] According to a fifth aspect of embodiments of the present disclosure, a computer program product is provided, comprising a computer program which, when executed by a processor, implements the method according to any one of the first aspect.

[0051] The technical solution provided by the embodiments of the present disclosure can include the following beneficial effects: the target word segmentation is obtained from the text to be labeled, the initial label of the target word segmentation is generated according to the label library by using the label generation model, the similarity values of the initial label and each candidate label in the synonym library are calculated by using multiple similarity calculation methods, the multiple similarity values are obtained, the multiple similarity values are normalized, the multiple similarity values after the normalization are sorted to obtain a first order, a second order of multiple matching modes is determined according to the first order, the initial label and the candidate label in the synonym library are matched according to the matching mode corresponding to the second order in turn until at least one target candidate label is obtained, and the target word segmentation is labeled by using the initial label and the at least one target candidate label. The labels of the text are expanded by the secondary generation of the identification, so that the efficiency of labeling the labels of the text is improved, the comprehensiveness of the labels of the text is improved, and the accuracy of searching or querying the text is improved, so that the knowledge resources can be fully utilized.

[0052] It should be understood that the foregoing general description and the following detailed description are only exemplary and explanatory, and are not limiting to the present disclosure. BRIEF DESCRIPTION OF DRAWINGS

[0053] The accompanying drawings, which are incorporated in and constitute a part of the specification, illustrate embodiments consistent with the present disclosure and serve to explain the principles of the present disclosure together with the specification.

[0054] Figure 1 is a flowchart of a text label labeling method according to an exemplary embodiment.

[0055] Figure 2 is a block diagram of a text label labeling apparatus according to an exemplary embodiment.

[0056] Figure 3 is a block diagram of an apparatus for a text label labeling method according to an exemplary embodiment. DETAILED DESCRIPTION

[0057] The exemplary embodiments will be described in detail herein with reference to the attached drawings. The following description is made with reference to the accompanying drawings in which like reference numerals refer to like elements, unless the context of use indicates otherwise. The following description of exemplary embodiments is not representative of all possible embodiments consistent with the present disclosure. Rather, it is merely an example of apparatus and methods consistent with some aspects of the present disclosure as detailed in the appended claims.

[0058] The terminology used in the present disclosure is for the purpose of describing particular embodiments only and is not intended to be limiting of the present disclosure. As used in the present disclosure and the appended claims, the singular forms "a," "an" and "the" are intended to include the plural forms as well, unless the context clearly indicates otherwise.

[0059] It will be understood that, although the terms first, second, third, etc. can be used herein to describe various information, these terms are not intended to denote a temporal sequence. Rather, these terms are used only as distinguish one piece of information from another. For example, a first information can be termed a second information, and similarly, a second information can also be termed a first information, without departing from the scope of the present disclosure. Depending on the context, the word "if" as used herein can be interpreted as "when" or "upon" or "in response to determining."

[0060] In addition, the steps of the various forms of flow shown in the present disclosure can be reordered, added or deleted. For example, the steps described in the present disclosure can be executed in parallel, sequentially or in different orders, as long as the desired results of the technical solutions disclosed in the present disclosure can be achieved, which are not limited herein.

[0061] In the related art, the knowledge resources such as stored scientific research reports or technical materials need to be classified by tags, so as to facilitate the query and retrieval, and then the knowledge resources can be effectively utilized and shared. However, the traditional manual tag classification method not only consumes time and effort, but also is difficult to guarantee the consistency and comprehensiveness of the tags, thereby limiting the effective utilization and sharing of the knowledge resources.

[0062] To solve the above problems, the present disclosure provides a text label annotation method, device and system. The target word segmentation is obtained from the text to be annotated, the initial label of the target word segmentation is generated according to the label library by using the label generation model, the similarity values of the initial label and each candidate label in the synonym library are calculated by using multiple similarity calculation methods, the multiple similarity values are obtained, the multiple similarity values are normalized, the multiple similarity values after normalization are sorted to obtain a first order, the second order of multiple matching modes is determined according to the first order, the initial label and the candidate label in the synonym library are matched according to the matching mode corresponding to the second order in turn until at least one target candidate label is obtained, and the target word segmentation is annotated by using the initial label and the at least one target candidate label. The text label is expanded by the secondary generation of the identification, so that the efficiency of annotating the text label is improved, the comprehensiveness of the text label is improved, and the accuracy of searching or querying the text is improved, so that the knowledge resources can be fully utilized.

[0063] Figure 1 is a flowchart of a text label annotation method according to an exemplary embodiment, as shown in Figure 1 It should be noted that the text label annotation method of the present disclosure is applied to a text label annotation device. As shown in Figure 1 The method can include the following steps:

[0064] Step 101, obtaining target word segmentation from the text to be annotated.

[0065] In some embodiments of the present disclosure, the knowledge resources that need to be annotated can be converted into pure text format in advance, and preprocessing operations such as denoising, word segmentation, and stop word filtering are performed to provide high-quality text data for subsequent processing. The natural language processing (NLP) technology, such as TF-IDF, Word2Vec or BERT model, is used to extract features from the preprocessed text, capture key information in the text, including keywords, phrases, sentence-level semantic features, etc., and obtain multiple word segmentation.

[0066] In one embodiment, the natural language processing (NLP) technology can be used for text preprocessing, cleaning the document, removing useless special characters, and performing word segmentation (for Chinese or other non-space separated languages) and stop word filtering to reduce the complexity of subsequent processing. Word embedding (such as Word2Vec, BERT) is used to convert text into numerical vectors for computer processing. In addition, TF-IDF, TextRank, etc. algorithm can be used to extract keywords or phrases as feature representation of the document.

[0067] It can be understood that each of the above multiple segmented words can be used as the above target segmented word to perform the text label annotation method proposed in the present disclosure to complete the annotation of the label representing the text as a whole.

[0068] In step 102, an initial label of the target segmented word is generated according to a label library by using a label generation model.

[0069] The label library is a label library associated with the field to which the text to be annotated belongs.

[0070] In an embodiment, the label library can be constructed in advance according to professional knowledge representing the field to which the text belongs, and an association network between labels can also be constructed in the label library, for example, a knowledge graph based on labels is constructed, so as to improve the comprehensiveness and logic of the label annotation.

[0071] As an example, a pre-trained machine learning or deep learning algorithm (such as K-means clustering, LDA topic model, sequence labeling model, etc.) can be used as a label generation model to automatically generate a set of initial labels. Since the initial labels are generated according to the label library including the domain professional knowledge, the initial labels not only cover the main content of the text, but also reflect the characteristics of the domain.

[0072] In some embodiments of the present disclosure, since the automatically generated initial labels can contain redundant, irrelevant or incorrect labels, the initial labels can be optimized and selected to further improve the quality of the labels. For example, the initial labels are de-duplicated and filtered to remove duplicate labels and obviously irrelevant labels based on statistics or rules.

[0073] In step 103, a plurality of similarity values are calculated by using a plurality of similarity calculation methods to calculate the similarity values between the initial label and each candidate label in the synonym library.

[0074] In some embodiments, the above plurality of similarity calculation methods can include any of the following:

[0075] TF-IDF algorithm, edit distance algorithm, cosine similarity algorithm and Jaccard similarity algorithm.

[0076] In step 104, the plurality of similarity values are normalized, and the plurality of normalized similarity values are sorted to obtain a first order.

[0077] In an embodiment, the plurality of normalized similarity values can be sorted in descending order.

[0078] In some embodiments of the present disclosure, the normalization of the plurality of similarity values in step 104 can include the following steps:

[0079] Step a1, in the case that the plurality of similarity calculation manners includes the first manner, the similarity value corresponding to the first manner is normalized by using the following formula:

[0080]

[0081] wherein, tf_idf_h(Test[n]) is the similarity value obtained by calculating the n th candidate label in the synonym library by using the first manner, a is the normalized similarity value corresponding to the first manner; the first manner is to calculate the similarity value by using the term frequency-inverse document frequency (TF-IDF) algorithm;

[0082] Step a2, in the case that the plurality of similarity calculation manners includes the second manner, the similarity value corresponding to the first manner is normalized by using the following formula:

[0083]

[0084] wherein, levenshtein_hash(Test[n]) is the similarity value obtained by calculating the n th candidate label in the synonym library by using the second manner, b is the normalized similarity value corresponding to the second manner, length(n) is the length of the n th candidate label; the second manner is to calculate the similarity value by using the edit distance algorithm.

[0085] Step 105, determining the second order of the plurality of matching manners according to the first order.

[0086] It can be understood that the greater the similarity value is, the more the corresponding matching manner is preferred to be applied.

[0087] In some embodiments of the present disclosure, step 105 can specifically include the following steps:

[0088] Obtaining a mapping relationship between the plurality of similarity calculation manners and the plurality of matching manners;

[0089] Determining the second order of the plurality of matching manners according to the mapping relationship and the first order.

[0090] Wherein, the plurality of similarity calculation manners includes the TF-IDF algorithm, the edit distance algorithm, the cosine similarity algorithm and the Jaccard similarity algorithm; the matching manner includes the synonym matching, the exact matching, the fuzzy matching and the semantic matching; the mapping relationship is that the TF-IDF algorithm corresponds to the synonym matching, the edit distance algorithm corresponds to the exact matching, the cosine similarity algorithm corresponds to the fuzzy matching, and the Jaccard similarity algorithm corresponds to the semantic matching.

[0091] It should be noted that the exact match refers to directly comparing the generated initial label with each synonym in the synonym library, and if they are exactly the same, it is considered as a successful match; the fuzzy match refers to using a fuzzy matching algorithm (such as edit distance, Jaccard similarity, etc.) to compare the similarity between the initial label and the synonym in order to consider the diversity and flexibility of language, and if the similarity exceeds a certain threshold, it is considered as a successful match; the semantic match refers to using natural language processing techniques (such as word embedding, semantic role labeling, etc.) to capture the semantic relationship between the initial label and the synonym, and if the initial label and the synonym are similar or related in semantics, it is considered as a successful match.

[0092] It can be understood that the TF-IDF (Term Frequency-Inverse Document Frequency) algorithm is used to evaluate the importance of a word to a file set or a file in a corpus. The importance of the word increases in direct proportion to the number of times it appears in the file, but at the same time, it decreases in inverse proportion to the frequency of its appearance in the corpus. Various forms of TF-IDF weighting are often used by search engines as a measure or rating of the degree of relevance between files and user queries. Based on this feature, TF-IDF values are easier to detect synonyms.

[0093] In addition, the edit distance algorithm is to calculate the edit distance between two texts to measure their similarity, which is used to calculate the minimum number of editing operations between two strings, including insertion, deletion and replacement. Based on this feature, it is easier to detect exact matches.

[0094] In addition, the cosine similarity algorithm represents the text label word group as a vector and calculates the cosine similarity between two vectors. Cosine similarity is a method for measuring the cosine value of the included angle between two non-zero vectors, and is commonly used to compare document similarity. The value of cosine similarity is between -1 and 1, where 1 represents complete identity, 0 represents dissimilarity, and -1 represents complete opposition. Based on this feature, it is more suitable to use fuzzy matching to match.

[0095] In addition, the Jaccard similarity algorithm is based on the lexical set of two text word groups, and calculates the ratio of their intersection and union, which is used as an indicator to measure the similarity between two sets, which is defined as the size of the intersection of the two sets divided by the size of the union. The Jaccard similarity value is between 0 and 1, 1 means that the two sets are exactly the same, and 0 means that they are completely different. Based on this feature, it is more suitable to use semantic matching to match.

[0096] In an embodiment, the similarity values calculated by the TF-IDF algorithm can be stored in the Hash table tf idf hash in the form of key-value pairs; the similarity values calculated by the edit distance algorithm can be stored in the Hash table levenshtein d hash in the form of key-value pairs; the similarity values calculated by the cosine similarity algorithm can be stored in the Hash table cosine similarity cos hash in the form of key-value pairs; and the similarity values calculated by the Jaccard similarity algorithm can be stored in the Hash table Jaccard jac hash in the form of key-value pairs.

[0097] In an embodiment, the four values a, b, c and d can be ranked to obtain the first ranking. The greater value is preferred to select the corresponding method for matching words. The value a is the similarity value calculated by the first method, the value b is the similarity value calculated by the second method, the value c is the similarity value calculated by the third method, and the value d is the similarity value calculated by the fourth method. The value c = consine similarity hash(Test[n]), and the value d = jaccard hash(Test[n]).

[0098] In step 106, the initial label is matched with the candidate labels in the synonym library in the order of the second sequence of the corresponding matching methods, until at least one target candidate label is obtained.

[0099] In an embodiment, the synonym library can be created in advance, and the synonym library can include polysemy and multi-word synonym cases, thereby enhancing the accuracy and richness of the search. The initial label is matched with the synonyms (i.e., candidate labels) in the label library to select the most suitable label as the target candidate label.

[0100] It can be understood that, in order to improve the efficiency of label matching, the most suitable matching method can be selected according to the second sequence, and if the target candidate label is not matched, the next matching method can be used for matching until the target candidate label is matched by the current matching method.

[0101] It should be noted that the target candidate label can be one or multiple. In addition, the initial label can be one or multiple. In the case of multiple initial labels in the target word segmentation, at least one target candidate label can be matched for each initial label.

[0102] In some embodiments of the present disclosure, step 106 can include the following steps:

[0103] In step b1, the current matching method is determined from the multiple matching methods according to the second sequence.

[0104] Step b2, matching the initial label with the candidate labels in the synonym library according to the current matching manner to obtain a matching result.

[0105] The matching result includes whether the matching is successful and the candidate label matched.

[0106] Step b3, in the case that the matching result is that the matching is not successful and the current matching manner is not the last matching manner in the second order, determining the next matching manner as the current matching manner according to the second order, and returning to step b2.

[0107] Step b4, in the case that the matching result is that the matching is successful, determining the candidate label matched as the target candidate label.

[0108] Step b5, in the case that the matching result is that the matching is not successful and the current matching manner is the last matching manner in the second order, determining that the matching fails.

[0109] In an embodiment, if it is determined that the matching fails, the initial label can be stored in the synonym library for future use.

[0110] In some embodiments of the present disclosure, step b2 can specifically include the following steps:

[0111] Step b21, in the case that the current matching manner is the fuzzy matching, calculating the comprehensive similarity value of the initial label and the candidate label in the synonym library according to the following formula:

[0112]

[0113] Wherein, Target is the comprehensive similarity value, a is the similarity value calculated by the first manner, b is the similarity value calculated by the second manner, c is the similarity value calculated by the third manner, d is the similarity value calculated by the fourth manner, λ1 is the weight value corresponding to the first manner, λ2 is the weight value corresponding to the second manner, λ3 is the weight value corresponding to the third manner, and λ4 is the weight value corresponding to the fourth manner.

[0114] Step b22, in the case that the comprehensive similarity value satisfies the first preset condition, determining the candidate label as the target candidate label.

[0115] In some embodiments of the present disclosure, step b22 can specifically include the following steps:

[0116] The similarity mean x is calculated according to the following formula:

[0117]

[0118] wherein n is the number of candidate labels in the synonym library;

[0119] In the case of Target<=x, the similarity level of the candidate label is determined by using a plurality of first intervals;

[0120] In the case of Target>x, the similarity level of the candidate label is determined by using a plurality of second intervals;

[0121] In the case of the similarity level satisfying the second preset condition, the candidate label is determined as the target candidate label.

[0122] wherein the interval range corresponding to the first interval in which the similarity level satisfies the second preset condition is greater than the interval range corresponding to the second interval in which the similarity level satisfies the second preset condition.

[0123] In an embodiment, the above-mentioned second preset condition can be that the similarity level is greater than or equal to a preset level.

[0124] It is understood that the greater x is, the higher the overall similarity of the initial label to the synonym library is, and it is easier to match to the target candidate label. The smaller x is, the lower the overall similarity of the initial label to the synonym library is, and it is more difficult to match to the target candidate label. Therefore, in the case of the comprehensive similarity value Target<=x of the initial label and the candidate label, it is more difficult to match, and the screening standard can be relaxed, that is, the similarity level of the candidate label is determined by using a plurality of first intervals, so as to determine whether the candidate label can be used as the target candidate label by using the similarity level; in the case of the comprehensive similarity value Target>x of the initial label and the candidate label, it is easier to match, and the screening standard can be tightened, so as to improve the matching precision on the premise of ensuring the successful matching, that is, the similarity level of the candidate label is determined by using a plurality of second intervals, so as to determine whether the candidate label can be used as the target candidate label by using the similarity level.

[0125] For example, when Target<=x, the plurality of first intervals used are shown in Table 1:

[0126] Table 1: Mapping relationship table of first interval and similarity level

[0127] Rating level 1 low similarity 2 lower similarity 3 higher similarity 4 high similarity First interval [0,0.3) [0.3,0.5) [0.5,0.7) [0.7,1.0]

[0128] When Target>x, the plurality of first intervals used are shown in Table 2:

[0129] Table 2: Mapping relationship table of first interval and similarity level

[0130] Rating level 1 low similarity 2 lower similarity 3 higher similarity 4 high similarity Second interval [0,0.4) [0.4,0.6) [0.6,0.85) [0.85,1.0]

[0131] When the similarity level is determined to be 3, the label similarity is high, and when the similarity level is determined to be 4, the similarity is high. A threshold value a can be set, 0.6 <= a <= 1, which is set by the knowledge base system in this range, and if Value >= a, it is considered that the fuzzy matching is successful.

[0132] In step 107, the initial label and at least one target candidate label are used to label the target word segmentation.

[0133] In some embodiments of the present disclosure, after step 107, the initial label and at least one target candidate label can also be displayed on the terminal device, and the user can provide real-time feedback on the label, including "correct", "incorrect", "useful", "irrelevant", etc.

[0134] According to the text label labeling method proposed in the embodiments of the present disclosure, the target word segmentation is obtained from the text to be labeled, the initial label of the target word segmentation is generated according to the label library by using the label generation model, the similarity values of the initial label and each candidate label in the synonym library are calculated by using multiple similarity calculation methods, multiple similarity values are obtained, the multiple similarity values are normalized, the multiple similarity values after normalization are sorted to obtain a first order, a second order of multiple matching modes is determined according to the first order, and the initial label and the candidate label in the synonym library are matched according to the matching mode corresponding to the second order in turn until at least one target candidate label is obtained. The initial label and at least one target candidate label are used to label the target word segmentation. The text label is expanded by the secondary generation of the identification, thereby improving the efficiency of labeling the text label, improving the comprehensiveness of the text label, and further improving the accuracy of retrieving or querying the text, so that the knowledge resources can be fully utilized.

[0135] Figure 2 is a block diagram of a text label labeling apparatus according to an exemplary embodiment. Referring to Figure 2 The apparatus includes an acquisition unit 201, a generation unit 202, a calculation unit 203, a sorting unit 204, a determination unit 205, a matching unit 206, and a labeling unit 207.

[0136] The acquisition unit 201 is configured to obtain target word segmentation from the text to be labeled.

[0137] The generation unit 202 is configured to generate an initial label of the target word segmentation according to a label library by using a label generation model; the label library is a label library associated with the field to which the text to be labeled belongs.

[0138] The calculation unit 203 is configured to calculate similarity values of the initial label and each candidate label in a synonym library by using multiple similarity calculation methods, and obtain multiple similarity values.

[0139] The sorting unit 204 is configured to normalize the plurality of similarity values, and sort the normalized plurality of similarity values to obtain a first order.

[0140] The determining unit 205 is configured to determine a second order of the plurality of matching manners according to the first order.

[0141] The matching unit 206 is configured to match the initial label with the candidate labels in the synonym library according to the matching manner corresponding to the second order in sequence until at least one target candidate label is obtained.

[0142] The labeling unit 207 is configured to label the target word segmentation by using the initial label and the at least one target candidate label.

[0143] In some embodiments of the present disclosure, the sorting unit 204 can be specifically configured to:

[0144] In a case where the plurality of similarity calculation manners includes a first manner, the similarity value corresponding to the first manner is normalized by using the following formula:

[0145]

[0146] wherein tf_idf_h(Test[n]) is a similarity value obtained by calculating the similarity of the nth candidate label in the synonym library by using the first manner, a is the normalized similarity value corresponding to the first manner, and the first manner is to calculate the similarity value by using the term frequency-inverse document frequency (TF-IDF) algorithm.

[0147] In a case where the plurality of similarity calculation manners includes a second manner, the similarity value corresponding to the first manner is normalized by using the following formula:

[0148]

[0149] wherein levenshtein_hash(Test[n]) is a similarity value obtained by calculating the similarity of the nth candidate label in the synonym library by using the second manner, b is the normalized similarity value corresponding to the second manner, and length(n) is the length of the nth candidate label; and the second manner is to calculate the similarity value by using the edit distance algorithm.

[0150] In some embodiments of the present disclosure, the determining unit 205 can be specifically configured to:

[0151] obtain a mapping relationship between the plurality of similarity calculation manners and the plurality of matching manners;

[0152] determine a second order of the plurality of matching manners according to the mapping relationship and the first order; wherein the plurality of similarity calculation manners comprise a TF-IDF algorithm, an edit distance algorithm, a cosine similarity algorithm and a Jaccard similarity algorithm; the matching manners comprise synonym matching, exact matching, fuzzy matching and semantic matching; the mapping relationship is that the TF-IDF algorithm corresponds to synonym matching, the edit distance algorithm corresponds to exact matching, the cosine similarity algorithm corresponds to fuzzy matching, and the Jaccard similarity algorithm corresponds to semantic matching.

[0153] In some embodiments of the present disclosure, the matching unit 206 can be specifically configured to:

[0154] determine a current matching manner from the plurality of matching manners according to the second order;

[0155] match the initial label with the candidate labels in the synonym library according to the current matching manner to obtain a matching result; the matching result comprises whether matching is successful and a matched candidate label;

[0156] in a case where the matching result is that matching is not successful and the current matching manner is not the last matching manner in the second order, determine a next matching manner as the current matching manner according to the second order, and return to execute the step of matching the initial label with the candidate labels in the synonym library according to the current matching manner to obtain a matching result;

[0157] in a case where the matching result is that matching is successful, determine the matched candidate label as a target candidate label;

[0158] in a case where the matching result is that matching is not successful and the current matching manner is the last matching manner in the second order, determine that matching fails.

[0159] In some embodiments of the present disclosure, the matching unit 206 can be specifically configured to:

[0160] in a case where the current matching manner is fuzzy matching, calculate a comprehensive similarity value of the initial label and each candidate label in the synonym library according to the following formula:

[0161]

[0162] wherein Target is the comprehensive similarity value, a is a similarity value calculated by using a first manner, b is a similarity value calculated by using a second manner, c is a similarity value calculated by using a third manner, d is a similarity value calculated by using a fourth manner, λ1 is a weight value corresponding to the first manner, λ2 is a weight value corresponding to the second manner, λ3 is a weight value corresponding to the third manner, and λ4 is a weight value corresponding to the fourth manner;

[0163] In a case where the comprehensive similarity value meets a first preset condition, the candidate label is determined as a target candidate label.

[0164] In some embodiments of the present disclosure, the matching unit 206 can be specifically configured to:

[0165] The similarity mean value x is calculated by the following formula:

[0166]

[0167] wherein n is the number of candidate labels in the synonym library;

[0168] In a case where Target <= x, the similarity level of the candidate label is determined by using a plurality of first intervals;

[0169] In a case where Target > x, the similarity level of the candidate label is determined by using a plurality of second intervals;

[0170] In a case where the similarity level meets a second preset condition, the candidate label is determined as a target candidate label; wherein the interval range corresponding to the first interval in which the similarity level meets the second preset condition is greater than the interval range corresponding to the second interval in which the similarity level meets the second preset condition.

[0171] As to the apparatus in the above-described embodiments, the specific manners in which various modules perform operations have been described in detail in the embodiments of the method, and thus will not be described herein in detail.

[0172] The text label labeling apparatus according to the embodiments of the present disclosure, by acquiring a target word from a text to be labeled, using a label generation model, generating an initial label of the target word according to a label library, calculating similarity values between the initial label and each candidate label in a synonym library by using a plurality of similarity calculation manners, obtaining a plurality of similarity values, performing normalization processing on the plurality of similarity values, sorting the plurality of similarity values after the normalization processing to obtain a first order, determining a second order of a plurality of matching manners according to the first order, and sequentially matching the initial label with the candidate labels in the synonym library according to the matching manners corresponding to the second order until at least one target candidate label is obtained, and labeling the target word by using the initial label and the at least one target candidate label. The text label is expanded by the secondary generation of the identification, so as to improve the efficiency of labeling the text label, improve the comprehensiveness of the text label, and further improve the accuracy of searching or querying the text, so that the knowledge resources can be fully utilized.

[0173] Figure 3is a block diagram of an apparatus for a labeling method of a text label according to an exemplary embodiment. For example, the apparatus 300 can be an electronic device such as a mobile phone, a computer, a digital broadcasting terminal, a messaging device, a game console, a tablet device, a medical device, a fitness device, a personal digital assistant, etc.

[0174] Referring to Figure 3 The apparatus 300 can include one or more of the following components: a processing component 302, a memory 304, a power component 306, a multimedia component 308, an audio component 310, an input / output (I / O) interface 312, a sensor component 314, and a communication component 316.

[0175] The processing component 302 usually controls overall operations of the apparatus 300, such as operations associated with displaying, making phone calls, data communications, camera operations, and recording operations. The processing component 302 can include one or more processors 320 to execute instructions to complete all or part of steps of the above-described methods. In addition, the processing component 302 can include one or more modules to facilitate interaction between the processing component 302 and other components. For example, the processing component 302 can include a multimedia module to facilitate the interaction between the multimedia component 308 and the processing component 302.

[0176] The memory 304 is configured to store various types of data to support operations of the apparatus 300. Examples of these data include instructions for any application or method operating on the apparatus 300, contact data, phonebook data, messages, pictures, videos, etc. The memory 304 can be realized by any type of volatile or non-volatile storage devices or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic storage, flash memory, magnetic disk or optical disk.

[0177] The power component 306 provides power to the various components of the apparatus 300. The power component 306 can include a power management system, one or more power sources, and other components associated with generating, managing, and distributing power for the apparatus 300.

[0178] The multimedia component 308 includes a screen providing an output interface between the device 300 and a user. In some embodiments, the screen includes a liquid crystal display (LCD) and a touch panel (TP). If the screen includes a touch panel, the screen can be implemented as a touch screen to receive input signals from a user. The touch panel includes one or more touch sensors to sense touch, swiping, and gestures on the touch panel. The touch sensor can not only sense a boundary of a touching or swiping action, but also detect duration and pressure related to the touching or swiping action. In some embodiments, the multimedia component 308 includes a front camera and / or a rear camera. When the device 300 is in an operation mode, such as a shooting mode or a video mode, the front camera and / or the rear camera can receive external multimedia data. Each of the front and rear camera can be a fixed optical lens system or have a focal length and optical zoom capability.

[0179] The audio component 310 is configured to output and / or input audio signals. For example, the audio component 310 includes a microphone (MIC) configured to receive an external audio signal when the device 300 is in an operation mode, such as a call mode, a recording mode, and a voice recognition mode. The received audio signal can be further stored in the memory 304 or transmitted via the communication component 316. In some embodiments, the audio component 310 further includes a speaker for outputting audio signals.

[0180] The I / O interface 312 provides an interface between the processing component 302 and peripheral interface modules, which can be a keypad, a click wheel, buttons, and the like. The buttons can include, but are not limited to, a home button, a volume button, a start button, and a lock button.

[0181] The sensor component 314 includes one or more sensors to provide various state assessments for the device 300. For example, the sensor component 314 can detect an open / closed state of the device 300, relative positioning of components, such as a display and a keypad of the device 300, a change in position of the device 300 or a component of the device 300, presence or absence of user contact with the device 300, a change in orientation of the device 300 or acceleration / deceleration of the device 300, and a temperature change of the device 300. The sensor component 314 can include a proximity sensor configured to detect presence of a nearby object without any physical touch. The sensor component 314 can further include a light sensor, such as a CMOS or CCD image sensor, for use in an imaging application. In some embodiments, the sensor component 314 can further include an acceleration sensor, a gyroscope sensor, a magnetic sensor, a pressure sensor, or a temperature sensor.

[0182] The communication component 316 is configured to facilitate wired or wireless communication between the device 300 and other devices. The device 300 can access a wireless network based on a communication standard, such as WiFi, 2G, or 3G, or a combination thereof. In an exemplary embodiment, the communication component 316 receives a broadcast signal or broadcast related information from an external broadcast management system via a broadcast channel. In an exemplary embodiment, the communication component 316 further includes a Near Field Communication (NFC) module to facilitate short-range communication. For example, the NFC module can be implemented based on Radio Frequency Identification (RFID) technology, infrared data association (IrDA) technology, ultra-wideband (UWB) technology, Bluetooth (BT) technology and other technology.

[0183] In an exemplary embodiment, the device 300 can be implemented by one or more application-specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DSPDs), programmable logic devices (PLDs), field programmable gate arrays (FPGAs), controllers, micro-controllers, microprocessors or other electronic components, for performing the above-described methods.

[0184] In an exemplary embodiment, a non-transitory computer readable storage medium, such as the memory 304 including instructions, is also provided, which can be executed by the processor 320 of the device 300 to complete the above-described methods. For example, the non-transitory computer readable storage medium can be a ROM, a random access memory (RAM), a CD-ROM, a magnetic tape, a floppy disc, and an optical data storage device, etc.

[0185] In an exemplary embodiment, a computer program product including a computer program is also provided, which, when executed by the processor 320 of the device 300, implements the above-described methods.

[0186] Other embodiments of the present application will be apparent to those skilled in the art from consideration of the specification and practice of the application disclosed herein. It is intended that the present application cover any and all variations of the application that come within the scope of the claims and their equivalents. It is intended that the specification and examples be considered exemplary only, with the true scope and spirit of the application indicated by the following claims.

[0187] It is to be understood that the application is not limited to the precise construction herein disclosed and shown in the attached drawings, and that various changes in form and detail can be made therein without departing from the scope thereof. The scope of the application should only be limited by the appended claims.

Claims

1. A method of annotating a text label, characterized by, The method comprises the following steps: obtaining a target word from a text to be labeled; generating an initial label of the target word according to a label library by using a label generation model; the label library is a label library associated with a field to which the text to be labeled belongs; calculating similarity values between the initial label and each candidate label in a synonym library by using multiple similarity calculation methods, to obtain multiple similarity values; normalizing the multiple similarity values, and sorting the multiple similarity values after normalization to obtain a first order; determining a second order of multiple matching methods according to the first order; matching the initial label with the candidate labels in the synonym library according to the matching method corresponding to the second order in sequence until at least one target candidate label is obtained; labeling the target word by using the initial label and the at least one target candidate label; wherein the determining the second order of multiple matching methods according to the first order comprises: obtaining a mapping relationship between the multiple similarity calculation methods and the multiple matching methods; determining the second order of the multiple matching methods according to the mapping relationship and the first order; wherein the multiple similarity calculation methods include TF-IDF algorithm, edit distance algorithm, cosine similarity algorithm and Jaccard similarity algorithm; the matching methods include synonym matching, exact matching, fuzzy matching and semantic matching; the mapping relationship is that the TF-IDF algorithm corresponds to synonym matching, the edit distance algorithm corresponds to exact matching, the cosine similarity algorithm corresponds to fuzzy matching, and the Jaccard similarity algorithm corresponds to semantic matching; wherein the exact matching is to compare the initial label with each synonym in the synonym library, and if they are completely the same, the matching is successful; the semantic matching is to capture the semantic relationship between the initial label and the synonym by using natural language processing technology, and if the initial label and the synonym are similar or related in semantics, the matching is successful.

2. The text labeling method of claim 1, wherein The normalization of the multiple similarity values comprises: in the case that the multiple similarity calculation methods include a first method, the similarity value corresponding to the first method is normalized by using the following formula: wherein, is a similarity value obtained by using the first method to calculate the similarity of the n th candidate label in the synonym library, a is a normalized similarity value corresponding to the first method; the first method is to calculate the similarity value by using the term frequency-inverse document frequency (TF-IDF) algorithm; in the case that the multiple similarity calculation methods include a second method, the similarity value corresponding to the first method is normalized by using the following formula: wherein, is a similarity value obtained by using the second method to calculate the similarity of the n th candidate label in the synonym library, b is a normalized similarity value corresponding to the second method, length(n) is the length of the n th candidate label; the second method is to calculate the similarity value by using an edit distance algorithm.

3. The text labeling method of claim 1, wherein the matching of the initial label with the candidate labels in the synonym library according to the matching method corresponding to the second order in sequence until at least one target candidate label is obtained comprises: determining a current matching method from the multiple matching methods according to the second order; matching the initial label with the candidate labels in the synonym library according to the current matching method to obtain a matching result; the matching result includes whether the matching is successful and the matched candidate label; In a case where the matching result is no match and the current matching manner is not the last matching manner in the second sequence, a next matching manner is determined as the current matching manner in the second sequence, and the step of matching the initial label with the candidate labels in the synonym library according to the current matching manner to obtain a matching result is performed again; In a case where the matching result is a match, the matched candidate label is determined as the target candidate label; In a case where the matching result is no match and the current matching manner is the last matching manner in the second sequence, it is determined that the matching fails.

4. The text label annotation method of claim 3, wherein The matching manners include fuzzy matching, and the matching of the initial label with the candidate labels in the synonym library according to the current matching manner to obtain a matching result includes: In a case where the current matching manner is fuzzy matching, the integrated similarity value of the initial label and each candidate label in the synonym library is calculated according to the following formula: Wherein, Target is a comprehensive similarity value, a is a similarity value calculated by using a first method, b is a similarity value calculated by using a second method, c is a similarity value calculated by using a third method, d is a similarity value calculated by using a fourth method, is a weight value corresponding to the first method, is a weight value corresponding to the second method, is a weight value corresponding to the third method, is a weight value corresponding to the fourth method; In a case where the integrated similarity value meets a first preset condition, the candidate label is determined as the target candidate label.

5. The text label annotation method of claim 4, wherein, The determination of the candidate label as the target candidate label in a case where the integrated similarity value meets the first preset condition includes: The similarity mean value x is calculated according to the following formula: Wherein, n is the number of candidate labels in the synonym library; In a case where Target<=x, the similarity level of the candidate label is determined by using a plurality of first intervals; In a case where Target>x, the similarity level of the candidate label is determined by using a plurality of second intervals; In a case where the similarity level meets a second preset condition, the candidate label is determined as the target candidate label; wherein the interval range corresponding to the first interval in which the similarity level meets the second preset condition is greater than the interval range corresponding to the second interval in which the similarity level meets the second preset condition.

6. A text label marking apparatus characterized by comprising: The method of any one of claims 1-5 includes: An acquisition unit configured to acquire a target word from a text to be annotated; A generation unit configured to generate an initial label of the target word according to a label library by using a label generation model, the label library being a label library associated with a field to which the text to be annotated belongs; A calculation unit configured to calculate similarity values of the initial label and each candidate label in a synonym library by using a plurality of similarity calculation manners, to obtain a plurality of similarity values; An ordering unit configured to perform normalization processing on the plurality of similarity values, and sort the plurality of similarity values after the normalization processing to obtain a first sequence; A determination unit configured to determine a second sequence of the plurality of matching manners according to the first sequence; A matching unit configured to match the initial label with the candidate labels in the synonym library according to the matching manners corresponding to the second sequence in sequence until at least one target candidate label is obtained; An annotation unit configured to annotate the target word by using the initial label and the at least one target candidate label.

7. An electronic device, comprising: The method includes: Memory, a processor, and a computer program stored on the memory and loadable on the processor, the processor implementing the method according to any one of claims 1 to 5 when executing the computer program.

8. A computer-readable storage medium having stored thereon a computer program, characterized in that, The computer program is executed by a processor to implement the method according to any one of claims 1 to 5.

9. A computer program product comprising a computer program, characterized in that, The computer program is executed by a processor to implement the method according to any one of claims 1 to 5.

Citation Information

Patent Citations

  • Text data labeling method and device, electronic equipment and storage medium

    CN114357990A

  • Text set matching method and device, electronic equipment and storage medium

    CN116796723A