Interactive method, system and storage medium for robots

By converting user voice into language text and performing sentiment analysis to obtain the generation direction, the problems of large-scale computing power consumption and incorrect understanding in the existing technology are solved, and answer text generation is achieved that is more in line with user needs.

CN119202138BActive Publication Date: 2025-02-11中影年年(北京)科技有限公司
View PDF 4 Cites 0 Cited by

Patent Information

Application Number
CN202411677095.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-11-22
Publication Date
2025-02-11
Estimated Expiration
2044-11-22

AI Technical Summary

Technical Problem

The prior art requires judging the user's intentions before generating answer text, which leads to a large amount of computing power consumption in the system, and may experience errors in understanding when facing ultra-long texts, giving wrong analysis results.

Method used

By receiving the user's voice, converting it into language text, extracting entities, and performing sentiment analysis based on the entities, obtaining the emotional direction of language text. Use two analytical methods to obtain the generation direction, reduce the system processing load, and ensure the accuracy of the generation direction.

Benefits of technology

When generating answer text, the results are generated based on the emotions of the language text to ensure that the generated results are more in line with user needs, reduce the processing load of the system, and improve the accuracy of the analysis results.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119202138B_ABST
    Figure CN119202138B_ABST
Patent Text Reader

Abstract

The present invention discloses an interactive method, system and storage medium for a robot, belonging to the technical field of natural language processing, the method comprising: receiving a user's voice, converting the voice into a language text, extracting entities in the language text; performing a first analysis on the language text based on the entity, and judging whether the generation direction of the language text is obtained, the generation direction includes a positive direction and a negative direction, if the generation direction is not obtained, performing component analysis on the entity, setting the entity whose component is a predicate as a segmentation word, and segmenting the language text into a subject sentence and a modifying sentence based on the segmentation word, wherein the segmentation word is located in the modifying sentence; performing a second analysis on the subject sentence and the modifying sentence, determining the generation direction of the answer text; performing a third analysis on the entity, obtaining a processing target in the entity, analyzing the processing target based on the generation direction, and generating an answer text. The present invention can quickly generate reasonable question-and-answer results.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the technical field of natural language processing, and in particular relates to an interactive method, system and storage medium for a robot. Background Art

[0002] At present, new chatbots driven by large language models are developing rapidly. Compared with traditional conversational robots, new chatbots can better understand user intentions and can polish and modify various material texts provided by users based on user conversations.

[0003] For example, Chinese patent document 1 with publication number CN116775870A discloses a method for identifying conversation intentions in combination with a large model. The method recognizes user conversation content through a speech recognition module to form a text form, and matches and calculates the conversation content with a preset intention text through text similarity. If the match is successful, the intention corresponding to the current preset intention text is called to process the text. For example, Chinese patent document 2 with publication number CN117112763A discloses an application method for intelligent customer service based on ChatGPT and its storage medium. The method includes collecting and preprocessing a conversation data set in a preset field, determining the preset field involved in the intelligent customer service system, and then collecting conversation data in a specific field, preprocessing the collected conversation data set, annotating the conversation data, dividing the preprocessed conversation data set into a training set, a verification set, and a test set, and using the conversation data set to train and fine-tune the ChatGPT model to adapt to the customer service scenario in the preset field.

[0004] Before generating the answer text, the above-mentioned methods first judge the user's question intention in order to generate a more appropriate answer text. Then, Patent Document 1 needs to be compared with a large amount of text, which will greatly increase the computing power of the system. Patent Document 2 needs to collect a large amount of dialogue data sets, which takes a lot of time. Moreover, when faced with an extremely long text generated at one time, since there are multiple words with different emotional attributes, the language model may misunderstand and give wrong analysis results. Summary of the invention

[0005] To solve the above problems, the present invention provides an interactive method, system and storage medium for a robot to solve the problems in the prior art.

[0006] In order to achieve the above-mentioned object of the invention, the present invention proposes a method for generating a virtual building model, comprising:

[0007] S1: receiving a user's voice, converting the voice into language text, and extracting entities in the language text;

[0008] S2: Perform a first analysis on the language text based on the entity, and determine whether a generation direction of the language text is obtained, the generation direction including a positive direction and a negative direction. If yes, execute S5; if no, execute S3;

[0009] S3: performing component analysis on the entity, setting the entity whose component is the predicate as a segmentation word, and segmenting the language text into a subject sentence and a modifying sentence based on the segmentation word, wherein the segmentation word is located in the modifying sentence;

[0010] S4: performing a second analysis on the subject sentence and the modified sentence to determine the generation direction of the answer text;

[0011] S5: Perform a third analysis on the entity, obtain the processing target in the entity, analyze the processing target based on the generation direction, and generate the answer text.

[0012] Further, performing the first analysis on the entity comprises the following steps:

[0013] Establishing a dictionary library, the dictionary library includes a plurality of entities, each entity is annotated with a first attribute, the first attribute includes a positive attribute, a negative attribute, an inverted attribute and a neutral attribute, counting the first number of entities with the positive attribute, the second number of entities with the negative attribute, and the total number of entities included in the language text;

[0014] In the case where the total number is less than a first threshold, if the first number is greater than the second number, the generation direction is determined as the positive direction; if the first number is less than the second number, the generation direction is determined as the negative direction.

[0015] Further, if the first number is the same as the second number, or the total number is greater than or equal to the first threshold, it is determined that the generation direction of the language text cannot be obtained.

[0016] Furthermore, performing the second analysis on the subject sentence and the modified sentence comprises the following steps:

[0017] Selecting a first analysis target in the modified sentence, combining the first analysis target with entities on both sides to form a first expansion word and a second expansion word, calculating reasonable values ​​of the first expansion word and the second expansion word, retaining the expansion word with a larger reasonable value and defining it as a first phrase, obtaining the first attribute of the first phrase, combining the first phrase with entities on both sides to form a third expansion word and a fourth expansion word to generate a second phrase, calculating the first attribute of the second phrase, and repeating this step until the analysis of the modified sentence is completed;

[0018] If there is a second analysis target in the subject sentence, determine the first attribute of the second analysis target, and determine the generation direction based on the second analysis target and the first attribute of the modified sentence; if there is no second analysis target, determine the generation direction based on the first attribute of the modified sentence.

[0019] Further, obtaining the first attribute of the first phrase includes the following steps:

[0020] If the two entities included in the first phrase are the positive attribute and the negative attribute respectively, obtaining the first attribute of the entity at the previous position, defining it as a target attribute, and determining the target attribute as the first attribute of the first phrase;

[0021] If both entities have the positive attribute or the negative attribute, determining that the first phrase includes the same first attribute of the entities;

[0022] If one of the entities is the positive attribute or the negative attribute, which is defined as the target attribute, and the other entity is the neutral attribute, the first phrase is classified as the target attribute;

[0023] If one of the entities is the positive attribute or the negative attribute, it is defined as the target attribute, and the other entity is the inverse attribute, and the first phrase is divided into the opposite attribute of the target attribute.

[0024] Further, determining whether the subject sentence contains a second analysis target comprises the following steps:

[0025] The entities in the subject sentence are divided into nouns and non-nouns, the noun that appears last in the subject sentence is located and defined as a target word, if a non-noun exists after the target word, it is determined that the second analysis target exists in the subject sentence, and the non-noun after the target word is defined as the second analysis target.

[0026] Further, after determining the generation direction based on the second analysis, the confidence C of the generation direction is calculated based on a first formula, wherein the first formula is: , where x is the number of entities included in the language text, and y is a preset value;

[0027] If the confidence level is greater than a second threshold, a prompt statement is generated based on the generation direction, a feedback result of the prompt statement is obtained, the generation direction of the feedback result is analyzed, and if the generation direction is the negative direction, the generation direction of the language text is reversed, and the processing target is analyzed based on the reversed generation direction.

[0028] Further, calculating the reasonable value includes the following steps:

[0029] A text database is established, and a first search result and a second search result are obtained by searching the text database based on the first expansion word and the second expansion word. A first quantity and a second quantity of the first search result and the second search result are counted, and the first quantity and the second quantity are set as the reasonable values ​​of the first expansion word and the second expansion word, respectively.

[0030] The present invention also provides an interactive system for a robot, for implementing the above-mentioned method, the system comprising:

[0031] A conversion module receives the user's speech, converts the speech into language text, and extracts entities in the language text;

[0032] An analysis module performs a first analysis on the language text based on the entity, and determines whether a generation direction of the language text is obtained, the generation direction includes a positive direction and a negative direction. If yes, a third analysis is performed on the entity to obtain a processing target in the entity. If no, a component analysis is performed on the entity, the entity whose component is a predicate is set as a segmentation word, the language text is segmented into a subject sentence and a modifying sentence based on the segmentation word, the segmentation word is located in the modifying sentence, a second analysis is performed on the subject sentence and the modifying sentence, the generation direction of the answer text is determined, and the processing target is analyzed based on the generation direction;

[0033] A generation module analyzes the processing target based on the generation direction and generates the answer text.

[0034] The present invention also provides a computer storage medium, wherein the computer storage medium stores program instructions, wherein when the program instructions are executed, the device where the computer storage medium is located is controlled to execute the above-mentioned method.

[0035] Compared with the prior art, the beneficial effects of the present invention are at least as follows:

[0036] Before inputting the user's language text into the natural language model, the present invention first performs sentiment analysis on the language text to obtain the sentiment direction of the language text. When performing the analysis, the sentiment direction is first obtained using a relatively simple first analysis method. If the sentiment direction cannot be obtained according to the first analysis method, the sentiment direction is then obtained according to the second analysis method. The two methods can be used to obtain the sentiment direction, which can reduce the processing load of the system and ensure the generation direction. After obtaining the generation direction, when generating an answer statement for the processing object, the generation result can be adjusted according to the sentiment of the language text, thereby obtaining a result that better meets the user's needs. BRIEF DESCRIPTION OF THE DRAWINGS

[0037] Figure 1 A flowchart of the steps of an interactive method for a robot according to the present invention;

[0038] Figure 2 The figure is a schematic diagram of the structure of an interactive system for robots according to the present invention. DETAILED DESCRIPTION

[0039] In order to make the purpose, technical solution and advantages of the present invention more clearly understood, the present invention is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not intended to limit the present invention.

[0040] It is understood that the terms "first", "second", etc. used in this application may be used herein to describe various elements, but unless otherwise specified, these elements are not limited by these terms. These terms are only used to distinguish a first element from another element. For example, without departing from the scope of this application, a first xx script may be referred to as a second xx script, and similarly, a second xx script may be referred to as a first xx script.

[0041] like Figure 1 As shown, an interactive method for a robot comprises:

[0042] S1: Receive the user's voice, convert the voice into language text, and extract entities in the language text.

[0043] S2: Perform a first analysis on the language text based on the entity, and determine whether the generation direction of the language text is obtained, the generation direction includes a positive direction and a negative direction. If yes, execute S5, if not, execute S3.

[0044] The robot referred to in the present invention may be a physical robot, or a virtual conversational robot set in a mobile terminal or a personal PC. The answer text may be an answer to a question asked by a user, or a processing result of an input text. In this embodiment, a physical robot is used as an example for explanation. The physical robot receives the user's voice, converts the user's voice into language text using a TTS algorithm, and then uses a word segmentation algorithm to extract entities in the language text. For example, if the language text is: Please help me modify it, the language text is split into please / help / me / modify / it;

[0045] After obtaining the entity, the language text is subjected to a first analysis, and the specific steps of the first analysis will be described in detail later; after the first analysis, it is determined whether the generation direction of the language text is obtained. If the generation direction of the language text is obtained based on the first analysis alone, then the language text is subjected to a second analysis to determine the processing target of the language text; such as "Article 1 is too poorly written, please help me revise it", where the processing target is Article 1, and the generation direction of the language text is a negative direction, then the robot will make a lot of modifications to the article, such as description logic. For another example, if the language text is "Article 1 is okay, please help me revise it", and the generation direction of the language text is a positive direction, the robot will think that the writing content of Article 1 is good, and will retain most of the content during the modification, or only improve its description method. The specific modification method is determined according to the modification rules set by the user and the corpus.

[0046] In the prior art, if the above two sentences are respectively input into the same language model, the same result may be obtained, because for the language model, its purpose is to modify article 1. However, after obtaining the generation direction through the present invention, the generation result can be adjusted according to the emotion of the language text, thereby obtaining a result that better meets the user's needs, and there is no need for a lot of training in advance.

[0047] S3: Perform component analysis on the entity, set the entity whose component is the predicate as a segmentation word, and segment the language text into a subject sentence and a modifying sentence based on the segmentation word, and the segmentation word is located in the modifying sentence.

[0048] S4: Conduct a second analysis on the subject sentence and the modifying sentence to determine the generation direction of the answer text.

[0049] Specifically, component analysis is dependency analysis, that is, obtaining which entities are subjects, predicates, objects, etc. The dependency analysis method is a prior art and will not be introduced here. After dependency analysis is performed on the entities in the language text, the entities classified as predicates are obtained, because the predicate is used to explain The actions performed or the characteristics and states possessed are generally adjectives or verbs, which facilitates subsequent analysis. After determining the predicate, the language text is divided into the subject sentence and the modifying sentence with the predicate as the segmentation word. For example, the language text is "The leader who is optimistic about my colleague did not agree with his flawed fault prevention measures". Here, the predicate is determined to be agree. After segmentation, the subject sentence is "The leader who is optimistic about my colleague did not agree with his flawed fault prevention measures", and the modifying sentence is "agree with his flawed fault prevention measures".

[0050] After the segmentation is completed, the language text is analyzed again according to the subject sentence and the modifying sentence to obtain the generation direction of the language text. The specific analysis method will be introduced in detail later.

[0051] S5: Perform a third analysis on the entity, obtain the processing target in the entity, analyze the processing target based on the generation direction, and generate the answer text.

[0052] The processing target is the object that the answer text is targeting, and is generally the keyword that best represents the entire sentence in the language text. For example, "Article 1 is well written, please help me revise it", Article 1 is the processing target this time, which means that the subsequent language model needs to revise Article 1. The processing target can be the object in the language text after component analysis, or the document file input by the user, or the content after the punctuation mark colon as the processing target.

[0053] Before inputting the user's language text into the natural language model, the present invention first performs sentiment analysis on the language text to obtain the sentiment direction of the language text. When performing the analysis, the sentiment direction is first obtained using a relatively simple first analysis method. If the sentiment direction cannot be obtained according to the first analysis method, the sentiment direction is then obtained according to the second analysis method. The two methods can be used to obtain the sentiment direction, which can reduce the processing load of the system and ensure the generation direction. After obtaining the generation direction, when generating an answer statement for the processing object, the generation result can be adjusted according to the sentiment of the language text, thereby obtaining a result that better meets the user's needs.

[0054] It is particularly noteworthy that the present invention can quickly generate reasonable question-and-answer results, thereby better meeting the needs of users.

[0055] In this embodiment, performing a first analysis on an entity includes the following steps:

[0056] A dictionary library is established, which includes multiple entities. Each entity is annotated with a first attribute, which includes a positive attribute, a negative attribute, an inverted attribute, and a neutral attribute. The first number of entities with positive attributes and the second number of entities with negative attributes in the language text are counted, as well as the total number of entities included in the language text.

[0057] When the total number is less than the first threshold, if the first number is greater than the second number, the generating direction is determined as a positive direction; if the first number is less than the second number, the generating direction is determined as a negative direction.

[0058] Specifically, the entities in the dictionary are annotated with the first attribute in advance, such as praise, commendation, identification, and like as positive attributes, such as disgust, uselessness, criticism, etc. as negative attributes, such as prevention, no, no, these words are reverse attributes, and leadership, I, black, these nouns or adjectives are neutral attributes. In the case of a dictionary, the first number and second number of entities with positive and negative attributes in the language text are counted. For example, "Article 1 / Written / Too / Badly / ", there are no entities with positive attributes, the first number is 0, and there are no entities with negative attributes, so the second number is 1. The remaining entities are neutral attributes, the total number of entities is 6, and the first threshold is set to 10. Therefore, the language text is set to the negative direction.

[0059] If the first number is the same as the second number, or the total number is greater than or equal to the first threshold, it is determined that the generation direction of the language text cannot be obtained.

[0060] For example, for the following sentence, "I am optimistic about my colleague's leader but I don't agree with his / the flawed / fault prevention measures", the number of entities included is 14, which exceeds the first threshold, and the generation direction of the language text cannot be determined. In addition, optimistic and agree are positive attributes, and flawed and faulty are negative attributes. The first number is equal to the second number, so the generation direction of the language text cannot be determined.

[0061] In this embodiment, the second analysis of the subject sentence and the modified sentence includes the following steps:

[0062] Select a first analysis target in the modified sentence, combine the first analysis target and the entities on both sides to form a first expansion word and a second expansion word respectively, calculate reasonable values ​​of the first expansion word and the second expansion word, retain the expansion word with a larger reasonable value, define it as a first phrase, obtain the first attribute of the first phrase, continue to combine the first phrase with the entities on both sides to form a third expansion word and a fourth expansion word respectively to generate a second phrase, calculate the first attribute of the second phrase, and repeat this step until the analysis of the modified sentence is completed.

[0063] Wherein, obtaining the first attribute of the first phrase comprises the following steps:

[0064] If the two entities included in the first phrase are respectively positive attributes and negative attributes, the first attribute of the entity at the front position is obtained, defined as the target attribute, and the target attribute is determined as the first attribute of the first phrase.

[0065] If both entities have positive attributes or negative attributes, the first phrase is determined to include the same first attribute of the entities.

[0066] If one of the entities is a positive attribute or a negative attribute, defined as the target attribute, and the other entity is a neutral attribute, the first phrase is classified as the target attribute.

[0067] If one of the entities is a positive attribute or a negative attribute, it is defined as the target attribute, and the other entity is the inverted attribute, and the first phrase is divided into the opposite attribute of the target attribute.

[0068] Based on the previous example, "The leader who is optimistic about / my / colleague / does not / agree / with / his / that / flawful / fault / prevention / measures", the segmented word in this sentence is "agree", so the modified sentence is "agree / his / that / fault-filled / fault / prevention / measures", and then the first analysis target is selected therefrom. The first analysis target in this embodiment is an entity close to the end of the modified sentence and has positive or negative attributes. The first analysis target of the above modified sentence is fault, and then the first analysis target is expanded to obtain the first expanded word "fault" and the second expanded word "fault prevention". After calculation, the reasonable value of the second expanded word is greater than the first expanded word, so the second expanded word is retained and used as the first phrase, and then the first attribute of the first phrase is analyzed.

[0069] When judging the first attribute of the first phrase, it is determined according to the entities included therein. For example, the first phrase is "like to wither", where "like" is a positive attribute and "wither" is a negative attribute. Since the entity belonging to the positive attribute is in front, the positive attribute is set as the target attribute, so the first phrase is set to a positive attribute. If both entities are positive and negative attributes, such as "praise courage", "courage" and "praise" are both positive attributes, so the first phrase is set to a positive attribute. If one of the entities is a positive attribute or a negative attribute, and the other entity is a neutral attribute, such as "beautiful girl", "beauty" is a positive attribute, which is set as the target attribute here, and "girl" is a neutral attribute, so the first phrase is set to a positive attribute. If one of the entities is a positive attribute or a negative attribute, and the other entity is a reverse attribute, such as "treat disease", where "treat" is a reverse attribute and "disease" is a negative attribute, the negative attribute is set as the target attribute, and then the negative attribute is reversed to a positive attribute, and the first phrase is divided into a positive attribute.

[0070] Based on the above introduction, the first attribute of the modified sentence is analyzed as a whole. First, the first phrase is "fault prevention", where "fault" is a negative attribute and "prevention" is a reverse attribute, so the first phrase is a positive attribute. Then the second phrase "fault prevention measures" is obtained, "measures" is a neutral attribute, and the second phrase is a positive attribute. Then the third phrase "the one full of loopholes" is obtained, "of" is a neutral attribute, and the third phrase is a positive attribute. The fourth phrase "fault prevention measures full of loopholes" is obtained, and "full of loopholes" is a negative attribute. Since there is a positive attribute and a negative attribute in the fourth phrase, and the negative attribute is in the front, the fourth phrase is a negative attribute. The fifth phrase "the fault prevention measures full of loopholes" is a negative attribute, and the sixth phrase "his fault prevention measures full of loopholes" is a negative attribute. The seventh phrase "agree with his fault prevention measures full of loopholes", "agree" is a positive attribute, and the position is in the front, so the seventh phrase is a positive attribute. The seventh phrase is also a modified sentence.

[0071] If there is a second analysis target in the subject sentence, determine the first attribute of the second analysis target, and determine the generation direction based on the second analysis target and the first attribute of the modifying sentence. If there is no second analysis target, determine the generation direction based on the first attribute of the modifying sentence.

[0072] After that, the subject sentence is analyzed separately to determine whether there is a second analysis target in it. The method of obtaining the second analysis target will be introduced later. In the subject sentence "Do you think my colleague's leader is good?", there is a second analysis target, which is the word "no". "No" is a reverse attribute, so the positive attribute of the modified sentence is reversed to a negative attribute, and finally it can be determined that the generation direction of the language text is negative. In this case, if the user submits his own text A and his colleague's text B, try to modify text A to make it different from text B. If the subject sentence is "Do you think my colleague's leader is good?", there is no second analysis target, and the generation direction of the language text is positive. In this case, try to modify text A to make it close to text B.

[0073] In this embodiment, determining whether there is a second analysis target in the subject sentence includes the following steps:

[0074] The entities in the subject sentence are divided into nouns and non-nouns. The last noun in the subject sentence is located and defined as the target word. If there is a non-noun after the target word, it is determined that there is a second analysis target in the subject sentence, and the non-noun after the target word is defined as the second analysis target.

[0075] In the sentence "optimistic / my / colleague / of / leader / no", the nouns are "I", "colleague", and "leader", and the non-nouns are "optimistic", "of", and "no". After "leader", there is "no", so "no" is taken as the second analysis target. In traditional analysis methods, the existence of the word "optimistic" may affect the analysis of the language text, but the second analysis target extracted by this step can quickly and accurately determine the generation direction of the language text, avoiding the interference of other words.

[0076] After determining the generation direction based on the second analysis, this embodiment calculates the confidence C of the generation direction based on the first formula. The first formula is: , where x is the number of entities included in the language text and y is a preset value.

[0077] If the confidence is greater than the second threshold, a prompt sentence is generated based on the generation direction, feedback results of the prompt sentence are obtained, and the generation direction of the feedback result is analyzed. If the generation direction is a negative direction, the generation direction of the language text is reversed, and the processing target is analyzed based on the reversed generation direction.

[0078] Y is a preset value, which is set to 0.36 in this embodiment. It can be seen from the first formula that the more entities included in the language text, the smaller the confidence obtained after calculation. Here, the second threshold is set to 0.2. When the confidence is less than the second threshold, the robot will inquire again based on the generation direction to confirm the reliability of this analysis. For example, the prompt sentence is "Do you want your fault prevention measures to appear almost different from your colleagues' fault prevention measures?" If positive feedback answers such as "Yes" and "That's right" are obtained, the original generation direction will not be changed. If negative feedback answers such as "No" are obtained, the original generation direction will be reversed.

[0079] The calculation of the reasonable value in this embodiment includes the following steps:

[0080] A text database is established, and a first search result and a second search result are obtained by searching the text database based on the first expansion word and the second expansion word. A first quantity and a second quantity of the first search result and the second search result are counted, and the first quantity and the second quantity are set as reasonable values ​​of the first expansion word and the second expansion word, respectively.

[0081] A text database can be established by collecting Internet resources, for example. After the text database is established, the first expansion word and the second expansion word are used for precise search respectively to obtain a first search result including the first expansion word and a second search result including the second expansion word. The more results obtained after the search, the more the word or phrase conforms to writing habits. Therefore, the number of search results is taken as a reasonable value of the expansion word.

[0082] like Figure 2As shown, the present invention also provides an interactive system for a robot, for implementing the above method, the system comprising:

[0083] The conversion module receives the user's voice, converts the voice into language text, and extracts entities in the language text;

[0084] The analysis module performs a first analysis on the language text based on the entity, and determines whether a generation direction of the language text is obtained, the generation direction includes a positive direction and a negative direction. If yes, a third analysis is performed on the entity to obtain a processing target in the entity. If no, a component analysis is performed on the entity, an entity whose component is a predicate is set as a segmentation word, and the language text is segmented into a subject sentence and a modifying sentence based on the segmentation word, the segmentation word is located in the modifying sentence, a second analysis is performed on the subject sentence and the modifying sentence, the generation direction of the answer text is determined, and the processing target is analyzed based on the generation direction;

[0085] The generation module analyzes the processing target based on the generation direction and generates the answer text.

[0086] The present invention also provides a computer storage medium, which stores program instructions. When the program instructions are executed, the device where the computer storage medium is located is controlled to execute the above method.

[0087] It should be understood that, although each step in the flow chart of each embodiment of the present invention is shown in sequence according to the indication of the arrow, these steps are not necessarily performed in sequence according to the order indicated by the arrow. Unless there is a clear explanation in this article, the execution of these steps does not have a strict order restriction, and these steps can be performed in other orders. Moreover, at least a portion of the steps in each embodiment may include a plurality of sub-steps or a plurality of stages, and these sub-steps or stages are not necessarily performed at the same time, but can be performed at different times, and the execution order of these sub-steps or stages is not necessarily performed in sequence, but can be performed in turn or alternately with at least a portion of other steps or sub-steps or stages of other steps.

[0088] The technical features of the above-mentioned embodiments can be combined arbitrarily. In order to make the description concise, not all possible combinations of the technical features in the above-mentioned embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0089] The above embodiments only express several implementation methods of the present invention, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the patent of the present invention. It should be pointed out that, for those of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present invention, and these all belong to the protection scope of the present invention. Therefore, the protection scope of the patent of the present invention shall be subject to the attached claims.

[0090] The above are only preferred embodiments of the present invention and are not intended to limit the present invention. Any modifications, equivalent substitutions and improvements made within the spirit and principles of the present invention should be included in the protection scope of the present invention.

Claims

1. An interactive method for a robot, characterized in that, include: S1: receiving a user's voice, converting the voice into language text, and extracting entities in the language text; S2: Perform a first analysis on the language text based on the entity, and determine whether a generation direction of the language text is obtained, the generation direction including a positive direction and a negative direction. If yes, execute S5; if no, execute S3; S3: performing component analysis on the entity, setting the entity whose component is the predicate as a segmentation word, and segmenting the language text into a subject sentence and a modifying sentence based on the segmentation word, wherein the segmentation word is located in the modifying sentence; S4: performing a second analysis on the subject sentence and the modified sentence to determine the generation direction of the answer text; S5: performing a third analysis on the entity, obtaining a processing target in the entity, analyzing the processing target based on the generation direction, and generating the answer text; Performing the first analysis on the entity comprises the following steps: Establishing a dictionary library, the dictionary library includes a plurality of entities, each entity is annotated with a first attribute, the first attribute includes a positive attribute, a negative attribute, an inverted attribute and a neutral attribute, counting the first number of entities with the positive attribute, the second number of entities with the negative attribute, and the total number of entities included in the language text; In the case where the total number is less than a first threshold, if the first number is greater than the second number, the generation direction is determined as the positive direction; if the first number is less than the second number, the generation direction is determined as the negative direction; The second analysis of the subject sentence and the modified sentence comprises the following steps: Selecting a first analysis target in the modified sentence, combining the first analysis target with entities on both sides to form a first expansion word and a second expansion word, calculating reasonable values ​​of the first expansion word and the second expansion word, retaining the expansion word with a larger reasonable value and defining it as a first phrase, obtaining the first attribute of the first phrase, combining the first phrase with entities on both sides to form a third expansion word and a fourth expansion word to generate a second phrase, calculating the first attribute of the second phrase, and repeating this step until the analysis of the modified sentence is completed; If there is a second analysis target in the subject sentence, determine the first attribute of the second analysis target, and determine the generation direction based on the second analysis target and the first attribute of the modified sentence; if there is no second analysis target, determine the generation direction based on the first attribute of the modified sentence.

2. The method according to claim 1, characterized in that: If the first number is the same as the second number, or the total number is greater than or equal to the first threshold, it is determined that the generation direction of the language text cannot be obtained.

3. The method according to claim 1, characterized in that Acquiring the first attribute of the first phrase comprises the following steps: If the two entities included in the first phrase are the positive attribute and the negative attribute respectively, obtaining the first attribute of the entity at the previous position, defining it as a target attribute, and determining the target attribute as the first attribute of the first phrase; If both entities have the positive attribute or the negative attribute, determining that the first phrase includes the same first attribute of the entities; If one of the entities is the positive attribute or the negative attribute, which is defined as the target attribute, and the other entity is the neutral attribute, the first phrase is classified as the target attribute; If one of the entities is the positive attribute or the negative attribute, it is defined as the target attribute, and the other entity is the inverse attribute, and the first phrase is divided into the opposite attribute of the target attribute.

4. The method according to claim 1, characterized in that: Determining whether the subject sentence contains a second analysis target comprises the following steps: The entities in the subject sentence are divided into nouns and non-nouns, the noun that appears last in the subject sentence is located and defined as a target word, if a non-noun exists after the target word, it is determined that the second analysis target exists in the subject sentence, and the non-noun after the target word is defined as the second analysis target.

5. The method according to claim 1, characterized in that After determining the generation direction based on the second analysis, the confidence C of the generation direction is calculated based on a first formula, where the first formula is: , where x is the number of entities included in the language text, and y is a preset value; If the confidence level is greater than a second threshold, a prompt statement is generated based on the generation direction, a feedback result of the prompt statement is obtained, the generation direction of the feedback result is analyzed, and if the generation direction is the negative direction, the generation direction of the language text is reversed, and the processing target is analyzed based on the reversed generation direction.

6. The method according to claim 1, characterized in that Calculating the reasonable value includes the following steps: A text database is established, and a first search result and a second search result are obtained by searching the text database based on the first expansion word and the second expansion word. A first quantity and a second quantity of the first search result and the second search result are counted, and the first quantity and the second quantity are set as the reasonable values ​​of the first expansion word and the second expansion word, respectively.

7. An interactive system for a robot, used to implement the method according to any one of claims 1 to 6, characterized in that: include: A conversion module receives the user's speech, converts the speech into language text, and extracts entities in the language text; The analysis module performs a first analysis on the language text based on the entity, and determines whether the generation direction of the language text is obtained, the generation direction includes a positive direction and a negative direction. If yes, the entity is subjected to a third analysis to obtain a processing target in the entity. If no, the entity is subjected to a component analysis, the entity whose component is a predicate is set as a segmentation word, the language text is segmented into a subject sentence and a modifying sentence based on the segmentation word, the segmentation word is located in the modifying sentence, the subject sentence and the modifying sentence are subjected to a second analysis to determine the generation direction of the answer text, the processing target is analyzed based on the generation direction, and when the first analysis package is performed on the entity, a dictionary is established, the dictionary includes multiple entities, each entity is annotated with a first attribute, the first attribute includes a positive attribute, a negative attribute, a reverse attribute and a neutral attribute, and a first number of entities in the language text that are the positive attribute, a second number of entities that are the negative attribute, and a total number of entities included in the language text are counted. When the total number is less than a first threshold, if the first number is greater than the a second number, determining the generation direction as the positive direction; if the first number is less than the second number, determining the generation direction as the negative direction; when performing the second analysis on the subject sentence and the modifying sentence, selecting a first analysis target in the modifying sentence, combining the first analysis target with entities on both sides to form a first expansion word and a second expansion word, calculating reasonable values ​​of the first expansion word and the second expansion word, retaining the expansion word with a larger reasonable value, defining it as a first phrase, obtaining the first attribute of the first phrase, combining the first phrase with entities on both sides to form a third expansion word and a fourth expansion word, respectively, to generate a second phrase, calculating the first attribute of the second phrase, repeating this step until the analysis of the modifying sentence is completed; if there is a second analysis target in the subject sentence, determining the first attribute of the second analysis target, determining the generation direction based on the second analysis target and the first attribute of the modifying sentence; if there is no second analysis target, determining the generation direction based on the first attribute of the modifying sentence; A generation module analyzes the processing target based on the generation direction and generates the answer text.

8. A computer storage medium, characterized in that The computer storage medium stores program instructions, wherein when the program instructions are executed, the device where the computer storage medium is located is controlled to execute the method according to any one of claims 1 to 6.

Citation Information

Patent Citations

  • Dialogue intention recognition method combined with large model

    CN116775870A

  • ChatGPT-based intelligent customer service application method and storage medium thereof

    CN117112763A

  • Sentiment analysis method oriented to micro-blog short text

    CN102663046A

  • Voice interaction system based on deep learning model

    CN114842835A