Method, device, computer storage medium and terminal for determining Chinese semantics
Patent Information
- Application Number
- CN202210922481.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-08-02
- Publication Date
- 2025-09-23
- Estimated Expiration
- 2042-08-02
Smart Images

Figure CN115438671B_ABST
Abstract
Description
Technical Field
[0001] This article relates to but is not limited to text information processing technology, and in particular to a method, device, computer storage medium and terminal for determining Chinese semantics. Background Art
[0002] Abbreviation recognition is a very important aspect of research in the field of Chinese information processing. With the rapid development of science and technology, terminology in various fields has emerged in an endless stream. Since the full names of professional terms in a field are usually long, professionals tend to use abbreviations to represent professional terms in scientific and technological literature, technical reports, and popular speeches. However, for users who are not familiar with the field, it is very difficult to understand text sentences containing professional term abbreviations. In addition, abbreviations in different fields sometimes use similar expressions, that is, one abbreviation corresponds to different full names of professional terms, which increases the difficulty for non-professional technicians to search the abbreviation on the Internet to understand its meaning. How to design a term abbreviation recognition method to accurately identify abbreviations with the same representation in different industry fields is very meaningful for non-specialists to read and understand text reports in this field.
[0003] Currently, research on abbreviation recognition technology often focuses on the same language domain: recognizing the full Chinese name for Chinese abbreviations and the full English name for English abbreviations. However, with the development of information and the exchange of science and technology, English abbreviations are often used to represent professional terms in Chinese sentences. Recognizing the Chinese semantics of English abbreviations in Chinese sentences to avoid the confusion caused by the use of the same English abbreviations in different fields has been a research gap in the field of Chinese information processing. Summary of the Invention
[0004] The following is a summary of the subject matter described in detail herein. This summary is not intended to limit the scope of the claims.
[0005] The embodiments of the present invention provide a method, device, computer storage medium and terminal for determining Chinese semantics, which can perform Chinese semantic recognition on English abbreviations in Chinese sentences.
[0006] An embodiment of the present invention provides a method for determining Chinese semantics, including:
[0007] Processing a first Chinese sentence containing an English abbreviation using a preset first model to obtain a first word vector representation of the first Chinese sentence and a first position of the English abbreviation therein, and determining a second word vector representation of the English abbreviation;
[0008] Masking the first Chinese sentence according to the first position, and determining a first position masked embedding representation of the first Chinese sentence after the first position is masked according to the first word vector representation;
[0009] Processing the first position mask embedding representation and the second word vector representation through a preset second model to obtain a first Chinese semantic embedding representation of the Chinese semantics corresponding to the English at the first position;
[0010] Processing the pre-obtained first Chinese sentence with masked Chinese semantics through a preset third model to obtain a second Chinese semantic embedding representation corresponding to the Chinese semantic position;
[0011] Optimizing the second model and the third model according to the similarity between the first Chinese semantic embedding representation and the second Chinese semantic embedding representation;
[0012] Constructing a semantic recognition model based on the first model, the optimized second model, and the third model;
[0013] Processing the Chinese sentence to be analyzed according to the constructed semantic recognition model to determine the Chinese semantics of the English abbreviations in the Chinese sentence to be analyzed;
[0014] The first position mask embedding representation is: the embedding representation after the first position in the first word vector representation is masked.
[0015] On the other hand, an embodiment of the present invention further provides a computer storage medium, wherein the computer storage medium stores a computer program, and when the computer program is executed by a processor, the method for determining Chinese semantics is implemented.
[0016] In another aspect, an embodiment of the present invention further provides a terminal, comprising: a memory and a processor, wherein the memory stores a computer program;
[0017] The processor is configured to execute the computer program in the memory;
[0018] When the computer program is executed by the processor, the method for determining Chinese semantics as described above is implemented.
[0019] In another aspect, an embodiment of the present invention further provides an apparatus for determining Chinese semantics, comprising: a first model unit, a mask processing unit, a second model unit, a third model unit, a collaborative training unit, a construction unit, and a determination unit; wherein,
[0020] The first model unit is configured to: process a first Chinese sentence containing an English abbreviation using a preset first model to obtain a first word vector representation of the first Chinese sentence and a first position of the English abbreviation therein, and determine a second word vector representation of the English abbreviation;
[0021] The mask processing unit is configured to: mask the first Chinese sentence according to the first position, and determine a first position mask embedding representation of the first Chinese sentence after the first position is masked according to the first word vector representation;
[0022] The second model unit is configured to: process the first position mask embedding representation and the second word vector representation through a preset second model to obtain a first Chinese semantic embedding representation of the Chinese semantics corresponding to the English at the first position;
[0023] The third model unit is configured to: process the first Chinese sentence with masked Chinese semantics obtained in advance through a preset third model to obtain a second Chinese semantic embedding representation corresponding to the Chinese semantic position;
[0024] The collaborative training unit is configured to: optimize the second model and the third model according to the similarity between the first Chinese semantic embedding representation and the second Chinese semantic embedding representation;
[0025] The construction unit is configured to: construct a semantic recognition model according to the first model, the optimized second model and the third model;
[0026] The determination unit is configured to: process the Chinese sentence to be analyzed according to the constructed semantic recognition model to determine the Chinese semantics of the English abbreviation in the Chinese sentence to be analyzed;
[0027] The first position mask embedding representation is: the embedding representation after the first position in the first word vector representation is masked.
[0028] The technical solution of the present application includes: processing a first Chinese sentence containing an English abbreviation through a preset first model to obtain a first word vector representation of the first Chinese sentence and a first position of the English abbreviation therein, and determining a second word vector representation of the English abbreviation; masking the first Chinese sentence according to the first position, and determining a first position masked embedding representation of the first Chinese sentence after the first position is masked according to the first word vector representation; processing the first position masked embedding representation and the second word vector representation through a preset second model to obtain a first Chinese semantic embedding representation of the Chinese semantics corresponding to the English at the first position; processing the first Chinese sentence with the Chinese semantics masked in advance through a preset third model to obtain a second Chinese semantic embedding representation corresponding to the Chinese semantic position; optimizing the second model and the third model according to the similarity between the first Chinese semantic embedding representation and the second Chinese semantic embedding representation; constructing a semantic recognition model based on the first model, the optimized second model and the third model; processing the Chinese sentence to be analyzed according to the constructed semantic recognition model to determine the Chinese semantics of the English abbreviation in the Chinese sentence to be analyzed; wherein, the first position masked embedding representation is: the embedding representation after the first position is masked in the first word vector representation. The embodiment of the present invention constructs a semantic recognition model for semantic recognition by using the first model, the second model and the third model. Based on the constructed semantic recognition model, Chinese semantic analysis of English abbreviations in the Chinese sentences to be analyzed is implemented, thereby avoiding confusion in interpretation when interpreting English abbreviations in the Chinese sentences to be analyzed because they contain multiple Chinese semantics.
[0029] Other features and advantages of the present invention will be described in the following description, and in part will become apparent from the description, or will be understood by practicing the present invention. The purposes and other advantages of the present invention can be realized and obtained by the structures particularly pointed out in the description, claims and drawings. BRIEF DESCRIPTION OF THE DRAWINGS
[0030] The accompanying drawings are used to provide a further understanding of the technical solution of the present invention and constitute a part of the specification. Together with the embodiments of the present application, they are used to explain the technical solution of the present invention and do not constitute a limitation on the technical solution of the present invention.
[0031] Figure 1 A flowchart of a method for determining Chinese semantics according to an embodiment of the present invention;
[0032] Figure 2 A structural block diagram of an apparatus for determining Chinese semantics according to an embodiment of the present invention;
[0033] Figure 3 This is a processing flow chart of Chinese semantic recognition in an application example of the present invention. DETAILED DESCRIPTION
[0034] To make the purpose, technical solutions and advantages of the present invention more clearly understood, the embodiments of the present invention will be described in detail below with reference to the accompanying drawings. It should be noted that, unless there is a conflict, the embodiments and features in the embodiments of the present application can be combined with each other in any manner.
[0035] The steps shown in the flowcharts of the accompanying drawings can be executed in a computer system such as a set of computer executable instructions. Also, although a logical order is shown in the flowcharts, in some cases, the steps shown or described can be performed in an order different from that shown here.
[0036] Figure 1 Flowchart of the method for determining Chinese semantics according to an embodiment of the present invention, such as Figure 1 As shown, including:
[0037] Step 101: Process a first Chinese sentence containing an English abbreviation using a preset first model to obtain a first word vector representation of the first Chinese sentence and a first position of the English abbreviation therein, and determine a second word vector representation of the English abbreviation;
[0038] In an exemplary embodiment, the first Chinese sentence is a Chinese sentence collected in advance from one or more pre-set channels; the first Chinese sentence contains Chinese semantics and corresponding English abbreviations; the same English abbreviation corresponds to different Chinese semantics in Chinese sentences in different application scenarios; an embodiment of the present invention can construct a training data set for model training based on the first Chinese sentence; the training data set can be stored as a corpus with reference to relevant technologies.
[0039] Step 102: Mask the first Chinese sentence according to the first position, and determine a first position mask embedding representation of the first Chinese sentence after the first position is masked according to the first word vector representation;
[0040] Step 103: Process the first position mask embedding representation of the preset second model and the second word vector representation to obtain a first Chinese semantic embedding representation of the Chinese semantics corresponding to the English at the first position;
[0041] Step 104: Process the pre-obtained first Chinese sentence with masked Chinese semantics using a preset third model to obtain a second Chinese semantic embedding representation corresponding to the Chinese semantic position;
[0042] Step 105: Optimize the second model and the third model based on the similarity between the first Chinese semantic embedding representation and the second Chinese semantic embedding representation;
[0043] Step 106: construct a semantic recognition model based on the first model, the optimized second model, and the third model;
[0044] Step 107: Process the Chinese sentence to be analyzed according to the constructed semantic recognition model to determine the Chinese semantics of the English abbreviations in the Chinese sentence to be analyzed;
[0045] The first position mask embedding is the embedding representation after the first position in the word vector representation is masked.
[0046] The embodiment of the present invention constructs a semantic recognition model for semantic recognition by using the first model, the second model and the third model. Based on the constructed semantic recognition model, Chinese semantic analysis of English abbreviations in the Chinese sentences to be analyzed is realized, thereby avoiding confusion in interpretation when interpreting English abbreviations in the Chinese sentences to be analyzed because they contain multiple Chinese semantics.
[0047] In an exemplary embodiment, the first model of the embodiment of the present invention includes a first knowledge enhanced semantic representation model (ERNIE) layer composed of a first ERNIE.
[0048] In an exemplary embodiment, the second model of the embodiment of the present invention includes a second ERNIE layer composed of a second ERNIE.
[0049] In an exemplary embodiment, the third model of the embodiment of the present invention includes a third ERNIE layer composed of a third ERNIE.
[0050] It should be noted that after the semantic recognition model is obtained through training in the embodiment of the present invention, the Chinese sentence to be analyzed can be processed by the obtained semantic recognition model, and the semantic recognition model only needs to be trained once.
[0051] To facilitate understanding of the embodiments of the present invention, the embodiments of the present invention briefly describe the Enhanced Representation from kNowledge IntEgration (ERNIE) model. ERNIE is a natural language processing (NLP) pre-trained language model. It is based on the Bidirectional Encoder Representation from Transformer (BERT). Based on the Transformers model structure, the masked language model is improved, and input characters (tokens) are masked at three levels: basic-level, entity-level, and phase-level. The model is pre-trained using multi-source data corpus training, such as encyclopedia, news information, and forum dialogue data. The concept of continuous multi-task learning is introduced, and the language model is pre-trained by constructing three types of tasks: how to organize lexical relationships between words, how to organize syntactic relationships between sentences, and how to organize semantic relationships between text semantic blocks. ERNIE can improve the effectiveness of NLP tasks. In the embodiment of the present invention, ERNIE is used to embed Chinese sentences, realizing word vector representation of Chinese sentences and English abbreviations, and providing network support for realizing the recognition of Chinese semantics of English abbreviations.
[0052] The embodiment of the present invention constructs a semantic recognition model for semantic recognition by a first model, a second model, and a third model including a knowledge-enhanced semantic representation model (ERNIE). Based on the ERNIE in the constructed semantic recognition model, Chinese semantic analysis of English abbreviations in Chinese sentences to be analyzed is implemented, thereby avoiding confusion in interpretation when interpreting English abbreviations in Chinese sentences to be analyzed because they contain multiple Chinese semantics.
[0053] In an exemplary embodiment, the first model of the embodiment of the present invention includes: a first ERNIE layer, a bidirectional long short-term memory (Bi-LSTM) layer, a fully connected layer, and a normalization layer; wherein,
[0054] The first ERNIE layer is used to perform word segmentation and embedding encoding on the first Chinese sentence to obtain the first word vector representation;
[0055] The Bi-LSTM layer is used to perform feature mapping on the first word vector representation to obtain a feature representation sequence.
[0056] The fully connected layer is used to: convert the obtained feature representation sequence into a one-dimensional vector;
[0057] The normalization layer is used to predict the position of the English abbreviation in the first Chinese sentence according to the one-dimensional vector obtained by the full connection layer transformation to obtain the first position.
[0058] In an exemplary embodiment, the first model of the embodiment of the present invention further includes a first input layer, which is used to send the input first Chinese sentence to the first ERNIE layer.
[0059] It should be noted that the normalization layer, also known as the Softmax regression layer, is a classifier well known to those skilled in the art and belongs to a black box model. Its function of obtaining the first position is the function of the Softmax regression layer itself and will not be elaborated here.
[0060] In an exemplary embodiment, the present invention can determine the parameters of the first model with reference to relevant principles. In an exemplary embodiment, the present invention can use the actual position of the English abbreviation in the first Chinese sentence as the label, use the cross entropy between the first position predicted by the Softmax regression layer and the actual position as the loss function, and modulate the parameters of the first ERNIE layer; in an exemplary embodiment, the present invention iteratively trains the parameters of the Bi-LSTM, fully connected layer, and Softmax regression layer to determine the relevant parameters of the first model.
[0061] In an exemplary embodiment, the second ERNIE layer of an embodiment of the present invention is used to:
[0062] According to the mask embedding representation of the first position and the second word vector representation, the Chinese semantics at the first position is predicted by embedding to obtain a first Chinese semantic embedding representation.
[0063] In an exemplary instance, the second model of an embodiment of the present invention further includes a second input layer for receiving the first position mask embedding representation and the second word vector representation.
[0064] In an exemplary instance, the second word vector representation of an embodiment of the present invention may include a word vector representation obtained using one-hot encoding, including: constructing a one-hot encoding for each letter through the positions of the 26 letters of the English alphabet, and splicing the constructed one-hot encodings to obtain a second word vector representation.
[0065] In an exemplary embodiment, the second model of an embodiment of the present invention further includes a second output layer, which is used to: output the first Chinese semantic embedding representation obtained by the second ERNIE layer.
[0066] In an exemplary embodiment, the third ERNIE layer of the embodiment of the present invention is used to:
[0067] An embedding representation is predicted for the first Chinese sentence with masked Chinese semantics to obtain a second Chinese semantic embedding representation.
[0068] In an exemplary embodiment, the third model of the embodiment of the present invention further includes a third input layer for receiving an input first Chinese sentence with masked Chinese semantics.
[0069] In an exemplary embodiment, the third model of the embodiment of the present invention further includes a third output layer, which is used to: output a second Chinese semantic embedding representation.
[0070] In an exemplary embodiment, the embodiment of the present invention optimizes the second model and the third model according to the similarity between the obtained first Chinese semantic embedding representation and the second Chinese semantic embedding representation, including:
[0071] Set the loss function based on similarity;
[0072] The second model and the third model are trained according to the set loss function.
[0073] Set the loss function based on similarity;
[0074] Iteratively training the second model and the third model to determine the minimized loss function;
[0075] The parameters of the second model and the third model when minimizing the loss function are determined as the parameters of the second model and the third model.
[0076] It should be noted that the determination of the parameters of the minimization loss function can be implemented with reference to related technologies and will not be elaborated in detail in the embodiment of the present invention.
[0077] In an exemplary embodiment, the embodiment of the present invention processes the Chinese sentence to be analyzed based on the constructed semantic recognition model, including:
[0078] Construct a corpus based on the English abbreviations contained in the first Chinese sentence;
[0079] When it is determined that the constructed corpus contains an English abbreviation in the Chinese sentence to be analyzed, the Chinese sentence to be analyzed is processed by the first model in the semantic recognition model to obtain a third word vector representation of the Chinese sentence to be analyzed and a second position of the English abbreviation in the Chinese sentence to be analyzed;
[0080] Masking the English abbreviation of the Chinese sentence to be analyzed according to the obtained second position to obtain a third Chinese semantic embedding representation after the second position is masked;
[0081] After concatenating the obtained third Chinese semantic embedding representation and the third word vector representation, the concatenation is input into the third model in the semantic recognition model to determine a fourth Chinese semantic embedding representation of the Chinese semantics of the second position of the Chinese sentence to be analyzed;
[0082] For an English abbreviation contained in the Chinese sentence to be analyzed, determining all fifth Chinese semantic embedding representations corresponding to the English abbreviation contained in a pre-built embedding representation library;
[0083] Calculating the similarity between the determined fourth Chinese semantic embedding representation and each of the determined fifth Chinese semantic embedding representations, and determining the fifth Chinese semantic with the greatest similarity as the Chinese semantic of the English abbreviation in the Chinese sentence to be analyzed;
[0084] The embedding representation library includes predetermined: one or more English abbreviations, and the fifth Chinese semantic embedding representation corresponding to each English abbreviation.
[0085] In an exemplary embodiment, when the corpus constructed by an embodiment of the present invention does not contain English abbreviations in the Chinese sentence to be analyzed, the method of the embodiment of the present invention further includes: storing the Chinese sentence to be analyzed, and training and updating the semantic recognition model based on the stored Chinese sentence to be analyzed.
[0086] An embodiment of the present invention further provides a computer storage medium, in which a computer program is stored. When the computer program is executed by a processor, the method for determining Chinese semantics is implemented.
[0087] An embodiment of the present invention further provides a terminal, comprising: a memory and a processor, wherein a computer program is stored in the memory;
[0088] The processor is configured to execute the computer program in the memory;
[0089] When the computer program is executed by a processor, the method for determining Chinese semantics as described above is implemented.
[0090] Figure 2 This is a structural block diagram of a device for determining Chinese semantics according to an embodiment of the present invention, such as Figure 2 As shown, it includes: a first model unit, a mask processing unit, a second model unit, a third model unit, a collaborative training unit, a construction unit and a determination unit; wherein,
[0091] The first model unit is configured to: process a first Chinese sentence containing an English abbreviation using a preset first model to obtain a first word vector representation of the first Chinese sentence and a first position of the English abbreviation therein, and determine a second word vector representation of the English abbreviation;
[0092] The mask processing unit is configured to: mask the first Chinese sentence according to the first position, and determine a first position mask embedding representation of the first Chinese sentence after the first position is masked according to the first word vector representation;
[0093] The second model unit is configured to: process the preset second model first position mask embedding representation and the second word vector representation to obtain a first Chinese semantic embedding representation of the Chinese semantics corresponding to the English at the first position;
[0094] The third model unit is configured to: process the first Chinese sentence with masked Chinese semantics obtained in advance through a preset third model to obtain a second Chinese semantic embedding representation corresponding to the Chinese semantic position;
[0095] The collaborative training unit is configured to optimize the second model and the third model according to the similarity between the first Chinese semantic embedding representation and the second Chinese semantic embedding representation;
[0096] The construction unit is set to: construct a semantic recognition model based on the first model, the optimized second model and the third model;
[0097] The determination unit is configured to: process the Chinese sentence to be analyzed according to the constructed semantic recognition model to determine the Chinese semantics of the English abbreviation in the Chinese sentence to be analyzed;
[0098] The first position mask embedding is the embedding representation after the first position in the word vector representation is masked.
[0099] The embodiment of the present invention constructs a semantic recognition model for semantic recognition by using the first model, the second model and the third model. Based on the constructed semantic recognition model, Chinese semantic analysis of English abbreviations in the Chinese sentences to be analyzed is realized, thereby avoiding confusion in interpretation when interpreting English abbreviations in the Chinese sentences to be analyzed because they contain multiple Chinese semantics.
[0100] In an exemplary embodiment, the first model of the embodiment of the present invention includes a first knowledge enhanced semantic representation model (ERNIE) layer composed of a first ERNIE.
[0101] In an exemplary embodiment, the second model of the embodiment of the present invention includes a second ERNIE layer composed of a second ERNIE.
[0102] In an exemplary embodiment, the third model of the embodiment of the present invention includes a third ERNIE layer composed of a third ERNIE.
[0103] In an exemplary embodiment, the first model of the embodiment of the present invention includes: a first ERNIE layer, a bidirectional long short-term memory (Bi-LSTM) layer, a fully connected layer, and a normalization layer; wherein,
[0104] The first ERNIE layer is used to perform word segmentation and embedding encoding on the first Chinese sentence to obtain the first word vector representation;
[0105] The Bi-LSTM layer is used to perform feature mapping on the first word vector representation to obtain a feature representation sequence.
[0106] The fully connected layer is used to: convert the obtained feature representation sequence into a one-dimensional vector;
[0107] The normalization layer is used to predict the position of the English abbreviation in the first Chinese sentence according to the one-dimensional vector obtained by the full connection layer transformation to obtain the first position.
[0108] In an exemplary embodiment, the first model of the embodiment of the present invention further includes a first input layer, which is used to send the input first Chinese sentence to the first ERNIE layer.
[0109] In an exemplary embodiment, the second ERNIE layer of an embodiment of the present invention is used to:
[0110] According to the mask embedding representation of the first position and the second word vector representation, the Chinese semantics at the first position is predicted by embedding to obtain a first Chinese semantic embedding representation.
[0111] In an exemplary instance, the second model of an embodiment of the present invention further includes a second input layer for receiving the first position mask embedding representation and the second word vector representation.
[0112] In an exemplary embodiment, the second model of an embodiment of the present invention further includes a second output layer, which is used to: output the first Chinese semantic embedding representation obtained by the second ERNIE layer.
[0113] In an exemplary embodiment, the third ERNIE layer of the embodiment of the present invention is used to:
[0114] An embedding representation is predicted for the first Chinese sentence with masked Chinese semantics to obtain a second Chinese semantic embedding representation.
[0115] In an exemplary embodiment, the third model of the embodiment of the present invention further includes a third input layer for receiving an input first Chinese sentence with masked Chinese semantics.
[0116] In an exemplary embodiment, the third model of the embodiment of the present invention further includes a third output layer, which is used to: output a second Chinese semantic embedding representation.
[0117] In an exemplary embodiment, the collaborative training unit of the embodiment of the present invention is configured as follows:
[0118] Set the loss function based on similarity;
[0119] Iteratively training the second model and the third model to determine the minimized loss function;
[0120] The parameters of the second model and the third model when minimizing the loss function are determined as the parameters of the second model and the third model.
[0121] In an exemplary embodiment, the determining unit of the embodiment of the present invention is configured to:
[0122] Construct a corpus based on the English abbreviations contained in the first Chinese sentence;
[0123] When it is determined that the constructed corpus contains an English abbreviation in the Chinese sentence to be analyzed, the Chinese sentence to be analyzed is processed by the first model in the semantic recognition model to obtain a third word vector representation of the Chinese sentence to be analyzed and a second position of the English abbreviation in the Chinese sentence to be analyzed;
[0124] Masking the English abbreviation of the Chinese sentence to be analyzed according to the obtained second position to obtain a third Chinese semantic embedding representation after the second position is masked;
[0125] After concatenating the obtained third Chinese semantic embedding representation and the third word vector representation, the concatenation is input into the third model in the semantic recognition model to determine a fourth Chinese semantic embedding representation of the Chinese semantics of the second position of the Chinese sentence to be analyzed;
[0126] For an English abbreviation contained in the Chinese sentence to be analyzed, determining all fifth Chinese semantic embedding representations corresponding to the English abbreviation contained in a pre-built embedding representation library;
[0127] Calculating the similarity between the determined fourth Chinese semantic embedding representation and each of the determined fifth Chinese semantic embedding representations, and determining the fifth Chinese semantic with the greatest similarity as the Chinese semantic of the English abbreviation in the Chinese sentence to be analyzed;
[0128] The embedding representation library includes predetermined: one or more English abbreviations, and the fifth Chinese semantic embedding representation corresponding to each English abbreviation.
[0129] The following briefly describes the embodiments of the present invention through application examples. The application examples are only used to illustrate the embodiments of the present invention and are not used to limit the protection scope of the embodiments of the present invention.
[0130] Application Examples
[0131] This application example provides a method for Chinese semantic recognition of English abbreviations based on deep learning. The method is based on ERNIE to perform embedding encoding on Chinese sentences with English abbreviations to obtain word vector representations, construct an English abbreviation corresponding position recognition model (the first model in the embodiment of the present invention), construct a Chinese semantic embedding representation model for the corresponding position of English abbreviations (the second model in the embodiment of the present invention), and construct a Chinese semantic embedding representation model corresponding to English abbreviations (the second model in the embodiment of the present invention); based on a pre-constructed embedding representation library of Chinese semantics corresponding to English abbreviations (the embedding representation library in the embodiment of the present invention), Chinese semantic recognition of English abbreviations in different Chinese sentences to be analyzed is performed through similarity calculation and matching. This application example can identify different Chinese semantics for the same English abbreviation according to its contextual semantics in the original sentence, so as to solve the problem of Chinese semantic confusion caused by using the same English abbreviations in different fields.
[0132] Figure 3 This is a processing flow chart of Chinese semantic recognition in an application example of the present invention, as shown in FIG. Figure 3 As shown, including:
[0133] Constructing a corpus; including: constructing a corpus based on the English abbreviations contained in the first Chinese sentence, wherein each English abbreviation in the corpus corresponds to one or more Chinese semantics; the first Chinese sentence of the embodiment of the present invention includes collecting text data from one or more predetermined channels, and the same English abbreviation may correspond to different Chinese semantic interpretations in different application scenarios.
[0134] Construct an English abbreviation corresponding position recognition model; in this application example, the first Chinese sentence is input into the English abbreviation corresponding position recognition model, and the input first Chinese sentence is processed to obtain the first word vector representation and the first position of the English abbreviation in the first Chinese sentence;
[0135] Construct a Chinese semantic embedding representation model for the corresponding position of the English abbreviation; the input of the Chinese semantic embedding representation model for the corresponding position of the English abbreviation in this application example includes: a masked embedding representation of the first position after the first position is masked and a second word vector representation of the English abbreviation in the predetermined first Chinese sentence; after the second ERNIE processing, a first Chinese semantic embedding representation of the Chinese semantics of the first position is obtained; wherein the masked embedding representation of the first position after the first position is masked is obtained based on the first word vector representation obtained by the English abbreviation corresponding position identifier and the first position processing;
[0136] Construct a Chinese semantic embedding representation model corresponding to English abbreviations. The input of this application example English abbreviation corresponding to Chinese semantic embedding representation model is: the first Chinese sentence with the Chinese semantics masked in advance, and the output is: the second Chinese semantic embedding representation corresponding to the Chinese semantic position.
[0137] Collaborative training constructs Chinese semantic embedding representation models corresponding to English abbreviations and constructs Chinese semantic embedding representation models corresponding to English abbreviations; this application example performs collaborative training based on the first Chinese semantic embedding representation and the second Chinese semantic embedding representation;
[0138] In an exemplary embodiment, the above-mentioned processing of this application example is implemented through offline training.
[0139] Construct an Embedding representation library of English abbreviations corresponding to Chinese semantics; in an exemplary embodiment, this application example can be constructed by those skilled in the art based on English abbreviations and the Chinese semantics corresponding to the English abbreviations in various application scenarios to construct an Embedding representation library.
[0140] Perform Chinese semantic recognition on English abbreviations in the Chinese sentence to be analyzed. After obtaining a semantic recognition model consisting of a first model, a second model determined by parameters, and a third model, this application example inputs the Chinese sentence to be analyzed into the semantic recognition model for processing to obtain the Chinese semantics of the English abbreviations contained in the Chinese sentence to be analyzed.
[0141] It will be appreciated by those skilled in the art that all or some of the steps, systems, and functional modules / units in the methods disclosed above may be implemented as software, firmware, hardware, and appropriate combinations thereof. In hardware implementations, the division between the functional modules / units mentioned in the above description does not necessarily correspond to the division of physical components; for example, a physical component may have multiple functions, or a function or step may be performed by several physical components in cooperation. Some or all components may be implemented as software executed by a processor, such as a digital signal processor or a microprocessor, or implemented as hardware, or implemented as an integrated circuit, such as an application-specific integrated circuit. Such software may be distributed on a computer-readable medium, which may include a computer storage medium (or non-transitory medium) and a communication medium (or temporary medium). As is well known to those skilled in the art, the term computer storage medium includes volatile and non-volatile, removable, and non-removable media implemented in any method or technology for storing information (such as computer-readable instructions, data structures, program modules, or other data). Computer storage media include, but are not limited to, RAM, ROM, EEPROM, flash memory or other memory technology, CD-ROM, digital versatile disks (DVD) or other optical disk storage, magnetic cassettes, magnetic tape, magnetic disk storage or other magnetic storage devices, or any other medium that can be used to store the desired information and can be accessed by a computer. In addition, it is well known to those skilled in the art that communication media generally embodies computer-readable instructions, data structures, program modules, or other data in a modulated data signal such as a carrier wave or other transport mechanism, and may include any information delivery media.
Claims
1. A method for determining Chinese semantics, comprising: Processing a first Chinese sentence containing an English abbreviation using a preset first model to obtain a first word vector representation of the first Chinese sentence and a first position of the English abbreviation therein, and determining a second word vector representation of the English abbreviation; Masking the first Chinese sentence according to the first position, and determining a first position masked embedding representation of the first Chinese sentence after the first position is masked according to the first word vector representation; Processing the first position mask embedding representation and the second word vector representation through a preset second model to obtain a first Chinese semantic embedding representation of the Chinese semantics corresponding to the English at the first position; Processing the pre-obtained first Chinese sentence with masked Chinese semantics through a preset third model to obtain a second Chinese semantic embedding representation corresponding to the Chinese semantic position; Optimizing the second model and the third model according to the similarity between the first Chinese semantic embedding representation and the second Chinese semantic embedding representation; Constructing a semantic recognition model based on the first model, the optimized second model, and the third model; Processing the Chinese sentence to be analyzed according to the constructed semantic recognition model to determine the Chinese semantics of the English abbreviations in the Chinese sentence to be analyzed; The first position mask embedding representation is: the embedding representation after the first position in the first word vector representation is masked.
2. The method according to claim 1, characterized in that The first model includes a first ERNIE layer composed of a first knowledge enhanced semantic representation model ERNIE; the second model includes a second ERNIE layer composed of a second ERNIE; and the third model includes a third ERNIE layer composed of a third ERNIE.
3. The method according to claim 2, characterized in that The first model includes: the first ERNIE layer, a bidirectional long short-term memory Bi-LSTM layer, a fully connected layer and a normalization layer; wherein, The first ERNIE layer is used to: perform word segmentation and embedding encoding on the first Chinese sentence to obtain the first word vector representation; The Bi-LSTM layer is used to perform feature mapping on the sequence composed of the first word vector representations obtained by the first ERNIE layer to obtain a feature representation sequence; The fully connected layer is used to: convert the obtained feature representation sequence into a one-dimensional vector; The normalization layer is used to predict the position of the English abbreviation in the first Chinese sentence according to the one-dimensional vector obtained by the conversion to obtain the first position.
4. The method according to claim 2, characterized in that The second ERNIE layer is used to: Based on the first position mask embedding representation and the second word vector representation, the Chinese semantics of the first position is predicted by embedding representation to obtain the first Chinese semantic embedding representation.
5. The method according to claim 2, characterized in that The third ERNIE layer is used to: An embedding representation prediction is performed on the first Chinese sentence with the Chinese semantics masked to obtain the second Chinese semantic embedding representation.
6. The method according to any one of claims 1 to 5, characterized in that The training of the second model and the third model includes: Setting a loss function according to the similarity; Iteratively training the second model and the third model to determine the minimized loss function; The parameters of the second model and the third model when minimizing the loss function are determined as the parameters of the second model and the third model.
7. The method according to any one of claims 1 to 5, characterized in that The processing of the Chinese sentence to be analyzed based on the constructed semantic recognition model includes: Construct a corpus based on the English abbreviations contained in the first Chinese sentence; When it is determined that the constructed corpus contains the English abbreviation in the Chinese sentence to be analyzed, the Chinese sentence to be analyzed is processed by the first model in the semantic recognition model to obtain a third word vector representation of the Chinese sentence to be analyzed and a second position of the English abbreviation in the Chinese sentence to be analyzed; Masking the English abbreviation of the Chinese sentence to be analyzed according to the obtained second position to obtain a third Chinese semantic embedding representation after the second position is masked; After concatenating the obtained third Chinese semantic embedding representation and the third word vector representation, the concatenation is input into the third model in the semantic recognition model to determine a fourth Chinese semantic embedding representation of the Chinese semantics of the second position of the Chinese sentence to be analyzed; For the English abbreviation contained in the Chinese sentence to be analyzed, determining all fifth Chinese semantic embedding representations corresponding to the English abbreviation contained in a pre-built embedding representation library; Calculating the similarity between the determined fourth Chinese semantic embedding representation and each of the determined fifth Chinese semantic embedding representations, and determining the fifth Chinese semantic with the greatest similarity as the Chinese semantic of the English abbreviation in the Chinese sentence to be analyzed; The embedding representation library includes: one or more predetermined English abbreviations, and the fifth Chinese semantic embedding representation corresponding to each English abbreviation.
8. A computer storage medium storing a computer program, wherein the computer storage medium stores a computer program, and when the computer program is executed by a processor, the method for determining Chinese semantics according to any one of claims 1 to 7 is implemented.
9. A terminal comprising: A memory and a processor, wherein the memory stores a computer program; wherein, The processor is configured to execute the computer program in the memory; When the computer program is executed by the processor, the method for determining Chinese semantics according to any one of claims 1 to 7 is implemented.
10. A device for determining Chinese semantics, comprising: A first model unit, a mask processing unit, a second model unit, a third model unit, a collaborative training unit, a construction unit, and a determination unit; wherein, The first model unit is configured to: process a first Chinese sentence containing an English abbreviation using a preset first model to obtain a first word vector representation of the first Chinese sentence and a first position of the English abbreviation therein, and determine a second word vector representation of the English abbreviation; The mask processing unit is configured to: mask the first Chinese sentence according to the first position, and determine a first position mask embedding representation of the first Chinese sentence after the first position is masked according to the first word vector representation; The second model unit is configured to: process the first position mask embedding representation and the second word vector representation through a preset second model to obtain a first Chinese semantic embedding representation of the Chinese semantics corresponding to the English at the first position; The third model unit is configured to: process the first Chinese sentence with masked Chinese semantics obtained in advance through a preset third model to obtain a second Chinese semantic embedding representation corresponding to the Chinese semantic position; The collaborative training unit is configured to: optimize the second model and the third model according to the similarity between the first Chinese semantic embedding representation and the second Chinese semantic embedding representation; The construction unit is configured to: construct a semantic recognition model according to the first model, the optimized second model and the third model; The determination unit is configured to: process the Chinese sentence to be analyzed according to the constructed semantic recognition model to determine the Chinese semantics of the English abbreviation in the Chinese sentence to be analyzed; The first position mask embedding representation is: the embedding representation after the first position in the first word vector representation is masked.
Citation Information
Patent Citations
Method and device for training language model based on multiple word vectors, equipment and medium
CN111737995A
Chinese medical named entity identification method and system, storage medium and equipment
CN112597774A