CN109543014B - Man-machine conversation method, device, terminal and server - Google Patents

Man-machine conversation method, device, terminal and server Download PDF

Info

Publication number
CN109543014B
CN109543014B CN201811309389.2A CN201811309389A CN109543014B CN 109543014 B CN109543014 B CN 109543014B CN 201811309389 A CN201811309389 A CN 201811309389A CN 109543014 B CN109543014 B CN 109543014B
Authority
CN
China
Prior art keywords
answer
question
target
candidate
query
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201811309389.2A
Other languages
Chinese (zh)
Other versions
CN109543014A (en
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.)
Tencent Technology Shenzhen Co Ltd
Original Assignee
Tencent Technology Shenzhen 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 Tencent Technology Shenzhen Co Ltd filed Critical Tencent Technology Shenzhen Co Ltd
Priority to CN201811309389.2A priority Critical patent/CN109543014B/en
Publication of CN109543014A publication Critical patent/CN109543014A/en
Application granted granted Critical
Publication of CN109543014B publication Critical patent/CN109543014B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Abstract

The invention provides a man-machine conversation method, a man-machine conversation device, a terminal and a server, wherein the method comprises the steps of obtaining a query parameter set, wherein the query parameter set comprises a query statement and basic information of a target user, and the target user is a user issuing the query statement; acquiring a question-answer pair data set corresponding to the target user according to the basic information of the target user; extracting candidate question-answer pairs corresponding to the query sentences from the question-answer pair data set to obtain a first candidate set; judging whether the first candidate set is empty or not; and if the first candidate set is not empty, selecting a target answer from the first candidate set, and outputting the target answer. The invention supports the user to individually configure the question-answer pair data set belonging to the user, thereby improving the accuracy of man-machine conversation. On the premise of allowing the question-answer pairs to be customized, a public data set is provided, so that the recall rate of man-machine conversation is guaranteed.

Description

Man-machine conversation method, device, terminal and server
Technical Field
The invention relates to the field of computers, in particular to a man-machine conversation method, a man-machine conversation device, a terminal and a server.
Background
The existing man-machine conversation robot mainly uses two technical schemes, one is to generate answers to questions by adopting a deep learning method aiming at each question, and a flow chart of the existing man-machine conversation robot is shown in fig. 1. The method has the advantages of high recall rate, namely basically giving answers to each query statement of a user, and low accuracy. The other method is to generate answers to questions by a search method, and a flow chart is shown in fig. 2. The method needs to configure a knowledge base in advance, search out the most similar question from the knowledge base for each query statement, and then give out the corresponding answer of the searched question as the answer to reply. The method has the advantages of high accuracy, capability of giving answers meeting the user's intention to a greater extent and low recall rate.
In addition, the two technical schemes are transparent and not configurable for users, so that the given answer is basically fixed and lacks diversity, and different answers cannot be given to the same question of different users.
Disclosure of Invention
In order to solve the technical problems, the invention provides a man-machine conversation method, a man-machine conversation device, a terminal and a server. The invention is realized by the following technical scheme:
in a first aspect, a human-machine interaction method includes:
acquiring a query parameter set, wherein the query parameter set comprises a query statement and basic information of a target user, and the target user is a user who issues the query statement;
acquiring a question-answer pair data set corresponding to the target user according to the basic information of the target user;
extracting candidate question-answer pairs corresponding to the query sentences from the question-answer pair data set to obtain a first candidate set;
selecting a target answer from the first candidate set, and outputting the target answer.
In a second aspect, a human-machine interaction device includes:
the query parameter set acquisition module is used for acquiring a query parameter set, wherein the query parameter set comprises a query statement and basic information of a target user, and the target user is a user who issues the query statement;
the question-answer pair data set acquisition module is used for acquiring a question-answer pair data set corresponding to the target user according to the basic information of the target user;
a first candidate set obtaining module, configured to extract candidate question-answer pairs corresponding to the query statement from the question-answer pair data set, and obtain a first candidate set;
and the target answer obtaining module is used for selecting a target answer from the first candidate set and outputting the target answer.
In a third aspect, a terminal is provided for use in a human-machine interaction device as described above.
In a fourth aspect, a server is used in a human-machine interaction device as described above.
The invention provides a man-machine conversation method, a man-machine conversation device, a terminal and a server. The invention supports the user to individually configure the question-answer pair data set belonging to the user, thereby improving the accuracy of man-machine conversation. On the premise of allowing the question-answer pairs to be customized, a public data set is provided, so that the recall rate of man-machine conversation is guaranteed. Furthermore, the invention also provides a method for selecting the target answer based on the FastText word vector model, thereby further improving the accuracy of the output target answer.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, it is obvious that the drawings in the following description are only some embodiments of the present invention, and other drawings can be obtained by those skilled in the art without creative efforts.
FIG. 1 is a flowchart of a deep learning-based human-machine interaction method provided in the background of the invention;
FIG. 2 is a flow chart of a method for providing a human-machine interaction based on a search in the background of the invention;
FIG. 3 is a flowchart of a man-machine interaction method provided by an embodiment of the present invention;
FIG. 4 is a diagram of a question-answer pair editing interface provided by an embodiment of the present invention;
FIG. 5 is a flowchart of a method for pre-querying a target answer according to an embodiment of the present invention;
FIG. 6 is a diagram illustrating contents of a first default template according to an embodiment of the present invention;
FIG. 7 is a diagram illustrating contents of a second default template according to an embodiment of the present invention;
FIG. 8 is a diagram illustrating contents of a third default template according to an embodiment of the present invention;
fig. 9 is a flowchart of a method for obtaining question-answer pairs according to a query statement according to an embodiment of the present invention;
FIG. 10 is a flowchart of a method for selecting a target answer from among candidate question-answer pairs according to an embodiment of the present invention;
FIG. 11 is a flowchart of a method for obtaining similarity between candidate question-answer pairs and query statements according to an embodiment of the present invention;
FIG. 12 is a block diagram of a human-machine interaction device according to an embodiment of the present invention;
fig. 13 is a schematic diagram of a terminal provided in an embodiment of the present invention;
fig. 14 is a schematic structural diagram of a server according to an embodiment of the present invention.
Detailed Description
In order to make the technical solutions of the present invention better understood, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
It should be noted that the terms "first," "second," and the like in the description and claims of the present invention and in the drawings described above are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used is interchangeable under appropriate circumstances such that the embodiments of the invention described herein are capable of operation in sequences other than those illustrated or described herein. Furthermore, the terms "comprises," "comprising," and "having," and any variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, system, article, or apparatus that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed, but may include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus.
The embodiment of the invention discloses a man-machine conversation method, as shown in figure 3, the method comprises the following steps:
s101, acquiring a query parameter set, wherein the query parameter set comprises a query statement and basic information of a target user, and the target user is a user who issues the query statement.
In particular, a user may have a human-machine conversation through an intelligent conversation tool, whose communication interface may include a conversation window.
In particular, the session window may be a client-provided window for interacting with a user. The client may be an Instant Messaging (IM) client embedded. The instant messaging tool can be applied to any electronic device, such as a mobile smart phone, a tablet electronic device, a portable computer (such as a notebook computer and the like), a Personal Digital Assistant (PDA), a desktop computer, an intelligent wearable device with an information reading function and the like. The instant messaging tools may include, but are not limited to, smart conversation tools, Tencent's QQ or WeChat, Microsoft's MSN, AOL's ICQ, Panwang, Neiko, Feixin, millet's Rice chat, and the like. The intelligent dialog tool may be a computer program capable of instant interaction with a user, which may receive input information from the user and may present reply information matching the input information in a conversation window. The intelligent dialog tools may include microsoft corporation's small ice, hundreds of degrees corporation's miracle, kyoto corporation's JIMI, assistant too, and apple corporation's Siri, among others.
And S102, acquiring a question-answer pair data set corresponding to the target user according to the basic information of the target user.
Specifically, in the embodiment of the present invention, the question-answer pair data set may be customized according to the user's own characteristics, and thus, a one-to-one correspondence relationship is established between the question-answer pair data set and the target user. The basic information of the target user comprises user identification, the user identification corresponds to the question-answer pair data sets corresponding to the user one by one, and the question-answer pair data sets corresponding to the user can be obtained according to the basic information of the user. As shown in fig. 4, a schematic diagram of a question-answer pair editing interface is shown. The question-answer pair editing interface is used for editing the questions of the user, the corresponding answers and setting the basic data of the user. And after the user edits the question-answer pairs by using the question-answer pair editing interface, the question-answer pairs are recorded in the question-answer pair data set corresponding to the user. The question-answer pair editing interface also comprises a basic data input template, and the question-answer pair can be automatically generated by inputting basic data into the basic data input template.
S103, extracting candidate question-answer pairs corresponding to the query sentences in the question-answer pair data set to obtain a first candidate set.
S104, judging whether the first candidate set is empty or not.
And S105, if the first candidate set is not empty, selecting a target answer from the first candidate set, and outputting the target answer.
In the man-machine conversation method disclosed by the embodiment of the invention, the user can be allowed to edit question-answer pairs by himself, and the question-answer pair data set edited and obtained by the user is preferably considered in the link of outputting the target answer. Compared with the technical scheme that the man-machine conversation can only be preset but cannot be freely configured by the user in the prior art, the method has the advantages of strong diversity and good user experience. In addition, if the first candidate set freely configured by the user can successfully output the target answer, the target answer obviously meets the query requirement of the user, and therefore, the accuracy of the target answer is also improved.
However, the content freely configured by the user is limited, and the user cannot set a large number of questions and corresponding answers, so in order to provide answers to the questions that the user does not set, the following steps are further provided in the embodiment of the present invention:
and S106, if the first candidate set is empty, extracting candidate question-answer pairs corresponding to the query statement in a public data set, and obtaining a second candidate set.
In particular, the content in the common data set may not require user customization, nor be relevant to a particular user. The public data set can be obtained by inputting a large amount of corpus training in advance.
S107, judging whether the second candidate set is empty or not.
And S108, if the second candidate set is not empty, selecting a target answer from the second candidate set, and outputting the target answer.
Further, in order to increase the output speed of the target answer, the embodiment of the present invention uses a dual query engine to perform a process of human-machine interaction, and specifically, the dual query engine includes a full-text search engine and a database engine. When the user edits the question-answer pairs, the question-answer pairs are directly written into the full-text search engine and take effect immediately, and the question-answer pairs are synchronized into the database engine by the full-text search engine, so that the consistency of data in the full-text search engine and the database engine is ensured. During the man-machine interaction, the target answers are preferably obtained from the full-text search engine (i.e., steps S103-S105 are performed), and if the full-text search engine cannot provide the target answers, the target answers are provided from the database engine (i.e., steps S106-S108 are performed). In addition, when a database engine is designed, disaster recovery backup is fully considered in the embodiment of the invention, so that answers can be selected from the database engine when the full-text search engine fails, and the man-machine conversation process is stably implemented.
Specifically, the full text search engine in the embodiment of the present invention uses an elastic search. The ElasticSearch is a Lucene-based search server. It provides a distributed multi-user capable full-text search engine based on RESTful web interface. The Elasticsearch was developed in Java and published as open source under the Apache licensing terms, and is currently a popular enterprise-level search engine. The database engine in embodiments of the present invention uses Mysql. MySQL is a relational database management system that keeps data in different tables, rather than putting all the data in one large repository, which increases speed and flexibility. The SQL language used by MySQL is the most common standardized language for accessing databases. The method has the advantages of small size, high speed, low total cost and source code opening, and can be matched with PHP and Apache to form a good development environment.
In order to increase the output speed of the target answer, the embodiment of the present invention further provides a target answer pre-query method based on a query statement, where the method may be implemented between step S101 and step S102, and as shown in fig. 5, the method includes:
s201, judging whether the query statement is an illegal query statement.
Specifically, whether the query sentence is legal or not can be determined by determining whether the query sentence contains Chinese characters or English characters, if yes, the query sentence is legal, and if not, the query sentence is illegal.
S202, if yes, outputting a target answer according to a first preset template.
Further, the method further comprises:
s203, if not, judging whether the query sentence contains the sensitive words.
Specifically, the sensitive words in the embodiment of the invention generally refer to words with sensitive political tendency, violence tendency and unhealthy color. In other possible embodiments, the sensitive words may also be customized in relation to the environment in which the man-machine interaction method is implemented. For example, if the method is applied to the scene of electronic commerce, some commodities which are related to infringement of intellectual property and are not suitable for sale, such as "emulational", "water goods", "pirate", "burning", etc., can be set as sensitive words, and in addition, the names of competitors are also sensitive words which cannot be issued in some e-commerce websites.
The sensitive words can also be forbidden words published by authoritative documents or countries, such as forbidden words mentioned in "the forbidden words in news reports of Xinhua society" (first batch) published by Xinhua society, which mainly relate to five aspects, namely forbidden words of time-political and social life classes, forbidden words of law and regulation classes, forbidden words of national religions classes, forbidden words of Hongkong and territorial leadership classes, and forbidden words of international relations classes.
And S204, if so, outputting a target answer according to a second preset template.
Further, the method further comprises:
s205, if not, judging whether the query sentence contains the non-civilized words.
The term "non-civilized" refers to a language that is in the back of the public moral or the public order. The uncertainties can also be some 'names of people', for example, some words which are difficult to open teeth in daily life of people.
S206, if yes, outputting a target answer according to a third preset template.
In the embodiment of the invention, the first preset template, the second preset template and the third preset template can be preset and stored in the full-text search engine. Referring to fig. 6, which shows the content of the first preset template, when the query statement is an illegal query statement, the content of the first preset template "i do not have a language of extraterrestrial too much" is output. Referring to fig. 7, which shows the content of the second preset template, when the query statement contains a sensitive word, the content of the second preset template is output, i do not know what you say, and the original artificial intelligence is not any more than ten thousand. Referring to FIG. 8, which shows the contents of the third preset template, when the query statement contains a dirty word, the contents of the third preset template are output as "cursory is not a civilized behavior". In other possible embodiments, the contents of the first preset template, the second preset template and the third preset template may also be changed according to the actual situation of the user, so as to improve the adaptability of the human-computer interaction. For example, for the third preset template, if the user is a girl, the "aesthetic and non-aesthetic person" may be output, and if the user is a boy, the "no-aesthetic person" may be output.
In a specific implementation, steps S203-S204 and steps S205-S206 are interchangeable. In the execution of the pre-query method, if the target answer is output, the step S102 and the subsequent steps are not required to be executed.
In order to accurately and quickly judge whether the query sentence contains the sensitive words or the non-civilized words, the invention detects the sensitive words or the non-civilized words by using the dictionary tree. Namely, a trie tree is constructed based on the existing sensitive words and the dirty word dictionary, and then the trie tree is used for extracting the sensitive words or the non-civilized words in the query sentence.
The dictionary tree can be called as Trie tree, has high efficiency, can be used for counting and sequencing a large number of character strings, has the advantages of reducing meaningless character string comparison to the maximum extent, can reduce the expense of query time by utilizing the public prefixes of the character strings to achieve the purpose of improving efficiency, and has the following characteristics: the root node does not contain characters, and except the root node, each node only contains one character; from the root node to a certain node, the characters passing through the path are connected to form a character string corresponding to the node; all child nodes of each node contain different character strings.
Further, the embodiment of the present invention discloses a method for extracting question-answer pairs according to query statements, as shown in fig. 9, the method includes:
s301, performing word segmentation on the query sentence, and obtaining a word segmentation result set.
S302, extracting candidate question-answer pairs for each word in the word segmentation result set, and obtaining candidate question-answer pairs corresponding to the words.
Specifically, for each question-answer pair, if the question includes the participle, the question-answer pair belongs to a candidate question-answer pair corresponding to the participle.
And S303, taking the intersection of the candidate question-answer pairs corresponding to the participles to obtain the candidate question-answer pairs corresponding to the query sentence.
Specifically, the method for obtaining question-answer pairs according to the query statement may be applied to step S103 and/or step S106.
After the candidate question-answer pairs are obtained, the embodiment of the invention further provides a method for selecting the target answer from the candidate question-answer pairs, the method in the embodiment of the invention is based on a FastText word vector model, FastText is a tool for text classification and word vector calculation, which is introduced by Facebook in 2016, and the method has the advantages of simple model and high training speed. The FastText word vector model in the embodiment of the invention is trained in advance by adopting 1400 ten thousand encyclopedia question-answer pairs under the line, and the content structure of the FastText word vector model is that each line corresponds to a word and a 100-dimensional vector corresponding to the word.
As shown in fig. 10, the method specifically includes:
s401, calculating the similarity between each candidate question-answer pair and the query statement.
S402, selecting the candidate question-answer pair with the highest similarity as a target question-answer pair.
And S403, judging whether the similarity is greater than a preset threshold value.
S404, if yes, the answer in the target question-answer pair is used as the target answer.
Specifically, as shown in fig. 11, obtaining the similarity between the candidate question-answer pair and the query statement includes:
s4011, performing word segmentation on the query sentence to obtain a first word segmentation set, and performing word segmentation on candidate questions in the candidate question-answer pairs to obtain a second word segmentation set.
S4012, finding out the corresponding word vector of each word in the first word segmentation set and the second word segmentation set in the FastText model.
S4013, calculating a first vector corresponding to the first branch set and a second vector corresponding to the second branch set.
In particular, the calculation method used for the first vector and the second vector may be the same. In the embodiment of the present invention, taking the first vector as an example, the first vector is obtained by summing up word vectors corresponding to words in the first word segmentation set and then dividing the sum by the number of words in the first word segmentation set, for example, the first vector corresponding to the first word segmentation set obtained after the word segmentation of the query statement "what name you called" is [ -0.105925, -0.137778, -0.049424 ], · · · ·, -0.049424, -0.080659,0.120057] (the dimension of the vector is 100 dimensions, and only a partial dimension value is displayed here).
S4014, calculating cosine similarity of the first vector and the second vector, and taking the cosine similarity as similarity of the query statement and the candidate question-answer pairs.
The cosine similarity is calculated by the formula
Figure BDA0001854596470000101
As shown, a and b are the first vector and the second vector, respectively, | | a | | | represents a modulus of the vector a, and | | | b | | | represents a modulus of the vector b.
In another possible embodiment of the present invention, a Long Short-Term-Memory (LSTM) network model may be further used to obtain the similarity between the candidate question-answer pair and the query statement, the query statement and the candidate question of the candidate question-answer are encoded by using the LSTM network model, the semantic similarity between them is calculated based on the encoding result, and the semantic similarity is used as the similarity between the query statement and the candidate question-answer pair.
The method provided by the embodiment of the invention can support the user to individually configure the question-answer pair data set belonging to the user, thereby improving the accuracy of man-machine conversation. On the premise of allowing the question-answer pairs to be customized, a public data set is provided, so that the recall rate of man-machine conversation is guaranteed. Furthermore, the invention also provides a method for selecting the target answer based on the FastText word vector model, thereby further improving the accuracy of the output target answer.
An embodiment of the present invention further provides a man-machine interaction device, as shown in fig. 12, including:
a query parameter set obtaining module 501, configured to obtain a query parameter set, where the query parameter set includes a query statement and basic information of a target user, and the target user is a user who issues the query statement;
a question-answer pair data set obtaining module 502, configured to obtain, according to the basic information of the target user, a question-answer pair data set corresponding to the target user;
a first candidate set obtaining module 503, configured to extract candidate question-answer pairs corresponding to the query statement from the question-answer pair data set, and obtain a first candidate set;
a determining module 504, configured to determine whether the first candidate set is empty;
a target answer obtaining module 505, configured to select a target answer from the first candidate set and output the target answer if the first candidate set is not empty.
The embodiment of the man-machine interaction device and the method in the embodiment of the device of the invention are based on the same inventive concept.
Embodiments of the present invention also provide a storage medium, which can be used to store program codes required for implementing a human-machine conversation according to the embodiments. Optionally, in this embodiment, the storage medium may be located in at least one network device of a plurality of network devices of a computer network. Optionally, in this embodiment, the storage medium may include, but is not limited to: a U-disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a removable hard disk, a magnetic or optical disk, and other various media capable of storing program codes.
Referring to fig. 13, a schematic structural diagram of a terminal according to an embodiment of the present invention is shown. The terminal runs and implements the man-machine interaction device provided in the above embodiment.
The terminal may include RF (Radio Frequency) circuitry 110, memory 120 including one or more computer-readable storage media, input unit 130, display unit 140, sensor 150, audio circuitry 160, WiFi (wireless fidelity) module 170, processor 180 including one or more processing cores, and power supply 190. Those skilled in the art will appreciate that the terminal structure shown in fig. 13 is not intended to be limiting and may include more or fewer components than those shown, or some components may be combined, or a different arrangement of components. Wherein:
the RF circuit 110 may be used for receiving and transmitting signals during information transmission and reception or during a call, and in particular, receives downlink information from a base station and then sends the received downlink information to the one or more processors 180 for processing; in addition, data relating to uplink is transmitted to the base station. In general, the RF circuitry 110 includes, but is not limited to, an antenna, at least one amplifier, a tuner, one or more oscillators, a Subscriber Identity Module (SIM) card, a transceiver, a coupler, an LNA (low noise amplifier), a duplexer, and the like. In addition, the RF circuitry 110 may also communicate with networks and other devices via wireless communications. The wireless communication may use any communication standard or protocol, including but not limited to GSM (Global System for mobile communications), GPRS (General Packet Radio Service), CDMA (Code Division multiple access), WCDMA (Wideband Code Division multiple access), LTE (Long Term Evolution), email, SMS (Short Messaging Service), etc.
The memory 120 may be used to store software programs and modules, and the processor 180 executes various functional applications and data processing by operating the software programs and modules stored in the memory 120. The memory 120 may mainly include a program storage area and a data storage area, wherein the program storage area may store an operating system, application programs required for functions, and the like; the storage data area may store data created according to the use of the terminal, and the like. Further, the memory 120 may include high speed random access memory, and may also include non-volatile memory, such as at least one magnetic disk storage device, flash memory device, or other volatile solid state storage device. Accordingly, the memory 120 may further include a memory controller to provide the processor 180 and the input unit 130 with access to the memory 120.
The input unit 130 may be used to receive input numeric or character information and generate keyboard, mouse, joystick, optical or trackball signal inputs related to user settings and function control. In particular, the input unit 130 may include a touch-sensitive surface 131 as well as other input devices 132. The touch-sensitive surface 131, also referred to as a touch display screen or a touch pad, may collect touch operations by a user on or near the touch-sensitive surface 131 (e.g., operations by a user on or near the touch-sensitive surface 131 using a finger, a stylus, or any other suitable object or attachment), and drive the corresponding connection device according to a predetermined program. Alternatively, the touch sensitive surface 131 may comprise two parts, a touch detection means and a touch controller. The touch detection device detects the touch direction of a user, detects a signal brought by touch operation and transmits the signal to the touch controller; the touch controller receives touch information from the touch sensing device, converts the touch information into touch point coordinates, sends the touch point coordinates to the processor 180, and can receive and execute commands sent by the processor 180. Additionally, the touch-sensitive surface 131 may be implemented using various types of resistive, capacitive, infrared, and surface acoustic waves. In addition to the touch-sensitive surface 131, the input unit 130 may also include other input devices 132. In particular, other input devices 132 may include, but are not limited to, one or more of a physical keyboard, function keys (such as volume control keys, switch keys, etc.), a trackball, a mouse, a joystick, and the like.
The display unit 140 may be used to display information input by or provided to a user and various graphic user interfaces of the terminal, which may be configured by graphics, text, icons, video, and any combination thereof. The Display unit 140 may include a Display panel 141, and optionally, the Display panel 141 may be configured in the form of an LCD (Liquid Crystal Display), an OLED (Organic Light-Emitting Diode), or the like. Further, the touch-sensitive surface 131 may cover the display panel 141, and when a touch operation is detected on or near the touch-sensitive surface 131, the touch operation is transmitted to the processor 180 to determine the type of the touch event, and then the processor 180 provides a corresponding visual output on the display panel 141 according to the type of the touch event. Although in FIG. 13, touch-sensitive surface 131 and display panel 141 are shown as two separate components to implement input and output functions, in some embodiments, touch-sensitive surface 131 may be integrated with display panel 141 to implement input and output functions.
The terminal may also include at least one sensor 150, such as a light sensor, motion sensor, and other sensors. Specifically, the light sensor may include an ambient light sensor that adjusts the brightness of the display panel 141 according to the brightness of ambient light, and a proximity sensor that turns off the display panel 141 and/or a backlight when the terminal is moved to the ear. As one of the motion sensors, the gravity acceleration sensor can detect the magnitude of acceleration in each direction (generally, three axes), detect the magnitude and direction of gravity when the terminal is stationary, and can be used for applications of recognizing terminal gestures (such as horizontal and vertical screen switching, related games, magnetometer gesture calibration), vibration recognition related functions (such as pedometer and tapping), and the like; as for other sensors such as a gyroscope, a barometer, a hygrometer, a thermometer, and an infrared sensor, which can be configured in the terminal, detailed description is omitted here.
Audio circuitry 160, speaker 161, microphone 162 may provide an audio interface between a user and the terminal. The audio circuit 160 may transmit the electrical signal converted from the received audio data to the speaker 161, and convert the electrical signal into a sound signal for output by the speaker 161; on the other hand, the microphone 162 converts the collected sound signal into an electric signal, converts the electric signal into audio data after being received by the audio circuit 160, and then outputs the audio data to the processor 180 for processing, and then to the RF circuit 110 to be transmitted to, for example, another terminal, or outputs the audio data to the memory 120 for further processing. The audio circuit 160 may also include an earbud jack to provide communication of peripheral headphones with the terminal.
WiFi belongs to a short-distance wireless transmission technology, and the terminal can help a user to send and receive e-mails, browse webpages, access streaming media and the like through the WiFi module 170, and provides wireless broadband internet access for the user. Although fig. 13 shows the WiFi module 170, it is understood that it does not belong to the essential constitution of the terminal, and may be omitted entirely as needed within the scope not changing the essence of the invention.
The processor 180 is a control center of the terminal, connects various parts of the entire terminal using various interfaces and lines, performs various functions of the terminal and processes data by operating or executing software programs and/or modules stored in the memory 120 and calling data stored in the memory 120, thereby performing overall monitoring of the terminal. Optionally, processor 180 may include one or more processing cores; preferably, the processor 180 may integrate an application processor, which mainly handles operating systems, user interfaces, application programs, etc., and a modem processor, which mainly handles wireless communications. It will be appreciated that the modem processor described above may not be integrated into the processor 180.
The terminal also includes a power supply 190 (e.g., a battery) for powering the various components, which may preferably be logically coupled to the processor 180 via a power management system to manage charging, discharging, and power consumption management functions via the power management system. The power supply 190 may also include any component including one or more of a dc or ac power source, a recharging system, a power failure detection circuit, a power converter or inverter, a power status indicator, and the like.
Although not shown, the terminal may further include a camera, a bluetooth module, and the like, which are not described herein again. In this embodiment, the display unit of the terminal is a touch screen display, the terminal further includes a memory, and one or more programs, where the one or more programs are stored in the memory, and the one or more programs executed by the one or more processors include instructions for executing the human-computer interaction method.
Referring to fig. 14, a schematic structural diagram of a server according to an embodiment of the present invention is shown. The server runs and implements the man-machine interaction device provided in the above embodiment. Specifically, the method comprises the following steps:
the server 1200 includes a Central Processing Unit (CPU)1201, a system memory 1204 including a Random Access Memory (RAM)1202 and a Read Only Memory (ROM)1203, and a system bus 1205 connecting the system memory 1204 and the central processing unit 1201. The server 1200 also includes a basic input/output system (I/O system) 1206 to facilitate transfer of information between devices within the computer, and a mass storage device 1207 for storing an operating system 1213, application programs 1214, and other program modules 1215.
The basic input/output system 1206 includes a display 1208 for displaying information and an input device 1209, such as a mouse, keyboard, etc., for a user to input information. Wherein the display 1208 and input device 1209 are connected to the central processing unit 1201 through an input-output controller 1210 coupled to the system bus 1205. The basic input/output system 1206 may also include an input/output controller 1210 for receiving and processing input from a number of other devices, such as a keyboard, mouse, or electronic stylus. Similarly, input-output controller 1210 also provides output to a display screen, a printer, or other type of output device.
The mass storage device 1207 is connected to the central processing unit 1201 through a mass storage controller (not shown) connected to the system bus 1205. The mass storage device 1207 and its associated computer-readable media provide non-volatile storage for the server 1200. That is, the mass storage device 1207 may include a computer-readable medium (not shown) such as a hard disk or CD-ROM drive.
Without loss of generality, the computer-readable media may comprise computer storage media and communication media. Computer storage media includes volatile and nonvolatile, removable and non-removable media implemented in any method or technology for storage of information such as computer readable instructions, data structures, program modules or other data. Computer storage media includes RAM, ROM, EPROM, EEPROM, flash memory or other solid state memory technology, CD-ROM, DVD, or other optical storage, magnetic cassettes, magnetic tape, magnetic disk storage or other magnetic storage devices. Of course, those skilled in the art will appreciate that the computer storage media is not limited to the foregoing. The system memory 1204 and mass storage device 1207 described above may be collectively referred to as memory.
The server 1200 may also operate as a remote computer connected to a network via a network, such as the internet, in accordance with various embodiments of the present invention. That is, the server 1200 may be connected to the network 1212 through a network interface unit 1211 coupled to the system bus 1205, or the network interface unit 1211 may be used to connect to other types of networks or remote computer systems (not shown).
The memory also includes one or more programs stored in the memory and configured to be executed by one or more processors. The one or more programs include instructions for performing the method of the server.
It should be understood that reference to "a plurality" herein means two or more. "and/or" describes the association relationship of the associated objects, meaning that there may be three relationships, e.g., a and/or B, which may mean: a exists alone, A and B exist simultaneously, and B exists alone. The character "/" generally indicates that the former and latter associated objects are in an "or" relationship.
The above-mentioned serial numbers of the embodiments of the present invention are merely for description and do not represent the merits of the embodiments.
It will be understood by those skilled in the art that all or part of the steps for implementing the above embodiments may be implemented by hardware, or may be implemented by a program instructing relevant hardware, where the program may be stored in a computer-readable storage medium, and the above-mentioned storage medium may be a read-only memory, a magnetic disk or an optical disk, etc.
The above description is only for the purpose of illustrating the preferred embodiments of the present invention and is not to be construed as limiting the invention, and any modifications, equivalents, improvements and the like that fall within the spirit and principle of the present invention are intended to be included therein.

Claims (9)

1. A method for human-computer interaction, comprising:
acquiring a query parameter set, wherein the query parameter set comprises a query statement and basic information of a target user, and the target user is a user who issues the query statement;
judging whether the query statement is an illegal query statement, if so, outputting a target answer according to a first preset template corresponding to the target user;
if the query sentence is not the illegal query sentence, judging whether the query sentence contains sensitive words customized based on the implementation scene of the man-machine conversation, if so, outputting a target answer according to a second preset template corresponding to the target user;
if the sensitive words customized based on the implementation scene of the man-machine conversation are not contained, judging whether the query sentence contains the non-civilized words, and if so, outputting target answers according to a third preset template corresponding to the target user;
if the non-civilized words are not included, obtaining a question-answer pair data set corresponding to the target user according to the basic information of the target user;
extracting candidate question-answer pairs corresponding to the query sentences from the question-answer pair data set to obtain a first candidate set;
selecting a target answer from the first candidate set, and outputting the target answer.
2. The method of claim 1, further comprising:
judging whether the first candidate set is empty or not;
if the first candidate set is empty, extracting a candidate question-answer pair corresponding to the query statement in a public data set to obtain a second candidate set;
judging whether the second candidate set is empty;
and if the second candidate set is not empty, selecting a target answer from the second candidate set and outputting the target answer.
3. The method of claim 1, wherein the extracting the candidate question-answer pairs corresponding to the query sentence comprises:
performing word segmentation on the query sentence, and obtaining a word segmentation result set;
extracting candidate question-answer pairs of each word segmentation element in the word segmentation result set, and obtaining candidate question-answer pairs corresponding to the word segmentation;
and taking the intersection of the candidate question-answer pairs corresponding to the participles to obtain the candidate question-answer pairs corresponding to the query sentence.
4. The method according to any one of claims 1-3, wherein the selecting a target answer comprises:
acquiring the similarity between each candidate question-answer pair and the query statement;
selecting the candidate question-answer pair with the highest similarity as a target question-answer pair;
judging whether the similarity is greater than a preset threshold value or not;
if yes, the answer in the target question-answer pair is used as the target answer.
5. The method of claim 4, wherein obtaining the similarity between each candidate question-answer pair and the query statement comprises:
performing word segmentation on the query sentence to obtain a first word segmentation set, and performing word segmentation on the candidate questions in each candidate question-answer pair to obtain a corresponding second word segmentation set;
finding out a corresponding word vector of each word in the first word segmentation set and the second word segmentation set in a FastText model;
calculating a first vector corresponding to the first word set and a second vector corresponding to the second word set;
and calculating the cosine similarity of the first vector and the second vector, and taking the cosine similarity as the similarity of the query statement and each candidate question-answer pair.
6. A human-computer interaction device, comprising:
the query parameter set acquisition module is used for acquiring a query parameter set, wherein the query parameter set comprises a query statement and basic information of a target user, and the target user is a user who issues the query statement;
the preset answer output module is used for judging whether the query statement is an illegal query statement or not, and if so, outputting a target answer according to a first preset template corresponding to the target user; if the query sentence is not the illegal query sentence, judging whether the query sentence contains sensitive words customized based on the implementation scene of the man-machine conversation, if so, outputting a target answer according to a second preset template corresponding to the target user; if the sensitive words customized based on the implementation scene of the man-machine conversation are not contained, judging whether the query sentence contains the non-civilized words, and if so, outputting target answers according to a third preset template corresponding to the target user;
the question-answer pair data set acquisition module is used for acquiring a question-answer pair data set corresponding to the target user according to the basic information of the target user;
a first candidate set obtaining module, configured to extract candidate question-answer pairs corresponding to the query statement from the question-answer pair data set, and obtain a first candidate set;
and the target answer obtaining module is used for selecting a target answer from the first candidate set and outputting the target answer.
7. A terminal, characterized in that it is adapted to operate a human-machine interaction device according to claim 6.
8. A server, characterized in that it is adapted to operate a human-machine interaction device according to claim 6.
9. A readable storage medium for storing program code which, when executed, performs a human-machine dialog method as claimed in any one of claims 1 to 5.
CN201811309389.2A 2018-11-05 2018-11-05 Man-machine conversation method, device, terminal and server Active CN109543014B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201811309389.2A CN109543014B (en) 2018-11-05 2018-11-05 Man-machine conversation method, device, terminal and server

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201811309389.2A CN109543014B (en) 2018-11-05 2018-11-05 Man-machine conversation method, device, terminal and server

Publications (2)

Publication Number Publication Date
CN109543014A CN109543014A (en) 2019-03-29
CN109543014B true CN109543014B (en) 2021-06-15

Family

ID=65846240

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201811309389.2A Active CN109543014B (en) 2018-11-05 2018-11-05 Man-machine conversation method, device, terminal and server

Country Status (1)

Country Link
CN (1) CN109543014B (en)

Families Citing this family (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110162611B (en) * 2019-04-23 2021-03-26 苏宁金融科技(南京)有限公司 Intelligent customer service response method and system
CN111241260A (en) * 2020-01-08 2020-06-05 平安科技(深圳)有限公司 Data processing method, device and equipment based on human-computer interaction and storage medium
CN112509690B (en) * 2020-11-30 2023-08-04 北京百度网讯科技有限公司 Method, apparatus, device and storage medium for controlling quality
CN113918702B (en) * 2021-10-25 2022-07-01 北京航空航天大学 Semantic matching-based online law automatic question-answering method and system

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103198155A (en) * 2013-04-27 2013-07-10 俞志晨 Mobile terminal based smart question answering interaction system and method
CN107623620A (en) * 2016-07-14 2018-01-23 腾讯科技(深圳)有限公司 Processing method, the webserver and the Intelligent dialogue system of randomness interaction data
CN108182262A (en) * 2018-01-04 2018-06-19 华侨大学 Intelligent Answer System construction method and system based on deep learning and knowledge mapping
CN108595619A (en) * 2018-04-23 2018-09-28 海信集团有限公司 A kind of answering method and equipment

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US10769537B2 (en) * 2016-06-21 2020-09-08 International Business Machines Corporation Cognitive question answering pipeline blending

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103198155A (en) * 2013-04-27 2013-07-10 俞志晨 Mobile terminal based smart question answering interaction system and method
CN107623620A (en) * 2016-07-14 2018-01-23 腾讯科技(深圳)有限公司 Processing method, the webserver and the Intelligent dialogue system of randomness interaction data
CN108182262A (en) * 2018-01-04 2018-06-19 华侨大学 Intelligent Answer System construction method and system based on deep learning and knowledge mapping
CN108595619A (en) * 2018-04-23 2018-09-28 海信集团有限公司 A kind of answering method and equipment

Also Published As

Publication number Publication date
CN109543014A (en) 2019-03-29

Similar Documents

Publication Publication Date Title
CN110472251B (en) Translation model training method, sentence translation equipment and storage medium
CN109543014B (en) Man-machine conversation method, device, terminal and server
CN104123937B (en) Remind method to set up, device and system
US20170091335A1 (en) Search method, server and client
US9241242B2 (en) Information recommendation method and apparatus
CN111177371B (en) Classification method and related device
US20140324426A1 (en) Reminder setting method and apparatus
KR20160124182A (en) Method and apparatus for grouping contacts
CN108156508B (en) Barrage information processing method and device, mobile terminal, server and system
CN104217717A (en) Language model constructing method and device
CN107608532A (en) A kind of association-feeding method, device and electronic equipment
CN110162600B (en) Information processing method, session response method and session response device
CN107885718B (en) Semantic determination method and device
CN111490927A (en) Method, device and equipment for displaying message
CN112214605A (en) Text classification method and related device
CN110597957B (en) Text information retrieval method and related device
CN114357278A (en) Topic recommendation method, device and equipment
WO2015003607A1 (en) Systems and methods for filtering microblogs
CN109389977B (en) Voice interaction method and device
CN110399474A (en) A kind of Intelligent dialogue method, apparatus, equipment and storage medium
US10630619B2 (en) Electronic device and method for extracting and using semantic entity in text message of electronic device
CN111553163A (en) Text relevance determining method and device, storage medium and electronic equipment
CN108491471B (en) Text information processing method and mobile terminal
CN116955610A (en) Text data processing method and device and storage medium
CN114647703A (en) Data processing method and device, electronic equipment and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant