WO2021072850A1 - 特征词提取方法、文本相似度计算方法、装置和设备 - Google Patents

特征词提取方法、文本相似度计算方法、装置和设备 Download PDF

Info

Publication number
WO2021072850A1
WO2021072850A1 PCT/CN2019/117401 CN2019117401W WO2021072850A1 WO 2021072850 A1 WO2021072850 A1 WO 2021072850A1 CN 2019117401 W CN2019117401 W CN 2019117401W WO 2021072850 A1 WO2021072850 A1 WO 2021072850A1
Authority
WO
WIPO (PCT)
Prior art keywords
text
texts
phrase
similarity
value
Prior art date
Application number
PCT/CN2019/117401
Other languages
English (en)
French (fr)
Inventor
刘翔
姚飞
Original Assignee
平安科技(深圳)有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 平安科技(深圳)有限公司 filed Critical 平安科技(深圳)有限公司
Publication of WO2021072850A1 publication Critical patent/WO2021072850A1/zh

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/10Text processing
    • G06F40/194Calculation of difference between files
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/20Natural language analysis
    • G06F40/205Parsing
    • G06F40/216Parsing using statistical methods
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/20Natural language analysis
    • G06F40/279Recognition of textual entities
    • G06F40/289Phrasal analysis, e.g. finite state techniques or chunking

Definitions

  • This application relates to the field of computer technology, and in particular to a feature word extraction method, text similarity calculation method, device, computer equipment, and computer-readable storage medium.
  • Feature words refer to words or phrases that best represent the subject and key content of the text, and they have very important applications in many fields. For example, text comparison, text classification, content push, search engine, etc. However, in most cases, the text does not directly give its corresponding feature words, so it is necessary to provide a feature word extraction scheme.
  • the purpose of this application is to provide a feature word extraction method, text similarity calculation method, device, computer equipment, and computer-readable storage medium, which can solve the above-mentioned defects in the prior art.
  • One aspect of the present application provides a feature word extraction method, including: in response to a word segmentation instruction for a target text, segmenting the target text to obtain a word segmentation set; combining each of the word segmentation in the word segmentation set to obtain Several phrases, wherein each said phrase includes several said word segmentation; calculate the first TF value and TF-IDF value of said phrase group; calculate and combine the second TF value of each said segmentation of said phrase to obtain several The second TF value; use the TF-IDF value, the first TF value and a number of the second TF values to calculate the probability of the phrase to limit the TF-IDF value; select the TF-IDF value arranged before the predetermined position The probability limits the phrase corresponding to the TF-IDF value as the feature word of the target text.
  • Another aspect of the present application provides a text similarity calculation method, including: selecting feature words of a target text, wherein the feature words of the target text are selected by a feature word extraction method, and the feature word extraction
  • the method includes: in response to a word segmentation instruction for the target text, segmenting the target text to obtain a word segmentation set; combining each of the word segmentation in the word segmentation set to obtain several phrases, wherein each of the phrases includes Several of the word segmentation; calculate the first TF value and the TF-IDF value of the phrase; calculate the second TF value of each of the word segmentation of the combination of the phrase to obtain a number of the second TF values; use the TF -IDF value, the first TF value and a number of second TF values to calculate the probability of the phrase to limit the TF-IDF value; select the phrase that is arranged before the predetermined position to limit the TF-IDF value As the feature word of the target text; input the feature word into a first text search database to obtain a number
  • a feature word extraction device including: a word segmentation module for segmenting the target text in response to a word segmentation instruction to the target text to obtain a word segmentation set; a combination module for combining Each of the word segmentation in the predicate word segmentation set obtains a number of phrases, wherein each of the phrase includes a number of the word segmentation; the first calculation module is used to calculate the first TF value and the TF-IDF value of the phrase; The second calculation module is used to calculate the second TF value of each of the word segmentation of the phrase group to obtain a number of the second TF values; the third calculation module is used to use the TF-IDF value and the first A TF value and a number of the second TF values calculate the probability limit TF-IDF value of the phrase; the first selection module is used to select the phrase corresponding to the probability limit TF-IDF value arranged before the predetermined position As the characteristic word of the target text.
  • a text similarity calculation device including: a second selection module for selecting feature words of a target text, wherein the feature words of the target text are selected by a feature word extraction method .
  • the feature word extraction method includes: in response to a word segmentation instruction for the target text, segmenting the target text to obtain a word segmentation set; combining each of the word segmentation in the word segmentation set to obtain several phrases, wherein , Each said phrase includes several said word segmentation; calculate the first TF value and TF-IDF value of said phrase group; calculate the second TF value of each said word segmentation of said phrase group to obtain a number of said second TF value; using the TF-IDF value, the first TF value and a number of the second TF values to calculate the probability of the phrase to limit the TF-IDF value; select the probability that is arranged before a predetermined position to limit the TF-
  • the phrase corresponding to the IDF value is used as the characteristic word of the target text; the first input module is used to input the
  • Another aspect of the present application provides a computer-readable storage medium on which a computer program is stored.
  • the target text is executed Word segmentation to obtain a word segmentation set; combine each of the word segmentation in the word segmentation set to obtain several phrases, wherein each of the phrase includes several of the word segmentation; calculate the first TF value and the TF-IDF value of the phrase; Calculate and combine the second TF value of each of the word segmentation of the phrase to obtain several second TF values; use the TF-IDF value, the first TF value and several second TF values to calculate the
  • the probability of the phrase group defines the TF-IDF value; the phrase corresponding to the probability-restricted TF-IDF value arranged before a predetermined position is selected as the feature word of the target text.
  • Another aspect of the present application provides a computer-readable storage medium on which a computer program is stored.
  • the characteristic words of the target text are selected, wherein all of the target text
  • the said feature words are selected by a feature word extraction method, and the feature word extraction method includes: in response to a word segmentation instruction for the target text, segmenting the target text to obtain a word segmentation set; combining words in the word segmentation set For each of the word segmentation, several phrases are obtained, where each of the phrase includes several of the word segmentation; the first TF value and the TF-IDF value of the phrase are calculated; the first TF value and the TF-IDF value of the phrase are calculated; Two TF values to obtain several second TF values; use the TF-IDF value, the first TF value, and several second TF values to calculate the probability of the phrase to limit the TF-IDF value; select and arrange in The probability before the predetermined position limits the phrase corresponding to the a processor
  • This application provides a method for extracting feature words.
  • word segmentation into phrases, and then using the improved TF-IDF algorithm to calculate the probability of the phrase to limit the TF-IDF value, not only the relevance of the phrase is considered, but the phrase and composition are considered.
  • the degree of relevance between the participles of the phrase further, because the expressive ability of long words is greater than that of short words, the higher-ranking phrase is selected as the characteristic word, so that the selected phrase is representative enough, that is, the selected characteristic is improved.
  • the accuracy of the word is improved.
  • This application provides a text similarity calculation method.
  • the feature words of the target text are selected through the above feature word extraction method, and then a number of first texts are retrieved based on the feature words. For the retrieval of a number of first texts and from a number of first texts In the process of identifying texts similar to the target text in the process, because the selected feature words are sufficiently representative, some first texts retrieved by these phrases are also sufficiently similar to the target text, and then determined from these first texts The text similar to the target text is also accurate enough.
  • FIG. 1 schematically shows a flowchart of a method for extracting feature words according to Embodiment 1 of the present application
  • Fig. 2 schematically shows a flowchart of a text similarity calculation method according to the second embodiment of the present application
  • FIG. 3 schematically shows a flowchart of a method for calculating text similarity according to Embodiment 3 of the present application
  • FIG. 4 schematically shows a flowchart of a text similarity calculation method according to the fourth embodiment of the present application
  • Fig. 5 schematically shows a block diagram of a feature word extraction device according to the fifth embodiment of the present application.
  • Fig. 6 schematically shows a block diagram of a text similarity calculation device according to the sixth embodiment of the present application.
  • Fig. 7 schematically shows a block diagram of a computer device suitable for implementing the feature word extraction method or the text similarity calculation method according to the seventh embodiment of the present application.
  • FIG. 1 schematically shows a flowchart of a method for extracting feature words according to Embodiment 1 of the present application.
  • the feature word extraction method may include steps S101 to S106, where:
  • Step S101 in response to the word segmentation instruction for the target text, the target text is segmented to obtain a word segmentation set.
  • the target text can be any text, such as papers, patents, or technical articles.
  • a participle can be a word or a word, for example, a participle is "most", and another participle is "similar".
  • the word segmentation set includes all the word segmentation that make up the target text.
  • the word segmentation set can be obtained by executing step S101 as "Beijing welcomes you”.
  • step S101 may include step S1011 and step S1012, where:
  • Step S1011 perform word segmentation on the target text to obtain all the word segmentation that compose the target text
  • Step S1012 clean all the word segmentation to obtain the word segmentation set.
  • the word segmentation can be further cleaned to remove useless word segmentation, such as removing "you", “me”, “he”, and “ Words such as "it” and " ⁇ ", and then the remaining participles after cleaning are used as participle sets.
  • step S1012 it is preferable to remove the word segmentation located at the beginning and end of the sentence, and do not clean the word segmentation located in the middle of the sentence.
  • Step S102 Combine each word segment in the word segmentation set to obtain a number of phrases, wherein each phrase includes a number of word segments.
  • the n-gram algorithm can be used to combine each word segmentation in the word segmentation set, and there is overlap between several word segments included in two adjacent phrases.
  • n-gram algorithm is a 2-gram algorithm
  • step S102 performs step S102 to get "Beijing welcomes you,”
  • step S102 performs step S102. Get "Beijing welcomes you welcome your arrival”.
  • the improved TF-IDF term frequency-inverse document frequency, term frequency-inverse text frequency
  • the following steps S103 to S105 are for
  • the process of using the improved TF-IDF algorithm to calculate the probability of one of the phrases to limit the TF-IDF value is the same.
  • the process of using the improved TF-IDF algorithm to calculate the probability of other phrases to limit the TF-IDF value is the same, and will not be repeated in this embodiment.
  • Step S103 Calculate the first TF value and TF-IDF value of the phrase.
  • the core idea of the TF-IDF algorithm is: if a word appears frequently in an article and rarely appears in other articles, it is considered that the word has a good classification ability and is suitable for characterization The article.
  • the formula for calculating the TF-IDF value of any phrase is as follows:
  • W i,j represents the TF-IDF value of the i-th phrase in the target text j
  • log(N/df i ) represents the IDF (inverse document frequency) value of the i-th phrase in the text collection
  • N represents the total number of texts in the text collection
  • df i represents the occurrence in the text collection The number of texts in the i-th phrase.
  • the text collection can form a text retrieval database for subsequent retrieval of texts similar to the target text.
  • Step S104 Calculate the second TF value of each word segmentation of the combined phrase to obtain several second TF values.
  • the second TF value of each participle that composes the phrase it is necessary to calculate the second TF value of each participle that composes the phrase.
  • This embodiment is aimed at the process of calculating the TF value of one of the participles.
  • the process of calculating the TF value of other participles is the same.
  • This embodiment The examples will not be repeated. Specifically, the total number of word segments and phrases included in the target text can be determined, the number of occurrences of the word segmentation in the target text can be determined, and the ratio of the number of occurrences of the word segmentation in the target text to the total number of word segments and phrases can be used as the second TF value .
  • the i-th phrase includes two participles, and the second TF value of the first participle in the i-th phrase in the target text j can be among them, Represents the number of times the first participle in the i-th phrase appears in the target text j; the second TF value of the second participle in the i-th phrase in the target text j can be among them, Represents the number of occurrences of the second participle in the i-th phrase in the target text j.
  • the denominator n j in the TF value is the same, such as the word segmentation and The total number of phrases.
  • Step S105 using the TF-IDF value, the first TF value and several second TF values to calculate the probability of the phrase to limit the TF-IDF value.
  • step S105 may include step S1051 to step S1053, where:
  • Step S1051 Calculate the product of several second TF values to obtain the TF product
  • Step S1052 Calculate the ratio of the first TF value and the TF product to obtain the phrase probability value
  • step S1053 the TF-IDF value and the phrase probability value are used to calculate the probability limit TF-IDF value.
  • the ratio of the first TF value and the product of the TF may be used as the phrase probability value, where the larger the phrase probability value, the stronger the representativeness of the phrase.
  • step S1053 is executed to obtain the probability limit TF-IDF value of the phrase, where the larger the probability limit TF-IDF value, the stronger the classification ability of the phrase.
  • step S1053 may include the following solutions:
  • Solution 1 The sum result of the TF-IDF value and the phrase probability value is used as the probability to limit the TF-IDF value.
  • Solution 2 Use the product of the TF-IDF value and the phrase probability value as the probability to limit the TF-IDF value. For example, in combination with the above example, assuming that the phrase includes two participles, the formula for solution two is:
  • W′ i,j represents the probability of the i-th phrase in the target text j to limit the TF-IDF value
  • nf i,j represents the phrase probability value of the i-th phrase in the target text j.
  • Step S106 Select the phrase corresponding to the probability limit TF-IDF value arranged before the predetermined position as the feature word of the target text.
  • the probability limit TF-IDF value of all the phrases in the target text After calculating the probability limit TF-IDF value of all the phrases in the target text, sort these probability limit TF-IDF values, determine the probability limit TF-IDF value arranged before the predetermined position, and select from all the phrases and the previous step The determined probability limits the phrase corresponding to the TF-IDF value as the feature word. For example, the phrase corresponding to the TOP50 probability limit TF-IDF value is selected as the feature word.
  • FIG. 2 schematically shows a flowchart of a text similarity calculation method according to the second embodiment of the present application.
  • the text similarity calculation method may include steps S201 to S204, where:
  • Step S201 Select feature words of the target text, where the feature words of the target text are selected by the method described in the first embodiment.
  • the feature word extraction method of the first embodiment includes: in response to a word segmentation instruction for the target text, segmenting the target text to obtain a word segmentation set; combining each of the word segmentation in the word segmentation set, Obtain several phrases, where each said phrase includes several said word segmentation; calculate the first TF value and TF-IDF value of said phrase; calculate the second TF value of each said segmentation of said phrase to obtain A number of the second TF values; use the TF-IDF value, the first TF value and a number of the second TF values to calculate the probability of the phrase to limit the TF-IDF value; select all the TF-IDF values arranged before the predetermined position The probability limits the phrase corresponding to the TF-IDF value as the characteristic word of the target text.
  • the step of using the TF-IDF value, the first TF value and several second TF values to calculate the probability of the phrase to limit the TF-IDF value may include: calculating several second TF values Multiply the product to obtain the TF product; calculate the ratio of the first TF value and the TF product to obtain the phrase probability value; use the TF-IDF value and the phrase probability value to calculate the probability to limit the TF-IDF value.
  • Step S202 input the characteristic words into the first text search database to obtain a number of first texts.
  • the first text search database is composed of text collections, and the first text search database has a search function.
  • the first text search database By inputting characteristic words into the first text search database, several first texts covering all or part of the characteristic words can be retrieved , Where the text collection includes these first texts.
  • Step S203 Calculate first similarities between the target text and several first texts to obtain several first similarities.
  • the first similarity between the target text and each first text is calculated, wherein the calculation method of the first similarity is not limited, for example, it can be obtained by using Euclidean distance and cosine similarity in the prior art.
  • step S204 the first text corresponding to the first similarity that satisfies the first similarity threshold among the plurality of first similarities is regarded as the text similar to the target text.
  • Pre-set a similarity threshold determine a first similarity that satisfies the first similarity threshold from a number of first similarities, and further, take the first text corresponding to the determined first similarity among the plurality of first texts as the A text that is similar to the target text, where there are one or more third texts that are similar to the target text.
  • the third embodiment of the present application provides a text similarity calculation method. Some steps of the text similarity calculation method are the same as those in the above-mentioned first and second embodiments. This part of the steps is not shown in the third embodiment.
  • FIG. 3 schematically shows a flowchart of a text similarity calculation method according to Embodiment 3 of the present application. As shown in Fig. 3, the text similarity calculation method may include steps S301 to S307, where:
  • Step S301 Select feature words of the target text, where the feature words of the target text are selected by the method described in the first embodiment.
  • Step S302 input the characteristic words into the first text search database to obtain a number of first texts.
  • step S303 the characteristic words are expanded to obtain an expanded phrase set, where the expanded phrase set includes the characteristic words and synonyms of the characteristic words.
  • a synonym database may be constructed in advance, and the synonym database includes multiple association relationships, and each association relationship includes multiple words with similar meanings. For example, a certain relationship is: identification, detection, and acquisition. By expanding the feature words through the synonymous word library, an expanded phrase set can be obtained.
  • Step S304 Input the extended phrase set into the first text search database to obtain a number of second texts.
  • Step S305 Take the union of several first texts and several second texts to obtain several third texts.
  • Step S306 Calculate the second similarity between the target text and several third texts to obtain several second similarities.
  • the second degree of similarity between the target text and each third text is calculated.
  • the method for calculating the second degree of similarity is not limited. For example, it can be obtained by using Euclidean distance and cosine similarity in the prior art.
  • step S307 the third text corresponding to the second similarity that satisfies the second similarity threshold among the plurality of second similarities is taken as the text similar to the target text.
  • the characteristic words or words similar to the participles in the characteristic words can be added to form an extended phrase set, and then a number of second words can be retrieved using the extended phrase set. Text, you can expand the scope of filtering. At the same time, because there may be overlap between these second texts and the above-mentioned first text, the union of the two can be taken to obtain several third texts, and then texts similar to the target text can be determined from these third texts, and further Improve the accuracy of determining similar text.
  • the fourth embodiment of the present application provides a text similarity calculation method. Some steps of the text similarity calculation method correspond to the steps in the above-mentioned first and second embodiments. This part of the steps is not in the fourth embodiment.
  • FIG. 4 schematically shows a flowchart of a text similarity calculation method according to Embodiment 4 of the present application.
  • the text similarity calculation method may include steps S401 to S407, where:
  • Step S401 Select feature words of the target text, where the feature words of the target text are selected by the method described in the first embodiment.
  • Step S402 Input the characteristic words into the first text search database to obtain a number of first texts.
  • Step S403 Obtain a pre-established knowledge graph, where for each first text, the knowledge graph includes: several fourth texts citing the first text, several fifth texts of the same family as the first text, and several sixth texts and The third degree of similarity between each sixth text and the first text.
  • the text similarity calculation method further includes:
  • the steps of constructing a knowledge graph include:
  • For each first text obtain a number of fourth texts, and construct an association relationship between each fourth text and the first text in the number of fourth texts in the knowledge graph;
  • each first text For each first text, obtain a number of fifth texts, and construct the association relationship between each fifth text and the first text in the number of fifth texts in the knowledge graph;
  • each first text For each first text, extract the feature words of the first text and enter it into the second text search database to obtain a number of sixth texts, calculate the third similarity between the first text and each of the sixth texts, and add The relationship between each sixth text in the first text and the sixth texts and the third similarity degree is constructed in the knowledge graph.
  • the text in this embodiment is a patent text.
  • For each first text there may be several fourth texts citing the first text, or there may be several fifth texts that belong to the same family as the first text.
  • the association relationship between each fourth text and the first text, as well as the association relationship between each fifth text and the first text, are constructed in the knowledge graph; in addition, for each first text, you can also obtain several through the second search database.
  • Sixth text and calculate the third similarity between each sixth text and the first text, and then construct the association relationship between each first text, each sixth text, and the third similarity in the knowledge graph. That is, for each first text, the knowledge graph includes several fourth texts, several fifth texts, and several sixth texts, and the third similarity between each sixth text and the first text.
  • the knowledge graph may include all the above-mentioned association relationships corresponding to the first text.
  • the step of calculating the third similarity between the first text and each sixth text in the plurality of sixth texts includes: calculating the similarity between the feature words of the first text and the feature words of each sixth text; and/ Or calculate the similarity between the text word vector of the first text and the text word vector of each sixth text; and/or calculate the similarity between the IPC classification number of the first text and the IPC classification number of each sixth text.
  • Solution 1 Calculate the similarity between the feature words of the first text and the feature words of each sixth text. Specifically, the improved TF-IDF algorithm is used to extract the characteristic words of the first text, the improved TF-IDF algorithm is used to extract the characteristic words of the sixth text, and the similarity of the characteristic words is calculated.
  • the second solution is to calculate the similarity between the text word vector of the first text and the text word vector of each sixth text.
  • the gensim tool can be used to calculate the similarity of text word vectors.
  • the third solution is to calculate the similarity between the IPC classification number of the first text and the IPC classification number of each sixth text. Specifically, the number of IPC classification numbers of the first text and the IPC classification numbers of the sixth text may be counted, and the number of the same sequence numbers divided by the number of all sequence numbers is used as the similarity of the IPC classification numbers.
  • the similarity calculated by each solution is the third similarity.
  • a weight is set for the similarity of each scheme, according to the weight and each scheme Calculate the third degree of similarity.
  • the step of calculating the third similarity between the first text and each sixth text in several sixth texts includes scheme one, scheme two and scheme three, where the weight of scheme one is Q1 and the similarity is S1, The weight of the second scheme is Q2, and the similarity is S2, the weight of the third scheme is Q3, and the similarity is S3, then the third similarity is Q1*S1+Q2*S2+Q3*S3.
  • Step S404 For each first text, several fourth texts, several fifth texts, and several seventh texts are determined from the knowledge graph, where each seventh text is a number of sixth texts that meet the third similarity threshold The text corresponding to the third similarity of.
  • Step S405 taking several first texts, several fourth texts, several fifth texts and several seventh texts as an extended text set.
  • this embodiment expands the retrieved first texts to obtain an extended text set, and then executes step S406.
  • Step S406 Calculate the fourth similarity between the target text and each text in the extended text set to obtain several fourth similarities.
  • the fourth similarity degree of each text except all seventh texts in the target text and the extended text set can be calculated.
  • the calculation method of the fourth similarity degree is not limited.
  • the European version in the prior art can be used.
  • the distance and or cosine are similar to each other, and then the third similarity of each seventh text can be also called the fourth similarity in this step.
  • step S407 the text corresponding to the fourth similarity that satisfies the fourth similarity threshold in the extended text set is taken as the text similar to the target text.
  • the fourth similarity that satisfies the fourth similarity threshold is determined from all the fourth similarities. Further, the text corresponding to the determined fourth similarity in the extended text set is taken as the text similar to the target text. Among them, there is one Or multiple texts similar to the target text, each text similar to the target text may be the fourth text, the fifth text, or the seventh text.
  • the fifth embodiment of the present application also provides a feature word extraction device.
  • the feature word extraction device corresponds to the feature word extraction method provided in the first embodiment above.
  • the corresponding technical features and technical effects are no longer in the fifth embodiment.
  • FIG. 5 schematically shows a block diagram of a feature word extraction device according to Embodiment 5 of the present application.
  • the feature word extraction device may include a word segmentation module 501, a combination module 502, a first calculation module 503, a second calculation module 504, a third calculation module 505, and a first selection module 506, wherein:
  • the word segmentation module 501 is configured to perform word segmentation on the target text in response to a word segmentation instruction for the target text to obtain a word segmentation set;
  • the combination module 502 is used to combine each word segment in the word segmentation set to obtain a number of phrases, where each phrase includes a number of word segments;
  • the first calculation module 503 is used to calculate the first TF value and the TF-IDF value of the phrase;
  • the second calculation module 504 is used to calculate the second TF value of each word segmentation of the combined phrase to obtain several second TF values;
  • the third calculation module 505 is configured to use the TF-IDF value, the first TF value, and several second TF values to calculate the probability of the phrase to limit the TF-IDF value;
  • the first selection module 506 is configured to select the phrase corresponding to the probability limit TF-IDF value arranged before the predetermined position as the feature word of the target text.
  • the word segmentation module is also used to: perform word segmentation on the target text to obtain all the word segmentation constituting the target text; and clean all the word segments to obtain a word segmentation set.
  • the third calculation module is also used to: calculate the product of several second TF values to obtain the TF product; calculate the ratio of the first TF value and the TF product to obtain the phrase probability value; use the TF-IDF value and the phrase probability value Calculate the probability to limit the TF-IDF value.
  • FIG. 6 schematically shows a block diagram of a text similarity calculation device according to the sixth embodiment of the present application.
  • the text similarity calculation device may include a second selection module 601, a first input module 602, a fourth calculation module 603, and a first determination module 604, wherein:
  • the second selection module 601 is used to select feature words of the target text, where the feature words of the target text are selected by the method described in the first embodiment;
  • the first input module 602 is configured to input characteristic words into the first text search database to obtain a number of first texts;
  • the fourth calculation module 603 is used to calculate the first similarity between the target text and several first texts to obtain several first similarities
  • the first determining module 604 is configured to use the first text corresponding to the first similarity that satisfies the first similarity threshold among the plurality of first similarities as text similar to the target text.
  • the text similarity calculation device further includes: an expansion module, which is used to expand the feature words to obtain an expanded phrase set after the step of inputting the feature words into the first text search database to obtain several first texts, wherein:
  • the extended phrase set includes feature words and synonyms of feature words;
  • the second input module is used to input the extended phrase set into the first text search database to obtain a number of second texts;
  • the processing module is used to compare a number of first texts and a number of second texts.
  • the texts are unionized to obtain a number of third texts; the fourth calculation module is also used to: calculate the second similarity between the target text and the third texts to obtain a number of second similarities; the first determination module is also used to: The third text corresponding to the second similarity that satisfies the second similarity threshold in the second similarity is regarded as the text similar to the target text.
  • the text similarity calculation device further includes: an obtaining module, which is used to obtain a pre-established knowledge graph after inputting the characteristic words into the first text search database to obtain several first texts.
  • the knowledge graph includes: several fourth texts citing the first text, several fifth texts of the same family as the first text, and several sixth texts and the third degree of similarity between each sixth text and the first text;
  • the second determination module is used to determine a number of fourth texts, a number of fifth texts, and a number of seventh texts from the knowledge graph for each first text, where each seventh text is a number of sixth texts that satisfy the third The text corresponding to the third similarity degree of the similarity threshold;
  • the third determining module is used to take several first texts, several fourth texts, several fifth texts, and several seventh texts as extended text sets;
  • the fourth calculation module also uses Yu: Calculate the fourth similarity between the target text and each text in the extended text set to obtain a number of fourth similarities;
  • the first determining module is also used to: correspond to the fourth similarity in the extended text
  • the text similarity calculation device further includes: a construction module, which is used to construct a knowledge graph before the step of obtaining a pre-established knowledge graph; wherein, the construction module is also used to obtain a number of first texts for each first text.
  • a construction module which is used to construct a knowledge graph before the step of obtaining a pre-established knowledge graph; wherein, the construction module is also used to obtain a number of first texts for each first text.
  • Four texts, and the association relationship between each fourth text and the first text in the fourth texts is constructed in the knowledge graph; for each first text, several fifth texts are obtained, and each of the fifth texts
  • the association relationship between the fifth text and the first text is constructed in the knowledge graph; for each first text, the feature words of the first text are extracted and input into the second text retrieval database to obtain a number of sixth texts, and then calculate the first text and the number of first texts.
  • the construction module calculates the third similarity between the first text and each sixth text in the several sixth texts, it is also used to: calculate the difference between the feature words of the first text and the feature words of each sixth text. Similarity; and/or calculating the similarity between the text word vector of the first text and the text word vector of each sixth text; and/or calculating the IPC classification number of the first text and the IPC classification number of each sixth text Similarity.
  • Fig. 7 schematically shows a block diagram of a computer device suitable for implementing the feature word extraction method or the text similarity calculation method according to the seventh embodiment of the present application.
  • the computer device 700 may be a smart phone, a tablet computer, a notebook computer, a desktop computer, a rack server, a blade server, a tower server, or a cabinet server (including independent servers, or multiple Server cluster composed of servers) and so on.
  • the computer device 700 of this embodiment at least includes but is not limited to: a memory 701, a processor 702, and a network interface 703 that can be communicatively connected to each other through a system bus.
  • FIG. 7 only shows a computer device 700 with components 701-703, but it should be understood that it is not required to implement all the illustrated components, and more or fewer components may be implemented instead.
  • the memory 703 includes at least one type of computer-readable storage medium.
  • the readable storage medium includes flash memory, hard disk, multimedia card, card-type memory (for example, SD or DX memory, etc.), random access memory (RAM). ), static random access memory (SRAM), read only memory (ROM), electrically erasable programmable read only memory (EEPROM), programmable read only memory (PROM), magnetic memory, magnetic disks, optical disks, etc.
  • the memory 701 may be an internal storage unit of the computer device 700, such as a hard disk or memory of the computer device 700.
  • the memory 701 may also be an external storage device of the computer device 700, such as a plug-in hard disk, a smart media card (SMC), and a secure digital (Secure Digital, SMC) equipped on the computer device 700. SD) card, flash card (Flash Card), etc.
  • the memory 701 may also include both an internal storage unit of the computer device 700 and an external storage device thereof.
  • the memory 701 is generally used to store an operating system and various application software installed in the computer device 700, such as program code of a feature word extraction method or a program code of a text similarity calculation method.
  • the memory 701 can also be used to temporarily store various types of data that have been output or will be output.
  • the processor 702 may be a central processing unit (Central Processing Unit, CPU), a controller, a microcontroller, a microprocessor, or other data processing chips in some embodiments.
  • the processor 702 is generally used to control the overall operation of the computer device 700.
  • the program code of the feature word extraction method or the program code of the text similarity calculation method for performing data interaction or communication-related control and processing with the computer device 700 is generally used to control the overall operation of the computer device 700.
  • the program code of the feature word extraction method or the program code of the text similarity calculation method for performing data interaction or communication-related control and processing with the computer device 700.
  • the feature word extraction method or the text similarity calculation method stored in the memory 701 can also be divided into one or more program modules, which are executed by one or more processors (in this embodiment, the processor 702 ) To complete this application.
  • the network interface 703 may include a wireless network interface or a wired network interface, and the network interface 703 is generally used to establish a communication link between the computer device 700 and other computer devices.
  • the network interface 703 is used to connect the computer device 700 to an external terminal through a network, and to establish a data transmission channel and a communication link between the computer device 700 and the external terminal.
  • the network can be Intranet, Internet, Global System of Mobile communication (GSM), Wideband Code Division Multiple Access (WCDMA), 4G network , 5G network, Bluetooth (Bluetooth), Wi-Fi and other wireless or wired networks.
  • This embodiment also provides a computer-readable storage medium, including flash memory, hard disk, multimedia card, card-type memory (for example, SD or DX memory, etc.), random access memory (RAM), static random access memory (SRAM), only Readable memory (ROM), electrically erasable programmable read-only memory (EEPROM), programmable read-only memory (PROM), magnetic memory, magnetic disks, optical disks, servers, App application malls, etc., on which computer programs are stored, so When the computer program is executed by the processor, the feature word extraction method or the text similarity calculation method is realized.
  • the computer-readable storage medium may be a non-volatile computer-readable storage medium.
  • modules or steps of the embodiments of the present application described above can be implemented by a general computing device, and they can be concentrated on a single computing device or distributed among multiple computing devices.
  • they can be implemented by the program code executable by the computing device, so that they can be stored in the storage device for execution by the computing device, and in some cases, they can be different from here
  • the steps shown or described are performed in the order of, or they are respectively fabricated into individual integrated circuit modules, or multiple modules or steps of them are fabricated into a single integrated circuit module to achieve. In this way, the embodiments of the present application are not limited to any specific combination of hardware and software.

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • Health & Medical Sciences (AREA)
  • Artificial Intelligence (AREA)
  • Audiology, Speech & Language Pathology (AREA)
  • Computational Linguistics (AREA)
  • General Health & Medical Sciences (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Probability & Statistics with Applications (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

一种特征词提取方法,包括:响应于对目标文本的分词指令,对所述目标文本进行分词,得到分词集合(S101);组合所述分词集合中的各个所述分词,得到若干词组,其中,每个所述词组包括若干所述分词(S102);计算所述词组的第一TF值和TF-IDF值(S103);计算组合所述词组的每个所述分词的第二TF值,得到若干所述第二TF值(S104);利用所述TF-IDF值、所述第一TF值和若干所述第二TF值计算所述词组的概率限定TF-IDF值(S105);选取排列在预定位置之前的所述概率限定TF-IDF值对应的所述词组作为所述目标文本的特征词(S106)。还提供了一种文本相似度计算方法、一种特征词提取装置、一种文本相似度计算装置一种计算机设备和一种计算机可读存储介质。

Description

特征词提取方法、文本相似度计算方法、装置和设备
相关申请的交叉引用
本申请申明享有2019年10月15日递交的申请号为CN201910978967.X、名称为“特征词提取方法、文本相似度计算方法、装置和设备”的中国专利申请的优先权,该中国专利申请的整体内容以参考的方式结合在本申请中。
技术领域
本申请涉及计算机技术领域,具体涉及一种特征词提取方法、文本相似度计算方法、装置、计算机设备和计算机可读存储介质。
背景技术
特征词指的是最能代表文本的主题性和关键性内容的词或短语,其在很多领域都有着非常重要的应用。如,文本对比、文本分类、内容推送和搜索引擎等。但是,在大多数情况下,文本并没有直接给出其对应的特征词,因此提供一种特征词的提取方案非常必要。
然而,申请人在研究本申请的过程中发现,现有技术提供的特征词提取方案的准确性不高。
发明内容
本申请的目的在于提供一种特征词提取方法、文本相似度计算方法、装置、计算机设备和计算机可读存储介质,能够解决上述现有技术中的缺陷。
本申请的一个方面提供了一种特征词提取方法,包括:响应于对目标文本的分词指令,对所述目标文本进行分词,得到分词集合;组合所述分词集合中的各个所述分词,得到若干词组,其中,每个所述词组包括若干所述分词;计算所述词组的第一TF值和TF-IDF值;计算组合所述词组的每个所述分词的第二TF值,得到若干所述第二TF值;利用所述TF-IDF值、所述第一TF值和若干所述第二TF值计算所述词组的概率限定TF-IDF值;选取排列在预定位置之前的所述概率限定TF-IDF值对应的所述词组作为所述目标文本的特征词。
本申请的另一个方面提供了一种文本相似性计算方法,包括:选取目标文本的特征词,其中,所述目标文本的所述特征词是通过特征词提取方法选取的,所述特征词提取方法包括:响应于对所述目标文本的分词指令,对所述目标文本进行分词,得到分词集合;组合所述分词集合中的各个所述分词,得到若干词组,其中,每个所述词组包括若干所述分词;计算所述词组的第一TF值和TF-IDF值;计算组合所述词组的每个所述分词的第二TF值,得到若干所述第二TF值;利用所述TF-IDF值、所述第一TF值和若干所述第二TF值计算所述词组的概率限定TF-IDF值;选取排列在预定位置之前的所述概率限定TF-IDF值对应的所述词组作为所述目标文本的所述特征词;将所述特征词输入第一文本检索库,得到若干第一文本;计算所述目标文本和若干所述第一文本的第一相似度,得到若干所述第一相似度;将若干所述第一相似度中满足第一相似度阈值的第一相似度对应的第一文本作为与所述目标文本相似的文本。
本申请的再一个方面提供了一种特征词提取装置,包括:分词模块,用于响应于对目标文本的分词指令,对所述目标文本进行分词,得到分词集合;组合模块,用于组合所述 分词集合中的各个所述分词,得到若干词组,其中,每个所述词组包括若干所述分词;第一计算模块,用于计算所述词组的第一TF值和TF-IDF值;第二计算模块,用于计算组合所述词组的每个所述分词的第二TF值,得到若干所述第二TF值;第三计算模块,用于利用所述TF-IDF值、所述第一TF值和若干所述第二TF值计算所述词组的概率限定TF-IDF值;第一选取模块,用于选取排列在预定位置之前的所述概率限定TF-IDF值对应的所述词组作为所述目标文本的特征词。
本申请的又一个方面提供了一种文本相似性计算装置,包括:第二选取模块,用于选取目标文本的特征词,其中,所述目标文本的所述特征词是通过特征词提取方法选取的,所述特征词提取方法包括:响应于对所述目标文本的分词指令,对所述目标文本进行分词,得到分词集合;组合所述分词集合中的各个所述分词,得到若干词组,其中,每个所述词组包括若干所述分词;计算所述词组的第一TF值和TF-IDF值;计算组合所述词组的每个所述分词的第二TF值,得到若干所述第二TF值;利用所述TF-IDF值、所述第一TF值和若干所述第二TF值计算所述词组的概率限定TF-IDF值;选取排列在预定位置之前的所述概率限定TF-IDF值对应的所述词组作为所述目标文本的所述特征词;第一输入模块,用于将所述特征词输入第一文本检索库,得到若干第一文本;第四计算模块,用于计算所述目标文本和若干所述第一文本的第一相似度,得到若干所述第一相似度;第一确定模块,用于将若干所述第一相似度中满足第一相似度阈值的第一相似度对应的第一文本作为与所述目标文本相似的文本。
本申请的又一个方面提供了一种计算机设备,该计算机设备包括:存储器、处理器以及存储在上述存储器上并可在上述处理器上运行的计算机程序,上述处理器执行上述计算机程序时实现以下步骤:响应于对目标文本的分词指令,对所述目标文本进行分词,得到分词集合;组合所述分词集合中的各个所述分词,得到若干词组,其中,每个所述词组包括若干所述分词;计算所述词组的第一TF值和TF-IDF值;计算组合所述词组的每个所述分词的第二TF值,得到若干所述第二TF值;利用所述TF-IDF值、所述第一TF值和若干所述第二TF值计算所述词组的概率限定TF-IDF值;选取排列在预定位置之前的所述概率限定TF-IDF值对应的所述词组作为所述目标文本的特征词。
本申请的又一个方面提供了一种计算机可读存储介质,其上存储有计算机程序,上述计算机程序被处理器执行时实现以下步骤:响应于对目标文本的分词指令,对所述目标文本进行分词,得到分词集合;组合所述分词集合中的各个所述分词,得到若干词组,其中,每个所述词组包括若干所述分词;计算所述词组的第一TF值和TF-IDF值;计算组合所述词组的每个所述分词的第二TF值,得到若干所述第二TF值;利用所述TF-IDF值、所述第一TF值和若干所述第二TF值计算所述词组的概率限定TF-IDF值;选取排列在预定位置之前的所述概率限定TF-IDF值对应的所述词组作为所述目标文本的特征词。
本申请的又一个方面提供了一种计算机设备,该计算机设备包括:存储器、处理器以及存储在上述存储器上并可在上述处理器上运行的计算机程序,上述处理器执行上述计算机程序时实现以下步骤:选取目标文本的特征词,其中,所述目标文本的所述特征词是通过特征词提取方法选取的,所述特征词提取方法包括:响应于对所述目标文本的分词指令,对所述目标文本进行分词,得到分词集合;组合所述分词集合中的各个所述分词,得到若干词组,其中,每个所述词组包括若干所述分词;计算所述词组的第一TF值和TF-IDF值;计算组合所述词组的每个所述分词的第二TF值,得到若干所述第二TF值;利用所述TF-IDF 值、所述第一TF值和若干所述第二TF值计算所述词组的概率限定TF-IDF值;选取排列在预定位置之前的所述概率限定TF-IDF值对应的所述词组作为所述目标文本的所述特征词;将所述特征词输入第一文本检索库,得到若干第一文本;计算所述目标文本和若干所述第一文本的第一相似度,得到若干所述第一相似度;将若干所述第一相似度中满足第一相似度阈值的第一相似度对应的第一文本作为与所述目标文本相似的文本。
本申请的又一个方面提供了一种计算机可读存储介质,其上存储有计算机程序,上述计算机程序被处理器执行时实现以下步骤:选取目标文本的特征词,其中,所述目标文本的所述特征词是通过特征词提取方法选取的,所述特征词提取方法包括:响应于对所述目标文本的分词指令,对所述目标文本进行分词,得到分词集合;组合所述分词集合中的各个所述分词,得到若干词组,其中,每个所述词组包括若干所述分词;计算所述词组的第一TF值和TF-IDF值;计算组合所述词组的每个所述分词的第二TF值,得到若干所述第二TF值;利用所述TF-IDF值、所述第一TF值和若干所述第二TF值计算所述词组的概率限定TF-IDF值;选取排列在预定位置之前的所述概率限定TF-IDF值对应的所述词组作为所述目标文本的所述特征词;将所述特征词输入第一文本检索库,得到若干第一文本;计算所述目标文本和若干所述第一文本的第一相似度,得到若干所述第一相似度;将若干所述第一相似度中满足第一相似度阈值的第一相似度对应的第一文本作为与所述目标文本相似的文本。
本申请提供了一种特征词提取方法,通过将分词组合成词组,再利用改进的TF-IDF算法计算词组的概率限定TF-IDF值,不仅考虑了词组的关联度,该考虑了词组与组成该词组的分词之间的关联度,进一步,由于长词的表达能力大于短词的表达能力,选取排列靠前的词组作为特征词,使得选取的词组代表性够强,也即提高了选取特征词的准确度。
本申请提供了一种文本相似度计算方法,通过上述特征词提取方法选取出目标文本的特征词,然后基于特征词检索出若干第一文本,对于检索出若干第一文本以及从若干第一文本中确定出与目标文本相似的文本这一过程,由于选取的特征词具有足够的代表性,因此利用这些词组检索出若干第一文本也与目标文本足够相似,进而从这些第一文本中确定出的与目标文本相似的文本也足够准确。
附图说明
通过阅读下文优选实施方式的详细描述,各种其他的优点和益处对于本领域普通技术人员将变得清楚明了。附图仅用于示出优选实施方式的目的,而并不认为是对本申请的限制。而且在整个附图中,用相同的参考符号表示相同的部件。在附图中:
图1示意性示出了根据本申请实施例一的特征词提取方法的流程图;
图2示意性示出了根据本申请实施例二的文本相似度计算方法的流程图;
图3示意性示出了根据本申请实施例三的文本相似度计算方法的流程图;
图4示意性示出了根据本申请实施例四的文本相似度计算方法的流程图;
图5示意性示出了根据本申请实施例五的特征词提取装置的框图;
图6示意性示出了根据本申请实施例六的文本相似度计算装置的框图;
图7示意性示出了根据本申请实施例七的适于实现的特征词提取方法或文本相似度计算方法的计算机设备的框图。
具体实施方式
为了使本申请的目的、技术方案及优点更加清楚明白,以下结合附图及实施例,对本申请进行进一步详细说明。应当理解,此处所描述的具体实施例仅用以解释本申请,并不用于限定本申请。基于本申请中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其他实施例,都属于本申请保护的范围。
需要说明的是,在本文中,术语“包括”、“包含”或者其任何其他变体意在涵盖非排他性的包含,从而使得包括一系列要素的过程、方法、物品或者装置不仅包括那些要素,而且还包括没有明确列出的其他要素,或者是还包括为这种过程、方法、物品或者装置所固有的要素。在没有更多限制的情况下,由语句“包括一个……”限定的要素,并不排除在包括该要素的过程、方法、物品或者装置中还存在另外的相同要素。
实施例一
本申请的实施例一提供了一种特征词提取方法,该特征词提取方法用于利用改进的TF-IDF算法提取目标文本的特征词。具体地,图1示意性示出了根据本申请实施例一的特征词提取方法的流程图。如图1所示,该特征词提取方法可以包括步骤S101~步骤S106,其中:
步骤S101,响应于对目标文本的分词指令,对目标文本进行分词,得到分词集合。
其中,目标文本可以是任意文本,如论文、专利或技术文章等。一个分词可以是一个字或一个词语,比如一个分词为“最”,再比如一个分词为“相似”。
一个方案为:分词集合包括组成目标文本的所有分词。
例如,目标文本为“北京欢迎你的到来”,通过执行步骤S101可以得到分词集合为“北京欢迎你的到来”。
另一个方案为:分词集合包括组成目标文本的部分分词。如,步骤S101可以包括步骤S1011和步骤S1012,其中:
步骤S1011,对目标文本进行分词,得到组成目标文本的所有分词;
步骤S1012,清洗所有的分词,得到分词集合。
具体地,在对该目标文本进行分词处理以得到组成该目标文本的所有分词之后,可以进一步的清洗这些分词,以去除无用的分词,如去除“你”、“我”、“他”、“它”、“的”等词,进而将清洗后剩余的分词作为分词集合。
例如,结合上述示例,对目标文本进行分词后得到“北京欢迎你的到来”,清洗这些分词去除“北京”,则可以得到分词集合为“欢迎你的到来”。
需要说明的是,为了保证分词之间的连贯性,在执行步骤S1012时,优选去除位于句首和句尾的分词,对于位于句子中间的分词不做清洗处理。
步骤S102,组合分词集合中的各个分词,得到若干词组,其中,每个词组包括若干分词。
其中,可以通过n-gram算法对分词集合中的各个分词进行组合,且相邻的两个词组包括的若干分词之间有重叠。
例如,结合上述示例,若n-gram算法为2-gram算法,则执行步骤S102可以得到“北京欢迎欢迎你的你的到来”;若n-gram算法为3-gram算法,则执行步骤S102可以得到“北京欢迎你的欢迎你的到来”。
在得到词组之后,需要利用改进的TF-IDF(term frequency–inverse document frequency,词频-逆文本频率)算法计算每一个词组的概率限定TF-IDF值,其中,下述步骤S103~步骤S105针对的是利用改进的TF-IDF算法计算其中一个词组的概率限定TF-IDF值的过程,利用改进的TF-IDF算法计算其他词组的概率限定TF-IDF值的过程相同,本实施例不再赘述。
步骤S103,计算词组的第一TF值和TF-IDF值。
其中,TF-IDF算法的核心思想为:如果某个词语在一篇文章中出现的频率高,并且在其他文章中很少出现,则认为该词语具有很好的类别区分能力,适合用来表征该篇文章。本实施例中,计算任一词组的TF-IDF值的公式如下:
Figure PCTCN2019117401-appb-000001
其中,W i,j表征第i个词组在目标文本j中的TF-IDF值,
Figure PCTCN2019117401-appb-000002
表征第i个词组在目标文本j中的第一TF(term frequency,词频)值,n i表征第i个词组在目标文本j中出现的次数,n j表征目标文本j中分词和词组的总个数,log(N/df i)表征第i个词组在文本集合中的IDF(inverse document frequency,逆文本频率)值,N表征文本集合中的文本总个数,df i表征文本集合中出现第i个词组的文本个数。此处需要说明的是,在本实施例中,文本集合可以组成一个文本检索库,用于后续检索出与目标文本的相似文本。
步骤S104,计算组合词组的每个分词的第二TF值,得到若干第二TF值。
本实施例中,需要计算组成该词组的每个分词的第二TF值,其中,本实施例针对的是计算其中一个分词的TF值的过程,计算其他分词的TF值的过程相同,本实施例不再赘述。具体地,可以确定目标文本包括的分词和词组的总个数,确定该分词在目标文本中出现次数,将分词在目标文本中出现次数与分词和词组的总个数的比值作为第二TF值。
例如,第i个词组包括两个分词,第i个词组中第一个分词在目标文本j中的第二TF值可以为
Figure PCTCN2019117401-appb-000003
其中,
Figure PCTCN2019117401-appb-000004
表征第i个词组中第一个分词在目标文本j中出现的次数;第i个词组中第二个分词在目标文本j中的第二TF值可以为
Figure PCTCN2019117401-appb-000005
其中,
Figure PCTCN2019117401-appb-000006
表征第i个词组中第二个分词在目标文本j中出现的次数。
需要说明的是,为了满足归一化,无论是计算词组的第一TF值,还是计算分词的第二TF值,TF值中的分母n j均相同,如可以表示为目标文本j中分词和词组的总个数。
步骤S105,利用TF-IDF值、第一TF值和若干第二TF值计算词组的概率限定TF-IDF值。
具体地,步骤S105可以包括步骤S1051~步骤S1053,其中:
步骤S1051,计算若干第二TF值的乘积,得到TF乘积;
步骤S1052,计算第一TF值和TF乘积的比值,得到词组概率值;
步骤S1053,利用TF-IDF值和词组概率值计算概率限定TF-IDF值。
本实施例中,可以将第一TF值和TF乘积的比值作为词组概率值,其中,词组概率值越大表明该词组的代表性越强。进一步,执行步骤S1053,得到词组的概率限定TF-IDF值,其中,概率限定TF-IDF值越大,表明该词组分类能力越强。
可选地,步骤S1053可以包括如下方案:
方案一:对TF-IDF值和词组概率值的求和结果作为概率限定TF-IDF值。
方案二:将TF-IDF值和词组概率值的乘积作为概率限定TF-IDF值。如,结合上述示 例,假设词组包括两个分词,则方案二的公式为:
Figure PCTCN2019117401-appb-000007
Figure PCTCN2019117401-appb-000008
其中,W′ i,j表征第i个词组在目标文本j中的概率限定TF-IDF值,nf i,j表征第i个词组在目标文本j中的词组概率值。
步骤S106,选取排列在预定位置之前的概率限定TF-IDF值对应的词组作为目标文本的特征词。
在计算完所有词组在目标文本的概率限定TF-IDF值之后,将这些概率限定TF-IDF值排序,确定排列在预定位置之前的概率限定TF-IDF值,从所有的词组中选取与上一步确定的概率限定TF-IDF值对应的词组作为特征词,例如选取TOP50的概率限定TF-IDF值对应的词组作为特征词。
实施例二
本申请的实施例二提供了一种文本相似度计算方法,该文本相似度计算方法的部分步骤与上述实施例一中的步骤对应相同,这部分步骤在本实施例二中不再赘述,具体可参考上述实施例一。具体地,图2示意性示出了根据本申请实施例二的文本相似度计算方法的流程图。如图2所示,该文本相似度计算方法可以包括步骤S201~步骤S204,其中:
步骤S201,选取目标文本的特征词,其中,目标文本的特征词是通过实施例一所述的方法选取的。
具体地,实施例一所述的特征词提取方法包括:响应于对所述目标文本的分词指令,对所述目标文本进行分词,得到分词集合;组合所述分词集合中的各个所述分词,得到若干词组,其中,每个所述词组包括若干所述分词;计算所述词组的第一TF值和TF-IDF值;计算组合所述词组的每个所述分词的第二TF值,得到若干所述第二TF值;利用所述TF-IDF值、所述第一TF值和若干所述第二TF值计算所述词组的概率限定TF-IDF值;选取排列在预定位置之前的所述概率限定TF-IDF值对应的所述词组作为所述目标文本的所述特征词。其中,实施例一所述的特征词提取方法中利用TF-IDF值、第一TF值和若干第二TF值计算词组的概率限定TF-IDF值的步骤可以包括:计算若干第二TF值的乘积,得到TF乘积;计算第一TF值和TF乘积的比值,得到词组概率值;利用TF-IDF值和词组概率值计算概率限定TF-IDF值。
步骤S202,将特征词输入第一文本检索库,得到若干第一文本。
本实施例中,第一文本检索库通过文本集合构成,且第一文本检索库具备检索功能,通过将特征词输入第一文本检索库,可以检索出涵盖全部或部分特征词的若干第一文本,其中,文本集合包括这些第一文本。
步骤S203,计算目标文本和若干第一文本的第一相似度,得到若干第一相似度。
本实施例中,计算目标文本和每一个第一文本的第一相似度,其中,第一相似度的计算方式不做限定,如可以采用现有技术中的欧氏距离和或者余弦相似得到。
步骤S204,将若干第一相似度中满足第一相似度阈值的第一相似度对应的第一文本作 为与目标文本相似的文本。
预先设定相似度阈值,从若干第一相似度中确定出满足第一相似度阈值的第一相似度,进一步,将若干第一文本中与确定的第一相似度对应的第一文本作为与目标文本相似的文本,其中,存在一个或多个与目标文本相似的第三文本。
实施例三
本申请的实施例三提供了一种文本相似度计算方法,该文本相似度计算方法的部分步骤与上述实施例一和实施例二中的步骤对应相同,这部分步骤在本实施例三中不再赘述,具体可参考上述实施例一和实施例二。具体地,图3示意性示出了根据本申请实施例三的文本相似度计算方法的流程图。如图3所示,该文本相似度计算方法可以包括步骤S301~步骤S307,其中:
步骤S301,选取目标文本的特征词,其中,目标文本的特征词是通过实施例一所述的方法选取的。
步骤S302,将特征词输入第一文本检索库,得到若干第一文本。
步骤S303,对特征词进行扩展,得到扩展词组集合,其中,扩展词组集合包括特征词和特征词的近义词。
具体地,可以预先构建近义词库,该近义词库中包括多关联关系,每条关联关系包括多个意思相近的词语。如,某条关联关系为:识别、检测、获取。通过近义词库对特征词进行扩展,可以得到扩展词组集合。
步骤S304,将扩展词组集合输入第一文本检索库,得到若干第二文本。
在本实施例中,通过将扩展词组集合输入第一文本检索库,可以检索出涵盖全部或部分扩展词组集合的若干第二文本,其中,文本集合还包括这些第二文本。
步骤S305,对若干第一文本和若干第二文本取并集,得到若干第三文本。
为了保证能够准确确定出与目标文本相似的文本,希望与目标文本进行相似度比较的文本越多越好,因此,对于检索出的所有第一文本和所有第二文本,可以取二者的并集,得到若干第三文本。
步骤S306,计算目标文本和若干第三文本的第二相似度,得到若干第二相似度。
本实施例,计算目标文本和每一个第三文本的第二相似度,其中,第二相似度的计算方式不做限定,如可以采用现有技术中的欧氏距离和或者余弦相似得到。
步骤S307,将若干第二相似度中满足第二相似度阈值的第二相似度对应的第三文本作为与目标文本相似的文本。
从若干第二相似度中确定出满足第二相似度阈值的第二相似度,进一步,将若干第三文本中与确定的第二相似度对应的第三文本作为与目标文本相似的文本,其中,存在一个或多个与目标文本相似的第三文本。
通过本公开的实施例,由于相似的文字表达意义也十分近似,因此可以将特征词或者与特征词中的分词近似的词补充进来,形成扩展词组集合,再利用扩展词组集合检索出若干第二文本,可以扩大筛选的范围。同时,由于这些第二文本和上述第一文本之间可能存在重叠,因此可以取二者的并集,得到若干第三文本,进而从这些第三文本中确定出与目标文本相似的文本,进一步提高了确定相似文本的准确度。
实施例四
本申请的实施例四提供了一种文本相似度计算方法,该文本相似度计算方法的部分步骤与上述实施例一和实施例二中的步骤对应相同,这部分步骤在本实施例四中不再赘述,具体可参考上述实施例一和实施例二。具体地,图4示意性示出了根据本申请实施例四的文本相似度计算方法的流程图。如图4所示,该文本相似度计算方法可以包括步骤S401~步骤S407,其中:
步骤S401,选取目标文本的特征词,其中,目标文本的特征词是通过实施例一所述的方法选取的。
步骤S402,将特征词输入第一文本检索库,得到若干第一文本。
步骤S403,获取预先建立的知识图谱,其中,针对每个第一文本,知识图谱包括:引用第一文本的若干第四文本、与第一文本同族的若干第五文本、以及若干第六文本和每个第六文本与第一文本的第三相似度。
其中,针对每一个第一文本,若干第六文本可以是将该第一文本的特征词输入第二文本检索库中得到的,提取第一文本的特征词的方法可以与提取目标文本的方法一致,此处不再赘述。
需要说明的时是,在应用本实施例的方案之前,该文本相似度计算方法还包括:
构建知识图谱;
其中,构建知识图谱的步骤包括:
针对每个第一文本,获取若干第四文本,并将若干第四文本中每个第四文本和第一文本的关联关系构建在知识图谱中;
针对每个第一文本,获取若干第五文本,并将若干第五文本中每个第五文本和第一文本的关联关系构建在知识图谱中;
针对每个第一文本,提取第一文本的特征词输入第二文本检索库,得到若干第六文本,计算第一文本与若干第六文本中每个第六文本的第三相似度,并将第一文本、若干第六文本中的每个第六文本和第三相似度的关联关系构建在知识图谱中。
例如,本实施例中的文本为专利文本,对于每个第一文本,可能存在引用该第一文本的若干第四文本,也可能存在以该第一文本属于同族的若干第五文本,可以将每个第四文本和第一文本的关联关系,以及每个第五文本和第一文本的关联关系构建在知识图谱中;另外,对于每个第一文本,还可以通过第二检索库得到若干第六文本,并计算每个第六文本与第一文本的第三相似度,然后将每个第一文本、每个第六文本和第三相似度的关联关系构建在知识图谱中。即,针对每个第一文本而言,知识图谱中包括:若干第四文本、若干第五文本、以及若干第六文本和每个第六文本与第一文本的第三相似度。需要说明的是,知识图谱中可以包括所有第一文本对应的上述关联关系。
可选地,计算第一文本与若干第六文本中每个第六文本的第三相似度的步骤包括:计算第一文本的特征词和每个第六文本的特征词的相似度;和/或计算第一文本的文本词向量和每个第六文本的文本词向量的相似度;和/或计算第一文本的IPC分类号和每个第六文本的IPC分类号的相似度。
方案一,计算第一文本的特征词和每个第六文本的特征词的相似度。具体地,利用改进的TF-IDF算法提取第一文本的特征词,利用改进的TF-IDF算法提取第六文本的特征词,计算特征词的相似度。
方案二,计算第一文本的文本词向量和每个第六文本的文本词向量的相似度。具体地,可以利用gensim工具计算文本词向量的相似度。
方案三,计算第一文本的IPC分类号和每个第六文本的IPC分类号的相似度。具体地,可以是统计第一文本的IPC分类号和第六文本的IPC分类号相同序号的数量,将相同序号的数量除以所有序号的数量作为IPC分类号的相似度。
其中,在计算第一文本与若干第六文本中每个第六文本的第三相似度的步骤只包括上述任意一种方案时,每种方案计算出的相似度即为第三相似度。在计算第一文本与若干第六文本中每个第六文本的第三相似度的步骤包括上述任意两种或三种方案时,对每个方案的相似度设置权重,根据权重和每个方案的相似度计算出第三相似度。
如,在计算第一文本与若干第六文本中每个第六文本的第三相似度的步骤包括方案一、方案二和方案三,其中,方案一的权重为Q1,以及相似度为S1,方案二的权重为Q2,以及相似度为S2,方案三的权重为Q3,以及相似度为S3,则第三相似度为Q1*S1+Q2*S2+Q3*S3。
步骤S404,针对每个第一文本,从知识图谱中确定出若干第四文本、若干第五文本以及若干第七文本,其中,每个第七文本为若干第六文本中满足第三相似度阈值的第三相似度对应的文本。
步骤S405,将若干第一文本、若干第四文本、若干第五文本和若干第七文本作为扩展文本集。
为了避免通过第一文本检索库检索到的文本可能不全面的情况,本实施例对检索到的若干第一文本进行扩展,得到扩展文本集,然后执行步骤S406。
步骤S406,计算目标文本和扩展文本集中每个文本的第四相似度,得到若干第四相似度。
具体地,可以计算目标文本和扩展文本集中除所有第七文本之外的每个文本的第四相似度,其中,第四相似度的计算方式不做限定,如可以采用现有技术中的欧氏距离和或者余弦相似得到,然后可以将每一个第七文本的第三相似度在此步骤也称为第四相似度。
步骤S407,将扩展文本集中满足第四相似度阈值的第四相似度对应的文本作为与目标文本相似的文本。
从所有的第四相似度中确定出满足第四相似度阈值的第四相似度,进一步,将扩展文本集中与确定的第四似度对应的文本作为与目标文本相似的文本,其中,存在一个或多个与目标文本相似的文本,每个与目标文本相似的文本可能为第四文本、第五文本或者第七文本。
实施例五
本申请的实施例五还提供了一种特征词提取装置,该特征词提取装置与上述实施例一提供的特征词提取方法相对应,相应的技术特征和技术效果在本实施例五中不再详述,相关之处可参考上述实施例。具体地,图5示意性示出了根据本申请实施例五的特征词提取装置的框图。如图5所示,该特征词提取装置可以包括分词模块501、组合模块502、第一计算模块503、第二计算模块504、第三计算模块505和第一选取模块506,其中:
分词模块501,用于响应于对目标文本的分词指令,对目标文本进行分词,得到分词集合;
组合模块502,用于组合分词集合中的各个分词,得到若干词组,其中,每个词组包括若干分词;
第一计算模块503,用于计算词组的第一TF值和TF-IDF值;
第二计算模块504,用于计算组合词组的每个分词的第二TF值,得到若干第二TF值;
第三计算模块505,用于利用TF-IDF值、第一TF值和若干第二TF值计算词组的概率限定TF-IDF值;
第一选取模块506,用于选取排列在预定位置之前的概率限定TF-IDF值对应的词组作为目标文本的特征词。
可选地,分词模块还用于:对目标文本进行分词,得到组成目标文本的所有分词;清洗所有的分词,得到分词集合。
可选地,第三计算模块还用于:计算若干第二TF值的乘积,得到TF乘积;计算第一TF值和TF乘积的比值,得到词组概率值;利用TF-IDF值和词组概率值计算概率限定TF-IDF值。
实施例六
本申请的实施例六提供了一种文本相似度计算装置,该文本相似度计算装置与上述实施例二提供的文本相似度计算方法相对应,相应的技术特征和技术效果在本实施例六中不再详述,相关之处可参考上述实施例。具体地,图6示意性示出了根据本申请实施例六的文本相似度计算装置的框图。如图6所示,该文本相似度计算装置可以包括第二选取模块601、第一输入模块602、第四计算模块603和第一确定模块604,其中:
第二选取模块601,用于选取目标文本的特征词,其中,目标文本的特征词是通过实施例一所述的方法选取的;
第一输入模块602,用于将特征词输入第一文本检索库,得到若干第一文本;
第四计算模块603,用于计算目标文本和若干第一文本的第一相似度,得到若干第一相似度;
第一确定模块604,用于将若干第一相似度中满足第一相似度阈值的第一相似度对应的第一文本作为与目标文本相似的文本。
可选地,文本相似度计算装置还包括:扩展模块,用于在将特征词输入第一文本检索库,得到若干第一文本的步骤之后,对特征词进行扩展,得到扩展词组集合,其中,扩展词组集合包括特征词和特征词的近义词;第二输入模块,用于将扩展词组集合输入第一文本检索库,得到若干第二文本;处理模块,用于对若干第一文本和若干第二文本取并集,得到若干第三文本;第四计算模块还用于:计算目标文本和若干第三文本的第二相似度,得到若干第二相似度;第一确定模块还用于:将若干第二相似度中满足第二相似度阈值的第二相似度对应的第三文本作为与目标文本相似的文本。
可选地,文本相似度计算装置还包括:获取模块,用于在将特征词输入第一文本检索库,得到若干第一文本的步骤之后,获取预先建立的知识图谱,其中,针对每个第一文本,知识图谱包括:引用第一文本的若干第四文本、与第一文本同族的若干第五文本、以及若干第六文本和每个第六文本与第一文本的第三相似度;第二确定模块,用于针对每个第一文本,从知识图谱中确定出若干第四文本、若干第五文本以及若干第七文本,其中,每个第七文本为若干第六文本中满足第三相似度阈值的第三相似度对应的文本;第三确定模块, 用于将若干第一文本、若干第四文本、若干第五文本和若干第七文本作为扩展文本集;第四计算模块还用于:计算目标文本和扩展文本集中每个文本的第四相似度,得到若干第四相似度;第一确定模块还用于:将扩展文本集中满足第四相似度阈值的第四相似度对应的文本作为与目标文本相似的文本。
可选地,文本相似度计算装置还包括:构建模块,用于在获取预先建立的知识图谱的步骤之前,构建知识图谱;其中,构建模块还用于:针对每个第一文本,获取若干第四文本,并将若干第四文本中每个第四文本和第一文本的关联关系构建在知识图谱中;针对每个第一文本,获取若干第五文本,并将若干第五文本中每个第五文本和第一文本的关联关系构建在知识图谱中;针对每个第一文本,提取第一文本的特征词输入第二文本检索库,得到若干第六文本,计算第一文本与若干第六文本中每个第六文本的第三相似度,并将第一文本、若干第六文本中的每个第六文本和第三相似度的关联关系构建在知识图谱中。
可选地,构建模块在计算第一文本与若干第六文本中每个第六文本的第三相似度时,还用于:计算第一文本的特征词和每个第六文本的特征词的相似度;和/或计算第一文本的文本词向量和每个第六文本的文本词向量的相似度;和/或计算第一文本的IPC分类号和每个第六文本的IPC分类号的相似度。
实施例七
图7示意性示出了根据本申请实施例七的适于实现的特征词提取方法或文本相似度计算方法的计算机设备的框图。本实施例中,计算机设备700可以是执行程序的智能手机、平板电脑、笔记本电脑、台式计算机、机架式服务器、刀片式服务器、塔式服务器或机柜式服务器(包括独立的服务器,或者多个服务器所组成的服务器集群)等。如图7所示,本实施例的计算机设备700至少包括但不限于:可通过系统总线相互通信连接的存储器701、处理器702、网络接口703。需要指出的是,图7仅示出了具有组件701-703的计算机设备700,但是应理解的是,并不要求实施所有示出的组件,可以替代的实施更多或者更少的组件。
本实施例中,存储器703至少包括一种类型的计算机可读存储介质,可读存储介质包括包括闪存、硬盘、多媒体卡、卡型存储器(例如,SD或DX存储器等)、随机访问存储器(RAM)、静态随机访问存储器(SRAM)、只读存储器(ROM)、电可擦除可编程只读存储器(EEPROM)、可编程只读存储器(PROM)、磁性存储器、磁盘、光盘等。在一些实施例中,存储器701可以是计算机设备700的内部存储单元,例如该计算机设备700的硬盘或内存。在另一些实施例中,存储器701也可以是计算机设备700的外部存储设备,例如该计算机设备700上配备的插接式硬盘,智能存储卡(Smart Media Card,SMC),安全数字(Secure Digital,SD)卡,闪存卡(Flash Card)等。当然,存储器701还可以既包括计算机设备700的内部存储单元也包括其外部存储设备。在本实施例中,存储器701通常用于存储安装于计算机设备700的操作系统和各类应用软件,例如特征词提取方法的程序代码或文本相似度计算方法的程序代码等。此外,存储器701还可以用于暂时地存储已经输出或者将要输出的各类数据。
处理器702在一些实施例中可以是中央处理器(Central Processing Unit,CPU)、控制器、微控制器、微处理器、或其他数据处理芯片。该处理器702通常用于控制计算机设备700的总体操作。例如执行与计算机设备700进行数据交互或者通信相关的控制和处理等 的特征词提取方法的程序代码或文本相似度计算方法的程序代码。
在本实施例中,存储于存储器701中的特征词提取方法或文本相似度计算方法还可以被分割为一个或者多个程序模块,并由一个或多个处理器(本实施例为处理器702)所执行,以完成本申请。
网络接口703可包括无线网络接口或有线网络接口,该网络接口703通常用于在计算机设备700与其他计算机设备之间建立通信链接。例如,网络接口703用于通过网络将计算机设备700与外部终端相连,在计算机设备700与外部终端之间的建立数据传输通道和通信链接等。网络可以是企业内部网(Intranet)、互联网(Internet)、全球移动通讯系统(Global System of Mobile communication,简称为GSM)、宽带码分多址(Wideband Code Division Multiple Access,简称为WCDMA)、4G网络、5G网络、蓝牙(Bluetooth)、Wi-Fi等无线或有线网络。
实施例八
本实施例还提供一种计算机可读存储介质,包括闪存、硬盘、多媒体卡、卡型存储器(例如,SD或DX存储器等)、随机访问存储器(RAM)、静态随机访问存储器(SRAM)、只读存储器(ROM)、电可擦除可编程只读存储器(EEPROM)、可编程只读存储器(PROM)、磁性存储器、磁盘、光盘、服务器、App应用商城等,其上存储有计算机程序,所述计算机程序被处理器执行时实现特征词提取方法或文本相似度计算方法。所述计算机可读存储介质可以是非易失性计算机可读存储介质。
显然,本领域的技术人员应该明白,上述的本申请实施例的各模块或各步骤可以用通用的计算装置来实现,它们可以集中在单个的计算装置上,或者分布在多个计算装置所组成的网络上,可选地,它们可以用计算装置可执行的程序代码来实现,从而,可以将它们存储在存储装置中由计算装置来执行,并且在某些情况下,可以以不同于此处的顺序执行所示出或描述的步骤,或者将它们分别制作成各个集成电路模块,或者将它们中的多个模块或步骤制作成单个集成电路模块来实现。这样,本申请实施例不限制于任何特定的硬件和软件结合。
上述本申请实施例序号仅仅为了描述,不代表实施例的优劣。
通过以上的实施方式的描述,本领域的技术人员可以清楚地了解到上述实施例方法可借助软件加必需的通用硬件平台的方式来实现,当然也可以通过硬件,但很多情况下前者是更佳的实施方式。
以上仅为本申请的优选实施例,并非因此限制本申请的专利范围,凡是利用本申请说明书及附图内容所作的等效结构或等效流程变换,或直接或间接运用在其他相关的技术领域,均同理包括在本申请的专利保护范围内。

Claims (20)

  1. 一种特征词提取方法,其中,包括:
    响应于对目标文本的分词指令,对所述目标文本进行分词,得到分词集合;
    组合所述分词集合中的各个所述分词,得到若干词组,其中,每个所述词组包括若干所述分词;
    计算所述词组的第一TF值和TF-IDF值;
    计算组合所述词组的每个所述分词的第二TF值,得到若干所述第二TF值;
    利用所述TF-IDF值、所述第一TF值和若干所述第二TF值计算所述词组的概率限定TF-IDF值;
    选取排列在预定位置之前的所述概率限定TF-IDF值对应的所述词组作为所述目标文本的特征词。
  2. 根据权利要求1所述的方法,其中,利用所述TF-IDF值、所述第一TF值和若干所述第二TF值计算所述词组的概率限定TF-IDF值的步骤包括:
    计算若干所述第二TF值的乘积,得到TF乘积;
    计算所述第一TF值和所述TF乘积的比值,得到词组概率值;
    利用所述TF-IDF值和所述词组概率值计算所述概率限定TF-IDF值。
  3. 一种文本相似度计算方法,其中,包括:
    选取目标文本的特征词,其中,所述目标文本的所述特征词是通过特征词提取方法选取的,所述特征词提取方法包括:响应于对所述目标文本的分词指令,对所述目标文本进行分词,得到分词集合;组合所述分词集合中的各个所述分词,得到若干词组,其中,每个所述词组包括若干所述分词;计算所述词组的第一TF值和TF-IDF值;计算组合所述词组的每个所述分词的第二TF值,得到若干所述第二TF值;利用所述TF-IDF值、所述第一TF值和若干所述第二TF值计算所述词组的概率限定TF-IDF值;选取排列在预定位置之前的所述概率限定TF-IDF值对应的所述词组作为所述目标文本的所述特征词;
    将所述特征词输入第一文本检索库,得到若干第一文本;
    计算所述目标文本和若干所述第一文本的第一相似度,得到若干所述第一相似度;
    将若干所述第一相似度中满足第一相似度阈值的第一相似度对应的第一文本作为与所述目标文本相似的文本。
  4. 根据权利要求3所述的方法,其中,在所述将所述特征词输入第一文本检索库,得到若干第一文本的步骤之后,所述方法还包括:
    对所述特征词进行扩展,得到扩展词组集合,其中,所述扩展词组集合包括所述特征词和所述特征词的近义词;
    将所述扩展词组集合输入所述第一文本检索库,得到若干第二文本;
    对若干所述第一文本和若干所述第二文本取并集,得到若干第三文本;
    所述计算所述目标文本和若干所述第一文本的第一相似度,得到若干所述第一相似度的步骤包括:计算所述目标文本和若干所述第三文本的第二相似度,得到若干所述第二相似度;
    所述将若干所述第一相似度中满足第一相似度阈值的第一相似度对应的第一文本作为与所述目标文本相似的文本的步骤包括:将若干所述第二相似度中满足第二相似度阈值的 第二相似度对应的第三文本作为与所述目标文本相似的文本。
  5. 根据权利要求3所述的方法,其中,在所述将所述特征词输入第一文本检索库,得到若干第一文本的步骤之后,所述方法还包括:
    获取预先建立的知识图谱,其中,针对每个所述第一文本,所述知识图谱包括:引用所述第一文本的若干第四文本、与所述第一文本同族的若干第五文本、以及若干第六文本和每个所述第六文本与所述第一文本的第三相似度;
    针对每个所述第一文本,从所述知识图谱中确定出若干所述第四文本、若干所述第五文本以及若干第七文本,其中,每个所述第七文本为若干所述第六文本中满足第三相似度阈值的第三相似度对应的文本;
    将若干所述第一文本、若干所述第四文本、若干所述第五文本和若干所述第七文本作为扩展文本集;
    所述计算所述目标文本和若干所述第一文本的第一相似度,得到若干所述第一相似度的步骤包括:计算所述目标文本和所述扩展文本集中每个文本的第四相似度,得到若干所述第四相似度;
    所述将若干所述第一相似度中满足第一相似度阈值的第一相似度对应的第一文本作为与所述目标文本相似的文本的步骤包括:将扩展文本集中满足第四相似度阈值的第四相似度对应的文本作为与所述目标文本相似的文本。
  6. 根据权利要求5所述的方法,其中,在所述获取预先建立的知识图谱的步骤之前,所述方法还包括:
    构建所述知识图谱;
    其中,所述构建所述知识图谱的步骤包括:
    针对每个所述第一文本,获取若干所述第四文本,并将若干所述第四文本中每个所述第四文本和所述第一文本的关联关系构建在所述知识图谱中;
    针对每个所述第一文本,获取若干所述第五文本,并将若干所述第五文本中每个所述第五文本和所述第一文本的关联关系构建在所述知识图谱中;
    针对每个所述第一文本,提取所述第一文本的特征词输入第二文本检索库,得到若干所述第六文本,计算所述第一文本与若干所述第六文本中每个所述第六文本的第三相似度,并将所述第一文本、若干所述第六文本中的每个所述第六文本和所述第三相似度的关联关系构建在所述知识图谱中。
  7. 根据权利要求6所述的方法,其中,所述计算所述第一文本与若干所述第六文本中每个所述第六文本的第三相似度的步骤包括:
    计算所述第一文本的特征词和每个所述第六文本的特征词的相似度;和/或
    计算所述第一文本的文本词向量和每个所述第六文本的文本词向量的相似度;和/或
    计算所述第一文本的IPC分类号和每个所述第六文本的IPC分类号的相似度。
  8. 一种特征词提取装置,其中,包括:
    分词模块,用于响应于对目标文本的分词指令,对所述目标文本进行分词,得到分词集合;
    组合模块,用于组合所述分词集合中的各个所述分词,得到若干词组,其中,每个所述词组包括若干所述分词;
    第一计算模块,用于计算所述词组的第一TF值和TF-IDF值;
    第二计算模块,用于计算组合所述词组的每个所述分词的第二TF值,得到若干所述第二TF值;
    第三计算模块,用于利用所述TF-IDF值、所述第一TF值和若干所述第二TF值计算所述词组的概率限定TF-IDF值;
    第一选取模块,用于选取排列在预定位置之前的所述概率限定TF-IDF值对应的所述词组作为所述目标文本的特征词。
  9. 根据权利要求8所述的装置,其中,第三计算模块还用于:
    计算若干第二TF值的乘积,得到TF乘积;
    计算第一TF值和TF乘积的比值,得到词组概率值;
    利用TF-IDF值和词组概率值计算概率限定TF-IDF值。
  10. 一种文本相似度计算装置,其中,包括:
    第二选取模块,用于选取目标文本的特征词,其中,所述目标文本的所述特征词是通过特征词提取方法选取的,所述特征词提取方法包括:响应于对所述目标文本的分词指令,对所述目标文本进行分词,得到分词集合;组合所述分词集合中的各个所述分词,得到若干词组,其中,每个所述词组包括若干所述分词;计算所述词组的第一TF值和TF-IDF值;计算组合所述词组的每个所述分词的第二TF值,得到若干所述第二TF值;利用所述TF-IDF值、所述第一TF值和若干所述第二TF值计算所述词组的概率限定TF-IDF值;选取排列在预定位置之前的所述概率限定TF-IDF值对应的所述词组作为所述目标文本的所述特征词;
    第一输入模块,用于将所述特征词输入第一文本检索库,得到若干第一文本;
    第四计算模块,用于计算所述目标文本和若干所述第一文本的第一相似度,得到若干所述第一相似度;
    第一确定模块,用于将若干所述第一相似度中满足第一相似度阈值的第一相似度对应的第一文本作为与所述目标文本相似的文本。
  11. 根据权利要求10所述的装置,其中,所述装置还包括:
    扩展模块,用于在将特征词输入第一文本检索库,得到若干第一文本的步骤之后,对特征词进行扩展,得到扩展词组集合,其中,扩展词组集合包括特征词和特征词的近义词;
    第二输入模块,用于将扩展词组集合输入第一文本检索库,得到若干第二文本;
    处理模块,用于对若干第一文本和若干第二文本取并集,得到若干第三文本;
    第四计算模块还用于:计算目标文本和若干第三文本的第二相似度,得到若干第二相似度;
    第一确定模块还用于:将若干第二相似度中满足第二相似度阈值的第二相似度对应的第三文本作为与目标文本相似的文本。
  12. 根据权利要求10所述的装置,其中,所述装置还包括:
    获取模块,用于在将特征词输入第一文本检索库,得到若干第一文本的步骤之后,获取预先建立的知识图谱,其中,针对每个第一文本,知识图谱包括:引用第一文本的若干第四文本、与第一文本同族的若干第五文本、以及若干第六文本和每个第六文本与第一文本的第三相似度;
    第二确定模块,用于针对每个第一文本,从知识图谱中确定出若干第四文本、若干第五文本以及若干第七文本,其中,每个第七文本为若干第六文本中满足第三相似度阈值的 第三相似度对应的文本;
    第三确定模块,用于将若干第一文本、若干第四文本、若干第五文本和若干第七文本作为扩展文本集;
    第四计算模块还用于:计算目标文本和扩展文本集中每个文本的第四相似度,得到若干第四相似度;
    第一确定模块还用于:将扩展文本集中满足第四相似度阈值的第四相似度对应的文本作为与目标文本相似的文本。
  13. 根据权利要求12所述的装置,其中,所述装置还包括:
    构建模块,用于在获取预先建立的知识图谱的步骤之前,构建知识图谱;
    其中,构建模块还用于:
    针对每个第一文本,获取若干第四文本,并将若干第四文本中每个第四文本和第一文本的关联关系构建在知识图谱中;
    针对每个第一文本,获取若干第五文本,并将若干第五文本中每个第五文本和第一文本的关联关系构建在知识图谱中;
    针对每个第一文本,提取第一文本的特征词输入第二文本检索库,得到若干第六文本,计算第一文本与若干第六文本中每个第六文本的第三相似度,并将第一文本、若干第六文本中的每个第六文本和第三相似度的关联关系构建在知识图谱中。
  14. 根据权利要求13所述的装置,其中,所述构建模块在计算第一文本与若干第六文本中每个第六文本的第三相似度时,还用于:
    计算第一文本的特征词和每个第六文本的特征词的相似度;和/或
    计算第一文本的文本词向量和每个第六文本的文本词向量的相似度;和/或
    计算第一文本的IPC分类号和每个第六文本的IPC分类号的相似度。
  15. 一种计算机设备,所述计算机设备包括存储器、处理器以及存储在所述存储器上并可在所述处理器上运行的计算机程序,其中,所述处理器执行所述计算机程序时实现以下步骤:
    响应于对目标文本的分词指令,对所述目标文本进行分词,得到分词集合;
    组合所述分词集合中的各个所述分词,得到若干词组,其中,每个所述词组包括若干所述分词;
    计算所述词组的第一TF值和TF-IDF值;
    计算组合所述词组的每个所述分词的第二TF值,得到若干所述第二TF值;
    利用所述TF-IDF值、所述第一TF值和若干所述第二TF值计算所述词组的概率限定TF-IDF值;
    选取排列在预定位置之前的所述概率限定TF-IDF值对应的所述词组作为所述目标文本的特征词。
  16. 一种计算机可读存储介质,其上存储有计算机程序,其中,所述计算机程序被处理器执行时实现以下步骤:
    响应于对目标文本的分词指令,对所述目标文本进行分词,得到分词集合;
    组合所述分词集合中的各个所述分词,得到若干词组,其中,每个所述词组包括若干所述分词;
    计算所述词组的第一TF值和TF-IDF值;
    计算组合所述词组的每个所述分词的第二TF值,得到若干所述第二TF值;
    利用所述TF-IDF值、所述第一TF值和若干所述第二TF值计算所述词组的概率限定TF-IDF值;
    选取排列在预定位置之前的所述概率限定TF-IDF值对应的所述词组作为所述目标文本的特征词。
  17. 一种计算机设备,所述计算机设备包括存储器、处理器以及存储在所述存储器上并可在所述处理器上运行的计算机程序,其中,所述处理器执行所述计算机程序时实现以下步骤:
    选取目标文本的特征词,其中,所述目标文本的所述特征词是通过特征词提取方法选取的,所述特征词提取方法包括:响应于对所述目标文本的分词指令,对所述目标文本进行分词,得到分词集合;组合所述分词集合中的各个所述分词,得到若干词组,其中,每个所述词组包括若干所述分词;计算所述词组的第一TF值和TF-IDF值;计算组合所述词组的每个所述分词的第二TF值,得到若干所述第二TF值;利用所述TF-IDF值、所述第一TF值和若干所述第二TF值计算所述词组的概率限定TF-IDF值;选取排列在预定位置之前的所述概率限定TF-IDF值对应的所述词组作为所述目标文本的所述特征词;
    将所述特征词输入第一文本检索库,得到若干第一文本;
    计算所述目标文本和若干所述第一文本的第一相似度,得到若干所述第一相似度;
    将若干所述第一相似度中满足第一相似度阈值的第一相似度对应的第一文本作为与所述目标文本相似的文本。
  18. 根据权利要求17所述的计算机设备,其中,所述计算机设备还用于:
    在所述将所述特征词输入第一文本检索库,得到若干第一文本的步骤之后,对所述特征词进行扩展,得到扩展词组集合,其中,所述扩展词组集合包括所述特征词和所述特征词的近义词;
    将所述扩展词组集合输入所述第一文本检索库,得到若干第二文本;
    对若干所述第一文本和若干所述第二文本取并集,得到若干第三文本;
    所述计算所述目标文本和若干所述第一文本的第一相似度,得到若干所述第一相似度的步骤包括:计算所述目标文本和若干所述第三文本的第二相似度,得到若干所述第二相似度;
    所述将若干所述第一相似度中满足第一相似度阈值的第一相似度对应的第一文本作为与所述目标文本相似的文本的步骤包括:将若干所述第二相似度中满足第二相似度阈值的第二相似度对应的第三文本作为与所述目标文本相似的文本。
  19. 一种计算机可读存储介质,其上存储有计算机程序,其中,所述计算机程序被处理器执行时实现以下步骤:
    选取目标文本的特征词,其中,所述目标文本的所述特征词是通过特征词提取方法选取的,所述特征词提取方法包括:响应于对所述目标文本的分词指令,对所述目标文本进行分词,得到分词集合;组合所述分词集合中的各个所述分词,得到若干词组,其中,每个所述词组包括若干所述分词;计算所述词组的第一TF值和TF-IDF值;计算组合所述词组的每个所述分词的第二TF值,得到若干所述第二TF值;利用所述TF-IDF值、所述第一TF值和若干所述第二TF值计算所述词组的概率限定TF-IDF值;选取排列在预定位置之前的所述概率限定TF-IDF值对应的所述词组作为所述目标文本的所述特征词;
    将所述特征词输入第一文本检索库,得到若干第一文本;
    计算所述目标文本和若干所述第一文本的第一相似度,得到若干所述第一相似度;
    将若干所述第一相似度中满足第一相似度阈值的第一相似度对应的第一文本作为与所述目标文本相似的文本。
  20. 根据权利要求19所述的计算机可读存储介质,其中,所述计算机可读存储介质还用于:
    在所述将所述特征词输入第一文本检索库,得到若干第一文本的步骤之后,对所述特征词进行扩展,得到扩展词组集合,其中,所述扩展词组集合包括所述特征词和所述特征词的近义词;
    将所述扩展词组集合输入所述第一文本检索库,得到若干第二文本;
    对若干所述第一文本和若干所述第二文本取并集,得到若干第三文本;
    所述计算所述目标文本和若干所述第一文本的第一相似度,得到若干所述第一相似度的步骤包括:计算所述目标文本和若干所述第三文本的第二相似度,得到若干所述第二相似度;
    所述将若干所述第一相似度中满足第一相似度阈值的第一相似度对应的第一文本作为与所述目标文本相似的文本的步骤包括:将若干所述第二相似度中满足第二相似度阈值的第二相似度对应的第三文本作为与所述目标文本相似的文本。
PCT/CN2019/117401 2019-10-15 2019-11-12 特征词提取方法、文本相似度计算方法、装置和设备 WO2021072850A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201910978967.XA CN110852097B (zh) 2019-10-15 2019-10-15 特征词提取方法、文本相似度计算方法、装置和设备
CN201910978967.X 2019-10-15

Publications (1)

Publication Number Publication Date
WO2021072850A1 true WO2021072850A1 (zh) 2021-04-22

Family

ID=69596452

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2019/117401 WO2021072850A1 (zh) 2019-10-15 2019-11-12 特征词提取方法、文本相似度计算方法、装置和设备

Country Status (2)

Country Link
CN (1) CN110852097B (zh)
WO (1) WO2021072850A1 (zh)

Cited By (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113220835A (zh) * 2021-05-08 2021-08-06 北京百度网讯科技有限公司 文本信息处理方法、装置、电子设备以及存储介质
CN113270181A (zh) * 2021-06-22 2021-08-17 中国平安人寿保险股份有限公司 指标数据的区分方法、装置、设备及存储介质
CN113392637A (zh) * 2021-06-24 2021-09-14 青岛科技大学 基于tf-idf的主题词提取方法、装置、设备及存储介质
CN113515939A (zh) * 2021-04-27 2021-10-19 西安理工大学 一种勘察报告文本关键信息提取系统和提取方法
CN113554053A (zh) * 2021-05-20 2021-10-26 重庆康洲大数据有限公司 一种比较中药处方相似性的方法
CN113641786A (zh) * 2021-07-16 2021-11-12 中国人民解放军国防科技大学 基于关联图谱和机器学习的文档混合推荐方法及其应用
CN113705200A (zh) * 2021-08-31 2021-11-26 中国平安财产保险股份有限公司 投诉行为数据的分析方法、装置、设备及存储介质
CN113806486A (zh) * 2021-09-23 2021-12-17 深圳市北科瑞声科技股份有限公司 长文本相似度的计算方法及装置、存储介质、电子装置
CN115329742A (zh) * 2022-10-13 2022-11-11 深圳市大数据研究院 基于文本分析的科研项目产出评价验收方法及系统
WO2022257455A1 (zh) * 2021-06-09 2022-12-15 平安科技(深圳)有限公司 一种相似文本的确定方法、装置、终端设备及存储介质
CN116860703A (zh) * 2023-07-13 2023-10-10 杭州再启信息科技有限公司 基于人工智能的数据处理系统、方法及存储介质

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113723056A (zh) * 2021-08-19 2021-11-30 杭州火树科技有限公司 Icd编码转化方法、装置、计算设备和存储介质

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101206752A (zh) * 2007-12-25 2008-06-25 北京科文书业信息技术有限公司 电子商务网站相关商品推荐系统及其方法
US20110191355A1 (en) * 2007-04-24 2011-08-04 Peking University Method for monitoring abnormal state of internet information
CN105095175A (zh) * 2014-04-18 2015-11-25 北京搜狗科技发展有限公司 获取截短的网页标题的方法及装置
CN105550168A (zh) * 2015-12-10 2016-05-04 百度在线网络技术(北京)有限公司 一种确定对象的概念词的方法和装置

Family Cites Families (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN100520782C (zh) * 2007-11-09 2009-07-29 清华大学 一种基于词频和多元文法的新闻关键词抽取方法
GB2463515A (en) * 2008-04-23 2010-03-24 British Telecomm Classification of online posts using keyword clusters derived from existing posts
CN103714132B (zh) * 2013-12-17 2017-12-26 北京本果信息技术有限公司 一种用于基于地域和行业进行热点事件挖掘的方法和设备
CN103885934B (zh) * 2014-02-19 2017-05-03 中国专利信息中心 一种专利文献关键短语自动提取方法
US11093557B2 (en) * 2016-08-29 2021-08-17 Zoominfo Apollo Llc Keyword and business tag extraction
CN106372064B (zh) * 2016-11-18 2019-04-19 北京工业大学 一种文本挖掘的特征词权重计算方法
CN107247780A (zh) * 2017-06-12 2017-10-13 北京理工大学 一种基于知识本体的专利文献相似性度量方法
CN108038109A (zh) * 2018-02-07 2018-05-15 中译语通科技股份有限公司 从非结构化文本中提取特征词的方法及系统、计算机程序
CN108536677A (zh) * 2018-04-09 2018-09-14 北京信息科技大学 一种专利文本相似度计算方法

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20110191355A1 (en) * 2007-04-24 2011-08-04 Peking University Method for monitoring abnormal state of internet information
CN101206752A (zh) * 2007-12-25 2008-06-25 北京科文书业信息技术有限公司 电子商务网站相关商品推荐系统及其方法
CN105095175A (zh) * 2014-04-18 2015-11-25 北京搜狗科技发展有限公司 获取截短的网页标题的方法及装置
CN105550168A (zh) * 2015-12-10 2016-05-04 百度在线网络技术(北京)有限公司 一种确定对象的概念词的方法和装置

Cited By (19)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113515939A (zh) * 2021-04-27 2021-10-19 西安理工大学 一种勘察报告文本关键信息提取系统和提取方法
CN113515939B (zh) * 2021-04-27 2024-04-16 西安理工大学 一种勘察报告文本关键信息提取系统和提取方法
CN113220835A (zh) * 2021-05-08 2021-08-06 北京百度网讯科技有限公司 文本信息处理方法、装置、电子设备以及存储介质
CN113220835B (zh) * 2021-05-08 2023-09-29 北京百度网讯科技有限公司 文本信息处理方法、装置、电子设备以及存储介质
CN113554053A (zh) * 2021-05-20 2021-10-26 重庆康洲大数据有限公司 一种比较中药处方相似性的方法
WO2022257455A1 (zh) * 2021-06-09 2022-12-15 平安科技(深圳)有限公司 一种相似文本的确定方法、装置、终端设备及存储介质
CN113270181A (zh) * 2021-06-22 2021-08-17 中国平安人寿保险股份有限公司 指标数据的区分方法、装置、设备及存储介质
CN113270181B (zh) * 2021-06-22 2024-06-07 中国平安人寿保险股份有限公司 指标数据的区分方法、装置、设备及存储介质
CN113392637A (zh) * 2021-06-24 2021-09-14 青岛科技大学 基于tf-idf的主题词提取方法、装置、设备及存储介质
CN113392637B (zh) * 2021-06-24 2023-02-07 青岛科技大学 基于tf-idf的主题词提取方法、装置、设备及存储介质
CN113641786A (zh) * 2021-07-16 2021-11-12 中国人民解放军国防科技大学 基于关联图谱和机器学习的文档混合推荐方法及其应用
CN113641786B (zh) * 2021-07-16 2023-08-01 中国人民解放军国防科技大学 基于关联图谱和机器学习的文档混合推荐方法及其应用
CN113705200B (zh) * 2021-08-31 2023-09-15 中国平安财产保险股份有限公司 投诉行为数据的分析方法、装置、设备及存储介质
CN113705200A (zh) * 2021-08-31 2021-11-26 中国平安财产保险股份有限公司 投诉行为数据的分析方法、装置、设备及存储介质
CN113806486A (zh) * 2021-09-23 2021-12-17 深圳市北科瑞声科技股份有限公司 长文本相似度的计算方法及装置、存储介质、电子装置
CN113806486B (zh) * 2021-09-23 2024-05-10 深圳市北科瑞声科技股份有限公司 长文本相似度的计算方法及装置、存储介质、电子装置
CN115329742A (zh) * 2022-10-13 2022-11-11 深圳市大数据研究院 基于文本分析的科研项目产出评价验收方法及系统
CN116860703A (zh) * 2023-07-13 2023-10-10 杭州再启信息科技有限公司 基于人工智能的数据处理系统、方法及存储介质
CN116860703B (zh) * 2023-07-13 2024-04-16 杭州再启信息科技有限公司 基于人工智能的数据处理系统、方法及存储介质

Also Published As

Publication number Publication date
CN110852097A (zh) 2020-02-28
CN110852097B (zh) 2022-02-01

Similar Documents

Publication Publication Date Title
WO2021072850A1 (zh) 特征词提取方法、文本相似度计算方法、装置和设备
WO2019136993A1 (zh) 文本相似度计算方法、装置、计算机设备和存储介质
US9195738B2 (en) Tokenization platform
WO2021139262A1 (zh) 文献主题词聚合方法、装置、计算机设备及可读存储介质
CN104750798B (zh) 一种应用程序的推荐方法和装置
CN105760474B (zh) 一种基于位置信息的文档集的特征词提取方法及系统
CN111797214A (zh) 基于faq数据库的问题筛选方法、装置、计算机设备及介质
WO2018090468A1 (zh) 视频节目的搜索方法和装置
CN108595679B (zh) 一种标签确定方法、装置、终端和存储介质
CN111291177A (zh) 一种信息处理方法、装置和计算机存储介质
CN110032650B (zh) 一种训练样本数据的生成方法、装置及电子设备
CN110609952B (zh) 数据采集方法、系统和计算机设备
CN112560444A (zh) 文本处理方法、装置、计算机设备和存储介质
CN114780746A (zh) 基于知识图谱的文档检索方法及其相关设备
JP5194818B2 (ja) データ分類方法およびデータ処理装置
US9213759B2 (en) System, apparatus, and method for executing a query including boolean and conditional expressions
CN109614478A (zh) 词向量模型的构建方法、关键词匹配方法及装置
CN116383412B (zh) 基于知识图谱的功能点扩增方法和系统
WO2021027162A1 (zh) 一种非满格表格内容提取方法、装置及终端设备
JP2013222418A (ja) パッセージ分割方法、装置、及びプログラム
JP7016237B2 (ja) 情報検索装置、検索処理方法、およびプログラム
JP5145288B2 (ja) 類義語辞書構築装置及び方法、コンピュータプログラム
CN114741489A (zh) 文档检索方法、装置、存储介质以及电子设备
WO2021056740A1 (zh) 语言模型构建方法、系统、计算机设备及可读存储介质
CN112182235A (zh) 一种构建知识图谱的方法、装置、计算机设备及存储介质

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 19949382

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 19949382

Country of ref document: EP

Kind code of ref document: A1