Text processing method and apparatus, computing device, and computer-readable storage medium
By acquiring entity features and general word features of low-resource language texts, forming a feature word matrix, and inputting it into the text model, the problem of poor feature extraction accuracy of low-resource language texts is solved, and more efficient text processing results are achieved.
Patent Information
- Application Number
- CN202111610431.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-12-27
- Publication Date
- 2026-02-13
- Estimated Expiration
- 2041-12-27
AI Technical Summary
In existing technologies, the accuracy of feature extraction is poor when processing low-resource language texts, especially in terms of entity extraction and semantic annotation, where there is a lack of effective technical means.
By acquiring the text to be processed, extracting its entity features and adding general word features to form a feature word matrix, optimizing the word feature vectors using a labeling model and a random discretization feature selection matrix, and inputting the result into a preset text model for processing.
It improves the accuracy of low-resource text feature extraction, is more adaptable, and is especially efficient in multi-document classification and new document processing.
Smart Images

Figure CN114358009B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] Embodiments of the present application relate to the technical field of text processing, and in particular to a text processing method and device, a computing device, and a computer readable storage medium. BACKGROUND
[0002] In the prior art, in the aspect of key text extraction, the methods are usually applied to high-resource language texts. Since there are more text resources, methods such as word frequency comparison construction, coding and decoding principles, and vector construction models are usually used. However, since there is little technical information on text processing of low-resource languages, including entity extraction, semantic labeling, and key text extraction, technical mining and application in this regard have not been valued.
[0003] The present inventors have found in the process of implementing embodiments of the present application that the current low-resource text has poor adaptability to existing text processing techniques due to the small amount of text, and the accuracy of feature extraction is much worse than processing high-resource text. SUMMARY
[0004] In view of the above problems, embodiments of the present application provide a text processing method and device, a computing device, and a computer readable storage medium, to solve the problem of poor accuracy of low-resource text feature extraction in the prior art.
[0005] According to an aspect of embodiments of the present application, a text processing method is provided, the method comprising:
[0006] obtaining a text to be processed;
[0007] extracting corresponding entity features in the text to be processed;
[0008] adding general word features in the text to be processed to the entity features according to the context of the text to be processed, to obtain a feature word matrix;
[0009] inputting the feature word matrix into a preset text model to obtain a text processing result corresponding to the text to be processed.
[0010] In an optional manner, the extracting of the corresponding entity features in the text to be processed comprises: extracting word vectors in the text to be processed through a labeling model; the labeling model adds low-resource language rules; and the word vectors are classified by prediction to obtain the entity features corresponding to the text to be processed, the entity features including entities and corresponding attributes.
[0011] In an alternative approach, before extracting word vectors from the text to be processed using the annotation model, the method further includes: obtaining a training sample set for entity recognition; training the annotation model based on the training sample set; and adjusting the annotation model parameters according to a feature classifier to obtain the trained annotation model.
[0012] In one optional approach, the step of adding general word features from the text to be processed to the entity features to obtain a feature word matrix based on the context of the text to be processed includes: obtaining an initial cluster matrix of the text to be processed; processing the initial cluster matrix according to a preset random discretization feature selection matrix to obtain a discretized word feature vector; calculating the relevance score between words based on the word feature frequency of the discretized word feature vector; updating the discretized word feature vector based on the relevance score to obtain an updated discretized word feature vector; adjusting and optimizing the updated discretized word feature vector to obtain an optimized word feature vector; and adding the optimized word feature vector to the entity features to obtain a feature word matrix.
[0013] In one optional approach, adjusting and optimizing the updated discretized word feature vector to obtain an optimized word feature vector includes: calculating the distance feature score between each of the related words based on the relevance score; optimizing the related word attribute feature value in the updated discretized word feature vector based on the distance feature score; and updating the relevance score based on the optimized related word attribute feature value to obtain the optimized word feature vector.
[0014] In one optional approach, optimizing the related word attribute feature values in the updated discretized word feature vector based on the distance feature scores includes: calculating the Euclidean distance between the distance feature scores of two related words; calculating the distance coefficient between the two related words based on the Euclidean distance; and optimizing the related word attribute feature values based on the distance coefficient.
[0015] In one optional approach, the text model is a text classification model; the step of inputting the feature word matrix into a preset text model to obtain the text processing result corresponding to the text to be processed includes: inputting the feature word matrix into the text classification model to obtain the text classification result corresponding to the text to be processed.
[0016] According to another aspect of the present invention, a text processing apparatus is provided, comprising:
[0017] The acquisition module is used to acquire the text to be processed;
[0018] An extracting module is configured to extract corresponding entity features in the text to be processed;
[0019] An adding module is configured to add general word features in the text to be processed into the entity features according to a context of the text to be processed, to obtain a feature word matrix;
[0020] A classifying module is configured to input the feature word matrix into a preset text model, to obtain a text processing result corresponding to the text to be processed.
[0021] According to another aspect of the embodiments of the present application, a computing device is provided, which includes a processor, a memory, a communication interface and a communication bus, the processor, the memory and the communication interface complete communication with each other through the communication bus;
[0022] The memory is configured to store at least one executable instruction, and the executable instruction causes the processor to perform the operations of the text processing method.
[0023] According to still another aspect of the embodiments of the present application, a computer readable storage medium is provided, which stores at least one executable instruction, and the executable instruction causes a computing device to perform the operations of the text processing method when the computing device runs.
[0024] The embodiments of the present application can effectively improve the accuracy of low-resource text feature extraction by obtaining a text to be processed, extracting corresponding entity features in the text to be processed, adding general word features in the text to be processed into the entity features according to a context of the text to be processed, obtaining a feature word matrix, inputting the feature word matrix into a preset text model, and obtaining a text processing result corresponding to the text to be processed.
[0025] The above description is only a summary of the technical solutions of the embodiments of the present application, in order to more clearly understand the technical means of the embodiments of the present application, the embodiments of the present application can be implemented according to the content of the specification, and in order to make the above and other purposes, features and advantages of the embodiments of the present application more obvious and easy to understand, the following specific embodiments of the present application are described. BRIEF DESCRIPTION OF DRAWINGS
[0026] The accompanying drawings are only used to show the embodiments and are not considered as limitations of the present application. Moreover, the same reference signs are used to represent the same components throughout the drawings. In the drawings:
[0027] Figure 1 A flowchart of a text processing method provided by the embodiments of the present application is shown;
[0028] Figure 2 A structure diagram of a text processing device provided by the embodiments of the present application is shown;
[0029] Figure 3 A structural schematic diagram of a computing device provided by an embodiment of the present application is shown. DETAILED DESCRIPTION
[0030] Exemplary embodiments of the present application will be described in detail with reference to the drawings. Although exemplary embodiments of the present application are shown in the drawings, it should be understood that the present application can be implemented in various forms and should not be limited by the embodiments set forth herein.
[0031] Figure 1 A flowchart of a text processing method provided by an embodiment of the present application is shown, which is executed by a computing device. The computing device can be a computer device, a terminal device, a smart device, etc., and embodiments of the present application are not limited specifically. As shown in the flowchart, the method comprises the following steps: Figure 1
[0032] Step 110: obtaining a text to be processed.
[0033] In an embodiment of the present application, the text to be processed is data input by a user or obtained by a system from a network, etc.
[0034] In the extraction of word features and key text classification, the extraction of features is a key step. Low-resource languages are similar to existing high-resource languages, especially the regularity of text, which transmits short and regular content features between information exchanges. It should be noted that the method proposed in the present application extracts word features corresponding to a document separately, which is irrelevant to other documents. This has obvious advantages compared with general model training methods: 1. Regardless of the size of the document, the feature extraction method is universal, and the size of the document does not affect the feature processing process; 2. When applied to multi-document classification, only the incremental documents need to be updated, and there is no need to load the features of the inventory documents and retrain to extract features. The processing efficiency is higher when new document information is added.
[0035] Step 120: extracting entity features corresponding to the text to be processed.
[0036] The entity features include entities and their attributes corresponding to the text to be processed.
[0037] In the embodiment of the present application, the distance supervision method is used to extract entities. First, a word vector in the text to be processed is extracted through a labeling model, wherein the labeling model adds low-resource language rules; then the word vector is predicted and classified to obtain entity features corresponding to the text to be processed, the entity features including entities and corresponding attributes. In the embodiment of the present application, the low-resource language text refers to a sentence or a word expressed in a low-resource language, a language with a small amount of text. The low-resource language refers to a language with a small number of users and a language and voice research that is relatively backward, such as various small foreign languages and minority languages. The low-resource language rule refers to a language rule specific to various low-resource languages.
[0038] Before extracting the corresponding entity features in the text to be processed, the labeling model needs to be trained first, and the specific training process is as follows:
[0039] Step 001: Obtain a training data set and a test data set for named entity recognition, and obtain attributes corresponding to entities in the training data set and the test data set. In the embodiment of the present application, the specific definition of the attribute is not specifically limited, and a person skilled in the art can set it according to the specific scene. In one embodiment, the attribute includes PER (person name), LOC (location), DATE (date), ORG (organization), OTH (non-named entity label), and TIM (time). The scope of the training data set and the test data set is not limited, and the general operation language translation obtained from various websites, forums, blogs, Wikipedia, etc. can be used as the initial low-resource language text data set.
[0040] Step 002: Train the labeling model according to the training sample set.
[0041] In the method of core word vector embedding, word sense disambiguation is considered, which uses the combination of word vectors of each word or word to generate its final vector embedding, and obtains it in an iterative manner. Considering that there are also cross-words in the low-resource language environment, and there are special grammar structures and some very used words, the embedding calculation of the multi-dimensional word vector in the low-resource language environment is considered, and based on different positions, a plurality of different vector embeddings of each position are calculated. Therefore, the final word vector (i.e. vector embedding) of the low-resource text can be obtained by iterative calculation of the following algorithm of the labeling model:
[0042]
[0043] wherein l is the identification of a specific position l of a certain word, w j l is x j lIn the word vector corresponding to the specific position l where the word j is located, N j is x j l The number of characters contained in x k is x j l The vector embedding representation of the kth word in x Through iteration calculation at different positions, the vector embedding represented by a specific word at a corresponding specific position can be obtained, so that the efficiency and accuracy of the vector representation at the specific position are improved through the linear layer, and the calculation does not depend on the mass of corpus data, and the result also does not depend on the data capacity itself, which has more practical application value.
[0044] Step 003: adjusting the labeling model parameter of the labeling model according to the feature classifier, to obtain the trained labeling model.
[0045] Wherein, by using the commonly used feature classifier, the pre-training word embedding on the data feature obtained in the above step is fine-tuned, and more accurate word embedding results can be obtained. Fine-tune the feature representation. Taking the CRF classifier as an example, because CRF is a global range of normalized conditional state transition probability matrix, the class of each label of a specified sample is predicted, so the CRF classifier can give limited features, so that the word embedding learns a new nonlinear transformation space. All parameters of the word embedding in the labeling model are fine-tuned, including the end-to-end CRF, compared with the word features extracted directly from the word embedding training classifier, better performance will be obtained.
[0046] Wherein, after training the labeling model, the text to be processed is input into the labeling model, so as to obtain the corresponding entity and the corresponding attribute. For example, by inputting a low-resource text, the entity and its attribute contained therein are identified according to the preset attribute rules and the special language rules, wherein the special language rules can be set according to the specific scene. Taking a Chinese sentence as an example, "Today night 777 and 888 will hold a wedding ceremony at Huanghe Hotel." Identify "today night" -DATE, "777", "888" -PER, "Huanghe (hotel)" -LOC, "wedding" -OTH.
[0047] Step 130: according to the context of the text to be processed, the general word features in the text to be processed are added to the entity features to obtain a feature word matrix.
[0048] Wherein, considering that the general word features must depend on the context of the text (including entity) features, the previously extracted entity features will be included in the word feature extraction.
[0049] Specifically, the following steps are included:
[0050] Step 1301: Obtain the initial cluster matrix of the text to be processed. The document size is the number of deduplicated words it contains (including common words), and a random initial cluster matrix is obtained based on the number of deduplicated words.
[0051] Step 1302: Process the initial cluster matrix according to the preset random discretization feature selection matrix to obtain the discretized word feature vector.
[0052] The stochastic discretization feature selection matrix, which is efficiently computed and recognizable by a computer, is defined as follows:
[0053]
[0054] Where S(x) ij ) represents the discrete value in the randomized discretized feature selection matrix, if the discrete value S(x ij () is greater than the random value, x ij The value is 1 if x is positive and 0 otherwise. ij This indicates whether a certain key feature exists between the i-th word and the j-th context word in the document. The random value ranges from 0 to 1, including the first and last words. Random values are used here to increase the utilization rate of the existence of features between related words for extracting key information from the text and to improve computational efficiency.
[0055] Step 1303: Calculate the relevance score between words based on the word feature frequency of the discretized word feature vector.
[0056] In this embodiment of the invention, when the frequency of word features in the discretized word feature vector is greater than a preset threshold, the word feature frequencies can be summed to obtain a relevance score between words. The preset threshold is set according to the specific business scenario. Wherein, if x ij The corresponding word feature frequency WFF(x) ij If the word feature frequency WFF(x) is greater than the preset threshold, then the word feature frequency WFF(x) can be... ij ) Summing up the relevance scores between words yields ∑WFF(x ij The threshold is greater than the preset threshold, which means that a specific feature corresponding to the word is considered to be meaningful and highly correlated with the features of related words. Therefore, when extracting key information, the features are naturally related.
[0057] Step 1304: Update the discretized word feature vector according to the relevance score to obtain the updated discretized word feature vector.
[0058] Step 1305: Adjust and optimize the updated discretized word feature vector to obtain the optimized word feature vector.
[0059] Specifically, according to the correlation score, a distance feature score between each of the related words is calculated. According to the above obtained correlation score between words, the distance feature scores of any two related words are compared, and the larger distance feature score is migrated to the smaller one. Here, the distance feature scores of two related words are calculated by the Euclidean distance formula. Taking a feature attribute as an example, such as the time attribute, then the distance calculation space is two-dimensional space, and according to the feature attribute, the Euclidean distance formula is defined as follows:
[0060]
[0061] wherein d represents the number of document de-duplication words (including general words), that is, the size of the document after de-duplication processing, and is also the one-dimensional vector size of the random discretization feature selection matrix. ij represents whether a certain key feature exists between the i-th word and the j-th context-related word in the document; similarly, ik represents whether a certain key feature exists between the i-th word and the k-th context-related word in the document. If the number of attribute in the word feature vector is greater than 1, the above Euclidean distance formula can be extended to three-dimensional space.
[0062] Then, according to the distance feature score, the related word attribute feature value in the updated discretization word feature vector is optimized.
[0063] wherein the distance coefficient between any two related words is first defined as wherein, as above, p represents the Euclidean distance of the distance feature score of any two related words, C0 represents the distance coefficient when p = 0, and γ represents a fixed feature correlation coefficient, which is a fixed value specified in advance according to experimental settings. In addition, because the Euclidean distance is used, in order to simplify the calculation, the square is placed outside the Euclidean distance formula, so m is set to 2. Next, the related word key feature attribute is calculated according to the iterative optimization formula, which is as follows:
[0064]
[0065] In the formula, a r represents a random number in the range [-1 / 2, 1 / 2], and the remaining parameters are explained above and will not be repeated here. According to the above iterative optimization formula, the key feature attribute of any related word can be calculated, and a fixed number of iterations is selected according to the actual text size, and the optimized feature result is calculated by iteration.
[0066] Finally, the correlation score is updated according to the optimized related word attribute feature value, and the optimized word feature vector is obtained. Wherein, the correlation score between words is updated according to the optimized related word attribute feature value. ij), and a feature matrix (i.e., the above score matrix, containing the correlation scores between words) is formed according to the updated correlation scores. Thus far, the relevant features of the general words are extracted in connection with the context.
[0067] Taking the above Chinese as an example, with slight changes, “Today night 77 and 88 will hold a wedding ceremony at the Yellow River Hotel.” The above identifies “today night”-DATE, “77”, “88”-PER, “Yellow River (hotel)”-LOC, and “wedding ceremony”-OTH. After adding the general word feature relationship, through more sample training, it is identified that “will” represents the meaning of “future, future”, and “today night”-DATE is further refined as “future” DATE, adding the future attribute of “future”. In the sentence “Today night class has been finished.”, the meaning of “has been” and “finished” is identified as “past”, and correspondingly, “today night”-DATE is further refined as “past” DATE, adding the past attribute of “past”. Further, “wedding ceremony”-OTH can be determined as an event through “hold”, and can also be identified as a “relationship” attribute through more training samples, which needs to link two PER entities. Because for low-resource languages, the machine does not know in advance the influence of a general word on the semantic understanding of the context.
[0068] The key features of tense or voice are exemplified by the most commonly used Chinese and English. “I have already eaten.” — The context relationship established by “eat-rice” and “have-already” determines the tense feature. “I haven’t eaten yet.” — The tense feature represented by “haven’t” is different from the previous sentence. “I don’t go out until I have my lunch.” I don’t go out until I have my lunch. “I don’t go out after I have my lunch.” I don’t go out after I have my lunch. — “until” and “after” are general words that can be easily pre-processed and filtered out in some models, but the tense features they contain are very important for the understanding of the whole sentence and even the meaning of the context.
[0069] Step 1306: Add the optimized word feature vector to the entity feature to obtain a feature word matrix. In the embodiment of the application, the above optimized word feature vector is added to the entity feature (the above obtained entity and its attribute), and in order to integrate the feature information for subsequent use, the weighted method can be used for addition, i.e., the feature matrix is weighted and calculated.
[0070] Step 140: inputting the feature word matrix into a preset text model to obtain a text processing result corresponding to the text to be processed.
[0071] The preset text model can be a pre-trained text classification model, an abstract generation model, a title generation model, an intelligent interaction semantic understanding model, etc.
[0072] The embodiment of the application can obtain a to-be-processed text, extract corresponding entity features in the to-be-processed text, add general word features in the to-be-processed text into the entity features according to a context of the to-be-processed text, obtain a feature word matrix, input the feature word matrix into a preset text model, and obtain a text processing result corresponding to the to-be-processed text, thereby effectively improving the accuracy of low-resource text feature extraction.
[0073] Figure 2 A structure schematic diagram of a text processing device provided by the embodiment of the application is shown. As shown in the figure, the device 300 includes: Figure 2
[0074] The obtaining module 310 is configured to obtain a to-be-processed text.
[0075] The extracting module 320 is configured to extract corresponding entity features in the to-be-processed text.
[0076] The adding module 330 is configured to add general word features in the to-be-processed text into the entity features according to a context of the to-be-processed text, and obtain a feature word matrix.
[0077] The classification module 340 is configured to input the feature word matrix into a preset text model, and obtain a text processing result corresponding to the to-be-processed text.
[0078] In an optional manner, the extracting of the corresponding entity features in the to-be-processed text includes: extracting a word vector in the to-be-processed text by a labeling model; the labeling model adds low-resource language rules; and the word vector is classified by prediction to obtain the corresponding entity features of the to-be-processed text, wherein the entity features include an entity and corresponding attributes.
[0079] In an optional manner, before the extracting of the word vector in the to-be-processed text by the labeling model, the method further includes: obtaining a training sample set for entity recognition; training the labeling model according to the training sample set; adjusting the labeling model parameters of the labeling model according to a feature classifier to obtain the trained labeling model.
[0080] In an optional manner, the adding of the general word features in the to-be-processed text into the entity features according to the context of the to-be-processed text to obtain a feature word matrix comprises: obtaining an initial cluster matrix of the to-be-processed text; processing the initial cluster matrix according to a preset random discretization feature selection matrix to obtain a discretized word feature vector; calculating a correlation score between words according to the word feature frequency of the discretized word feature vector; updating the discretized word feature vector according to the correlation score to obtain an updated discretized word feature vector; adjusting and optimizing the updated discretized word feature vector to obtain an optimized word feature vector; and adding the optimized word feature vector to the entity features to obtain the feature word matrix.
[0081] In an optional manner, the adjusting and optimizing of the updated discretized word feature vector to obtain an optimized word feature vector comprises: calculating a distance feature score between each of the related words according to the correlation score; optimizing the related word attribute feature value in the updated discretized word feature vector according to the distance feature score; and updating the correlation score according to the optimized related word attribute feature value to obtain the optimized word feature vector.
[0082] In an optional manner, the optimizing of the related word attribute feature value in the updated discretized word feature vector according to the distance feature score comprises: calculating the Euclidean distance of the distance feature score between two related words; calculating a distance coefficient between the two related words according to the Euclidean distance; and optimizing the related word attribute feature value according to the distance coefficient.
[0083] In an optional manner, the text model is a text classification model; and the inputting of the feature word matrix into the preset text model to obtain a text processing result corresponding to the to-be-processed text comprises: inputting the feature word matrix into the text classification model to obtain a text classification result corresponding to the to-be-processed text.
[0084] The specific implementation process of the text processing device of the embodiment of the present application is generally consistent with the specific steps of the above text processing method, and will not be repeated here.
[0085] The embodiment of the present application can effectively improve the accuracy of low-resource text feature extraction by obtaining a to-be-processed text, extracting corresponding entity features in the to-be-processed text, adding general word features in the to-be-processed text into the entity features according to the context of the to-be-processed text to obtain a feature word matrix, and inputting the feature word matrix into a preset text model to obtain a text processing result corresponding to the to-be-processed text.
[0086] Figure 3Fig. 1 shows a structural schematic diagram of a computing device provided by an embodiment of the present application, and the embodiment of the present application does not limit the specific implementation of the computing device.
[0087] As shown in Fig. 1, the computing device can include a processor 402, a communications interface 404, a memory 406, and a communications bus 408. Figure 3
[0088] The processor 402, the communications interface 404, and the memory 406 can communicate with each other through the communications bus 408. The communications interface 404 is configured to communicate with network elements such as clients or other servers, etc. The processor 402 is configured to execute a program 410, and specifically can execute the related steps in the above-described text processing method embodiments.
[0089] Specifically, the program 410 can include program code including computer-executable instructions.
[0090] The processor 402 can be a central processing unit (CPU), or an application specific integrated circuit (ASIC), or one or more integrated circuits configured to implement embodiments of the present application. The one or more processors included in the computing device can be processors of the same type, such as one or more CPUs, or processors of different types, such as one or more CPUs and one or more ASICs.
[0091] The memory 406 is configured to store the program 410. The memory 406 can include a high-speed RAM memory, and can also include a non-volatile memory such as at least one disk memory.
[0092] The program 410 can specifically be invoked by the processor 402 to enable the computing device to perform the following operations:
[0093] Obtain a text to be processed;
[0094] Extract corresponding entity features in the text to be processed;
[0095] According to the context of the text to be processed, add general word features in the text to be processed into the entity features to obtain a feature word matrix;
[0096] Input the feature word matrix into a preset text model to obtain a text processing result corresponding to the text to be processed.
[0097] In an optional manner, the extracting the corresponding entity feature in the to-be-processed text comprises: extracting a word vector in the to-be-processed text by a labeling model; the labeling model adds a low-resource language rule; and the word vector is classified by prediction to obtain the corresponding entity feature of the to-be-processed text, wherein the entity feature comprises an entity and a corresponding attribute.
[0098] In an optional manner, before the extracting the word vector in the to-be-processed text by the labeling model, the method further comprises: obtaining a training sample set for entity recognition; training the labeling model according to the training sample set; adjusting a labeling model parameter of the labeling model according to a feature classifier to obtain the trained labeling model.
[0099] In an optional manner, the adding the general word feature in the to-be-processed text into the entity feature according to the context of the to-be-processed text to obtain a feature word matrix comprises: obtaining an initialization cluster matrix of the to-be-processed text; processing the initialization cluster matrix according to a preset random discretization feature selection matrix to obtain a discretized word feature vector; calculating a correlation score between words according to a word feature frequency of the discretized word feature vector; updating the discretized word feature vector according to the correlation score to obtain an updated discretized word feature vector; adjusting and optimizing the updated discretized word feature vector to obtain an optimized word feature vector; and adding the optimized word feature vector to the entity feature to obtain the feature word matrix.
[0100] In an optional manner, the adjusting and optimizing the updated discretized word feature vector to obtain the optimized word feature vector comprises: calculating a distance feature score between each of the related words according to the correlation score; optimizing a related word attribute feature value in the updated discretized word feature vector according to the distance feature score; and updating the correlation score according to the optimized related word attribute feature value to obtain the optimized word feature vector.
[0101] In an optional manner, the optimizing the related word attribute feature value in the updated discretized word feature vector according to the distance feature score comprises: calculating a Euclidean distance of the distance feature score between two related words; calculating a distance coefficient between the two related words according to the Euclidean distance; and optimizing the related word attribute feature value according to the distance coefficient.
[0102] In an optional mode, the text model is a text classification model; and the inputting the feature word matrix into the preset text model to obtain the text processing result corresponding to the text to be processed comprises: inputting the feature word matrix into the text classification model to obtain a text classification result corresponding to the text to be processed.
[0103] The embodiment of the present application can effectively improve the accuracy of low-resource text feature extraction by obtaining a text to be processed, extracting corresponding entity features in the text to be processed, adding general word features in the text to be processed into the entity features according to the context of the text to be processed, obtaining a feature word matrix, and inputting the feature word matrix into a preset text model to obtain a text processing result corresponding to the text to be processed. The embodiment of the present application provides a computer-readable storage medium, which stores at least one executable instruction. When the executable instruction runs on a computing device, the computing device executes the text processing method in any method embodiment described above.
[0104] The executable instruction can be specifically used to make the computing device perform the following operations:
[0105] obtaining a text to be processed;
[0106] extracting corresponding entity features in the text to be processed;
[0107] adding general word features in the text to be processed into the entity features according to the context of the text to be processed to obtain a feature word matrix;
[0108] inputting the feature word matrix into a preset text model to obtain a text processing result corresponding to the text to be processed.
[0109] In an optional mode, the extracting the corresponding entity features in the text to be processed comprises: extracting a word vector in the text to be processed by a labeling model; the labeling model adds low-resource language rules; and the word vector is classified by prediction to obtain the entity features corresponding to the text to be processed, wherein the entity features include entities and corresponding attributes.
[0110] In an optional mode, before the extracting the word vector in the text to be processed by the labeling model, the method further comprises: obtaining a training sample set for entity recognition; training the labeling model according to the training sample set; adjusting the labeling model parameters of the labeling model according to a feature classifier to obtain the trained labeling model.
[0111] In an optional manner, the adding of the general word features in the to-be-processed text into the entity features according to the context of the to-be-processed text to obtain a feature word matrix comprises: obtaining an initial cluster matrix of the to-be-processed text; processing the initial cluster matrix according to a preset random discretization feature selection matrix to obtain a discretized word feature vector; calculating a correlation score between words according to the word feature frequency of the discretized word feature vector; updating the discretized word feature vector according to the correlation score to obtain an updated discretized word feature vector; adjusting and optimizing the updated discretized word feature vector to obtain an optimized word feature vector; and adding the optimized word feature vector to the entity features to obtain the feature word matrix.
[0112] In an optional manner, the adjusting and optimizing of the updated discretized word feature vector to obtain an optimized word feature vector comprises: calculating a distance feature score between each of the related words according to the correlation score; optimizing the related word attribute feature value in the updated discretized word feature vector according to the distance feature score; and updating the correlation score according to the optimized related word attribute feature value to obtain the optimized word feature vector.
[0113] In an optional manner, the optimizing of the related word attribute feature value in the updated discretized word feature vector according to the distance feature score comprises: calculating the Euclidean distance of the distance feature score between two related words; calculating a distance coefficient between the two related words according to the Euclidean distance; and optimizing the related word attribute feature value according to the distance coefficient.
[0114] In an optional manner, the text model is a text classification model; and the inputting of the feature word matrix into a preset text model to obtain a text processing result corresponding to the to-be-processed text comprises: inputting the feature word matrix into the text classification model to obtain a text classification result corresponding to the to-be-processed text.
[0115] The embodiment of the present application can effectively improve the accuracy of low-resource text feature extraction by obtaining a to-be-processed text, extracting corresponding entity features in the to-be-processed text, adding general word features in the to-be-processed text into the entity features according to the context of the to-be-processed text to obtain a feature word matrix, and inputting the feature word matrix into a preset text model to obtain a text processing result corresponding to the to-be-processed text.
[0116] The embodiment of the present application provides a text processing device for executing the above-mentioned text processing method.
[0117] The embodiment of the present application provides a computer program, which can be invoked by a processor to enable a computing device to perform the text processing method in any method embodiment.
[0118] The embodiment of the present application provides a computer program product, which comprises a computer program stored on a computer readable storage medium, and the computer program comprises program instructions, which, when executed on a computer, enable the computer to perform the text processing method in any method embodiment.
[0119] The algorithms and displays presented herein are not inherently related to any particular computer, virtual system, or other apparatus. Various general purpose systems can be used with programs in accordance with the teachings herein, or it can prove convenient to construct more specialized apparatus to perform the required method steps. The required structure for a variety of these systems will be apparent from the description above. In addition, the present embodiment is not intended to be limited to any particular programming language. It will be appreciated that there are many programming languages that can be used to implement the teachings herein, and any such programming language can be used in connection with the various aspects of the present embodiment.
[0120] In the description provided herein, numerous specific details are set forth. However, it is understood that embodiments of the application can be practiced without these specific details. In some instances, well-known methods, structures and techniques have not been described in detail in order to avoid obscuring the understanding of this description.
[0121] Similarly, it is to be understood that the mechanical details of the application sometimes are presented in terms of sequences of actions to be taken by, for example, elements of the application, and that these dis- cussions are meant to include all such reasonably possible implementations of the application. Additionally, the description could be presented in terms of systems including a number of devices, components, steps and / or data structures. Such
[0122] Those of skill in the art would understand that information and signals can be represented using any of a variety of different technologies and techniques. For example, data, instructions, commands, information, signals, bits, symbols, and chips that can be referenced throughout the above description can be represented by voltages, currents, electromagnetic waves, magnetic fields or particles, optical fields or particles, or any combination thereof.
[0123] It should be noted that the above-mentioned embodiments illustrate rather than limit the application, and that those skilled in the art will be able to design many alternative embodiments without departing from the scope of the appended claims. In the claims, any reference signs placed between parentheses shall not be construed as limiting the claim. The word 'comprising' does not exclude the presence of elements or steps other than those listed in a claim. The word 'a' or 'an' preceding an element does not exclude the presence of a plurality of such elements. The application can be implemented by means of both hardware and software, and any combination thereof. In a unitary claim, several devices, apparatuses or means can be listed, comprising means for carrying out a certain task. The use of the term'means' in a claim is intended to refer to a combination of devices, apparatuses or means for carrying out a task. The word 'first','second', 'third', etc. do not imply any order. The use of these terms is to be construed as an indication of particular embodiments. Steps in the above-described embodiments, unless otherwise specified, are not to be construed as necessarily limiting the order in which the steps are performed.
Claims
1. A text processing method characterized by, The method comprises: acquiring a text to be processed; extracting corresponding entity features in the text to be processed; adding general word features in the text to be processed into the entity features according to a context of the text to be processed to obtain a feature word matrix; wherein, an initial cluster matrix of the text to be processed is acquired; the initial cluster matrix is processed according to a preset random discretization feature selection matrix to obtain a discretized word feature vector; a correlation score between words is calculated according to a word feature frequency of the discretized word feature vector; the discretized word feature vector is updated according to the correlation score to obtain an updated discretized word feature vector; a distance feature score between each relevant word is calculated according to the correlation score; relevant word attribute feature values in the updated discretized word feature vector are optimized according to the distance feature score; the correlation score is updated according to the optimized relevant word attribute feature values to obtain the optimized word feature vector; the optimized word feature vector is added to the entity features to obtain the feature word matrix; inputting the feature word matrix into a preset text model to obtain a text processing result corresponding to the text to be processed.
2. The method of claim 1, wherein, The extracting of the corresponding entity features in the text to be processed comprises: extracting a word vector in the text to be processed through a labeling model; the labeling model adds low-resource language rules; performing predictive classification on the word vector to obtain entity features corresponding to the text to be processed, wherein the entity features include entities and corresponding attributes.
3. The method of claim 2, wherein, Before the extracting of the word vector in the text to be processed through the labeling model, the method further comprises: acquiring a training sample set for entity recognition; training the labeling model according to the training sample set; adjusting labeling model parameters of the labeling model according to a feature classifier to obtain the trained labeling model.
4. The method of claim 1, wherein, The optimizing of the relevant word attribute feature values in the updated discretized word feature vector according to the distance feature score comprises: calculating an Euclidean distance of the distance feature score between two relevant words; calculating a distance coefficient between the two relevant words according to the Euclidean distance; optimizing the relevant word attribute feature values according to the distance coefficient.
5. The method of claim 1, wherein, The text model is an abstract generation model; the inputting of the feature word matrix into the preset text model to obtain the text processing result corresponding to the text to be processed comprises: inputting the feature word matrix into the preset text model to obtain an abstract text corresponding to the text to be processed.
6. A text processing apparatus characterized by comprising: The device comprises: an acquisition module configured to acquire a text to be processed; an extraction module configured to extract corresponding entity features in the text to be processed; The adding module is configured to add general word features in the to-be-processed text into the entity features according to a context of the to-be-processed text, to obtain a feature word matrix; the general word features include calculating distance feature scores between each related word according to a correlation score between words, optimizing a related word attribute feature value, and updating the correlation score according to the related word attribute feature value to obtain the word feature vector; wherein, an initial cluster matrix of the to-be-processed text is obtained; the initial cluster matrix is processed according to a preset random discretization feature selection matrix to obtain a discretized word feature vector; a correlation score between words is calculated according to a word feature frequency of the discretized word feature vector; the discretized word feature vector is updated according to the correlation score to obtain an updated discretized word feature vector; a distance feature score between each related word is calculated according to the correlation score; a related word attribute feature value in the updated discretized word feature vector is optimized according to the distance feature score; the correlation score is updated according to the optimized related word attribute feature value to obtain the optimized word feature vector; and the optimized word feature vector is added to the entity features to obtain the feature word matrix. The classification module is configured to input the feature word matrix into a preset text model to obtain a text processing result corresponding to the to-be-processed text.
7. A computing device, comprising: The text processing method comprises the following steps: a processor, a memory, a communication interface, and a communication bus, the processor, the memory, and the communication interface being in communication with each other through the communication bus; the memory is configured to store at least one executable instruction, and the executable instruction causes the processor to perform the operations of the text processing method according to any one of claims 1-5.
8. A computer-readable storage medium, characterized in that, The storage medium stores at least one executable instruction, and the executable instruction, when running on a computing device, causes the computing device to perform the operations of the text processing method according to any one of claims 1-5.
Citation Information
Patent Citations
Multi-feature bidirectional gating field expert entity extraction method and system
CN112101028A
Text named entity recognition method and device, electronic equipment and storage medium
CN112633001A
News manuscript generation method and device, storage medium and electronic device
CN112949299A