CN111291158A - Information query method and device, electronic equipment and storage medium - Google Patents

Information query method and device, electronic equipment and storage medium Download PDF

Info

Publication number
CN111291158A
CN111291158A CN202010075722.9A CN202010075722A CN111291158A CN 111291158 A CN111291158 A CN 111291158A CN 202010075722 A CN202010075722 A CN 202010075722A CN 111291158 A CN111291158 A CN 111291158A
Authority
CN
China
Prior art keywords
information
query
type
structured
preset
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN202010075722.9A
Other languages
Chinese (zh)
Other versions
CN111291158B (en
Inventor
蒋卓
林绍令
康兵兵
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Orion Star Technology Co Ltd
Original Assignee
Beijing Orion Star Technology 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 Beijing Orion Star Technology Co Ltd filed Critical Beijing Orion Star Technology Co Ltd
Priority to CN202010075722.9A priority Critical patent/CN111291158B/en
Publication of CN111291158A publication Critical patent/CN111291158A/en
Application granted granted Critical
Publication of CN111291158B publication Critical patent/CN111291158B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/30Information retrieval; Database structures therefor; File system structures therefor of unstructured textual data
    • G06F16/33Querying
    • G06F16/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/33Querying
    • G06F16/3331Query processing
    • G06F16/334Query execution
    • G06F16/3343Query execution using phonetics
    • 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
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Abstract

The embodiment of the invention provides an information query method, an information query device, electronic equipment and a storage medium, wherein the method comprises the following steps: acquiring a voice instruction sent by a user; based on configured classification information, identifying preset type query information included in text information corresponding to a voice instruction, wherein the classification information is information configured for each preset type based on various types of data and application scenes in an acquired structured information set, the structured information set comprises a plurality of pieces of structured information, and each piece of structured information comprises data corresponding to configured type information; inquiring the structural information matched with the inquiry information from the structural information set, and determining the structural information as target information; and generating and outputting reply information based on the target information, the inquiry information and a preset template. Because the structured information set is the relevant information of the application scene, the target information which accords with the query intention of the user can be queried from the structured information set, and the convenient and fast information query service is provided for the user.

Description

Information query method and device, electronic equipment and storage medium
Technical Field
The present invention relates to the field of information processing technologies, and in particular, to an information query method and apparatus, an electronic device, and a storage medium.
Background
In markets, airports, railway stations or office buildings and the like, the general area range is large, a lot of shops, companies or boarding gates, ticket gates, security check places and the like are arranged in the market, the airports, the railway stations or the office buildings, and the distribution of the shops, the companies or the boarding gates, the ticket gates, the security check places and the like is not uniform. It is difficult for a user to find a certain location.
A user can search for a place through a sign, and recently, there have been some electronic inquiry apparatuses in which an electronic map is stored, and the user can search for a shop or other place in the electronic map displayed on a display screen thereof.
However, whether the user searches through the indicator or the electronic map for electronic query, the user is troublesome, and the user can accurately find the place to be searched, so that a method for facilitating the user to query the information is needed, a convenient and fast information query service is provided for the user, and the user's requirements are met.
Disclosure of Invention
The embodiment of the invention aims to provide an information query method, an information query device, electronic equipment and a storage medium, so as to provide convenient and fast information query service for a user and meet the requirements of the user. The specific technical scheme is as follows:
in a first aspect, an embodiment of the present invention provides an information query method, where the method includes:
acquiring a voice instruction sent by a user;
based on configured classification information, identifying preset type query information included in text information corresponding to the voice instruction, wherein the classification information is information configured for each preset type based on various types of data and application scenes in an acquired structured information set, the structured information set comprises a plurality of pieces of structured information, and each piece of structured information comprises data corresponding to configured type information;
querying the structural information matched with the query information from the structural information set, and determining the structural information as target information;
and generating reply information based on the target information, the query information and a preset template, and outputting the reply information.
In a second aspect, an embodiment of the present invention provides an information query apparatus, where the apparatus includes:
the voice instruction acquisition module is used for acquiring a voice instruction sent by a user;
the query information identification module is used for identifying query information of a preset type included in text information corresponding to the voice instruction based on configured classification information, wherein the classification information is information configured for each preset type based on various types of data and application scenes in an acquired structured information set, the structured information set comprises a plurality of pieces of structured information, and each piece of structured information comprises data corresponding to configured type information;
the target information matching module is used for inquiring the structural information matched with the inquiry information from the structural information set and determining the structural information as target information;
and the reply information generating module is used for generating reply information based on the target information, the query information and a preset template and outputting the reply information.
In a third aspect, an embodiment of the present invention provides an electronic device, including a processor, a communication interface, a memory, and a communication bus, where the processor and the communication interface complete communication between the memory and the processor through the communication bus;
a memory for storing a computer program;
a processor, configured to implement the steps of the information query method according to the first aspect when executing the program stored in the memory.
In a fourth aspect, an embodiment of the present invention provides a computer-readable storage medium, where a computer program is stored in the computer-readable storage medium, and when the computer program is executed by a processor, the steps of the information query method according to the first aspect are implemented.
In a fifth aspect, the present invention further provides a computer program product, where the computer program product includes a computer program stored on a computer-readable storage medium, and the computer program includes program instructions, where the program instructions, when executed by a processor, implement the steps of the information query method according to the first aspect.
In the scheme provided by the embodiment of the invention, the electronic device can acquire a voice instruction sent by a user, recognize preset type query information included in text information corresponding to the voice instruction based on configured classification information, query structured information matched with the query information from a structured information set, and determine the structured information as target information, wherein the classification information is information configured for each preset type based on various types of data and application scenes in the acquired structured information set, the structured information set comprises a plurality of pieces of structured information, each piece of structured information comprises data corresponding to the configured type information, and reply information is generated and output based on the target information, the query information and a preset template. Therefore, only a voice instruction is required to be sent by a user, the electronic equipment can identify preset type query information included in text information corresponding to the voice instruction, and the structured information set is the acquired set of relevant information of the application scene, so that target information meeting the query intention of the user can be queried from the structured information set, further, reply information is generated and output, convenient and fast information query service can be provided for the user, and the requirements of the user are met.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, it is obvious that the drawings in the following description are only some embodiments of the present invention, and for those skilled in the art, other drawings can be obtained according to the drawings without creative efforts.
Fig. 1 is a flowchart of an information query method according to an embodiment of the present invention;
FIG. 2 is a flow chart of a target information determination method based on the embodiment shown in FIG. 1;
FIG. 3 is a flowchart illustrating a specific step S104 in the embodiment shown in FIG. 1;
FIG. 4 is another detailed flowchart of step S104 in the embodiment shown in FIG. 1;
FIG. 5 is a flowchart of step S401 in the embodiment shown in FIG. 4;
FIG. 6 is another flowchart of step S401 in the embodiment shown in FIG. 4;
fig. 7 is a schematic structural diagram of an information query apparatus according to an embodiment of the present invention;
FIG. 8 is a diagram illustrating an exemplary structure of the query message identification module 720 in the embodiment shown in FIG. 7;
fig. 9 is a schematic structural diagram of an electronic device according to an embodiment of the present invention.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
In order to provide convenient and fast information query service for users and meet the requirements of the users, the embodiment of the invention provides an information query method, an information query device, electronic equipment, a computer readable storage medium and a computer program product.
The following describes an information query method provided by an embodiment of the present invention. The information query method provided by the embodiment of the present invention may be applied to a robot, a server in communication connection with the robot, a processor, and other electronic devices, and is not limited specifically herein. For convenience and clarity of description, the following is referred to as an electronic device. And if the voice command is applied to the server, the server reports the voice command acquired by the robot through the robot.
As shown in fig. 1, an information query method includes:
s101, acquiring a voice instruction sent by a user;
s102, based on the configured classification information, recognizing preset type query information included in text information corresponding to the voice command;
the classification information is configured information for each preset type based on various types of data and application scenes in an acquired structured information set, the structured information set comprises a plurality of pieces of structured information, and each piece of structured information comprises data corresponding to configured type information.
S103, querying the structural information matched with the query information from the structural information set, and determining the structural information as target information;
and S104, generating reply information based on the target information, the inquiry information and a preset template, and outputting the reply information.
As can be seen, in the scheme provided in the embodiment of the present invention, the electronic device may obtain a voice command issued by a user, identify query information of a preset type included in text information corresponding to the voice command based on configured classification information, query structured information matched with the query information from a structured information set, and determine the structured information as target information, where the classification information is information configured for each preset type based on various types of data and application scenarios in the obtained structured information set, the structured information set includes a plurality of pieces of structured information, each piece of structured information includes data corresponding to the configured type information, and generate reply information based on the target information, the query information, and a preset template to output the reply information. Therefore, only a voice instruction is required to be sent by a user, the electronic equipment can identify preset type query information included in text information corresponding to the voice instruction, and the structured information set is the acquired set of relevant information of the application scene, so that target information meeting the query intention of the user can be queried from the structured information set, further, reply information is generated and output, convenient and fast information query service can be provided for the user, and the requirements of the user are met.
In places such as a shopping mall, an airport, an office building, a railway station, and a bank, the electronic device may be installed at a fixed location in order to facilitate a user to find a place to which the user wants to go, to know the situation of a certain shop, or the like.
A voice instruction (query) may be issued when the user wants to query some information, for example, in a shopping mall scenario, when the user wants to query a certain shop, it can be said that "shop a is on several floors? ". For another example, in a bank scenario, a user wants to know how to handle a financial product in the bank, and may say "introduce a financial product". In this way, in step S101, the electronic device may obtain the voice command sent by the user, and in an embodiment, the electronic device may obtain the voice command sent by the user through a voice signal collecting device such as a microphone.
Next, the electronic device may identify, based on the configured classification information, query information of a preset type included in the text information corresponding to the voice instruction, where the preset type is a preset information type, which is convenient for determining query content of the user, and may include an entity type, a tag type, an attribute type, and the like, for example. The entity type information may be entities with specific meanings, and mainly includes names of persons, names of places, names of institutions, names of stores, proper nouns and the like. The information of the tag type may be information indicating a kind of the information of the entity type, and a specific tag included in the information may be preset according to different application scenarios. The information of the attribute type may be information capable of representing a specific attribute of the information of the entity type, and the specific attribute included in the information may be determined according to the information representing the specific attribute of the information of the entity type included in the structured information set.
The classification information may be information configured for each preset type based on various types of data and application scenarios in the acquired structured information set, where the structured information set may include multiple pieces of structured information, and each piece of structured information may include data corresponding to configured type information. The configured category information may be set in advance according to an application scenario and the like.
In order to establish the association between the preset type of classification information and the structured information set, different types of information may be configured in advance for different application scenarios (e.g., a mall, a bank, etc.), and when a specific enterprise under a certain application scenario is served, the configured type information may be provided for the specific enterprise, so that a specific person of the enterprise may fill in corresponding structured information based on the configured type information, and thus, after the electronic device obtains the structured information set, the electronic device may determine the reply information corresponding to the voice instruction of the user based on the classification information and the structured information set. In one embodiment, a table for acquiring the structured information may be preset for the application scenario, and a header in the table may be preset according to the application scenario.
For example, it can be shown in the following table:
shop Categories Brand logo Scoring Average price Lowest price Address
The information obtained in advance can be information uploaded by the target person, and then the electronic device can sort the information uploaded by the target person to obtain the structured information set. For example, if the electronic device is located in a shopping mall, the target person may be a data maintainer of each merchant or the shopping mall, and thus the information that can be obtained in advance may be related information of each store uploaded by the data maintainer of each merchant or the shopping mall, and may include information such as a name, a price, and an address of the store.
For example, the structured information set may be as shown in the following table:
serial number Shop Categories Brand logo Scoring Average price Lowest price Address
1 Shop a Roast duck Logo 1 3.7 79 70 Address 1
2 Shop b Japanese chafing dish Logo 2 5 163 126 Address 2
Then, in order to directly use the information uploaded by the user, a form with only a header (i.e., a column name) may be issued to each target person, so that each target person may fill in various kinds of information according to the specified header. After the related information of each shop uploaded by each target person is acquired, the abbreviations of the shop names in one of the shop columns can be completed, the data corresponding to the category column can be rewritten according to specific labels included in the preset classification label information, and the like, so that the data in the obtained structured set can be ensured to be in accordance with query rules, and subsequent query operation is facilitated.
In the table, each row of information except the first row is a piece of structured information, column names of stores, categories, scores and the like are pre-configured category information, each configured category information corresponds to specific data, for example, in the first piece of structured information, specific data corresponding to the configured category information "average price" is "79", and specific data corresponding to the configured category information "address" is "address 1".
In the classification information, the classification information corresponding to the entity type may be information obtained based on data of a specified category (i.e., a category corresponding to the entity type) in the structured information. For example, in a shopping mall scenario, the data of the specified category may be data corresponding to a column of shops in the table; for another example, in a banking scenario, the data of the specified category may be data corresponding to a business name. The classification information corresponding to the label type may be at least one level of classification label information determined according to the application scenario and used for identifying each category information corresponding to the application scenario. The classification information corresponding to the attribute type may be information associated with the configured category information of the structured information and having the same or similar semantics, that is, the classification information corresponding to the attribute type may be information obtained by generalizing the configured category information of the structured information so as to include information associated with the configured category information and having the same or similar semantics. For example, the configured category information in the table above may be included: brand logo, score, minimum price, average price, address, and information associated with such information and having the same or similar semantics.
For example, assume that the classification information of the entity type includes "store a", the classification information of the attribute type includes "address", and information associated with the address and having the same or similar semantics. Then, if the text information corresponding to the voice instruction issued by the user is "shop a is in several buildings", and the preset type includes an entity, a tag, and an attribute, the electronic device may determine that the query information of the preset type included in the text information corresponding to the voice instruction includes query information "shop a" of the type of the entity, and since "shop" is associated with "address" and has similar semantics, the electronic device may determine that the query information includes query information "address" of the type of the attribute.
After determining the query information, the electronic device may perform step S103, that is, querying the structured information matching the query information from the structured information set to determine the structured information as the target information. In one embodiment, the electronic device may determine the data matching the query information according to the similarity between the query information and each data in the structured information set, and further determine the target information from the structured information including the data.
For example, if the query information is "shop a" and "address", in the above structured information set, the target information matching the query information is the structured information including "shop a" and the specific data "address 1" corresponding to the address, that is, the first piece of structured information in the above table.
Further, in the above step S104, the electronic device may generate reply information based on the target information, the inquiry information, and the preset template, and output the reply information. In one embodiment, a plurality of templates may be preset according to preset types, each template may include information of a different preset type, and the setting of the specific content of the preset template is syntax-compliant.
For example, the preset template for the preset type "address" may be that the detailed address of "{ name } is { val }", where name represents a name slot and val represents a column value slot, that is, specific data corresponding to the "address". Then, assuming that the target information obtained by matching is the structured information with the sequence number 1 in the table above, the electronic device may generate the reply information: the detailed address of store a is address 1.
After generating the reply information, the electronic device may output the reply information to inform the user of the result that the user wants to query. It is reasonable that the electronic device can output the reply information in a voice playing manner, can display the reply information through the display screen, and can output the reply information in a voice playing and display screen displaying manner at the same time. For example, it is reasonable that the electronic device may voice-report the reply information, display a map or the like corresponding to the reply information in the display screen, and mark a walking route or the like in the map.
As an implementation manner of the embodiment of the present invention, the preset type may include an entity type, a tag type, and an attribute type.
The classification information corresponding to the entity type may be information obtained based on data of a specified kind in the structured information. In one embodiment, the information about the entity type may be a name of an actually existing object, and the classification information corresponding to the entity type may be information obtained based on data in the structured information, the category of which is the name of the actually existing object. For example, "store a" and "store b" in the table above are names of actual stores, and they can be classified information corresponding to entity types.
Because the categories corresponding to the queryable information in the application scene have similar characteristics for the same application scene, at least one level of classification label information for identifying each category information corresponding to the application scene can be determined in advance according to the application scene.
For example, for the case that the application scene is a shopping mall, since the shopping mall generally includes shopping malls of categories such as food, shopping, entertainment, and the like, and the categories such as food, shopping, entertainment, and the like may include more specific categories, the category label information may include multi-level labels. For the case that the application scene is a mall, the classification information corresponding to the corresponding label type can be preset, as shown in the following table:
Figure BDA0002378441500000071
Figure BDA0002378441500000081
the classification information corresponding to the attribute type may be information associated with the configured category information of the structured information and having the same or similar semantics. In the configured category information included in the structured information, some categories of information, such as brand logo, score, price, address, etc., are used to represent specific attribute information of the data of the entity type, and the information of these categories and the information having the same or similar semantics can be used as the classification information corresponding to the attribute type.
For example, if the semantic of "several buildings" is similar to that of "address", it can be determined that the query information includes the word "address" of the attribute type if "several buildings" is included in the text information corresponding to the voice instruction issued by the user.
As an implementation manner of the embodiment of the present invention, the step of identifying, based on the pre-stored classification information, a preset type of query information included in the text information corresponding to the voice instruction may include:
performing voice recognition processing on the voice instruction to obtain text information corresponding to the voice instruction; determining words included in the text information, and determining the words as the inquiry information if first information matched with the words exists in any classification information for each word; or carrying out voice recognition processing on the voice instruction to obtain text information corresponding to the voice instruction; and recognizing preset types of inquiry information included in the text information corresponding to the voice instruction according to the text information and a pre-trained recognition model.
The electronic device may perform speech recognition processing on the speech instruction through various speech recognition algorithms to determine text information corresponding to the speech instruction, and for a specific speech recognition mode, embodiments of the present invention are not specifically limited and described herein, as long as the text information corresponding to the speech instruction can be obtained through recognition.
As an implementation manner, after obtaining text information corresponding to a voice instruction, the electronic device may perform word segmentation on the text information to obtain words included in the text information, and further, for each word, if first information matching the word exists in any classification information, determine the word as query information, where a preset type corresponding to the query information is a type corresponding to the first information.
Specifically, the electronic device may determine whether first information matching each word exists in any classification information according to the similarity between each word and the classification information, and if so, the word is query information.
For example, the text message "shop a is on several floors", and the words including "shop a", "on" and "several floors" are prepositioned and do not have actual meaning, so that the next operation may not be performed. For the "shop a" and the "several buildings", the electronic device may calculate the similarity between the "shop a" and the "several buildings" and each information included in the classification information, and assuming that the classification information includes the "shop a", the similarity corresponding to the word "shop a" is 100%, it may be determined that the query information of the preset type included in the text information is the "shop a", and the corresponding preset type is the same as the type of the classification information "shop a", for example, the type is an entity type.
In one embodiment, since the entity and the category have a corresponding relationship, after determining that the query information includes the word of the entity type, the electronic device may further determine the category corresponding to the word of the entity type as the word of the tag type included in the query information.
For example, if the "store a" is a hot pot store and the category information corresponding to the tag type includes the tag "chinese cuisine", the electronic device may determine that the category corresponding to the "store a" is chinese cuisine, and may determine that the query information includes the word "chinese cuisine" of the tag type.
As another embodiment, after obtaining the text information corresponding to the voice instruction, the electronic device may recognize, according to the text information and the pre-trained recognition model, the query information of the preset type included in the text information corresponding to the voice instruction.
Specifically, it is reasonable that the electronic device may input the text information into the pre-trained recognition model to obtain the query information of the preset type included in the text information corresponding to the voice instruction, or the electronic device may determine the words included in the text information in advance, and then input the words included in the text information into the pre-trained recognition model to obtain the query information of the preset type included in the text information corresponding to the voice instruction.
The recognition model is obtained by training according to the word samples and the pre-stored classification information in advance, the similarity between each word sample and the classification information can be learned during training, and then when the words included in the text information corresponding to the voice command are recognized, the preset type of query information corresponding to each word can be determined according to the similarity between the words included in the text information and the classification information. The recognition model can be a deep learning model such as a convolutional neural network, a cyclic neural network and the like, and the specific structure of the recognition model is not limited in the embodiment of the invention.
In one embodiment, for each word, the recognition model may output a value between 1 and 0 and the corresponding query information of the preset type, and when the value is greater than a preset threshold (e.g., 0.5), it indicates that the word has a higher similarity to the output query information of the preset type, so that the electronic device may determine the query information of the preset type corresponding to each word according to the output result.
In any way, the preset type of query information is determined, and since the word included in the text information corresponding to the voice command issued by the user may not be one word but a plurality of words, the word included in the preset type of query information included in the text information corresponding to the determined voice command may be one word or a plurality of words, as long as the word matching any one of the classification information is included in the query information.
As can be seen, in this embodiment, the electronic device may perform speech recognition processing on the voice instruction to obtain corresponding text information, determine words included in the text information, and determine, for each word, a word as query information if first information matching the word exists in any classification information, or recognize, according to the text information and a pre-trained recognition model, a preset type of query information included in the text information corresponding to the voice instruction. By adopting any mode, the inquiry information with the preset type in the text information can be accurately determined, and the accuracy of the subsequently generated reply information is further ensured.
As an implementation manner of the embodiment of the present invention, the text information may include a first word with a preset part of speech, for example, the preset part of speech is a pronoun, the first word may be "you", "i", "here", and the like, and since the first word with the preset part of speech may affect the determination of the preset type of query information included in the text information, before the step of determining the word included in the text information, the method may further include:
determining the type corresponding to the first word according to the corresponding relation between the preset part of speech and the type, and converting the first word into a word belonging to the preset type according to the semantic meaning of the first word and the determined type; or converting the first word into a preset word corresponding to the application scene.
In order to eliminate the influence of these factors on subsequent processing, in the first implementation, the electronic device may determine the type corresponding to the first word according to a preset correspondence between the part of speech and the type. For example, the preset correspondence between parts of speech and types includes: the pronouns correspond to entity types, and when the first word is a pronoun, the corresponding type can be determined to be an entity type.
After determining the type corresponding to the first word, the electronic device may convert the first word into a word belonging to a preset type according to the semantic meaning of the first word and the determined type. Specifically, the electronic device may determine, according to the semantic meaning of the first word, a word conforming to the semantic meaning from the classification information corresponding to the type corresponding to the first word, and convert the first word into the word.
In a second implementation manner, the electronic device may convert the first word into a preset word corresponding to the application scenario. For example, the application scene is a mall scene, and the device providing the information query service is a robot, so if the mall currently served by the robot is "facing yang in happy city", and the text information corresponding to the voice instruction sent by the user is "do you have a store x", then the semantic word "do you here" is a pronoun, and the electronic device can convert the first word "do you here" into "facing yang in happy city".
As can be seen, in this embodiment, before the step of determining the words included in the text information, the electronic device may determine the type corresponding to the first word according to the preset correspondence between parts of speech and types, and convert the first word into a word belonging to a preset type according to the semantics of the first word and the determined type; or, the first word is converted into a preset word corresponding to the application scene, so that the influence of the non-standard word on the subsequent identification inquiry information can be eliminated, and the accuracy of the subsequent generation of the reply information is further ensured.
As an implementation manner of the embodiment of the present invention, the step of querying the structured information matching with the query information from the structured information set and determining the structured information as the target information may include:
and if the query information contains words of entity types and attribute types, determining first structured information matched with the words of the entity types and the attribute types contained in the query information in the structured information set as target information.
In a specific implementation, the query information includes words of an entity type and an attribute type, that is, the query information includes words of an entity type and an attribute type, or the query information includes words of an entity type, an attribute type, and a tag type.
When the query information includes words of an entity type, a tag type, and an attribute type, in one case, the text information corresponding to the voice command issued by the user includes the above three types of words, for example, "how much the price of the women's shop m is," women's dress "is the word of the tag type," shop m "is the word of the entity type, and" price "is the word of the attribute type.
In another case, the text information corresponding to the voice instruction issued by the user includes information of the entity type and the attribute type, for example, "what the price of the store m is," suit-dress "is determined by the electronic device according to the" store m, "suit-dress" is a word of the tag type, "store m" is a word of the entity type, and "price" is a word of the attribute type.
When the query information includes words of entity types and attribute types, the electronic device may first determine whether there is first structured information in the structured information that matches the first information of the words of entity types and attribute types included in the query information. That is to say, the electronic device may match the words of which the types are the entity and the attribute first, and since the tag corresponds to the entity and the words of which the types are the specific names, once the words of which the types are the entity can be successfully matched, the words of which the types are the tag inevitably can also be successfully matched, so that the electronic device may match the words of which the types are the entity and the attribute first no matter whether the query information includes the words of which the types are the tag. If the first structured information is available, the first structured information can be determined as the target information.
For example, the query information includes the word "shop m" of the entity type and the word "price" of the attribute type, and the electronic device may determine whether there is first structured information matching the "shop m" and the "price" in the structured information, and if so, determine the first structured information as the target information.
Further, if the first structured information does not exist in the structured information set, determining second structured information matched with words of entity types included in the query information in the structured information set as target information;
for the case where the query information includes words of entity types and attribute types, if the electronic device does not find first structured information from the set of structured information that matches the words of entity types and attribute types included in the query information, it may proceed to determine whether there is second structured information in the set of structured information that matches the words of entity types included in the query information.
For example, the query information includes the word "shop m" of the entity type, the word "women's dress" of the tag type, and the word "price" of the attribute type, the electronic device may first determine whether there is first structured information in the structured information that matches the "shop m" and the "price", and if not, may determine whether there is second structured information in the structured information that matches the "shop m", and if so, may determine the second structured information as the target information.
As another implementation manner of the embodiment of the present invention, the step of querying the structured information matching with the query information from the structured information set and determining the structured information as the target information may include:
and if the query information contains words of entity types and does not contain words of attribute types, determining second structured information matched with the words of entity types included in the query information in the structured information set as target information.
In particular implementations, if the query information includes words of the entity type but does not include words of the attribute type, the electronic device may determine whether there is second structured information in the structured information that matches the words of the entity type included in the query information, that is, the electronic device may match words of the entity type to obtain information related to the entity information queried by the user.
For example, the query information includes the word "shop m" of the entity type but does not include the word "price" of the attribute type, the electronic device may determine whether there is second structured information matching the "shop m" in the structured information, and if so, determine the second structured information as the target information.
As another implementation manner of the embodiment of the present invention, the step of querying the structured information matching with the query information from the structured information set and determining the queried information as the target information may include:
and if the query information comprises words of the tag type and the attribute type and does not comprise words of the entity type, determining third structured information which is matched with the words of the tag type and the attribute type in the query information in the structured information set as target information.
In a specific implementation, if the query information includes words of tag types and attribute types but does not include words of entity types, the electronic device may determine whether the structured information includes third structured information that matches the words of tag types and attribute types included in the query information, that is, the electronic device may match the query information of tag and attribute types to obtain information that is consistent with the tags and attributes queried by the user. If the third structured information exists, the third structured information can be determined as the target information.
For example, the query information includes a word "suit-dress" of the tag type and a word "price" of the attribute type, and the electronic device may determine whether there is third structured information matching the "suit-dress" and the "price" among the pre-stored structured information, and if so, may determine the third structured information as the target information.
And if the third structured information does not exist in the structured information set, determining fourth structured information which is matched with words of the label type included in the query information in the structured information set as target information.
For the case that the query information includes words of the tag type and the attribute type and does not include words of the entity type, if the electronic device does not find third structured information matching the words of the tag type and the attribute type included in the query information from the structured information set, it may be continuously determined whether there is fourth structured information matching the words of the tag type included in the query information in the structured information set.
For example, the query information includes the word "suit-dress" of the label type and the word "price" of the attribute type, the electronic device may determine whether there is third structured information that matches the word "suit-dress" and the word "price" in the pre-stored structured information, and if not, may proceed to determine whether there is fourth structured information that matches the word "suit-dress" in the structured information set, and if so, determine the fourth structured information as the target information.
As another implementation manner of the embodiment of the present invention, the step of querying the structured information matching with the query information from the structured information set and determining the queried information as the target information may include:
and if the query information only comprises words of the label type, determining fourth structured information matched with the words of the label type included in the query information in the structured information set as target information.
In particular implementations, if the query information includes only words of the tag type, the electronic device may determine whether the structured information has fourth structured information that matches words of the tag type included in the query information, that is, the electronic device may match query information of the tag type to obtain information that is consistent with the tag queried by the user. If the fourth structured information is present, the fourth structured information may be determined to be the target information. If the fourth structured information is not present, the target information may be determined to be the preset information. The preset information may be information indicating that no relevant result is queried, for example, "sorry, no relevant information found", or the like.
For example, if the query message includes only the word "suit-dress" of the tag type, the electronic device may determine whether there is fourth structured information matching the "suit-dress" in the structured information, and if so, may determine the fourth structured information as the target information.
As can be seen, in this embodiment, for the case that the query information includes different types of terms, the electronic device may query the target information matching the query information according to the degree of correlation between the terms of the entity, tag, and attribute types and the information to be queried by the user, so as to ensure that the obtained target information is most suitable for the query requirement of the user.
As an implementation manner of the embodiment of the present invention, no matter which word or which types of words are specifically included in the query information, the electronic device may determine the type of the word included in the query information, and if the query information includes the words of the entity type and the attribute type, may query whether there is the first structured information in the structured information set that matches the words of the entity type and the attribute type included in the query information.
In both cases, if there is no first structured information in the structured information set that matches the terms of the entity type and the attribute type included in the query information, or the query information includes terms of the entity type and does not include terms of the attribute type, it is possible to continue querying whether there is second structured information in the structured information set that matches the terms of the entity type included in the query information.
In either case, whether the query information includes words of the tag type and the attribute type and does not include words of the entity type, or if the query information includes words of the entity type but there is no second structured information in the structured information set that matches the words of the entity type included therein, may continue with the third structured information in the structured information set that matches the words of the tag type and the attribute type included in the query information.
If the query information only includes the terms of the tag type, or the query information includes the terms of the tag type and the attribute type, but the third structured information matching the terms of the tag type and the attribute type included in the structured information set does not exist in the structured information set, the query information can be continuously queried whether the structured information set has the fourth structured information matching the terms of the tag type included in the query information.
If there is no fourth structured information in the structured information set that matches the terms of the tag type included in the query information, it may be determined that the target information is not queried.
As an implementation manner of the embodiment of the present invention, in a case that the first structured information, the second structured information, the third structured information, and the fourth structured information do not exist in the structured information set, as shown in fig. 2, the method may further include:
s201, determining a parent tag corresponding to a tag of a word of a tag type included in the query information based on a pre-established tag tree.
In the case where the first structured information, the second structured information, the third structured information, and the fourth structured information do not exist in the structured information set, that is, when the target information is not queried in any of the query methods, a tag tree may be constructed in advance based on tags according to a preset rule so that information that the user is interested in can be recommended to the user. In the tag tree, the range identified by the tag corresponding to the parent node includes the ranges identified by the tags corresponding to all of its child nodes.
For example, the parent node P has three child nodes, and the three child nodes respectively correspond to the labels "men's clothing", "women's clothing", and "children's clothes", so that the label corresponding to the parent node P can be "clothing", and in the classification of clothing, the range identified by "clothing" includes the range identified by "men's clothing", "women's clothing", and "children's clothes".
When the structured information set does not include the first structured information, the second structured information, the third structured information, and the fourth structured information, the electronic device may determine, based on a label tree established in advance, a parent label corresponding to a label of a word of a label type included in the query information. For example, if the query information includes a tag for a tag-type word that is "women's dress," its corresponding parent tag may be "clothing.
S202, if fifth structured information matched with the parent tag exists in the structured information set, determining the fifth structured information as target information.
Next, the electronic device may determine whether a fifth piece of structured information matching the parent tag exists in the structured information set, where the parent tag includes a plurality of child tags, so that in the structured information set, as long as the structured information corresponding to at least one of the plurality of child tags exists, it may be determined that the fifth piece of structured information exists, and the fifth piece of structured information may be determined as the target information.
S203, if the fifth structured information does not exist in the structured information set, determining the father label as a label of a word of a label type included in the query information, returning to the step S201 until the father label is a label corresponding to a root node of the label tree, and determining the target information according to the label corresponding to the root node.
If the fifth structured information does not exist, since the parent tag may be a child node of another node, the range corresponding to the tag included in the parent node is larger, at this time, the electronic device may determine the parent tag as the tag of the word of the tag type included in the query information, and then return to step S201.
That is to say, the parent tag corresponding to the parent tag is further determined, so as to continue to execute steps S202 to S203, until the parent tag is the tag corresponding to the root node of the tag tree, the target information is determined according to the tag corresponding to the root node, and the specific determination process is the same as the manner of determining the fifth structured information, and is not repeated. If no matched structured information is found, it may be considered that no related information is queried, and at this time, it may be determined that the target information is preset information, for example, "information needed by you is not found" or the like.
As can be seen, in this embodiment, for the case that the first structured information, the second structured information, the third structured information, and the fourth structured information do not exist in the pre-stored structured information, the electronic device may determine, based on a pre-established tag tree, a parent tag corresponding to a tag of a word of a tag type included in the query information, and if fifth structured information matching the parent tag exists in the structured information set, determine the fifth structured information as the target information; and if the fifth structural information does not exist, determining the parent tag as the tag of the word of the tag type included in the query information, returning to a pre-established tag tree, determining the parent tag corresponding to the tag of the word of the tag type included in the query information until the parent tag is the tag corresponding to the root node of the tag tree, and determining the target information according to the tag corresponding to the root node. Therefore, the target information matched with the query information can be searched as much as possible, and the query requirements of the user are met.
It should be noted that, in this document, the relational terms of "first", "second", "third", "fourth", and "fifth", etc. are only used to distinguish the structural information queried in different cases, and do not indicate any limitation of execution order, nor do they indicate any limitation of the number of structural information.
As an implementation manner of the embodiment of the present invention, as shown in fig. 3, the step of generating the reply information based on the target information, the query information, and the preset template may include:
s301, determining a content template corresponding to the type of the word contained in the query information according to the preset corresponding relation between the type and the content template;
to facilitate generating the reply message, the electronic device may preset a template for generating the reply message, i.e., a preset template, which may include a start portion template, an end portion template, and a content template in one embodiment. For example, the default templates may be as shown in the following table:
name (R) Form panel
default The address is located at the location for your introduction { name } | (restaurant profile } | belonging to { restaurant profile } category |Floor level …
start Hello | Hi | Hello
end Please focus | respect expectation
Shop name Name of name is called name
Categories { name } belongs to { val } class
Brand logo { name } of logo please see { val }
Scoring { name } is scored as { val }
Average price The price of { name } is { val }
Lowest price The lowest price of { name } is { val }
Region of residence { name } is { val } here
Detailed address The detailed address of { name } is { val }
The start is a start part template, the end is an end part template, the rest are content templates, the name is an entity name, and the val is specific data corresponding to the words of the attribute type in the structured information.
Because the types of words included in the query information may be different, for example, when the preset type includes an entity, a tag, and an attribute, four cases may occur in the type of the word included in the query information, which are: the entity and the attribute, the entity, the tag and the attribute, and the tag can be preset with the corresponding relationship between the type and the content template, so that the electronic equipment can determine the content template corresponding to the type of the word contained in the query information from each preset content template according to the preset corresponding relationship.
S302, generating reply information according to the target information and the determined content template.
After the content template is determined, the electronic device may generate reply information based on the target information and the content template. For example, the target information is:
serial number Shop Categories Brand logo Scoring Average price Lowest price Address
2 Shop b Japanese chafing dish Logo 2 5 163 126 Address 2
The type of the word contained in the query information is entity and attribute, specifically, "store b" and "lowest price", and then the electronic device determines the content template as follows according to the corresponding relationship: { name } the lowest price is { val }, the electronic device may write the specific data "store b" corresponding to the entity type in the target information and the specific data "126" corresponding to the attribute "lowest price" into the content template, thereby generating the reply information: the lowest price for store b is 126.
As can be seen, in this embodiment, the electronic device may determine, according to a preset correspondence between the type and the content template, the content template corresponding to the type to which the word included in the query information belongs, and further generate the reply information according to the target information and the determined content template. Therefore, reply information conforming to grammar can be generated based on the inquired target information, and user experience is improved.
As an implementation manner of the embodiment of the present invention, when the preset template further includes a start portion template and an end portion template, the step of generating the reply information according to the target information and the determined content template may include:
and generating reply information according to the target information, the starting part template, the ending part template and the determined content template.
In order to make the reply information more similar to the language habit of the user and more polite, the electronic device may generate the reply information according to the target information, the start portion template, the end portion template and the determined content template after determining the content template corresponding to the type of the word included in the query information.
Specifically, the electronic device may write specific data corresponding to the type of the word included in the query information in the target information into the determined content template to obtain the content portion, and then combine the start portion template, the content portion, and the end portion template in order to generate the reply information.
Where there are multiple start portion templates and end portion templates, then in one embodiment, it is reasonable for the electronic device to randomly select one of the multiple start portion templates for use and one of the multiple end portion templates for use.
For example, the start part template is "hello", the content part is "the lowest price of store b is 126", and the end part template is "give attention", the electronic device may compose it into reply information: your good, store b has a minimum price of 126, worrisome.
As can be seen, in this embodiment, the electronic device may generate reply information based on the target information, the beginning portion template, the ending portion template, and the determined content template. The generated reply information can better accord with language habits, has more politeness and improves user experience.
As an implementation manner of the embodiment of the present invention, the correspondence between the preset type and the content template may include:
in the first case: the corresponding relationship includes: the types of words contained in the query information are entity types and attribute types, and the corresponding content template is a content template consisting of an entity name, an attribute name and an attribute value.
If the query information includes words of entity types and attribute types, the electronic device may determine that the content template is a content template composed of entity names, attribute names and attribute values according to the correspondence, for example, if the query information includes words of entity types such as "stores" and words of attribute types such as "average price", the electronic device may determine that the content template is { name } in the table.
In the second case: the corresponding relationship includes: the type of the words contained in the query information is only the entity type, and the corresponding content template is a content template consisting of the entity name and the preset content.
If the query information only includes words of the entity type, which means that the query information does not include words of any specific attribute type, and the user may only want to obtain some introductory information related to the words of the entity type, the electronic device may determine, according to the correspondence, that the preset content template is a content template composed of an entity name and preset content, where the preset content is information related to the entity name.
For example, if the query message includes the word "stores" of the entity type, then the electronic device may determine that the content template is one of the default templates in the table, which may be: introduce { name } for you, etc.
Correspondingly, the step of determining the content template corresponding to the type of the word included in the query information according to the preset correspondence between the type and the content template may include:
and if the query information only comprises the label and the words of the attribute type, determining the entity name of the data of the entity type included in the target information, and determining the content template according to the entity name and the words of the attribute type included in the query information.
If the query message includes only the tag and the attribute type word and does not include the entity type word, it indicates that the user may want to query the attribute type information corresponding to a category of entities, for example, the lowest price of a korean-type store in a mall.
At this time, the electronic device may determine the entity name of the entity type information included in the target information, and determine the content template according to the entity name and the word of the attribute type included in the query information, and specifically, the electronic device may determine the entity name of the entity type information included in the target information, and determine the content template according to the correspondence in the first case.
For example, if the query message includes a tag-type word of "korean cuisine", an attribute-type word of "lowest price", and the object information includes an entity-type data of "korean cuisine h", the electronic device may determine that the lowest price of { name } in the table is { val } based on the "korean cuisine h" and the "lowest price".
In one embodiment, since the target information may be plural, in this case, the electronic device may select one target information from the plural target information, and determine the entity name of the included data of the entity type. It is also reasonable to determine the entity name of the data of the entity type included in each target information one by one, and then obtain a plurality of reply information.
Correspondingly, the step of determining the content template corresponding to the type of the word included in the query information according to the preset correspondence between the type and the content template may include:
if the query information includes only words of the tag type, an entity name of data of the entity type included in the target information is determined, and the content template is determined according to the entity name.
If the query message includes only tag type terms and does not include entity type terms and attribute type terms, then the query message indicates that the user may want to query for information about a category of entities, such as duty free stores in an airport.
At this time, the electronic device may determine the entity name of the data of the entity type included in the target information and determine the content template according to the entity name, specifically, the electronic device may determine the entity name of the data of the entity type included in the target information and determine the content template according to the correspondence in the second case.
For example, if the query message includes the word of the tag type "duty free shop" and the entity name of the data of the entity type included in the target message is "duty free shop 1", the electronic device may determine that the content template is "duty free shop 1" to introduce { name } for you, { floor } for the address in the table, and the like.
In one embodiment, since there may be one or more target information, in the case that there are more target information, the electronic device may select one target information from the plurality of target information, and further determine the entity name of the included entity type data. It is also reasonable to determine the entity name of the data of the entity type included in each target information one by one, and then obtain a plurality of reply information.
Therefore, in this embodiment, the electronic device may determine, according to different types of terms included in the query information, a content template that meets the query intent of the user, so as to improve the service level and the user experience.
As an implementation manner of the embodiment of the present invention, the target information may be multiple, and since the number of the structured information in the structured information set may be large, there may also be multiple target information obtained by matching, in this case, in order to better select the target information that best meets the query intention of the user, as shown in fig. 4, the step of generating the reply information based on the target information, the query information, and the preset template may include:
s401, screening the target information to obtain a preset number of screened target information;
the preset number may be set according to the number of structured information, and the like, and may be, for example, 3, 5, 8, and the like, and is not specifically limited herein. In one embodiment, the electronic device may filter the target information according to a preset policy, where the preset policy may be, but is not limited to, filtering according to a matching degree of the target information and the query information, filtering according to a priority, filtering according to a geographic location, and the like.
S402, generating reply information based on the screened target information, the inquiry information and a preset template.
After obtaining the filtered target information, the electronic device may generate reply information based on the filtered target information, the query information, and the preset template, where a specific manner of generating the reply information is described in the above embodiments and is not described again.
Therefore, in this embodiment, the electronic device may screen the target information to obtain a preset number of target information, so that the target information that best meets the query intention of the user may be screened out when the number of the target information is large.
As an implementation manner of the embodiment of the present invention, as shown in fig. 5, the step of filtering the target information to obtain a preset number of target information may include:
s501, sorting the target information according to the sequence of the number of data matched with words of preset types included in the query information in the target information from most to least;
since the number of data included in each target information and matching with the preset type of words included in the query information is not necessarily the same, and the greater the number indicates the higher the matching degree between the target information and the query information, the electronic device may sort the target information in the order of the number of data included and matching with the preset type of words included in the query information, and obtain a sorting result.
For example, if the query information includes words of "shop c", "western food", "fast food", and "address" of preset types, the target information x1 includes data matching with "shop c", "western food", "fast food", and "address", respectively, the target information x3 includes data matching with "shop c", "western food", and "address", respectively, and the target information x2 includes data matching with "shop c" and "address", respectively, the electronic device may obtain the ranking result as: target information x1, target information x3, and target information x 2.
And S502, determining the top preset number of results in the sorting results as the screened target information.
In a specific implementation, after the sorting result is obtained in S501, the electronic device may determine that the top preset number of results in the sorting result are the screened target information. For example, if the predetermined number is 2, the electronic device may use the target information x1 and the target information x3 as the target information based on the example in step S501.
As can be seen, in this embodiment, the electronic device may sort the target information in an order from a largest number to a smallest number of the included data that matches the preset type of words included in the query information, and further determine that a top preset number of the results in the sorting results are the screened target information. Therefore, the electronic equipment can screen out the target information which most meets the query intention of the user according to the matching degree of the target information and the query information.
As an implementation manner of the embodiment of the present invention, as shown in fig. 6, the step of filtering the target information to obtain a preset number of target information may include:
s601, sequencing the target information from high to low according to the corresponding priority information;
the priority information is information that may indicate a priority level of each entity data, and may be, for example, an identifier of an enterprise, a service, a device, or the like, or an identifier of a location where the entity data is located. If the structured information is collected as the information uploaded by each merchant, the priority information may be uploaded by each merchant together with the structured information. Therefore, the electronic equipment can sort the target information from high to low according to the corresponding priority information to obtain a sorting result.
For example, priority information corresponding to the target information x4, the target information x5, and the target information x6 is enterprise a, business c, and device y, respectively, and if the priority level of the enterprise, business, and device is higher than the enterprise, and the enterprise is higher than the business, the electronic device may obtain a ranking result as follows: target information x6, target information x4, and target information x 5.
For another example, the positions corresponding to the target information x7, the target information x8, the target information x9, and the target information x10 are position 1, position 2, position 3, and position 4, respectively, and the distances from the current position of the electronic device to the current position are, in order from near to far: position 2, position 4, position 1, and position 3, since the closer to the current position of the electronic device, the easier the user can reach, so the priority may be higher, and the electronic device may determine that the ranking result is: target information x8, target information x10, target information x7, and target information x 9.
S602, determining the top preset number of results in the sorting results as the screened target information.
The specific implementation of step S602 is the same as step S502 described above, and is not described herein again.
As can be seen, in this embodiment, the electronic device may sort the target information according to the corresponding filtered information from high to low, and then determine that a preset number of results in the sorting result are the filtered target information. Therefore, the electronic equipment can screen out the target information which most meets the query intention of the user according to the priority level of the target information.
As an implementation manner of the embodiment of the present invention, the method may further include:
and if the text information corresponding to the voice instruction sent by the user does not contain any preset type of query information, finishing the query operation.
The preset type of query information not included in the text information may include three cases: in the first case, only words of non-query semantics are included in the text message, e.g., do not want to go there, are not wanted, etc. In the second case, the text information is a sentence representing the ending semantics, e.g., good, goodbye, thank you, etc. In the third case, the text information is information whose semantics are incomplete or whose semantics cannot be determined, for example, i think to know, i think to say, i think to ask one, and the like.
The query information of the preset type, which is not included in the text information, indicates that the user has already obtained the information that the user wants to query, or does not think about the information that needs to query, and the like, and at this time, the information query operation is not required, so the electronic device can end the query operation.
As can be seen, in this embodiment, if the preset type of query information that is not included in the text information corresponding to the voice command sent by the user, the electronic device may end the query operation, so as to filter the voice command sent by the user, improve the query efficiency, and avoid wasting computing resources.
Corresponding to the information query method, the embodiment of the invention also provides an information query device. The following describes an information query apparatus according to an embodiment of the present invention.
As shown in fig. 7, an information inquiry apparatus, the apparatus comprising:
a voice instruction obtaining module 710, configured to obtain a voice instruction sent by a user;
the query information recognition module 720 is configured to recognize, based on the configured classification information, query information of a preset type included in the text information corresponding to the voice instruction;
the classification information is configured information for each preset type based on various types of data and application scenes in an acquired structured information set, the structured information set comprises a plurality of pieces of structured information, and each piece of structured information comprises data corresponding to configured type information.
The target information matching module 730 is configured to query the structured information matched with the query information from the structured information set, and determine the structured information as target information;
a reply information generating module 740, configured to generate reply information based on the target information, the query information, and a preset template, and output the reply information.
As can be seen, in the scheme provided by the embodiment of the present invention, an electronic device may obtain a voice instruction sent by a user, recognize query information of a preset type included in the voice instruction, recognize query information of a preset type included in text information corresponding to the voice instruction based on configured classification information, query structural information matched with the query information from a structural information set, and determine the structural information as target information, where the classification information is information configured for each preset type based on various types of data and application scenarios in the obtained structural information set, the structural information set includes a plurality of pieces of structural information, each piece of structural information includes data corresponding to the configured type information, and generate reply information based on the target information, the query information, and a preset template to output reply information. Therefore, only a voice instruction is required to be sent by a user, the electronic equipment can identify preset type query information included in text information corresponding to the voice instruction, and the structured information set is the acquired set of relevant information of the application scene, so that target information meeting the query intention of the user can be queried from the structured information set, further, reply information is generated and output, convenient and fast information query service can be provided for the user, and the requirements of the user are met.
As an implementation manner of the embodiment of the present invention, the preset type may include an entity type, a tag type, and an attribute type;
the classification information corresponding to the entity type is information obtained based on data of a specified kind in the structured information;
the classification information corresponding to the label type is at least one level of classification label information used for identifying each category information corresponding to the application scene according to the application scene;
and the classification information corresponding to the attribute type is information which is associated with the configured category information of the structural information and has the same or similar semantics.
As an implementation manner of the embodiment of the present invention, as shown in fig. 8, the query information identification module 720 may include:
the text information determining sub-module 721 is configured to perform speech recognition processing on the speech instruction to obtain text information corresponding to the speech instruction;
the query information identification submodule 722 is configured to determine words included in the text information, and for each word, if first information matching the word exists in any classification information, determine the word as the query information, or identify, according to the text information and a pre-trained identification model, a preset type of query information included in the text information corresponding to the voice instruction, where the identification model is obtained by training based on the pre-stored classification information.
As an implementation manner of the embodiment of the present invention, the text information may include a first word of a preset part of speech; the above apparatus may further include:
a conversion module, configured to determine, before determining a word included in the text information, a type corresponding to the first word according to a preset correspondence between a part of speech and the type, and convert the first word into a word belonging to the preset type according to a semantic meaning of the first word and the determined type; or converting the first word into a preset word corresponding to the application scene.
As an implementation manner of the embodiment of the present invention, the target information matching module 730 may include:
a first matching sub-module, configured to determine, as target information, first structured information in the structured information set that matches words of an entity type and an attribute type included in the query information, if the query information includes words of the entity type and the attribute type; alternatively, the first and second electrodes may be,
a second matching sub-module, configured to determine, as target information, second structured information in the structured information set that matches a word of an entity type included in the query information, if the query information includes the word of the entity type and does not include the word of the attribute type; alternatively, the first and second electrodes may be,
a third matching sub-module, configured to determine, as target information, third structured information in the structured information set that matches words of the tag type and the attribute type included in the query information if the query information includes words of the tag type and the attribute type and does not include words of the entity type; alternatively, the first and second electrodes may be,
a fourth matching sub-module, configured to determine, as the target information, fourth structured information in the structured information set that matches the words of the tag type included in the query information, if the query information only includes the words of the tag type.
As an implementation manner of the embodiment of the present invention, the first matching sub-module may be further configured to determine, if the first structured information does not exist in the structured information set, second structured information in the structured information set, which matches a word of an entity type included in the query information, as target information; alternatively, the first and second electrodes may be,
the third matching sub-module may be further configured to determine, as the target information, fourth structured information in the structured information set that matches a word of a tag type included in the query information, if the third structured information does not exist in the structured information set.
As an implementation manner of the embodiment of the present invention, the apparatus may further include:
a parent tag determination module, configured to determine, based on a pre-established tag tree, a parent tag corresponding to a tag of a word of a tag type included in the query information if the first structured information, the second structured information, the third structured information, and the fourth structured information do not exist in the structured information set;
the label tree is constructed based on each label according to a preset rule.
The judging module is used for determining whether the prestored structural information has fifth structural information matched with the parent tag;
a determining module, configured to determine fifth structured information as target information if fifth structured information matching the parent tag exists in the structured information set; alternatively, the first and second electrodes may be,
and a tag updating module, configured to determine, if the fifth structured information does not exist in the structured information set, the parent tag as a tag of a word of a tag type included in the query information, trigger the parent tag determining module until the parent tag is a tag corresponding to a root node of the tag tree, and determine the target information according to the tag corresponding to the root node.
As an implementation manner of the embodiment of the present invention, the reply information generating module 740 may include:
the content template determining submodule is used for determining a content template corresponding to the type of the words contained in the inquiry information according to the preset corresponding relation between the type and the content template;
and the reply information generation submodule is used for generating reply information according to the target information and the determined content template.
As an implementation manner of the embodiment of the present invention, the content template determining sub-module may include:
a first determining unit, configured to determine an entity name of data of an entity type included in the target information if the query information only includes words of a tag type and an attribute type, and determine the content template according to the entity name and the words of the attribute type included in the query information; alternatively, the first and second electrodes may be,
a second determining unit, configured to determine an entity name of data of an entity type included in the target information if the query information includes only words of a tag type, and determine the content template according to the entity name.
As an implementation manner of the embodiment of the present invention, the preset template may further include a start portion template and an end portion template;
the reply information generation sub-module may be specifically configured to generate reply information according to the target information, the start portion template, the end portion template, and the determined content template.
As an implementation manner of the embodiment of the present invention, the target information may be a plurality of pieces;
the reply information generating module may include:
the screening submodule is used for screening the target information to obtain a preset number of screened target information;
and the generation sub-module is used for generating reply information based on the screened target information, the inquiry information and a preset template.
As an implementation manner of the embodiment of the present invention, the screening sub-module may be specifically configured to sort the target information according to a sequence from a largest number to a smallest number of data in the target information, where the data is matched with words of a preset type included in the query information, and determine that a top preset number of results in a sorting result are the screened target information; or, the method may be specifically configured to sort the target information in an order from high to low according to the corresponding priority information, and determine that a preset number of results in the sorting result are the screened target information.
An embodiment of the present invention further provides an electronic device, as shown in fig. 9, the electronic device may include a processor 901, a communication interface 902, a memory 903, and a communication bus 904, where the processor 901, the communication interface 902, and the memory 903 complete mutual communication through the communication bus 904,
a memory 903 for storing computer programs;
the processor 901 is configured to implement the steps of the information query method according to any of the above embodiments when executing the program stored in the memory 903.
As can be seen, in the scheme provided by the embodiment of the present invention, an electronic device may obtain a voice instruction sent by a user, recognize query information of a preset type included in the voice instruction, recognize query information of a preset type included in text information corresponding to the voice instruction based on configured classification information, query structural information matched with the query information from a structural information set, and determine the structural information as target information, where the classification information is information configured for each preset type based on various types of data and application scenarios in the obtained structural information set, the structural information set includes a plurality of pieces of structural information, each piece of structural information includes data corresponding to the configured type information, and generate reply information based on the target information, the query information, and a preset template to output reply information. Therefore, only a voice instruction is required to be sent by a user, the electronic equipment can identify preset type query information included in text information corresponding to the voice instruction, and the structured information set is the acquired set of relevant information of the application scene, so that target information meeting the query intention of the user can be queried from the structured information set, further, reply information is generated and output, convenient and fast information query service can be provided for the user, and the requirements of the user are met.
The communication bus mentioned in the electronic device may be a Peripheral Component Interconnect (PCI) bus, an Extended Industry Standard Architecture (EISA) bus, or the like. The communication bus may be divided into an address bus, a data bus, a control bus, etc. For ease of illustration, only one thick line is shown, but this does not mean that there is only one bus or one type of bus.
The communication interface is used for communication between the electronic equipment and other equipment.
The Memory may include a Random Access Memory (RAM) or a Non-Volatile Memory (NVM), such as at least one disk Memory. Optionally, the memory may also be at least one memory device located remotely from the processor.
The Processor may be a general-purpose Processor, including a Central Processing Unit (CPU), a Network Processor (NP), and the like; but may also be a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), a Field Programmable Gate Array (FPGA) or other Programmable logic device, discrete Gate or transistor logic device, discrete hardware component.
The embodiment of the present invention further provides a computer-readable storage medium, in which a computer program is stored, and when the computer program is executed by a processor, the steps of the information query method described in any of the above embodiments are implemented.
As can be seen, in the solution provided in the embodiment of the present invention, when being executed by a processor, a computer program may obtain a voice instruction sent by a user, identify query information of a preset type included in text information corresponding to the voice instruction based on configured classification information, query structural information matched with the query information from a structural information set, and determine the query information as target information, where the classification information is information configured for each preset type based on various types of data and application scenarios in the obtained structural information set, the structural information set includes a plurality of pieces of structural information, each piece of structural information includes data corresponding to the configured type information, and generate reply information based on the target information, the query information, and a preset template, and output reply information. Therefore, only a voice instruction is required to be sent by a user, the electronic equipment can identify preset type query information included in text information corresponding to the voice instruction, and the structured information set is the acquired set of relevant information of the application scene, so that target information meeting the query intention of the user can be queried from the structured information set, further, reply information is generated and output, convenient and fast information query service can be provided for the user, and the requirements of the user are met.
An embodiment of the present invention further provides a computer program product, where the computer program product includes a computer program stored on a computer-readable storage medium, where the computer program includes program instructions, and the program instructions, when executed by a processor, implement the steps of the information query method in any of the above embodiments.
As can be seen, in the solution provided in the embodiment of the present invention, when a computer program product runs, a voice instruction sent by a user may be acquired, query information of a preset type included in text information corresponding to the voice instruction is identified based on configured classification information, structured information matched with the query information is queried from a structured information set, and the query information is determined to be target information, where the classification information is information configured for each preset type based on various types of data and application scenarios in the acquired structured information set, the structured information set includes a plurality of pieces of structured information, each piece of structured information includes data corresponding to the configured type information, and reply information is generated and output based on the target information, the query information, and a preset template. Therefore, only a voice instruction is required to be sent by a user, the electronic equipment can identify preset type query information included in text information corresponding to the voice instruction, and the structured information set is the acquired set of relevant information of the application scene, so that target information meeting the query intention of the user can be queried from the structured information set, further, reply information is generated and output, convenient and fast information query service can be provided for the user, and the requirements of the user are met.
It should be noted that, for the above-mentioned apparatus, electronic device, computer-readable storage medium and computer program product embodiments, since they are substantially similar to the corresponding method embodiments, the description is relatively simple, and for the relevant points, reference may be made to part of the description of the method embodiments.
It is further noted that, herein, relational terms such as first and second, and the like may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Also, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other identical elements in a process, method, article, or apparatus that comprises the element.
All the embodiments in the present specification are described in a related manner, and the same and similar parts among the embodiments may be referred to each other, and each embodiment focuses on the differences from the other embodiments.
The above description is only for the preferred embodiment of the present invention, and is not intended to limit the scope of the present invention. Any modification, equivalent replacement, or improvement made within the spirit and principle of the present invention shall fall within the protection scope of the present invention.

Claims (10)

1. An information query method, the method comprising:
acquiring a voice instruction sent by a user;
based on configured classification information, identifying preset type query information included in text information corresponding to the voice instruction, wherein the classification information is information configured for each preset type based on various types of data and application scenes in an acquired structured information set, the structured information set comprises a plurality of pieces of structured information, and each piece of structured information comprises data corresponding to configured type information;
querying the structural information matched with the query information from the structural information set, and determining the structural information as target information;
and generating reply information based on the target information, the query information and a preset template, and outputting the reply information.
2. The method of claim 1, wherein the preset types include an entity type, a tag type, and an attribute type;
the classification information corresponding to the entity type is information obtained based on data of a specified kind in the structured information;
the classification information corresponding to the label type is at least one level of classification label information used for identifying each category information corresponding to the application scene according to the application scene;
and the classification information corresponding to the attribute type is information which is associated with the configured category information of the structural information and has the same or similar semantics.
3. The method of claim 1, wherein the step of recognizing a preset type of query information included in the text information corresponding to the voice command based on the pre-stored classification information comprises:
performing voice recognition processing on the voice instruction to obtain text information corresponding to the voice instruction;
determining words included in the text information, and determining the words as the inquiry information if first information matched with the words exists in any classification information for each word; alternatively, the first and second electrodes may be,
and recognizing preset types of inquiry information included in the text information corresponding to the voice command according to the text information and a pre-trained recognition model, wherein the recognition model is obtained by training based on the pre-stored classification information.
4. The method of claim 3, wherein the text message includes a first word of a predetermined part of speech;
before the step of determining words included in the text information, the method further comprises:
determining the type corresponding to the first word according to the corresponding relation between the preset part of speech and the type, and converting the first word into a word belonging to the preset type according to the semantic meaning of the first word and the determined type; alternatively, the first and second electrodes may be,
and converting the first word into a preset word corresponding to the application scene.
5. The method of claim 1, wherein the step of querying the structured information matching the query information from the structured information set to determine the structured information as the target information comprises:
if the query information contains words of entity types and attribute types, determining first structured information matched with the words of the entity types and the attribute types contained in the query information in the structured information set as target information; alternatively, the first and second electrodes may be,
if the query information contains words of an entity type and does not contain words of an attribute type, determining second structured information matched with the words of the entity type included in the query information in the structured information set as target information; alternatively, the first and second electrodes may be,
determining third structured information in the structured information set, which is matched with the words of the tag type and the attribute type included in the query information, as target information if the query information includes words of the tag type and the attribute type and does not include words of the entity type; alternatively, the first and second electrodes may be,
and if the query information only comprises words of the label type, determining fourth structured information matched with the words of the label type included in the query information in the structured information set as target information.
6. The method of claim 5, wherein the method further comprises:
if the first structured information does not exist in the structured information set, determining second structured information matched with words of entity types included in the query information in the structured information set as target information; alternatively, the first and second electrodes may be,
and if the third structured information does not exist in the structured information set, determining fourth structured information which is matched with words of the label type included in the query information in the structured information set as target information.
7. The method of claim 1, wherein the step of generating reply information based on the target information, the query information, and a preset template comprises:
determining a content template corresponding to the type of the word contained in the query information according to the preset corresponding relation between the type and the content template;
and generating reply information according to the target information and the determined content template.
8. An information query apparatus, comprising:
the voice instruction acquisition module is used for acquiring a voice instruction sent by a user;
the query information identification module is used for identifying query information of a preset type included in text information corresponding to the voice instruction based on configured classification information, wherein the classification information is information configured for each preset type based on various types of data and application scenes in an acquired structured information set, the structured information set comprises a plurality of pieces of structured information, and each piece of structured information comprises data corresponding to configured type information;
the target information matching module is used for inquiring the structural information matched with the inquiry information from the structural information set and determining the structural information as target information;
and the reply information generating module is used for generating reply information based on the target information, the query information and a preset template and outputting the reply information.
9. An electronic device is characterized by comprising a processor, a communication interface, a memory and a communication bus, wherein the processor and the communication interface are used for realizing mutual communication by the memory through the communication bus;
a memory for storing a computer program;
a processor for implementing the method steps of any of claims 1 to 7 when executing a program stored in the memory.
10. A computer-readable storage medium, characterized in that a computer program is stored in the computer-readable storage medium, which computer program, when being executed by a processor, carries out the method steps of any one of claims 1 to 7.
CN202010075722.9A 2020-01-22 2020-01-22 Information query method and device, electronic equipment and storage medium Active CN111291158B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010075722.9A CN111291158B (en) 2020-01-22 2020-01-22 Information query method and device, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010075722.9A CN111291158B (en) 2020-01-22 2020-01-22 Information query method and device, electronic equipment and storage medium

Publications (2)

Publication Number Publication Date
CN111291158A true CN111291158A (en) 2020-06-16
CN111291158B CN111291158B (en) 2023-06-09

Family

ID=71029935

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010075722.9A Active CN111291158B (en) 2020-01-22 2020-01-22 Information query method and device, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN111291158B (en)

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113157964A (en) * 2021-03-10 2021-07-23 深圳市明源云科技有限公司 Method and device for searching data set through voice and electronic equipment
CN113569012A (en) * 2021-07-28 2021-10-29 卫宁健康科技集团股份有限公司 Medical data query method, device, equipment and storage medium
CN114385779A (en) * 2021-08-06 2022-04-22 应急管理部通信信息中心 Emergency scheduling instruction execution method and device and electronic equipment
CN116561650A (en) * 2023-07-10 2023-08-08 中汽智联技术有限公司 Scene file classification and updating method, device and equipment based on tree structure

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US10146751B1 (en) * 2014-12-31 2018-12-04 Guangsheng Zhang Methods for information extraction, search, and structured representation of text data
CN109284363A (en) * 2018-12-03 2019-01-29 北京羽扇智信息科技有限公司 A kind of answering method, device, electronic equipment and storage medium
CN109885810A (en) * 2019-01-17 2019-06-14 平安城市建设科技(深圳)有限公司 Nan-machine interrogation's method, apparatus, equipment and storage medium based on semanteme parsing
CN109920414A (en) * 2019-01-17 2019-06-21 平安城市建设科技(深圳)有限公司 Nan-machine interrogation's method, apparatus, equipment and storage medium
US10331402B1 (en) * 2017-05-30 2019-06-25 Amazon Technologies, Inc. Search and knowledge base question answering for a voice user interface

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US10146751B1 (en) * 2014-12-31 2018-12-04 Guangsheng Zhang Methods for information extraction, search, and structured representation of text data
US10331402B1 (en) * 2017-05-30 2019-06-25 Amazon Technologies, Inc. Search and knowledge base question answering for a voice user interface
CN109284363A (en) * 2018-12-03 2019-01-29 北京羽扇智信息科技有限公司 A kind of answering method, device, electronic equipment and storage medium
CN109885810A (en) * 2019-01-17 2019-06-14 平安城市建设科技(深圳)有限公司 Nan-machine interrogation's method, apparatus, equipment and storage medium based on semanteme parsing
CN109920414A (en) * 2019-01-17 2019-06-21 平安城市建设科技(深圳)有限公司 Nan-machine interrogation's method, apparatus, equipment and storage medium

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
陶永芹;: "专业领域智能问答系统设计与实现" *

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113157964A (en) * 2021-03-10 2021-07-23 深圳市明源云科技有限公司 Method and device for searching data set through voice and electronic equipment
CN113569012A (en) * 2021-07-28 2021-10-29 卫宁健康科技集团股份有限公司 Medical data query method, device, equipment and storage medium
CN113569012B (en) * 2021-07-28 2023-12-26 卫宁健康科技集团股份有限公司 Medical data query method, device, equipment and storage medium
CN114385779A (en) * 2021-08-06 2022-04-22 应急管理部通信信息中心 Emergency scheduling instruction execution method and device and electronic equipment
CN116561650A (en) * 2023-07-10 2023-08-08 中汽智联技术有限公司 Scene file classification and updating method, device and equipment based on tree structure
CN116561650B (en) * 2023-07-10 2023-09-19 中汽智联技术有限公司 Scene file classification and updating method, device and equipment based on tree structure

Also Published As

Publication number Publication date
CN111291158B (en) 2023-06-09

Similar Documents

Publication Publication Date Title
CN111291158B (en) Information query method and device, electronic equipment and storage medium
US11106983B2 (en) Intelligent interaction method and intelligent interaction system
CN109800306B (en) Intention analysis method, device, display terminal and computer readable storage medium
JP6440732B2 (en) Automatic task classification based on machine learning
CN109947909B (en) Intelligent customer service response method, equipment, storage medium and device
WO2019141109A1 (en) Method and device for content recommendation
CN108038208B (en) Training method and device of context information recognition model and storage medium
US9984687B2 (en) Image display device, method for driving the same, and computer readable recording medium
CN105956053A (en) Network information-based search method and apparatus
CN107436916B (en) Intelligent answer prompting method and device
CN112256845A (en) Intention recognition method, device, electronic equipment and computer readable storage medium
CN116881429B (en) Multi-tenant-based dialogue model interaction method, device and storage medium
CN111611358A (en) Information interaction method and device, electronic equipment and storage medium
JP2020046895A (en) Apparatus and method for processing information, and program
JP7058574B2 (en) Information processing equipment, information processing methods, and programs
CN110750626B (en) Scene-based task-driven multi-turn dialogue method and system
CN112396079A (en) Number recognition model training method, number recognition method and device
CN112818689B (en) Entity identification method, model training method and device
US10438095B2 (en) System and method for cascading image clustering using distribution over auto-generated labels
CN112434140B (en) Reply information processing method and system
CN109658173A (en) A kind of food and beverage sevice customization method and system
CN113570427A (en) System for extracting and identifying on-line or system commodity characteristic information
CN106557465B (en) Method and device for obtaining word weight categories
JP6160018B1 (en) Information analysis apparatus, information analysis method, and information analysis program
CN112347768B (en) Entity identification method and device

Legal Events

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