A non-standard word class identification method and computer-readable storage medium
By combining dictionary, rules and neural network methods, and integrating expert knowledge, the problem of insufficient efficiency and accuracy of non-standard word category identification methods in the existing technology is solved, and efficient and accurate non-standard word category judgment is achieved, which is suitable for Chinese speech. Synthesis and other applications.
Patent Information
- Application Number
- CN202111567719.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-12-21
- Publication Date
- 2024-08-23
- Estimated Expiration
- 2041-12-21
AI Technical Summary
There is a lack of effective non-standard part-of-speech discrimination methods in the existing technology. Rule-based methods have a heavy workload and poor scalability. Unexplainable errors are prone to occur when the neural network model is directly applied. The interactive capabilities of the hybrid system are limited and the rules cannot be fully utilized. expert knowledge.
A non-standard part-of-speech identification method is used to match input Chinese sentences with matching rules and dictionaries, obtain character and word embeddings, calculate relative position coding, and predict the category of non-standard words based on the Transformer model and conditional random field layer, combined with the rule base and neural networks, integrating expert knowledge to improve model scalability and accuracy.
It improves the efficiency and accuracy of non-standard word classification, enhances the scalability of the model, can accurately determine the category of non-standard words, and is suitable for application scenarios such as Chinese speech synthesis.
Smart Images

Figure CN114444492B
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of non-standard sub-prediction, and in particular to a non-standard word class identification method and a computer-readable storage medium. Background Art
[0002] The earliest prediction methods for non-standard words were based on manual rules. Linguists first summarized a series of rules to disambiguate non-standard words, and then wrote these rules into a form that computers can understand. Simple rule methods are mainly used to deal with non-standard words that are easy to disambiguate or have scarce corpus or corpus with serious imbalance between categories. However, since each possible non-standard word needs to be distinguished separately, the workload of establishing rules is huge and it is difficult to cover all situations. That is, the rule-based non-standard word category prediction method, the work of manually designing rules is too cumbersome, and the rule scalability is poor and does not take into account contextual information, resulting in poor results. In addition, when designing new rules, it is easy to conflict with previous rules.
[0003] Since neural networks can extract high-level features from raw data and deep learning has brought breakthroughs in many fields such as speech recognition, machine translation, and computer vision, more and more researchers are trying to use sequence-to-sequence models of neural networks to directly deal with text regularization problems. Sequence-to-sequence models usually encode a written text representation as a state vector and decode it into a spoken text output sequence. However, directly applying sequence-to-sequence models to the conversion of non-standard words may lead to unexpected and unexplainable errors caused by model or data bias.
[0004] There is also a hybrid system in the prior art. The hybrid system simply regards the rule-based model and the neural network model as cascaded sub-modules continuously, and uses a rule method based on a fallback strategy to correct the errors of the neural network model. However, this hybrid system does not solve the problems of the rules and the neural network respectively, and may cause error accumulation; the rule-based model and the neural network model can complement each other, but the interaction capabilities of these two cascaded sub-modules are limited, which makes it impossible for the neural network model to fully utilize the expert knowledge contained in the rules.
[0005] The prior art lacks a non-standard word class identification method and a computer-readable storage medium.
[0006] The disclosure of the above background technology content is only used to assist in understanding the concept and technical solution of the present invention. It does not necessarily belong to the prior art of this patent application. In the absence of clear evidence that the above content has been disclosed on the filing date of this patent application, the above background technology should not be used to evaluate the novelty and creativity of the present application. Summary of the invention
[0007] In order to solve the existing problems, the present invention provides a non-standard word class identification method and a computer-readable storage medium.
[0008] In order to solve the above problems, the technical solution adopted by the present invention is as follows:
[0009] A method for distinguishing non-standard word classes includes the following steps: S1: inputting a character sequence of a complete Chinese sentence containing non-standard words and matching the Chinese sentence with the matching rules of non-standard words and a Chinese dictionary to obtain all possible candidate non-standard words and potential Chinese words; S2: organizing the character sequence of the Chinese sentence, the potential Chinese words and all possible candidate non-standard words into a sequence, and obtaining the character embedding of each character in the character sequence; obtaining the word embedding of each potential Chinese word and each candidate non-standard word; S3: obtaining a relative position code from the head and tail positions of each character, potential Chinese word and candidate non-standard word in the character sequence, and obtaining a context feature representation of a sequence consisting of each character in the character sequence, each potential Chinese word and candidate non-standard word based on the character embedding, the word embedding and the relative position code; S4: predicting the category of each candidate non-standard word based on the context feature representation.
[0010] Preferably, obtaining the candidate non-standard words and potential Chinese words includes: scanning the character sequence of the Chinese sentence from front to back, returning the start and end positions of a non-standard word when it is matched in a regular expression set, and returning the start and end positions of a Chinese word when it is matched in a Chinese dictionary; when matching, matching all possible potential Chinese words and candidate non-standard words based on a greedy algorithm, and returning their corresponding start and end positions.
[0011] Preferably, a word embedding layer based on an attention mechanism and a fully connected network is used to obtain character embeddings of the character sequence of the Chinese sentence; based on the character-level embedding representation, a pooling layer is used to obtain the word embeddings of each potential Chinese word and each candidate non-standard word.
[0012] Preferably, a unit of a Transformer model encoder is used as a neural network structure to obtain a context feature representation of a sequence consisting of each character in the character sequence, each potential Chinese word and candidate non-standard words.
[0013] Preferably, the relative position embedding is calculated as follows: the absolute position of each character in each input character sequence, potential Chinese words and candidate non-standard words in the sentence is represented by the start and end positions in the input sentence, named head and tail; the four relative distances between each character in any two character sequences, potential Chinese words and candidate non-standard words are calculated using the heads and tails of all inputs.
[0014] Preferably, the context feature representation of each input is obtained through a decoding layer to generate a sequence of category labels corresponding to a character sequence of a Chinese sentence; the decoding layer includes a linear layer and a conditional random field layer.
[0015] Preferably, the conditional random field obtains an optimal prediction sequence through the relationship between adjacent category labels.
[0016] Preferably, the morphological categories of the entire non-standard words that can be matched by the rule base regular expression include: date, time, fraction, ratio, punctuation, money, English words, cardinality words, decimals, website addresses, telephone numbers, and English abbreviations.
[0017] Preferably, when all possible candidates of the non-standard words are obtained, attribute features are added, and the attribute features are parts of speech.
[0018] The present invention also provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of any of the above methods are implemented.
[0019] The beneficial effects of the present invention are: providing a non-standard word class identification method and a computer-readable storage medium, by integrating expert knowledge on predefined rules into a neural network-based model, the rule base and the dictionary can be updated at any time according to demand, which greatly improves the scalability of the model; further, the expert knowledge of the rule base and the neural network are combined to improve the efficiency and accuracy of non-standard word classification. BRIEF DESCRIPTION OF THE DRAWINGS
[0020] Figure 1 Schematic diagram of the general process of Chinese text regularization in an embodiment of the present invention.
[0021] Figure 2 It is a schematic diagram of a non-standard word class identification method in an embodiment of the present invention.
[0022] Figure 3 is a schematic diagram of an end-to-end non-standard word category prediction model in an embodiment of the present invention.
[0023] Figure 4 It is a schematic diagram of dictionary and rule matching in an embodiment of the present invention.
[0024] Figure 5 Schematic diagram of a pre-trained word embedding model in an embodiment of the present invention.
[0025] Figure 6 Schematic diagram of the generation of character, Chinese word and non-standard word embedding in an embodiment of the present invention.
[0026] Figure 7 Schematic diagram of context feature extraction in an embodiment of the present invention.
[0027] Figure 8 Schematic diagram of a Transformer model encoder unit in an embodiment of the present invention.
[0028] Fig. 9 Schematic diagram of the calculation of relative position embedding in an embodiment of the present invention.
[0029] Fig.10 is a schematic diagram of a decoding layer based on a linear and conditional random field layer in an embodiment of the present invention.
[0030] Fig.11 It is a flowchart of a method for determining a non-standard word category in an embodiment of the present invention. DETAILED DESCRIPTION
[0031] In order to make the technical problems, technical solutions and beneficial effects to be solved by the embodiments of the present invention more clearly understood, the present invention is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not used to limit the present invention.
[0032] It should be noted that when a component is referred to as being "fixed to" or "disposed on" another component, it can be directly on the other component or indirectly on the other component. When an element is referred to as being "connected to" another element, it can be directly connected to the other element or indirectly connected to the other element. In addition, connection can be used for both fixing and circuit connection.
[0033] It should be understood that the orientation or position relationship indicated by terms such as "length", "width", "up", "down", "front", "back", "left", "right", "vertical", "horizontal", "top", "bottom", "inside" and "outside" are based on the orientation or position relationship shown in the accompanying drawings, and are only for the convenience of describing the embodiments of the present invention and simplifying the description, and do not indicate or imply that the referred device or element must have a specific orientation, be constructed and operated in a specific orientation, and therefore cannot be understood as a limitation on the present invention.
[0034] In addition, the terms "first" and "second" are for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the quantity of the indicated technical features. Thus, features defined with "first" and "second" may explicitly or implicitly include one or more such features. In the description of the embodiments of the present invention, "a plurality of" means two or more unless otherwise specifically defined.
[0035] TTS: Text-to-speech, which is also known as speech synthesis. It refers to the conversion of text information into standard and fluent pronunciation.
[0036] NSW: Non standard word, which refers to a word containing non-Chinese characters (such as numbers, English characters, etc.), such as "6:15".
[0037] FSW: Spoken-form words, which refers to a Chinese character string with a determined pronunciation converted from a non-standard word, such as "six fifteen".
[0038] TN: Text Normalization, which refers to the process of converting non-standard words into Chinese character strings to determine their pronunciations.
[0039] The Text-to-Speech (TTS) technology has been widely applied to products such as voice assistants, intelligent navigation, and e-books. For Chinese speech synthesis, it is first necessary to perform front-end processing on the output Chinese text. Generally, the input Chinese text will contain some non-Chinese characters with uncertain pronunciations (referred to as non-standard words). Converting these non-Chinese characters into Chinese character strings with determined pronunciations (referred to as standard words) before synthesizing speech, that is, Chinese text regularization, is an essential step.
[0040] As Figure 1 shown, it is a schematic diagram of the general process of Chinese text regularization. Input a Chinese sentence with non-standard words (NSW) before text regularization, segment the sentence to obtain a Chinese character sequence and non-standard word sub-fragments; use a non-standard word category prediction model to obtain the category corresponding to each non-standard word sub-fragment; for each predicted category, obtain the Chinese character sequence of the non-standard word by the corresponding conversion function; finally, merge all the Chinese character sequences to obtain the sentence after text regularization.
[0041] Therefore, in the text regularization task, the category prediction of non-standard words is the most important step. The current non-standard word category prediction methods have the following two main problems: (1) Rule-based methods use keywords and regular expressions for category prediction. The selection of keywords and the construction of regular expression rules are time-consuming and labor-intensive, not scalable, and have poor results. (2) Neural network-based methods directly apply sequence-to-sequence models to the category prediction of non-standard words, which may cause unexplainable errors in the prediction results due to model or data bias.
[0042] In view of the above problems, the present invention proposes an end-to-end non-standard word category determination method combining a dictionary, rules and a neural network.
[0043] like Figure 2 As shown, the present invention provides a non-standard word class identification method, comprising the following steps:
[0044] S1: Input a character sequence of a complete Chinese sentence containing non-standard words and match the Chinese sentence with the matching rules of non-standard words and a Chinese dictionary to obtain all possible candidate non-standard words and potential Chinese words;
[0045] S2: Organizing the character sequence of the Chinese sentence, the potential Chinese words and all possible candidate non-standard words into a sequence, obtaining the character embedding of each character in the character sequence; obtaining the word embedding of each potential Chinese word and each candidate non-standard word;
[0046] S3: Obtaining relative position codes from the head and tail positions of each character, potential Chinese words and candidate non-standard words in the character sequence, and obtaining context feature representation of a sequence consisting of each character, potential Chinese words and candidate non-standard words in the character sequence based on the character embedding, the word embedding and the relative position codes;
[0047] S4: Predicting the category of each candidate non-standard word based on the context feature representation.
[0048] like Figure 3 As shown, an end-to-end non-standard word category prediction model of the present invention is shown.
[0049] The present invention predicts the category of non-standard words in an end-to-end method, accepts a character sequence containing non-standard words as input, matches them in a predefined Chinese dictionary and rule base, and matches all possible Chinese words and non-standard words without any additional preprocessing.
[0050] In one embodiment of the present invention, when all possible candidate non-standard words are obtained, attribute features are added, and the attribute features may be parts of speech, such as nouns and verbs. Specifically, the method is to concatenate the feature vector of the part of speech into each input vector.
[0051] This method proposes a rule base matching method, which integrates expert knowledge on predefined rules into a neural network-based model. The rule base and dictionary can be updated at any time according to needs, which greatly improves the scalability of the model; further, the expert knowledge of the rule base and the neural network are combined to improve the efficiency and accuracy of non-standard word classification.
[0052] The method of the present invention has important value for the human-computer interaction industry and can be used in various application scenarios such as Chinese speech synthesis, speech interaction, voice assistant, news speech synthesis, etc. Compared with the prior art, the category of non-standard words in the original text can be accurately obtained for text regularization processing.
[0053] The method of the present invention is described in detail below.
[0054] For the input Chinese character sequence, a dictionary and rule base are needed to match potential Chinese words and non-standard words. The rule base is a set of regular expressions for category matching of non-standard words, and the dictionary is a set of Chinese words.
[0055] like Figure 4 As shown, a Chinese character sequence is input, and the sentence is scanned from front to back. If a non-standard word is matched in the regular expression set, its start and end positions are returned. If a word is matched in the Chinese dictionary, its start and end positions are also returned. When matching, all possible Chinese words and non-standard words will be matched based on a greedy algorithm, and their corresponding start and end positions will be returned.
[0056] The rule base divides non-standard words into multiple categories according to their different forms, including date, time, fraction, ratio, punctuation, money, English words, cardinality, decimals, URLs, phone numbers, and English abbreviations. For each category, a regular expression is designed to match potential non-standard words in the sentence.
[0057] The categories of final judgment of the method of the present invention include:
[0058] CARDINAL: Cardinal number; DIGIT: Number; ENG LETTER: English letter; HYPHEN IGNORE: Ignore; POINT: Decimal point; VERBATIM: Read one by one; HYPHEN RANGE: Short dash-range; MEASURE UNIT: Measurement unit; SLASH PER: Slash-per; HYPHEN RATIO: Short dash-score; NUM TWO LIANG: Two; COLON HOUR: Colon-hour; MINUTE CARDINAL: Cardinal number-minute; SLASH OR: Slash-or; NUM ENG: Number to English; SLASHFRACTION: Slash-fraction; ABBR: Abbreviation; DAY CARDINAL: Cardinal number-date; SLASH YEAR: Slash-year; SLASH MONTH: Slash-month; HYPHEN MINUS: Short dash-minus; HYPHEN SUBZERO: Short dash-minus; MONTHCARDINAL: Cardinal number-month; COLON MINUTE: colon-minute; SECOND CARDINAL: cardinal number-second; HYPHENEXTENSION: hyphen-transfer; POWER OPERATOR: power symbol.
[0059] like Figure 5 As shown in the figure, for the original input sequence, a pre-trained word embedding model is needed to obtain the word embedding representation of the input sequence, and the obtained word embedding representation is used as the input for subsequent context feature extraction.
[0060] The present invention implements a word embedding layer based on an attention mechanism and a fully connected network. In a specific embodiment, it is a word embedding layer based on BERT, which is used to obtain character embeddings of an input sequence. BERT generates character-level embedding representations. For Chinese words and non-standard words, the present invention uses a pooling layer to obtain the final word embeddings of Chinese words and non-standard words.
[0061] like Figure 6 , which is a schematic diagram of a process of generating character, Chinese word and non-standard word embedding in an embodiment of the present invention.
[0062] like Figure 7 FIG. 1 is a schematic diagram of context feature extraction in an embodiment of the present invention. In order to use context information to classify non-standard words, the model needs to have the ability of context modeling, obtain sentence-level context feature representation, and context modeling based on neural network.
[0063] like Figure 8As shown, a Transformer model encoder unit in an embodiment of the present invention is shown. The present invention uses the unit of the Transformer model encoder as a neural network structure to obtain context feature representation of a sequence consisting of each character in the character sequence, each potential Chinese word and candidate non-standard word.
[0064] The present invention uses a neural network of a Transformer encoder unit with relative position encoding to effectively model various context information including input characters, dictionaries, rules, etc., which can eliminate ambiguity and improve the accuracy of non-standard word category judgment.
[0065] The Transformer encoder takes as its input the embedding and relative position embedding of the input sequence. The embedding of the input sequence is provided by the embedding representation layer mentioned above, which concatenates the embedding representations of characters, Chinese words, and non-standard words and inputs them into the neural network; while the relative position embedding is obtained by calculating the relative position encoding.
[0066] like Fig. 9 As shown, the relative position embedding is calculated as:
[0067] The absolute position of each character in each input character sequence, potential Chinese words and candidate non-standard words in the sentence is represented by the start and end positions in the input sentence, named head and tail;
[0068] The four relative distances between each character in any two character sequences, potential Chinese words and candidate non-standard words are calculated using the heads and tails of all inputs.
[0069] like Fig.10As shown, it is a schematic diagram of a decoding layer based on a linear and conditional random field layer in an embodiment of the present invention. Using the context modeling method, a sentence-level feature representation is obtained, which contains rich sentence-level semantic information, but the category corresponding to each input character needs to be obtained, which needs to be implemented through a decoding layer. The decoding layer obtains the context representation vector of each input and generates a category label sequence corresponding to the input sequence. The present invention uses a linear layer and a conditional random field layer (CRF) as a decoding layer, and obtains the sequence of category labels corresponding to the character sequence of the Chinese sentence through the decoding layer to predict the entity label as the final output of the model. The conditional random field can obtain an optimal prediction sequence through the relationship between the adjacent category labels, and helps to reduce the occurrence of errors. There are two feature functions involved in the conditional random field algorithm, one is a state feature function, which calculates the state score, and the other is a transition feature function, which calculates the transition score. The former only focuses on which entity annotations the character at the current position can be converted into, and the latter focuses on which entity annotation combinations the characters at the current position and its adjacent positions can have. The conditional random field layer also needs to learn a transition score matrix, which represents the combination between all annotation states and represents the possibility of each combination. This matrix is randomly initialized at first, and after training, it will gradually know which combinations are more in line with the rules and which are less in line with the rules, thereby obtaining the optimal prediction sequence of non-standard word categories.
[0070] The present invention first uses a rule base and a dictionary to match potential Chinese words and non-standard words; then inputs a character sequence into a BERT embedding layer to obtain a corresponding embedding representation; the character string matched by the dictionary and the rule base is passed through a pooling layer to obtain the corresponding embedding representation of Chinese words and non-standard words; then the position of the head and tail of each character, Chinese word and non-standard word is recorded to obtain the relative position encoding between any two inputs in the sequence; all characters, Chinese words and non-standard words constitute an input sequence; finally, the embedding representation vector and the relative position encoding of the input sequence are input into a unit of a Transformer encoder, and then passed through a linear layer and a conditional random field layer to obtain the prediction category corresponding to the non-standard word.
[0071] In one embodiment of the present invention, for the encoder part of the Transformer, it is possible to consider not performing scaling when using the attention calculation formula, in order to make the difference in the dot product results larger, so as to improve the attention level of the input related to non-standard words.
[0072] The present invention accepts an original Chinese character sequence (ie, a sentence) containing non-standard words as input, does not require any additional preprocessing work, and is an end-to-end method.
[0073] The present invention proposes a method for matching dictionaries and rule bases, which integrates expert knowledge on predefined dictionaries and rule bases into a neural network-based model, better integrating the respective advantages of dictionaries, rules and neural networks. The rule base and dictionary can be updated at any time according to needs, greatly improving the scalability of the model.
[0074] The present invention uses a neural network of a Transformer encoder unit with relative position encoding to effectively model various context information including input characters, dictionaries, rules, etc., which can eliminate ambiguity and improve the accuracy of non-standard word category judgment.
[0075] like Fig.11 As shown, it is a flow chart of a non-standard word category determination method of the present invention. The user only needs to provide a Chinese sentence as input. The method of the present invention accepts the character sequence of the complete sentence as input and predicts the category of the non-standard word. For example, if the user wants to predict the category of each sub-segment of "6:15" in "I study at 6:15.", just input the original character sequence (a sentence). The method of the present invention can directly obtain the category of each part of the non-standard word in the sentence according to the input sentence. Specifically, the Chinese sentence "I study at 6:15." is input. After the first step of matching, the non-standard word "6:15" and the word "study" are obtained, which are spliced after the sentence as a new input sequence. After the second step, the character embedding of the input character and the word embedding representation of the non-standard word "6:15" and the word "study" are obtained. After the third step, the relative position encoding of the input is calculated, and the context feature representation of the input character is calculated using Transformer. After the fourth step, the three parts of "6:15" "6", ":", and "15" are decoded and belong to the categories of "cardinal word", "separator-hour", and "cardinal word-minute" respectively.
[0076] Each method was tested on the data set. As shown in Table 1, the classification performance of this method for non-standard words exceeds that of the previous simple rules and neural network methods:
[0077] Table 1 Comparison of method results
[0078] method Accuracy F1 value Traditional rules approach 0.87 0.87 BERT+MLP method 0.98 0.96 BERT+LSTM method 0.98 0.96 Method of the present invention 0.99 0.97
[0079] An embodiment of the present application also provides a control device, including a processor and a storage medium for storing a computer program; wherein the processor is used to execute at least the method described above when executing the computer program.
[0080] An embodiment of the present application also provides a storage medium for storing a computer program, which at least performs the method described above when executed.
[0081] An embodiment of the present application further provides a processor, which executes a computer program and at least performs the method described above.
[0082] The storage medium may be implemented by any type of volatile or non-volatile storage device, or a combination thereof. Among them, the non-volatile memory may be a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), a magnetic random access memory (FRAM), a ferromagnetic random access memory, a flash memory, a magnetic surface memory, an optical disc, or a compact disc read-only memory (CD-ROM); the magnetic surface memory may be a disk memory or a tape memory. The volatile memory may be a random access memory (RAM), which is used as an external cache. By way of example but not limitation, many forms of RAM are available, such as static random access memory (SRAM), synchronous static random access memory (SSRAM), dynamic random access memory (DRAM), synchronous dynamic random access memory (SDRAM), double data rate synchronous dynamic random access memory (DDRSDRAM), enhanced synchronous dynamic random access memory (ESDRAMEnhanced Synchronous Dynamic Random Access Memory), synchronous link dynamic random access memory (SLDRAM), direct memory bus random access memory (DRRAM). The storage medium described in the embodiments of the present invention is intended to include, but is not limited to, these and any other suitable types of memory.
[0083] In the several embodiments provided in the present application, it should be understood that the disclosed systems and methods can be implemented in other ways. The device embodiments described above are merely schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation, such as: multiple units or components can be combined, or can be integrated into another system, or some features can be ignored, or not executed. In addition, the coupling, direct coupling, or communication connection between the components shown or discussed can be through some interfaces, and the indirect coupling or communication connection of the devices or units can be electrical, mechanical or other forms.
[0084] The units described above as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units; some or all of the units may be selected according to actual needs to achieve the purpose of the present embodiment.
[0085] In addition, all functional units in the embodiments of the present invention may be integrated into one processing unit, or each unit may be separately used as a unit, or two or more units may be integrated into one unit; the above-mentioned integrated units may be implemented in the form of hardware or in the form of hardware plus software functional units.
[0086] A person skilled in the art can understand that: all or part of the steps of implementing the above method embodiment can be completed by hardware related to program instructions, and the aforementioned program can be stored in a computer-readable storage medium. When the program is executed, it executes the steps of the above method embodiment; and the aforementioned storage medium includes: mobile storage devices, read-only memories (ROM, Read-Only Memory), random access memories (RAM, Random Access Memory), disks or optical disks, etc. Various media that can store program codes.
[0087] Alternatively, if the above-mentioned integrated unit of the present invention is implemented in the form of a software function module and sold or used as an independent product, it can also be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the embodiment of the present invention can be essentially or partly reflected in the form of a software product that contributes to the prior art. The computer software product is stored in a storage medium and includes several instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the methods described in each embodiment of the present invention. The aforementioned storage medium includes: various media that can store program codes, such as mobile storage devices, ROM, RAM, magnetic disks or optical disks.
[0088] The methods disclosed in several method embodiments provided in this application can be arbitrarily combined without conflict to obtain new method embodiments.
[0089] The features disclosed in several product embodiments provided in this application can be arbitrarily combined without conflict to obtain new product embodiments.
[0090] The features disclosed in several method or device embodiments provided in this application can be arbitrarily combined without conflict to obtain new method embodiments or device embodiments.
[0091] The above contents are further detailed descriptions of the present invention in combination with specific preferred embodiments, and it cannot be determined that the specific implementation of the present invention is limited to these descriptions. For those skilled in the art of the present invention, several equivalent substitutions or obvious variations can be made without departing from the concept of the present invention, and the performance or use is the same, which should be regarded as belonging to the protection scope of the present invention.
Claims
1. A non-standard part-of-speech identification method, characterized in that: The steps include: S1: Input a character sequence of a complete Chinese sentence containing non-standard words and match the Chinese sentence with the matching rules of non-standard words and a Chinese dictionary to obtain all possible candidate non-standard words and potential Chinese words; S2: Organizing the character sequence of the Chinese sentence, the potential Chinese words and all possible candidate non-standard words into a sequence, obtaining the character embedding of each character in the character sequence; obtaining the word embedding of each potential Chinese word and each candidate non-standard word; S3: Obtaining relative position codes from the head and tail positions of each character, potential Chinese words and candidate non-standard words in the character sequence, and obtaining context feature representation of a sequence consisting of each character, potential Chinese words and candidate non-standard words in the character sequence based on the character embedding, the word embedding and the relative position codes; S4: Predicting the category of each candidate non-standard word based on the context feature representation.
2. The non-standard word class identification method according to claim 1, characterized in that: The candidate non-standard words and potential Chinese words include: Scan the character sequence of the Chinese sentence from front to back, and return the start and end positions of a non-standard word if it is matched in the regular expression set, and also return the start and end positions of a Chinese word if it is matched in the Chinese dictionary; During matching, all possible potential Chinese words and candidate non-standard words are matched based on a greedy algorithm, and their corresponding start and end positions are returned.
3. The non-standard part-of-speech identification method according to claim 2, characterized in that: Obtaining character embeddings of the character sequence of the Chinese sentence using a word embedding layer based on an attention mechanism and a fully connected network; Based on the character-level embedding representation, a pooling layer is used to obtain the word embedding of each potential Chinese word and each candidate non-standard word.
4. The non-standard part-of-speech identification method according to claim 3, characterized in that: The units of the Transformer model encoder are used as the neural network structure to obtain the context feature representation of the sequence consisting of each character in the character sequence, each potential Chinese word and the candidate non-standard word.
5. The non-standard part-of-speech identification method according to claim 4, characterized in that: The relative position embedding is calculated as: The absolute position of each character in each input character sequence, potential Chinese words and candidate non-standard words in the sentence is represented by the start and end positions in the input sentence, named head and tail; The four relative distances between each character in any two character sequences, potential Chinese words and candidate non-standard words are calculated using the heads and tails of all inputs.
6. The non-standard word class identification method according to claim 5, characterized in that: The context feature representation of each input is obtained through a decoding layer to generate a sequence of category labels corresponding to a character sequence of a Chinese sentence; the decoding layer includes a linear layer and a conditional random field layer.
7. The non-standard part-of-speech identification method according to claim 6, characterized in that: The conditional random field obtains an optimal prediction sequence through the relationship between adjacent category labels.
8. The non-standard word class identification method according to any one of claims 1 to 7, characterized in that: The morphological categories of the entire non-standard word that can be matched by the regular expression of the rule base include: date, time, fraction, ratio, punctuation, money, English words, cardinality words, decimals, URLs, telephone numbers, and English abbreviations.
9. The non-standard word class identification method according to any one of claims 1 to 7, characterized in that: When all possible candidates of the non-standard words are obtained, attribute features are added, and the attribute features are parts of speech.
10. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 9 are implemented.
