CN114925679A - Interaction method and device, electronic equipment and storage medium - Google Patents

Interaction method and device, electronic equipment and storage medium Download PDF

Info

Publication number
CN114925679A
CN114925679A CN202210459426.8A CN202210459426A CN114925679A CN 114925679 A CN114925679 A CN 114925679A CN 202210459426 A CN202210459426 A CN 202210459426A CN 114925679 A CN114925679 A CN 114925679A
Authority
CN
China
Prior art keywords
entity
lattice
command text
text
change
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.)
Pending
Application number
CN202210459426.8A
Other languages
Chinese (zh)
Inventor
韩后岳
王心璐
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
iFlytek Co Ltd
Original Assignee
iFlytek Co Ltd
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by iFlytek Co Ltd filed Critical iFlytek Co Ltd
Priority to CN202210459426.8A priority Critical patent/CN114925679A/en
Publication of CN114925679A publication Critical patent/CN114925679A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/20Natural language analysis
    • G06F40/279Recognition of textual entities
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/20Natural language analysis
    • G06F40/279Recognition of textual entities
    • G06F40/284Lexical analysis, e.g. tokenisation or collocates

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Health & Medical Sciences (AREA)
  • Artificial Intelligence (AREA)
  • Audiology, Speech & Language Pathology (AREA)
  • Computational Linguistics (AREA)
  • General Health & Medical Sciences (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Machine Translation (AREA)

Abstract

The invention provides an interaction method, an interaction device, electronic equipment and a storage medium, wherein the method comprises the following steps: acquiring a command text of a user; under the condition that the language of the command text belongs to the Indonesia-European language family, performing entity extraction on the command text to obtain a lattice change entity in the command text, and determining the lattice position of the lattice change entity in the command text; determining an original entity corresponding to the lattice-changing entity based on the lattice position of the lattice-changing entity in the command text; the response command text is based on the original entity. According to the method, the device, the electronic equipment and the storage medium provided by the invention, under the condition that the language of the command text belongs to the Indonesian system, the lattice change entity in the command text is extracted, the lattice position of the lattice change entity in the command text is determined, and the original entity corresponding to the lattice change entity is obtained based on the reduction, so that the noun lattice change problem existing in Indonesian system interaction is solved, the accuracy and the effectiveness of the Indonesian system interaction are improved, and the interaction experience of a user is greatly improved.

Description

Interaction method and device, electronic equipment and storage medium
Technical Field
The present invention relates to the field of natural language processing technologies, and in particular, to an interaction method, an interaction apparatus, an electronic device, and a storage medium.
Background
With the rapid development of speech recognition technology and natural language understanding technology, speech interactive products are rapidly developed in various industries, and are widely applied to various fields such as industry, household appliances, communication, automotive electronics, medical treatment, home services, electronic products and the like. Meanwhile, only the voice interaction of a single language can not meet the requirement of the market on the voice interaction, and the multi-language voice interaction has more and more application scenes. However, for the voice interaction of the Hindi system, there is a problem to be solved: noun variations are a common feature of the Hinoki language, unlike Asian languages.
In the current human-computer interaction dialog system, a common semantic understanding method based on a sequence labeling model can only obtain an entity in an actual sentence, however, for the Hindu system, the entity in the actual sentence is usually a qualified entity, which causes that the entity extracted by the prior art does not conform to the entity actually required by a user, which can cause that a subsequent interaction flow cannot be performed, and interaction experience of the user is influenced.
Disclosure of Invention
The invention provides an interaction method, an interaction device, electronic equipment and a storage medium, which are used for solving the problem of poor user experience in the voice interaction of the Indonesian system in the prior art.
The invention provides an interaction method, which comprises the following steps:
acquiring a command text of a user;
under the condition that the language of the command text belongs to the Indonesian system, performing entity extraction on the command text to obtain a lattice change entity in the command text, and determining the lattice position of the lattice change entity in the command text;
determining an original entity corresponding to the lattice change entity based on the lattice position of the lattice change entity in the command text;
responding to the command text based on the original entity.
According to an interaction method provided by the invention, the determining of the lattice position of the lattice-changing entity in the command text comprises the following steps:
selecting the lattice position of the lattice-changing entity in the command text from all lattice positions in the language of the command text based on the word segmentation of the preorder segmentation, wherein the preorder segmentation is the segmentation arranged in the command text before the lattice-changing entity.
According to an interaction method provided by the present invention, the determining an original entity corresponding to the lattice-change entity based on the lattice position of the lattice-change entity in the command text includes:
selecting the part of speech to which the lattice-changing entity belongs from the parts of speech of the command text;
and determining an original entity corresponding to the lattice change entity based on the part of speech to which the lattice change entity belongs and the lattice position to which the lattice change entity belongs in the command text.
According to an interaction method provided by the present invention, the determining an original entity corresponding to the lattice-change entity based on the part of speech to which the lattice-change entity belongs and the lattice position to which the lattice-change entity belongs in the command text comprises:
determining a lattice change rule corresponding to the part of speech and the lattice position to which the lattice change entity belongs based on the preset relationship between various part of speech lattice position combinations and the lattice change rule;
and performing lattice change reduction on the lattice change entity based on a lattice change rule corresponding to the part of speech and the lattice position to which the lattice change entity belongs to obtain an original entity corresponding to the lattice change entity.
According to an interaction method provided by the invention, the entity extraction of the command text to obtain a lattice-change entity in the command text comprises the following steps:
coding the command text based on a general dictionary to obtain a text vector of the command text, wherein the general dictionary is constructed based on multi-language parallel linguistic data;
and performing entity extraction on the command text based on the text vector of the command text to obtain a lattice change entity in the command text.
According to an interaction method provided by the invention, the entity extraction is performed on the command text based on the text vector of the command text to obtain a lattice change entity in the command text, and the method comprises the following steps:
performing entity extraction on the text vector based on an entity extraction model to obtain the lattice-changing entity;
the entity extraction model is obtained by training a sample text vector and a sample entity of a first sample text in the language of a command text on the basis of a general model, and the general model is obtained by training a sample text vector and a sample entity of a second sample text in multiple languages.
According to an interaction method provided by the present invention, the responding to the command text based on the original entity includes:
and matching the original entity with a plurality of candidate entities stored in advance to obtain a matching result, and responding to the command text based on the matching result.
The invention also provides an interaction device, comprising:
the acquisition unit is used for acquiring a command text of a user;
the extracting unit is used for performing entity extraction on the command text under the condition that the language of the command text belongs to the Indonesian language family to obtain a lattice change entity in the command text and determining the lattice position of the lattice change entity in the command text;
the restoring unit is used for determining an original entity corresponding to the lattice change entity based on the lattice position of the lattice change entity in the command text;
a response unit for responding to the command text based on the original entity.
The present invention also provides an electronic device, comprising a memory, a processor and a computer program stored in the memory and executable on the processor, wherein the processor implements the interaction method as described in any one of the above when executing the program.
The invention also provides a non-transitory computer-readable storage medium having stored thereon a computer program which, when executed by a processor, implements the interaction method as described in any of the above.
According to the interaction method, the interaction device, the electronic equipment and the storage medium, provided by the invention, under the condition that the language of the command text belongs to the Indonesian system, the entity of the command text is extracted to obtain the lattice-changing entity in the command text, the lattice position of the lattice-changing entity in the command text is determined, the original entity corresponding to the lattice-changing entity is obtained through reduction based on the lattice-changing entity, and the command text is responded based on the original entity, so that the noun lattice-changing problem existing in the Indonesian system interaction is solved, the accuracy and the effectiveness of the Indonesian system interaction are improved, and the interaction experience of a user is greatly improved.
Drawings
In order to more clearly illustrate the technical solutions of the present invention or the prior art, the drawings needed to be used in the description of the embodiments or the prior art will be briefly described below, and it is obvious that the drawings in the following description are some embodiments of the present invention, and it is obvious for those skilled in the art to obtain other drawings based on these drawings without creative efforts.
FIG. 1 is a flow chart of an interaction method provided by the present invention;
FIG. 2 is a flow chart of a method for determining an original entity according to the present invention;
FIG. 3 is a second flowchart of the method for determining an original entity according to the present invention;
FIG. 4 is an exemplary diagram of the relationship between various part-of-speech lexeme combinations and lattice change rules provided by the present invention;
FIG. 5 is a flow chart of an entity extraction method provided by the present invention;
FIG. 6 is a second flowchart of the interaction method provided by the present invention;
FIG. 7 is a schematic diagram of the structure of an interactive device provided by the present invention;
fig. 8 is a schematic structural diagram of an electronic device provided in the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention clearer, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings, and it is obvious that the described embodiments are some, but not all embodiments of the present invention. All other embodiments, which can be obtained by a person skilled in the art without inventive step based on the embodiments of the present invention, are within the scope of protection of the present invention.
In practical application, when a user uses behavior analysis, the following results are found: under the vertical scenes of navigating to a specific Point of Interest (Point of Interest), calling to a contact, searching for a song and the like, a noun in a Hindu system sentence often has the problem of lattice change, a slot extraction method in the existing NLP (Natural Language Processing) can only obtain the form after the noun in the sentence is subjected to lattice change, but the lattice change of the noun relates to negative and positive characters, a single and plural number, a preposition or a verb in the front, the mode of using a rule enumerate not only is complex to process, but also is not easy to realize basically, once the extracted entity is not matched with the original entity, the whole interaction failure can be caused, and the interaction experience of a user is greatly influenced.
For example, for a Chinese interactive scene, assuming that a contact person "ann east" is stored in an address book, a user sends a voice request "call to ann east", and the system obtains the following semantic results through semantic understanding: (1) domain (domain): a telephone; (2) intent (intent): dialing a call; (3) slot value (slot): searching in the address list through a semantic result of 'name ═ an east', wherein the name can be searched at the moment;
for the interactive scenario of russian, suppose that the contact "a" is trusted to generate green word ", the user requests" Π "з", the user makes a request of "Π" from the russian address book, and "a" is generated у ", in this case," a "g" у "is to use the form of the third lattice (i.e., the g lattice), and the contact stored in the address book generally uses the form of the first lattice (i.e., the main lattice," a g "is generated), so the semantic result" name ═ a g "from the system semantic understanding cannot be searched in the address book, at this time, the interactive flow cannot be continued.
In view of this, the present invention provides an interaction method. Fig. 1 is a schematic flowchart of an interaction method provided in the present invention, and as shown in fig. 1, the method includes:
step 110, obtaining a command text of a user.
Here, the command text is a text used for representing an interactive command of the user, and may specifically be a text directly input by the user, or may also be a text obtained by performing voice transcription on voice data input by the user, which is not specifically limited in the embodiment of the present invention.
Step 120, under the condition that the language of the command text belongs to the Indonesia-Europe language family, performing entity extraction on the command text to obtain a lattice change entity in the command text, and determining the lattice position of the lattice change entity in the command text;
step 130, determining an original entity corresponding to the lattice-changing entity based on the lattice position of the lattice-changing entity in the command text;
based on the original entity, the command text is responded to, step 140.
Specifically, the Hinoki language family may include, for example, German, Russian, Spanish, Portuguese, and Polish languages. The lattice is a syntactic category representing the structure and semantic relation between words, and the lattice to which the lattice-changing entity belongs in the command text is used for representing the structure and semantic relation between the corresponding noun of the lattice-changing entity and other words in the command text, for example, in russian, the lattice can be one of a host lattice, a living lattice, a given lattice, an object lattice, a tool lattice and a preposed lattice.
Considering that in the existing natural language understanding scheme, the extracted entity information can only be consistent with the entity in the actual sentence, when the entity extraction is performed on the language in the Hindu system, the extracted entity is often the entity subjected to lattice change and does not correspond to the entity in the original form, thereby reducing the accuracy of the final interaction.
Aiming at the problem, the embodiment of the invention performs entity extraction on the command text under the condition that the language to which the command text belongs to the Indonesian system to obtain the entity subjected to lattice change in the command text, namely the lattice change entity, then determines the lattice position of the lattice change entity in the command text, and restores the entity in the original form corresponding to the lattice change entity according to the lattice position of the lattice change entity in the command text, namely the original entity.
Taking an interactive scene of russian as an example, a change of noun is embodied in a change of a word tail of a noun, for example, the command text is "Π з q h a q a у" (chinese meaning: call to an andong), then the change ge entity is "a h-h" у ", the lattice bit to which the change ge entity belongs in the command text is a lattice, since a contact stored in the address book generally uses a main lattice, that is, an original form of a noun, at which time," a h-h "h-h у" may be reduced to an original entity "a h-h", on which basis, matching may be performed with each contact person in the address book according to "a h-h" to obtain a phone number of "a h-h" and perform dialing to finish a response flow of the command text.
In the step 130, the corresponding original entity may be determined only according to the lattice position to which the lattice-change entity belongs in the command text, or may be determined by combining the lattice position to which the lattice-change entity belongs, and other information related to lattice change, such as part of speech information and word type, and specifically may be set correspondingly according to an application scenario, for example, in an interactive scenario of calling a contact person, the types of the lattice-change entities are fixed and are both names of people, and the names of people are all neutral in russian, and at this time, the corresponding original entity may be determined only according to the lattice position to which the lattice-change entity belongs in the command text.
According to the method provided by the embodiment of the invention, under the condition that the language of the command text belongs to the Indonesian system, the entity extraction is carried out on the command text to obtain the lattice change entity in the command text, the lattice position of the lattice change entity in the command text is determined, the original entity corresponding to the lattice change entity is obtained through reduction based on the lattice change entity, and the command text is responded based on the original entity, so that the noun lattice change problem existing in Indonesian system interaction is solved, the accuracy and the effectiveness of the Indonesian system interaction are improved, and the interaction experience of a user is greatly improved.
Based on the above embodiment, in step 120, determining the lattice position of the lattice-change entity in the command text includes:
selecting the lattice position of the variation entity in the command text from all the lattice positions in the language of the command text based on the participle expression of the preamble participles, wherein the preamble participles are the participles arranged in front of the variation entity in the command text.
Specifically, considering that for the hindu system, the lattice position to which a noun belongs in a sentence depends on the word arranged before the noun in the sentence, for example, in russian, when there occurs h, ajo, i з, i з - з a, or o k pi, etc., the following noun generally uses the second lattice (i.e., a generation lattice), for which, the embodiment of the present invention selects the lattice position to which the lattice entity belongs in the command text from each lattice position in the language of the command text according to the word segmentation representation of the preamble word segmentation, where the preamble word segmentation is the word arranged before the lattice entity in the command text, so as to improve the accuracy of lattice position determination.
For example, the command text is "pi o з", xiga bei a у ", the variant ge entity is" a bha у ", then the partial word arranged before the variant ge entity is arranged in the command text, i.e. the preamble partial word is" pi o з "and generates" e he e ", according to the partial word representation of the preamble partial word, the lattice site belonging to the variant ge entity in the command text is selected as the lattice site.
Here, the word segmentation representation of the preamble word may be a feature representation of the word segmentation obtained by encoding, specifically, may be obtained by directly encoding the word segmentation, or may be obtained by obtaining a text representation of a command text according to an encoder in an entity extraction model for performing entity extraction, and then extracting the text representation from the command text, which is not specifically limited in the embodiment of the present invention.
Further, the lattice of the lattice change entity in the command text is selected, which may be specifically realized by a classification model for performing lattice classification, where the classification model may be a model common to multiple languages of the european language system, or a model obtained by separately training the languages of the command text, and the structure of the classification model may be, for example, CNN (Convolutional Neural Network), RNN (Recurrent Neural Network), etc., which are not specifically limited in the embodiments of the present invention,
based on any of the above embodiments, fig. 2 is a schematic flowchart of a method for determining an original entity provided by the present invention, as shown in fig. 2, step 130 includes:
step 131, selecting the part of speech to which the lattice-changing entity belongs from the parts of speech in the language of the command text;
and step 132, determining an original entity corresponding to the lattice-changing entity based on the part of speech to which the lattice-changing entity belongs and the lattice position of the lattice-changing entity in the command text.
Specifically, the part of speech is a category of grammar reflecting the concept of the attribute of a word, and the part of speech to which the variant entity belongs is the attribute concept reflecting the corresponding noun of the variant entity, for example, in russian, the part of speech may be one of neutral, negative and positive.
Considering that the variation of nouns in the Hinoki system is related to the part of speech of nouns, the embodiment of the invention selects the part of speech to which the variation entity belongs from various parts of speech in the language of the command text, and on the basis, the part of speech to which the variation entity belongs and the lattice position to which the variation entity belongs in the command text can be combined to restore and obtain the entity in the original form, namely the original entity, corresponding to the variation entity, so that the accuracy of the reduction of the variation can be improved.
Based on any of the above embodiments, fig. 3 is a second flowchart of the method for determining an original entity provided by the present invention, as shown in fig. 3, step 132 includes:
step 1321, determining a lattice change rule corresponding to the part of speech and the lattice position to which the lattice change entity belongs based on the preset relationship between various part of speech lattice position combinations and the lattice change rule;
and 1322, performing lattice change reduction on the lattice change entity based on the part of speech to which the lattice change entity belongs and the lattice change rule corresponding to the lattice position to obtain an original entity corresponding to the lattice change entity.
Specifically, the lattice change rule is a rule for changing a noun, and taking russian as an example, the lattice change rule may be a rule for changing the suffix of the noun. After the part of speech and the lattice position to which the lattice-variable entity belongs are determined, the lattice-variable rule corresponding to the part of speech and the lattice position to which the lattice-variable entity belongs can be determined according to the preset relation between various part of speech lattice position combinations and the lattice-variable rule, and on the basis, the lattice-variable entity can be subjected to lattice-variable reduction according to the lattice-variable rule corresponding to the part of speech and the lattice position to which the lattice-variable entity belongs, so that the original form entity, namely the original entity, is obtained through reduction and is used for subsequent interaction processes.
For example, as an example of the relationship between the word level combination and the variation rule, fig. 4 is an illustration of the relationship between the word level combination and the variation rule, which is provided by the present invention, as shown in fig. 4, the word level is divided into the main word generation case and the preliminary word generation case, which correspond to the first, second, third, fourth, fifth, and sixth cases in fig. 4, respectively, and the command text is "Π or" h ". cnahi у", the variation entity is "a h у", which belongs to the word level combination in the command text is "o", which corresponds to the variation rule, and the variation rule is determined based on the variation rule "", further, since "a steam generator у belongs to the name of person, the tail does not need to be added" -o ", therefore, the original entity obtained by the shift reduction is" a steam generator ".
Based on any of the above embodiments, fig. 5 is a schematic flowchart of an entity extraction method provided by the present invention, and as shown in fig. 5, performing entity extraction on a command text to obtain a lattice change entity in the command text includes:
step 510, coding the command text based on a general dictionary to obtain a text vector of the command text, wherein the general dictionary is constructed based on multi-language parallel linguistic data;
and step 520, performing entity extraction on the command text based on the text vector of the command text to obtain a lattice change entity in the command text.
Specifically, multilingual parallel corpora are corpora expressing the same meaning but different languages. Considering that the existing natural language understanding scheme is to extract entities for sentences of a single language, and cannot be applied to multiple languages, and with the acceleration of the globalization process, the scheme only supporting a single language cannot meet the actual requirement. In view of the above problems, in the embodiments of the present invention, a multi-language shared dictionary, that is, a general dictionary, is constructed according to multi-language parallel corpora, and then a command text is encoded according to the general dictionary, so that a word embedding vector that is used for representing the meaning of the command text and removing language information is obtained and is used as a text vector of the command text, and on this basis, the command text is subjected to entity extraction according to the text vector of the command text to obtain a lattice-change entity in the command text, thereby ensuring the universality of the entity extraction method for multiple languages and satisfying the user's interactive experience for adapting to multiple languages.
Further, the general dictionary may be obtained by constructing embedding of multilingual parallel corpora through a Byte Pair Encoding (BPE) algorithm, and the entity extraction may be specifically implemented through a neural network model. It can be understood that the alignment effect of different languages in the embedding space can be significantly improved by constructing a universal dictionary, so that the neural network model for performing entity extraction later focuses more on the organizational structure of the language, rather than the category of the language.
Based on any of the above embodiments, step 520 includes:
performing entity extraction on the text vector based on an entity extraction model to obtain a lattice-changing entity;
the entity extraction model is obtained by training a sample text vector and a sample entity of a first sample text in the language of a command text on the basis of a general model, and the general model is obtained by training a sample text vector and a sample entity of a second sample text in multiple languages.
Specifically, considering that training an independent neural network model for each language is troublesome for a multi-language interaction scene, and operation cost is greatly increased, in the embodiment of the invention, sentences of multiple languages of the Hinoko language family and having the same meaning are collected as second sample texts, and are marked to obtain sample entities in the second sample texts, then the second sample texts are coded according to a general dictionary, so that sample text vectors of the second sample texts in the same semantic space are obtained, then the sample text vectors and the sample entities of the second sample texts are applied, an initial model is trained, so that a general model suitable for the multiple languages is obtained, and on the basis, the general model is finely adjusted, so that an entity extraction model for the language to which the command text belongs can be obtained.
Here, the fine-tuning of the generic model may be specifically implemented as follows: firstly, collecting a first sample text in the language of a command text, labeling to obtain a sample entity in the first sample text, and coding the first sample text according to a universal dictionary to obtain a sample text vector of the first sample text; because the entity output by the general model does not contain language information, a mapping layer can be added on the basis of the general model, so that an initial entity extraction model which can be mapped back to the entity in the language is obtained; and finally, training the initial entity extraction model by applying the sample text vector and the sample entity of the first sample text, so as to obtain the entity extraction model corresponding to the language after fine tuning, and further improve the accuracy of the entity extraction task in the language.
After the entity extraction model is obtained through training, the text vector of the command text obtained through coding is input into the entity extraction model, and the entity extraction model performs entity extraction on the text vector, so that a lattice-changing entity in the command text can be obtained through extraction.
Based on any of the above embodiments, step 140 includes:
and matching the original entity with a plurality of candidate entities stored in advance to obtain a matching result, and responding to the command text based on the matching result.
In particular, the candidate entities are entities that are selectable in an interaction scenario, for example, in an interaction scenario of a telephone, the candidate entities may be respective contacts stored in an address book, for example, in an interaction scenario of a music, the candidate entities may be respective songs stored in a song list, for example, in an interaction scenario of a navigation, the candidate entities may be respective addresses stored in an address library.
After the original form entity, namely the original entity, is obtained, the original entity can be matched with a plurality of prestored candidate entities in the original form, so that a matching result is obtained, the matching result can represent whether the matching is successful, if the matching is successful, the matching result can also represent the candidate entities matched with the original entity, and immediately, a command text of a user can be responded according to the matching result, for example, the user dials a phone number of a XXXX contact person, plays a XX song and the like, so that the whole interaction process is guaranteed to be completed smoothly.
Based on any of the above embodiments, the present invention provides an interactive method suitable for multiple languages. It can be understood that the service requirements of different products are different, and therefore, the service range applied by the interaction method is different for different products, for example: the service range supported by the intelligent sound box is music, reminding, weather, schedule, chatting and the like, and the service range supported by the intelligent automobile is navigation, music, telephone, radio station, command control and the like. Particularly, in vertical scenes such as navigation, music, telephone and the like, the problem of noun transformation of the Hindu system generally exists, and the embodiment of the invention takes the service range supported by the intelligent automobile as an example for detailed description.
Fig. 6 is a second schematic flowchart of the interaction method provided by the present invention, and as shown in fig. 6, the implementation flow of the interaction method is specifically as follows:
s1, the corpus is encoded through a BPE algorithm to train an end-to-end model, and a universal model suitable for multiple languages is obtained:
considering that the current word vectors are usually obtained by training in a single language (chinese or english) corpus set and do not have universality, and the embedding layer of the word vectors cannot cover multi-language semantic information, therefore, in order to better fuse the multi-language information into a shared word list, the embodiment of the invention uses BPE in text preprocessing, and replaces the most frequent symbol pairs (original bytes) in a given data set iteratively by using a single unused symbol, so that the processed word list is not sensitive to the language category information, and more retained is the language organization structure information. In the embodiment of the invention, the universal dictionary shared by all languages can be obtained by constructing the embedding of the multilingual parallel linguistic data through the BPE algorithm, and the universal dictionary can remarkably improve the alignment effect of different languages in the embedding space. In the embodiment of the invention, sentences are sampled from random polynomial distribution in a multi-language corpus for BPE learning, and in order to ensure balance of linguistic data and universality of the multi-language linguistic data, the sampling of the sentences obeys the polynomial distribution:
Figure BDA0003619972500000131
wherein: n is i : amount of speech material (n) of ith language k Same);
Figure BDA0003619972500000132
sum of corpora of all languages; p is a radical of formula i : the ratio probability (p) of the ith language corpus to the total language corpus j Same); α: the super parameter is preferably set to be 0.5 in order to solve the problem of unbalanced distribution of language corpora of each language;
Figure BDA0003619972500000133
the sum of the probabilities of all language corpora; q. q of i : sampling rate of ith language.
The embodiment of the invention obtains the sample text vector of the second sample text by using the BPE algorithm for sentences of all languages related to the Indonesia-European system and sentences with the same meaning, namely the second sample text, thereby constructing a large amount of training corpora to realize training to obtain a pre-training model irrelevant to language information, and taking the pre-training model as a multi-language general model.
The general model sequentially comprises an encoder, a decoder, a full connection layer and softmax, in the training process, the input of the encoder is a sample text vector of a second sample text (each word vector can be 1024-dimensional BPE embedding), the output is an intermediate vector of the second sample text, a target vector of the second sample text is obtained through the decoder, and a named entity is obtained through extraction according to the target vector.
Alternatively, the encoder may adopt a neural network model combining Bi-directional Long-Short Term Memory (Bi-directional Long-Short Term Memory) and max-firing; the decoder may use LSTM (Long Short-Term Memory network), which generates a sequence representing a task chain through loop implementation, each node in the sequence represents a task, and the generation of a single task depends on the output of the encoder and the last task, that is, the input of the decoder is the output of the encoder and the historical characteristics of the last time.
In the training process, the objective function of the general model is a maximized conditional likelihood function of encoder and decoder joint training:
Figure BDA0003619972500000141
wherein, theta is a parameter of the model, N is the number of samples of the training set, and x θ Is a sample of the model input, y is the prediction of the model output, p θ The probability of correctness is predicted for the model.
S2, fine-tune the general model according to the language of the command text, and extract the lattice-changing entity in the command text based on the entity extraction model obtained by fine tuning:
on the basis of step S1, an end-to-end entity extraction model for each language can be obtained by performing fine tuning on the trained general model, where the fine tuning may specifically be adding a mapping layer on the basis of the general model to obtain an initial entity extraction model that can be mapped back to an entity in each language, and then training the initial entity extraction model by using the labeled linguistic data related to each language, for example, for the language to which the command text belongs, a mapping layer corresponding to the language can be added on the basis of the general model to obtain an initial entity extraction model corresponding to the language, then a sample text vector obtained by a first sample text through BPE coding and a sample entity corresponding to the first sample text are applied, and training the initial entity extraction model to obtain the entity extraction model corresponding to the language after fine adjustment.
In the application process, the command text is input into the entity extraction model of the corresponding language, so that the key slot information slot in the command text can be extracted, and the task of extracting the named entity is completed. However, when the language of the command text belongs to the indolo language family, there is a noun transformation problem, and at this time, the extracted key slot information is not actually intended, which may cause a subsequent interaction process to be unable to be performed.
S3, obtaining the lattice position of the variation entity in the command text by using a classification model according to the lattice position information of the corresponding languages of the variation entity and the command text:
in the embodiment of the invention, the lattice position classification is carried out on the lattice change entity by adopting the classification model to obtain the lattice position of the lattice change entity in the command text, and optionally, the classification model can adopt CNN.
The training process is as follows:
1) and (3) corpus: before multiplexing, fine-tune uses a first sample text of a specific language, and marks the lattice position of a sample entity in the first sample text
2) An objective function: mean square error loss function
Figure BDA0003619972500000151
Wherein, theta is the parameter of the model, k is the number of samples of the training set, PT (theta) i For the marked grid, PF (theta) i The lattice positions obtained for the classification model.
The application process is as follows:
1) inputting: extracting the obtained variation entities slots, expressing the participle of the previous participle token arranged in front of the variation entity in the command text output by the coder in the entity extraction model, and corresponding to the lattice position information of the language (i.e. one language has several variation forms, for example, Russian has 6 variation forms, such as main lattice, raw lattice, given lattice, object lattice, tool lattice and preposed lattice)
2) And (3) outputting: lattice ID of lattice change entity in command text
It can be understood that, in the embodiment of the present invention, the classification model is a model common to multiple languages in the european language system, and by inputting the lattice information of the language corresponding to the command text, each lattice in the language can be obtained, and then selecting the lattice-changing entity from the lattice-changing entity to belong to the second lattice in the command text, for example, for russian corpora, the classification problem becomes a 6-class problem.
S4, according to the variation entity slot, the affiliated lattice ID and the specific rule of the corresponding language, restoring to obtain the original entity:
through the entity extraction model and the classification model in the steps S2 and S3, the lattice change entity in the command text and the lattice position to which the lattice change entity belongs can be obtained, and on the basis, the specific rule corresponding to the language can include the relationship between various part-of-speech lattice combinations and the lattice change rule in the language, so that the entity slot in the original form, namely the original entity, can be conveniently and accurately reduced. The original entity obtained by the restoration can be matched with the stored entity, so that the subsequent interactive process is completed.
The method provided by the embodiment of the invention obtains uniform embedding by carrying out BPE coding on multi-language data expressing the same meaning, thereby constructing a training corpus to train an end-to-end general model to realize a sequence labeling task, obtaining an entity extraction model by fine tuning aiming at the language of a command text, namely a target language, applying the entity extraction model to obtain a lattice change entity in the command text under the condition that the language of the command text belongs to the Indonesian system, adding lattice change information of the target language through a classification model to obtain the lattice position of the lattice change entity under the target language in the command text, and then reducing and obtaining an original entity according to the lattice change entity and the lattice position thereof in the command text and the specific rule of the target language, thereby realizing the solving of noun change problem existing in the Indonesian interaction, the effect of seal european language system multilingual interaction is improved, a plurality of language independent training models are not needed, only a single language needs to be finely adjusted, and the interaction experience of a user is greatly improved.
The following describes the interaction device provided by the present invention, and the interaction device described below and the interaction method described above may be referred to correspondingly.
Based on any of the above embodiments, the present invention provides an interactive device. Fig. 7 is a schematic structural diagram of an interaction device provided in the present invention, and as shown in fig. 7, the device includes:
an obtaining unit 710, configured to obtain a command text of a user;
the extracting unit 720 is configured to perform entity extraction on the command text to obtain a lattice change entity in the command text and determine a lattice position to which the lattice change entity belongs in the command text, when the language of the command text belongs to the european language system;
the restoring unit 730 is configured to determine an original entity corresponding to the lattice change entity based on the lattice position of the lattice change entity in the command text;
a responding unit 740 for responding to the command text based on the original entity.
According to the device provided by the embodiment of the invention, under the condition that the language of the command text belongs to the Indonesian system, the entity extraction is carried out on the command text to obtain the lattice change entity in the command text, the lattice position of the lattice change entity in the command text is determined, the original entity corresponding to the lattice change entity is obtained through reduction based on the lattice change entity, and the command text is responded based on the original entity, so that the noun lattice change problem existing in Indonesian system interaction is solved, the accuracy and the effectiveness of the Indonesian system interaction are improved, and the interaction experience of a user is greatly improved.
Based on any one of the above embodiments, determining the lattice position to which the lattice-change entity belongs in the command text includes:
selecting the lattice position of the lattice-changing entity in the command text from all lattice positions in the language of the command text based on the word segmentation representation of the preamble word, wherein the preamble word is the word segmentation arranged in front of the lattice-changing entity in the command text.
Based on any of the above embodiments, the reduction unit 730 includes:
the part of speech determining subunit is used for selecting the part of speech to which the lattice-changing entity belongs from the parts of speech of the command text in the language;
and the lattice change reduction subunit is used for determining an original entity corresponding to the lattice change entity based on the part of speech to which the lattice change entity belongs and the lattice position to which the lattice change entity belongs in the command text.
Based on any of the embodiments above, the lattice-changing atomic unit is specifically configured to:
determining a lattice change rule corresponding to the part of speech and the lattice position to which the lattice change entity belongs based on the preset relationship between various part of speech lattice position combinations and the lattice change rule;
and carrying out lattice change reduction on the lattice change entity based on the lattice change rule corresponding to the part of speech and the lattice position to which the lattice change entity belongs to obtain an original entity corresponding to the lattice change entity.
Based on any of the above embodiments, performing entity extraction on the command text to obtain a lattice change entity in the command text, including:
coding the command text based on a general dictionary to obtain a text vector of the command text, wherein the general dictionary is constructed based on multi-language parallel linguistic data;
and performing entity extraction on the command text based on the text vector of the command text to obtain a lattice change entity in the command text.
Based on any of the above embodiments, performing entity extraction on the command text based on the text vector of the command text to obtain a lattice change entity in the command text, including:
performing entity extraction on the text vector based on an entity extraction model to obtain a lattice-changing entity;
the entity extraction model is obtained by training a sample text vector and a sample entity of a first sample text in the language of a command text on the basis of a general model, and the general model is obtained by training a sample text vector and a sample entity of a second sample text in multiple languages.
Based on any of the above embodiments, the response unit 740 is configured to:
and matching the original entity with a plurality of candidate entities stored in advance to obtain a matching result, and responding to the command text based on the matching result.
Fig. 8 illustrates a physical structure diagram of an electronic device, and as shown in fig. 8, the electronic device may include: a processor (processor)810, a communication Interface 820, a memory 830 and a communication bus 840, wherein the processor 810, the communication Interface 820 and the memory 830 communicate with each other via the communication bus 840. Processor 810 may call logic instructions in memory 830 to perform an interaction method comprising: acquiring a command text of a user; under the condition that the language of the command text belongs to the Indonesian system, performing entity extraction on the command text to obtain a lattice change entity in the command text, and determining the lattice position of the lattice change entity in the command text; determining an original entity corresponding to the lattice change entity based on the lattice position of the lattice change entity in the command text; responding to the command text based on the original entity.
In addition, the logic instructions in the memory 830 may be implemented in software functional units and stored in a computer readable storage medium when the logic instructions are sold or used as independent products. Based on such understanding, the technical solution of the present invention may be embodied in the form of a software product, which is stored in a storage medium and includes instructions for causing a computer device (which may be a personal computer, a server, or a network device) to execute all or part of the steps of the method according to the embodiments of the present invention. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk or an optical disk, and other various media capable of storing program codes.
In another aspect, the present invention also provides a computer program product, the computer program product comprising a computer program, the computer program being storable on a non-transitory computer-readable storage medium, the computer program, when executed by a processor, being capable of executing the interaction method provided by the above methods, the method comprising: acquiring a command text of a user; under the condition that the language of the command text belongs to the Indonesian system, performing entity extraction on the command text to obtain a lattice change entity in the command text, and determining the lattice position of the lattice change entity in the command text; determining an original entity corresponding to the lattice change entity based on the lattice position of the lattice change entity in the command text; responding to the command text based on the original entity.
In yet another aspect, the present invention also provides a non-transitory computer-readable storage medium, on which a computer program is stored, the computer program being implemented by a processor to perform the interaction method provided by the above methods, the method comprising: acquiring a command text of a user; under the condition that the language of the command text belongs to the Indonesian system, performing entity extraction on the command text to obtain a lattice change entity in the command text, and determining the lattice position of the lattice change entity in the command text; determining an original entity corresponding to the lattice change entity based on the lattice position of the lattice change entity in the command text; responding to the command text based on the original entity.
The above-described embodiments of the apparatus are merely illustrative, and the units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one position, or may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of the present embodiment. One of ordinary skill in the art can understand and implement it without inventive effort.
Through the above description of the embodiments, those skilled in the art will clearly understand that each embodiment may be implemented by software plus a necessary general hardware platform, and may also be implemented by hardware. With this understanding in mind, the above-described technical solutions may be embodied in the form of a software product, which can be stored in a computer-readable storage medium such as ROM/RAM, magnetic disk, optical disk, etc., and includes instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to execute the methods described in the embodiments or some parts of the embodiments.
Finally, it should be noted that: the above examples are only intended to illustrate the technical solution of the present invention, but not to limit it; although the present invention has been described in detail with reference to the foregoing embodiments, it will be understood by those of ordinary skill in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some technical features may be equivalently replaced; and such modifications or substitutions do not depart from the spirit and scope of the corresponding technical solutions of the embodiments of the present invention.

Claims (10)

1. An interaction method, comprising:
acquiring a command text of a user;
under the condition that the language of the command text belongs to the Indonesian system, performing entity extraction on the command text to obtain a lattice change entity in the command text, and determining the lattice position of the lattice change entity in the command text;
determining an original entity corresponding to the lattice change entity based on the lattice position of the lattice change entity in the command text;
responding to the command text based on the original entity.
2. The interactive method of claim 1, wherein the determining the lattice position to which the lattice-changing entity belongs in the command text comprises:
selecting the lattice position of the lattice-changing entity in the command text from all lattice positions in the language of the command text based on the word segmentation of the preorder segmentation, wherein the preorder segmentation is the segmentation arranged in the command text before the lattice-changing entity.
3. The interaction method according to claim 1, wherein the determining an original entity corresponding to the lattice-changing entity based on the lattice position to which the lattice-changing entity belongs in the command text comprises:
selecting the part of speech to which the lattice-changing entity belongs from the parts of speech of the command text;
and determining an original entity corresponding to the lattice change entity based on the part of speech to which the lattice change entity belongs and the lattice position to which the lattice change entity belongs in the command text.
4. The interaction method according to claim 3, wherein the determining an original entity corresponding to the lattice-change entity based on the part of speech to which the lattice-change entity belongs and the lattice position to which the lattice-change entity belongs in the command text comprises:
determining a lattice change rule corresponding to the part of speech and the lattice position to which the lattice change entity belongs based on the preset relationship between various part of speech lattice position combinations and the lattice change rule;
and carrying out lattice change reduction on the lattice change entity based on a lattice change rule corresponding to the part of speech and the lattice position to which the lattice change entity belongs to obtain an original entity corresponding to the lattice change entity.
5. The interaction method according to claim 1, wherein the extracting the entity from the command text to obtain the lattice-change entity in the command text comprises:
coding the command text based on a general dictionary to obtain a text vector of the command text, wherein the general dictionary is constructed based on multi-language parallel linguistic data;
and performing entity extraction on the command text based on the text vector of the command text to obtain a lattice-changing entity in the command text.
6. The interaction method according to claim 5, wherein the performing entity extraction on the command text based on the text vector of the command text to obtain a lattice change entity in the command text comprises:
performing entity extraction on the text vector based on an entity extraction model to obtain the lattice-changing entity;
the entity extraction model is obtained by training a sample text vector and a sample entity of a first sample text in the language of a command text on the basis of a general model, and the general model is obtained by training a sample text vector and a sample entity of a second sample text in multiple languages.
7. The interaction method according to any one of claims 1 to 6, wherein said responding to said command text based on said original entity comprises:
and matching the original entity with a plurality of candidate entities stored in advance to obtain a matching result, and responding to the command text based on the matching result.
8. An interactive apparatus, comprising:
the acquisition unit is used for acquiring a command text of a user;
the extracting unit is used for performing entity extraction on the command text under the condition that the language of the command text belongs to the Indonesian language system to obtain a lattice change entity in the command text and determine the lattice position of the lattice change entity in the command text;
the restoring unit is used for determining an original entity corresponding to the lattice change entity based on the lattice position of the lattice change entity in the command text;
a response unit for responding to the command text based on the original entity.
9. An electronic device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, wherein the processor implements the interaction method according to any one of claims 1 to 7 when executing the program.
10. A non-transitory computer-readable storage medium, on which a computer program is stored, which, when executed by a processor, implements the interaction method according to any one of claims 1 to 7.
CN202210459426.8A 2022-04-27 2022-04-27 Interaction method and device, electronic equipment and storage medium Pending CN114925679A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210459426.8A CN114925679A (en) 2022-04-27 2022-04-27 Interaction method and device, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210459426.8A CN114925679A (en) 2022-04-27 2022-04-27 Interaction method and device, electronic equipment and storage medium

Publications (1)

Publication Number Publication Date
CN114925679A true CN114925679A (en) 2022-08-19

Family

ID=82806830

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210459426.8A Pending CN114925679A (en) 2022-04-27 2022-04-27 Interaction method and device, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN114925679A (en)

Similar Documents

Publication Publication Date Title
CN110210029B (en) Method, system, device and medium for correcting error of voice text based on vertical field
CN108287858B (en) Semantic extraction method and device for natural language
CN114580382A (en) Text error correction method and device
WO2017127296A1 (en) Analyzing textual data
CN111814487B (en) Semantic understanding method, device, equipment and storage medium
JP7335300B2 (en) Knowledge pre-trained model training method, apparatus and electronic equipment
WO2019226954A1 (en) Training sequence generation neural networks using quality scores
CN111310440A (en) Text error correction method, device and system
CN113672708A (en) Language model training method, question and answer pair generation method, device and equipment
CN111930914A (en) Question generation method and device, electronic equipment and computer-readable storage medium
KR101677859B1 (en) Method for generating system response using knowledgy base and apparatus for performing the method
CN111223476B (en) Method and device for extracting voice feature vector, computer equipment and storage medium
CN114757176A (en) Method for obtaining target intention recognition model and intention recognition method
CN112560510A (en) Translation model training method, device, equipment and storage medium
CN110489761B (en) Chapter-level text translation method and device
CN116050425A (en) Method for establishing pre-training language model, text prediction method and device
CN111813923A (en) Text summarization method, electronic device and storage medium
CN114492396A (en) Text error correction method for automobile proper nouns and readable storage medium
CN113822044B (en) Grammar error correction data generating method, device, computer equipment and storage medium
CN117574924A (en) Translation model training method, translation device, electronic equipment and medium
CN113609873A (en) Translation model training method, device and medium
KR20170055630A (en) Multilingual translation method
CN113705207A (en) Grammar error recognition method and device
CN116913278A (en) Voice processing method, device, equipment and storage medium
CN116484809A (en) Text processing method and device based on artificial intelligence

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