CN113901836B - Word sense disambiguation method and device based on context semantics and related equipment - Google Patents
Word sense disambiguation method and device based on context semantics and related equipment Download PDFInfo
- Publication number
- CN113901836B CN113901836B CN202111354317.1A CN202111354317A CN113901836B CN 113901836 B CN113901836 B CN 113901836B CN 202111354317 A CN202111354317 A CN 202111354317A CN 113901836 B CN113901836 B CN 113901836B
- Authority
- CN
- China
- Prior art keywords
- information
- context
- definition
- ambiguous word
- probability
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Active
Links
- 238000000034 method Methods 0.000 title claims abstract description 31
- 238000012549 training Methods 0.000 claims abstract description 31
- 238000003860 storage Methods 0.000 claims abstract description 12
- 238000004364 calculation method Methods 0.000 claims description 16
- 238000007781 pre-processing Methods 0.000 claims description 8
- 238000004590 computer program Methods 0.000 claims description 7
- 238000003058 natural language processing Methods 0.000 abstract description 3
- 239000013598 vector Substances 0.000 description 15
- 239000011159 matrix material Substances 0.000 description 9
- 238000010586 diagram Methods 0.000 description 6
- 230000011218 segmentation Effects 0.000 description 4
- 238000004891 communication Methods 0.000 description 3
- 238000012545 processing Methods 0.000 description 3
- 230000006835 compression Effects 0.000 description 2
- 238000007906 compression Methods 0.000 description 2
- 238000005516 engineering process Methods 0.000 description 2
- 230000006870 function Effects 0.000 description 2
- 230000003287 optical effect Effects 0.000 description 2
- 238000012163 sequencing technique Methods 0.000 description 2
- 238000013519 translation Methods 0.000 description 2
- 238000012935 Averaging Methods 0.000 description 1
- 238000013473 artificial intelligence Methods 0.000 description 1
- 238000004140 cleaning Methods 0.000 description 1
- 239000000835 fiber Substances 0.000 description 1
- 230000010365 information processing Effects 0.000 description 1
- 230000003993 interaction Effects 0.000 description 1
- 238000004519 manufacturing process Methods 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- 230000003068 static effect Effects 0.000 description 1
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F40/00—Handling natural language data
- G06F40/30—Semantic analysis
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F18/00—Pattern recognition
- G06F18/20—Analysing
- G06F18/24—Classification techniques
- G06F18/241—Classification techniques relating to the classification model, e.g. parametric or non-parametric approaches
- G06F18/2415—Classification techniques relating to the classification model, e.g. parametric or non-parametric approaches based on parametric or probabilistic models, e.g. based on likelihood ratio or false acceptance rate versus a false rejection rate
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F40/00—Handling natural language data
- G06F40/20—Natural language analysis
- G06F40/279—Recognition of textual entities
- G06F40/289—Phrasal analysis, e.g. finite state techniques or chunking
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- Artificial Intelligence (AREA)
- General Physics & Mathematics (AREA)
- General Health & Medical Sciences (AREA)
- Data Mining & Analysis (AREA)
- Computational Linguistics (AREA)
- Audiology, Speech & Language Pathology (AREA)
- Health & Medical Sciences (AREA)
- Life Sciences & Earth Sciences (AREA)
- Evolutionary Computation (AREA)
- Evolutionary Biology (AREA)
- Computer Vision & Pattern Recognition (AREA)
- Bioinformatics & Computational Biology (AREA)
- Bioinformatics & Cheminformatics (AREA)
- Probability & Statistics with Applications (AREA)
- Machine Translation (AREA)
Abstract
The invention relates to the technical field of natural language processing, and discloses a word sense disambiguation method, a device, computer equipment and a storage medium based on context semantics, wherein the method comprises the following steps: the text data is obtained, preprocessed to obtain the data to be processed, the data to be processed is input into a pre-trained language model for training to obtain the context information, the ambiguous word information and the context information, text segment semantic information is obtained according to the context information, the ambiguous word information and the context information, the text segment semantic information is input into a pre-trained classifier for training, definition of the ambiguous word information in the current context is determined, and word sense disambiguation accuracy is improved.
Description
Technical Field
The present invention relates to the field of natural language processing technologies, and in particular, to a word sense disambiguation method, device, computer device, and storage medium based on context semantics.
Background
A certain number of ambiguous words exist in the language vocabulary, the ambiguous words bring convenience for the application of the natural language, and certain difficulties are brought for the understanding and translation of the natural language. With the rise of artificial intelligence, word sense disambiguation is increasingly applied to a plurality of high and new fields, and has become an important problem to be solved in natural language processing.
At present, the context Wen Yugou of each word to be disambiguated is mainly determined, after the representation learning is carried out on the context sentences and the word sense sentences where the words to be disambiguated are located, the similarity of each definition of each word to be disambiguated and the context sentences is calculated, and the definition with the largest similarity is selected as the definition of the word to be disambiguated, but the definition of the word to be disambiguated can only be roughly classified in the mode, so that the accuracy rate is lower, and the word sense disambiguation accuracy is poor.
Disclosure of Invention
The embodiment of the invention provides a word sense disambiguation method, a device, computer equipment and a storage medium based on context semantics, so as to improve the accuracy of word sense disambiguation.
In order to solve the above technical problems, an embodiment of the present application provides a word sense disambiguation method based on context semantics, including:
acquiring 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 to obtain the context information, the ambiguous word information and the context information, wherein the pre-trained language model is a self-coding language model or an autoregressive language model;
obtaining text segment semantic information according to the context information, the ambiguous word information and the context information;
Inputting the text segment semantic information into a pre-trained classifier for training, and determining the definition of the ambiguous word information in the current context, wherein the pre-trained classifier is a Softmax linear classifier.
In order to solve the above technical problem, an embodiment of the present application further provides a word sense disambiguation device based on context semantics, including:
The data acquisition module is used for acquiring text data and preprocessing the text data to obtain data to be processed;
The first training module is used for inputting the data to be processed into a pre-trained language model for training to obtain the context information, the ambiguous word information and the context information, wherein the pre-trained language model is an autorecoding language model or an autoregressive language model;
The text segment semantic information acquisition module is used for acquiring text segment semantic information according to the context information, the ambiguous word information and the context information;
And the second training module is used for 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, wherein the pre-trained classifier is a Softmax linear classifier.
In order to solve the above technical problem, an embodiment of the present application further provides a computer device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, where the processor implements the steps of the word sense disambiguation method based on context semantics when executing the computer program.
To solve the above technical problem, embodiments of the present application further provide a computer readable storage medium storing a computer program, which when executed by a processor, implements the steps of the word sense disambiguation method based on context semantics.
According to the word sense disambiguation method, device, computer equipment and storage medium based on context semantics, text data are obtained, the text data are preprocessed to obtain the data to be processed, the data to be processed are input into a pre-trained language model to be trained to obtain the context information, the ambiguous word information and the context information, the pre-trained language model is a self-coding language model or an autoregressive language model, text segment semantic information is obtained according to the context information, the ambiguous word information and the context information, the text segment semantic information is input into a pre-trained classifier to be trained, definition of the ambiguous word information in a current context is determined, and the pre-trained classifier is a Softmax linear classifier.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings that are needed in the description of the embodiments of the present invention will be briefly described below, it being obvious that the drawings in the following description are only some embodiments of the present invention, and that other drawings may be obtained according to these drawings without inventive effort for a person skilled in the art.
FIG. 1 is an exemplary system architecture diagram in which the present application may be applied;
FIG. 2 is a flow diagram of one embodiment of a word sense disambiguation method based on context semantics of the present application;
FIG. 3 is a schematic diagram of one embodiment of a context semantic based word sense disambiguation apparatus according to the present application;
FIG. 4 is a schematic structural view of one embodiment of a computer device according to the present application;
FIG. 5 is a schematic diagram of the structure of word vectors in a pre-trained language model according to one embodiment of a context semantic based word sense disambiguation method of the present application.
Detailed Description
Unless defined otherwise, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application belongs; the terminology used in the description of the applications herein is for the purpose of describing particular embodiments only and is not intended to be limiting of the application; the terms "comprising" and "having" and any variations thereof in the description of the application and the claims and the description of the drawings above are intended to cover a non-exclusive inclusion. The terms first, second and the like in the description and in the claims or in the above-described figures, are used for distinguishing between different objects and not necessarily for describing a sequential or chronological order.
Reference herein to "an embodiment" means that a particular feature, structure, or characteristic described in connection with the embodiment may be included in at least one embodiment of the application. The appearances of such phrases in various places in the specification are not necessarily all referring to the same embodiment, nor are separate or alternative embodiments mutually exclusive of other embodiments. Those of skill in the art will explicitly and implicitly appreciate that the embodiments described herein may be combined with other embodiments.
The following description of the embodiments of the present invention will be made clearly and fully with reference to the accompanying drawings, in which it is evident that the embodiments described are some, but not all embodiments of the invention. All other embodiments, which can be made by those skilled in the art based on the embodiments of the invention without making any inventive effort, are intended to be within the scope of the invention.
Referring to fig. 1, as shown in fig. 1, a system architecture 100 may include terminal devices 101, 102, 103, a network 104, and a server 105. The network 104 is used as a medium to provide 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 fiber optic cables, among others.
The user may interact with the server 105 via the network 104 using the terminal devices 101, 102, 103 to receive or send messages or the like.
The terminal devices 101, 102, 103 may be various electronic devices having a display screen and supporting web browsing, including but not limited to smartphones, tablet computers, electronic book readers, MP3 players (Moving Picture Experts Group Audio Layer III, dynamic video expert compression standard audio plane 3), MP4 (Moving Picture Experts Group Audio Layer IV, dynamic video expert compression standard audio plane 4) players, laptop and desktop computers, and the like.
The server 105 may be a server providing various services, such as a background server providing support for pages displayed on the terminal devices 101, 102, 103.
It should be noted that, the method for maintaining the TiDB database provided by the embodiment of the present application is executed by the server, and accordingly, the device for maintaining the TiDB database is disposed in the server.
It should be understood that the number of terminal devices, networks and servers in fig. 1 is merely illustrative. Any number of terminal devices, networks and servers may be provided according to implementation requirements, and the terminal devices 101, 102, 103 in the embodiment of the present application may specifically correspond to application systems in actual production.
Referring to fig. 2, fig. 2 shows a word sense disambiguation method based on context semantics according to an embodiment of the present invention, and the method is applied to the server in fig. 1 for illustration, and is described in detail as follows:
S201: and acquiring text data, and preprocessing the text data to obtain data to be processed.
Specifically, the text data is text data to be translated or understood, and can be obtained through an internet platform by adopting a crawler technology, such as a learning platform, a translation platform, a webpage and the like, the data to be processed is a word segmentation data set obtained by preprocessing the text data, and the word segmentation data set comprises a plurality of ambiguous word information, wherein for each ambiguous word in the ambiguous word information, at least one definition is provided in a preselected vocabulary resource (such as WordNet), and preprocessing comprises the processes of cleaning, dirtying, punctuation removal, word segmentation, sentence segmentation and the like of the text data.
S202: and inputting the data to be processed into a pre-trained language model for training to obtain the context information, the ambiguous word information and the context information, wherein the pre-trained language model is a self-coding language model or an autoregressive language model.
Specifically, the autoregressive model is elmo models, the autocoding model is bert models, and the data formats of the data to be processed input into the pre-trained language model are as follows: [ CLS ] sentence 1[ sep ], [ CLS ] sentence 2[ sep ], and so on, wherein sentence, sentence are data to be processed, wherein an input of the model bert or elmo is data to be processed, the above context information, ambiguous word information, and the following context information output as data to be processed are represented as vector [ sentence _up ], vector [ token ], vector [ sentence _down ], respectively, wherein, as shown in fig. 5, bert model or elmo model outputs 1,2,3,...
S203: and obtaining text segment semantic information according to the context information, the ambiguous word information and the context information.
Specifically, text segment semantic information can be obtained by averaging the context information, the ambiguous word information and the context information, that is, vector [ sentence _up ], vector [ token ], vector [ sentence _down ] are averaged to obtain a vector [ sentence ], and the vector [ sentence ] is used as the text segment semantic information, where the text segment semantic information reflects the association among the context information, the ambiguous word information and the context information.
S204: inputting text segment semantic information into a pre-trained classifier for training, and determining definition of ambiguous word information in the current context, wherein the pre-trained classifier is a Softmax linear classifier.
Specifically, inputting text segment semantic information into a softmax classifier, wherein the softmax classifier calculates the score of a definition corresponding to 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 a formula (1):
(1)
wherein P is the score corresponding to the definition of the ambiguous word information in the current context, w is a weight matrix, the dimension of the weight matrix is H, b is a bias value, x is a text segment semantic information matrix, the dimension of the weight matrix is H1, and the dimension of the weight matrix is H S;
the method for acquiring the definition matrix comprises the following steps:
The definition data set is input into a pre-training model to obtain S vectors, the S vectors can be expressed as vector_1[ CLS ], vector_2[ CLS ], and the like, the S vectors are spliced to obtain a definition matrix W_def, the dimension of the definition matrix is H x S, H, S is a positive integer greater than 0, the pre-training model can be bert model or elmo model, and the definition data in the definition data set comprises H ambiguous words and a plurality of definition data corresponding to each ambiguous word, and the definition matrix can be expressed as token_definition.
In this embodiment, text data is obtained and preprocessed to obtain data to be processed, the data to be processed is input into a pre-trained language model to train to obtain context information, ambiguous word information and context information, the pre-trained language model is a self-coding language model or an autoregressive language model, text segment semantic information is obtained according to the context information, the ambiguous word information and the context information, the text segment semantic information is input into a pre-trained classifier to train to determine definition of the ambiguous word information in a current context, and the pre-trained classifier is a Softmax linear classifier.
In some optional implementations of the present embodiment, in step S203, obtaining text segment semantic information according to the context information, the ambiguous word information, and the context information includes:
And carrying out mean value calculation on the context information, the ambiguous word information and the context information to obtain text segment semantic information.
Specifically, the context information is an context vector of an ambiguous word, the context information is a context vector of the ambiguous word, and the ambiguous word information is an ambiguous word vector corresponding to the ambiguous word.
In this embodiment, the text segment semantic information fuses the features of the context information, the ambiguous word information and the context information, so that the definition and classification accuracy of the ambiguous word information in the current context is improved, and the word sense disambiguation accuracy is further improved.
In some optional implementations of the present embodiment, in step S203, obtaining text segment semantic information according to the context information, the ambiguous word information, and the context information includes:
and carrying out mean value calculation on the context information and the ambiguous word information to obtain first semantic information.
Specifically, the first semantic information is obtained by carrying out mean value calculation on the context information and the ambiguous word information, so that the characteristics of the context information and the ambiguous word information are fused, the definition accuracy of the ambiguous word information in the current context is improved according to the context information, and the word sense disambiguation accuracy is further improved.
And carrying out mean value calculation on the context information and the ambiguous word information to obtain second semantic information.
Specifically, the second semantic information is obtained by carrying out mean value calculation on the context information and the ambiguous word information, so that the characteristics of the context information and the ambiguous word information are fused, the definition and classification accuracy of the ambiguous word information in the current context is improved according to the context information, and the word sense disambiguation accuracy is further improved.
And taking the first semantic information and the second semantic information as text segment semantic information.
Specifically, the first semantic information and the second semantic information are spliced to obtain splicing association information, and the splicing association information is used as text segment semantic information.
In this embodiment, according to the association degree of the ambiguous word information, the context information and the context information, the mean value calculation is performed on the ambiguous word information and the context information and the ambiguous word information and the context information separately, so that the definition and classification accuracy of the ambiguous word information in the current context is improved, and the word sense disambiguation accuracy is further improved.
In some optional implementations of this embodiment, in step S204, a definition information base is configured in the pre-trained classifier, the definition information base includes at least one definition of ambiguous word information, 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:
And step S2040, inputting text segment semantic information into a pre-trained classifier for probability prediction to obtain probability value information corresponding to the ambiguous word information.
Specifically, the probability value information is that the pre-trained classifier performs probability prediction on a plurality of definitions corresponding to ambiguous word information in the text segment semantic information according to the text segment semantic information to obtain a score of each definition, where the pre-trained classifier refers to the explanation of the embodiment of step S204, and is not repeated here.
And step S2041, determining definition of the ambiguous word information in the current context according to the probability value information.
Specifically, the scores of each definition in the probability value information are ordered according to a preset sequence (such as a sequence from large to small), a score sequence is obtained, 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.
In the embodiment, the text segment semantic information is input into the pre-trained classifier for probability prediction, the defined score corresponding to the ambiguous word information is determined, and the definition classification accuracy of the ambiguous word information in the current context is determined according to the score, so that the word sense disambiguation accuracy is improved.
In some optional implementations of the present embodiment, in step S2041, determining the definition of the ambiguous word information in the current context according to the probability value information includes steps S20410 to S20411 as follows:
in step S20410, probability value information is a probability score for each definition corresponding to the ambiguous word information.
Step S20411, according to the probability score of each definition, determining the definition of the ambiguous word information in the current context.
In the embodiment, the accuracy of determining the definition classification of the ambiguous word information in the current context is improved according to the score, and the accuracy of word sense disambiguation is further improved.
In some optional implementations of the present embodiment, in step S2041, determining the definition of the ambiguous word information in the current context according to the probability value information includes steps S20412 to S20414 as follows:
Step S20412, the probability value information is the above probability score information, the below probability score information, and the probability parameter.
Specifically, the above probability score information is a score defined by each of the first semantic information input to the pre-trained classifier, the following probability score information is a score defined by each of the second semantic information input to the pre-trained classifier, and the probability parameter is a training parameter of the pre-trained classifier, for example, training the softmax linear classifier by training data until the loss function of the softmax linear classifier converges to obtain the probability parameter, wherein the training parameter is updated after the pre-set classifier predicts the text segment semantic information, the prediction accuracy of the classifier on the defined classification of the ambiguous word information is improved, and the accuracy of sense disambiguation is further improved, and the loss value is calculated according to the formula (2):
(2)
wherein M is the number of ambiguous words in a sentence, S is the number of definitions of each ambiguous word, the true label of the mth ambiguous word in the sentence is the true label of the S-th definition of the mth ambiguous word, and the predictive value of the S-th definition of the mth ambiguous word is provided.
Step S20413, calculating to obtain each defined probability score according to the above probability score information, the following probability peak information and the probability parameters.
Specifically, each defined probability score is calculated according to equation (3):
(3)
Wherein, the probability score defined for the ith of the ambiguous word is defined for the ith of the ambiguous word under the influence of the context information, the probability score defined for the ith of the ambiguous word under the influence of the context information is defined for the probability score of the ith of the ambiguous word under the influence of the context information, and the probability parameter is defined.
Step S20414, according to each defined probability score, determining the definition of the ambiguous word information in the current context.
Specifically, the probability scores of each definition are arranged according to a preset sequence (such as a sequence from small to large), a score sequence is obtained, 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.
In the embodiment, the probability score of each definition is calculated through the above probability score information, the below probability peak information and the probability parameter, so that the definition classification accuracy of the ambiguous word information in the current context is improved, and the word sense disambiguation accuracy is further improved.
In some optional implementations of this embodiment, step S20412 or step S20414, determining the definition of the ambiguous word information in the current context based on each defined probability score includes:
And sequencing each defined probability score according to a preset sequencing rule to obtain a score sequence.
And obtaining the maximum probability score from the score sequence, and taking the definition corresponding to the maximum probability score as the definition of the ambiguous word information in the current context.
In the embodiment, the accuracy of determining the definition classification of the ambiguous word information in the current context is improved according to the score, and the accuracy of word sense disambiguation is further improved.
It should be understood that the sequence number of each step in the foregoing embodiment does not mean that the execution sequence of each process should be determined by the function and the internal logic, and should not limit the implementation process of the embodiment of the present invention.
Fig. 3 shows a schematic block diagram of a word sense disambiguation device based on context semantics in one-to-one correspondence with the word sense disambiguation method based on context semantics of the above embodiment. As shown in fig. 3, the word sense disambiguation device based on context semantics includes a data acquisition module 30, a first training module 31, an associated information acquisition module 32, and a second training module 33. The functional modules are described in detail as follows:
the data acquisition module 30 is configured to acquire text data, and perform preprocessing on the text data to obtain data to be processed.
The first training module 31 is configured to input data to be processed into a pre-trained language model for training, so as to obtain the context information, the ambiguous word information and the context information, where the pre-trained language model is a self-coding language model or an autoregressive language model.
The text segment semantic information obtaining module 32 is configured to obtain text segment semantic information according to the context information, the ambiguous word information and the context information.
The second training module 33 is configured to input the text segment semantic information into a pre-trained classifier for training, and determine the definition of the ambiguous word information in the current context, where the pre-trained classifier is a Softmax linear classifier.
Optionally, the text segment semantic information acquisition module 32 includes:
and the first average value calculation module is used for carrying out average value calculation on the context information, the ambiguous word information and the context information to obtain text segment semantic information.
Optionally, the text segment semantic information acquisition module 32 includes:
and the second average value calculation module is used for carrying out average value calculation on the context information and the ambiguous word information to obtain the first semantic information.
And the third mean value calculation module is used for carrying out mean value calculation on the context information and the ambiguous word information to obtain second semantic information.
And the information determining module is used for taking the first semantic information and the second semantic information as text segment semantic information.
Optionally, the second training module 33 includes:
The probability prediction module is used for inputting text segment semantic information into a pre-trained classifier to perform probability prediction to obtain probability value information corresponding to the ambiguous word information; the pre-trained classifier is configured with a definition information base including at least one definition of ambiguous word information.
And the first definition determining module is used for determining the definition of the ambiguous word information in the current context according to the probability value information.
Optionally, the first definition determining module includes:
and the first information determining module is used for determining probability value information as each defined probability score corresponding to the ambiguous word information.
And the second definition determining module is used for determining the definition of the ambiguous word information in the current context according to the probability score of each definition.
Optionally, the definition determining module includes:
and the second information determining module is used for determining the probability value information to be the upper probability score information, the lower probability score information and the probability parameter.
And the probability score acquisition module is used for calculating and obtaining each defined probability score according to the above probability score information, the following probability peak value information and the probability parameter.
And a third definition determining module for determining the definition of the ambiguous word information in the current context according to each defined probability score.
Optionally, the second definition determining module and the third definition determining module include:
And the sorting module is used for sorting each defined probability score according to a preset sorting rule to obtain a score sequence.
And the fourth definition determining unit is used for acquiring the maximum probability score from the score sequence and taking the definition corresponding to the maximum probability score as the definition of the ambiguous word information in the current context.
For specific limitations on the context-based semantic word sense disambiguation means, reference may be made to the limitations of the context-based semantic word sense disambiguation method above, and will not be described in detail herein. The above-described respective modules in the context-semantic-based word sense disambiguation apparatus may be implemented in whole or in part by software, hardware, and combinations thereof. The above modules may be embedded in hardware or may be independent of a processor in the computer device, or may be stored in software in a memory in the computer device, so that the processor may call and execute operations corresponding to the above modules.
In order to solve the technical problems, the embodiment of the application also provides computer equipment. Referring specifically to fig. 4, fig. 4 is a basic structural block diagram of a computer device according to the present embodiment.
The computer device 4 comprises a memory 41, a processor 42, a network interface 43 communicatively connected to each other via a system bus. It is noted that only a computer device 4 having a component connection memory 41, a processor 42, a network interface 43 is shown in the figures, but it is understood that not all of the illustrated components are required to be implemented and that more or fewer components may be implemented instead. It will be appreciated by those skilled in the art that the computer device herein is a device capable of automatically performing numerical calculation and/or information processing according to a preset or stored instruction, and its hardware includes, but is not limited to, a microprocessor, an Application SPECIFIC INTEGRATED Circuit (ASIC), a Programmable gate array (Field-Programmable GATE ARRAY, FPGA), a digital Processor (DIGITAL SIGNAL Processor, DSP), an embedded device, and the like.
The computer equipment can be a desktop computer, a notebook computer, a palm computer, a cloud server and other computing equipment. The computer equipment can perform man-machine interaction with a user through a keyboard, a mouse, a remote controller, a touch pad or voice control equipment and the like.
The memory 41 includes at least one type of readable storage medium including flash memory, a hard disk, a multimedia card, a card type memory (e.g., SD or D interface display memory, etc.), a Random Access Memory (RAM), a Static Random Access Memory (SRAM), a read-only memory (ROM), an electrically erasable programmable read-only memory (EEPROM), a programmable read-only memory (PROM), a magnetic memory, a magnetic disk, an optical disk, etc. In some embodiments, the storage 41 may be an internal storage unit of the computer device 4, such as a hard disk or a memory of the computer device 4. In other embodiments, the memory 41 may 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 (SD) card, a flash memory card (FLASH CARD) or the like, which are provided on the computer device 4. Of course, the memory 41 may also comprise both an internal memory unit of the computer device 4 and an external memory device. In this embodiment, the memory 41 is typically used for storing an operating system and various application software installed on the computer device 4, such as program codes for controlling electronic files, etc. Further, the memory 41 may be used to temporarily store various types of data that have been output or are to be output.
The processor 42 may be a central processing unit (Central Processing Unit, CPU), controller, microcontroller, microprocessor, or other data processing chip in some embodiments. The processor 42 is typically used to control the overall operation of the computer device 4. In this embodiment, the processor 42 is configured to execute a program code stored in the memory 41 or process data, such as a program code for executing control of an electronic file.
The network interface 43 may comprise a wireless network interface or a wired network interface, which network interface 43 is typically used for establishing a communication connection between the computer device 4 and other electronic devices.
The present application also provides another embodiment, namely, a computer-readable storage medium storing an interface display program executable by at least one processor to cause the at least one processor to perform the steps of the word sense disambiguation method based on context semantics as described above.
From the above description of the embodiments, it will be clear to those skilled in the art that the above-described embodiment method may be implemented by means of software plus a necessary general hardware platform, but of course may also be implemented by means of hardware, but in many cases the former is a preferred embodiment. Based on such understanding, the technical solution of the present application may be embodied essentially or in a part contributing to the prior art in the form of a software product stored in a storage medium (e.g. ROM/RAM, magnetic disk, optical disk) comprising instructions for causing a terminal device (which may be a mobile phone, a computer, a server, an air conditioner, or a network device, etc.) to perform the method according to the embodiments of the present application.
It is apparent that the above-described embodiments are only some embodiments of the present application, but not all embodiments, and the preferred embodiments of the present application are shown in the drawings, which do not limit the scope of the patent claims. This application may be embodied in many different forms, but rather, embodiments are provided in order to provide a thorough and complete understanding of the present disclosure. Although the application has been described in detail with reference to the foregoing embodiments, it will be apparent to those skilled in the art that modifications may be made to the embodiments described in the foregoing description, or equivalents may be substituted for elements thereof. All equivalent structures made by the content of the specification and the drawings of the application are directly or indirectly applied to other related technical fields, and are also within the scope of the application.
Claims (6)
1. The word sense disambiguation method based on the context semantics is characterized by comprising the following steps of:
acquiring 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 to obtain the context information, the ambiguous word information and the context information, wherein the pre-trained language model is a self-coding language model or an autoregressive language model;
obtaining text segment semantic information according to the context information, the ambiguous word information and the context information;
Inputting the text segment semantic information into a pre-trained classifier for training, and determining 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 base, the definition information base comprises 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 comprises:
Inputting the text segment semantic information 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;
The determining, according to the probability value information, the definition of the ambiguous word information in the current context includes:
the probability value information is a 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 definition;
The determining, according to the probability value information, the definition of the ambiguous word information in the current context includes:
the probability value information is the context probability score information, the context probability score information and the probability parameter,
Calculating each defined probability score according to the above probability score information, the below probability score information and the probability parameters,
Determining the definition of the ambiguous word information in the current context according to the probability score of each definition;
The determining of the definition of the ambiguous word information in the current context based on each of the defined probability scores comprises:
Ordering each defined probability score according to a preset ordering rule to obtain a score sequence,
And acquiring the maximum probability score from the score sequence, and taking the definition corresponding to the maximum probability score as the definition of the ambiguous word information in the current context.
2. The method of context semantic based word sense disambiguation of claim 1, wherein said deriving text segment semantic information from said context information, said ambiguous word information, and said context information comprises:
and carrying out mean value calculation on the context information, the ambiguous word information and the context information to obtain text segment semantic information.
3. The method of context semantic based word sense disambiguation of claim 1, wherein said deriving text segment semantic information from said context information, said ambiguous word information, and said context information comprises:
Performing mean value calculation on the context information and the ambiguous word information to obtain first semantic information;
performing mean value calculation on the context information and the ambiguous word information to obtain second semantic information;
and taking the first semantic information and the second semantic information as the text segment semantic information.
4. A word sense disambiguation apparatus based on context semantics, which uses the word sense disambiguation method based on context semantics as claimed in claim 1, comprising:
The data acquisition module is used for acquiring text data and preprocessing the text data to obtain data to be processed;
The first training module is used for inputting the data to be processed into a pre-trained language model for training to obtain the context information, the ambiguous word information and the context information, wherein the pre-trained language model is an autorecoding language model or an autoregressive language model;
The text segment semantic information acquisition module is used for acquiring text segment semantic information according to the context information, the ambiguous word information and the context information;
And the second training module is used for 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, wherein 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 the processor implements the context-semantic-based word sense disambiguation method according to any of claims 1 to 3 when the computer program is executed by the processor.
6. A computer readable storage medium storing a computer program, wherein the computer program when executed by a processor implements the context semantic based word sense disambiguation method of any of claims 1 to 3.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202111354317.1A CN113901836B (en) | 2021-11-16 | 2021-11-16 | Word sense disambiguation method and device based on context semantics and related equipment |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202111354317.1A CN113901836B (en) | 2021-11-16 | 2021-11-16 | Word sense disambiguation method and device based on context semantics and related equipment |
Publications (2)
Publication Number | Publication Date |
---|---|
CN113901836A CN113901836A (en) | 2022-01-07 |
CN113901836B true CN113901836B (en) | 2024-09-17 |
Family
ID=79194488
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202111354317.1A Active CN113901836B (en) | 2021-11-16 | 2021-11-16 | Word sense disambiguation method and device based on context semantics and related equipment |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN113901836B (en) |
Families Citing this family (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN114818736B (en) * | 2022-05-31 | 2023-06-09 | 北京百度网讯科技有限公司 | Text processing method, chain finger method and device for short text and storage medium |
CN117725204A (en) * | 2022-09-07 | 2024-03-19 | 马上消费金融股份有限公司 | Method and device for disambiguating dialogue intention |
CN117892735B (en) * | 2024-03-14 | 2024-07-02 | 中电科大数据研究院有限公司 | Deep learning-based natural language processing method and system |
Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US6405162B1 (en) * | 1999-09-23 | 2002-06-11 | Xerox Corporation | Type-based selection of rules for semantically disambiguating words |
CN113065002A (en) * | 2021-04-19 | 2021-07-02 | 北京理工大学 | Chinese semantic disambiguation method based on knowledge graph and context |
Family Cites Families (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN109726385A (en) * | 2017-10-31 | 2019-05-07 | 株式会社Ntt都科摩 | Word sense disambiguation method and equipment, meaning of a word extended method and device |
-
2021
- 2021-11-16 CN CN202111354317.1A patent/CN113901836B/en active Active
Patent Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US6405162B1 (en) * | 1999-09-23 | 2002-06-11 | Xerox Corporation | Type-based selection of rules for semantically disambiguating words |
CN113065002A (en) * | 2021-04-19 | 2021-07-02 | 北京理工大学 | Chinese semantic disambiguation method based on knowledge graph and context |
Also Published As
Publication number | Publication date |
---|---|
CN113901836A (en) | 2022-01-07 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN112101041B (en) | Entity relationship extraction method, device, equipment and medium based on semantic similarity | |
CN112685565A (en) | Text classification method based on multi-mode information fusion and related equipment thereof | |
CN113901836B (en) | Word sense disambiguation method and device based on context semantics and related equipment | |
CN111767375A (en) | Semantic recall method and device, computer equipment and storage medium | |
US11036996B2 (en) | Method and apparatus for determining (raw) video materials for news | |
CN112084752B (en) | Sentence marking method, device, equipment and storage medium based on natural language | |
CN115438149A (en) | End-to-end model training method and device, computer equipment and storage medium | |
CN113887237A (en) | Slot position prediction method and device for multi-intention text and computer equipment | |
CN113360660A (en) | Text type identification method and device, electronic equipment and storage medium | |
CN114817478A (en) | Text-based question and answer method and device, computer equipment and storage medium | |
CN117725960B (en) | Knowledge distillation-based language model training method, text classification method and equipment | |
CN113505595A (en) | Text phrase extraction method and device, computer equipment and storage medium | |
CN115495541B (en) | Corpus database, corpus database maintenance method, apparatus, device and medium | |
CN112182157A (en) | Training method of online sequence labeling model, online labeling method and related equipment | |
CN115730237B (en) | Junk mail detection method, device, computer equipment and storage medium | |
CN114742058B (en) | Named entity extraction method, named entity extraction device, computer equipment and storage medium | |
CN115169370B (en) | Corpus data enhancement method and device, computer equipment and medium | |
CN114492456B (en) | Text generation method, model training method, device, electronic equipment and medium | |
CN114218356B (en) | Semantic recognition method, device, equipment and storage medium based on artificial intelligence | |
CN113627197B (en) | Text intention recognition method, device, equipment and storage medium | |
CN112364649B (en) | Named entity identification method and device, computer equipment and storage medium | |
CN115062136A (en) | Event disambiguation method based on graph neural network and related equipment thereof | |
CN113515931A (en) | Text error correction method and device, computer equipment and storage medium | |
CN114925202B (en) | Text classification method, device, computer equipment and storage medium | |
CN113987115B (en) | Text similarity calculation method, device, equipment and storage medium |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |