Label extraction method, device, equipment and storage medium

文档序号:7586 发布日期:2021-09-17 浏览:29次 中文

1. A label extraction method, comprising:

for each target text to be extracted, preprocessing the target text to obtain a plurality of words, and combining the words to obtain a plurality of word combinations;

for each target text, determining a text vector of the target text based on a plurality of words and a plurality of word combinations corresponding to the target text;

clustering a plurality of target texts based on the text vectors of the target texts to obtain a plurality of clusters;

and extracting a target label from at least one target text contained in each class cluster.

2. The method of claim 1, wherein for each target text to be extracted, preprocessing the target text to obtain a plurality of words comprises:

deleting target dialogues in a preset dialogues library in each target text to be extracted;

performing word segmentation processing on the target text with the target dialect deleted to obtain a plurality of initial words;

and deleting stop words in the plurality of initial words to obtain a plurality of words.

3. The method of claim 1, wherein said combining a plurality of said words to obtain a plurality of word combinations comprises:

and combining the words and N words behind the words according to the arrangement sequence of the words in the target text, so as to obtain a plurality of word combinations, wherein N is a positive integer smaller than M, and M is the difference between the total number of the words and 1.

4. The method of claim 1 or 3, wherein after said combining a plurality of said words to obtain a plurality of word combinations, said method further comprises:

determining the occurrence frequency of each word combination in all the word combinations of the dimensionality to which the word combination belongs, and deleting the word combinations of which the occurrence frequency is smaller than a set frequency threshold, wherein a plurality of word combinations obtained by adopting the same N value combination belong to the same dimensionality, and a plurality of word combinations obtained by adopting different N value combinations belong to different dimensionalities.

5. The method of claim 1, wherein determining a text vector for the target text based on a plurality of word combinations and a plurality of word combinations corresponding to the target text comprises:

determining respective word frequency values and inverse text frequency values of a plurality of words and word combinations corresponding to the target text;

respectively inputting a plurality of words and word combinations corresponding to the target text into a trained weight prediction model to obtain weight values corresponding to the words and the word combinations;

setting and calculating the word frequency value, the inverse text frequency value and the weight value corresponding to the word and the word combination respectively to obtain an operation result corresponding to each word and the word combination;

and determining a text vector of the target text based on the operation result corresponding to each word and the word combination corresponding to the target text.

6. The method of claim 1, wherein the clustering the plurality of target texts based on the text vector of each target text to obtain a plurality of clusters comprises:

clustering a plurality of target texts based on the text vectors corresponding to the target texts to obtain a plurality of clusters;

determining a miscellaneous cluster in a plurality of current cluster types;

determining whether the number of the target texts in the miscellaneous item cluster meets a set condition;

if not, clustering the target texts in the miscellaneous item clusters based on the text vectors corresponding to the target texts in the miscellaneous item clusters to obtain a plurality of similar clusters, and returning to execute the step of determining the miscellaneous item clusters in the plurality of current similar clusters until the number of the target texts in the miscellaneous item clusters is determined to meet the set conditions.

7. The method of claim 1, further comprising:

for each class cluster, extracting a plurality of keywords from at least one target text contained in the class cluster;

and classifying a plurality of keywords into the word packet of the target label corresponding to the class cluster.

8. The method of claim 7, further comprising:

searching words matched with the keywords from a preset word bank;

and classifying the searched words matched with the keywords into the word packet to which the keywords belong.

9. A label extraction method is applied to a user label extraction scene, and comprises the following steps:

acquiring a dialog text between the user and a preset object;

determining the dialog text sent to the preset object by the user in the dialog text as a target text to be extracted;

for each target text to be extracted, preprocessing the target text to obtain a plurality of words, and combining the words to obtain a plurality of word combinations;

for each target text, determining a text vector of the target text based on a plurality of words and a plurality of word combinations corresponding to the target text;

clustering a plurality of target texts based on the text vectors of the target texts to obtain a plurality of clusters;

and extracting the target label of the user from at least one target text contained in each class cluster.

10. The method of claim 9, wherein for each target text to be extracted, preprocessing the target text to obtain a plurality of words comprises:

deleting greetings in each target text to be extracted based on a preset greetings skill library;

based on a professional name word library, performing word segmentation processing on the target text with the greetings deleted to obtain a plurality of initial words;

and deleting stop words in the plurality of initial words to obtain a plurality of words.

11. A label extraction device, comprising:

the word segmentation module is used for preprocessing each target text to be extracted to obtain a plurality of words;

the combination module is used for combining the words to obtain a plurality of word combinations;

a vectorization module, configured to determine, for each target text, a text vector of the target text based on the plurality of words and the plurality of word combinations corresponding to the target text;

the clustering module is used for clustering a plurality of target texts based on the text vectors of the target texts to obtain a plurality of clusters;

and the label extraction module is used for extracting a target label from at least one target text contained in each class cluster.

12. A label extraction device, applied to a user label extraction scene, comprises:

the acquisition module is used for acquiring a dialog text between the user and a preset object;

the target determining module is used for determining the dialog text sent to the preset object by the user in the dialog text as a target text to be extracted;

the word segmentation module is used for preprocessing each target text to be extracted to obtain a plurality of words;

the combination module is used for combining a plurality of words according to a set word combination mode to obtain a plurality of word combinations;

a vectorization module, configured to determine, for each target text, a text vector of the target text based on the plurality of words and the plurality of word combinations corresponding to the target text;

the clustering module is used for clustering a plurality of target texts to obtain a plurality of clusters based on the text vectors of the target texts;

and the label extraction module is used for extracting the target label of the user from at least one target text contained in each class cluster.

13. An apparatus, comprising: a processor and a memory, the processor being configured to execute a tag extraction program stored in the memory to implement the tag extraction method of any one of claims 1 to 10.

14. A storage medium storing one or more programs executable by one or more processors to implement the label extraction method of any one of claims 1 to 10.

Background

A tag is a form of data used to characterize a business entity. The analysis angle of the business entity can be effectively expanded through the tags, and data screening and analysis can be performed through simple operation on different tags.

In the big data era, by labeling user requirements, user viewpoints and the like, accurate data operation can be realized.

Disclosure of Invention

An object of the embodiments of the present application is to provide a method, an apparatus, a device and a storage medium for extracting a label, so as to extract a more accurate label. The specific technical scheme is as follows:

the application provides a label extraction method, which comprises the following steps:

for each target text to be extracted, preprocessing the target text to obtain a plurality of words, and combining the words to obtain a plurality of word combinations;

for each target text, determining a text vector of the target text based on a plurality of words and a plurality of word combinations corresponding to the target text;

clustering a plurality of target texts based on the text vectors of the target texts to obtain a plurality of clusters;

and extracting a target label from at least one target text contained in each class cluster.

The application provides another label extraction method, which is applied to a user label extraction scene and comprises the following steps:

acquiring a dialog text between the user and a preset object;

determining the dialog text sent to the preset object by the user in the dialog text as a target text to be extracted;

for each target text to be extracted, preprocessing the target text to obtain a plurality of words, and combining the words to obtain a plurality of word combinations;

for each target text, determining a text vector of the target text based on a plurality of words and a plurality of word combinations corresponding to the target text;

clustering a plurality of target texts based on the text vectors of the target texts to obtain a plurality of clusters;

and extracting the target label of the user from at least one target text contained in each class cluster.

The application provides a label draw-out device, the device includes:

the word segmentation module is used for preprocessing each target text to be extracted to obtain a plurality of words;

the combination module is used for combining the words to obtain a plurality of word combinations;

a vectorization module, configured to determine, for each target text, a text vector of the target text based on the plurality of words and the plurality of word combinations corresponding to the target text;

the clustering module is used for clustering a plurality of target texts based on the text vectors of the target texts to obtain a plurality of clusters;

and the label extraction module is used for extracting a target label from at least one target text contained in each class cluster.

The application provides another kind of label extraction device, the device is applied to user's label extraction scene, includes:

the acquisition module is used for acquiring a dialog text between the user and a preset object;

the target determining module is used for determining the dialog text sent to the preset object by the user in the dialog text as a target text to be extracted;

the word segmentation module is used for preprocessing each target text to be extracted to obtain a plurality of words;

the combination module is used for combining a plurality of words according to a set word combination mode to obtain a plurality of word combinations;

a vectorization module, configured to determine, for each target text, a text vector of the target text based on the plurality of words and the plurality of word combinations corresponding to the target text;

the clustering module is used for clustering a plurality of target texts to obtain a plurality of clusters based on the text vectors of the target texts;

and the label extraction module is used for extracting the target label of the user from at least one target text contained in each class cluster.

The application provides equipment which comprises a processor, a communication interface, a memory and a communication bus, wherein the processor and the communication interface are used for realizing mutual communication by the memory through the communication bus;

a memory for storing a computer program;

a processor, configured to implement the methods provided in the various alternative implementations described above when executing the program stored in the memory.

The present application provides a storage medium having stored therein computer instructions, which when run on a computer, cause the computer to perform the methods provided in the various alternative implementations described above.

The present application provides a computer program product or computer program comprising computer instructions stored in a computer readable storage medium. The processor of the electronic device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the electronic device executes the method provided in the above-mentioned various alternative implementations.

According to the technical scheme provided by the embodiment of the application, the target text is preprocessed aiming at each target text to be extracted to obtain a plurality of words, the words are combined to obtain a plurality of word combinations, the text vector of the target text is determined according to the words and the word combinations corresponding to the target text aiming at each target text, the target texts are clustered according to the text vector of each target text to obtain a plurality of clusters, the target label is extracted from at least one target text contained in each cluster aiming at each cluster, as the words are combined after the words are obtained, the semantics of the target text can be represented more completely by the obtained word combinations, the text vector corresponding to the target text is determined according to the words and the word combinations, and then the target texts are clustered according to the text vectors, the target texts with similar semantics can be accurately divided into the same cluster, and finally, the target labels extracted from each cluster are more accurate.

Drawings

The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and together with the description, serve to explain the principles of the application.

In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings needed to be used in the description of the embodiments or the prior art will be briefly described below, and it is obvious for those skilled in the art to obtain other drawings without inventive exercise.

Fig. 1 is an overall flowchart of a label extraction method according to an embodiment of the present application;

fig. 2 is a flowchart of an embodiment of a label extraction method according to an embodiment of the present application;

fig. 3 is a flowchart of an embodiment of determining a text vector of a target text according to an embodiment of the present application;

fig. 4 is a flowchart of an embodiment of another label extraction method provided in an embodiment of the present application;

FIG. 5 is an exemplary diagram of label occupancy for different user requirements;

FIG. 6 is an exemplary diagram of a hot problem requiring significant attention;

fig. 7 is a block diagram of an embodiment of a tag extraction apparatus according to an embodiment of the present application;

fig. 8 is a block diagram of another embodiment of a label extraction apparatus according to an embodiment of the present application;

fig. 9 is a schematic structural diagram of an apparatus according to an embodiment of the present application.

Detailed Description

In order to make the objects, technical solutions and advantages of the embodiments of the present application clearer, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are some embodiments of the present application, but not all embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.

Referring to fig. 1, an overall flowchart of a label extraction method provided in an embodiment of the present application is shown. As shown in fig. 1, the label extraction method provided in the embodiment of the present application mainly includes five processes: preprocessing a text, constructing a multi-element phrase representation text, vectorizing the text, clustering the text and extracting labels. Further, after the labels are extracted, word packets corresponding to the labels can be constructed, and the word packets are expanded. The overall flow illustrated in fig. 1 will be further explained with specific embodiments in conjunction with the drawings, and the embodiments do not limit the embodiments of the present application.

Referring to fig. 2, a flowchart of an embodiment of a label extraction method provided in the embodiment of the present application is shown. As shown in fig. 1, the method may include the steps of:

step 201, for each target text to be extracted, preprocessing the target text to obtain a plurality of words, and combining the plurality of words to obtain a plurality of word combinations.

The pre-processing process may include cleaning, word segmentation, word deactivation, etc.

Specifically, as an embodiment, after a target text to be extracted is obtained, the target text to be extracted may be first cleaned to clean dirty data (for example, errors, incompleteness, wrong format, redundant data, and the like) in the target text, then, based on a professional vocabulary library conforming to a current scene, a unigram model Uni-Gram is used to perform word segmentation on the cleaned target text to obtain a plurality of initial words, and finally, stop words in the plurality of initial words are deleted to obtain a plurality of words.

As another embodiment, after the target text is cleaned and before the cleaned target text is participled, the target text in which the target dialect exists in the preset dialect library (hereinafter referred to as target dialect) may be deleted based on the preset dialect library, and then the target text in which the target dialect is deleted is participled by using the unigram model Uni-Gram based on the professional noumenon library conforming to the current scenario. Through the processing, text contents which do not belong to dirty data but possibly affect the subsequent label extraction result in the target text can be removed, so that the accuracy of the final label extraction result is improved. As for the specific implementation of the aforementioned dialect library, the following description is exemplary in combination with a specific application scenario, and will not be described in detail here.

In the embodiment of the application, in order to enrich semantic representation of the target text, after a plurality of words are obtained, the obtained words are further combined according to a set word combination mode to obtain a plurality of word combinations, namely, a multi-element word group is constructed.

Specifically, the word and N words located after the word may be combined in sequence for each word according to the arrangement order of the words in the target text, so as to obtain a plurality of word combinations, where N is a positive integer smaller than M, and M is a difference between the total number of words obtained after the stop word is deleted and 1.

For example, assuming that the word segmentation process is performed on the target text to obtain A, B, C, D four words, that is, M is 3, then N may take a value of 1 or 2, and according to the above description, when N takes a value of 1, the following word combinations may be obtained: AB. BC and CD, when N is 2, the following words ABC and BCD can be obtained.

In addition, in this embodiment of the present application, in order to avoid that, after the word combinations are added, a dictionary word list is too large in a subsequent vectorization process of the target text and a VSM (Vector Space Model) semantic Space is too sparse, in this embodiment of the present application, before step 102 is executed, the word combinations obtained in step 101 are filtered, and in step 102, a text Vector corresponding to the target text is determined based on the words corresponding to the target text and the filtered word combinations.

As an example, the filtering of the word combinations obtained in step 101 may be implemented as follows: and determining the occurrence frequency of each word combination in all the word combinations of the dimensionality to which the word combination belongs, and deleting the word combinations of which the occurrence frequency is smaller than a set frequency threshold value. Here, a plurality of word combinations obtained by using the same N value combination belong to the same dimension, and a plurality of word combinations obtained by using different N value combinations belong to different dimensions, or it can be said that a plurality of word combinations including the same number of words belong to the same dimension, and a plurality of word combinations including the different number of words belong to different dimensions. For example, the word combinations AB, BC, and CD belong to the same dimension, and the word combinations ABC and BCD belong to the same dimension.

Optionally, the set number threshold corresponding to different dimensions may be different, for example, for the dimension to which a word combination including 2 words belongs, the set number threshold is 10, and for the dimension to which a word combination including 3 words belongs, the set number threshold is 3.

Step 202, for each target text, determining a text vector of the target text based on a plurality of words and a plurality of word combinations corresponding to the target text.

In the embodiment of the present application, determining a text vector of a target text may be implemented by the flow shown in fig. 3. As shown in fig. 3, the method comprises the following steps:

step 301, determining respective word frequency values and inverse text frequency values of a plurality of words and a plurality of word combinations corresponding to the target text.

The TF-IDF is a statistical method for evaluating the importance of words, wherein TF refers to Term Frequency (Term Frequency) and IDF refers to Inverse text Frequency index (Inverse Document Frequency). The importance of a word increases in proportion to the number of times it appears in the text, but at the same time decreases in inverse proportion to the frequency of its appearance in the corpus, i.e., the main idea of TF-IDF is: if a word appears frequently in one text and rarely appears in other texts, the word is considered to have good category distinguishing capability and is suitable for classification.

The IDF value of a word can be obtained by dividing the total text number by the text number containing the word, and then taking the obtained quotient to be a base-10 logarithm. And multiplying the TF value and the IDF value of a certain word to obtain the TF-IDF value of the word, and further determining the TF-IDF value corresponding to each word and word combination corresponding to the target text.

Step 302, inputting a plurality of words and word combinations corresponding to the target text into the trained weight prediction model respectively to obtain weight values corresponding to the words and word combinations respectively.

Here, the weight value represents the degree of importance of the word/word combination.

In the embodiment of the application, the weight prediction model can be obtained by training a large amount of sample data in advance. Here, the sample data includes: and the corresponding relation between the word/word combination and the weight value, wherein the weight value is a preset value set based on expert experience. The trained weight prediction model takes the words or word combinations as input and takes the weight values corresponding to the input words or word combinations as output, that is, the trained weight prediction model can be used for predicting the weight values capable of representing the importance degrees of the words or word combinations. Based on this, in this step 302, a plurality of words and a plurality of word combinations corresponding to the target text may be respectively input to the trained weight prediction model, so as to obtain weight values corresponding to each word and each word combination.

Step 303, performing setting operation on the word frequency value, the inverse text frequency value and the weight value respectively corresponding to the word and the word combination to obtain an operation result corresponding to each word and word combination.

As an embodiment, the setting operation is a multiplication operation, that is, a word frequency value, an inverse text frequency value (that is, a TF-IDF value), and a weight value corresponding to a word and a word combination are multiplied to obtain an operation result corresponding to each word and word combination.

And step 304, determining a text vector of the target text based on the operation result corresponding to each word and the word combination corresponding to the target text.

In the embodiment of the application, the operation result obtained by the setting operation is determined as the final TF-IDF value, and the target text is vectorized based on the final TF-IDF value to obtain the text vector of the target text. Specifically, each word and word combination corresponding to the target text are quantized into a decimal represented by a TF-IDF value, and then, according to the arrangement sequence of each word and word combination in the target text, the decimal obtained by quantizing each word and word combination is arranged and combined to obtain the text vector of the target text. Therefore, the target text is vectorized based on the TF-IDF value, and the weight information of each word and the word combination in the target text can be reserved in the text vector, which is equivalent to the information of the target text.

Furthermore, as can be seen from the above description, when the target text is vectorized, the importance degree of the word/word combination is determined by the weight value corresponding to the word/word combination and the TF-IDF value, which can effectively reduce the influence of the high-frequency invalid word and improve the influence of the important word. Here, the high-frequency ineffective word may be, for example: conjunctions, word atmosphere words, indicative pronouns, and the like; the important words may be nouns, verbs, etc. associated with the business scenario.

And 203, clustering the target texts based on the text vectors of the target texts to obtain a plurality of clusters.

It is first explained that after clustering the clustering objects (referred to as target texts in the embodiment of the present application) by using the clustering algorithm, some clustering objects may not be classified into any obtained class cluster, and at this time, the clustering objects not classified into any obtained class cluster may be classified into one class, which is called a miscellaneous cluster. It can be seen that, among the plurality of cluster types obtained by clustering, there may be a miscellaneous cluster.

Further, a single-round clustering mode is adopted, the phenomenon that the data volume in one cluster is far larger than that in a miscellaneous cluster often occurs, under the phenomenon, on one hand, the cluster theme is difficult to summarize due to the large data volume in the cluster, on the other hand, if the occupation ratio of the data volume in the miscellaneous cluster to the total data volume is large, a large amount of data cannot summarize effective labels, and the problem that the summarized label coverage rate is low occurs at the same time.

Based on this, the embodiment of the application proposes to adopt a multi-round clustering mode to cluster a plurality of target texts. In each round of clustering, the same clustering algorithm may be adopted, and different clustering algorithms may also be adopted, which is not limited in the embodiments of the present application. Here, the set clustering algorithm may be, for example: K-Means algorithm, DBSCAN (sensitivity-Based Spatial Clustering of Applications with Noise), etc.

Specifically, as an embodiment, in the first-round clustering process, based on a text vector corresponding to each target text, clustering the target texts according to a set clustering algorithm to obtain a plurality of clusters, then determining a miscellaneous cluster in the plurality of current clusters, that is, a cluster composed of a plurality of target texts which are not classified into any one of the clusters obtained by clustering with the clustering algorithm, and determining whether the number of the target texts in the miscellaneous cluster meets a set condition, where the set condition may be: the number of the target texts in the miscellaneous item cluster does not exceed a set number threshold, or the proportion of the number of the target texts in the miscellaneous item cluster to the total number of the target texts does not exceed a set proportion threshold (for example, 25%).

Further, if it is determined that the number of the target texts in the miscellaneous item cluster does not satisfy the set condition, it means that the proportion of the data amount in the miscellaneous item cluster to the total data amount is large, at this time, in order to reduce the proportion of the data amount in the miscellaneous item cluster to the total data amount, the current miscellaneous item cluster is continuously clustered, that is, based on the text vector corresponding to the target text in the current miscellaneous item cluster, the target texts in the current miscellaneous item cluster are clustered according to the set clustering algorithm, so as to obtain a plurality of clusters. And then, returning to the step of determining the miscellaneous item cluster until the number of the target texts in the miscellaneous item cluster is determined to meet the set condition.

For example, assuming that in the first round of clustering, a plurality of target texts are clustered to obtain four clusters a, b, c and d, and assuming that d is a miscellaneous cluster, according to the above description, if the number of the target texts in the miscellaneous cluster does not meet the set condition, the target texts in the miscellaneous cluster are continuously clustered, assuming that three clusters of e, e and g are obtained, and assuming that g is the miscellaneous cluster, if the number of the target texts in the miscellaneous cluster meets the set condition, clustering is stopped according to the above description, at this time, the finally obtained clusters are: the first, second, third, fifth, sixth and seventh clusters are 6 clusters.

Through the embodiment, the proportion of the data volume in the miscellaneous item cluster to the total data volume can be reduced as much as possible, so that the situation that a large amount of data cannot induce effective labels can be avoided, and the coverage rate of the induced labels is improved.

As another embodiment, the number of clustering rounds may be preset, in the first round of clustering, a plurality of target texts are clustered based on the text vectors corresponding to the target texts according to a set clustering algorithm to obtain a plurality of clusters, and in each subsequent round of clustering, for each current cluster, the plurality of target texts in the cluster are clustered again according to the set clustering algorithm based on the text vectors corresponding to the target texts in the cluster to obtain a plurality of clusters until the number of clustering rounds reaches the preset number of clustering rounds.

Through the embodiment, a multi-round clustering mode is adopted to cluster a plurality of target texts, and the final clustering miscellaneous item proportion can be compressed to be below a proportional threshold (for example, below 25%) by using an iterative multi-round clustering mode, so that more clusters can be obtained compared with the clustering of a plurality of target texts by using a single-round clustering mode, on one hand, more detailed clustering division can be performed on the target texts, and then labels extracted subsequently based on each cluster can be more refined and improved, on the other hand, the clusters with relatively small masses and small quantity can be gradually stripped from the plurality of target texts, but the clusters with object characteristics can also be represented. Here, the object may refer to a user.

And 204, extracting a target label from at least one target text contained in each class cluster.

As an embodiment, a core keyword may be determined from at least one target text included in the class cluster, and the core keyword is used as a target tag corresponding to the class cluster.

As an optional implementation manner, for each class cluster, a class cluster center of the class cluster may be determined, and a keyword (also referred to as a topic word) is determined from a target text corresponding to a text vector at the class cluster center. Since the class cluster center has more representative meaning for the class cluster, the keywords determined from the target text corresponding to the text vector of the class cluster center have more representative meaning than the keywords determined from all the target texts corresponding to the class cluster, and therefore, the keywords determined from the target text corresponding to the text vector of the class cluster center can be used as core keywords.

As another alternative implementation, a plurality of keywords may be determined from the target text included in the class cluster by a TF-IDF method, a topic model, a RAKE algorithm, or the like, and then a core keyword may be determined from the plurality of keywords. For example, the keyword with the highest corresponding TF-IDF value is used as the core keyword, and for example, the keyword with the highest corresponding RAKE score is used as the core keyword.

It should be noted that, before determining the keywords from the target text by applying the above-mentioned method, the word segmentation processing is performed on the target text, a plurality of obtained word segments are used as candidate keywords, and then the final keyword is selected from the candidate keywords. On this basis, the embodiment of the present application proposes that after performing word segmentation processing on the target text, combining a plurality of words obtained by word segmentation according to the word combination manner described in step 201 to obtain a plurality of word combinations, and then using the plurality of words obtained by word segmentation and the plurality of word combinations obtained through word combination as candidate keywords. Through the processing, the finally obtained core keyword may be a word or a word combination, and it can be understood that the word combination can express semantics more completely compared with the word, so that the finally extracted target label has obvious and complete semantics.

In addition, when determining the keyword through the TF-IDF method, operations such as part-of-speech tagging, dependency syntactic analysis and the like may be performed on the target text, where the part-of-speech tagging refers to tagging each word in the target text with a correct part-of-speech, that is, determining that each word is a noun, a verb, an adjective or other part-of-speech, the dependency syntactic analysis refers to analyzing the target text to obtain a syntactic structure of the target text, that is, determining that the target text is a predicate, a predicate complement, a dependency relationship or other syntactic structures, then selecting a more important word from all words contained in the target text by using an expert rule and based on a part-of-speech tagging result and a dependency syntactic analysis result, and finally determining the keyword by using the TF-IDF method for the more important word selected by the user. For example, if the expert rules indicate that words such as pronouns, conjunctions, and word atmosphere words are invalid words, other words in the target text except the invalid words may be selected as more important words. For another example, if the expert rules characterize that important words related to the business scenario are generally nouns or verbs, the nouns or verbs in the target text may be selected as the more important words.

In addition, the embodiment of the application also provides that: and aiming at each cluster, classifying the keywords (except the core keywords) determined from the target texts contained in the cluster into the word packet of the target label corresponding to the cluster. Further, in order to improve the coverage rate of the word package on the full data set, the embodiment of the present application further proposes to expand the word package constructed in the above manner: and searching words matched with the keywords from a preset word bank, and classifying the searched words matched with the keywords into a word packet to which the keywords belong. Here, matching may mean: the similarity between the corresponding word vectors is greater than or equal to a set similarity threshold, wherein the similarity can be represented by cosine distance, Euclidean distance and the like.

In practice, the text to be marked may be marked by a package of words. For example, if a text includes Q words in a word packet, a label corresponding to the word packet is assigned to the text, where Q is a natural number greater than 0, and a specific value may be set by a user according to actual needs. It will be appreciated that the greater the Q value, the more accurate the final marking result.

In an exemplary application scenario, a historical text input by a user can be used as a text to be marked, the historical text input by the user is marked, which is equivalent to marking user requirements according to the historical text input by the user, and then the occupation ratios of different user requirements or hot point requirements can be analyzed according to marking results.

According to the technical scheme provided by the embodiment of the application, the target text is preprocessed aiming at each target text to be extracted to obtain a plurality of words, the words are combined according to a set word combination mode to obtain a plurality of word combinations, for each target text, a text vector of the target text is determined based on the words and the word combinations corresponding to the target text, the target texts are clustered based on the text vector of each target text to obtain a plurality of cluster types, a target label is extracted from at least one target text contained in the cluster types aiming at each cluster type, as the words are combined after the words are obtained, the semantics of the target text can be represented more completely by the obtained word combinations, and therefore, the text vector corresponding to the target text is determined based on the words and the word combinations, and then, clustering a plurality of target texts according to the text vectors, so that the target texts with similar semantics can be accurately divided into the same cluster, and finally, the target labels extracted from each cluster are more accurate.

In order to facilitate understanding of the label extraction method provided in the embodiment of the present application, the following further explains the label extraction method provided in the embodiment of the present application with reference to a specific application scenario.

Referring to fig. 4, a flowchart of an embodiment of another label extraction method provided in the embodiment of the present application is shown. As an embodiment, the method may be applied to a preset industry tag architecture building scenario, where the preset industry may be, for example, an insurance industry, a financial industry, and the like, and as shown in fig. 4, the method may include the following steps:

step 401, obtaining a dialog text between a user and a preset object.

Here, the preset object refers to an object that provides a service to a user in the preset industry. The object may be a service person or an automatic question and answer system, which is not limited in the embodiment of the present application, and the service may be, for example: business handling services, after-sales services, consulting services, etc.

Here, the dialog text refers to a dialog text of the user and the preset object within a set historical time period (for example, within the last 3 days, within the last week, within the last month, within the last half year), and the dialog text at least includes text information sent by the user to the preset object and text information sent by the preset object to the target user. The text information sent by the preset object to the user comprises text information sent by the preset object and text information sent by a built-in automatic response system. The set historical time period may be a preset fixed value, or may be set by a user (e.g., an operator) according to an actual requirement, which is not limited in the embodiment of the present application.

Step 402, in the dialog text, the dialog text sent to the preset object by the user is determined as the target text to be extracted.

As an embodiment, the technical scheme of the application can be applied to a construction scene of a user demand label in a preset industry, where the user demand label refers to a label capable of representing a user demand, and the user demand can be usually expressed through a dialog text sent to a preset object by a user, and based on this, in this step 402, the dialog text sent to the preset object by the user in the dialog text obtained in step 401 is determined as a target text to be extracted.

Step 403, for each target text to be extracted, preprocessing the target text to obtain a plurality of words, and combining the plurality of words to obtain a plurality of word combinations.

The pre-processing process may include cleaning, word segmentation, word deactivation, etc.

Specifically, as an embodiment, the target text to be extracted may be first cleaned to clean dirty data (for example, errors, incompleteness, wrong format, redundant data, and the like) in the target text, then, based on the professional vocabulary library conforming to the current scenario, the cleaned target text is subjected to word segmentation processing by using the unigram model Uni-Gram to obtain a plurality of initial words, and finally, stop words in the plurality of initial words are deleted to obtain a plurality of words.

As another embodiment, before performing word segmentation processing on the cleaned target text, greetings, such as hello, thank you, bad meanings, etc., in the target text may be deleted based on a preset greetings terminology library. And then, based on a professional name word library conforming to the current scene, performing word segmentation processing on the target text with the greetings deleted by using a unary grammar model Uni-Gram to obtain a plurality of initial words, and finally deleting stop words in the plurality of initial words to obtain a plurality of words.

The following further exemplifies the word combinations: assume that the target text is: can hospitalization be reimbursed? Then, according to the related description in step 201, the target text is preprocessed to obtain a plurality of words, which may include hospitalization and reimbursement, and then the words of hospitalization and reimbursement are combined to obtain a word combination (binary word group) of hospitalization reimbursement. Compared with two terms of hospitalization and reimbursement, the term combination of hospitalization and reimbursement can represent semantic information of the target text more completely, and accuracy of clustering results obtained by clustering the target text subsequently can be improved.

As another example, assume that the target text is: can the outpatient service in hospital give an expense? Then, according to the related description in the above step 201, the target text is preprocessed to obtain a plurality of words, which may include hospitalization, outpatient service, and reimbursement, then, the two words of hospitalization and outpatient service are combined to obtain a word combination of hospitalization and outpatient service (binary word group), the two words of outpatient service and reimbursement are combined to obtain a word combination of reimbursement of outpatient service (binary word group), and the three words of hospitalization, outpatient service, and reimbursement are combined to obtain a word combination of reimbursement of hospitalization and outpatient service (ternary word group). Compared with three terms of hospitalization, outpatient service and reimbursement, the three terms of hospitalization outpatient service, outpatient service and reimbursement in hospitalization outpatient service can be combined to completely represent semantic information of the target text, and therefore the accuracy of clustering results obtained by clustering the target text subsequently can be improved.

Further, in order to avoid that the word list of the dictionary is too large in the subsequent vectorization process of the target text and the VSM semantic space is too sparse after the binary phrases and the ternary phrases are added, the embodiment of the present application proposes that the obtained binary phrases and ternary phrases are screened by using a set frequency threshold, specifically, the occurrence frequency of each binary phrase in all binary phrases is determined, the occurrence frequency of each ternary phrase in all ternary phrases is determined, and word combinations with the occurrence frequency smaller than the set frequency threshold are deleted, that is, multi-element phrases which appear for many times and may contain business semantic information are retained.

Step 404, for each target text, determining a text vector of the target text based on a plurality of words and a plurality of word combinations corresponding to the target text.

In the above description, the importance degree of a word or a word combination is determined using the TF-IDF value of the word or the word combination and a weight value for representing the importance degree of the word or the word combination, and then the text vector of the target text is determined according to the importance degree.

And 405, clustering the target texts based on the text vectors of the target texts to obtain a plurality of clusters.

And 406, extracting a target label of the user from at least one target text contained in each class cluster.

Specifically, for target text clustering, a K-Means algorithm can be adopted, a skleran function interface is adopted for realizing the K-Means algorithm, and the cluster number (K value) of clustering is selected according to the value with the fastest SSE (simple State experience) descending speed. After the first clustering is completed, in order to further subdivide and mine the clustering cluster pointed by the specific theme, more secondary labels of the theme are further subdivided and mined, meanwhile, the clustering miscellaneous items occupying a larger proportion are further subdivided and mined, secondary clustering is continuously performed on the miscellaneous item clusters in the result of the first clustering, and the specific parameter selection is the same as the selection mode of the first clustering. The obtained cluster and the previous result of the secondary clustering of the full data have similar and complementary relations on the one hand by carrying out automatic iterative clustering on the miscellaneous item cluster, namely clustering the miscellaneous items of the last clustering again until the ratio of the miscellaneous item cluster to the full data is less than the preset threshold (for example, 25 percent); on the other hand, relatively small masses and small quantity (for example, 20-30 strips) can be gradually stripped in the clustering process, and the clustering cluster of partial user group voice is reflected at the same time.

Therefore, the relatively fuzzy label distribution can be obtained through the first clustering, the second clustering is the refinement of the first clustering result, each cluster obtained through the first clustering can be clustered independently, and the refined labels existing under each fuzzy label are analyzed.

In conclusion, the method and the device can perform secondary clustering on the target text to obtain a secondary label system, and the secondary clustering is the refinement and enrichment of the primary clustering result. Meanwhile, besides the secondary clustering building of a secondary label system, a plurality of rounds of iterative clustering can be carried out on a plurality of text clustering miscellaneous items with a large number and a large content obtained in the secondary clustering, new sounds of relatively small people are continuously stripped from the text clustering miscellaneous items, and the new sounds are merged with the existing sounds in the secondary label.

Further, multiple rounds of iterative clustering can cluster the miscellaneous item clusters in the clustering process until the finally obtained miscellaneous item scale is reduced by 25% of the scale of the full data set. Therefore, on one hand, the data coverage rate is improved, and on the other hand, the continuous refinement and perfection of a secondary label system can be realized through multi-round iterative clustering.

In addition, the embodiment of the application provides that after a plurality of target texts are clustered by adopting a multi-round iterative clustering mode to obtain a plurality of clusters, cluster clusters with similar clustering centers can be further fused. Specifically, as an optional implementation manner, the clustering center texts of the various clusters (i.e., the texts corresponding to the text vectors in the cluster centers) may be determined first, then the similarity between the clustering center texts of the various clusters is calculated, and if the similarity between the clustering center texts of two clusters is greater than a set similarity threshold, the two clusters may be merged into the same cluster.

On the basis, if some clusters exist, the similarity between the cluster center texts of the clusters and the cluster center texts of other clusters is smaller than the set similarity threshold, and then the target label of the user is extracted from at least one target text contained in the clusters, which means that a brand-new sound of a small user is found.

Other detailed descriptions of the steps 404-406 can refer to the related descriptions in the flow chart shown in fig. 2, and are not repeated here.

Further, as can be seen from the description in step 403, the target tag extracted in the embodiment of the present application can represent the requirement of the user, and therefore, by allocating the target tag to the dialog text sent by the user, it can be implemented to allocate a tag capable of representing the requirement of the user to the user. In the application, the analysis of the occupation ratios of different user requirements according to the target labels corresponding to the multiple users, that is, the analysis of the occupation ratios of the different target labels in the target labels corresponding to all the users, and the analysis of the hot problem (that is, the user requirements) needing to be focused on according to the target labels corresponding to the multiple users can be realized, for example, the multiple target labels are sequenced from high to low according to the occurrence frequency, and the user requirements represented by the target labels arranged in the first few places are determined as the hot problem needing to be focused on. See fig. 5 for an exemplary graph of tag occupancy for different user requirements, and fig. 6 for an exemplary graph of a hot problem requiring significant attention.

Corresponding to the embodiment of the label extracting method, the application also provides an embodiment of a label extracting device.

Referring to fig. 7, a block diagram of an embodiment of a label extracting apparatus provided in an embodiment of the present application is shown, where the apparatus includes: a preprocessing module 71, a combining module 72, a vectorization module 73, a clustering module 74, and a label extraction module 75.

The preprocessing module 71 is configured to preprocess each target text to be extracted to obtain a plurality of words;

the combination module 72 is used for combining a plurality of words to obtain a plurality of word combinations;

a vectorization module 73, configured to, for each target text, determine a text vector of the target text based on a plurality of words and a plurality of word combinations corresponding to the target text;

a clustering module 74, configured to cluster the multiple target texts based on the text vectors of the target texts to obtain multiple clusters;

a label extracting module 75, configured to, for each of the class clusters, extract a target label from at least one target text included in the class cluster.

In a possible embodiment, the preprocessing module 71 comprises (not shown in the figures):

the cleaning submodule is used for deleting the target dialogues in the target text, which exist in a preset dialogues library, aiming at each target text to be extracted;

the word segmentation sub-module is used for carrying out word segmentation processing on the target text with the target dialect deleted to obtain a plurality of initial words;

and the deleting submodule is used for deleting the stop words in the plurality of initial words to obtain a plurality of words.

In a possible embodiment, the combination module 72 is specifically configured to:

and combining the words and N words behind the words according to the arrangement sequence of the words in the target text, so as to obtain a plurality of word combinations, wherein N is a positive integer smaller than M, and M is the difference between the total number of the words and 1.

In a possible embodiment, the device further comprises (not shown in the figures):

and the filtering module is used for determining the occurrence frequency of each word combination in all the word combinations with the dimensionality, and deleting the word combinations with the occurrence frequency smaller than a set frequency threshold, wherein a plurality of word combinations obtained by adopting the same N value combination belong to the same dimensionality, and a plurality of word combinations obtained by adopting different N value combinations belong to different dimensionalities.

In a possible implementation, the vectorization module 73 is specifically configured to:

determining respective word frequency values and inverse text frequency values of a plurality of words and word combinations corresponding to the target text; respectively inputting a plurality of words and word combinations corresponding to the target text into a trained weight prediction model to obtain weight values corresponding to the words and the word combinations; setting and calculating the word frequency value, the inverse text frequency value and the weight value corresponding to the word and the word combination respectively to obtain an operation result corresponding to each word and the word combination; and determining a text vector of the target text based on the operation result corresponding to each word and the word combination corresponding to the target text.

In a possible implementation, the clustering module 74 is specifically configured to:

clustering a plurality of target texts based on the text vectors corresponding to the target texts to obtain a plurality of clusters; determining a miscellaneous cluster in a plurality of current cluster types; determining whether the number of the target texts in the miscellaneous item cluster meets a set condition; if not, clustering the target texts in the miscellaneous item clusters based on the text vectors corresponding to the target texts in the miscellaneous item clusters to obtain a plurality of similar clusters, and returning to execute the step of determining the miscellaneous item clusters in the plurality of current similar clusters until the number of the target texts in the miscellaneous item clusters is determined to meet the set conditions.

In a possible embodiment, the device further comprises (not shown in the figures):

the keyword extraction module is used for extracting keywords from at least one target text contained in each class cluster;

and the word packet construction module is used for classifying the keywords into the word packets of the target labels corresponding to the class clusters.

In a possible embodiment, the device further comprises (not shown in the figures):

the word packet expansion module is used for searching words matched with the keywords from a preset word bank;

and classifying the searched words matched with the keywords into the word packet to which the keywords belong.

Referring to fig. 8, a block diagram of another embodiment of a label extraction apparatus according to an embodiment of the present application is provided. As shown in fig. 8, the apparatus includes: the system comprises an acquisition module 81, a target determination module 82, a preprocessing module 83, a combination module 84, a vectorization module 85, a clustering module 86 and a label extraction module 87.

An obtaining module 81, configured to obtain a dialog text between a user and a preset object;

a target determining module 82, configured to determine, as a target text to be extracted, a dialog text that is sent to the preset object by the user in the dialog text;

the preprocessing module 83 is configured to preprocess each target text to be extracted to obtain a plurality of words;

a combination module 84, configured to combine a plurality of words to obtain a plurality of word combinations;

a vectorization module 85, configured to determine, for each target text, a text vector of the target text based on the plurality of words and the plurality of word combinations corresponding to the target text;

a clustering module 86, configured to cluster the multiple target texts based on the text vectors of the target texts to obtain multiple clusters;

a label extracting module 87, configured to, for each class cluster, extract a target label of the user from at least one target text included in the class cluster.

The embodiment of the present application further provides an apparatus, as shown in fig. 9, including a processor 901, a communication interface 902, a memory 903, and a communication bus 904, where the processor 901, the communication interface 902, and the memory 903 complete mutual communication through the communication bus 904,

a memory 903 for storing computer programs;

the processor 901 is configured to implement the following steps when executing the program stored in the memory 903:

for each target text to be extracted, preprocessing the target text to obtain a plurality of words, and combining the words to obtain a plurality of word combinations; for each target text, determining a text vector of the target text based on a plurality of words and a plurality of word combinations corresponding to the target text; clustering a plurality of target texts based on the text vectors of the target texts to obtain a plurality of clusters; and extracting a target label from at least one target text contained in each class cluster.

Alternatively, the first and second electrodes may be,

acquiring a dialog text between the user and a preset object; determining the dialog text sent to the preset object by the user in the dialog text as a target text to be extracted; for each target text to be extracted, preprocessing the target text to obtain a plurality of words, and combining the words to obtain a plurality of word combinations; for each target text, determining a text vector of the target text based on a plurality of words and a plurality of word combinations corresponding to the target text; clustering a plurality of target texts based on the text vectors of the target texts to obtain a plurality of clusters; and extracting the target label of the user from at least one target text contained in each class cluster.

The communication bus mentioned in the above server may be a Peripheral Component Interconnect (PCI) bus, an Extended Industry Standard Architecture (EISA) bus, or the like. The communication bus may be divided into an address bus, a data bus, a control bus, etc. For ease of illustration, only one thick line is shown, but this does not mean that there is only one bus or one type of bus.

The communication interface is used for communication between the server and other devices.

The Memory may include a Random Access Memory (RAM) or a non-volatile Memory (non-volatile Memory), such as at least one disk Memory. Optionally, the memory may also be at least one memory device located remotely from the processor.

The Processor may be a general-purpose Processor, and includes a Central Processing Unit (CPU), a Network Processor (NP), and the like; the Integrated Circuit may also be a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), a Field Programmable Gate Array (FPGA) or other Programmable logic device, a discrete Gate or transistor logic device, or a discrete hardware component.

In another embodiment provided by the present application, there is also provided a storage medium having stored therein instructions that, when run on an apparatus, cause a computer to execute the label extraction method according to any one of the above embodiments.

In a further embodiment provided by the present application, there is also provided a computer program product comprising instructions which, when run on an apparatus, cause the apparatus to perform the label extraction method as described in any of the above embodiments.

In the above embodiments, the implementation may be wholly or partially realized by software, hardware, firmware, or any combination thereof. When implemented in software, may be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When loaded and executed on a computer, cause the processes or functions described in accordance with the embodiments of the application to occur, in whole or in part. The computer may be a general purpose computer, a special purpose computer, a network of computers, or other programmable device. The computer instructions may be stored on a storage medium or transmitted from one storage medium to another, for example, from one website, computer, server, or data center to another website, computer, server, or data center via wire (e.g., coaxial cable, fiber optic, Digital Subscriber Line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.). The storage medium may be any available medium that can be accessed by a computer or a data storage device including one or more available media integrated servers, data centers, and the like. The usable medium may be a magnetic medium (e.g., floppy Disk, hard Disk, magnetic tape), an optical medium (e.g., DVD), or a semiconductor medium (e.g., Solid State Disk (SSD)), among others.

It is noted that, herein, relational terms such as first and second, and the like may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Also, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other identical elements in a process, method, article, or apparatus that comprises the element.

All the embodiments in the present specification are described in a related manner, and the same and similar parts among the embodiments may be referred to each other, and each embodiment focuses on the differences from the other embodiments. In particular, for the system embodiment, since it is substantially similar to the method embodiment, the description is simple, and for the relevant points, reference may be made to the partial description of the method embodiment.

The above description is only for the preferred embodiment of the present application, and is not intended to limit the scope of the present application. Any modification, equivalent replacement, improvement and the like made within the spirit and principle of the present application are included in the protection scope of the present application.

完整详细技术资料下载
上一篇:石墨接头机器人自动装卡簧、装栓机
下一篇:一种基于物联网的校园资料查询云平台

网友询问留言

已有0条留言

还没有人留言评论。精彩留言会获得点赞!

精彩留言,会给你点赞!