CN116303937A - Reply method, reply device, electronic equipment and readable storage medium - Google Patents

Reply method, reply device, electronic equipment and readable storage medium Download PDF

Info

Publication number
CN116303937A
CN116303937A CN202310079546.XA CN202310079546A CN116303937A CN 116303937 A CN116303937 A CN 116303937A CN 202310079546 A CN202310079546 A CN 202310079546A CN 116303937 A CN116303937 A CN 116303937A
Authority
CN
China
Prior art keywords
rule
reply
input text
target
rule template
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202310079546.XA
Other languages
Chinese (zh)
Inventor
任珂
任展
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Cloudminds Shanghai Robotics Co Ltd
Original Assignee
Cloudminds Shanghai Robotics 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 Cloudminds Shanghai Robotics Co Ltd filed Critical Cloudminds Shanghai Robotics Co Ltd
Priority to CN202310079546.XA priority Critical patent/CN116303937A/en
Publication of CN116303937A publication Critical patent/CN116303937A/en
Pending legal-status Critical Current

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/332Query formulation
    • G06F16/3329Natural language query formulation or dialogue systems
    • 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/36Creation of semantic tools, e.g. ontology or thesauri
    • G06F16/367Ontology
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/10Text processing
    • G06F40/166Editing, e.g. inserting or deleting
    • G06F40/186Templates
    • 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
    • G06F40/295Named entity recognition
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/30Semantic analysis
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02WCLIMATE CHANGE MITIGATION TECHNOLOGIES RELATED TO WASTEWATER TREATMENT OR WASTE MANAGEMENT
    • Y02W90/00Enabling technologies or technologies with a potential or indirect contribution to greenhouse gas [GHG] emissions mitigation

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • Computational Linguistics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Artificial Intelligence (AREA)
  • General Health & Medical Sciences (AREA)
  • Audiology, Speech & Language Pathology (AREA)
  • Health & Medical Sciences (AREA)
  • Mathematical Physics (AREA)
  • Databases & Information Systems (AREA)
  • Data Mining & Analysis (AREA)
  • Life Sciences & Earth Sciences (AREA)
  • Animal Behavior & Ethology (AREA)
  • Human Computer Interaction (AREA)
  • Machine Translation (AREA)

Abstract

The disclosure relates to a reply method, a reply device, an electronic device and a readable storage medium, wherein the method comprises the following steps: obtaining an input text, extracting key entities from the input text to obtain an entity recognition result of the input text, segmenting the input text, matching the segmented input text with rule templates in a rule template library, screening candidate rule templates containing key words, wherein the rule template library comprises rule templates of all predefined problem categories, one rule template corresponds to one or more reply rules, screening out a target rule template from the candidate rule templates based on a regular matching method, and obtaining replies corresponding to the input text based on the entity recognition result and the reply rules of the target rule template; and obtaining a reply rule from a predefined rule template library through the entity extraction result and the semantic matching result, and obtaining a reply corresponding to the input text according to the reply rule, so that reply sentences are optimized, and the spam reply is more diversified.

Description

Reply method, reply device, electronic equipment and readable storage medium
Technical Field
The disclosure relates to the field of computer technology, and in particular, to a reply method, a reply device, an electronic device and a readable storage medium.
Background
In most artificial intelligence dialogue systems, for the problem that the dialogue system or the third party process cannot accurately reply, a fixed reply is usually used as a reply to the problem, so that the dialogue system is prevented from having any response. This approach often makes the robot feel too stiff to reply to the user, feel the dialog system less intelligent, and cannot understand the meaning of the user. Therefore, a reply method is needed to make the spam reply in such a scenario more diverse and more intelligent for the dialog system to behave.
Disclosure of Invention
The present disclosure provides an electronic device, which makes a dialog system behave more intelligently by enabling spam replies to be more diverse through key entity extraction and generalized intent matching when facing a problem that cannot be accurately replied.
To achieve the above object, a first aspect of an embodiment of the present disclosure provides a reply method, including: acquiring an input text; extracting key entities from the input text to obtain an entity identification result of the input text; performing word segmentation on the input text, matching the segmented input text with rule templates in a rule template library, and screening candidate rule templates containing keywords; the rule template library comprises rule templates of each predefined problem category, and one rule template corresponds to one or more reply rules; screening out a target rule template from the candidate rule templates based on a regular matching method; and obtaining a reply corresponding to the input text based on the entity identification result and the reply rule of the target rule template.
Optionally, the word segmentation is performed on the input text, the word segmented input text is matched with a rule template in a rule template library, and candidate rule templates containing keywords are screened out, including: word segmentation is carried out on the input text to obtain one or more words; determining the keyword from the one or more words; and matching the keyword with each rule template in the rule template library, and taking the rule template containing the keyword as the candidate rule template.
Optionally, the determining the keyword from the one or more words includes: obtaining a problem category contained in the rule template library; matching each of the one or more terms to the problem category; and taking the words corresponding to the problem category semantics as the keywords.
Optionally, the screening the target rule template from the candidate rule templates based on the regular matching method includes: comparing the semantics and sequence of each word of the candidate rule template with the semantics and sequence of each word of the input text; and taking the candidate rule templates, which completely correspond to the input text, of the semantics of each word and the sequence of each word as the target rule templates.
Optionally, the obtaining the reply corresponding to the input text based on the entity recognition result and the reply rule of the target rule template includes: acquiring one or more reply rules corresponding to the target rule template; determining a target reply rule from the one or more reply rules; and replacing the entity in the entity identification result to the appointed position of the target reply rule to obtain a reply corresponding to the input text.
Optionally, the determining a target reply rule from the one or more reply rules includes: randomly selecting one from the one or more reply rules as the target reply rule.
Optionally, the replacing the entity in the entity identification result to the designated position of the target reply rule to obtain the reply corresponding to the input text includes: under the condition that the entity identification result comprises a plurality of entities, replacing the entity with the largest character number to the appointed position of the target reply rule to obtain a reply corresponding to the input text; or replacing the entity in front of the input text to the appointed position of the target reply rule to obtain a reply corresponding to the input text.
According to a second aspect of embodiments of the present disclosure, there is provided a recovery device comprising: the acquisition module is used for acquiring an input text; the identification module is used for extracting key entities from the input text to obtain an entity identification result of the input text; the processing module is used for segmenting the input text, matching the segmented input text with rule templates in the rule template library, and screening candidate rule templates containing keywords; the rule template library comprises rule templates of each predefined problem category, and one rule template corresponds to one or more reply rules; the screening module is used for screening out a target rule template from the candidate rule templates based on a regular matching method; and the processing module is also used for obtaining a reply corresponding to the input text based on the entity identification result and the reply rule of the target rule template.
According to a third aspect of embodiments of the present disclosure, there is provided an electronic device, comprising: a processor; a memory for storing processor-executable instructions; wherein the processor is configured to execute the executable instructions to implement the steps of the reply method described above.
According to a fourth aspect of embodiments of the present disclosure, there is provided a computer readable storage medium having stored thereon computer program instructions which, when executed by a processor, implement the steps of the reply method provided by the first aspect of the present disclosure.
The technical scheme provided by the embodiment of the disclosure can comprise the following beneficial effects: the method comprises the steps that an input text can be obtained, key entity extraction is carried out on the input text to obtain an entity identification result of the input text, word segmentation is carried out on the input text, the input text after word segmentation is matched with rule templates in a rule template library, candidate rule templates containing key words are screened out, the rule template library comprises rule templates of all problem categories defined in advance, one rule template corresponds to one or more reply rules, a target rule template is screened out from the candidate rule templates based on a regular matching method, and replies corresponding to the input text are obtained based on the entity identification result and the reply rules of the target rule template; under the condition that accurate reply cannot be carried out on the input text, key entity extraction and generalized semantic matching are carried out on the input text, reply rules are obtained from a predefined rule template library through entity extraction results and semantic matching results, replies corresponding to the input text are obtained according to the reply rules, reply sentences are optimized, the spam replies are more diversified, and a dialogue system is more intelligent in appearance.
Additional features and advantages of the present disclosure will be set forth in the detailed description which follows.
Drawings
The accompanying drawings are included to provide a further understanding of the disclosure, and are incorporated in and constitute a part of this specification, illustrate the disclosure and together with the description serve to explain, but do not limit the disclosure. In the drawings:
fig. 1 is a schematic diagram of a computer system according to an exemplary embodiment of the present disclosure.
Fig. 2 is a flow chart of a reply method shown in an exemplary embodiment of the present disclosure.
Fig. 3 is a block diagram of a reply device according to one example embodiment.
Fig. 4 is a block diagram of an apparatus according to an example embodiment.
Detailed Description
Specific embodiments of the present disclosure are described in detail below with reference to the accompanying drawings. It should be understood that the detailed description and specific examples, while indicating and illustrating the disclosure, are not intended to limit the disclosure.
It should be noted that, all actions for acquiring signals, information or data in the present disclosure are performed under the condition of conforming to the corresponding data protection rule policy of the country of the location and obtaining the authorization given by the owner of the corresponding device.
It is understood that the term "plurality" in this disclosure means two or more, and other adjectives are similar thereto. "and/or" describes an association relationship of an association object, meaning that there may be three relationships, e.g., a and/or B, may represent: a exists alone, A and B exist together, and B exists alone. The character "/" generally indicates that the context-dependent object is an "or" relationship. The singular forms "a," "an," and "the" are intended to include the plural forms as well, unless the context clearly indicates otherwise.
Fig. 1 is a schematic diagram of a computer system including a terminal 120 and a server 140, which is shown in an exemplary embodiment of the present disclosure.
The terminal 120 and the server 140 are connected to each other through a wired or wireless network.
The terminal 120 may include at least one of a smart phone, a notebook computer, a desktop computer, a tablet computer, a smart speaker, and a smart robot.
Terminal 120 includes a display; the display may be used to display a reply to the input text.
The terminal 120 includes a first memory and a first processor. The first memory stores a first program; the first program is called and executed by the first processor to implement the reply method provided by the present disclosure. The first memory may include, but is not limited to, the following: random access Memory (Random Access Memory, RAM), read Only Memory (ROM), programmable Read Only Memory (Programmable Read-Only Memory, PROM), erasable Read Only Memory (Erasable Programmable Read-Only Memory, EPROM), and electrically erasable Read Only Memory (Electric Erasable Programmable Read-Only Memory, EEPROM).
The first processor may be one or more integrated circuit chips. Alternatively, the first processor may be a general purpose processor, such as a central processing unit (Central Processing Unit, CPU) or a network processor (Network Processor, NP).
The server 140 includes a second memory and a second processor. The second memory stores a second program, and the second program is called by the second processor to implement the reply method provided by the disclosure. Alternatively, the second memory may include, but is not limited to, the following: RAM, ROM, PROM, EPROM, EEPROM. Alternatively, the second processor may be a general purpose processor, such as a CPU or NP.
The server may be an independent physical server, a server cluster or a distributed system formed by a plurality of physical servers, or a cloud server providing cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, CDNs (Content Delivery Network, content delivery networks), basic cloud computing services such as big data and artificial intelligent platforms, and the like. The terminal may be, but is not limited to, a smart phone, a tablet computer, a notebook computer, a desktop computer, a smart speaker, a smart watch, etc. The terminal and the server may be directly or indirectly connected through wired or wireless communication, and the disclosure is not limited herein.
Fig. 2 is a flowchart of a reply method according to an exemplary embodiment of the present disclosure, and as shown in fig. 1, the reply method is used in a terminal such as an intelligent robot, an intelligent dialogue system, and the like, and includes the following steps.
In step S11, an input text is acquired.
The input text is a query sentence input by the user, and asks the dialogue system for a question, for example, the user asks the dialogue system how to go to the Xilin snow mountain, and asks how to go to the library A. The input text may be input by a user in voice, manually by a user, or in other possible input manners, which is not limited by the present disclosure.
In step S12, the key entity extraction is performed on the input text to obtain the entity recognition result of the input text.
The keyword extraction refers to extracting words with specific meaning in the text, such as a person name, a place name, an organization name, a proper noun, and the like, and marking the words to be identified in the text sequence, or may also be called named entity identification (Named Entity Recognition, NER).
For example, the keyword extraction of the input text "how to go to the west mountain" may obtain the entity "west mountain" related to the place, and the keyword extraction of the input text "please ask how to go to the a-market library" may obtain the entity "a-market library" or "a-market" related to the place, where "west mountain", "a-market library" or "a-market" are entity recognition results.
By way of example, the input text may be entity identified by a NER model, which may be, but is not limited to, template NER, demonstration NER, etc., or other model that may be entity identified by the input text, which is not limiting to the present disclosure.
In step S13, the input text is segmented, the segmented input text is matched with rule templates in the rule template library, and candidate rule templates containing keywords are screened out.
The word segmentation refers to dividing the subjects, predicates, objects and prepositions in the input text, for example, dividing the words of the input text "how to go to the Xilin and the three words of the input text" how to go to the Xilin and the Xilin "mentioned in the previous step, the input text after word segmentation can be recorded as [ how to go to the Xilin and the Xilin ], and the word segmentation of the input text" how to ask to the A library "can be obtained [ how to ask to the I to go to the A library ].
The rule template library comprises rule templates of each predefined problem category, and one rule template corresponds to one or more reply rules; wherein the question category includes, but is not limited to, questions of the query location, the category of query weather, or the price of the query commodity, etc., each category of questions corresponds to a rule template, e.g., the rule template of the questions of the query location may be "[0:5| ] [ how|how ] [ to|go ] @ sys.any: any", where [0:5| ] means that there may be no more than 5 characters, e.g., may be "ask", "ask once", etc., where @ sys.any: any means that matching of any characters may be supported herein, without limitation in length; one rule template corresponds to one or more reply rules, e.g., the rule template of the previous example "[0:5| ] [ how|how ] [ to|go ] @ sys.any: any" the corresponding reply rule may be "I am also curious [ $], pungent you find others to hear [ $], or" this [ $] mystery, I am also unaware where you do not ask nearby people bars ", where [ $ ] is a replacement bit, which may be replaced by an entity identified in the input text.
In one embodiment, after word segmentation is performed on the input text to obtain one or more words, a keyword needs to be determined from the one or more words, the keyword is matched with each rule template in the rule template library, and the rule template containing the keyword is used as a candidate rule template. The keywords may be words having a specific meaning in the input text, that is, the keywords are entities in the input text, for example, the keywords in the input text "how to go to the west mountain snow mountain" are "west mountain snow mountain", the keywords in the input text "how to ask how to go to the a market library" are "a market library" or "a market", and the keywords may also be words corresponding to the problem category semantics, such as the problem category of the query location corresponding to the "west mountain snow mountain". After the keywords are determined, matching the keywords with each rule template in the rule template library, and taking the rule templates containing the keywords as candidate rule templates.
In step S14, a target rule template is screened from candidate rule templates based on the regular matching method.
By way of example, the user inputs the text "how to ask for the library in the city a" by voice, and the input text can be matched with two candidate rule templates of "[0:5 ] how to @ sys.any" and "[0:5 ] how to @ sys.any @" and the word-segmented input text [ how to ask for @ a library ] the semantics and order of each word in "[0:5 ] how to @ sys.any @ any" are in one-to-one correspondence with the semantics and order of each word in "[0:5 ] how to @ sys.any @" and thus "[0:5 ] how to @ sys.any" can be used as the target rule template.
In step S15, a reply corresponding to the input text is obtained based on the entity recognition result and the reply rule of the target rule template.
In the foregoing, each rule template corresponds to one or more reply rules, so after the target rule template is obtained, one or more reply rules corresponding to the target rule template are obtained, and a reply corresponding to the input text is obtained based on the entity identification result and the reply rules of the target rule template. For example, "[0:5 ] how |how |go @ sys.any: any" the corresponding reply rule may be "i am curious [ $ ] where you are listening to, or" this [ $ ] mystery, i am not aware where you are not asking about nearby bars, "in one embodiment, one of the two reply rules may be selected randomly as the target reply rule. Then, replacing the entity in the entity identification result to the appointed position of the target reply rule to obtain a reply corresponding to the input text; the designated position herein refers to the replacement bit [ $ ]. For example, replacing the entity "A library" in the input text "please ask how to go to A library" with the reply rule can get a reply to the input text "this A library is mystery, I don't know where to go, you need not ask nearby bars".
It should be noted that, when the entity recognition result includes a plurality of entities, the entity with the largest number of characters is replaced to the designated position of the target reply rule, so as to obtain a reply corresponding to the input text; or replacing the entity in front of the input text to the appointed position of the target reply rule to obtain the reply corresponding to the input text. For example, the entities in the input text "please ask how to go to the A-market library" include "A-market library" or "A-market", and the number of characters in the A-market library "is greater than that in the" A-market ", so that the" A-market library "is taken as the final replacement entity; as another example, the entities in the input text "please ask how to go to the A-market library and the museum woolen" include "A-market library" or "museum", where the entity in the input text that is the front may be used as the replacement entity.
In summary, the reply method provided in the present disclosure includes: obtaining an input text, extracting key entities from the input text to obtain an entity recognition result of the input text, segmenting the input text, matching the segmented input text with rule templates in a rule template library, screening candidate rule templates containing key words, wherein the rule template library comprises rule templates of all predefined problem categories, one rule template corresponds to one or more reply rules, screening out a target rule template from the candidate rule templates based on a regular matching method, and obtaining replies corresponding to the input text based on the entity recognition result and the reply rules of the target rule template; under the condition that accurate reply cannot be carried out on the input text, key entity extraction and generalized semantic matching are carried out on the input text, reply rules are obtained from a predefined rule template library through entity extraction results and semantic matching results, replies corresponding to the input text are obtained according to the reply rules, reply sentences are optimized, the spam replies are more diversified, and a dialogue system is more intelligent in appearance.
Fig. 2 is a block diagram of a reply device shown in an exemplary embodiment of the present disclosure. Referring to fig. 4, the reply device 20 includes an acquisition module 201, an identification module 202, a processing module 203, and a screening module 204.
The acquiring module 201 is configured to acquire an input text;
the recognition module 202 is configured to extract key entities from the input text to obtain an entity recognition result of the input text;
the processing module 203 is configured to segment the input text, match the segmented input text with rule templates in the rule template library, and screen out candidate rule templates containing keywords; the rule template library comprises rule templates of each predefined problem category, and one rule template corresponds to one or more reply rules;
the screening module 204 is configured to screen a target rule template from the candidate rule templates based on a regular matching method;
the processing module 201 is configured to obtain a reply corresponding to the input text based on the entity identification result and a reply rule of the target rule template.
Optionally, the processing module 203 is further configured to segment the input text to obtain one or more terms;
determining the keyword from the one or more words;
and matching the keyword with each rule template in the rule template library, and taking the rule template containing the keyword as the candidate rule template.
Optionally, the processing module 203 is further configured to obtain a problem category included in the rule template library;
matching each of the one or more terms to the problem category;
and taking the words corresponding to the problem category semantics as the keywords.
Optionally, the filtering module 204 is further configured to compare the semantics and sequence of each term of the candidate rule template with the semantics and sequence of each term of the input text;
and taking the candidate rule templates, which completely correspond to the input text, of the semantics of each word and the sequence of each word as the target rule templates.
Optionally, the processing module 201 is further configured to obtain one or more reply rules corresponding to the target rule template;
determining a target reply rule from the one or more reply rules;
and replacing the entity in the entity identification result to the appointed position of the target reply rule to obtain a reply corresponding to the input text.
Optionally, the processing module 201 is further configured to randomly select one from the one or more reply rules as the target reply rule.
The specific manner in which the various modules perform the operations in the apparatus of the above embodiments have been described in detail in connection with the embodiments of the method, and will not be described in detail herein.
Fig. 4 is a block diagram of an electronic device 700, according to an example embodiment. As shown in fig. 4, the electronic device 700 may include: a processor 701, a memory 702. The electronic device 700 may also include one or more of a multimedia component 703, an input/output (I/O) interface 704, and a communication component 705.
The processor 701 is configured to control the overall operation of the electronic device 700 to perform all or part of the above-mentioned recovery method. The memory 702 is used to store various types of data to support operation on the electronic device 700, which may include, for example, instructions for any application or method operating on the electronic device 700, as well as application-related data, such as contact data, messages sent and received, pictures, audio, video, and so forth. The Memory 702 may be implemented by any type or combination of volatile or non-volatile Memory devices, such as static random access Memory (Static Random Access Memory, SRAM for short), electrically erasable programmable Read-Only Memory (Electrically Erasable Programmable Read-Only Memory, EEPROM for short), erasable programmable Read-Only Memory (Erasable Programmable Read-Only Memory, EPROM for short), programmable Read-Only Memory (Programmable Read-Only Memory, PROM for short), read-Only Memory (ROM for short), magnetic Memory, flash Memory, magnetic disk, or optical disk. The multimedia component 703 can include a screen and an audio component. Wherein the screen may be, for example, a touch screen, the audio component being for outputting and/or inputting audio signals. For example, the audio component may include a microphone for receiving external audio signals. The received audio signals may be further stored in the memory 702 or transmitted through the communication component 705. The audio assembly further comprises at least one speaker for outputting audio signals. The I/O interface 704 provides an interface between the processor 701 and other interface modules, which may be a keyboard, mouse, buttons, etc. These buttons may be virtual buttons or physical buttons. The communication component 705 is for wired or wireless communication between the electronic device 700 and other devices. Wireless communication, such as Wi-Fi, bluetooth, near field communication (Near Field Communication, NFC for short), 2G, 3G, 4G, NB-IOT, eMTC, or other 5G, etc., or one or a combination of more of them, is not limited herein. The corresponding communication component 705 may thus comprise: wi-Fi module, bluetooth module, NFC module, etc.
In an exemplary embodiment, the electronic device 700 may be implemented by one or more application specific integrated circuits (Application Specific Integrated Circuit, abbreviated ASIC), digital signal processor (Digital Signal Processor, abbreviated DSP), digital signal processing device (Digital Signal Processing Device, abbreviated DSPD), programmable logic device (Programmable Logic Device, abbreviated PLD), field programmable gate array (Field Programmable Gate Array, abbreviated FPGA), controller, microcontroller, microprocessor, or other electronic components for performing the above-described restoration method.
In another exemplary embodiment, a computer readable storage medium is also provided, comprising program instructions which, when executed by a processor, implement the steps of the reply method described above. For example, the computer readable storage medium may be the memory 702 including program instructions described above, which are executable by the processor 701 of the electronic device 700 to perform the reply method described above.
In another exemplary embodiment, a computer readable storage medium is also provided, comprising program instructions which, when executed by a processor, implement the steps of the reply method described above. For example, the computer readable storage medium may be the memory 1932 described above including program instructions that are executable by the processor 1922 of the electronic device 1900 to perform the reply method described above.
In another exemplary embodiment, a computer program product is also provided, comprising a computer program executable by a programmable apparatus, the computer program having code portions for performing the above-mentioned reply method when executed by the programmable apparatus.
The preferred embodiments of the present disclosure have been described in detail above with reference to the accompanying drawings, but the present disclosure is not limited to the specific details of the above embodiments, and various simple modifications may be made to the technical solutions of the present disclosure within the scope of the technical concept of the present disclosure, and all the simple modifications belong to the protection scope of the present disclosure.
In addition, the specific features described in the foregoing embodiments may be combined in any suitable manner, and in order to avoid unnecessary repetition, the present disclosure does not further describe various possible combinations.
Moreover, any combination between the various embodiments of the present disclosure is possible as long as it does not depart from the spirit of the present disclosure, which should also be construed as the disclosure of the present disclosure.

Claims (10)

1. A method of replying, comprising:
acquiring an input text;
extracting key entities from the input text to obtain an entity identification result of the input text;
performing word segmentation on the input text, matching the segmented input text with rule templates in a rule template library, and screening candidate rule templates containing keywords; the rule template library comprises rule templates of each predefined problem category, and one rule template corresponds to one or more reply rules;
screening out a target rule template from the candidate rule templates based on a regular matching method;
and obtaining a reply corresponding to the input text based on the entity identification result and the reply rule of the target rule template.
2. The method of claim 1, wherein the step of word segmentation of the input text, matching the segmented input text with rule templates in a rule template library, and screening candidate rule templates containing keywords, comprises:
word segmentation is carried out on the input text to obtain one or more words;
determining the keyword from the one or more words;
and matching the keyword with each rule template in the rule template library, and taking the rule template containing the keyword as the candidate rule template.
3. The method of claim 2, wherein said determining the keyword from the one or more terms comprises:
obtaining a problem category contained in the rule template library;
matching each of the one or more terms to the problem category;
and taking the words corresponding to the problem category semantics as the keywords.
4. The method of claim 1, wherein the screening the target rule templates from the candidate rule templates based on a canonical matching method comprises:
comparing the semantics and sequence of each word of the candidate rule template with the semantics and sequence of each word of the input text;
and taking the candidate rule templates, which completely correspond to the input text, of the semantics of each word and the sequence of each word as the target rule templates.
5. The method of claim 1, wherein the obtaining a reply corresponding to the input text based on the entity recognition result and a reply rule of the target rule template comprises:
acquiring one or more reply rules corresponding to the target rule template;
determining a target reply rule from the one or more reply rules;
and replacing the entity in the entity identification result to the appointed position of the target reply rule to obtain a reply corresponding to the input text.
6. The method of claim 5, wherein the determining a target reply rule from the one or more reply rules comprises:
randomly selecting one from the one or more reply rules as the target reply rule.
7. The method of claim 5, wherein replacing the entity in the entity identification result to the specified location of the target reply rule, to obtain the reply corresponding to the input text, comprises:
under the condition that the entity identification result comprises a plurality of entities, replacing the entity with the largest character number to the appointed position of the target reply rule to obtain a reply corresponding to the input text; or replacing the entity in front of the input text to the appointed position of the target reply rule to obtain a reply corresponding to the input text.
8. A recovery device, comprising:
the acquisition module is used for acquiring an input text;
the identification module is used for extracting key entities from the input text to obtain an entity identification result of the input text;
the processing module is used for segmenting the input text, matching the segmented input text with rule templates in the rule template library, and screening candidate rule templates containing keywords; the rule template library comprises rule templates of each predefined problem category, and one rule template corresponds to one or more reply rules;
the screening module is used for screening out a target rule template from the candidate rule templates based on a regular matching method;
and the processing module is also used for obtaining a reply corresponding to the input text based on the entity identification result and the reply rule of the target rule template.
9. An electronic device, comprising:
a memory having a computer program stored thereon;
a processor for executing the computer program in the memory to implement the steps of the method of any one of claims 1-7.
10. A computer readable storage medium, on which a computer program is stored, characterized in that the computer program, when being executed by a processor, implements the steps of the method according to any of claims 1-7.
CN202310079546.XA 2023-01-20 2023-01-20 Reply method, reply device, electronic equipment and readable storage medium Pending CN116303937A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202310079546.XA CN116303937A (en) 2023-01-20 2023-01-20 Reply method, reply device, electronic equipment and readable storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202310079546.XA CN116303937A (en) 2023-01-20 2023-01-20 Reply method, reply device, electronic equipment and readable storage medium

Publications (1)

Publication Number Publication Date
CN116303937A true CN116303937A (en) 2023-06-23

Family

ID=86787891

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202310079546.XA Pending CN116303937A (en) 2023-01-20 2023-01-20 Reply method, reply device, electronic equipment and readable storage medium

Country Status (1)

Country Link
CN (1) CN116303937A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116842169A (en) * 2023-09-01 2023-10-03 国网山东省电力公司聊城供电公司 Power grid session management method, system, terminal and storage medium

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116842169A (en) * 2023-09-01 2023-10-03 国网山东省电力公司聊城供电公司 Power grid session management method, system, terminal and storage medium
CN116842169B (en) * 2023-09-01 2024-01-12 国网山东省电力公司聊城供电公司 Power grid session management method, system, terminal and storage medium

Similar Documents

Publication Publication Date Title
JP6647351B2 (en) Method and apparatus for generating candidate response information
US9369418B2 (en) Determining additional information associated with geographic location information
CN107491477B (en) Emotion symbol searching method and device
CN109241286B (en) Method and device for generating text
US10592782B2 (en) Image analysis enhanced related item decision
CN112925898B (en) Question-answering method and device based on artificial intelligence, server and storage medium
CN110087021B (en) Online video method and device and video terminal
CN114595686A (en) Knowledge extraction method, and training method and device of knowledge extraction model
CN113407851A (en) Method, device, equipment and medium for determining recommendation information based on double-tower model
CN112765364A (en) Group chat session ordering method and device, storage medium and electronic equipment
CN116303937A (en) Reply method, reply device, electronic equipment and readable storage medium
CN110134920B (en) Pictogram compatible display method, device, terminal and computer readable storage medium
CN111930891B (en) Knowledge graph-based search text expansion method and related device
CN113326363A (en) Searching method and device, prediction model training method and device, and electronic device
CN110852057A (en) Method and device for calculating text similarity
CN108509059B (en) Information processing method, electronic equipment and computer storage medium
CN116775815B (en) Dialogue data processing method and device, electronic equipment and storage medium
CN107330126B (en) Method and apparatus for outputting information
CN109120783A (en) Information acquisition method and device, mobile terminal and computer readable storage medium
CN113254579A (en) Voice retrieval method and device and electronic equipment
CN108962398B (en) Hospital information acquisition method and device
CN109145084B (en) Data processing method, data processing device and server
CN112597529A (en) Multimedia content processing method and device, storage medium and electronic equipment
CN113504836B (en) Information input method and electronic equipment
CN110825954A (en) Keyword recommendation method and device and electronic equipment

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