CN113094478A - Expression reply method, device, equipment and storage medium - Google Patents

Expression reply method, device, equipment and storage medium Download PDF

Info

Publication number
CN113094478A
CN113094478A CN202110645856.4A CN202110645856A CN113094478A CN 113094478 A CN113094478 A CN 113094478A CN 202110645856 A CN202110645856 A CN 202110645856A CN 113094478 A CN113094478 A CN 113094478A
Authority
CN
China
Prior art keywords
information
result
replied
expression
reply
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.)
Granted
Application number
CN202110645856.4A
Other languages
Chinese (zh)
Other versions
CN113094478B (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.)
Ping An Technology Shenzhen Co Ltd
Original Assignee
Ping An 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 Ping An Technology Shenzhen Co Ltd filed Critical Ping An Technology Shenzhen Co Ltd
Priority to CN202110645856.4A priority Critical patent/CN113094478B/en
Publication of CN113094478A publication Critical patent/CN113094478A/en
Application granted granted Critical
Publication of CN113094478B publication Critical patent/CN113094478B/en
Priority to PCT/CN2022/071318 priority patent/WO2022257452A1/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/30Information retrieval; Database structures therefor; File system structures therefor of unstructured textual data
    • G06F16/33Querying
    • G06F16/3331Query processing
    • G06F16/334Query execution
    • G06F16/3346Query execution using probabilistic model
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/30Information retrieval; Database structures therefor; File system structures therefor of unstructured textual data
    • G06F16/35Clustering; Classification
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/20Natural language analysis
    • G06F40/205Parsing
    • G06F40/216Parsing using statistical methods
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/20Natural language analysis
    • G06F40/279Recognition of textual entities
    • G06F40/289Phrasal analysis, e.g. finite state techniques or chunking
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06QINFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
    • G06Q50/00Information and communication technology [ICT] specially adapted for implementation of business processes of specific business sectors, e.g. utilities or tourism
    • G06Q50/01Social networking

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • Health & Medical Sciences (AREA)
  • Computational Linguistics (AREA)
  • General Health & Medical Sciences (AREA)
  • Probability & Statistics with Applications (AREA)
  • Business, Economics & Management (AREA)
  • Artificial Intelligence (AREA)
  • Data Mining & Analysis (AREA)
  • Databases & Information Systems (AREA)
  • Audiology, Speech & Language Pathology (AREA)
  • Economics (AREA)
  • Computing Systems (AREA)
  • Human Resources & Organizations (AREA)
  • Marketing (AREA)
  • Primary Health Care (AREA)
  • Strategic Management (AREA)
  • Tourism & Hospitality (AREA)
  • General Business, Economics & Management (AREA)
  • Management, Administration, Business Operations System, And Electronic Commerce (AREA)

Abstract

The invention relates to artificial intelligence and provides an expression reply method, device, equipment and storage medium. The method includes the steps of obtaining information to be replied, generating an information vector according to the information to be replied, inputting the information vector into a classification model to obtain a classification result and a result probability, detecting whether the information to be replied contains user expression information or not if the classification result is a target result, obtaining a detection result, generating a reply score according to the result probability and the detection result, extracting feature information of the information to be replied if the reply score is larger than a preset threshold, carrying out emotion recognition on the feature information to obtain an emotion result, carrying out intention recognition on the feature information to obtain an intention result, and selecting a matched expression from a preset expression library as a reply expression of the information to be replied according to the emotion result and the intention result. The invention can accurately reply the user information by using the expression. In addition, the invention also relates to a block chain technology, and the reply emoticons can be stored in the block chain.

Description

Expression reply method, device, equipment and storage medium
Technical Field
The invention relates to the technical field of artificial intelligence, in particular to an expression reply method, device, equipment and storage medium.
Background
In the social network application, the expression of daily emotion of people can be enriched by using the emoticon, and therefore, the emoticon is used in the chat robot, however, when the chat robot replies by using the chat emoticon, the chat emotion of the user cannot be accurately analyzed, so that the problem that whether the current user should be replied by using the emoticon cannot be accurately determined, and meanwhile, the emoticon to be used cannot be accurately determined, so that the user information cannot be accurately replied by using the emoticon.
Disclosure of Invention
In view of the above, it is desirable to provide an expression reply method, apparatus, device and storage medium capable of accurately replying to user information using expressions.
In one aspect, the present invention provides an expression reply method, where the expression reply method includes:
when a reply request is received, acquiring information to be replied according to the reply request;
generating an information vector according to the information to be replied;
inputting the information vector into a classification model trained in advance to obtain a classification result and a result probability of the classification result, wherein the classification result comprises a target result, and the target result is used for indicating that the expression needs to be replied;
if the classification result is the target result, detecting whether the information to be replied contains user expression information or not to obtain a detection result;
generating a reply score according to the result probability and the detection result;
if the reply score is larger than a preset threshold value, extracting the characteristic information of the information to be replied;
performing emotion recognition on the characteristic information to obtain an emotion result, and performing intention recognition on the characteristic information to obtain an intention result;
and selecting a matched expression from a preset expression library as a reply expression of the information to be replied according to the emotion result and the intention result.
According to a preferred embodiment of the present invention, the generating an information vector according to the information to be replied includes:
extracting a target image in the information to be replied, and acquiring all pixels in the target image;
generating an image vector of the target image according to all the pixels;
determining information except the target image in the information to be replied as information to be processed;
filtering stop words in the information to be processed to obtain processed information;
performing word segmentation processing on the processed information to obtain information word segmentation, and acquiring word segmentation vectors of the information word segmentation;
determining the image position of the target image in the information to be replied, and determining the word segmentation position of the information word segmentation in the information to be replied;
and splicing the image vector and the word segmentation vector according to the image position and the word segmentation position to obtain the information vector.
According to a preferred embodiment of the present invention, the detecting whether the message to be replied includes user expression information, and obtaining a detection result includes:
acquiring an input address of the target image;
determining a terminal corresponding to the input address as an input terminal of the target image, and acquiring a terminal number of the input terminal;
comparing the terminal number with all machine numbers in a preset terminal library;
and if the terminal number is different from all the machine numbers, determining the detection result as that the information to be replied contains the user expression information.
According to the preferred embodiment of the present invention, the extracting the feature information of the message to be replied includes:
generating a context feature vector set of each information word according to the word segmentation vectors;
calculating the product of each word segmentation vector in the context feature vector set and a first preset matrix to obtain a plurality of operation vectors of the information word segmentation, and calculating the average value of the operation vectors to obtain a middle vector of the information word segmentation;
multiplying the intermediate vector point by a second preset matrix to obtain a target matrix, wherein each column of vectors in the target matrix represents each characteristic of the information to be replied;
calculating the similarity between each column of vectors in the target matrix and the word segmentation vectors;
and determining the information participle corresponding to the participle vector with the maximum similarity and the target image as the characteristic information.
According to a preferred embodiment of the present invention, the identifying the intention of the feature information, and obtaining an intention result includes:
acquiring a vector of the feature information from the word segmentation vector as a feature vector;
inputting the feature vector into a pre-trained bidirectional long and short term memory network to obtain a semantic vector;
and processing the semantic vector by using a laminated conditional random field to obtain the intention result.
According to a preferred embodiment of the present invention, before inputting the information vector into a pre-trained classification model, the method further comprises:
acquiring a preset learner, wherein the preset learner comprises a full connection layer;
acquiring historical sample data, wherein the historical sample data comprises historical information and user satisfaction;
dividing the historical sample data into training data and verification data;
adjusting parameters in the full connection layer by using the training data to obtain a classification learner;
determining an accuracy rate of the classification learner based on the validation data;
and if the accuracy is less than the preset accuracy, adjusting the classification learner according to the verification data until the accuracy of the classification learner is greater than or equal to the preset accuracy, and obtaining the classification model.
According to a preferred embodiment of the present invention, the generating a reply score according to the result probability and the detection result comprises:
obtaining a first weight of the classification model;
determining the product of the result probability and the first weight as a first fraction of the information to be replied;
acquiring a detection value corresponding to the detection result, and acquiring a second weight of the user expression information;
determining the product of the detection value and the second weight as a second fraction of the message to be replied;
and calculating the sum of the first score and the second score to obtain the reply score.
On the other hand, the invention also provides an expression reply device, which comprises:
the device comprises an acquisition unit, a processing unit and a processing unit, wherein the acquisition unit is used for acquiring information to be replied according to a reply request when the reply request is received;
the generating unit is used for generating an information vector according to the information to be replied;
the input unit is used for inputting the information vector into a pre-trained classification model to obtain a classification result and a result probability of the classification result, wherein the classification result comprises a target result, and the target result is used for indicating that the expression needs to be replied;
the detection unit is used for detecting whether the information to be replied contains user expression information or not if the classification result is the target result, and obtaining a detection result;
the generating unit is further used for generating a reply score according to the result probability and the detection result;
the extracting unit is used for extracting the characteristic information of the information to be replied if the reply score is larger than a preset threshold value;
the identification unit is used for carrying out emotion identification on the characteristic information to obtain an emotion result and carrying out intention identification on the characteristic information to obtain an intention result;
and the selecting unit is used for selecting the matched expression from a preset expression library as the reply expression of the information to be replied according to the emotion result and the intention result.
In another aspect, the present invention further provides an electronic device, including:
a memory storing computer readable instructions; and
a processor executing computer readable instructions stored in the memory to implement the expression reply method.
In another aspect, the present invention further provides a computer-readable storage medium, where computer-readable instructions are stored, and the computer-readable instructions are executed by a processor in an electronic device to implement the expression reply method.
According to the technical scheme, the information to be replied is analyzed and whether the information to be replied contains user expression information is detected through the classification model, and whether the expression needs to be replied in the information to be replied is determined by comparing reply scores generated according to the result probability and the detection result with a preset threshold.
Drawings
FIG. 1 is a flowchart illustrating an expression retrieval method according to a preferred embodiment of the present invention.
FIG. 2 is a functional block diagram of an expression recovering device according to a preferred embodiment of the present invention.
Fig. 3 is a schematic structural diagram of an electronic device implementing an expression reply method according to a preferred embodiment of the invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention more apparent, the present invention will be described in detail with reference to the accompanying drawings and specific embodiments.
Fig. 1 is a flowchart illustrating an expression retrieval method according to a preferred embodiment of the present invention. The order of the steps in the flow chart may be changed and some steps may be omitted according to different needs.
The expression reply method is applied to one or more electronic devices, which are devices capable of automatically performing numerical calculation and/or information processing according to computer readable instructions set or stored in advance, and the hardware thereof includes but is not limited to a microprocessor, an Application Specific Integrated Circuit (ASIC), a Programmable Gate Array (FPGA), a Digital Signal Processor (DSP), an embedded device, and the like.
The electronic device may be any electronic product capable of performing human-computer interaction with a user, for example, a Personal computer, a tablet computer, a smart phone, a Personal Digital Assistant (PDA), a game machine, an interactive Internet Protocol Television (IPTV), a smart wearable device, and the like.
The electronic device may include a network device and/or a user device. Wherein the network device includes, but is not limited to, a single network electronic device, an electronic device group consisting of a plurality of network electronic devices, or a Cloud Computing (Cloud Computing) based Cloud consisting of a large number of hosts or network electronic devices.
The network in which the electronic device is located includes, but is not limited to: the internet, a wide area Network, a metropolitan area Network, a local area Network, a Virtual Private Network (VPN), and the like.
S10, when a reply request is received, the information to be replied is obtained according to the reply request.
In at least one embodiment of the invention, the reply request is triggered to be generated when input information of a user is received. The information carried by the reply request includes, but is not limited to: a log number, etc.
The information to be replied refers to information that needs to be replied, and the information to be replied may include, but is not limited to: information currently input by the user, information of multiple rounds of conversations between the user and the chat robot, and the like.
The information to be replied can be text information, image information or voice information, and the invention does not limit the specific form of the information to be replied.
In at least one embodiment of the present invention, the obtaining, by the electronic device, the to-be-replied information according to the reply request includes:
analyzing the message of the reply request to obtain the data information carried by the message;
acquiring information indicating a log from the data information as a log number;
writing the log number into a preset template to obtain an inquiry statement;
acquiring a log storage library, and operating the query statement in the log storage library to obtain a target log;
and determining the information carried by the method body in the target log as the information to be replied.
Wherein the data information includes, but is not limited to: a label indicating the log, the log number, etc.
The preset template refers to a preset statement capable of inquiring information, and the preset template can be a structured inquiry statement.
The log repository stores log information of a plurality of chat robots and users.
The method body refers to dialogue information between the chat robot and the user.
The data information can be quickly acquired by analyzing the message, so that the target log can be quickly acquired from the log storage library according to the acquired log number, and the information to be replied can be quickly acquired.
And S11, generating an information vector according to the information to be replied.
In at least one embodiment of the present invention, the information vector refers to a characterization vector of the information to be replied.
In at least one embodiment of the present invention, the generating, by the electronic device, an information vector according to the information to be replied includes:
extracting a target image in the information to be replied, and acquiring all pixels in the target image;
generating an image vector of the target image according to all the pixels;
determining information except the target image in the information to be replied as information to be processed;
filtering stop words in the information to be processed to obtain processed information;
performing word segmentation processing on the processed information to obtain information word segmentation, and acquiring word segmentation vectors of the information word segmentation;
determining the image position of the target image in the information to be replied, and determining the word segmentation position of the information word segmentation in the information to be replied;
and splicing the image vector and the word segmentation vector according to the image position and the word segmentation position to obtain the information vector.
The target image can comprise an emoticon sent by any end in the information to be replied, and the any end comprises a user end and a chat robot.
The stop words comprise vocabularies with parts of speech being prepositions and the like.
The image position refers to a position where the target image appears in the information to be replied, and the image position may be a serial number, for example, the information to be replied is { user: do you happy today; the chat robot comprises: a (A is an emoticon), tweed; the user: i'm happy }, it is determined that a is the target image, and since a is in the second sentence in the message to be replied, the image position is 2.
The word segmentation position refers to a position where the information word segmentation appears in all the word segmentation of the information to be replied, and in accordance with the above example, the information word segmentation "today" is located at the second position of all the word segmentation, so that the word segmentation position of the information word segmentation "today" is 2.
The image vector of the target image can be accurately generated through all the pixels, the word segmentation vector can be quickly obtained through the information word segmentation, and then the information vector corresponding to the information to be replied can be accurately generated according to the image position and the word segmentation position.
Specifically, the extracting, by the electronic device, the target image in the message to be replied includes:
and acquiring information with the same preset format from the information to be replied as the target image.
The preset format may be any format of the indication image, for example, the preset format may be a JPG format, and the preset format may also be a PNG format.
And the target image can be quickly acquired from the information to be replied through the preset format.
Further, the electronic device generating an image vector of the target image from the all pixels includes:
acquiring a vector value corresponding to each pixel;
and splicing the vector values according to the pixel position of each pixel in the target image to obtain the image vector.
For example, the target image has 10 pixels, each pixel corresponds to a vector value of 0, 1, 0, 0, 1, 0, 0, 1, 1, 1, and the vector values are spliced according to the pixel positions to obtain the image vector of [0, 1, 0, 0, 1, 1 ].
Further, the electronic device performs word segmentation processing on the processed information by using a crust algorithm to obtain information word segmentation.
Further, the electronic equipment acquires a vector corresponding to the information word segmentation from a vector mapping table as a word segmentation vector.
And S12, inputting the information vector into a pre-trained classification model to obtain a classification result and a result probability of the classification result, wherein the classification result comprises a target result, and the target result is used for indicating that the expression needs to be replied.
In at least one embodiment of the present invention, the classification model is used to detect whether the message to be replied needs to be replied by expression.
The result probability refers to the probability that the classification model classifies the information to be replied as the classification result.
The classification result may further include a feature result indicating that no expression is required to be replied.
In at least one embodiment of the present invention, before inputting the information vector into a pre-trained classification model, the method further comprises:
acquiring a preset learner, wherein the preset learner comprises a full connection layer;
acquiring historical sample data, wherein the historical sample data comprises historical information and user satisfaction;
dividing the historical sample data into training data and verification data;
adjusting parameters in the full connection layer by using the training data to obtain a classification learner;
determining an accuracy rate of the classification learner based on the validation data;
and if the accuracy is less than the preset accuracy, adjusting the classification learner according to the verification data until the accuracy of the classification learner is greater than or equal to the preset accuracy, and obtaining the classification model.
The preset learner further comprises convolution layers and a pooling layer, wherein each convolution layer comprises a plurality of convolution kernels with different sizes.
The full-connection layer is used for mapping the vector generated by the pooling layer.
The parameters in the full connection layer are adjusted by utilizing the training data, so that the mapping accuracy of the classification learner can be improved, and the classification learner is verified by the verification data, so that the classification accuracy of the classification model can be improved on the whole.
Specifically, the adjusting, by the electronic device, parameters in the full connection layer by using the training data to obtain a classification learner includes:
inputting the historical information into the full-connection layer for each training data to obtain an output result;
generating a learning rate according to the user satisfaction and the output result;
determining the training data with the best learning rate as target training data;
and adjusting the parameters according to the target training data to obtain the classification learner.
Through the implementation mode, the learning rate in the full connection layer can be improved, and therefore the classification accuracy of the classification learner can be improved.
Specifically, the generating, by the electronic device, the learning rate according to the user satisfaction and the output result includes:
calculating a difference between the user satisfaction and the output result;
and dividing the difference value by the output result to obtain the learning rate.
And S13, if the classification result is the target result, detecting whether the information to be replied contains user expression information or not to obtain a detection result.
In at least one embodiment of the present invention, the detection result includes two results, that is, the to-be-replied message includes user expression information, and the to-be-replied message does not include user expression information.
It should be noted that, when the to-be-replied message includes the emoticon of the user, it is indicated that the dependency of the user on the emoticon is high, and the chat robot can communicate with the user by using the emoticon more. And when the information to be replied does not contain the user expression, the chat robot avoids the communication between the user and the expression package by using the expression as much as possible.
In at least one embodiment of the present invention, the electronic device detects whether the to-be-replied message includes user expression information, and obtaining a detection result includes:
acquiring an input address of the target image;
determining a terminal corresponding to the input address as an input terminal of the target image, and acquiring a terminal number of the input terminal;
comparing the terminal number with all machine numbers in a preset terminal library;
and if the terminal number is different from all the machine numbers, determining the detection result as that the information to be replied contains the user expression information.
The target image comprises emotion information sent by a user and emotion information sent by the chat robot.
And the preset terminal library comprises machine numbers of all the chat robots.
The input address can be quickly obtained through the target log, the input terminal can be accurately determined through the input address, the terminal number can be accurately obtained, and the detection result can be quickly determined through the terminal number because each symbol in the input address does not need to be compared. In addition, by comparing the terminal number with all the machine numbers, the expression information of the user sent by the user can be accurately extracted from the target image, so that whether the information to be replied needs to be replied by adopting expressions or not can be detected.
Specifically, the acquiring, by the electronic device, the input address of the target image includes:
and acquiring information indicating an address from the target log as an input address of the target image.
And S14, generating a reply score according to the result probability and the detection result.
In at least one embodiment of the invention, the reply score indicates a score value of the message to be replied by the emoticon.
In at least one embodiment of the present invention, the generating, by the electronic device, a reply score according to the result probability and the detection result includes:
obtaining a first weight of the classification model;
determining the product of the result probability and the first weight as a first fraction of the information to be replied;
acquiring a detection value corresponding to the detection result, and acquiring a second weight of the user expression information;
determining the product of the detection value and the second weight as a second fraction of the message to be replied;
and calculating the sum of the first score and the second score to obtain the reply score.
The detection value refers to a numerical value corresponding to the detection result, for example, if the detection result indicates that the to-be-replied message includes user expression information, the detection value is 1.
For example, the first weight of the classification model is 0.2, the result probability is 0.8, the detection result a indicates that the information to be replied includes the user expression information, and then a detection value corresponding to the detection result a is 1, the second weight is 0.8, and after calculation, the first score is 0.16, the second score is 0.8, and therefore, the reply score is 0.96.
For another example, the detection result B indicates that the information to be replied does not include the user expression information, and then a detection value corresponding to the detection result B is obtained as-1, and the first score is obtained as 0.16 and the second score is obtained as-0.8 through calculation, so that the reply score is-0.64.
Through the embodiment, whether the emoticons need to be replied in the information to be replied can be comprehensively determined from multiple dimensions, and the determination accuracy is improved.
And S15, if the reply score is larger than a preset threshold value, extracting the characteristic information of the information to be replied.
In at least one embodiment of the present invention, the preset threshold may be set in a user-defined manner, and the value of the preset threshold is not limited by the present invention.
The characteristic information refers to information capable of representing the semantics of the information to be replied.
In at least one embodiment of the present invention, the extracting, by the electronic device, the feature information of the message to be replied includes:
generating a context feature vector set of each information word according to the word segmentation vectors;
calculating the product of each word segmentation vector in the context feature vector set and a first preset matrix to obtain a plurality of operation vectors of the information word segmentation, and calculating the average value of the operation vectors to obtain a middle vector of the information word segmentation;
multiplying the intermediate vector point by a second preset matrix to obtain a target matrix, wherein each column of vectors in the target matrix represents each characteristic of the information to be replied;
calculating the similarity between each column of vectors in the target matrix and the word segmentation vectors;
and determining the information participle corresponding to the participle vector with the maximum similarity and the target image as the characteristic information.
The first preset matrix and the second preset matrix are preset weight matrixes respectively.
Through the implementation mode, the information participle containing context semantics can be extracted from the information to be replied to serve as the feature information, the determination accuracy rate of the feature information is improved, and meanwhile, the target image can better express the emotion of a user, so that the target image is determined as the feature information, and the emotion recognition of the information to be replied can be facilitated.
And S16, performing emotion recognition on the characteristic information to obtain an emotion result, and performing intention recognition on the characteristic information to obtain an intention result.
In at least one embodiment of the invention, the emotional result may be a positive emotion such as happiness or a negative emotion such as disinterest.
The intention result refers to the intention of the user in the information to be replied.
In at least one embodiment of the present invention, the electronic device performs emotion recognition on the feature information through the pre-trained emotion recognition model to obtain an emotion result.
The emotion recognition model training method belongs to the prior art, and is not described in detail herein.
In at least one embodiment of the present invention, the electronic device performs intention recognition on the feature information, and obtaining an intention result includes:
acquiring a vector of the feature information from the word segmentation vector as a feature vector;
inputting the feature vector into a pre-trained bidirectional long and short term memory network to obtain a semantic vector;
and processing the semantic vector by using a laminated conditional random field to obtain the intention result.
Semantic information in the characteristic information can be acquired through the bidirectional long-short term memory network, and the intention result can be accurately identified.
And S17, selecting a matched expression from a preset expression library as a reply expression of the information to be replied according to the emotion result and the intention result.
It is emphasized that the reply emoticon may also be stored in a node of a blockchain in order to further ensure privacy and security of the reply emoticon.
In at least one embodiment of the present invention, the preset expression library stores a plurality of predefined expressions.
The reply expression refers to an expression which needs to reply to the message to be replied.
In at least one embodiment of the present invention, the selecting, by the electronic device, a matched expression from a preset expression library as a reply expression of the to-be-replied message according to the emotion result and the intention result includes:
selecting target expressions from a preset expression library according to the emotion results;
and screening the expression matched with the intention result from the target class expression as a reply expression of the information to be replied.
And the target expression refers to an expression corresponding to the emotion result.
By the implementation mode, the reply expression can be accurately acquired from the preset expression library.
In at least one embodiment of the invention, the method further comprises:
if the preset expression library does not contain the expression matched with the intention result, acquiring any expression from the target expression;
and synthesizing the arbitrary expression and the intention result to obtain the reply expression.
The intention result may be text information, for example, the intention result is "unable to do".
The reply expression refers to an expression containing text information (namely, the intention result).
Through the embodiment, the reply expression can be automatically synthesized when the corresponding expression is not stored in the preset expression library, and comprehensiveness is improved. In addition, the reply message contains the intention result, so that the user can be assisted to accurately learn the meaning expressed by the reply expression.
Specifically, the synthesizing, by the electronic device, the arbitrary expression and the intention result, and the obtaining the reply expression includes:
and recording the intention result into any position of any expression to obtain the reply expression.
The arbitrary position may include a lower part of the arbitrary expression, and may also include an upper part of the arbitrary expression.
According to the technical scheme, the information to be replied is analyzed and whether the information to be replied contains user expression information is detected through the classification model, and whether the expression needs to be replied in the information to be replied is determined by comparing reply scores generated according to the result probability and the detection result with a preset threshold.
Fig. 2 is a functional block diagram of an expression recovering device according to a preferred embodiment of the present invention. The expression replying device 11 includes an obtaining unit 110, a generating unit 111, an input unit 112, a detecting unit 113, an extracting unit 114, a recognizing unit 115, a selecting unit 116, a dividing unit 117, an adjusting unit 118, a determining unit 119, and a synthesizing unit 120. The module/unit referred to herein is a series of computer readable instruction segments that can be accessed by the processor 13 and perform a fixed function and that are stored in the memory 12. In the present embodiment, the functions of the modules/units will be described in detail in the following embodiments.
When receiving a reply request, the obtaining unit 110 obtains the information to be replied according to the reply request.
In at least one embodiment of the invention, the reply request is triggered to be generated when input information of a user is received. The information carried by the reply request includes, but is not limited to: a log number, etc.
The information to be replied refers to information that needs to be replied, and the information to be replied may include, but is not limited to: information currently input by the user, information of multiple rounds of conversations between the user and the chat robot, and the like.
The information to be replied can be text information, image information or voice information, and the invention does not limit the specific form of the information to be replied.
In at least one embodiment of the present invention, the obtaining unit 110 obtains the to-be-replied information according to the reply request, where the obtaining unit includes:
analyzing the message of the reply request to obtain the data information carried by the message;
acquiring information indicating a log from the data information as a log number;
writing the log number into a preset template to obtain an inquiry statement;
acquiring a log storage library, and operating the query statement in the log storage library to obtain a target log;
and determining the information carried by the method body in the target log as the information to be replied.
Wherein the data information includes, but is not limited to: a label indicating the log, the log number, etc.
The preset template refers to a preset statement capable of inquiring information, and the preset template can be a structured inquiry statement.
The log repository stores log information of a plurality of chat robots and users.
The method body refers to dialogue information between the chat robot and the user.
The data information can be quickly acquired by analyzing the message, so that the target log can be quickly acquired from the log storage library according to the acquired log number, and the information to be replied can be quickly acquired.
The generating unit 111 generates an information vector according to the information to be replied.
In at least one embodiment of the present invention, the information vector refers to a characterization vector of the information to be replied.
In at least one embodiment of the present invention, the generating unit 111 generates an information vector according to the information to be replied, including:
extracting a target image in the information to be replied, and acquiring all pixels in the target image;
generating an image vector of the target image according to all the pixels;
determining information except the target image in the information to be replied as information to be processed;
filtering stop words in the information to be processed to obtain processed information;
performing word segmentation processing on the processed information to obtain information word segmentation, and acquiring word segmentation vectors of the information word segmentation;
determining the image position of the target image in the information to be replied, and determining the word segmentation position of the information word segmentation in the information to be replied;
and splicing the image vector and the word segmentation vector according to the image position and the word segmentation position to obtain the information vector.
The target image can comprise an emoticon sent by any end in the information to be replied, and the any end comprises a user end and a chat robot.
The stop words comprise vocabularies with parts of speech being prepositions and the like.
The image position refers to a position where the target image appears in the information to be replied, and the image position may be a serial number, for example, the information to be replied is { user: do you happy today; the chat robot comprises: a (A is an emoticon), tweed; the user: i'm happy }, it is determined that a is the target image, and since a is in the second sentence in the message to be replied, the image position is 2.
The word segmentation position refers to a position where the information word segmentation appears in all the word segmentation of the information to be replied, and in accordance with the above example, the information word segmentation "today" is located at the second position of all the word segmentation, so that the word segmentation position of the information word segmentation "today" is 2.
The image vector of the target image can be accurately generated through all the pixels, the word segmentation vector can be quickly obtained through the information word segmentation, and then the information vector corresponding to the information to be replied can be accurately generated according to the image position and the word segmentation position.
Specifically, the generating unit 111 extracting the target image in the message to be replied includes:
and acquiring information with the same preset format from the information to be replied as the target image.
The preset format may be any format of the indication image, for example, the preset format may be a JPG format, and the preset format may also be a PNG format.
And the target image can be quickly acquired from the information to be replied through the preset format.
Further, the generating unit 111 generates the image vector of the target image from the all pixels includes:
acquiring a vector value corresponding to each pixel;
and splicing the vector values according to the pixel position of each pixel in the target image to obtain the image vector.
For example, the target image has 10 pixels, each pixel corresponds to a vector value of 0, 1, 0, 0, 1, 0, 0, 1, 1, 1, and the vector values are spliced according to the pixel positions to obtain the image vector of [0, 1, 0, 0, 1, 1 ].
Further, the generating unit 111 performs word segmentation processing on the processed information by using a blocking algorithm to obtain information word segmentation.
Further, the generating unit 111 acquires a vector corresponding to the information word from a vector mapping table as a word segmentation vector.
The input unit 112 inputs the information vector into a classification model trained in advance, and obtains a classification result and a result probability of the classification result, where the classification result includes a target result, and the target result is used to indicate that an expression needs to be replied.
In at least one embodiment of the present invention, the classification model is used to detect whether the message to be replied needs to be replied by expression.
The result probability refers to the probability that the classification model classifies the information to be replied as the classification result.
The classification result may further include a feature result indicating that no expression is required to be replied.
In at least one embodiment of the present invention, before inputting the information vector into a classification model trained in advance, the obtaining unit 110 obtains a preset learner, where the preset learner includes a full connection layer;
the obtaining unit 110 obtains history sample data, where the history sample data includes history information and user satisfaction;
the dividing unit 117 divides the history sample data into training data and verification data;
the adjusting unit 118 adjusts parameters in the fully-connected layer by using the training data to obtain a classification learner;
the determination unit 119 determines the accuracy of the classification learner based on the verification data;
if the accuracy is less than the predetermined accuracy, the adjusting unit 118 adjusts the classification learner according to the verification data until the accuracy of the classification learner is greater than or equal to the predetermined accuracy, so as to obtain the classification model.
The preset learner further comprises convolution layers and a pooling layer, wherein each convolution layer comprises a plurality of convolution kernels with different sizes.
The full-connection layer is used for mapping the vector generated by the pooling layer.
The parameters in the full connection layer are adjusted by utilizing the training data, so that the mapping accuracy of the classification learner can be improved, and the classification learner is verified by the verification data, so that the classification accuracy of the classification model can be improved on the whole.
Specifically, the adjusting unit 118 adjusts parameters in the fully-connected layer by using the training data, and obtaining a classification learner includes:
inputting the historical information into the full-connection layer for each training data to obtain an output result;
generating a learning rate according to the user satisfaction and the output result;
determining the training data with the best learning rate as target training data;
and adjusting the parameters according to the target training data to obtain the classification learner.
Through the implementation mode, the learning rate in the full connection layer can be improved, and therefore the classification accuracy of the classification learner can be improved.
Specifically, the adjusting unit 118 generates the learning rate according to the user satisfaction and the output result, including:
calculating a difference between the user satisfaction and the output result;
and dividing the difference value by the output result to obtain the learning rate.
If the classification result is the target result, the detection unit 113 detects whether the information to be replied includes user expression information, and obtains a detection result.
In at least one embodiment of the present invention, the detection result includes two results, that is, the to-be-replied message includes user expression information, and the to-be-replied message does not include user expression information.
It should be noted that, when the to-be-replied message includes the emoticon of the user, it is indicated that the dependency of the user on the emoticon is high, and the chat robot can communicate with the user by using the emoticon more. And when the information to be replied does not contain the user expression, the chat robot avoids the communication between the user and the expression package by using the expression as much as possible.
In at least one embodiment of the present invention, the detecting unit 113 detects whether the to-be-replied message includes user expression information, and obtaining a detection result includes:
acquiring an input address of the target image;
determining a terminal corresponding to the input address as an input terminal of the target image, and acquiring a terminal number of the input terminal;
comparing the terminal number with all machine numbers in a preset terminal library;
and if the terminal number is different from all the machine numbers, determining the detection result as that the information to be replied contains the user expression information.
The target image comprises emotion information sent by a user and emotion information sent by the chat robot.
And the preset terminal library comprises machine numbers of all the chat robots.
The input address can be quickly obtained through the target log, the input terminal can be accurately determined through the input address, the terminal number can be accurately obtained, and the detection result can be quickly determined through the terminal number because each symbol in the input address does not need to be compared. In addition, by comparing the terminal number with all the machine numbers, the expression information of the user sent by the user can be accurately extracted from the target image, so that whether the information to be replied needs to be replied by adopting expressions or not can be detected.
Specifically, the acquiring, by the detection unit 113, the input address of the target image includes:
and acquiring information indicating an address from the target log as an input address of the target image.
The generating unit 111 generates a reply score according to the result probability and the detection result.
In at least one embodiment of the invention, the reply score indicates a score value of the message to be replied by the emoticon.
In at least one embodiment of the present invention, the generating unit 111 generates the reply score according to the result probability and the detection result includes:
obtaining a first weight of the classification model;
determining the product of the result probability and the first weight as a first fraction of the information to be replied;
acquiring a detection value corresponding to the detection result, and acquiring a second weight of the user expression information;
determining the product of the detection value and the second weight as a second fraction of the message to be replied;
and calculating the sum of the first score and the second score to obtain the reply score.
The detection value refers to a numerical value corresponding to the detection result, for example, if the detection result indicates that the to-be-replied message includes user expression information, the detection value is 1.
For example, the first weight of the classification model is 0.2, the result probability is 0.8, the detection result a indicates that the information to be replied includes the user expression information, and then a detection value corresponding to the detection result a is 1, the second weight is 0.8, and after calculation, the first score is 0.16, the second score is 0.8, and therefore, the reply score is 0.96.
For another example, the detection result B indicates that the information to be replied does not include the user expression information, and then a detection value corresponding to the detection result B is obtained as-1, and the first score is obtained as 0.16 and the second score is obtained as-0.8 through calculation, so that the reply score is-0.64.
Through the embodiment, whether the emoticons need to be replied in the information to be replied can be comprehensively determined from multiple dimensions, and the determination accuracy is improved.
If the reply score is greater than the preset threshold, the extracting unit 114 extracts the feature information of the message to be replied.
In at least one embodiment of the present invention, the preset threshold may be set in a user-defined manner, and the value of the preset threshold is not limited by the present invention.
The characteristic information refers to information capable of representing the semantics of the information to be replied.
In at least one embodiment of the present invention, the extracting unit 114 extracts feature information of the message to be replied, including:
generating a context feature vector set of each information word according to the word segmentation vectors;
calculating the product of each word segmentation vector in the context feature vector set and a first preset matrix to obtain a plurality of operation vectors of the information word segmentation, and calculating the average value of the operation vectors to obtain a middle vector of the information word segmentation;
multiplying the intermediate vector point by a second preset matrix to obtain a target matrix, wherein each column of vectors in the target matrix represents each characteristic of the information to be replied;
calculating the similarity between each column of vectors in the target matrix and the word segmentation vectors;
and determining the information participle corresponding to the participle vector with the maximum similarity and the target image as the characteristic information.
The first preset matrix and the second preset matrix are preset weight matrixes respectively.
Through the implementation mode, the information participle containing context semantics can be extracted from the information to be replied to serve as the feature information, the determination accuracy rate of the feature information is improved, and meanwhile, the target image can better express the emotion of a user, so that the target image is determined as the feature information, and the emotion recognition of the information to be replied can be facilitated.
Recognition section 115 performs emotion recognition on the feature information to obtain an emotion result, and performs intention recognition on the feature information to obtain an intention result.
In at least one embodiment of the invention, the emotional result may be a positive emotion such as happiness or a negative emotion such as disinterest.
The intention result refers to the intention of the user in the information to be replied.
In at least one embodiment of the present invention, the recognition unit 115 performs emotion recognition on the feature information through the pre-trained emotion recognition model to obtain an emotion result.
The emotion recognition model training method belongs to the prior art, and is not described in detail herein.
In at least one embodiment of the present invention, the identifying unit 115 performs intent identification on the feature information, and obtaining an intent result includes:
acquiring a vector of the feature information from the word segmentation vector as a feature vector;
inputting the feature vector into a pre-trained bidirectional long and short term memory network to obtain a semantic vector;
and processing the semantic vector by using a laminated conditional random field to obtain the intention result.
Semantic information in the characteristic information can be acquired through the bidirectional long-short term memory network, and the intention result can be accurately identified.
The selecting unit 116 selects a matched expression from a preset expression library as a reply expression of the to-be-replied information according to the emotion result and the intention result.
It is emphasized that the reply emoticon may also be stored in a node of a blockchain in order to further ensure privacy and security of the reply emoticon.
In at least one embodiment of the present invention, the preset expression library stores a plurality of predefined expressions.
The reply expression refers to an expression which needs to reply to the message to be replied.
In at least one embodiment of the present invention, the selecting unit 116 selects a matched expression from a preset expression library as a reply expression of the to-be-replied message according to the emotion result and the intention result, where the selecting unit includes:
selecting target expressions from a preset expression library according to the emotion results;
and screening the expression matched with the intention result from the target class expression as a reply expression of the information to be replied.
And the target expression refers to an expression corresponding to the emotion result.
By the implementation mode, the reply expression can be accurately acquired from the preset expression library.
In at least one embodiment of the present invention, if the preset expression library does not include an expression matching the intention result, the obtaining unit 110 obtains any expression from the target expression;
the synthesis unit 120 synthesizes the arbitrary expression and the intention result to obtain the reply expression.
The intention result may be text information, for example, the intention result is "unable to do".
The reply expression refers to an expression containing text information (namely, the intention result).
Through the embodiment, the reply expression can be automatically synthesized when the corresponding expression is not stored in the preset expression library, and comprehensiveness is improved. In addition, the reply message contains the intention result, so that the user can be assisted to accurately learn the meaning expressed by the reply expression.
Specifically, the synthesizing unit 120 synthesizes the arbitrary expression and the intention result, and obtaining the reply expression includes:
and recording the intention result into any position of any expression to obtain the reply expression.
The arbitrary position may include a lower part of the arbitrary expression, and may also include an upper part of the arbitrary expression.
According to the technical scheme, the information to be replied is analyzed and whether the information to be replied contains user expression information is detected through the classification model, and whether the expression needs to be replied in the information to be replied is determined by comparing reply scores generated according to the result probability and the detection result with a preset threshold.
Fig. 3 is a schematic structural diagram of an electronic device implementing an expression reply method according to a preferred embodiment of the present invention.
In one embodiment of the present invention, the electronic device 1 includes, but is not limited to, a memory 12, a processor 13, and computer readable instructions, such as an emoticon, stored in the memory 12 and executable on the processor 13.
It will be appreciated by a person skilled in the art that the schematic diagram is only an example of the electronic device 1 and does not constitute a limitation of the electronic device 1, and that it may comprise more or less components than shown, or some components may be combined, or different components, e.g. the electronic device 1 may further comprise an input output device, a network access device, a bus, etc.
The Processor 13 may be a Central Processing Unit (CPU), other general purpose Processor, a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), a Field Programmable Gate Array (FPGA) or other Programmable logic device, discrete Gate or transistor logic device, discrete hardware component, etc. The processor 13 is an operation core and a control center of the electronic device 1, and is connected to each part of the whole electronic device 1 by various interfaces and lines, and executes an operating system of the electronic device 1 and various installed application programs, program codes, and the like.
Illustratively, the computer readable instructions may be partitioned into one or more modules/units that are stored in the memory 12 and executed by the processor 13 to implement the present invention. The one or more modules/units may be a series of computer readable instruction segments capable of performing specific functions, which are used for describing the execution process of the computer readable instructions in the electronic device 1. For example, the computer-readable instructions may be divided into an acquisition unit 110, a generation unit 111, an input unit 112, a detection unit 113, an extraction unit 114, a recognition unit 115, a selection unit 116, a division unit 117, an adjustment unit 118, a determination unit 119, and a synthesis unit 120.
The memory 12 may be used for storing the computer readable instructions and/or modules, and the processor 13 implements various functions of the electronic device 1 by executing or executing the computer readable instructions and/or modules stored in the memory 12 and invoking data stored in the memory 12. The memory 12 may mainly include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application program required by at least one function (such as a sound playing function, an image playing function, etc.), and the like; the storage data area may store data created according to use of the electronic device, and the like. The memory 12 may include non-volatile and volatile memories, such as: a hard disk, a memory, a plug-in hard disk, a Smart Media Card (SMC), a Secure Digital (SD) Card, a Flash memory Card (Flash Card), at least one magnetic disk storage device, a Flash memory device, or other storage device.
The memory 12 may be an external memory and/or an internal memory of the electronic device 1. Further, the memory 12 may be a memory having a physical form, such as a memory stick, a TF Card (Trans-flash Card), or the like.
The integrated modules/units of the electronic device 1 may be stored in a computer-readable storage medium if they are implemented in the form of software functional units and sold or used as separate products. Based on such understanding, all or part of the flow of the method according to the above embodiments may be implemented by hardware that is configured to be instructed by computer readable instructions, which may be stored in a computer readable storage medium, and when the computer readable instructions are executed by a processor, the steps of the method embodiments may be implemented.
Wherein the computer readable instructions comprise computer readable instruction code which may be in source code form, object code form, an executable file or some intermediate form, and the like. The computer-readable medium may include: any entity or device capable of carrying said computer readable instruction code, recording medium, U-disk, removable hard disk, magnetic disk, optical disk, computer Memory, Read-Only Memory (ROM), Random Access Memory (RAM).
The block chain is a novel application mode of computer technologies such as distributed data storage, point-to-point transmission, a consensus mechanism, an encryption algorithm and the like. A block chain (Blockchain), which is essentially a decentralized database, is a series of data blocks associated by using a cryptographic method, and each data block contains information of a batch of network transactions, so as to verify the validity (anti-counterfeiting) of the information and generate a next block. The blockchain may include a blockchain underlying platform, a platform product service layer, an application service layer, and the like.
With reference to fig. 1, the memory 12 in the electronic device 1 stores computer-readable instructions to implement an emotion replying method, and the processor 13 can execute the computer-readable instructions to implement:
when a reply request is received, acquiring information to be replied according to the reply request;
generating an information vector according to the information to be replied;
inputting the information vector into a classification model trained in advance to obtain a classification result and a result probability of the classification result, wherein the classification result comprises a target result, and the target result is used for indicating that the expression needs to be replied;
if the classification result is the target result, detecting whether the information to be replied contains user expression information or not to obtain a detection result;
generating a reply score according to the result probability and the detection result;
if the reply score is larger than a preset threshold value, extracting the characteristic information of the information to be replied;
performing emotion recognition on the characteristic information to obtain an emotion result, and performing intention recognition on the characteristic information to obtain an intention result;
and selecting a matched expression from a preset expression library as a reply expression of the information to be replied according to the emotion result and the intention result.
Specifically, the processor 13 may refer to the description of the relevant steps in the embodiment corresponding to fig. 1 for a specific implementation method of the computer readable instructions, which is not described herein again.
In the embodiments provided in the present invention, it should be understood that the disclosed system, apparatus and method may be implemented in other ways. For example, the above-described apparatus embodiments are merely illustrative, and for example, the division of the modules is only one logical functional division, and other divisions may be realized in practice.
The computer readable storage medium has computer readable instructions stored thereon, wherein the computer readable instructions when executed by the processor 13 are configured to implement the steps of:
when a reply request is received, acquiring information to be replied according to the reply request;
generating an information vector according to the information to be replied;
inputting the information vector into a classification model trained in advance to obtain a classification result and a result probability of the classification result, wherein the classification result comprises a target result, and the target result is used for indicating that the expression needs to be replied;
if the classification result is the target result, detecting whether the information to be replied contains user expression information or not to obtain a detection result;
generating a reply score according to the result probability and the detection result;
if the reply score is larger than a preset threshold value, extracting the characteristic information of the information to be replied;
performing emotion recognition on the characteristic information to obtain an emotion result, and performing intention recognition on the characteristic information to obtain an intention result;
and selecting a matched expression from a preset expression library as a reply expression of the information to be replied according to the emotion result and the intention result.
The modules described as separate parts may or may not be physically separate, and parts displayed as modules may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of the present embodiment.
In addition, functional modules in the embodiments of the present invention may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit. The integrated unit can be realized in a form of hardware, or in a form of hardware plus a software functional module.
The present embodiments are therefore to be considered in all respects as illustrative and not restrictive, the scope of the invention being indicated by the appended claims rather than by the foregoing description, and all changes which come within the meaning and range of equivalency of the claims are therefore intended to be embraced therein. Any reference signs in the claims shall not be construed as limiting the claim concerned.
Furthermore, it is obvious that the word "comprising" does not exclude other elements or steps, and the singular does not exclude the plural. The plurality of units or devices may also be implemented by one unit or device through software or hardware. The terms first, second, etc. are used to denote names, but not any particular order.
Finally, it should be noted that the above embodiments are only for illustrating the technical solutions of the present invention and not for limiting, and although the present invention is described in detail with reference to the preferred embodiments, it should be understood by those skilled in the art that modifications or equivalent substitutions may be made on the technical solutions of the present invention without departing from the spirit and scope of the technical solutions of the present invention.

Claims (10)

1. An expression reply method, characterized in that the expression reply method comprises:
when a reply request is received, acquiring information to be replied according to the reply request;
generating an information vector according to the information to be replied;
inputting the information vector into a classification model trained in advance to obtain a classification result and a result probability of the classification result, wherein the classification result comprises a target result, and the target result is used for indicating that the expression needs to be replied;
if the classification result is the target result, detecting whether the information to be replied contains user expression information or not to obtain a detection result;
generating a reply score according to the result probability and the detection result;
if the reply score is larger than a preset threshold value, extracting the characteristic information of the information to be replied;
performing emotion recognition on the characteristic information to obtain an emotion result, and performing intention recognition on the characteristic information to obtain an intention result;
and selecting a matched expression from a preset expression library as a reply expression of the information to be replied according to the emotion result and the intention result.
2. The expression reply method of claim 1, wherein the generating an information vector according to the information to be replied comprises:
extracting a target image in the information to be replied, and acquiring all pixels in the target image;
generating an image vector of the target image according to all the pixels;
determining information except the target image in the information to be replied as information to be processed;
filtering stop words in the information to be processed to obtain processed information;
performing word segmentation processing on the processed information to obtain information word segmentation, and acquiring word segmentation vectors of the information word segmentation;
determining the image position of the target image in the information to be replied, and determining the word segmentation position of the information word segmentation in the information to be replied;
and splicing the image vector and the word segmentation vector according to the image position and the word segmentation position to obtain the information vector.
3. The expression reply method of claim 2, wherein the detecting whether the message to be replied contains the user expression information or not and obtaining the detection result comprises:
acquiring an input address of the target image;
determining a terminal corresponding to the input address as an input terminal of the target image, and acquiring a terminal number of the input terminal;
comparing the terminal number with all machine numbers in a preset terminal library;
and if the terminal number is different from all the machine numbers, determining the detection result as that the information to be replied contains the user expression information.
4. The expression reply method according to claim 2, wherein the extracting the feature information of the information to be replied comprises:
generating a context feature vector set of each information word according to the word segmentation vectors;
calculating the product of each word segmentation vector in the context feature vector set and a first preset matrix to obtain a plurality of operation vectors of the information word segmentation, and calculating the average value of the operation vectors to obtain a middle vector of the information word segmentation;
multiplying the intermediate vector point by a second preset matrix to obtain a target matrix, wherein each column of vectors in the target matrix represents each characteristic of the information to be replied;
calculating the similarity between each column of vectors in the target matrix and the word segmentation vectors;
and determining the information participle corresponding to the participle vector with the maximum similarity and the target image as the characteristic information.
5. The expression reply method according to claim 2, wherein the performing intent recognition on the feature information to obtain an intent result comprises:
acquiring a vector of the feature information from the word segmentation vector as a feature vector;
inputting the feature vector into a pre-trained bidirectional long and short term memory network to obtain a semantic vector;
and processing the semantic vector by using a laminated conditional random field to obtain the intention result.
6. The expression reply method according to claim 1, wherein before inputting the information vector into a pre-trained classification model, the method further comprises:
acquiring a preset learner, wherein the preset learner comprises a full connection layer;
acquiring historical sample data, wherein the historical sample data comprises historical information and user satisfaction;
dividing the historical sample data into training data and verification data;
adjusting parameters in the full connection layer by using the training data to obtain a classification learner;
determining an accuracy rate of the classification learner based on the validation data;
and if the accuracy is less than the preset accuracy, adjusting the classification learner according to the verification data until the accuracy of the classification learner is greater than or equal to the preset accuracy, and obtaining the classification model.
7. The expression reply method of claim 1, wherein the generating a reply score according to the result probability and the detection result comprises:
obtaining a first weight of the classification model;
determining the product of the result probability and the first weight as a first fraction of the information to be replied;
acquiring a detection value corresponding to the detection result, and acquiring a second weight of the user expression information;
determining the product of the detection value and the second weight as a second fraction of the message to be replied;
and calculating the sum of the first score and the second score to obtain the reply score.
8. An expression reply device, characterized in that the expression reply device comprises:
the device comprises an acquisition unit, a processing unit and a processing unit, wherein the acquisition unit is used for acquiring information to be replied according to a reply request when the reply request is received;
the generating unit is used for generating an information vector according to the information to be replied;
the input unit is used for inputting the information vector into a pre-trained classification model to obtain a classification result and a result probability of the classification result, wherein the classification result comprises a target result, and the target result is used for indicating that the expression needs to be replied;
the detection unit is used for detecting whether the information to be replied contains user expression information or not if the classification result is the target result, and obtaining a detection result;
the generating unit is further used for generating a reply score according to the result probability and the detection result;
the extracting unit is used for extracting the characteristic information of the information to be replied if the reply score is larger than a preset threshold value;
the identification unit is used for carrying out emotion identification on the characteristic information to obtain an emotion result and carrying out intention identification on the characteristic information to obtain an intention result;
and the selecting unit is used for selecting the matched expression from a preset expression library as the reply expression of the information to be replied according to the emotion result and the intention result.
9. An electronic device, characterized in that the electronic device comprises:
a memory storing computer readable instructions; and
a processor executing computer readable instructions stored in the memory to implement the expression reply method of any of claims 1 to 7.
10. A computer-readable storage medium characterized by: the computer-readable storage medium stores computer-readable instructions, which are executed by a processor in an electronic device to implement the expression reply method according to any one of claims 1 to 7.
CN202110645856.4A 2021-06-10 2021-06-10 Expression reply method, device, equipment and storage medium Active CN113094478B (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
CN202110645856.4A CN113094478B (en) 2021-06-10 2021-06-10 Expression reply method, device, equipment and storage medium
PCT/CN2022/071318 WO2022257452A1 (en) 2021-06-10 2022-01-11 Meme reply method and apparatus, and device and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110645856.4A CN113094478B (en) 2021-06-10 2021-06-10 Expression reply method, device, equipment and storage medium

Publications (2)

Publication Number Publication Date
CN113094478A true CN113094478A (en) 2021-07-09
CN113094478B CN113094478B (en) 2021-08-13

Family

ID=76662686

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110645856.4A Active CN113094478B (en) 2021-06-10 2021-06-10 Expression reply method, device, equipment and storage medium

Country Status (2)

Country Link
CN (1) CN113094478B (en)
WO (1) WO2022257452A1 (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114637833A (en) * 2022-03-24 2022-06-17 支付宝(杭州)信息技术有限公司 Man-machine interaction method, device and equipment
CN114860912A (en) * 2022-05-20 2022-08-05 马上消费金融股份有限公司 Data processing method and device, electronic equipment and storage medium
WO2022257452A1 (en) * 2021-06-10 2022-12-15 平安科技(深圳)有限公司 Meme reply method and apparatus, and device and storage medium

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106683672A (en) * 2016-12-21 2017-05-17 竹间智能科技(上海)有限公司 Intelligent dialogue method and system based on emotion and semantics
JP2019012457A (en) * 2017-06-30 2019-01-24 新日鉄住金ソリューションズ株式会社 Information processing device, information processing method, and program
CN110895558A (en) * 2018-08-23 2020-03-20 北京搜狗科技发展有限公司 Dialog reply method and related device
CN111897933A (en) * 2020-07-27 2020-11-06 腾讯科技(深圳)有限公司 Emotional dialogue generation method and device and emotional dialogue model training method and device
DE112019001533T5 (en) * 2018-05-24 2020-12-10 International Business Machines Corporation EXTENSION OF TRAINING DATA FOR THE CLASSIFICATION OF NATURAL LANGUAGE

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110232116B (en) * 2019-05-31 2021-07-27 腾讯科技(深圳)有限公司 Method and device for adding expressions in reply sentence
US20200396187A1 (en) * 2019-06-14 2020-12-17 Microsoft Technology Licensing, Llc Email reactions through embedded tokens
CN111193657A (en) * 2019-12-12 2020-05-22 广州啦咔网络科技有限公司 Chat expression reply method, device and storage medium
CN113094478B (en) * 2021-06-10 2021-08-13 平安科技(深圳)有限公司 Expression reply method, device, equipment and storage medium

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106683672A (en) * 2016-12-21 2017-05-17 竹间智能科技(上海)有限公司 Intelligent dialogue method and system based on emotion and semantics
JP2019012457A (en) * 2017-06-30 2019-01-24 新日鉄住金ソリューションズ株式会社 Information processing device, information processing method, and program
DE112019001533T5 (en) * 2018-05-24 2020-12-10 International Business Machines Corporation EXTENSION OF TRAINING DATA FOR THE CLASSIFICATION OF NATURAL LANGUAGE
CN110895558A (en) * 2018-08-23 2020-03-20 北京搜狗科技发展有限公司 Dialog reply method and related device
CN111897933A (en) * 2020-07-27 2020-11-06 腾讯科技(深圳)有限公司 Emotional dialogue generation method and device and emotional dialogue model training method and device

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2022257452A1 (en) * 2021-06-10 2022-12-15 平安科技(深圳)有限公司 Meme reply method and apparatus, and device and storage medium
CN114637833A (en) * 2022-03-24 2022-06-17 支付宝(杭州)信息技术有限公司 Man-machine interaction method, device and equipment
CN114860912A (en) * 2022-05-20 2022-08-05 马上消费金融股份有限公司 Data processing method and device, electronic equipment and storage medium
CN114860912B (en) * 2022-05-20 2023-08-29 马上消费金融股份有限公司 Data processing method, device, electronic equipment and storage medium

Also Published As

Publication number Publication date
WO2022257452A1 (en) 2022-12-15
CN113094478B (en) 2021-08-13

Similar Documents

Publication Publication Date Title
CN111695033B (en) Enterprise public opinion analysis method, enterprise public opinion analysis device, electronic equipment and medium
CN111046133B (en) Question and answer method, equipment, storage medium and device based on mapping knowledge base
CN111695352A (en) Grading method and device based on semantic analysis, terminal equipment and storage medium
CN113094478B (en) Expression reply method, device, equipment and storage medium
CN110334179B (en) Question-answer processing method, device, computer equipment and storage medium
CN110222328B (en) Method, device and equipment for labeling participles and parts of speech based on neural network and storage medium
CN113408278B (en) Intention recognition method, device, equipment and storage medium
CN112528637A (en) Text processing model training method and device, computer equipment and storage medium
CN113656547B (en) Text matching method, device, equipment and storage medium
CN113435196B (en) Intention recognition method, device, equipment and storage medium
CN113032528A (en) Case analysis method, case analysis device, case analysis equipment and storage medium
CN112632248A (en) Question answering method, device, computer equipment and storage medium
CN113095072B (en) Text processing method and device
CN110532562B (en) Neural network training method, idiom misuse detection method and device and electronic equipment
CN111368066B (en) Method, apparatus and computer readable storage medium for obtaining dialogue abstract
CN113342977B (en) Invoice image classification method, device, equipment and storage medium
CN113705468A (en) Digital image identification method based on artificial intelligence and related equipment
CN113535925A (en) Voice broadcasting method, device, equipment and storage medium
CN112597299A (en) Text entity classification method and device, terminal equipment and storage medium
CN114528851B (en) Reply sentence determination method, reply sentence determination device, electronic equipment and storage medium
CN113627186B (en) Entity relation detection method based on artificial intelligence and related equipment
CN112949305B (en) Negative feedback information acquisition method, device, equipment and storage medium
CN113326365B (en) Reply sentence generation method, device, equipment and storage medium
CN113420545B (en) Abstract generation method, device, equipment and storage medium
CN114398482A (en) Dictionary construction 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
REG Reference to a national code

Ref country code: HK

Ref legal event code: DE

Ref document number: 40053567

Country of ref document: HK