Text information processing method and device, electronic equipment and storage medium

文档序号:7685 发布日期:2021-09-17 浏览:22次 中文

1. A method for processing text information, the method comprising:

acquiring text information to be processed in a text processing context and associated text information matched with the text to be processed;

determining an associated text information context type matched with the associated text information based on the text information to be processed and the associated text information;

acquiring candidate similar text information matched with the text information to be processed, and determining the similarity between the text information to be processed and the candidate similar text information based on the text information to be processed, the associated text information and the associated text information context type;

and determining a reply sentence matched with the text information to be processed based on the similarity between the text information to be processed and the candidate similar text information.

2. The method according to claim 1, wherein determining the associated text information context type matching the associated text information based on the pending text information and the associated text information comprises:

triggering a matched text information matching model based on the text information to be processed and the associated text information;

processing the text information to be processed and the associated text information through an associated text information context type discriminator network of the text information matching model to determine an associated text information context type matched with the associated text information; alternatively, the first and second electrodes may be,

determining a text information embedding vector to be processed corresponding to the text information to be processed through a text information processing network of the text information matching model;

determining an associated text information embedding vector corresponding to the associated text information through a text information processing network of the text information matching model;

and processing the text information embedding vector to be processed and the associated text information embedding vector through an associated text information context type discriminator network of the text information matching model, and determining an associated text information context type matched with the associated text information.

3. The method of claim 1, further comprising:

triggering a corresponding word segmentation library according to the text information parameters carried by the text information to be processed;

performing word segmentation processing on the text information to be processed based on the triggered word segmentation library word dictionary through a text information processing network of the text information matching model to form different word-level text information embedding vectors to be processed;

and denoising the different word-level text information embedding vectors to be processed to form a text information embedding vector set to be processed corresponding to the text information to be processed.

4. The method of claim 3, further comprising:

determining the name of a word segmentation library used when the word segmentation processing is carried out on the text information to be processed;

determining the parameters of the word segmentation library matched with the word level text information embedding vector corresponding to the text information to be processed according to the names of the word segmentation library, wherein the parameters of the word segmentation library comprise:

the category of the word-dividing library, the name of the word-dividing library and the version of the word-dividing library.

5. The method of claim 3, wherein the denoising the different word-level text information to form a set of word-level feature vectors corresponding to the text information comprises:

determining a dynamic noise threshold that matches the text processing context;

denoising the text information to be processed according to the dynamic noise threshold, and triggering a dynamic word segmentation strategy matched with the dynamic noise threshold;

and performing word segmentation processing on the text information to be processed according to a dynamic word segmentation strategy matched with the dynamic noise threshold value to form text information embedding vectors to be processed corresponding to the text information to be processed.

6. The method of claim 3, wherein the denoising the different word-level text information to form a set of word-level feature vectors corresponding to the text information comprises:

determining a fixed noise threshold that matches the text processing context;

denoising the text information to be processed according to the fixed noise threshold, and triggering a fixed word segmentation strategy matched with the fixed noise threshold;

and performing word segmentation processing on the text information to be processed according to a fixed word segmentation strategy matched with the fixed noise threshold value to form text information embedding vectors to be processed corresponding to the text information to be processed.

7. The method according to claim 1, wherein the obtaining candidate similar text information matching the text information to be processed and determining the similarity between the text information to be processed and the candidate similar text information based on the text information to be processed, the associated text information and the associated text information context type comprises:

triggering a matched text information matching model based on the text information to be processed and the associated text information;

determining candidate similar text information embedding vectors corresponding to the candidate similar text information through a text information processing network of the text information matching model;

processing the text information embedding vector to be processed and the associated text information embedding vector through a multi-round matching network of the text information matching model to determine a first splicing feature vector;

and determining the similarity between the text information embedding vector to be processed and the candidate similar text information embedding vector based on the associated text information context type and the first splicing characteristic vector through a multi-round matching network of the text information matching model.

8. The method according to claim 1, wherein the obtaining candidate similar text information matching the text information to be processed and determining the similarity between the text information to be processed and the candidate similar text information based on the text information to be processed, the associated text information and the associated text information context type comprises:

determining candidate similar text information embedding vectors corresponding to the candidate similar text information through a text information processing network of the text information matching model;

processing the text information embedding vector to be processed and the associated text information embedding vector through a multi-round matching network of the text information matching model to determine a first splicing feature vector;

determining the similarity between the text information embedding vector to be processed and the candidate similar text information embedding vector based on the first splicing feature vector through a multi-round matching network of the text information matching model;

sequencing the similarity of the text information embedding vector to be processed and the candidate similar text information embedding vector according to the associated text information context type;

and determining the similarity between the text information to be processed and the candidate similar text information based on the sequencing result.

9. The method of claim 8, further comprising:

determining whether the candidate similar text information is in compliance based on the similarity between the text information to be processed and the candidate similar text information and a matched similarity threshold;

when the candidate similar text information is determined to be in compliance, adding the candidate similar text information to a text recommendation process;

sequencing recall sequences of all candidate similar text information in the text recommendation process;

and recommending the text information to the target user based on the sorting result of the candidate similar text information recall sequence.

10. The method of claim 1, further comprising:

acquiring a training sample set, wherein the training sample set comprises different text information samples marked by entities;

processing the training sample set through the text information matching model, and determining initial parameters of an associated text information context type discriminator network in the text information matching model and initial parameters of a multi-round matching network;

processing the training sample set through the text information matching model based on the initial parameters of the associated text information context type discriminator network and the initial parameters of the multi-round matching network, and respectively determining the updating parameters corresponding to the associated text information context type discriminator network and the updating parameters corresponding to the multi-round matching network;

and respectively carrying out iterative updating on the associated text information context type discriminator network and the multi-round matching network through the training sample set according to the updating parameters corresponding to the associated text information context type discriminator network and the updating parameters corresponding to the multi-round matching network.

11. The method of claim 10, further comprising:

determining a first loss function matched with the network of associated text information context type discriminators;

determining a second loss function matched with the multi-round matching network;

and determining a fusion loss function corresponding to the text information matching model based on the first loss function and the second loss function.

12. The method of claim 1, further comprising:

acquiring a training sample set matched with the context type of the text information to be processed from a data source based on the context type of the associated text information matched with the associated text information;

and determining model parameters of a text information matching model matched with the context type of the text information to be processed according to the training sample set matched with the context type of the text information to be processed.

13. A text information processing apparatus, characterized by comprising:

the information transmission module is used for acquiring text information to be processed in a text processing context and associated text information matched with the text to be processed;

the information processing module is used for determining the context type of the associated text information matched with the associated text information based on the text information to be processed and the associated text information;

the information processing module is used for acquiring candidate similar text information matched with the text information to be processed and determining the similarity between the text information to be processed and the candidate similar text information based on the text information to be processed, the associated text information and the context type of the associated text information;

and the information processing module is used for determining a reply sentence matched with the text information to be processed based on the similarity between the text information to be processed and the candidate similar text information.

14. An electronic device, characterized in that the electronic device comprises:

a memory for storing executable instructions;

a processor for implementing the method of processing text information according to any one of claims 1 to 12 when executing the executable instructions stored in the memory.

15. A computer-readable storage medium storing executable instructions, wherein the executable instructions, when executed by a processor, implement the text information processing method of any one of claims 1 to 12.

Background

With the development of machine learning technology, machine learning can answer questions of users in an artificial intelligence mode mechanism, wherein understanding of text information Query is a core technology in the fields of question and answer engines, conversation systems and other NLPs, requirements of users can be understood more accurately, and the system can give corresponding answers better. Query is usually a text or a text obtained after a sentence of speech is subjected to speech recognition, but for various context types such as "context irrelevant", "repeated questioning", "default question following", "referred question" and the like which are common in multiple rounds of question answering, the related technology cannot accurately recognize the context types, so that the processing of artificial intelligence on text information is influenced, and the accuracy of a processing result is poor.

Disclosure of Invention

In view of this, embodiments of the present invention provide a text information processing method and apparatus, an electronic device, and a storage medium, which can determine a context type of associated text information through the associated text information, so as to achieve a more accurate processing effect on the text information to be processed, so that a processing result of the text information to be processed is applicable to a current usage scenario, an influence on a generated reply sentence due to a lack of the associated text information is reduced, and a usage experience of a user is improved.

The technical scheme of the embodiment of the invention is realized as follows:

the embodiment of the invention provides a text information processing method, which comprises the following steps:

acquiring text information to be processed in a text processing context and associated text information matched with the text to be processed;

determining an associated text information context type matched with the associated text information based on the text information to be processed and the associated text information;

acquiring candidate similar text information matched with the text information to be processed, and determining the similarity between the text information to be processed and the candidate similar text information based on the text information to be processed, the associated text information and the associated text information context type;

and determining a reply sentence matched with the text information to be processed based on the similarity between the text information to be processed and the candidate similar text information.

An embodiment of the present invention further provides a text information processing apparatus, including:

the information transmission module is used for acquiring text information to be processed in a text processing context and associated text information matched with the text to be processed;

the information processing module is used for determining the context type of the associated text information matched with the associated text information based on the text information to be processed and the associated text information;

the information processing module is used for acquiring candidate similar text information matched with the text information to be processed and determining the similarity between the text information to be processed and the candidate similar text information based on the text information to be processed, the associated text information and the context type of the associated text information;

and the information processing module is used for determining a reply sentence matched with the text information to be processed based on the similarity between the text information to be processed and the candidate similar text information.

In the above-mentioned scheme, the first step of the method,

the information processing module is used for processing the text information to be processed and the associated text information through an associated text information context type discriminator network of the text information matching model and determining an associated text information context type matched with the associated text information; alternatively, the first and second electrodes may be,

determining a text information embedding vector to be processed corresponding to the text information to be processed through a text information processing network of the text information matching model;

determining an associated text information embedding vector corresponding to the associated text information through a text information processing network of the text information matching model;

and processing the text information embedding vector to be processed and the associated text information embedding vector through an associated text information context type discriminator network of the text information matching model, and determining an associated text information context type matched with the associated text information.

In the above-mentioned scheme, the first step of the method,

the information processing module is used for triggering the corresponding word segmentation libraries according to the text information parameters carried by the text information to be processed;

the information processing module is used for performing word segmentation processing on the text information to be processed based on the triggered word segmentation library word dictionary through a text information processing network of the text information matching model to form different word-level text information embedding vectors to be processed;

and the information processing module is used for denoising the different word-level text information embedding vectors to be processed to form a text information embedding vector set to be processed corresponding to the text information to be processed.

In the above-mentioned scheme, the first step of the method,

the information processing module is used for determining the name of a word segmentation library used when the word segmentation processing is carried out on the text information to be processed;

the information processing module is used for determining the parameters of the word segmentation library matched with the word level text information embedding vector corresponding to the text information to be processed according to the names of the word segmentation library, wherein the parameters of the word segmentation library comprise:

the category of the word-dividing library, the name of the word-dividing library and the version of the word-dividing library.

In the above-mentioned scheme, the first step of the method,

the information processing module is used for determining a dynamic noise threshold value matched with the text processing context;

the information processing module is used for carrying out denoising processing on the text information to be processed according to the dynamic noise threshold value and triggering a dynamic word segmentation strategy matched with the dynamic noise threshold value;

and the information processing module is used for performing word segmentation processing on the text information to be processed according to a dynamic word segmentation strategy matched with the dynamic noise threshold value to form text information embedding vectors to be processed corresponding to the text information to be processed.

In the above-mentioned scheme, the first step of the method,

the information processing module is used for determining a fixed noise threshold value matched with the text processing context;

the information processing module is used for carrying out denoising processing on the text information to be processed according to the fixed noise threshold value and triggering a fixed word segmentation strategy matched with the fixed noise threshold value;

and the information processing module is used for performing word segmentation processing on the text information to be processed according to a fixed word segmentation strategy matched with the fixed noise threshold value to form text information embedding vectors to be processed corresponding to the text information to be processed.

In the above-mentioned scheme, the first step of the method,

the information processing module is used for determining candidate similar text information embedding vectors corresponding to the candidate similar text information through a text information processing network of the text information matching model;

the information processing module is used for processing the text information embedding vector to be processed and the associated text information embedding vector through a multi-round matching network of the text information matching model to determine a first splicing characteristic vector;

the information processing module is used for determining the similarity between the text information embedding vector to be processed and the candidate similar text information embedding vector based on the associated text information context type and the first splicing feature vector through a multi-round matching network of the text information matching model.

In the above-mentioned scheme, the first step of the method,

the information processing module is used for determining candidate similar text information embedding vectors corresponding to the candidate similar text information through a text information processing network of the text information matching model;

the information processing module is used for processing the text information embedding vector to be processed and the associated text information embedding vector through a multi-round matching network of the text information matching model to determine a first splicing characteristic vector;

the information processing module is used for determining the similarity between the text information embedding vector to be processed and the candidate similar text information embedding vector based on the first splicing feature vector through a multi-round matching network of the text information matching model;

the information processing module is used for sequencing the similarity between the text information embedding vector to be processed and the candidate similar text information embedding vector according to the associated text information context type;

and the information processing module is used for determining the similarity between the text information to be processed and the candidate similar text information based on the sequencing result.

In the above scheme, the apparatus further comprises:

the training module is used for acquiring a training sample set, wherein the training sample set comprises different text information samples marked by entities;

the training module is used for processing the training sample set through the text information matching model and determining initial parameters of an associated text information context type discriminator network and initial parameters of a multi-round matching network in the text information matching model;

the training module is used for processing the training sample set through the text information matching model based on the initial parameters of the associated text information context type discriminator network and the initial parameters of the multi-round matching networks, and respectively determining the updating parameters corresponding to the associated text information context type discriminator network and the updating parameters corresponding to the multi-round matching networks;

and the training module is used for respectively carrying out iterative updating on the associated text information context type discriminator network and the multi-round matching network through the training sample set according to the updating parameters corresponding to the associated text information context type discriminator network and the updating parameters corresponding to the multi-round matching network.

In the above-mentioned scheme, the first step of the method,

the training module is used for determining a first loss function matched with the associated text information context type discriminator network;

the training module is used for determining a second loss function matched with the multi-round matching network;

and the training module is used for determining a fusion loss function corresponding to the text information matching model based on the first loss function and the second loss function.

In the above-mentioned scheme, the first step of the method,

the training module is used for acquiring a training sample set matched with the context type of the text information to be processed from a data source based on the context type of the associated text information matched with the associated text information;

and the training module is used for determining model parameters of a text information matching model matched with the context type of the text information to be processed according to the training sample set matched with the context type of the text information to be processed.

An embodiment of the present invention further provides an electronic device, where the electronic device includes:

a memory for storing executable instructions;

and the processor is used for realizing the text information processing method of the preamble when the executable instruction stored in the memory is operated.

The embodiment of the invention also provides a computer-readable storage medium, which stores executable instructions and is characterized in that the executable instructions are executed by a processor to realize the text information processing method of the preamble.

The embodiment of the invention has the following beneficial effects:

the method comprises the steps of obtaining text information to be processed in a text processing context and associated text information matched with the text to be processed; determining an associated text information context type matched with the associated text information based on the text information to be processed and the associated text information; acquiring candidate similar text information matched with the text information to be processed, and determining the similarity between the text information to be processed and the candidate similar text information based on the text information to be processed, the associated text information and the associated text information context type; and determining a reply sentence matched with the text information to be processed based on the similarity between the text information to be processed and the candidate similar text information. Therefore, the context type of the associated text information can be determined through the associated text information, the processing effect of the text information to be processed is more accurate, the processing result of the text information to be processed is suitable for the current use scene, the influence of the lack of the associated text information on the generated reply sentences is reduced, the universal reply is reduced, the matching property and the foresight property of the reply can be improved, and the use experience of a user is improved.

Drawings

Fig. 1 is a schematic view of a usage scenario of a text information processing method according to an embodiment of the present invention;

FIG. 2 is a schematic diagram of a structure of a text message processing apparatus according to an embodiment of the present invention;

FIG. 3 is a diagram illustrating a reply sentence generated by a base text information matching model in the related art;

fig. 4 is a schematic data structure diagram of a text information processing method according to an embodiment of the present invention;

fig. 5 is a schematic flow chart of an alternative text information processing method according to an embodiment of the present invention;

FIG. 6 is a diagram illustrating text message processing via a applet in an embodiment of the invention;

fig. 7 is a schematic data structure diagram of a text information processing method according to an embodiment of the present invention;

fig. 8 is a schematic data structure diagram of a text information processing method according to an embodiment of the present invention;

FIG. 9 is a diagram illustrating a text matching process in an embodiment of the invention;

fig. 10 is a schematic flow chart of an alternative text information processing method according to an embodiment of the present invention;

FIG. 11 is a diagram of an application environment of a text information matching model according to an embodiment of the present invention;

fig. 12 is a schematic diagram of a working process of the text information matching model according to the embodiment of the present invention.

Detailed Description

In order to make the objects, technical solutions and advantages of the present invention clearer, the present invention will be further described in detail with reference to the accompanying drawings, the described embodiments should not be construed as limiting the present invention, and all other embodiments obtained by a person of ordinary skill in the art without creative efforts shall fall within the protection scope of the present invention.

In the following description, reference is made to "some embodiments" which describe a subset of all possible embodiments, but it is understood that "some embodiments" may be the same subset or different subsets of all possible embodiments, and may be combined with each other without conflict.

Before further detailed description of the embodiments of the present invention, terms and expressions mentioned in the embodiments of the present invention are explained, and the terms and expressions mentioned in the embodiments of the present invention are applied to the following explanations.

1) In response to the condition or state on which the performed operation depends, one or more of the performed operations may be in real-time or may have a set delay when the dependent condition or state is satisfied; there is no restriction on the order of execution of the operations performed unless otherwise specified.

2) Word segmentation: also known as word segmentation, functions to segment the textual information of a complete sentence into a plurality of words, such as: XX is a Chinese singer. The result after word segmentation is: XX, China, singer.

3) A word bank is divided: the term segmentation library refers to a specific word segmentation method, and word dictionaries corresponding to different term segmentation libraries can be used for carrying out word segmentation processing on corresponding text information according to the word dictionaries corresponding to the term segmentation libraries.

4) token: the word unit, before any actual processing of the input text, needs to be divided into language units such as words, punctuation, numbers or pure alphanumerics. These units are called word units.

5) Twin neural networks (siamese networks): in the pseudo-twin neural network, two neural networks corresponding to input data may be different neural networks, or two neural networks may be the same type of neural network. The pseudo-twin neural network is adapted to handle the case where two inputs are "somewhat different". The text processing method is realized in a pseudo-twin neural network

6) And (4) model training, namely performing multi-classification learning on the image data set. The model can be constructed by adopting deep learning frames such as Tensor Flow, torch and the like, and a multi-classification model is formed by combining multiple layers of neural network layers such as CNN and the like. The input of the model is a three-channel or original channel matrix formed by reading an image through openCV and other tools, the output of the model is multi-classification probability, and the webpage category is finally output through softmax and other algorithms. During training, the model approaches to a correct trend through an objective function such as cross entropy and the like.

7) Neural Networks (NN): an Artificial Neural Network (ANN), referred to as Neural Network or Neural Network for short, is a mathematical model or computational model that imitates the structure and function of biological Neural Network (central nervous system of animals, especially brain) in the field of machine learning and cognitive science, and is used for estimating or approximating functions.

8) Bidirectional attention neural network model (BERT Bidirectional Encoder responses from transformations) Google. Transformers: a new network structure adopts an attention mechanism to replace the mode that a traditional coder-decoder must depend on other neural networks, and the method is widely used for various natural language processing tasks such as text classification, text matching, machine reading understanding and the like.

9) A Mini Program (Program) is a Program developed based on a front-end-oriented Language (e.g., JavaScript) and implementing a service in a hypertext Markup Language (HTML) page, and software downloaded by a client (e.g., a browser or any client embedded in a browser core) via a network (e.g., the internet) and interpreted and executed in a browser environment of the client saves steps installed in the client. For example, the small program in the terminal is awakened through a voice instruction, so that the small program for realizing various services such as air ticket purchase, task processing and making, data display and the like can be downloaded and run in the social network client.

Fig. 1 is a schematic view of a usage scenario of a text information processing method according to an embodiment of the present invention, and referring to fig. 1, a terminal (including a terminal 10-1 and a terminal 10-2) is provided with corresponding clients capable of executing different functions, the client is a terminal (including a terminal 10-1 and a terminal 10-2) which obtains different articles from a corresponding server 200 through a network 300 to browse or obtain applets or public numbers stored in the server, when the terminal runs an instant messaging client process, a corresponding reply sentence can be acquired from the input question sentence by the provided question-answering function, the obtained reply sentences can be candidate reply sentences obtained from reply contents in different contents such as a friend circle, an applet, an article, a public number and the like, and also can be reply sentences which are obtained by the medical robot and are adaptive to a medical application scene environment. The terminal is connected to the server 200 through the network 300, the network 300 may be a wide area network or a local area network, or a combination of the two, and data transmission is achieved by using a wireless link, wherein a client which may also have chat software is arranged on the terminal (including the terminal 10-1 and the terminal 10-2), a user may input a corresponding question sentence through the arranged chat client, and the chat client may also receive a corresponding reply sentence and display the received reply sentence to the user.

In some embodiments of the invention, the different types of applets maintained in server 200 may be written in software code environments in different programming languages, and the code objects may be different types of code entities. For example, in the software code of C language, one code object may be one function. In the software code of JAVA language, a code object may be a class, and the OC language of IOS terminal may be a target code. In the software code of C + + language, a code object may be a class or a function to execute text information from different terminals. Wherein no distinction is made in the present application between the sources of the retrieval instructions. The applet (Mini Program) is a Program developed based on a front-end-oriented Language (e.g., JavaScript) and used for realizing services in a hypertext Markup Language (HTML) page, and is software which is downloaded by a client (e.g., any client with a browser or an embedded browser core) through a network (e.g., the internet) and interpreted and executed in a browser environment of the client, so that steps installed in the client are saved. For example, the small program in the terminal is awakened through a voice instruction, so that the small program for realizing various services such as air ticket purchase, task processing and making, data display and the like can be downloaded and run in the social network client.

The server 200 transmits a reply sentence of the corresponding text message to the terminal (the terminal 10-1 and/or the terminal 10-2) through the network 300 according to the keyword recognized by the terminal, and thus. As an example, the server 200 may be configured to obtain text information to be processed in a text processing context and associated text information matched with the text to be processed; determining an associated text information context type matched with the associated text information based on the text information to be processed and the associated text information; acquiring candidate similar text information matched with the text information to be processed, and determining the similarity between the text information to be processed and the candidate similar text information based on the text information to be processed, the associated text information and the associated text information context type; and determining a reply sentence matched with the text information to be processed based on the similarity between the text information to be processed and the candidate similar text information.

The text information processing method provided by the embodiment of the application is realized based on Artificial Intelligence (AI), which is a theory, method, technology and application system for simulating, extending and expanding human Intelligence by using a digital computer or a machine controlled by the digital computer, sensing the environment, acquiring knowledge and obtaining the best result by using the knowledge. In other words, artificial intelligence is a comprehensive technique of computer science that attempts to understand the essence of intelligence and produce a new intelligent machine that can react in a manner similar to human intelligence. Artificial intelligence is the research of the design principle and the realization method of various intelligent machines, so that the machines have the functions of perception, reasoning and decision making.

The artificial intelligence technology is a comprehensive subject and relates to the field of extensive technology, namely the technology of a hardware level and the technology of a software level. The artificial intelligence infrastructure generally includes technologies such as sensors, dedicated artificial intelligence chips, cloud computing, distributed storage, big data processing technologies, operation/interaction systems, mechatronics, and the like. The artificial intelligence software technology mainly comprises a computer vision technology, a voice processing technology, a natural language processing technology, machine learning/deep learning and the like.

In the embodiment of the present application, the artificial intelligence software technology mainly involved includes the above-mentioned voice processing technology and machine learning and other directions. For example, the present invention may relate to a Speech Recognition Technology (ASR) in Speech Technology (Speech Technology), which includes Speech signal preprocessing (Speech signal preprocessing), Speech signal frequency domain analysis (Speech signal analysis), Speech signal feature extraction (Speech signal feature extraction), Speech signal feature matching/Recognition (Speech signal feature matching/Recognition), training of Speech (Speech training), and the like.

For example, Machine Learning (ML) may be involved, which is a multi-domain cross discipline, involving probability theory, statistics, approximation theory, convex analysis, algorithm complexity theory, and so on. The special research on how a computer simulates or realizes the learning behavior of human beings so as to acquire new knowledge or skills and reorganize the existing knowledge structure to continuously improve the performance of the computer. Machine learning is the core of artificial intelligence, is the fundamental approach for computers to have intelligence, and is applied to all fields of artificial intelligence. Machine Learning generally includes techniques such as Deep Learning (Deep Learning), which includes artificial Neural networks (artificial Neural networks), such as Convolutional Neural Networks (CNN), Recurrent Neural Networks (RNN), Deep Neural Networks (DNN), and the like.

It can be understood that the text information processing method and the voice processing provided by the present application can be applied to an Intelligent device (Intelligent device), and the Intelligent device can be any device with a voice instruction recognition function, for example, an Intelligent terminal, an Intelligent home device (such as an Intelligent sound box, an Intelligent washing machine, etc.), an Intelligent wearable device (such as an Intelligent watch), a vehicle-mounted Intelligent central control system (which wakes up an applet in the terminal to execute different tasks through a voice instruction), or an AI Intelligent medical device (which wakes up and triggers through a voice instruction), and the like.

As will be described in detail below, the structure of the text message processing apparatus according to the embodiment of the present invention may be implemented in various forms, such as a dedicated terminal with a text message processing function, or a server with a text message processing function, such as the server 200 in fig. 1. Fig. 2 is a schematic diagram of a composition structure of a text information processing apparatus according to an embodiment of the present invention, and it is understood that fig. 2 only shows an exemplary structure of the text information processing apparatus, and not a whole structure thereof, and a part of or the whole structure shown in fig. 2 may be implemented as needed.

The text information processing device provided by the embodiment of the invention comprises: at least one processor 201, memory 202, user interface 203, and at least one network interface 204. The various components of the text information processing apparatus are coupled together by a bus system 205. It will be appreciated that the bus system 205 is used to enable communications among the components. The bus system 205 includes a power bus, a control bus, and a status signal bus in addition to a data bus. For clarity of illustration, however, the various buses are labeled as bus system 205 in fig. 2.

The user interface 203 may include, among other things, a display, a keyboard, a mouse, a trackball, a click wheel, a key, a button, a touch pad, or a touch screen.

It will be appreciated that the memory 202 can be either volatile memory or nonvolatile memory, and can include both volatile and nonvolatile memory. The memory 202 in embodiments of the present invention is capable of storing data to support operation of the terminal (e.g., 10-1). Examples of such data include: any computer program, such as an operating system and application programs, for operating on a terminal (e.g., 10-1). The operating system includes various system programs, such as a framework layer, a core library layer, a driver layer, and the like, and is used for implementing various basic services and processing hardware-based tasks. The application program may include various application programs.

In some embodiments, the text information processing apparatus provided in the embodiments of the present invention may be implemented by a combination of hardware and software, and by way of example, the text information processing apparatus provided in the embodiments of the present invention may be a processor in the form of a hardware decoding processor, which is programmed to execute the text information processing method provided in the embodiments of the present invention. For example, a processor in the form of a hardware decoding processor may employ one or more Application Specific Integrated Circuits (ASICs), DSPs, Programmable Logic Devices (PLDs), Complex Programmable Logic Devices (CPLDs), Field Programmable Gate Arrays (FPGAs), or other electronic components.

As an example of the text information processing apparatus provided by the embodiment of the present invention implemented by combining software and hardware, the text information processing apparatus provided by the embodiment of the present invention may be directly embodied as a combination of software modules executed by the processor 201, where the software modules may be located in a storage medium, the storage medium is located in the memory 202, and the processor 201 reads executable instructions included in the software modules in the memory 202, and completes the text information processing method provided by the embodiment of the present invention in combination with necessary hardware (for example, including the processor 201 and other components connected to the bus 205).

By way of example, the Processor 201 may be an integrated circuit chip having Signal processing capabilities, such as a general purpose Processor, a Digital Signal Processor (DSP), or other programmable logic device, discrete gate or transistor logic, discrete hardware components, or the like, wherein the general purpose Processor may be a microprocessor or any conventional Processor or the like.

As an example of the text information processing apparatus provided by the embodiment of the present invention implemented by hardware, the apparatus provided by the embodiment of the present invention may be implemented by directly using the processor 201 in the form of a hardware decoding processor, for example, by being executed by one or more Application Specific Integrated Circuits (ASICs), DSPs, Programmable Logic Devices (PLDs), Complex Programmable Logic Devices (CPLDs), Field Programmable Gate Arrays (FPGAs), or other electronic components, to implement the text information processing method provided by the embodiment of the present invention.

The memory 202 in the embodiment of the present invention is used to store various types of data to support the operation of the text information processing apparatus. Examples of such data include: any executable instructions for operating on the text information processing apparatus, such as executable instructions, a program that implements the text information processing method of the embodiment of the present invention may be contained in the executable instructions.

In other embodiments, the text information processing apparatus provided in the embodiments of the present invention may be implemented by software, and fig. 2 shows the text information processing apparatus stored in the memory 202, which may be software in the form of programs, plug-ins, and the like, and includes a series of modules, and as an example of the programs stored in the memory 202, the text information processing apparatus may include the following software modules, namely, an information transmission module 2081 and an information processing module 2082. When the software modules in the text information processing apparatus are read into the RAM by the processor 201 and executed, the functions of the software modules in the text information processing apparatus according to the embodiment of the present invention will be described below, in which,

the information transmission module 2081 is configured to obtain text information to be processed in a text processing context and associated text information matched with the text to be processed.

The information processing module 2082 is configured to determine, based on the to-be-processed text information and the associated text information, an associated text information context type matched with the associated text information.

The information processing module 2082 is configured to obtain candidate similar text information matched with the to-be-processed text information, and determine similarity between the to-be-processed text information and the candidate similar text information based on the to-be-processed text information, the associated text information, and the associated text information context type.

The information processing module 2082 is configured to determine a reply sentence matched with the to-be-processed text information based on the similarity between the to-be-processed text information and the candidate similar text information.

According to the electronic device shown in fig. 2, in one aspect of the present application, the present application also provides a computer program product or a computer program comprising computer instructions stored in a computer readable storage medium. The processor of the computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions to cause the computer device to execute different embodiments and combinations of embodiments provided in various alternative implementations of the text information processing method.

Before describing the method of the text information processing apparatus according to the embodiment of the present invention, first, in the related art, in a process of generating a corresponding reply sentence according to a question text by using a conventional text information matching model, a schematic diagram of generating a reply sentence by using a base text information matching model in the related art is described in fig. 3, where in the conventional end-to-end text retrieval method based on context information, a matching effect of multiple rounds of information is improved mainly by using a matching process of an optimization model. As shown in fig. 3, multiple rounds of question-answering sentences are combined into a column, the joints are separated by _ SOS _ and the whole dialogue history is regarded as a complete vector sentence to match the next sentence answering sentence. And then a multi-view matching mechanism is introduced in the matching process to enhance the matching effect. Specifically, the whole dialog history is combined into a column, word-level features are extracted through a GRU module after the characters are embedded into a vector word embedding, and the word-level features are matched with a candidate answer sentence response, and the process only uses data driving to enhance the model matching effect. Therefore, the method has high requirement on data, increases the calculation burden of the terminal equipment, and is not beneficial to the processing of the mobile terminal on the text information.

Referring to fig. 4, fig. 4 is a data structure diagram of a text information processing method according to an embodiment of the present invention, a method for rewriting a context Query to generate a reply sentence mainly rewrites a current user Query in an extraction formula or a generation formula by using context information, replaces an original Query with the rewritten Query, and converts multi-round matching into single-round matching by the method. Specifically, the user input a1 and the system reply B1 need to be connected, and then output as a Query after rewriting, together with the user input a2 (sentence to be rewritten), as an input of the rewrite model. However, in the related art, the effect of rewriting the model is not controllable, a large amount of rewriting deviation is introduced in the rewriting process, so that new noise is introduced in multiple rounds of conversation, and adaptive adjustment cannot be performed according to the context type of the associated text information of the context.

In order to overcome the above-mentioned drawbacks, referring to fig. 5, fig. 5 is an optional flowchart of the text message processing method according to the embodiment of the present invention, and it can be understood that the steps shown in fig. 5 can be executed by various electronic devices operating the text message processing apparatus, such as a dedicated terminal with text message answering function, a mobile phone, or a communication apparatus operating a small program with a retrieval function. The following is a description of the steps shown in fig. 5.

Step 501: and acquiring to-be-processed text information in the text processing context and associated text information matched with the to-be-processed text.

Wherein the sources of the text information to be processed in different text processing contexts may be different, for example: in the intelligent medical terminal, the text information to be processed can be diagnosis and treatment problem information input by a patient. In the media asset using environment of the mobile terminal, the text information to be processed may be the text information of the voice question input by the user and received by the smart speaker and the vehicle-mounted smart system.

In some embodiments of the present invention, a corresponding word segmentation library may be triggered according to a text information parameter carried by the text information to be processed; performing word segmentation processing on the text information to be processed based on the triggered word segmentation library word dictionary through a text information processing network of the text information matching model to form different word-level text information embedding vectors to be processed; and denoising the different word-level text information embedding vectors to be processed to form a text information embedding vector set to be processed corresponding to the text information to be processed. Determining the name of a word segmentation library used when the word segmentation processing is carried out on the text information to be processed; determining the parameters of the word segmentation library matched with the word level text information embedding vector corresponding to the text information to be processed according to the names of the word segmentation library, wherein the parameters of the word segmentation library comprise: the category of the word-dividing library, the name of the word-dividing library and the version of the word-dividing library.

Referring to fig. 6, fig. 6 is a schematic diagram of text information processing performed by a applet in an embodiment of the present invention, where, in conjunction with the description of the preceding embodiment, different terminal devices (for example, the terminal 10-1 and/or the terminal 10-2 shown in the preceding fig. 1) may provide, on respective corresponding question-answer interfaces (for example, a web page, an information question-answer APP, and a question-answer applet for performing data question-answer on the keyword to be question-answered, a user may input text information in the question-answer field by a voice instruction, and when the terminal device detects a click operation on the question-answer key, the server is triggered to start a corresponding word segmentation instruction, where the word segmentation instruction carries the keyword in the question-answer field, and the server receives the word segmentation instruction. Or the terminal device displays the hot question and answer keywords on a question and answer interface, when the click operation on the hot question and answer keywords is detected, the terminal device sends the word segmentation instruction to the server, the word segmentation instruction carries the hot question and answer keywords, and the server receives the word segmentation instruction. It should be noted that the embodiment of the present invention does not limit the triggering manner of the word segmentation instruction.

Because the formed word-level feature vectors are not completely the same when different word banks are used for processing the same text information, the parameters of the word banks matched with the word-level feature vectors corresponding to the text information to be processed are determined according to the names of the word banks, so that the parameters of the word banks used for word splitting of the text information to be processed are determined, for example: after the text information to be processed is processed by using the word segmentation library A, a word level characteristic vector set A (credit card; due; how to do) corresponding to the text information to be processed is formed; after the word segmentation library B is used for processing, a word level characteristic vector set B (credit card expiration; how to do) corresponding to the text information to be processed is formed; after being processed by the word segmentation library A1, a word level feature vector set A1 (credit card, how due) corresponding to the text information to be processed is formed.

In some embodiments of the invention, a dynamic noise threshold may be determined that matches the text processing context; denoising the text information to be processed according to the dynamic noise threshold, and triggering a dynamic word segmentation strategy matched with the dynamic noise threshold; and performing word segmentation processing on the text information to be processed according to a dynamic word segmentation strategy matched with the dynamic noise threshold value to form text information embedding vectors to be processed corresponding to the text information to be processed. Alternatively, determining a fixed noise threshold that matches the text processing context; denoising the text information to be processed according to the fixed noise threshold, and triggering a fixed word segmentation strategy matched with the fixed noise threshold; and performing word segmentation processing on the text information to be processed according to a fixed word segmentation strategy matched with the fixed noise threshold value to form text information embedding vectors to be processed corresponding to the text information to be processed. When the word vector processing network is solidified in a corresponding hardware mechanism, such as an intelligent triage system in a hospital, and the using environment is processing spoken instructions related to medical information and extracting keywords, due to the fact that noise is single, the training speed of the word vector processing network can be effectively refreshed through the fixed noise threshold corresponding to the fixed word vector processing network, the waiting time of a user is shortened, and the word vector processing network is more suitable for the using environment of the intelligent triage in the hospital.

Step 502: and determining the associated text information context type matched with the associated text information based on the text information to be processed and the associated text information.

In some embodiments of the present invention, determining the associated text information context type matching the associated text information based on the text information to be processed and the associated text information may be implemented by:

triggering a matched text information matching model based on the text information to be processed and the associated text information; processing the text information to be processed and the associated text information through an associated text information context type discriminator network of the text information matching model to determine an associated text information context type matched with the associated text information; or determining a text information embedding vector to be processed corresponding to the text information to be processed through a text information processing network of the text information matching model; determining an associated text information embedding vector corresponding to the associated text information through a text information processing network of the text information matching model; and processing the text information embedding vector to be processed and the associated text information embedding vector through an associated text information context type discriminator network of the text information matching model, and determining an associated text information context type matched with the associated text information.

Referring to fig. 7, fig. 7 is a schematic data structure diagram of the text information processing method according to the embodiment of the present invention, where the associated text information context type discriminator network and the multi-round matching network may present a serial structure, and when the context type discriminator network and the multi-round matching network are serially combined, the context type discrimination and the multi-round matching process may be executed serially, and the type determination is performed through the context, and then the determination result information, the question context information, and the Query of the current user are used together as part of the input of the matching model to perform the matching process of the multi-round retrieval. Through the context type discriminator network of the associated text information of the text information matching model, the advantages of processing the text information to be processed and the associated text information are that the model training can be gradually carried out in stages in an off-line mode, the model training can be carried out in a serial mode after the model training is deployed, flexible adaptation can be conveniently carried out on the line, and the adjusting time after the model application is reduced. Further, when a serial structure is used, candidate similar text information matched with the text information to be processed is obtained, and the similarity between the text information to be processed and the candidate similar text information is determined based on the text information to be processed, the associated text information and the associated text information context type, which can be realized by the following steps:

determining candidate similar text information embedding vectors corresponding to the candidate similar text information through a text information processing network of the text information matching model; processing the text information embedding vector to be processed and the associated text information embedding vector through a multi-round matching network of the text information matching model to determine a first splicing feature vector; and determining the similarity between the text information embedding vector to be processed and the candidate similar text information embedding vector based on the associated text information context type and the first splicing characteristic vector through a multi-round matching network of the text information matching model.

Referring to fig. 8, fig. 8 is a data structure diagram of the text information processing method according to the embodiment of the present invention, and the context type discriminator network for associated text information and the multi-round matching network may also have a parallel structure, where the multi-round matching network may use a Siamese-BERT structure, and the left and right BERT models do not share parameters and keep independent calculation.

Step 503: and acquiring candidate similar text information matched with the text information to be processed, and determining the similarity between the text information to be processed and the candidate similar text information based on the text information to be processed, the associated text information and the associated text information context type. Referring to fig. 9, fig. 9 is a schematic diagram of a text matching process in an embodiment of the present invention, and when a related text information context type discriminator network and a multi-round matching network may also present a parallel structure, candidate similar text information embedding vectors corresponding to the candidate similar text information are determined through a text information processing network of the text information matching model; processing the text information embedding vector to be processed and the associated text information embedding vector through a multi-round matching network of the text information matching model to determine a first splicing feature vector; determining the similarity between the text information embedding vector to be processed and the candidate similar text information embedding vector based on the first splicing feature vector through a multi-round matching network of the text information matching model; sequencing the similarity of the text information embedding vector to be processed and the candidate similar text information embedding vector according to the associated text information context type; and determining the similarity between the text information to be processed and the candidate similar text information based on the sequencing result.

Step 504: and determining a reply sentence matched with the text information to be processed based on the similarity between the text information to be processed and the candidate similar text information.

Of course, training the text information matching model is needed before using the text information matching model, where fig. 10 is an optional flowchart of the text information processing method provided in the embodiment of the present invention, and referring to fig. 10, it can be understood that the steps shown in fig. 10 may be executed by various electronic devices operating the text information processing apparatus, for example, a dedicated terminal with text information answering function, a mobile phone, or a communication apparatus operating a search function applet, so as to implement training the text information matching model, and deploy the trained text information matching model in a server. The following is a description of the steps shown in fig. 10.

Step 1001: acquiring a training sample set, wherein the training sample set comprises different text information samples marked by entities.

Specifically, a training sample set matched with the context type of the text information to be processed can be obtained in a data source based on the context type of the associated text information matched with the associated text information; and determining model parameters of a text information matching model matched with the context type of the text information to be processed according to the training sample set matched with the context type of the text information to be processed.

Step 1002: and processing the training sample set through the text information matching model, and determining initial parameters of an associated text information context type discriminator network in the text information matching model and initial parameters of a multi-round matching network.

Step 1003: processing the training sample set through the text information matching model based on the initial parameters of the associated text information context type discriminator network and the initial parameters of the multi-round matching networks, and respectively determining the updating parameters corresponding to the associated text information context type discriminator network and the updating parameters corresponding to the multi-round matching networks.

Step 1004: and respectively carrying out iterative updating on the associated text information context type discriminator network and the multi-round matching network through the training sample set according to the updating parameters corresponding to the associated text information context type discriminator network and the updating parameters corresponding to the multi-round matching network.

Specifically, a first loss function matched with an associated text information context type discriminator network can be determined in the process of respectively carrying out iterative updating on the associated text information context type discriminator network and a multi-round matching network through a training sample set; determining a second loss function matched with the multi-round matching network; determining a fusion loss function corresponding to the text information matching model based on the first loss function and the second loss function, wherein when the associated text information context type discriminator network and the multi-round matching network can also present a serial structure, model parameters in training refer to formula 1:

the associated text information context type discriminator network and the multi-round matching network can also present a parallel structure, and the model parameters in the training refer to formula 2:

in the test use stage, only the context, the current query and the candidate are required to be input, and stage prediction is not required. Therefore, the waiting time of the user can be saved, and the user of the text information matching model can obtain better use experience. When the usage scenario of the text information matching model is a non-chinese usage scenario (which may be a usage environment of a single english language or other languages, or a usage environment including at least two language question and statement sources), the corresponding bilingual evaluation research value determined according to the negative example sample set may be used as a supervision parameter to evaluate the semantic understanding result of the text information matching model.

In some embodiments of the present invention, the decoder in the text information matching model may be a bidirectional network model, for example, Bi-GRU bidirectional GRU models may be used as the corresponding encoder and the corresponding decoder, where the Bi-GRU bidirectional GRU model is a model that can recognize a flip sentence structure. When a user inputs a question sentence, the dialog sentence may be in an inverted sentence structure, that is, the dialog sentence structure is different from a normal sentence structure, for example, the dialog sentence input by the user is 'married and married in summer', and the normal sentence structure is 'married in summer', and the dialog sentence in the inverted sentence structure can be identified by adopting a Bi-GRU bidirectional GRU model, so that the functions of the trained model can be enriched, and the robustness of a text information matching model obtained by final training can be improved.

The text information matching model provided in the embodiment of the present invention is described below with a text information matching model encapsulated in a corresponding APP, where fig. 11 is an application environment schematic diagram of the text information matching model in the embodiment of the present invention, as shown in fig. 11, with the development of a human-computer interaction technology, more and more intelligent products based on the human-computer interaction technology come into operation, for example, an automatic answering robot of an instant messaging client, and these intelligent products can communicate with a user by chatting and generate corresponding answer information according to the questions of the user. However, the generated answer information is usually a high-frequency general reply or an incorrect reply information, and what the opposite user desires to obtain is exactly the reply sentence shown on the right side of fig. 11, but the replies generated on the left side of fig. 11 often have no practical meaning and do not conform to the context of the text information matching model (for example, different text information matching models need to generate the most appropriate reply sentence according to the context of the use environment model), and the related art can only generate one corresponding reply sentence according to one question sentence, but cannot generate a plurality of corresponding sentences and replies according to one question sentence and the corresponding human setting information of the virtual robot, so that the use experience of the user is affected.

Fig. 12 is a schematic diagram of a working process of the text information matching model according to the embodiment of the present invention, which specifically includes the following steps:

step 1201: and acquiring the text information to be processed and the associated text information, and triggering a text information matching model in the instant messaging APP.

Step 1202: and determining the associated text information context type matched with the associated text information based on the conversation information in the instant messaging APP.

Step 1203: and determining the similarity between the text information to be processed and the candidate similar text information.

Step 1204: and determining whether the candidate similar text information is in compliance based on the similarity between the text information to be processed and the candidate similar text information and the matched similarity threshold.

Step 1205: when candidate similar text information compliance is determined, the candidate similar text information is added to a text recommendation process.

Step 1206: sequencing recall sequences of all candidate similar text information in the text recommendation process;

step 1207: and recommending the text information to the target user based on the sorting result of the candidate similar text information recall sequence.

Therefore, the context type of the associated text information can be determined through the associated text information, the processing effect of the text information to be processed is more accurate, the current use scene is adapted, and the user can obtain better automatic conversation experience in the instant messaging APP.

The invention has the following beneficial technical effects:

the method comprises the steps of obtaining text information to be processed in a text processing context and associated text information matched with the text to be processed; determining an associated text information context type matched with the associated text information based on the text information to be processed and the associated text information; acquiring candidate similar text information matched with the text information to be processed, and determining the similarity between the text information to be processed and the candidate similar text information based on the text information to be processed, the associated text information and the associated text information context type; and determining a reply sentence matched with the text information to be processed based on the similarity between the text information to be processed and the candidate similar text information. Therefore, the context type of the associated text information can be determined through the associated text information, the processing effect of the text information to be processed is more accurate, the processing result of the text information to be processed is suitable for the current use scene, the influence of the lack of the associated text information on the generated reply sentences is reduced, the universal reply is reduced, the matching property and the foresight property of the reply can be improved, and the use experience of a user is improved.

The above description is only exemplary of the present invention and should not be taken as limiting the scope of the present invention, and any modifications, equivalents, improvements, etc. made within the spirit and principle of the present invention should be included in the scope of the present invention.

完整详细技术资料下载
上一篇:石墨接头机器人自动装卡簧、装栓机
下一篇:文章原创检查方法、装置及存储介质

网友询问留言

已有0条留言

还没有人留言评论。精彩留言会获得点赞!

精彩留言,会给你点赞!