Natural language processing methods, natural language processing devices and electronic equipment

By processing user input information through natural language understanding technology and combining multiple dictionaries for querying, the problems of inaccurate intent recognition and incomplete results in existing technologies are solved, resulting in more accurate and comprehensive natural language query results and improving user experience.

CN116049355BActive Publication Date: 2025-11-14SHANGHAI MOBVOI INFORMATION TECH CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202310081827.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-01-17
Publication Date
2025-11-14
Estimated Expiration
2043-01-17

AI Technical Summary

Technical Problem

Existing technologies perform queries based on pre-defined rules, which cannot accurately identify user intent. This results in query results that do not match the user's intent and are not comprehensive enough, leading to a poor user experience.

Method used

The system processes user input using Natural Language Understanding (NLU) technology to determine intent information and selects from candidate dictionaries such as a basic dictionary, a reverse dictionary, a related dictionary, a classical Chinese dictionary, and a dictionary of proverbs for querying. The appropriate dictionary is selected based on the intent category to determine the natural language query results.

Benefits of technology

It improves the coverage of natural language query results and their relevance to user intent, thereby enhancing the user experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116049355B_ABST
    Figure CN116049355B_ABST
Patent Text Reader

Abstract

This invention discloses a natural language processing method, a natural language processing device, and an electronic device. By performing natural language understanding processing on user input query information to determine intent information, one or more target dictionaries are determined from a candidate dictionary based on the intent information. Finally, one or more target dictionaries are queried based on the input query information to determine the natural language query result. Therefore, one or more target dictionaries can be associated and queried based on the intent information corresponding to the input query information to determine the natural language query result matching the user's intent. This achieves efficient natural language querying, improves the coverage of natural language query results, and enhances the user experience.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of natural language processing technology, and in particular to a natural language processing method, a natural language processing device, and an electronic device. Background Technology

[0002] People encounter unfamiliar knowledge every day in their lives, studies, and work. To resolve this confusion, they usually consult electronic devices with dictionary functions. These devices can quickly provide users with the necessary information based on their input, thus resolving their confusion.

[0003] In existing technologies, queries are performed by pre-setting rules. Specifically, the user's input query information is first categorized, and corresponding rules are abstracted for each category, then a fixed dictionary is consulted. For example, if the user inputs a query term, the electronic device queries the basic dictionary and returns the meaning of the query term. As another example, if the user inputs a word's meaning description, the electronic device queries a reverse dictionary and returns the word corresponding to the meaning description.

[0004] On the one hand, existing technologies, which rely on pre-defined rules for querying, have significant limitations and cannot accurately identify user intent, resulting in inaccurate or mismatched query results. On the other hand, because existing technologies query fixed dictionaries based on pre-defined rules, the query results are not comprehensive enough to fully cover the knowledge information required by the user, leading to a poor user experience. Summary of the Invention

[0005] In view of this, the purpose of this invention is to provide a natural language processing method, a natural language processing device, and an electronic device that can associate one or more target dictionaries based on input query information to determine natural language query results that match the user's intent, thereby improving the coverage of natural language query results and enhancing the user experience while achieving efficient natural language querying.

[0006] In a first aspect, embodiments of the present invention provide a natural language processing method, the method comprising:

[0007] Natural language understanding is used to process the user's input query information to determine intent information;

[0008] Based on the intent information, at least one target dictionary is determined from the candidate dictionaries; and

[0009] Based on the input query information, at least one of the target dictionaries is queried to determine the corresponding natural language query results;

[0010] The candidate dictionaries include one or more of the following: basic dictionary, reverse dictionary, related dictionary, classical Chinese dictionary, and proverb dictionary.

[0011] In some embodiments, the step of performing natural language understanding processing based on user input query information to determine intent information includes:

[0012] The intent information and query terms are determined based on the input query information through rule matching.

[0013] The step of querying at least one of the target dictionaries based on the input query information to determine the corresponding natural language query result includes:

[0014] Based on the query terms, at least one of the target dictionaries is queried to determine the corresponding natural language query results.

[0015] In some embodiments, determining at least one target dictionary from the candidate dictionaries based on the intent information includes:

[0016] Determine the intent category corresponding to the intent information; and

[0017] At least one target dictionary is determined from the candidate dictionaries based on the intent category.

[0018] In some embodiments, querying at least one of the target dictionaries based on the query terms to determine the corresponding natural language query results includes:

[0019] In response to the intent information being a first intent category, the query term is input into the basic dictionary and the associated dictionary to determine the natural language query result, where the first intent category represents the word meaning query;

[0020] The target dictionary includes the basic dictionary and the associated dictionary.

[0021] In some embodiments, querying at least one of the target dictionaries based on the query terms to determine the corresponding natural language query results includes:

[0022] In response to the intent information being a second intent category, the query term is input into a pre-trained language model in the reverse dictionary to obtain a word embedding vector, where the second intent category represents the word query and the input query information represents the query term.

[0023] Similarity is determined based on the word embedding vectors;

[0024] The confidence level is determined based on the similarity.

[0025] Target words are determined based on the confidence level; and

[0026] The target words are identified as the natural language query results;

[0027] The target dictionary includes the reverse dictionary.

[0028] In some embodiments, querying at least one of the target dictionaries based on the input query information to determine the corresponding natural language query result includes:

[0029] In response to the intent information being a second intent category, the input query information is input into a pre-trained language model in the reverse dictionary to obtain character vectors, word embedding vectors, and sentence embedding vectors. The second intent category represents a word query, and the input query information represents a query word meaning description.

[0030] Similarity, part-of-speech information, word category information, morpheme information, and semantic information are determined based on the character vectors, word embedding vectors, and sentence embedding vectors.

[0031] The target word is determined by calculating the similarity, part-of-speech information, word category information, morpheme information, and semantic information using preset weights; and

[0032] The target words are identified as the natural language query results;

[0033] The target dictionary includes the reverse dictionary.

[0034] In some embodiments, querying the target dictionary based on the query term to determine the corresponding natural language query result includes:

[0035] In response to the intent information being a third intent category, the association dictionary is queried based on the query term to determine related terms, where the third intent category represents the related term query; and

[0036] The associated words are identified as the natural language query results;

[0037] The target dictionary includes the associated dictionary, and the associated words include one or more of the following: related words, synonyms, near-synonyms, and antonyms.

[0038] In some embodiments, querying the target dictionary based on the input query information to determine the corresponding natural language query result includes:

[0039] In response to the intent information being a fourth intent category, the system queries a preset ancient Chinese database in the ancient Chinese dictionary based on the input query information to determine the natural language query result. The fourth intent category represents an ancient Chinese query, and the target dictionary includes the ancient Chinese dictionary; or

[0040] In response to the intent information being a fifth intent category, the matching degree is determined by querying the preset proverb database in the proverb dictionary based on the input query information. The fifth intent category represents a proverb query, and the target dictionary includes the proverb dictionary.

[0041] The target proverb information is determined based on the matching degree; and

[0042] The target proverb information is identified as the natural language query result.

[0043] In a second aspect, embodiments of the present invention provide a natural language processing apparatus, the apparatus comprising:

[0044] The intent information determination unit is used to perform natural language understanding processing based on the user's input query information to determine intent information;

[0045] The target dictionary determination unit is used to determine at least one target dictionary from the candidate dictionaries based on the intent information;

[0046] The natural language query result determination unit is used to query at least one of the target dictionaries based on the input query information to determine the corresponding natural language query result;

[0047] The candidate dictionaries include one or more of the following: basic dictionary, reverse dictionary, related dictionary, classical Chinese dictionary, and proverb dictionary.

[0048] Thirdly, embodiments of the present invention provide an electronic device, the electronic device comprising:

[0049] A memory and a processor, the memory being used to store one or more computer program instructions, wherein the one or more computer program instructions are executed by the processor to implement the method as described in the first aspect.

[0050] This invention employs natural language understanding processing on user input query information to determine intent information. Based on this intent information, one or more target dictionaries are then selected from candidate dictionaries. Finally, the input query information is used to query one or more target dictionaries to determine the natural language query result. Therefore, one or more target dictionaries can be associated and queried based on the intent information corresponding to the input query information to determine natural language query results matching the user's intent. This achieves efficient natural language querying, improves the coverage of natural language query results, and enhances the user experience. Attached Figure Description

[0051] The above and other objects, features and advantages of the present invention will become clearer from the following description of embodiments of the invention with reference to the accompanying drawings, in which:

[0052] Figure 1 This is a flowchart of a natural language processing method according to an embodiment of the present invention;

[0053] Figure 2 This is a flowchart illustrating how an embodiment of the present invention determines at least one target dictionary from candidate dictionaries based on intent information;

[0054] Figure 3 This is a flowchart in an embodiment of the present invention that queries at least one target dictionary based on query terms to determine the corresponding natural language query results;

[0055] Figure 4 This is a flowchart in an embodiment of the present invention that queries at least one target dictionary based on the semantic description of the query term to determine the corresponding natural language query result;

[0056] Figure 5 This is a schematic diagram of the reverse dictionary model in an embodiment of the present invention;

[0057] Figure 6 This is a flowchart in an embodiment of the present invention that queries at least one target dictionary based on query terms to determine the corresponding natural language query results;

[0058] Figure 7 This is a flowchart in an embodiment of the present invention that queries at least one target dictionary based on the input query information to determine the corresponding natural language query result;

[0059] Figure 8 This is a schematic diagram of a natural language processing device according to an embodiment of the present invention;

[0060] Figure 9 This is a schematic diagram of an electronic device according to an embodiment of the present invention. Detailed Implementation

[0061] The present invention is described below based on embodiments, but the invention is not limited to these embodiments. In the detailed description of the invention below, certain specific details are described in detail. Those skilled in the art will fully understand the invention even without these details. To avoid obscuring the essence of the invention, well-known methods, processes, flows, elements, and circuits are not described in detail.

[0062] Furthermore, those skilled in the art should understand that the accompanying drawings provided herein are for illustrative purposes only and are not necessarily drawn to scale.

[0063] Unless the context explicitly requires it, words such as "including" or "contains" in the instruction manual should be interpreted as including rather than exclusive or exhaustive; that is, meaning "including but not limited to".

[0064] In the description of this invention, it should be understood that the terms "first," "second," etc., are configured for descriptive purposes only and should not be construed as indicating or implying relative importance. Furthermore, in the description of this invention, unless otherwise stated, "a plurality of" means two or more.

[0065] In the following description, the application of natural language processing methods in electronic devices is used as an example. These electronic devices include terminal devices (mobile phones, computers, etc.). It should be understood that the natural language processing methods of this embodiment can also be applied to various scenarios that require natural language processing, such as word query systems on cloud servers.

[0066] Figure 1 This is a flowchart of a natural language processing method according to an embodiment of the present invention. Figure 1 As shown, the natural language processing process in this embodiment includes the following steps:

[0067] Step S100: Perform natural language understanding processing on the user's input query information to determine intent information.

[0068] In this embodiment, existing technologies, which rely on pre-defined rules for querying, have significant limitations and cannot accurately identify user intent, leading to inaccurate or mismatched query results. To address this, this embodiment incorporates an NLU (Natural Language Understanding) unit in the terminal. This NLU unit uses NLU technology to process the user's input query information using natural language processing to determine the user's intent. NLU technology enables electronic devices to understand human language information, extract information from it, and then send this information to other applications or systems to fulfill the user's intent (e.g., querying a dictionary). The NLU unit implements a predetermined function and can be a general-purpose hardware interface or a program written according to the natural language processing procedure. In the following description, an example is given of an NLU unit written according to the natural language processing procedure described below.

[0069] Optionally, the user can input query information as text input.

[0070] In one alternative implementation, the electronic device may be equipped with a display and an input component, which may be input buttons. The user can then input text information using the input buttons.

[0071] In another alternative implementation, the electronic device may be equipped with a touchscreen. The user can then input text information by touching the screen.

[0072] Optionally, the user's input query information can also be audio input information. In this case, the electronic device can first perform ASR (Automatic Speech Recognition) processing on the audio input information to obtain the corresponding text input information. In the following description, we will use audio input information as an example.

[0073] In this embodiment, to accurately identify user intent and match natural language query results with user intent, the NLU unit determines intent information and slots based on the text input information corresponding to the user's input query information through rule matching. Intent information represents the actual or potential needs of the user identified by the electronic device. Slots are parameters related to the intent information. Any intent information can correspond to one or more slots, and the slots can include one or more query words, sentences, parts of speech, etc. For example, if the user's audio input information is "words to describe someone as beautiful," then the intent information can be determined as "word query" through rule matching, and the slots include the query word "beautiful," the part of speech "adjective," and other necessary parameters.

[0074] In one alternative implementation, intent information and slots can be determined using a parsing algorithm (PA) rule matching method based on CFG (Context-Free Grammar). Specifically, firstly, the general form of the CFG grammar is converted into a CNF (Chomsky Normal Form) grammar based on the user's input query information. Then, the CYK (Cockney-Younger Kasami Algorithm) algorithm is used to perform bottom-up parsing on the converted CNF grammar. The CYK algorithm then uses dynamic programming to reduce the input word step-by-step to the initial state according to the rule-based grammar recursion, ultimately completing the parsing. After parsing, a parsing tree can be generated based on the parsing path. Features can then be extracted from the parsing tree to obtain the user's intent information and slots.

[0075] In another alternative implementation, intent information and slots can be determined through rule matching based on FST (Finite State Transducer). FST is an extension of FSA (Finite State Acceptor), a highly efficient data structure. Since natural language processing requires modifying the text input corresponding to the user's query information according to predetermined rules (e.g., modifying a character in a string), and FST obtains an input / output label pair at each state transition, FST can describe the transformation of a set of rules or the transformation of a sequence of symbols into another set of sequences of symbols through these input / output label pairs. In other words, several rules can be integrated into a single large rule based on predetermined rules, effectively improving the processing efficiency of user input query information. Specifically, the user's query information is first preprocessed based on FST to remove useless format characters during rule matching (e.g., removing spaces, punctuation marks, etc. from the input query information). Then, FST performs rule matching on the preprocessed input query information using a preset FST intent slot model. During state transitions, the preset FST intent slot model can insert preset intent annotation information and / or preset slot annotation information into the preprocessed input query information. The preset intent annotation information is used to annotate the intent information of the input query information, and the preset slot annotation information is used to annotate the slots in the input query information. Thus, the user's intent information and slots can be obtained.

[0076] Step S200: Determine at least one target dictionary from the candidate dictionaries based on the intent information.

[0077] In this embodiment, step S200 includes steps S201 and S202. Specifically, refer to... Figure 2 .

[0078] Figure 2 This is a flowchart illustrating how an embodiment of the present invention determines at least one target dictionary from candidate dictionaries based on intent information. (The remaining text appears to be incomplete and requires further context.) Figure 2 As shown, the process of determining at least one target dictionary from candidate dictionaries based on intent information in this embodiment includes the following steps:

[0079] Step S201: Determine the intent category corresponding to the intent information.

[0080] In this embodiment, the NLU unit can pre-classify according to the user's intent to determine the intent category corresponding to the intent information.

[0081] In an optional implementation, the NLU unit can pre-classify the intent information by performing SOC (Spoken Utterance Classification) processing based on the user's intent.

[0082] In another alternative implementation, the NLU unit can classify intent based on user intent using a pre-trained language model, such as the BERT model (Bidirectional Encoder Representations from Transformer), and thus determine the intent category corresponding to the intent information.

[0083] Optionally, the NLU unit can perform slot filling while determining the intent category corresponding to the intent information, thereby determining the slot parameters. Taking semantic slot filling as an example, the NLU unit can extract the values ​​of predefined semantic slots from the input query information based on a semantic frame (SF) of a specific domain or intent. This transforms the semantic slot filling task into a sequence labeling task. Using the IOB tagging method, a word is labeled as the beginning (begin), inside (continue), or outside (non-semantic slot) of a semantic slot.

[0084] In this embodiment, the intent categories include a first intent category, a second intent category, a third intent category, a fourth intent category, and a fifth intent category. The first intent category represents a semantic query. The second intent category represents a word query. The third intent category represents a related word query. The fourth intent category represents a classical Chinese query. The fifth intent category represents a proverb / idiom query.

[0085] Step S202: Determine at least one target dictionary from the candidate dictionaries based on the intent category.

[0086] In this embodiment, existing technologies, by querying fixed dictionaries according to pre-set rules, result in incomplete query results, failing to fully cover the knowledge information required by the user and leading to a poor user experience. To address this, this embodiment uses an NLU unit to determine one or more target dictionaries from candidate dictionaries based on the category of the intent information corresponding to the user's input query information. The candidate dictionaries include one or more of the following: a basic dictionary, a reverse dictionary, a related dictionary, a classical Chinese dictionary, and a dictionary of proverbs. The basic dictionary is used for word meaning lookup, i.e., querying the meaning of a word based on its definition. The reverse dictionary is used for word lookup, i.e., querying words based on their meanings. The related dictionary is used for related word lookup, i.e., querying related words based on their search terms. The classical Chinese dictionary is used for classical Chinese text lookup. The proverb dictionary is used for proverb lookup.

[0087] In an optional embodiment, the candidate dictionary, including the base dictionary, reverse dictionary, related dictionary, classical Chinese dictionary, and proverb dictionary, can be a custom dictionary, i.e., an application program written based on the user's input query information and corresponding intent information. Furthermore, any dictionary in the candidate dictionary can invoke other dictionaries for auxiliary queries via invocation commands, such as API Actions (Application Program Interface Actions). Thus, the NLU unit can associate one or more target dictionaries for querying based on user intent to determine natural language query results matching the user's intent, improving the coverage of natural language query results while achieving efficient natural language querying and enhancing the user experience.

[0088] In another optional embodiment, the NLU unit can obtain the candidate dictionary from a cloud server via a network. Furthermore, the NLU unit can expand the candidate dictionary data based on the query words and sentences corresponding to the slots determined by the user's input query information.

[0089] In this embodiment, the intent categories include semantic search, word search, related word search, classical Chinese search, and proverb search, as examples for illustration. However, this embodiment of the invention does not limit the intent categories. For example, intent categories may also include translation search, where the translation search represents the translation of the input query information into a predetermined language type. Correspondingly, this embodiment of the invention also does not limit the candidate dictionary, which may include Chinese-English dictionaries, etc.

[0090] Step S300: Query at least one of the target dictionaries based on the input query information to determine the corresponding natural language query results.

[0091] In this embodiment, the NLU unit queries at least one target dictionary based on the query words and sentences corresponding to the slots determined by the user's input query information, and identifies the information in the database corresponding to each target dictionary that matches the slot as the natural language query result. Furthermore, the natural language query results can be displayed to the user through pop-ups, prompts, or other means.

[0092] In this embodiment, if the intent category of the intent information corresponding to the user's input query information is the first intent category, that is, word meaning query, the target dictionaries can be the basic dictionary and the associated dictionary. Specifically, the NLU unit can input one or more query words corresponding to the slot into the basic dictionary and the associated dictionary to determine the word meanings and associated words corresponding to the one or more query words. Then the NLU unit determines the word meanings and associated words corresponding to the one or more query words as the natural language query result. Among them, the associated words corresponding to the query words include related words, synonyms, antonyms, etc. For example, if the user's input query information is "What does beautiful mean", the NLU unit determines the intent information as "word meaning query" according to the user's input query information, and the slot is the query word "beautiful". Since the intent information belongs to the first intent category, the NLU unit determines the target dictionaries as the basic dictionary and the associated dictionary among multiple candidate dictionaries. Furthermore, the NLU unit inputs the query word "beautiful" into the basic dictionary and the associated dictionary to determine the natural language query result as "Beautiful means approaching perfection or an ideal state in appearance, proportion, layout, demeanor, color or sound, making people's various senses extremely pleasant. The synonyms of beautiful are elegant and pretty, the antonym is ugly, the related word is extremely beautiful, and the synonym is handsome and glamorous". Thus, the associated words of the query word can be determined while querying the word meaning, so that while determining the natural language query result matching the user's intent, the coverage range of the natural language query result is increased to improve the user experience.

[0093] Optionally, during the process of word meaning query, the NLU unit can also query the classical Chinese dictionary and the Chinese allegorical saying dictionary according to the query word to determine the classical Chinese source information and the Chinese allegorical saying information related to the query word. Furthermore, the NLU unit determines the word meanings, associated words, classical Chinese source information, and Chinese allegorical saying information corresponding to the query word as the natural language query result. At this time, the target dictionaries can be the basic dictionary, the associated dictionary, the classical Chinese dictionary, and the Chinese allegorical saying dictionary. For example, if the user's input query information is "What does beautiful mean". Then the NLU unit inputs the query word "beautiful" into the basic dictionary, the associated dictionary, the classical Chinese dictionary, and the Chinese allegorical saying dictionary to determine the natural language query result as "Beautiful means approaching perfection or an ideal state in appearance, proportion, layout, demeanor, color or sound, making people's various senses extremely pleasant. The synonyms of beautiful are elegant and pretty, the antonym is ugly, the related word is extremely beautiful, and the synonym is handsome and glamorous". "Beautiful" comes from the classical Chinese "Xunzi·Feixiang" which says "Nowadays, the chaotic rulers in the secular world and the glib youths in the countryside are all beautiful, charming, wearing strange clothes and women's ornaments, and their temperament and attitude are similar to those of women". The Chinese allegorical saying information is wearing a skirt on a snowy day - beautiful and moving (frozen). Thus, the coverage range of the natural language query result can be further increased to improve the user experience.

[0094] Optionally, the NLU unit can retrieve dictionaries related to the basic dictionary from a cloud server via a network, and update and expand the basic dictionary data based on user input query information. For example, it can determine high-frequency query words based on user input query information, retrieve trending new words from the cloud server via the network, and store the high-frequency query words and trending new words in the database corresponding to the basic dictionary. Simultaneously, it can store the related words corresponding to the high-frequency query words and trending new words in the database corresponding to the related dictionary. This can improve query efficiency and speed.

[0095] In this embodiment, if the intent category of the user's input query information corresponds to the second intent category, i.e., a word query, then the target dictionary can be a reverse dictionary. Specifically, the reverse dictionary can determine whether the input query information represents a query word or a query word meaning description based on the number of characters in the input query information. Specifically, if the number of characters in the input query information is greater than a threshold, then the input query information is determined to represent a query word meaning description, i.e., a description of the meaning of the query word. If the number of characters in the input query information is less than or equal to the threshold, then the input query information is determined to represent a query word. The threshold can be set by the user according to their needs or can be automatically set by the electronic device.

[0096] In an optional implementation, if the intent category of the user's input query information corresponds to the second intent category, and the input query information represents a query term, then step S300 includes steps S301-S305, which can be referred to. Figure 3 .

[0097] Figure 3 This is a flowchart illustrating how, in an embodiment of the present invention, at least one target dictionary is queried based on the query term to determine the corresponding natural language query result. For example... Figure 3 As shown, the process of querying at least one target dictionary based on the query term to determine the corresponding natural language query result in this embodiment includes the following steps:

[0098] Step S301: Input the query terms into the pre-trained language model in the reverse dictionary to obtain word embedding vectors.

[0099] In this embodiment, the pre-trained language model in the reverse dictionary can be a BERT model. The BERT model can be a model based on a bidirectional LSTM architecture and attention mechanism, pre-trained using unlabeled training data. Before applying it to a specific processing task, it is fine-tuned with a small amount of training data tailored to the specific task, thus acquiring the ability to handle the task. Therefore, the BERT model has high versatility and task processing efficiency, making it suitable for the NLP (Natural Language Processing) field. Further, the BERT model can include token embeddings (TE), segment embeddings (SE), and position embeddings (PE). The token embedding layer converts the input query terms into fixed-dimensional vectors. The segment embedding layer classifies the input sentence pairs. The position embedding layer encodes the vectors sequentially. Thus, the BERT model can use the token embedding layer to query the word vector table and convert each character in the query term into a fixed-dimensional vector to obtain the word embedding vector. The word embedding vector is also known as the Word Embedding vector.

[0100] Optionally, language models can also include ERNIE (Enhanced Representation from Knowledge Integration), XLM (Cross-linguistic Language Model), and MASS (Masked Sequence to Sequence Pre-training). ERNIE models are pre-trained using a large amount of training data (e.g., words corresponding to various query terms). Therefore, ERNIE models can achieve good training results with small training sets. XLM models are trained through multilingual training tasks. Compared to BERT models, XLM models incorporate two pre-training methods: CLM (Causal Language Modeling) and TLM (Translational Language Modeling). Therefore, XLM models have more parameters and a larger query vocabulary. Similar to the BERT model, the MASS model replaces subsequent text following the input text with a mask token. This mask token, along with a word token formed by the query term in the input text, is then input into the MASS model as a sequence. The MASS model outputs predictions of the mask tokens, which are then used to determine subsequent text. Furthermore, the language model can be a combination of the BERT model and one or more of the aforementioned models. Thus, word embedding vectors can be determined based on the user's input query information.

[0101] Step S302: Determine the similarity based on the word embedding vector.

[0102] In this embodiment, the Word Embedded vector of the query term allows words with similar distances to have similar meanings. Therefore, the similarity between each candidate word and the query term can be calculated based on the Word Embedded vector of the query term and the candidate words in the reverse dictionary. For example, the distance between `embedded` (pretty) and `embedded` (beautiful) is very close, indicating high similarity. The distance between `embedded` (pretty) and `embedded` (ugly) is very far, indicating low similarity.

[0103] Step S303: Determine the confidence level based on the similarity.

[0104] In this embodiment, the confidence level (i.e., the confidence score) is determined based on the similarity between the Word Embedded vector of the query term and each candidate term. The higher the confidence level, the better the match between the candidate term and the query term.

[0105] Optionally, the query term can be input into an associated dictionary to determine the synonyms corresponding to the query term, and the confidence score of the corresponding candidate words can be doubled based on the synonyms.

[0106] Step S304: Determine the target words based on the confidence level.

[0107] In this embodiment, candidate words are ranked according to their confidence level to determine the target word.

[0108] In one alternative implementation, the candidate word with the highest confidence level is identified as the target word.

[0109] In another alternative implementation, candidate words with a confidence level higher than a predetermined value are identified as target words. The predetermined value can be set by the user or automatically by the electronic device.

[0110] Step S305: Determine the target words as natural language query results.

[0111] In this embodiment, one or more candidate words included in the target word are identified as natural language query results and displayed to the user.

[0112] In another optional implementation, if the intent category of the user's input query information corresponds to the second intent category, and the input query information represents a query semantic description, then step S300 includes steps S311-S314, which can be referred to... Figure 4 .

[0113] Figure 4 This is a flowchart illustrating how, in an embodiment of the present invention, at least one target dictionary is queried based on the semantic description of the query term to determine the corresponding natural language query result. For example... Figure 4 As shown, the process of querying at least one target dictionary based on the semantic description of the query term to determine the corresponding natural language query result in this embodiment includes the following steps:

[0114] Step S311: Input the input query information into the pre-trained language model in the reverse dictionary to obtain character vectors, word embedding vectors, and sentence embedding vectors.

[0115] In this embodiment, the reverse dictionary model can refer to Figure 5 .

[0116] Figure 5 This is a schematic diagram of the reverse dictionary model in an embodiment of the present invention. For example... Figure 5As shown, the input query information (i.e., the query word meaning description) is input into the BERT model in the inverse dictionary to obtain word vectors, word embedding vectors, and sentence embedding vectors (i.e., sentence embedding vectors).

[0117] Step S312: Determine similarity, part-of-speech information, word category information, morpheme information, and semantic information based on character vectors, word embedding vectors, and sentence embedding vectors.

[0118] In this embodiment, similarity (i.e., word prediction score) can be determined based on the Word Embedded vector. The specific implementation method is the same as... Figure 3 The embodiments shown are similar, and the present invention will not be described in detail here.

[0119] In this embodiment, the bidirectional LSTM architecture of the BERT model includes an internal channel and an external channel. The internal channel is used to predict the part-of-speech (Pos) and morpheme (Mor) of the target word, and to predict the word category (Cat) and semantic feature (Sem) of the target word. The word category can be obtained through WordNet or a thesaurus, and the semantic features can be obtained through HowNet.

[0120] In this embodiment, one or more query words or sentences corresponding to the slots determined by the input query information (i.e., query semantic description) can be input into the BERT model. The BERT model uses a labeled embedding layer to query the word vector table to determine the word vector of each character. Then, based on the word vectors, lexical information (i.e., global lexical prediction score) and semantic information (i.e., global semantic prediction score) are determined. A word represents the smallest linguistic unit that can be used independently in a language. A lexical (or morpheme) is a unit one level below a word, a component that constitutes a word, representing the smallest semantic unit in a language. For example, the word "highway" corresponds to the lexicals "high," "speed," and "highway." A semantic element (i.e., semantic primitive, semantic component) represents a semantic unit in a language, including semantic phrases, semantic clusters, and semantic positions. Semantic elements are a type of semantic unit analyzed theoretically; they are not based on natural language units and are not directly combined with speech. Specifically, for lexical information, the word vectors can be processed through a single-layer perceptron (SLP) to obtain the local lexical prediction score for each character. Then, pooling is performed to obtain the global morpheme prediction score for the entire sentence (i.e., the query semantic description). This pooling process can be max pooling. Further, the global morpheme prediction score for each candidate word in the inverse dictionary's vocabulary can be determined by a weighted sum of the number of morphemes hit by each candidate word, with the weight being the global morpheme prediction score corresponding to the candidate word. For semantic information, the determination method is similar to that for morpheme information. The character vectors can be processed through a single-layer perceptron to obtain the local semantic prediction score for each character. Then, pooling is performed to obtain the global semantic prediction score for the entire sentence (i.e., the query semantic description). Further, the global semantic prediction score for each candidate word in the inverse dictionary's vocabulary can be determined by a weighted sum of the number of semantic elements hit by each candidate word, with the weight being the global semantic prediction score corresponding to the candidate word.

[0121] In this embodiment, part-of-speech information (i.e., part-of-speech prediction score) and word category information (i.e., word category prediction score) can be determined based on the Sentence Embedded vector. Part-of-speech representation is based on the characteristics of words; for example, if a user's input query is "describing someone as very beautiful," the corresponding word's part-of-speech is an adjective. Therefore, candidate words with mismatched part-of-speech can be removed from the part-of-speech dimension. Word category represents the role a word plays in the structure. During the similarity determination process, semantically related words often have high similarity, but it's impossible to determine whether semantically related words have similar word categories. For example, "highway" and "road sign" have high similarity, but different word categories. Similarly, "highway" and "road" have high similarity and the same word category. Therefore, candidate words with mismatched word categories can be removed from the word category dimension. Specifically, for part-of-speech information, the Sentence Embedded vector is processed through a single-layer perceptron to obtain a part-of-speech prediction score. Furthermore, the part-of-speech prediction score for each candidate word in the reverse dictionary's vocabulary can be determined by a weighted sum based on the number of parts of speech matched by the candidate word, with the weight being the score of the corresponding part of speech. For word category information, similar to part-of-speech information, a single-layer perceptron is used to obtain the word category prediction score. Furthermore, the part-of-speech prediction score for each candidate word in the reverse dictionary's vocabulary can be determined by a weighted sum based on the number of word categories matched by the candidate word, with the weight being the score of the corresponding category.

[0122] Step S313: Calculate the target word based on similarity, part-of-speech information, word category information, morpheme information, and semantic information using preset weights.

[0123] In this embodiment, the similarity, global morpheme prediction score, global semantic morpheme prediction score, part-of-speech prediction score, and word class prediction score of each candidate word are weighted and summed according to preset weights to determine the matching confidence score between each candidate word and the user's input query information (i.e., the query word meaning description). Further, the target word is determined from the candidate words based on the matching confidence score. Specifically, the candidate word with the highest matching confidence score can be determined as the target word, or candidate words with matching confidence scores higher than a predetermined value can be determined as the target word.

[0124] Step S314: Determine the target words as natural language query results.

[0125] In this embodiment, one or more candidate words included in the target word are identified as natural language query results and displayed to the user.

[0126] Optionally, after identifying the target words, a query can be performed using the basic dictionary and related dictionaries to determine the meaning and related words of the target words. In this case, the target dictionary consists of the reverse dictionary, the basic dictionary, and the related dictionary. The target words, their meanings, and related words are then used as the natural language query results and displayed to the user. This improves the coverage of natural language query results and enhances the user experience.

[0127] In this embodiment, if the intent category of the user's input query information is a third intent category, i.e., a related word query, then the target dictionary can be a related word dictionary. Correspondingly, step S300, including steps S321 and S322, can be referred to... Figure 6 .

[0128] Figure 6 This is a flowchart illustrating how, in an embodiment of the present invention, at least one target dictionary is queried based on the query term to determine the corresponding natural language query result. For example... Figure 6 As shown, the process of querying at least one target dictionary based on the query term to determine the corresponding natural language query result in this embodiment includes the following steps:

[0129] Step S321: Query the related dictionary based on the query term to determine the related terms.

[0130] In this embodiment, the NLU unit can input one or more query terms corresponding to the slot determined by the user's input query information into an association dictionary to determine associated terms. These associated terms include related words, synonyms, near-synonyms, and antonyms. Related words represent words with related meanings, such as the words "highway" and "road sign." The association dictionary can be configured with related word units and near-synonym, antonym, and near-synonym units. The related word unit determines the related words matching the user's input query information, and the near-synonym, antonym, and near-synonym units determine the near-synonyms, antonyms, and near-synonyms matching the user's input query information. Specifically, for related words, the association dictionary can determine the word embedding vector of the query term and the word embedding vectors of candidate words in the association dictionary's word list using a word2vec model. Then, it calculates the similarity between the word embedding vectors of the query term and the candidate word embedding vectors, and identifies the candidate word with the highest similarity or a similarity higher than a predetermined value as the synonym of the query term. The Word2Vec model represents a tool for converting query terms and candidate words into vector form. It simplifies the processing of query terms and candidate terms to vector operations in a vector space, calculating the similarity in the vector space to represent the semantic similarity between query terms and candidate terms. For synonyms, related terms, and antonyms, the association dictionary can determine the corresponding synonyms, related terms, and antonyms for the query term using a dictionary of synonyms, related terms, and antonyms. This dictionary of synonyms, related terms, and antonyms can be obtained from a cloud server via a network by the NLU unit, or it can be a custom dictionary, i.e., an application program written based on the user's input query information and corresponding intent information.

[0131] Step S322: Determine the related words as the natural language query results.

[0132] In this embodiment, related words, synonyms, antonyms, and related terms are identified as natural language query results and displayed to the user.

[0133] Optionally, after identifying the related terms, the meanings of the corresponding words can be determined by querying the basic dictionary, i.e., the meanings of related words, synonyms, near-synonyms, and antonyms. In this case, the target dictionary consists of the basic dictionary and the related dictionary. The related terms and their corresponding meanings are then used as natural language query results and displayed to the user. This improves the coverage of natural language query results and enhances the user experience.

[0134] In this embodiment, if the intent category of the user's input query information is the fourth intent category, i.e., classical Chinese query, then the target dictionary can be a classical Chinese dictionary. Specifically, the preset classical Chinese database in the classical Chinese dictionary is queried based on the user's input query information to determine the natural language query result.

[0135] In one optional implementation, the user's input query information represents the author of the classical Chinese text. The system then queries a pre-defined database of classical Chinese texts in a dictionary to determine candidate texts corresponding to the author. From these candidate texts, a target text that meets predetermined conditions is selected and identified as the natural language query result. The predetermined conditions can be either frequently searched texts by the author or texts with high pre-defined popularity by the author.

[0136] In another optional implementation, the user's input query information represents a classical Chinese text title. The classical Chinese text corresponding to the title is then determined as the natural language query result by querying a pre-set classical Chinese text database in a classical Chinese text dictionary.

[0137] In another optional implementation, the user's input query information represents an ancient Chinese sentence, that is, a sentence in ancient Chinese. The ancient Chinese text corresponding to the sentence is then determined as the natural language query result by querying a preset ancient Chinese database in an ancient Chinese dictionary.

[0138] In this embodiment, if the intent category of the user's input query information is the fifth intent category, i.e., a proverb query, then the target dictionary can be a proverb dictionary. Correspondingly, steps S300, including steps S331-S333, can be referred to... Figure 7 .

[0139] Figure 7 This is a flowchart in an embodiment of the present invention that queries at least one target dictionary based on the input query information to determine the corresponding natural language query result. For example... Figure 7 As shown, the process of querying at least one target dictionary based on the input query information to determine the corresponding natural language query result in this embodiment includes the following steps:

[0140] Step S331: Based on the input query information, query the preset proverb database in the proverb dictionary to determine the matching degree.

[0141] In this embodiment, the system queries a pre-set database of proverbs in the proverb dictionary based on the user's input query information, and matches the user's input query information with the candidate proverb data in the proverb database to determine the matching degree of the candidate proverb data.

[0142] Step S323: Determine the target proverb information based on the matching degree.

[0143] In this embodiment, the candidate proverbs with the highest matching degree or those with a matching degree higher than a predetermined value can be identified as the target proverb information based on the matching degree. For example, if the user's input query information is the first half or the second half of the target proverb, then the target proverb information is the complete proverb.

[0144] Step S323: Determine the target proverb information as the natural language query result.

[0145] This invention employs natural language understanding processing on user input query information to determine intent information. Based on this intent information, one or more target dictionaries are then selected from multiple candidate dictionaries. Finally, the input query information is used to query one or more target dictionaries to determine the natural language query result. Thus, one or more target dictionaries can be associated and queried based on the input query information to determine natural language query results matching the user's intent. This achieves efficient natural language querying while increasing the coverage of natural language query results and improving the user experience.

[0146] Figure 8 This is a schematic diagram of a natural language processing device according to an embodiment of the present invention. Figure 8 As shown, the natural language processing device in this embodiment includes an intent information determination unit 411, a target dictionary determination unit 412, and a natural language query result determination unit 413. The intent information determination unit 411 performs natural language understanding processing based on the user's input query information to determine intent information. The target dictionary determination unit 412 determines at least one target dictionary from multiple candidate dictionaries based on the intent information. The natural language query result determination unit 413 queries at least one of the target dictionaries based on the input query information to determine the corresponding natural language query result.

[0147] In some embodiments, the intent information determination unit 411 is further configured to:

[0148] The intent information and query terms are determined based on the input query information through rule matching.

[0149] The natural language query result determination unit 413 is further configured to:

[0150] Based on the query terms, at least one of the target dictionaries is queried to determine the corresponding natural language query results.

[0151] In some embodiments, the target dictionary determination unit 412 is further configured to:

[0152] Determine the intent category corresponding to the intent information; and

[0153] At least one target dictionary is determined from the candidate dictionaries based on the intent category.

[0154] In some embodiments, the natural language query result determination unit 413 is further configured to:

[0155] In response to the intent information being a first intent category, the query term is input into the basic dictionary and the associated dictionary to determine the natural language query result, where the first intent category represents the word meaning query;

[0156] The target dictionary includes the basic dictionary and the associated dictionary.

[0157] In some embodiments, the natural language query result determination unit 413 is further configured to:

[0158] In response to the intent information being a second intent category, the query term is input into a pre-trained language model in a reverse dictionary to obtain a word embedding vector, where the second intent category represents the word query and the input query information represents the query term.

[0159] Similarity is determined based on the word embedding vectors;

[0160] The confidence level is determined based on the similarity.

[0161] Target words are determined based on the confidence level; and

[0162] The target words are identified as the natural language query results;

[0163] The target dictionary includes the reverse dictionary.

[0164] In some embodiments, the natural language query result determination unit 413 is further configured to:

[0165] In response to the intent information being a second intent category, the input query information is input into a pre-trained language model in a reverse dictionary to obtain character vectors, word embedding vectors, and sentence embedding vectors. The second intent category represents a word query, and the input query information represents a query word meaning description.

[0166] Similarity, part-of-speech information, word category information, morpheme information, and semantic information are determined based on the character vectors, word embedding vectors, and sentence embedding vectors.

[0167] The target word is determined by calculating the similarity, part-of-speech information, word category information, morpheme information, and semantic information using preset weights; and

[0168] The target words are identified as the natural language query results;

[0169] The target dictionary includes the reverse dictionary.

[0170] In some embodiments, the natural language query result determination unit 413 is further configured to:

[0171] In response to the intent information being a third intent category, the association dictionary is queried based on the query term to determine related terms, where the third intent category represents the related term query; and

[0172] The associated words are identified as the natural language query results;

[0173] The target dictionary includes the associated dictionary, and the associated words include one or more of the following: related words, synonyms, near-synonyms, and antonyms.

[0174] In some embodiments, the natural language query result determination unit 413 is further configured to:

[0175] In response to the intent information being a fourth intent category, the system queries a preset ancient Chinese database in the ancient Chinese dictionary based on the input query information to determine the natural language query result. The fourth intent category represents an ancient Chinese query, and the target dictionary includes the ancient Chinese dictionary; or

[0176] In response to the intent information being a fifth intent category, the matching degree is determined by querying the preset proverb database in the proverb dictionary based on the input query information. The fifth intent category represents a proverb query, and the target dictionary includes the proverb dictionary.

[0177] The target proverb information is determined based on the matching degree; and

[0178] The target proverb information is identified as the natural language query result.

[0179] This invention employs natural language understanding processing on user input query information to determine intent information. Based on this intent information, one or more target dictionaries are then selected from multiple candidate dictionaries. Finally, the input query information is used to query one or more target dictionaries to determine the natural language query result. Thus, one or more target dictionaries can be associated and queried based on the input query information to determine natural language query results matching the user's intent. This achieves efficient natural language querying while increasing the coverage of natural language query results and improving the user experience.

[0180] Figure 9 This is a schematic diagram of an electronic device according to an embodiment of the present invention. Figure 9The illustrated electronic device can be a general-purpose data processing chip or device. The data processing chip or device includes a general-purpose computer hardware architecture, comprising at least a processor 421 and a memory 422. The processor 421 and memory 422 are connected via a bus 423. The memory 422 is adapted to store instructions or programs executable by the processor 421. The processor 421 can be a standalone microprocessor or a collection of one or more microprocessors. Thus, the processor 421 executes the instructions stored in the memory 422 to perform the method flow of the embodiments of the present invention as described above, thereby realizing data processing and control of other devices. The bus 423 connects the aforementioned multiple controls together, and also connects the controls to a display controller 424, a display device, and an input / output (I / O) device 425. The input / output (I / O) device 425 can be a mouse, keyboard, modem, network interface, touch input device, motion-sensing input device, printer, and other devices known in the art. Typically, the input / output device 425 is connected to the system via an input / output (I / O) controller 426.

[0181] Those skilled in the art will understand that embodiments of the present invention can be provided as methods, electronic devices, or computer program products. Therefore, the present invention can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, the present invention can be implemented as a computer program product on one or more computer-readable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, etc.) that include computer-usable program code.

[0182] This invention is described with reference to flowchart illustrations of methods, electronic devices, and computer program products according to embodiments of this application. It should be understood that each step in the flowchart can be implemented by computer program instructions.

[0183] These computer program instructions may be stored in a computer-readable storage medium that can direct a computer or other programmable data processing chip or device to operate in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including an instruction means, the implementation process of which is described in the instruction means. Figure 1 The function specified in one or more processes.

[0184] These computer program instructions may also be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing chip or device to produce a machine, such that the instructions, which are executed by the processor of the computer or other programmable data processing chip or device, are configured to implement in a process Figure 1 A device for a function specified in one or more processes.

[0185] The above description is merely a preferred embodiment of the present invention and is not intended to limit the invention. Various modifications and variations can be made to the invention by those skilled in the art. Any modifications, equivalent substitutions, or improvements made within the spirit and principle of the invention should be included within the scope of protection of the invention.

Claims

1. A natural language processing method, characterized in that, The method includes: Natural language understanding is used to process the user's input query information to determine intent information; Based on the intent information, at least one target dictionary is determined from the candidate dictionaries; and Based on the input query information, at least one of the target dictionaries is queried to determine the corresponding natural language query results; The candidate dictionaries include one or more of the following: basic dictionary, reverse dictionary, related dictionary, classical Chinese dictionary, and proverb dictionary; The step of querying at least one of the target dictionaries based on the input query information to determine the corresponding natural language query result includes: In response to the intent information being a second intent category, the input query information is input into a pre-trained language model in the reverse dictionary to obtain character vectors, word embedding vectors, and sentence embedding vectors. The second intent category represents a word query, and the input query information represents a query word meaning description. Similarity, part-of-speech information, word category information, morpheme information, and semantic information are determined based on the character vectors, word embedding vectors, and sentence embedding vectors. The target word is determined by calculating the similarity, part-of-speech information, word category information, morpheme information, and semantic information using preset weights; and The target words are identified as the natural language query results; The target dictionary includes the reverse dictionary.

2. The method according to claim 1, characterized in that, The step of performing natural language understanding processing based on user input query information to determine intent information includes: The intent information and query terms are determined based on the input query information through rule matching. The step of querying at least one of the target dictionaries based on the input query information to determine the corresponding natural language query result includes: Based on the query terms, at least one of the target dictionaries is queried to determine the corresponding natural language query results.

3. The method according to claim 1, characterized in that, The step of determining at least one target dictionary from the candidate dictionaries based on the intent information includes: Determine the intent category corresponding to the intent information; and At least one target dictionary is determined from the candidate dictionaries based on the intent category.

4. The method according to claim 2, characterized in that, The step of querying at least one of the target dictionaries based on the query term to determine the corresponding natural language query result includes: In response to the intent information being a first intent category, the query term is input into the basic dictionary and the associated dictionary to determine the natural language query result, where the first intent category represents the word meaning query; The target dictionary includes the basic dictionary and the associated dictionary.

5. The method according to claim 2, characterized in that, The step of querying at least one of the target dictionaries based on the query term to determine the corresponding natural language query result includes: In response to the intent information being a second intent category, the query term is input into a pre-trained language model in the reverse dictionary to obtain a word embedding vector, where the second intent category represents the word query and the input query information represents the query term. Similarity is determined based on the word embedding vectors; The confidence level is determined based on the similarity. Target words are determined based on the confidence level; and The target words are identified as the natural language query results; The target dictionary includes the reverse dictionary.

6. The method according to claim 2, characterized in that, The step of querying the target dictionary based on the query term to determine the corresponding natural language query result includes: In response to the intent information being a third intent category, the association dictionary is queried based on the query term to determine related terms, where the third intent category represents the related term query; and The associated words are identified as the natural language query results; The target dictionary includes the associated dictionary, and the associated words include one or more of the following: related words, synonyms, near-synonyms, and antonyms.

7. The method according to claim 1, characterized in that, The step of querying the target dictionary based on the input query information to determine the corresponding natural language query result includes: In response to the intent information being a fourth intent category, the system queries a preset ancient Chinese database in the ancient Chinese dictionary based on the input query information to determine the natural language query result. The fourth intent category represents an ancient Chinese query, and the target dictionary includes the ancient Chinese dictionary; or In response to the intent information being a fifth intent category, the matching degree is determined by querying the preset proverb database in the proverb dictionary based on the input query information. The fifth intent category represents a proverb query, and the target dictionary includes the proverb dictionary. The target proverb information is determined based on the matching degree; and The target proverb information is identified as the natural language query result.

8. A natural language processing device, characterized in that, The device includes: The intent information determination unit is used to perform natural language understanding processing based on the user's input query information to determine intent information; The target dictionary determination unit is configured to determine at least one target dictionary from the candidate dictionaries based on the intent information; and The natural language query result determination unit is used to query at least one of the target dictionaries based on the input query information to determine the corresponding natural language query result; The candidate dictionaries include one or more of the following: basic dictionary, reverse dictionary, related dictionary, classical Chinese dictionary, and proverb dictionary; The natural language query result determination unit is also used for: In response to the intent information being a second intent category, the input query information is input into a pre-trained language model in the reverse dictionary to obtain character vectors, word embedding vectors, and sentence embedding vectors. The second intent category represents a word query, and the input query information represents a query word meaning description. Similarity, part-of-speech information, word category information, morpheme information, and semantic information are determined based on the character vectors, word embedding vectors, and sentence embedding vectors. The target word is determined by calculating the similarity, part-of-speech information, word category information, morpheme information, and semantic information using preset weights; and The target words are identified as the natural language query results; The target dictionary includes the reverse dictionary.

9. An electronic device, characterized in that, The electronic device includes: A memory and a processor, the memory being used to store one or more computer program instructions, wherein the one or more computer program instructions are executed by the processor to implement the method as described in any one of claims 1-7.

Citation Information

Patent Citations

  • Intelligent interaction method, electronic device and storage medium

    CN108427722A