Text processing method, device and computer readable storage medium
By combining the grammatical relationships of text for sequence pattern mining and support calculation in named entity recognition, the problem of ignoring grammatical features in existing methods is solved, and the accuracy of text processing and named entity recognition is improved.
Patent Information
- Application Number
- CN202110920249.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-08-11
- Publication Date
- 2024-10-01
- Estimated Expiration
- 2041-08-11
AI Technical Summary
Existing named entity recognition methods ignore important grammatical features such as morphology and syntax in the text, resulting in low recognition accuracy.
By mining the sequence pattern according to the grammatical relationship of the text, the support of the sequence pattern is obtained, and used as a weight to calculate the grammatical relationship features, and the reference grammatical relationship features are matched to improve the recognition accuracy.
It improves the accuracy of text processing and ensures that the grammatical relationship features more accurately reflect the grammatical relationships of the text, thereby improving the accuracy of named entity recognition.
Smart Images

Figure CN114330310B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of natural semantic processing, and in particular to a text processing method, a text processing device, and a computer-readable storage medium. Background Art
[0002] Natural language processing (NLP) is an important direction in the fields of computer science and artificial intelligence. It studies various theories and methods that can achieve effective communication between people and computers using natural language. Natural language processing is a science that integrates linguistics, computer science, and mathematics. Therefore, research in this field will involve natural language, that is, the language people use in daily life, so it is closely related to the study of linguistics. Natural language processing technology usually includes text processing, semantic understanding, machine translation, robot question answering, knowledge graph and other technologies. Named entity recognition is a hot issue and basic work in natural language processing, and it is of great significance to natural language processing. Existing named entity recognition methods ignore the important grammatical implicit features of named entities in texts, such as lexical syntax, resulting in low accuracy of named entity recognition methods. Summary of the invention
[0003] In order to solve the above technical problems, the embodiments of the present application provide a text processing method and a text processing device, which can improve the accuracy of text processing.
[0004] Other features and advantages of the present application will become apparent from the following detailed description, or may be learned in part by the practice of the present application.
[0005] According to one aspect of an embodiment of the present application, a text method is provided, including: performing sequence pattern mining on a text according to the grammatical relationship corresponding to the text to obtain a sequence pattern corresponding to the text; obtaining the support of the sequence pattern; using the support as a weight to calculate the weighted sum of the sequence pattern to obtain a grammatical relationship feature corresponding to the text; calculating the match between the grammatical relationship feature and a reference grammatical relationship feature, and if the match is greater than a preset threshold, using the category label associated with the reference grammatical relationship feature as the text processing result corresponding to the text.
[0006] According to one aspect of an embodiment of the present application, a text processing device is provided, comprising: a mining module, used to perform sequence pattern mining on a text according to the grammatical relationship corresponding to the text, and obtain the sequence pattern corresponding to the text; an acquisition module, connected to the mining module, used to obtain the support of the sequence pattern; a calculation module, connected to the acquisition module, used to calculate the weighted sum of the sequence pattern using the support as a weight, and obtain the grammatical relationship feature corresponding to the text; a matching module, connected to the calculation module, used to calculate the matching degree between the grammatical relationship feature and the reference grammatical relationship feature, and if the matching degree is greater than a preset threshold, the category label associated with the reference grammatical relationship feature is used as the text processing result corresponding to the text.
[0007] According to one aspect of an embodiment of the present application, an electronic device is provided, including a processor and a memory, wherein the memory stores computer-readable instructions, and when the computer-readable instructions are executed by the processor, the text processing method as described above is implemented.
[0008] According to one aspect of an embodiment of the present application, a computer-readable storage medium is provided, on which computer-readable instructions are stored. When the computer-readable instructions are executed by a processor of a computer, the computer executes the text processing method provided above.
[0009] According to one aspect of the embodiments of the present application, a computer program product or a computer program is provided, the computer program product or the computer program includes a computer instruction, and the computer instruction is stored in a computer-readable storage medium. The processor of the computer device reads the computer instruction from the computer-readable storage medium, and the processor executes the computer instruction, so that the computer device executes the text processing method provided in the above-mentioned various optional embodiments. In the technical solution provided in the embodiments of the present application, the support of each sequence pattern corresponding to the text is first calculated, and based on each sequence pattern and its corresponding support, the weighted sum of all sequence patterns is calculated to obtain the grammatical relationship feature corresponding to the text, and the matching degree between the grammatical relationship feature and the reference grammatical relationship feature is calculated. If the matching degree is greater than a preset threshold, the category label associated with the reference grammatical relationship feature is used as the text processing result corresponding to the text. On the one hand, the grammatical relationship feature corresponding to the text is extracted in combination with the grammatical relationship corresponding to the text. Since the grammatical relationship is used as a factor to process the text, this processing method itself can provide the accuracy of text processing. On the other hand, since the grammatical feature corresponding to the text takes into account each sequence pattern corresponding to the text according to the weight, the reference grammatical relationship feature corresponding to the text can more accurately reflect the grammatical relationship of the text, and then the grammatical relationship feature is matched with the reference grammatical relationship feature, so that the obtained text processing result is more accurate.
[0010] It should be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present application. BRIEF DESCRIPTION OF THE DRAWINGS
[0011] The drawings herein are incorporated into the specification and constitute a part of the specification, showing embodiments consistent with the present application, and together with the specification, are used to explain the principles of the present application. Obviously, the drawings described below are only some embodiments of the present application, and for those of ordinary skill in the art, other drawings can be obtained based on these drawings without creative work. In the drawings:
[0012] Figure 1 is a flowchart of a text processing method shown in an exemplary embodiment of the present application;
[0013] Figure 2 yes Figure 1 Step S100 in the illustrated embodiment is a flow chart of an exemplary embodiment;
[0014] Figure 3 yes Figure 2 Step S110 in the illustrated embodiment is a flow chart of an exemplary embodiment;
[0015] Figure 4 is a schematic diagram of an exemplary syntactic dependency relationship of a word segmentation sequence;
[0016] Figure 5 is a schematic diagram of an exemplary dependency grammatical relationship of a word segmentation sequence;
[0017] Figure 6 yes Figure 1 Step S200 in the illustrated embodiment is a flowchart of an exemplary embodiment;
[0018] Figure 7 yes Figure 6 A flowchart of an exemplary embodiment of step S210 in the illustrated embodiment;
[0019] Figure 8 yes Figure 6 A flowchart of an exemplary embodiment of step S220 in the illustrated embodiment;
[0020] Fig. 9 is a flowchart of an exemplary method of extracting text information;
[0021] Fig.10 It is a block diagram of a text processing device shown in an exemplary embodiment of the present application. DETAILED DESCRIPTION
[0022] Here, exemplary embodiments will be described in detail, examples of which are shown in the accompanying drawings. When the following description refers to the drawings, unless otherwise indicated, the same numbers in different drawings represent the same or similar elements. The implementations described in the following exemplary embodiments do not represent all implementations consistent with the present application. Instead, they are only examples of devices and methods consistent with some aspects of the present application as detailed in the attached claims.
[0023] The block diagrams shown in the accompanying drawings are merely functional entities and do not necessarily correspond to physically independent entities. That is, these functional entities may be implemented in software form, or in one or more hardware modules or integrated circuits, or in different networks and / or processor devices and / or microcontroller devices.
[0024] The flowcharts shown in the accompanying drawings are only exemplary and do not necessarily include all the contents and operations / steps, nor must they be executed in the order described. For example, some operations / steps can be decomposed, and some operations / steps can be combined or partially combined, so the actual execution order may change according to actual conditions.
[0025] It should also be noted that the "multiple" mentioned in this application refers to two or more than two. "And / or" describes the association relationship of the associated objects, indicating that there can be three relationships. For example, A and / or B can mean: A exists alone, A and B exist at the same time, and B exists alone. The character " / " generally indicates that the previous and next associated objects are in an "or" relationship.
[0026] Artificial Intelligence (AI) is the theory, method, technology and application system that uses digital computers or machines controlled by digital computers to simulate, extend and expand human intelligence, perceive the environment, acquire knowledge and use knowledge to obtain the best results. In other words, artificial intelligence is a comprehensive technology in computer science that attempts to understand the essence of intelligence and produce a new intelligent machine that can respond in a similar way to human intelligence. Artificial intelligence is to study the design principles and implementation methods of various intelligent machines so that machines have the functions of perception, reasoning and decision-making.
[0027] Artificial intelligence technology is a comprehensive discipline that covers a wide range of fields, including both hardware-level and software-level technologies. The basic technologies of artificial intelligence generally include sensors, dedicated artificial intelligence chips, cloud computing, distributed storage, big data processing technology, operation / interaction systems, mechatronics and other technologies. Artificial intelligence software technology mainly includes computer vision technology, speech processing technology, natural language processing technology, and machine learning / deep learning.
[0028] Machine Learning (ML) is a multi-disciplinary subject that involves probability theory, statistics, approximation theory, convex analysis, algorithm complexity theory and other disciplines. It specializes in studying how computers simulate or implement human learning behavior to acquire new knowledge or skills and reorganize existing knowledge structures to continuously improve their performance. Machine learning is the core of artificial intelligence and the fundamental way to make computers intelligent. Its applications are spread across all areas of artificial intelligence. Machine learning and deep learning usually include artificial neural networks, belief networks, reinforcement learning, transfer learning, inductive learning, and teaching learning.
[0029] The text processing method and device, electronic device, and computer-readable storage medium proposed in the embodiments of the present application involve artificial intelligence technology and machine learning technology, and these embodiments will be described in detail below.
[0030] At present, name recognition methods based on sequence labeling, name recognition methods based on recurrent neural networks, and name recognition methods based on statistical models all ignore the important name recognition features implied in the lexical and syntactic structure of the text. Such recognition features can play a vital role in locating and extracting name entities.
[0031] Based on this, the text processing method provided by the present application, on the one hand, combines the grammatical relationship corresponding to the text to extract the grammatical relationship features corresponding to the text. Since the grammatical relationship is used as a factor to process the text, this processing method itself can provide the accuracy of text processing. On the other hand, since the grammatical features corresponding to the text take into account each sequence pattern corresponding to the text according to the weight, the reference grammatical relationship features corresponding to the text can more accurately reflect the grammatical relationship of the text, and then match the grammatical relationship features with the reference grammatical relationship features, so that the obtained text processing results are more accurate.
[0032] See also Figure 1 , Figure 1 FIG. 1 is a flowchart of a text processing method shown in an exemplary embodiment of the present application. The text processing method includes the following steps:
[0033] Step S100: performing sequence pattern mining on the text according to the grammatical relationship corresponding to the text to obtain the sequence pattern corresponding to the text.
[0034] In this embodiment, the grammatical relationship of the text may include at least one of a syntactic dependency relationship, a semantic dependency relationship, and a part-of-speech combination relationship. Sequence pattern mining refers to mining patterns with high frequency of occurrence relative to time or other patterns. Given a set consisting of different sequences, each sequence is arranged in order by different elements, and each element is composed of different items, and a user-specified minimum support threshold is given, sequence pattern mining is to find all frequent subsequences, that is, the frequency of occurrence of the subsequence in the sequence set is not less than the minimum support threshold specified by the user. This embodiment performs sequence pattern mining on the text according to the grammatical relationship corresponding to the text, and its purpose is to mine the patterns with higher frequency of occurrence in the text, so as to perform more accurate text processing on the text based on these patterns with higher frequency of occurrence. Step S200: Obtain the support of the sequence pattern.
[0035] Support is the degree of support, usually expressed as a percentage. Common usage scenarios include voting, elections, and public opinion surveys. For example, a certain school's Grade 13 class is holding a class committee election. There are 50 students in the class. In the election for the position of class monitor, Zhang San received 40 votes. So it can be said that in the class monitor election, Zhang San's support is: 40 / 50*100%=80%.
[0036] The concept of support often appears in association analysis of data mining. For example, if there are 1,000 customers shopping in a supermarket, and 200 of them buy bread (item set A), then the support of bread (item set A) is: P(A) = (200 / 1000) * 100% = 20%.
[0037] This embodiment obtains the support of the sequence pattern, and its purpose is to determine the proportion of the sequence pattern in the text. The larger the proportion, the more obvious the grammatical relationship reflected by the sequence pattern. Conversely, the smaller the proportion, the less obvious the grammatical relationship reflected by the sequence pattern.
[0038] Step S300: Using the support as a weight, calculate the weighted sum of the sequence patterns to obtain the grammatical relationship features corresponding to the text.
[0039] In this embodiment, each sequence pattern of the text is first encoded to obtain a vector corresponding to each sequence pattern, and then the vector corresponding to each sequence pattern is normalized to obtain sequence pattern vectors of unified dimension. Finally, the support of the sequence pattern is used as the weight to calculate the weighted sum of all sequence pattern vectors to obtain the grammatical relationship features corresponding to the text.
[0040] Step S400: Calculate the degree of match between the grammatical relationship feature and the reference grammatical relationship feature. If the degree of match is greater than a preset threshold, the category label associated with the reference grammatical relationship feature is used as the text processing result corresponding to the text. The reference grammatical relationship feature is obtained by extracting features from the reference sample based on the grammatical relationship corresponding to the reference sample. Optionally, the reference grammatical relationship feature can be obtained in the same way as the grammatical relationship feature is obtained, that is, based on the grammatical relationship corresponding to the reference sample, sequence pattern mining is performed on the reference sample to obtain a reference sequence pattern corresponding to the reference sample; the support of the reference sequence pattern is obtained, and the support is used as a weight to calculate the weighted sum of the reference sequence pattern to obtain the reference grammatical relationship feature corresponding to the reference sample.
[0041] In this embodiment, the similarity between the reference grammatical relationship feature and the grammatical relationship feature can be calculated, and then the similarity can be used as the matching degree between the two. The cosine distance or Euclidean distance between the reference grammatical relationship feature and the grammatical relationship feature can be calculated to obtain the similarity between the two. It should be noted that the similarity between the reference grammatical relationship feature and the grammatical relationship feature can also be calculated in other ways, and is not limited to this. For example, when performing name recognition, the category label associated with the reference grammatical relationship feature is "there is a name", so the text processing result obtained is that the text to be processed contains a name.
[0042] In summary, in the technical solution provided in the embodiments of the present application, the support of each sequence pattern corresponding to the text is first calculated, and based on each sequence pattern and its corresponding support, the weighted sum of all sequence patterns is calculated to obtain the grammatical relationship features corresponding to the text, and the matching degree between the grammatical relationship features and the reference grammatical relationship features is calculated. If the matching degree is greater than a preset threshold, the category label associated with the reference grammatical relationship features is used as the text processing result corresponding to the text. On the one hand, the grammatical relationship features corresponding to the text are extracted in combination with the grammatical relationship corresponding to the text. Since the grammatical relationship is used as a factor to process the text, this processing method itself can provide accuracy in text processing. On the other hand, since the grammatical features corresponding to the text take into account each sequence pattern corresponding to the text according to the weight, the reference grammatical relationship features corresponding to the text can more accurately reflect the grammatical relationship of the text, and then the grammatical relationship features are matched with the reference grammatical relationship features, so that the obtained text processing results are more accurate.
[0043] See also Figure 2 , Figure 2 yes Figure 1 The step S100 in the embodiment shown is a flowchart of an exemplary embodiment, and the step S100 includes the following steps:
[0044] Step S110: Analyze the grammatical relations contained in the text to obtain a grammatical relation sequence corresponding to the text.
[0045] Optional, see Figure 3 , Figure 3 yes Figure 2 Step S110 in the illustrated embodiment is a flow chart of an exemplary embodiment, and step S110 includes the following steps:
[0046] Step S111: Perform word segmentation processing on the text to obtain a word segmentation sequence corresponding to the text.
[0047] Word segmentation is the basis of natural language processing. The accuracy of word segmentation directly determines the quality of the following part-of-speech tagging, syntactic analysis, word vector and text analysis. Therefore, Chinese word segmentation is crucial for natural language processing. The current word segmentation algorithm is mainly divided into two categories, a dictionary-based rule matching method, and a statistical-based machine learning method. The statistical-based machine learning method mainly includes Hidden Markov model (HMM), conditional random field (CRF), support vector machine (SVM), and deep learning. This embodiment can directly use the existing Chinese word segmentation algorithm to segment the text, and the specific word segmentation process will not be described in detail here.
[0048] Step S112: Perform grammatical analysis on the word segmentation sequence to obtain word segmentation pairs having grammatical relations in the word segmentation sequence.
[0049] In this embodiment, part-of-speech tagging may be performed on the word segmentation sequence corresponding to the text, thereby obtaining a corresponding part-of-speech grammatical relationship sequence.
[0050] Part-of-speech tagging is a text data processing technology in corpus linguistics that marks the part of speech of words in a corpus according to their meaning and context. It is also called grammatical annotation and word class resolution. Part-of-speech tagging methods include rule-based part-of-speech tagging methods, statistical model-based part-of-speech tagging methods, and part-of-speech tagging methods based on a combination of statistics and rules.
[0051] For example, the results of part-of-speech tagging for the word sequences corresponding to the texts “The composer of Blue and White Porcelain is Zhang San”, “The lyricist from thousands of miles away is actually Li Si”, “In addition to Alibaba’s senior executives, Wang Er also expressed his views”, and “As Baidu’s CTO, Gao Wu made suggestions” are shown in Table 1.
[0052]
[0053] Table 1
[0054] Among them, n, u, v, d, p, f, and w represent part-of-speech markers, which are used to identify the part-of-speech of words in the word segmentation sequence. For example, n represents that the word in the word segmentation sequence is a noun, p represents that the word in the word segmentation sequence is a pronoun, and v represents that the word in the word segmentation sequence is a verb. It should be noted that in addition to the part-of-speech markers listed above, there are many other part-of-speech markers that do not appear in the above text, such as c represents that the word in the word segmentation sequence is a conjunction, etc.
[0055] In this embodiment, dependency syntactic analysis may be performed on the word segmentation sequence corresponding to the text, thereby obtaining a dependency syntactic relationship sequence corresponding to the word segmentation sequence.
[0056] Dependency grammar theory believes that there is a master-slave relationship between words, which is a binary unequal relationship. In a text, if one word modifies another word, the modifier is called a dependent, and the modified word is called a head. The grammatical relationship between the two is called a dependency relation. For example, the dependency relationship between the adjective "big" and the noun "dream" in the sentence "big dream" is a subject-centered relationship. As shown in Table 2, the dependency syntax identifier is the column where "Tag" is located. The dependency syntax identifier is used to mark the relationship between words in the word segmentation sequence, and then the dependency syntax relationship sequence corresponding to the word segmentation sequence can be obtained, that is, the dependency syntax relationship sequence is composed of multiple dependency syntax representations. The relationship corresponding to the dependency syntax identifier of the grammatical relationship sequence is the column where "relationship type" is located.
[0057] Relationship Type Tags Subject-Predicate Relationship SBV Verb-object relationship VOB Guest-guest relationship IOB Preposed Object FOB Conjunction DBL Central-South Relationship ATT State-centered relationship ADV Verb-complement relationship CMP Parallel Relationship COO Prepositional relationship POB Left Additional Relation LAD Right Additional Relation RAD Independent structure IS Core Relationships HED
[0058] Table 2
[0059] Step S113: traversing the grammatical relations of all the segmented words in the segmented word sequence in the order in which the segmented words are arranged, and taking the grammatical relation sequence obtained by traversing as the grammatical relation sequence corresponding to the text.
[0060] Optionally, in the process of traversing the grammatical relationships of all participles in the participle sequence in the order of the participle arrangement, if a participle has multiple grammatical relationships, the multiple grammatical relationships are traversed in sequence according to the distance relationship from large to small, wherein the distance relationship is used to characterize the degree of proximity of two participles with corresponding grammatical relationships appearing in the text.
[0061] For example, see Figure 4 , Figure 4 is a schematic diagram of an exemplary syntactic dependency relationship of a word segmentation sequence, such as Figure 4As shown, when performing dependency syntactic analysis on the word segmentation sequence corresponding to the text "The composer of 'Blue and White Porcelain' is Zhang San", there are a total of 6 word segments in the text, namely "Root", "Blue and White Porcelain", "of", "composer", "is", and "Zhang San". The word segment "Root" is the virtual root node of the text and does not depend on other words. The words in the text are arranged in the order from the word segment "Root" to the right. Dependency syntactic analysis is performed on these 6 word segments respectively. The word segment "Root" has no dependency relationship with other word segments, but the word segment "is" depends on the root node "Root", and its dependency syntactic relationship is the core relationship HED. Therefore, the core relationship HED is ranked at the forefront of the syntactic relationship sequence. When analyzing the dependency syntactic relationship of "Blue and White Porcelain", "Blue and White Porcelain" has two syntactic relationships, the attributive-middle relationship ATT with the word segment "composer" and the right adjunct relationship RAD with the word segment "of". Because the distance between "Blue and White Porcelain" and "composer" is greater than the distance between "Blue and White Porcelain" and "of", therefore, the dependency syntactic relationship between "Blue and White Porcelain" and "composer" is ranked in front, and the dependency syntactic relationship between "Blue and White Porcelain" and "of" is ranked behind. The word segment "of" only has the dependency syntactic relationship with the word segment "Blue and White Porcelain". "Composer" has the subject-predicate relationship SBV with the word segment "is", and the subject-predicate relationship SBV is ranked behind the dependency syntactic relationship between "Blue and White Porcelain" and "of". The word segment "Zhang San" has the verb-object relationship VOB with the word segment "is", and the verb-object relationship VOB is ranked behind the verb-object relationship VOB. Finally, the syntactic relationship sequence corresponding to the text "Blue and White Porcelain / of / composer / is / Zhang San" is obtained as HED ATT RAD SBV VOB. Refer to Table 3. Table 3 shows the syntactic dependency analysis results of the word segmentation sequences corresponding to the texts "The composer of Blue and White Porcelain is Zhang San", "The lyricist of 'Far Away' is actually Li Si", "In addition to the senior executives of Alibaba, Wang Er also expressed his views", and "As the CTO of Baidu, Gao Wu put forward suggestions" respectively, and the corresponding syntactic relationship sequences are obtained as shown in Table 3.
[0062]
[0063]
[0064] Table 3
[0065] In this embodiment, semantic dependency analysis can be performed on the word segmentation sequence corresponding to the text, and then the semantic dependency relationship sequence corresponding to the word segmentation sequence can be obtained.
[0066] Semantic Dependency Analysis: Analyze the semantic associations between various linguistic units in a sentence and present the semantic associations in a dependency structure. Using semantic dependencies to depict sentence semantics has the advantage that it is not necessary to abstract the words themselves, but rather to describe the words through the semantic frameworks they bear. The number of arguments is always much smaller than the number of words. The goal of semantic dependency analysis is to break through the constraints of the surface syntactic structure of the sentence and directly obtain the deep semantic information. For example, the following three sentences express the same semantic information in different ways, that is, Zhang San performed an action of eating, and the action of eating was performed on an apple. Table 4 shows the description of some semantic relation identifiers used for semantic dependency analysis of the text. Among them, the column where "Relation Type" is located identifies the type of semantic dependency relationship between word segments, and the column where "Tag" is located represents the semantic dependency relationship identifier corresponding to the relation type in the same row.
[0067]
[0068]
[0069] Table 4
[0070] For example, refer to Figure 5 , Figure 5 is a schematic diagram of the dependency grammar relationship of an exemplary word segmentation sequence. As Figure 5 shown, when performing semantic dependency analysis on the word segmentation sequence corresponding to the text "The composer of blue and white porcelain is Zhang San", the semantic dependency relationships of the 6 word segments "root", "blue and white porcelain", "of", "composer", "is", and "Zhang San" in the text are obtained in sequence. The word segment "Root" is the virtual root node of the text. "Is" semantically depends on the root node "Root", and its semantic dependency relationship is HED. "Blue and white porcelain" has two semantic dependency relationships, the descriptive role relationship FEAT with the word segment "composer" and the attachment marker relationship mDEPD with the word segment "of". Since the distance between "blue and white porcelain" and "composer" is greater than the distance between "blue and white porcelain" and "of", the semantic dependency relationship between "blue and white porcelain" and "composer" is ranked first, and the semantic dependency relationship between "blue and white porcelain" and "of" is ranked second. The word segment "of" only has a semantic dependency relationship with "blue and white porcelain". The agency relationship between "composer" and "is" is ranked after the attachment marker relationship mDEPD between the word segment "blue and white porcelain" and "of". The semantic dependency relationship LINK between "is" and "Zhang San" is ranked last. Finally, the semantic dependency relationship sequence corresponding to the text "The composer of blue and white porcelain is Zhang San" can be obtained, that is, Root TEAT mDEPD EXP LINK.
[0071] By performing semantic dependency analysis on the text "As the CTO of Baidu, Gaowu puts forward suggestions", we can obtain its corresponding semantic dependency relationship sequence, which is Root mRELA FEATmDEPD DATV mPUNC AGT CONT.
[0072] By performing semantic dependency analysis on the text "In addition to the senior executives of Alibaba, Wang Er also expressed his opinions", we can obtain the corresponding semantic dependency relationship sequence, which is Root mRELAFEAT mDEPD DATV mPUNC mDEPD AGTmDEPD CONT.
[0073] Step S120: performing sequence pattern mining on the grammatical relationship sequence to obtain a sequence pattern corresponding to the text.
[0074] Specifically, the grammatical relationship sequence obtained in step S110 is used as a mining object, such as a part-of-speech sequence, a syntactic relationship sequence, or a semantic dependency relationship sequence. At the same time, a multi-minimum support strategy is used, and the calculation method of the minimum support is shown in the following formula:
[0075] min-sup=a×n
[0076] Where n is the number of samples of the grammatical relation sequences to be mined (grammatical relation sequences of the same category), a is the minimum support rate, and the minimum support rate parameter is adjusted according to the number of samples in the sample set of the grammatical relation sequences to be mined.
[0077] Optionally, the specific operation steps of the sequence pattern mining algorithm used in this embodiment are as follows:
[0078] 1. Find the context sequence prefix and corresponding projection data set of the grammatical relation sequence element with unit length 1.
[0079] 2. Count the frequency of occurrence of the context sequence prefixes of the grammatical relationship sequence elements and add the prefixes whose support is higher than the minimum support threshold min_sup to the data set to obtain the frequent item set sequence pattern.
[0080] 3. Recursively mine all prefixes of length i that meet the minimum support threshold min_sup requirement:
[0081] 1) Mine the prefix projection data set. If the projection data is an empty set, return recursion.
[0082] 2) Count the minimum support of each item in the corresponding projected data set, merge each item that meets the minimum support threshold min_sup with the current prefix to obtain a new prefix, and recursively return if it does not meet the minimum support threshold min_sup.
[0083] 3) Let i=i+1, prefix be each new prefix after merging the single items, and recursively execute step 3 respectively.
[0084] Finally, all frequent sequence patterns in the context sequence sample set where the grammatical relation sequence element is located are returned.
[0085] For example, we conduct sequence pattern mining on the part-of-speech sequences corresponding to the texts “The composer of Blue and White Porcelain is Zhang San”, “The lyricist from thousands of miles away is actually Li Si”, “In addition to Alibaba’s senior executives, Wang Er also expressed his views”, and “As Baidu’s CTO, Gao Wu made suggestions”. See Table 5, which shows the part-of-speech sequences corresponding to each text.
[0086] Part-of-speech sequence to be mined / n / u / n / v / n / n / u / n / d / v / n / p / n / u / n / f / w / n / d / v / n / p / n / u / n / w / n / v / n
[0087] Table 5
[0088] Suppose the minimum support rate threshold is 0.4, then the minimum support threshold min_sup = 0.4*4 = 1.6.
[0089] The specific sequence mining process is as follows:
[0090] First, the number of occurrence samples of all part-of-speech sequence elements is counted, as shown in Table 6:
[0091] Part-of-speech sequence elements Number of samples / n 4 / u 4 / v 4 / d 2 / w 2 / p 2 / f 1
[0092] Table 6
[0093] Filter out the part-of-speech sequence elements that do not meet the minimum support rate threshold, that is, the part-of-speech sequence elements must appear in at least 2 samples in the above 4 samples to meet the minimum support threshold requirement. The threshold filtering processing samples are shown in Table 7:
[0094] Filter results by single support threshold / n / u / n / v / n / n / u / n / d / v / n / p / n / u / n / w / n / d / v / n / p / n / u / n / w / n / v / n
[0095] Table 7
[0096] The part-of-speech sequence elements that meet the minimum support threshold are used to construct a prefix and its corresponding suffix. The results are shown in Table 8:
[0097]
[0098] Table 8
[0099] Taking a prefix of " / n" as an example, we continue to mine two prefixes and corresponding suffixes that meet the minimum support threshold as shown in the table:
[0100]
[0101]
[0102] Table 9
[0103] Taking the two-term prefix " / n / u" as an example, we continue to mine three-term prefixes and corresponding suffixes that meet the minimum support threshold as shown in Table 10:
[0104]
[0105]
[0106] Table 10
[0107] Taking the three prefixes " / n / u / n" as an example, we continue to mine four prefixes and corresponding suffixes that meet the minimum support threshold as shown in Table 11:
[0108]
[0109] Table 11
[0110] Taking the four prefixes " / n / u / n / v" as an example, we continue to mine five prefixes and corresponding suffixes that meet the minimum support threshold as shown in Table 12:
[0111] Five prefixes Corresponding suffix / n / u / n / v / n
[0112] Table 12
[0113] At the end of the iteration, a sequence pattern " / n / u / n / v / n" is obtained. By analogy, sequence patterns of various lengths can be obtained. Similarly, other grammatical relationship sequences are sequence mined in the same way to obtain multiple sequence patterns corresponding to other grammatical relationship sequences.
[0114] Optionally, see Figure 6 , Figure 6 yes Figure 1 The flowchart of step S200 in the illustrated embodiment is an exemplary embodiment, and step S200 includes the following steps:
[0115] S210: Build a reference sequence pattern library.
[0116] The reference sequence pattern library constructed in this embodiment includes multiple reference sequence patterns and the support corresponding to each reference sequence pattern.
[0117] Optionally, see Figure 7 , Figure 7 yes Figure 6 In the illustrated embodiment, step S210 is a flowchart of an exemplary embodiment, and step S210 includes the following steps:
[0118] S211: Acquire multiple reference samples.
[0119] In this embodiment, the multiple reference samples obtained correspond to the same category label, for example, if the category label is "name", then each reference sample obtained should contain a name, and these reference samples are used as training samples to train the model, and the obtained model is used to determine whether the text to be processed includes a name. Of course, the reference sample can also be a category label other than "name", such as "politician", "scientist", etc. Different training sample category labels will result in different models, which is not specifically limited here.
[0120] For example, a batch of reference samples with human names are obtained, and the category label corresponding to each reference sample is "with human name".
[0121] The specific acquisition method can be: first obtain a batch of name entity words, such as: Zhang San, Li Si, Huang Liu, Wang Er, etc. The acquisition method can be through listing or crawling Baidu Encyclopedia character entries, etc., as the initialization training sample, and then the model will continuously expand the name entity set through iteration, so there is no need to list or crawl again.
[0122] After obtaining a set of name entities, we match various texts, such as news information, Baidu entries, Wikipedia, etc., to obtain a batch of texts containing these name entities. That is, each sentence of the matched recalled text contains at least one name entity, and use this batch of texts as reference samples.
[0123] S212: Obtain a reference sequence pattern corresponding to each reference sample.
[0124] In this step, the reference sequence pattern corresponding to each reference sample is obtained in the same manner as the sequence pattern corresponding to the text to be processed in step S100, that is, the grammatical relations contained in the reference sample are first analyzed to obtain the grammatical relation sequence corresponding to the reference sample, and then the sequence pattern mining is performed on the grammatical relation sequence to obtain the reference sequence pattern corresponding to the reference sample. It should be noted that when the sequence pattern mining is performed on the grammatical relation sequence corresponding to the reference sample, each iteration process only needs to retain the sequence sample containing the name entity (category label), and the reference sequence patterns corresponding to the reference samples obtained in this way all contain the name entity.
[0125] For example, the word segmentation sequences of multiple reference samples such as "Zhang San is the composer of blue and white porcelain", "Li Si is the lyricist thousands of miles away", "In addition to Alibaba's senior executives, Wang Er also expressed his views", and "As Baidu's CTO, Gao Wu made suggestions" are grammatically annotated, and the obtained part-of-speech grammatical relationship sequences are sequence pattern mined to obtain the reference sequence pattern corresponding to each of the above reference samples, and the above reference samples all include person name entities. When the reference samples are grammatically annotated, generally speaking, the person name entity should be a noun, but in this embodiment, a separate identifier, such as "*", is set for the person name entity.
[0126] The results of part-of-speech tagging of the reference samples are shown in Table 12:
[0127] The text with grammatical relations to be mined Reference sample part-of-speech tagging results The composer of Blue and White Porcelain is Zhang San / n / u / n / v* The lyricist of "Thousands of Miles Away" turned out to be Li Si / n / u / n / d / v* In addition to Alibaba's executives, Wang Er also expressed his views / p / n / u / n / f / w* / d / v / n As Baidu's CTO, Gao Wu made suggestions / p / n / u / n / w* / v / n
[0128] Table 12
[0129] In this embodiment, the sequence pattern mining algorithm used in performing sequence pattern mining on text is used to perform sequence pattern mining on the part-of-speech grammatical relationship sequence corresponding to the reference sample.
[0130] Specifically, still assuming the minimum support rate is 0.4, the minimum support threshold is 1.6. First, count the number of occurrence samples of all part-of-speech sequence elements, and filter out the part-of-speech sequence elements that do not meet the minimum support threshold. That is, the part-of-speech sequence element must appear in at least 2 samples among the above 4 samples to meet the support threshold, and the filtered part-of-speech sequence element is f.
[0131] The filtering results are shown in Table 13:
[0132] Filter results by single support threshold / n / u / n / v* / n / u / n / d / v* / p / n / u / n / w* / d / v / n / p / n / u / n / w* / v / n
[0133] Table 13
[0134] Mining is performed based on the sequence pattern mining algorithm. Only sequence samples containing name entity identifiers* are retained in each iteration. The part-of-speech sequence elements that meet the minimum support threshold are used to construct a prefix and its corresponding suffix. The results are shown in Table 14:
[0135]
[0136]
[0137] Table 14
[0138] Taking a prefix of " / n" as an example, we continue to mine two prefixes and corresponding suffixes that meet the minimum support threshold as shown in Table 15:
[0139]
[0140]
[0141] Table 15
[0142] Taking the two-term prefix " / n / u" as an example, we continue to mine three-term prefixes and corresponding suffixes that meet the minimum support threshold as shown in Table 16:
[0143]
[0144] Table 16
[0145] Taking the three prefixes " / n / u / n" as an example, we continue to mine four prefixes and corresponding suffixes that meet the minimum support threshold as shown in Table 17:
[0146]
[0147]
[0148] Table 17
[0149] Continue to mine five prefixes and corresponding suffixes that meet the minimum support threshold as shown in Table 18:
[0150]
[0151] Table 18
[0152] At the end of the iteration, a reference sequence pattern " / n / u / n / v*" is obtained. By analogy, multiple reference sequence patterns of different lengths can be obtained. Similarly, other grammatical relationship sequences are sequence mined in the same way to obtain multiple reference sequence patterns corresponding to other grammatical relationship sequences. S213: Calculate the ratio between the number of reference samples corresponding to each reference sequence pattern and the total number of multiple reference samples, and use the ratio as the support of the corresponding reference sequence pattern.
[0153] That is, the support of the reference sequence pattern = the number of samples in which the reference sequence pattern appears / the total number of samples.
[0154] For example, if a reference sequence pattern appears in 50 reference samples, the number of reference samples corresponding to the reference sequence pattern is 50. If there are 100 reference samples in total, the support of the reference sequence pattern is 1 / 2. It should be emphasized that if a reference sequence pattern appears more than once in a reference sample, the number of reference samples corresponding to the reference sequence pattern is only increased by one.
[0155] S214: Construct a reference sequence pattern library according to the reference sequence patterns corresponding to each of the multiple reference samples and the support corresponding to each of all the reference sequence patterns.
[0156] S220: Acquire a reference sequence pattern matching the sequence pattern from a reference sequence pattern library,
[0157] In this step, refer to Figure 8 , Figure 8 yes Figure 6 In the illustrated embodiment, step S220 is a flowchart of an exemplary embodiment, where step S220 may include the following steps:
[0158] S221: Compare the first grammar identifier sequence contained in the sequence pattern with the second grammar identifier sequence contained in the reference sequence pattern in the reference sequence pattern library.
[0159] S222: If the comparison determines that the second grammar identifier sequence contains all the grammar identifiers in the first grammar identifier sequence, and the arrangement order of all the grammar identifiers in the second grammar identifier sequence is the same as the arrangement order of all the grammar identifiers in the first grammar identifier sequence, then the reference sequence pattern corresponding to the second grammar identifier sequence is used as the reference sequence pattern that matches the sequence pattern.
[0160] For example, the part-of-speech grammatical relationship sequence pattern corresponding to the text to be processed is / n / u / n / v, and a reference sequence pattern in the reference sequence pattern library is / n / u / n / w* / d / v. Obviously, the second grammatical identifier sequence / n / u / n / w* / d / v contains all the grammatical identifiers of the first grammatical identifier sequence / n / u / n / v, namely / n, / u, / v, and the arrangement order of the grammatical identifiers / n, / u, / v in the second grammatical identifier sequence is the same as that in the first grammatical identifier sequence. Then, the deterministic grammatical relationship sequence pattern / n / u / n / v can be matched with the reference sequence pattern / n / u / n / w* / d / v.
[0161] S230: Taking the support corresponding to the reference sequence pattern as the support of the sequence pattern.
[0162] It is understandable that a sequence pattern of the text to be processed may have multiple reference sequence patterns matching it in the reference sequence pattern library. In this case, the support of the reference sequence pattern with the highest support among all the reference sequence patterns matching the sequence pattern is used as the support of the sequence pattern.
[0163] In summary, in the technical solution provided in the embodiments of the present application, the support of each sequence pattern corresponding to the text is first calculated, and based on each sequence pattern and its corresponding support, the weighted sum of all sequence patterns is calculated to obtain the grammatical relationship features corresponding to the text, and the matching degree between the grammatical relationship features and the reference grammatical relationship features is calculated. If the matching degree is greater than a preset threshold, the category label associated with the reference grammatical relationship features is used as the text processing result corresponding to the text. On the one hand, the grammatical relationship features corresponding to the text are extracted in combination with the grammatical relationship corresponding to the text. Since the grammatical relationship is used as a factor to process the text, this processing method itself can provide accuracy in text processing. On the other hand, since the grammatical features corresponding to the text take into account each sequence pattern corresponding to the text according to the weight, the reference grammatical relationship features corresponding to the text can more accurately reflect the grammatical relationship of the text, and then the grammatical relationship features are matched with the reference grammatical relationship features, so that the obtained text processing results are more accurate.
[0164] Optionally, in this embodiment, after obtaining the text processing result in step S400, text information corresponding to the category label may also be extracted.
[0165] For details, see Fig. 9 , Fig. 9 is a flowchart of an exemplary method of extracting text information, such as Fig. 9 As shown, after step S400, the process of extracting text information corresponding to the category label includes the steps of:
[0166] S500: Determine the sequence pattern with the largest support among the sequence patterns corresponding to the text.
[0167] S600: Obtain a reference sequence pattern that matches the sequence pattern with the maximum support.
[0168] In this embodiment, and the method recorded in step S200, the support of all sequence patterns corresponding to the text can be obtained, and the support of all sequence patterns obtained can be compared to determine the sequence pattern with the largest support among the sequence patterns corresponding to the text, and the reference sequence pattern corresponding to the sequence pattern with the largest support.
[0169] S700: The position of the designated grammar identifier in the reference sequence pattern is used as the position of the target grammar identifier in the sequence pattern with the maximum support, and the designated grammar identifier is associated with the category label.
[0170] Since in the process of performing grammatical analysis on the reference sample to obtain the grammatical relationship sequence, the specified grammatical identifier associated with the category label is used as an element to mark the grammatical relationship sequence, in the process of obtaining the reference sequence pattern, only the reference sequence pattern containing the specified grammatical identifier is retained. Therefore, each reference sequence pattern includes the specified grammatical identifier and the position of the specified grammatical identifier can be determined.
[0171] S800: Determine text information corresponding to the position of the target grammar identifier in the text.
[0172] By extracting the text information corresponding to the position of the target grammatical identifier in the text, the text information corresponding to the category label can be extracted.
[0173] By determining the reference sequence pattern that matches the sequence pattern with the greatest support, the position of the specified grammatical identifier in the reference sequence pattern is used as the position of the target grammatical identifier in the sequence pattern with the greatest support, and then the text information corresponding to the position of the target grammatical identifier is accurately determined in the text, thereby improving the accuracy of text extraction.
[0174] The above-mentioned text processing method can be performed by a computer device (or text processing device). The computer device here may include but is not limited to: terminal devices such as smart phones, tablet computers, laptop computers, desktop computers, etc.; or service devices such as data processing servers, Web servers, application servers, etc., wherein the server can be an independent physical server, or a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, CDN, and big data and artificial intelligence platforms. The server here can be a node server on the blockchain. The terminal can be a smart phone, tablet computer, laptop computer, desktop computer, smart speaker, smart watch, etc., but is not limited to this. The terminal device and the service device can be directly or indirectly connected by wired or wireless communication, and this application does not limit this.
[0175] participate Fig.10 , Fig.10 is a block diagram of a text processing device shown in an exemplary embodiment of the present application, such as Fig.10 As shown, the text processing device 1000 includes a mining module 1100 , an acquisition module 1200 , a calculation module 1300 and a first matching module 1400 .
[0176] Among them, the mining module 1100 is used to mine the sequence pattern of the text according to the grammatical relationship corresponding to the text, and obtain the sequence pattern corresponding to the text. The acquisition module 1200 is connected to the mining module 1100 and is used to obtain the support of the sequence pattern. The calculation module 1300 is connected to the acquisition module 1200 and is used to use the support as a weight to calculate the weighted sum of the sequence pattern to obtain the grammatical relationship feature corresponding to the text. The first matching module 1400 is connected to the calculation module 1300 and is used to calculate the matching degree between the grammatical relationship feature and the reference grammatical relationship feature. If the matching degree is greater than a preset threshold, the category label associated with the reference grammatical relationship feature is used as the text processing result corresponding to the text.
[0177] In another exemplary embodiment, the text processing device 1000 may further include a first determination module, a second matching module, and a second determination module. The first determination module is connected to the first matching module 1400 and is used to determine the sequence pattern with the largest support in the sequence pattern corresponding to the text, the second matching module is used to obtain a reference sequence pattern that matches the sequence pattern with the largest support, the second determination module is used to use the position of the specified grammatical identifier in the reference sequence pattern as the position of the target grammatical identifier in the sequence pattern with the largest support, and the specified grammatical identifier is associated with the category label; and the text information corresponding to the position of the target grammatical identifier is determined in the text.
[0178] In another exemplary embodiment, the mining module 1100 includes an analysis unit and a mining unit connected to the analysis unit, the analysis unit is used to analyze the grammatical relations contained in the text to obtain a grammatical relation sequence corresponding to the text, and the mining unit is used to perform sequence pattern mining on the grammatical relation sequence to obtain a sequence pattern corresponding to the text.
[0179] In another exemplary embodiment, the analysis unit may include a segmentation sub-unit, an analysis sub-unit and an arrangement sub-unit. The segmentation sub-unit is used to perform segmentation on the text to obtain a segmentation sequence corresponding to the text; the analysis sub-unit is used to perform grammatical analysis on the segmentation sequence to obtain segmentation pairs with grammatical relations in the segmentation sequence; the arrangement sub-unit is used to traverse the grammatical relations of all segmentations in the segmentation sequence in the order of arrangement of the segmentations, and use the grammatical relationship sequence obtained by traversal as the grammatical relationship sequence corresponding to the text.
[0180] In another exemplary embodiment, the acquisition module 1200 includes a construction unit, a matching unit, and an acquisition unit, wherein the construction unit is used to obtain reference sequence patterns corresponding to each of the multiple reference samples; calculate the ratio between the number of reference samples corresponding to each reference sequence pattern and the total number of the multiple reference samples, and use the ratio as the support of the corresponding reference sequence pattern; construct a reference sequence pattern library according to the reference sequence patterns corresponding to each of the multiple reference samples and the support corresponding to each of all the reference sequence patterns; the matching unit is used to compare the first grammar identifier sequence contained in the sequence pattern with the second grammar identifier sequence contained in the reference sequence pattern in the reference sequence pattern library; if the comparison determines that the second grammar identifier sequence contains all the grammar identifiers in the first grammar identifier sequence, and the arrangement order of all the grammar identifiers in the second grammar identifier sequence is the same as the arrangement order of all the grammar identifiers in the first grammar identifier sequence, then use the reference sequence pattern corresponding to the second grammar identifier sequence as the reference sequence pattern that matches the sequence pattern. The acquisition unit is used to use the support corresponding to the reference sequence pattern as the support of the sequence pattern.
[0181] It should be noted that the device provided in the above embodiment and the method provided in the above embodiment belong to the same concept, wherein the specific manner in which each module and unit performs the operation has been described in detail in the method embodiment and will not be repeated here.
[0182] In another exemplary embodiment, the present application provides an electronic device, including a processor and a memory, wherein the memory stores computer-readable instructions, and when the computer-readable instructions are executed by the processor, the above-mentioned text processing method is implemented.
[0183] Another aspect of the present application provides a computer-readable storage medium having computer-readable instructions stored thereon, which implement the method of any one of the above embodiments when executed by a processor.
[0184] Another aspect of the present application also provides a computer program product or a computer program, which includes a computer instruction stored in a computer-readable storage medium. A processor of a computer device reads the computer instruction from the computer-readable storage medium, and the processor executes the computer instruction, so that the computer device executes the method provided in each of the above embodiments.
[0185] It should be noted that the computer-readable medium shown in the embodiment of the present application can be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium can be, for example, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media can include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM), a flash memory, an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present application, a computer-readable storage medium can be any tangible medium containing or storing a program, which can be used by an instruction execution system, a device or a device or used in combination with it. In the present application, a computer-readable signal medium can include a data signal propagated in a baseband or as a part of a carrier wave, wherein a computer-readable computer program is carried. Such propagated data signals may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. Computer-readable signal media may also be any computer-readable medium other than computer-readable storage media, which may send, propagate, or transmit programs for use by or in conjunction with an instruction execution system, apparatus, or device. The computer program contained on the computer-readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wired, etc., or any suitable combination of the above.
[0186] The flowchart and block diagram in the accompanying drawings illustrate the possible architecture, functions and operations of the system, method and computer program product according to various embodiments of the present application. Wherein, each box in the flowchart or block diagram can represent a module, a program segment, or a part of the code, and the above-mentioned module, program segment, or a part of the code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram or flowchart, and the combination of boxes in the block diagram or flowchart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0187] The units involved in the embodiments described in this application may be implemented by software or hardware, and the units described may also be set in a processor. The names of these units do not, in some cases, constitute limitations on the units themselves.
[0188] The above content is only a preferred exemplary embodiment of the present application and is not intended to limit the implementation scheme of the present application. A person skilled in the art can easily make corresponding changes or modifications based on the main concept and spirit of the present application. Therefore, the scope of protection of the present application shall be based on the scope of protection required by the claims.
Claims
1. A text processing method, It is characterized in that include: According to the grammatical relations corresponding to the text, sequential pattern mining is performed on the text to obtain a sequential pattern corresponding to the text; the sequential pattern corresponding to the text includes sequential patterns corresponding to multiple grammatical relations, and the sequential pattern corresponding to each grammatical relation includes multiple sequential patterns of different lengths; Obtaining the support of the sequence pattern; Using the support as a weight, calculating a weighted sum of the sequence patterns to obtain a grammatical relationship feature corresponding to the text; Calculating the matching degree between the grammatical relationship feature and the reference grammatical relationship feature, and if the matching degree is greater than a preset threshold, taking the category label associated with the reference grammatical relationship feature as the text processing result corresponding to the text; The step of using the support as a weight to calculate the weighted sum of the sequence patterns to obtain the grammatical relationship feature corresponding to the text includes: Encode each sequence pattern to obtain a sequence pattern vector corresponding to each sequence pattern; The support of each sequence pattern is used as a weight to calculate the weighted sum of multiple sequence pattern vectors corresponding to the text to obtain the grammatical relationship feature corresponding to the text.
2. The method according to claim 1, It is characterized in that The obtaining of the support of the sequence pattern comprises: Acquire a reference sequence pattern matching the sequence pattern from a reference sequence pattern library, wherein the reference sequence pattern library contains a plurality of reference sequence patterns and a support degree corresponding to each reference sequence pattern; The support corresponding to the reference sequence pattern is used as the support of the sequence pattern.
3. The method according to claim 2, It is characterized in that The acquiring a reference sequence pattern matching the sequence pattern from a reference sequence pattern library comprises: Comparing a first grammar identification sequence contained in the sequence pattern with a second grammar identification sequence contained in a reference sequence pattern in the reference sequence pattern library; If the comparison determines that the second grammar identifier sequence contains all the grammar identifiers in the first grammar identifier sequence, and the arrangement order of all the grammar identifiers in the second grammar identifier sequence is the same as the arrangement order of all the grammar identifiers in the first grammar identifier sequence, then the reference sequence pattern corresponding to the second grammar identifier sequence is used as the reference sequence pattern that matches the sequence pattern.
4. The method according to claim 2, It is characterized in that Before acquiring a reference sequence pattern matching the sequence pattern from a reference sequence pattern library, the method further comprises: Obtaining reference sequence patterns corresponding to each of the multiple reference samples; Calculating a ratio between the number of reference samples corresponding to each reference sequence pattern and the total number of the plurality of reference samples, and using the ratio as the support of the corresponding reference sequence pattern; The reference sequence pattern library is constructed according to the reference sequence patterns corresponding to each of the multiple reference samples and the support degrees corresponding to each of all the reference sequence patterns.
5. The method according to claim 2, It is characterized in that The method further comprises: Determine the sequence pattern with the largest support among the sequence patterns corresponding to the text; Acquire a reference sequence pattern that matches the sequence pattern with the maximum support; Using the position of a specified grammar identifier in the reference sequence pattern as the position of a target grammar identifier in the sequence pattern with the largest support, wherein the specified grammar identifier is associated with the category label; Determine text information corresponding to the position of the target grammar identifier in the text.
6. The method according to claim 1, It is characterized in that The step of performing sequence pattern mining on the text according to the grammatical relationship corresponding to the text to obtain the sequence pattern corresponding to the text includes: Analyzing the grammatical relations contained in the text to obtain a grammatical relation sequence corresponding to the text; Perform sequence pattern mining on the grammatical relationship sequence to obtain the sequence pattern corresponding to the text.
7. The method according to claim 6, It is characterized in that The analyzing the grammatical relations contained in the text to obtain a grammatical relation sequence corresponding to the text includes: Performing word segmentation processing on the text to obtain a word segmentation sequence corresponding to the text; Performing grammatical analysis on the word segmentation sequence to obtain word segmentation pairs having grammatical relations in the word segmentation sequence; The grammatical relations of all the participles in the participle sequence are traversed in the order in which the participles are arranged, and the grammatical relation sequence obtained by the traversal is used as the grammatical relation sequence corresponding to the text.
8. The method according to claim 7, It is characterized in that The method further comprises: In the process of traversing the grammatical relationships of all participles in the participle sequence in the order of the participle arrangement, if a participle has multiple grammatical relationships, the multiple grammatical relationships are traversed in sequence according to the distance relationship from large to small, wherein the distance relationship is used to characterize the degree of proximity of two participles with corresponding grammatical relationships appearing in the text.
9. A text processing device, It is characterized in that include: A mining module is used to mine a sequence pattern of the text according to the grammatical relationship corresponding to the text, so as to obtain a sequence pattern corresponding to the text; the sequence pattern corresponding to the text includes sequence patterns corresponding to multiple grammatical relationships, and the sequence pattern corresponding to each grammatical relationship includes multiple sequence patterns of different lengths; An acquisition module, connected to the mining module, for acquiring the support of the sequence pattern; A calculation module, connected to the acquisition module, used to calculate the weighted sum of the sequence patterns using the support as a weight to obtain the grammatical relationship feature corresponding to the text; A matching module, connected to the calculation module, for calculating the matching degree between the grammatical relationship feature and the reference grammatical relationship feature, and if the matching degree is greater than a preset threshold, taking the category label associated with the reference grammatical relationship feature as the text processing result corresponding to the text; The step of using the support as a weight to calculate the weighted sum of the sequence patterns to obtain the grammatical relationship feature corresponding to the text includes: Encode each sequence pattern to obtain a sequence pattern vector corresponding to each sequence pattern; The support of each sequence pattern is used as a weight to calculate the weighted sum of multiple sequence pattern vectors corresponding to the text to obtain the grammatical relationship feature corresponding to the text.
10. A computer-readable storage medium, It is characterized in that Computer-readable instructions are stored thereon, and when the computer-readable instructions are executed by a processor of a computer, the computer is caused to execute the method according to any one of claims 1 to 8.
11. An electronic device, It is characterized in that The method comprises a processor and a memory, wherein the memory stores computer-readable instructions, and when the computer-readable instructions are executed by the processor, the method according to any one of claims 1 to 8 is implemented.
12. A computer program product, It is characterized in that The method comprises computer instructions, which, when executed by a processor of a computer device, cause the computer device to execute the method according to any one of claims 1 to 8.
