Word sense disambiguation method, device and related equipment based on contextual semantics

By using a pre-trained language model to extract contextual information and combining it with the Softmax classifier in word sense disambiguation, the problem of low word sense disambiguation accuracy in the existing technology is solved and higher word sense disambiguation accuracy is achieved.

CN113901836BActive Publication Date: 2024-09-17DONGGUAN UNIV OF TECH
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202111354317.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-11-16
Publication Date
2024-09-17
Estimated Expiration
2041-11-16

AI Technical Summary

Technical Problem

The existing technology has low accuracy in word meaning disambiguation and cannot effectively solve the problem of accurate definition of ambiguous words in different contexts.

Method used

By obtaining text data for preprocessing, and using pre-trained autoencoding or autoregressive language models to extract upper context information and lower context information, combined with Softmax linear classifier, determine the definition of ambiguous words in the current context, and improve Accuracy of word sense disambiguation.

Benefits of technology

By combining the above context and the below context information, the accuracy of definition classification of ambiguous words in the current context is significantly improved, and the accuracy of word meaning disambiguation is improved.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113901836B
    Figure CN113901836B
Patent Text Reader

Abstract

The present invention relates to the technical field of natural language processing, and discloses a word sense disambiguation method, device, computer equipment and storage medium based on context semantics. The method comprises: obtaining text data and preprocessing the text data to obtain data to be processed, inputting the data to be processed into a pre-trained language model for training, obtaining previous context information, ambiguous word information and following context information, obtaining text segment semantic information according to the previous context information, ambiguous word information and following context information, inputting the text segment semantic information into a pre-trained classifier for training, determining the definition of the ambiguous word information in the current context, and improving the accuracy of word sense disambiguation.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of natural language processing, and in particular to a word sense disambiguation method, device, computer equipment and storage medium based on contextual semantics. Background Art

[0002] There are a certain number of ambiguous words in language vocabulary. Ambiguous words bring convenience to the application of natural language, but also bring certain difficulties to the understanding and translation of natural language. With the rise of artificial intelligence, word sense disambiguation is increasingly used in many high-tech fields and has become an important problem that needs to be solved in natural language processing.

[0003] At present, the main method is to determine the context sentences of each word to be disambiguated, and after representation learning of the context sentences and the semantic sentences of the words to be disambiguated, calculate the similarity between each definition of each word to be disambiguated and the context sentences, and select the definition with the greatest similarity as the definition of the word to be disambiguated. However, this method can only roughly classify the definitions of the words to be disambiguated, with low accuracy and poor accuracy of word sense disambiguation. Summary of the invention

[0004] The embodiments of the present invention provide a context-based semantics-based word sense disambiguation method, apparatus, computer equipment and storage medium to improve the accuracy of word sense disambiguation.

[0005] In order to solve the above technical problems, the present application embodiment provides a word sense disambiguation method based on contextual semantics, including:

[0006] Acquire text data, and preprocess the text data to obtain data to be processed;

[0007] Inputting the data to be processed into a pre-trained language model for training to obtain context information of previous context, ambiguous word information and context information of following context, wherein the pre-trained language model is an autoencoding language model or an autoregressive language model;

[0008] Obtaining text segment semantic information according to the preceding context information, the ambiguous word information and the following context information;

[0009] The text segment semantic information is input into a pre-trained classifier for training to determine the definition of the ambiguous word information in the current context, and the pre-trained classifier is a Softmax linear classifier.

[0010] In order to solve the above technical problems, the embodiment of the present application further provides a word sense disambiguation device based on contextual semantics, including:

[0011] A data acquisition module, used to acquire text data and pre-process the text data to obtain data to be processed;

[0012] A first training module is used to input the data to be processed into a pre-trained language model for training to obtain context information, ambiguous word information and context information, wherein the pre-trained language model is an autoencoding language model or an autoregressive language model;

[0013] A text segment semantic information acquisition module, used to obtain text segment semantic information according to the preceding context information, the ambiguous word information and the following context information;

[0014] The second training module is used to input the semantic information of the text segment into a pre-trained classifier for training to determine the definition of the ambiguous word information in the current context, and the pre-trained classifier is a Softmax linear classifier.

[0015] In order to solve the above technical problems, an embodiment of the present application also provides a computer device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of the above-mentioned word sense disambiguation method based on contextual semantics when executing the computer program.

[0016] In order to solve the above technical problems, an embodiment of the present application further 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 the above-mentioned word sense disambiguation method based on contextual semantics are implemented.

[0017] The context-semantic-based word sense disambiguation method, device, computer equipment and storage medium provided by the embodiment of the present invention obtain text data and pre-process the text data to obtain data to be processed, input the data to be processed into a pre-trained language model for training to obtain context information, ambiguous word information and context information, the pre-trained language model is an autoencoder language model or an autoregressive language model, obtain text segment semantic information according to the context information, ambiguous word information and context information, input the text segment semantic information into a pre-trained classifier for training to determine the definition of the ambiguous word information in the current context, the pre-trained classifier is a Softmax linear classifier, the present invention determines the definition of the ambiguous word information in the current context by inputting the text segment semantic information into the pre-trained classifier for training, because the text segment semantic information combines the context information and the context information, the accuracy of the definition of the ambiguous word information in the current context is improved, thereby improving the accuracy of word sense disambiguation. BRIEF DESCRIPTION OF THE DRAWINGS

[0018] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the accompanying drawings required for use in the description of the embodiments of the present invention will be briefly introduced below. Obviously, the accompanying drawings in the following description are only some embodiments of the present invention. For ordinary technicians in this field, other accompanying drawings can be obtained based on these accompanying drawings without paying creative labor.

[0019] Figure 1 is an exemplary system architecture diagram to which the present application may be applied;

[0020] Figure 2 is a flowchart of an embodiment of a word sense disambiguation method based on contextual semantics of the present application;

[0021] Figure 3 is a structural schematic diagram of an embodiment of a word sense disambiguation device based on contextual semantics according to the present application;

[0022] Figure 4 is a schematic structural diagram of an embodiment of a computer device according to the present application;

[0023] Figure 5 It is a schematic diagram of the structure of word vectors in a pre-trained language model according to an embodiment of the word sense disambiguation method based on contextual semantics of the present application. DETAILED DESCRIPTION

[0024] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as those commonly understood by technicians in the technical field of the present application; the terms used in the specification of the application herein are only for the purpose of describing specific embodiments and are not intended to limit the present application; the terms "including" and "having" and any variations thereof in the specification and claims of the present application and the above-mentioned drawings are intended to cover non-exclusive inclusions. The terms "first", "second", etc. in the specification and claims of the present application or the above-mentioned drawings are used to distinguish different objects, not to describe a specific order.

[0025] Reference to "embodiments" herein means that a particular feature, structure, or characteristic described in conjunction with the embodiments may be included in at least one embodiment of the present application. The appearance of the phrase in various locations in the specification does not necessarily refer to the same embodiment, nor is it an independent or alternative embodiment that is mutually exclusive with other embodiments. It is explicitly and implicitly understood by those skilled in the art that the embodiments described herein may be combined with other embodiments.

[0026] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0027] See also Figure 1 ,like Figure 1 As shown, the system architecture 100 may include terminal devices 101, 102, 103, a network 104 and a server 105. The network 104 is used to provide a medium for communication links between the terminal devices 101, 102, 103 and the server 105. The network 104 may include various connection types, such as wired, wireless communication links or optical fiber cables, etc.

[0028] Users can use terminal devices 101 , 102 , 103 to interact with server 105 via network 104 to receive or send messages, etc.

[0029] Terminal devices 101, 102, 103 can be various electronic devices with display screens and supporting web browsing, including but not limited to smart phones, tablet computers, e-book readers, MP3 players (Moving Picture Experts Group Audio Layer III), MP4 (Moving Picture Experts Group Audio Layer IV), laptop computers, desktop computers, etc.

[0030] The server 105 may be a server that provides various services, such as a background server that provides support for web pages displayed on the terminal devices 101 , 102 , and 103 .

[0031] It should be noted that the TiDB database maintenance method provided in the embodiment of the present application is executed by a server, and accordingly, the TiDB database maintenance device is set in the server.

[0032] It should be understood that Figure 1 The number of terminal devices, networks and servers in the embodiment is only for illustration. According to the implementation requirements, there may be any number of terminal devices, networks and servers. The terminal devices 101, 102, 103 in the embodiment of the present application may specifically correspond to application systems in actual production.

[0033] See also Figure 2 , Figure 2A word sense disambiguation method based on contextual semantics provided by an embodiment of the present invention is shown. The method is applied in Figure 1 The server in is used as an example to illustrate the details as follows:

[0034] S201: Acquire text data, and pre-process the text data to obtain data to be processed.

[0035] Specifically, the text data is text data to be translated or understood, and can be obtained through Internet platforms such as learning platforms, translation platforms, web pages, etc. using crawler technology. The data to be processed is a word segmentation data set obtained after preprocessing the text data. The word segmentation data set includes multiple ambiguous word information, wherein each ambiguous word in the ambiguous word information has at least one definition in a preselected vocabulary resource (such as WordNet). The preprocessing includes cleaning, removing dirt, removing punctuation, word segmentation, sentence segmentation, and other processing of the text data.

[0036] S202: Input the data to be processed into a pre-trained language model for training to obtain previous context information, ambiguous word information and following context information. The pre-trained language model is an autoencoding language model or an autoregressive language model.

[0037] Specifically, the autoregressive model is the ELMO model, the autoencoder model is the BERT model, and the data format of the data to be processed input into the pre-trained language model is: [CLS] sentence 1[SEP], [CLS] sentence 2[SEP], and so on, where sentence1 and sentence2 are the data to be processed, where the input of the BERT model or the ELMO model is the data to be processed, and the output is the context information of the previous context, the ambiguous word information, and the context information of the following context of the data to be processed, which are represented as vector[sentence_up], vector[token], and vector[sentence_down], respectively. Figure 5 As shown, the BERT model or ELMO model outputs 1, 2, 3, ..., k-1, k, k+1, ..., n vectors, k and n are positive integers greater than 0 and k is less than n, vector[sentence_up] is the average of the [1, k-1]th vector output by the BERT model or ELMO model, vector[token] is the kth vector output by the BERT model or ELMO model, and vector[sentence_down] is the average of the [k+1, n]th vector output by the BERT model or ELMO model.

[0038] S203: Obtaining text segment semantic information based on previous context information, ambiguous word information and following context information.

[0039] Specifically, the semantic information of the text segment can be obtained by averaging the previous context information, ambiguous word information and the following context information, that is, averaging vector[sentence_up], vector[token] and vector[sentence_down] to obtain a vector vector[sentence], which is used as the semantic information of the text segment. The semantic information of the text segment reflects the relationship between the previous context information, the ambiguous word information and the following context information.

[0040] S204: inputting the semantic information of the text segment into a pre-trained classifier for training to determine the definition of the ambiguous word information in the current context, and the pre-trained classifier is a Softmax linear classifier.

[0041] Specifically, the text segment semantic information is input into the softmax classifier, and the softmax classifier calculates the score of the definition corresponding to the ambiguous word information in the text segment semantic information according to the text segment semantic information, and takes the definition corresponding to the highest score as the definition of the ambiguous word information in the current context, wherein the score corresponding to the definition of the ambiguous word information in the current context is determined according to formula (1):

[0042] (1)

[0043] Where P is the score corresponding to the definition of the ambiguous word information in the current context, w is the weight matrix with a dimension of H*H, b is the bias value, x is the text segment semantic information matrix with a dimension of H*1, and is the definition matrix with a dimension of H*S;

[0044] Among them, the method for obtaining the definition matrix is:

[0045] The definition data set is input into the pre-trained model, and a total of S vectors are obtained. The S vectors can be expressed as vector_1[CLS], vector_2[CLS], and so on. The S vectors are concatenated to obtain the definition matrix W_def. The dimension of the definition matrix is ​​H*S, where H and S are positive integers greater than 0. The pre-trained model can be a BERT model or an ELMO model. The definition data in the definition data set includes H ambiguous words and multiple definition data corresponding to each ambiguous word, which can be expressed as token_definition.

[0046] In this embodiment, text data is obtained and preprocessed to obtain data to be processed, and the data to be processed is input into a pre-trained language model for training to obtain context information, ambiguous word information and context information. The pre-trained language model is an autoencoder language model or an autoregressive language model. According to the context information, ambiguous word information and context information, text segment semantic information is obtained, and the text segment semantic information is input into a pre-trained classifier for training to determine the definition of the ambiguous word information in the current context. The pre-trained classifier is a Softmax linear classifier. The present invention determines the definition of the ambiguous word information in the current context by inputting the text segment semantic information into the pre-trained classifier for training. Since the text segment semantic information combines the context information and the context information, the accuracy of the definition classification of the ambiguous word information in the current context is improved, thereby improving the accuracy of word sense disambiguation.

[0047] In some optional implementations of this embodiment, in step S203, the text segment semantic information is obtained according to the previous context information, the ambiguous word information and the following context information, including:

[0048] The semantic information of the text segment is obtained by calculating the mean of the previous context information, ambiguous word information and the following context information.

[0049] Specifically, the previous context information is the previous word vector of the ambiguous word, the following context information is the following word vector of the ambiguous word, and the ambiguous word information is the ambiguous word vector corresponding to the ambiguous word.

[0050] In this embodiment, the text segment semantic information integrates the features of the previous context information, the ambiguous word information and the following context information, thereby improving the accuracy of the definition classification of the ambiguous word information in the current context, and further improving the accuracy of word sense disambiguation.

[0051] In some optional implementations of this embodiment, in step S203, the text segment semantic information is obtained according to the previous context information, the ambiguous word information and the following context information, including:

[0052] The above context information and ambiguous word information are averaged to obtain the first semantic information.

[0053] Specifically, the first semantic information is obtained by calculating the mean of the above context information and the ambiguous word information, which integrates the characteristics of the above context information and the ambiguous word information, and is beneficial to improving the accuracy of the definition of the ambiguous word information in the current context based on the above context information, thereby improving the accuracy of word sense disambiguation.

[0054] The second semantic information is obtained by calculating the mean of the following context information and the ambiguous word information.

[0055] Specifically, the second semantic information is obtained by calculating the mean of the following context information and the ambiguous word information, which integrates the characteristics of the following context information and the ambiguous word information, and is beneficial to improving the accuracy of definition classification of ambiguous word information in the current context based on the following context information, thereby improving the accuracy of word sense disambiguation.

[0056] The first semantic information and the second semantic information are used as text segment semantic information.

[0057] Specifically, the first semantic information and the second semantic information are concatenated to obtain concatenated association information, and the concatenated association information is used as the text segment semantic information.

[0058] In this embodiment, based on the correlation between the ambiguous word information and the previous context information and the following context information, the ambiguous word information and the previous context information are separated from the ambiguous word information and the following context information for mean calculation, thereby improving the accuracy of the definition classification of the ambiguous word information in the current context, and further improving the accuracy of word sense disambiguation.

[0059] In some optional implementations of this embodiment, in step S204, a definition information library is configured in the pre-trained classifier, the definition information library includes at least one definition of ambiguous word information, the text segment semantic information is input into the pre-trained classifier for training, and determining the definition of the ambiguous word information in the current context includes the following steps S2040 to S2041:

[0060] Step S2040: Input the semantic information of the text segment into a pre-trained classifier for probability prediction to obtain probability value information corresponding to the ambiguous word information.

[0061] Specifically, the probability value information is that a pre-trained classifier makes probability predictions on multiple definitions corresponding to ambiguous word information in the text segment semantic information according to the text segment semantic information to obtain a score for each definition, wherein the pre-trained classifier refers to the explanation of the embodiment of the above-mentioned step S204, and will not be repeated here to avoid repetition.

[0062] Step S2041: Determine the definition of the ambiguous word information in the current context according to the probability value information.

[0063] Specifically, the score of each definition in the probability value information is sorted in a preset order (such as from large to small) to obtain a score sequence, the highest score is selected from the score sequence, and the definition corresponding to the score is determined as the definition of the ambiguous word information in the current context.

[0064] In this embodiment, the semantic information of the text segment is input into a pre-trained classifier for probability prediction, the score of the definition corresponding to the ambiguous word information is determined, and the accuracy of the definition classification of the ambiguous word information in the current context is determined based on the score, thereby improving the accuracy of word sense disambiguation.

[0065] In some optional implementations of this embodiment, in step S2041, determining the definition of the ambiguous word information in the current context according to the probability value information includes the following steps S20410 to S20411:

[0066] Step S20410: The probability value information is the probability score of each definition corresponding to the ambiguous word information.

[0067] Step S20411: Determine the definition of the ambiguous word information in the current context according to the probability score of each definition.

[0068] In this embodiment, according to the high and low scores, the accuracy of determining the definition classification of ambiguous word information in the current context is improved, thereby improving the accuracy of word sense disambiguation.

[0069] In some optional implementations of this embodiment, in step S2041, determining the definition of the ambiguous word information in the current context according to the probability value information includes the following steps S20412 to S20414:

[0070] Step S20412: The probability value information includes the above probability score information, the below probability score information and the probability parameter.

[0071] Specifically, the probability score information above is the score of each definition corresponding to the ambiguous word information predicted by inputting the first semantic information into the pre-trained classifier, and the probability score information below is the score of each definition corresponding to the ambiguous word information predicted by inputting the second semantic information into the pre-trained classifier. The probability parameter is the training parameter of the pre-trained classifier, for example, the softmax linear classifier is trained using the training data until the loss function of the softmax linear classifier converges to obtain the probability parameter. It should be noted here that after the preset classifier finishes predicting the semantic information of the text segment, the training parameter will be updated to improve the prediction accuracy of the classifier for the definition classification of the ambiguous word information, thereby improving the accuracy of word sense disambiguation. The loss value is calculated according to formula (2):

[0072] (2)

[0073] Where M is the number of ambiguous words in a sentence, S is the number of definitions of each ambiguous word, is the true label of the m-th ambiguous word in the sentence, is the true label of the s-th definition of the m-th ambiguous word, and is the predicted score of the s-th definition of the m-th ambiguous word.

[0074] Step S20413: Calculate the probability score of each definition based on the above probability score information, the below probability peak information and the probability parameters.

[0075] Specifically, the probability score of each definition is calculated according to formula (3):

[0076] (3)

[0077] Wherein, is the probability score of the i-th definition of an ambiguous word, is the probability score of the i-th definition of an ambiguous word under the influence of the previous context information, is the probability score of the i-th definition of an ambiguous word under the influence of the following context information, and is the probability parameter.

[0078] Step S20414: Determine the definition of the ambiguous word information in the current context according to the probability score of each definition.

[0079] Specifically, the probability score of each definition is arranged in a preset order (such as from small to large) to obtain a score sequence, the highest score is selected from the score sequence, and the definition corresponding to the score is determined as the definition of the ambiguous word information in the current context.

[0080] In this embodiment, the probability score of each definition is calculated through the previous probability score information, the following probability peak information and the probability parameter, which improves the accuracy of definition classification of ambiguous word information in the current context, thereby improving the accuracy of word sense disambiguation.

[0081] In some optional implementations of this embodiment, step S20412 or step S20414, determining the definition of the ambiguous word information in the current context according to the probability score of each definition includes:

[0082] Each defined probability score is sorted according to a preset sorting rule to obtain a score sequence.

[0083] The maximum probability score is obtained from the score sequence, and the definition corresponding to the maximum probability score is used as the definition of the ambiguous word information in the current context.

[0084] In this embodiment, according to the high and low scores, the accuracy of determining the definition classification of ambiguous word information in the current context is improved, thereby improving the accuracy of word sense disambiguation.

[0085] It should be understood that the order of execution of the steps in the above embodiment does not necessarily mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiment of the present invention.

[0086] Figure 3 FIG. 1 is a block diagram showing a principle of a word sense disambiguation device based on contextual semantics corresponding to the word sense disambiguation method based on contextual semantics in the above embodiment. Figure 3 As shown, the context-based word sense disambiguation device includes a data acquisition module 30, a first training module 31, a related information acquisition module 32, and a second training module 33. The functional modules are described in detail as follows:

[0087] The data acquisition module 30 is used to acquire text data and pre-process the text data to obtain data to be processed.

[0088] The first training module 31 is used to input the data to be processed into a pre-trained language model for training to obtain previous context information, ambiguous word information and following context information. The pre-trained language model is an autoencoding language model or an autoregressive language model.

[0089] The text segment semantic information acquisition module 32 is used to obtain the text segment semantic information according to the previous context information, the ambiguous word information and the following context information.

[0090] The second training module 33 is used to input the semantic information of the text segment into a pre-trained classifier for training to determine the definition of the ambiguous word information in the current context. The pre-trained classifier is a Softmax linear classifier.

[0091] Optionally, the text segment semantic information acquisition module 32 includes:

[0092] The first mean calculation module is used to perform mean calculation on the previous context information, the ambiguous word information and the following context information to obtain the semantic information of the text segment.

[0093] Optionally, the text segment semantic information acquisition module 32 includes:

[0094] The second mean value calculation module is used to perform mean value calculation on the above context information and the ambiguous word information to obtain the first semantic information.

[0095] The third mean calculation module is used to perform mean calculation on the following context information and ambiguous word information to obtain second semantic information.

[0096] The information determination module is used to use the first semantic information and the second semantic information as text segment semantic information.

[0097] Optionally, the second training module 33 includes:

[0098] The probability prediction module is used to input the semantic information of the text segment into a pre-trained classifier for probability prediction to obtain probability value information corresponding to the ambiguous word information; the pre-trained classifier is configured with a definition information library, and the definition information library includes at least one definition of the ambiguous word information.

[0099] The first definition determination module is used to determine the definition of the ambiguous word information in the current context according to the probability value information.

[0100] Optionally, the first definition determination module includes:

[0101] The first information determination module is used to determine the probability value information as a probability score of each definition corresponding to the ambiguous word information.

[0102] The second definition determination module is used to determine the definition of the ambiguous word information in the current context according to the probability score of each definition.

[0103] Optionally, the definition module includes:

[0104] The second information determination module is used to determine the probability value information as the above probability score information, the below probability score information and the probability parameter.

[0105] The probability score acquisition module is used to calculate the probability score of each definition according to the above probability score information, the following probability peak information and the probability parameters.

[0106] The third definition determination module is used to determine the definition of the ambiguous word information in the current context according to the probability score of each definition.

[0107] Optionally, the second definition determination module and the third definition determination module include:

[0108] The sorting module is used to sort each defined probability score according to a preset sorting rule to obtain a score sequence.

[0109] The fourth definition determination unit is used to obtain the maximum probability score from the score sequence, and use the definition corresponding to the maximum probability score as the definition of the ambiguous word information in the current context.

[0110] For the specific definition of the word sense disambiguation device based on contextual semantics, please refer to the definition of the word sense disambiguation method based on contextual semantics above, which will not be repeated here. Each module in the above-mentioned word sense disambiguation device based on contextual semantics can be implemented in whole or in part by software, hardware and a combination thereof. The above-mentioned modules can be embedded in or independent of the processor in the computer device in the form of hardware, or can be stored in the memory of the computer device in the form of software, so that the processor can call and execute the operations corresponding to the above modules.

[0111] To solve the above technical problems, the present application also provides a computer device. Figure 4 , Figure 4 This is a basic structural block diagram of the computer device in this embodiment.

[0112] The computer device 4 includes a memory 41, a processor 42, and a network interface 43 that are interconnected through a system bus. It should be noted that the figure only shows a computer device 4 with components connected to the memory 41, the processor 42, and the network interface 43, but it should be understood that it is not required to implement all the components shown, and more or fewer components can be implemented instead. Among them, those skilled in the art can understand that the computer device here is a device that can automatically perform numerical calculations and / or information processing according to pre-set or stored instructions, and its hardware includes but is not limited to microprocessors, application specific integrated circuits (Application Specific Integrated Circuit, ASIC), programmable gate arrays (Field-Programmable Gate Array, FPGA), digital processors (Digital Signal Processor, DSP), embedded devices, etc.

[0113] The computer device may be a computing device such as a desktop computer, a notebook, a PDA, a cloud server, etc. The computer device may interact with a user through a keyboard, a mouse, a remote controller, a touch pad, or a voice control device.

[0114] The memory 41 includes at least one type of readable storage medium, and the readable storage medium includes flash memory, hard disk, multimedia card, card-type memory (for example, SD or D interface display memory, etc.), random access memory (RAM), static random access memory (SRAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), programmable read-only memory (PROM), magnetic memory, disk, optical disk, etc. In some embodiments, the memory 41 can be an internal storage unit of the computer device 4, such as a hard disk or memory of the computer device 4. In other embodiments, the memory 41 can also be an external storage device of the computer device 4, such as a plug-in hard disk, a smart memory card (Smart Media Card, SMC), a secure digital (Secure Digital, SD) card, a flash card (Flash Card), etc. equipped on the computer device 4. Of course, the memory 41 can also include both the internal storage unit of the computer device 4 and its external storage device. In this embodiment, the memory 41 is generally used to store the operating system and various application software installed on the computer device 4, such as the program code for controlling electronic files, etc. In addition, the memory 41 can also be used to temporarily store various types of data that have been output or are to be output.

[0115] The processor 42 may be a central processing unit (CPU), a controller, a microcontroller, a microprocessor, or other data processing chips in some embodiments. The processor 42 is generally used to control the overall operation of the computer device 4. In this embodiment, the processor 42 is used to run the program code stored in the memory 41 or process data, such as running the program code for controlling the electronic file.

[0116] The network interface 43 may include a wireless network interface or a wired network interface. The network interface 43 is generally used to establish a communication connection between the computer device 4 and other electronic devices.

[0117] The present application also provides another implementation, namely, providing a computer-readable storage medium, wherein the computer-readable storage medium stores an interface display program, and the interface display program can be executed by at least one processor to enable the at least one processor to perform the steps of the word sense disambiguation method based on contextual semantics as described above.

[0118] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present application, or the part that contributes to the prior art, can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, a magnetic disk, or an optical disk), and includes a number of instructions for enabling a terminal device (which can be a mobile phone, a computer, a server, an air conditioner, or a network device, etc.) to execute the methods described in each embodiment of the present application.

[0119] Obviously, the embodiments described above are only some embodiments of the present application, rather than all embodiments. The preferred embodiments of the present application are given in the accompanying drawings, but they do not limit the patent scope of the present application. The present application can be implemented in many different forms. On the contrary, the purpose of providing these embodiments is to make the understanding of the disclosure of the present application more thorough and comprehensive. Although the present application is described in detail with reference to the aforementioned embodiments, for those skilled in the art, it is still possible to modify the technical solutions recorded in the aforementioned specific implementation methods, or to perform equivalent replacement of some of the technical features therein. Any equivalent structure made using the contents of the specification and drawings of this application, directly or indirectly used in other related technical fields, is similarly within the scope of patent protection of this application.

Claims

1. A word sense disambiguation method based on contextual semantics, characterized in that: include: Acquire text data, and preprocess the text data to obtain data to be processed; Inputting the data to be processed into a pre-trained language model for training to obtain context information of previous context, ambiguous word information and context information of following context, wherein the pre-trained language model is an autoencoding language model or an autoregressive language model; Obtaining text segment semantic information according to the preceding context information, the ambiguous word information and the following context information; Inputting the text segment semantic information into a pre-trained classifier for training to determine the definition of the ambiguous word information in the current context, wherein the pre-trained classifier is a Softmax linear classifier; The pre-trained classifier is configured with a definition information library, the definition information library includes at least one definition of ambiguous word information, the text segment semantic information is input into the pre-trained classifier for training, and determining the definition of the ambiguous word information in the current context includes: Inputting the semantic information of the text segment into the pre-trained classifier for probability prediction to obtain probability value information corresponding to the ambiguous word information, Determining the definition of the ambiguous word information in the current context according to the probability value information; Determining the definition of the ambiguous word information in the current context according to the probability value information includes: The probability value information is the probability score of each definition corresponding to the ambiguous word information. Determining the definition of the ambiguous word information in the current context according to the probability score of each of the definitions; Determining the definition of the ambiguous word information in the current context according to the probability value information includes: The probability value information includes the above probability score information, the following probability score information and the probability parameter. The probability score of each definition is calculated according to the above probability score information, the below probability score information and the probability parameter, Determining the definition of the ambiguous word information in the current context according to the probability score of each of the definitions; Determining the definition of the ambiguous word information in the current context according to the probability score of each definition includes: Sort each of the defined probability scores according to a preset sorting rule to obtain a score sequence, The maximum probability score is obtained from the score sequence, and the definition corresponding to the maximum probability score is used as the definition of the ambiguous word information in the current context.

2. The word sense disambiguation method based on contextual semantics as claimed in claim 1, characterized in that: The obtaining of text segment semantic information according to the preceding context information, the ambiguous word information and the following context information includes: The preceding context information, the ambiguous word information and the following context information are averaged to obtain text segment semantic information.

3. The word sense disambiguation method based on contextual semantics as claimed in claim 1, characterized in that: The obtaining of text segment semantic information according to the preceding context information, the ambiguous word information and the following context information includes: Performing mean calculation on the above context information and the ambiguous word information to obtain first semantic information; Performing mean calculation on the following context information and the ambiguous word information to obtain second semantic information; The first semantic information and the second semantic information are used as the text segment semantic information.

4. A word sense disambiguation device based on contextual semantics, characterized in that: The method for word sense disambiguation based on contextual semantics as claimed in claim 1 comprises: A data acquisition module, used to acquire text data and pre-process the text data to obtain data to be processed; A first training module is used to input the data to be processed into a pre-trained language model for training to obtain context information, ambiguous word information and context information, wherein the pre-trained language model is an autoencoding language model or an autoregressive language model; A text segment semantic information acquisition module, used to obtain text segment semantic information according to the preceding context information, the ambiguous word information and the following context information; The second training module is used to input the semantic information of the text segment into a pre-trained classifier for training to determine the definition of the ambiguous word information in the current context, and the pre-trained classifier is a Softmax linear classifier.

5. A computer device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the word sense disambiguation method based on contextual semantics as described in any one of claims 1 to 3 is implemented.

6. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the method for word sense disambiguation based on contextual semantics as described in any one of claims 1 to 3 is implemented.

Citation Information

Patent Citations

  • Chinese semantic disambiguation method based on knowledge graph and context

    CN113065002A

  • Type-based selection of rules for semantically disambiguating words

    US6405162B1

  • Word meaning disambiguation method and device, word meaning expansion method, apparatus and device, and computer-readable storage medium

    WO2019085640A1