CN109815195B - Query method, terminal and storage medium - Google Patents

Query method, terminal and storage medium Download PDF

Info

Publication number
CN109815195B
CN109815195B CN201811618142.9A CN201811618142A CN109815195B CN 109815195 B CN109815195 B CN 109815195B CN 201811618142 A CN201811618142 A CN 201811618142A CN 109815195 B CN109815195 B CN 109815195B
Authority
CN
China
Prior art keywords
query statement
semantic similarity
terminal
preset
corresponding model
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201811618142.9A
Other languages
Chinese (zh)
Other versions
CN109815195A (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 Baidu Netcom Science and Technology Co Ltd
Original Assignee
Beijing Baidu Netcom Science and 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 Baidu Netcom Science and Technology Co Ltd filed Critical Beijing Baidu Netcom Science and Technology Co Ltd
Priority to CN201811618142.9A priority Critical patent/CN109815195B/en
Publication of CN109815195A publication Critical patent/CN109815195A/en
Application granted granted Critical
Publication of CN109815195B publication Critical patent/CN109815195B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The invention provides a query method, a terminal and a storage medium, wherein the method comprises the following steps: acquiring a query statement; acquiring semantic similarity between the query statement and each object in the terminal according to the query statement and a preset semantic similarity corresponding model of the query statement and the object of the terminal; and displaying the objects with the semantic similarity larger than the similarity threshold. According to the invention, the object corresponding to the current query statement of the user is obtained according to the corresponding relation between the preset query statement and the semantic similarity of each object in the terminal, so that the problem that the object is queried only by the name of the object in the prior art is avoided, and the query accuracy is improved.

Description

Query method, terminal and storage medium
Technical Field
The present invention relates to the field of information technologies, and in particular, to an inquiry method, a terminal, and a storage medium.
Background
With the continuous development of terminals, a large number of Applications (APPs) are installed in an existing operating system, and due to the large number of APPs, users are difficult to remember the accurate positions of all APPs, and often need to search the names of the APPs through the terminals to obtain the positions of the APPs; meanwhile, a large amount of files are stored on a computer (personal computer, PC), and a user needs to find out the files needed by the user by means of an inquiry system on the computer.
In the prior art, for inquiring an APP or a file on a terminal, a user needs to input a keyword corresponding to an APP name or a file name to acquire the corresponding APP or file; for example, "reading in hundred degrees" APP, the user uses keywords such as "reading in hundred degrees", "reading in hundred degrees" and the like, and then "reading in hundred degrees" APP can be inquired out, and the terminal recommends the inquiry result to the user.
In the prior art, an APP or a file on a query terminal needs to be queried by using query terms with the same or partially same names, and query terms with other relevant semantics cannot obtain a query result.
Disclosure of Invention
The invention provides a query method, a terminal and a storage medium, which avoid the problem that the object is queried only by the name of the object in the prior art, and improve the query accuracy by the semantics of the object.
A first aspect of the present invention provides a query method, including:
acquiring a query statement;
acquiring semantic similarity between the query statement and each object in the terminal according to the query statement and a preset semantic similarity corresponding model of the query statement and the object of the terminal;
and displaying the objects with the semantic similarity larger than the similarity threshold.
Optionally, the semantic similarity correspondence model between the preset query statement and the object of the terminal includes a correspondence between the query statement and the identifier of the object;
the corresponding model is obtained by:
acquiring a historical query statement, and taking the historical query statement as the preset query statement;
acquiring a positive example object and a negative example object of the preset query statement;
and training to obtain a first corresponding model by taking the first semantic similarity of the preset query statement, the preset query statement and the identification of the positive example object and the second semantic similarity of the preset query statement and the identification of the negative example object as training samples, wherein the first corresponding model is used for representing the corresponding relation between the query statement and the identification of the object.
Optionally, if there are a plurality of preset query statements, the obtaining of the positive example object and the negative example object of the preset query statement includes:
displaying the candidate object of each preset query statement;
and according to an operation instruction of a user, taking an object selected by the user in the candidate objects as a positive example object, and taking an object not selected by the user in the candidate objects as a negative example object, wherein the operation instruction comprises an identifier of the object selected by the user, and the user is the user using the terminal.
Optionally, after displaying the object whose semantic similarity is greater than the similarity threshold, the method further includes:
receiving an identification of the user-selected target object;
taking an object corresponding to the identification of the target object as a positive example object, and taking any one of objects not selected by a user as a negative example object;
and inputting the third semantic similarity of the identifications of the query statement, the query statement and the positive example object and the fourth semantic similarity of the identifications of the query statement and the negative example object into the first corresponding model as training samples to optimize the first corresponding model.
Optionally, the preset semantic similarity correspondence model between the query statement and the object of the terminal further includes a correspondence between the query statement and the attribute of the object;
the corresponding model is obtained by:
acquiring a static attribute and a dynamic attribute of each object, wherein the static attribute is an attribute of each object, and the dynamic attribute is operation data of a user corresponding to each object;
and training to obtain a second corresponding model by taking the preset query statement, the fifth semantic similarity of the preset query statement and the static attribute, and the sixth semantic similarity of the preset query statement and the dynamic attribute as training samples, wherein the second corresponding model is used for representing the corresponding relation between the query statement and the attribute of the object.
Optionally, the obtaining of the semantic similarity between the query statement and each object in the terminal includes:
acquiring a first sub-semantic similarity of the query statement and the identifier of each object according to the query statement and the first corresponding model;
acquiring a second sub-semantic similarity of the query statement and the identifier of each object according to the query statement and the second corresponding model;
and obtaining the semantic similarity between the query statement and each object of the terminal according to the first sub-semantic similarity and the second sub-semantic similarity.
Optionally, the first sub-semantic similarity and the second sub-semantic similarity have different weights respectively.
A second aspect of the present invention provides a terminal, comprising:
a query statement acquisition module for acquiring a query statement;
a semantic similarity obtaining module, configured to obtain semantic similarities between the query statement and each object in the terminal according to the query statement and a semantic similarity correspondence model between a preset query statement and an object in the terminal;
and the display module is used for displaying the objects with the semantic similarity larger than the similarity threshold.
Optionally, the semantic similarity correspondence model between the preset query statement and the object of the terminal includes a correspondence between the query statement and the identifier of the object.
Optionally, the terminal further includes: a first corresponding model obtaining module;
the first corresponding model obtaining module is used for obtaining a historical query statement and taking the historical query statement as the preset query statement; acquiring a positive example object and a negative example object of the preset query statement; and training to obtain a first corresponding model by taking the first semantic similarity of the preset query statement, the preset query statement and the identification of the positive example object and the second semantic similarity of the preset query statement and the identification of the negative example object as training samples, wherein the first corresponding model is used for representing the corresponding relation between the query statement and the identification of the object.
Optionally, the first corresponding model obtaining module is specifically configured to, if there are a plurality of preset query statements, display a candidate object of each preset query statement; and according to an operation instruction of a user, taking an object selected by the user in the candidate objects as a positive example object, and taking an object not selected by the user in the candidate objects as a negative example object, wherein the operation instruction comprises an identifier of the object selected by the user, and the user is the user using the terminal.
Optionally, the terminal further includes: an optimization module;
the optimization module is used for receiving the identification of the target object selected by the user; taking an object corresponding to the identification of the target object as a positive example object, and taking any one of objects not selected by a user as a negative example object; and inputting the third semantic similarity of the identifications of the query statement, the query statement and the positive example object and the fourth semantic similarity of the identifications of the query statement and the negative example object into the first corresponding model as training samples to optimize the first corresponding model.
Optionally, the preset semantic similarity correspondence model between the query statement and the object of the terminal further includes a correspondence between the query statement and the attribute of the object.
Optionally, the terminal further includes: a second corresponding model obtaining module;
the second corresponding model obtaining module is configured to obtain a static attribute and a dynamic attribute of each object, where the static attribute is an attribute of each object, and the dynamic attribute is operation data of a user corresponding to each object; and training to obtain a second corresponding model by taking the preset query statement, the fifth semantic similarity of the preset query statement and the static attribute, and the sixth semantic similarity of the preset query statement and the dynamic attribute as training samples, wherein the second corresponding model is used for representing the corresponding relation between the query statement and the attribute of the object.
Optionally, the semantic similarity obtaining module is specifically configured to obtain, according to the query statement and the first corresponding model, a first sub-semantic similarity between the query statement and each identifier of the object; acquiring a second sub-semantic similarity of the query statement and the identifier of each object according to the query statement and the second corresponding model; and obtaining the semantic similarity between the query statement and each object of the terminal according to the first sub-semantic similarity and the second sub-semantic similarity.
Optionally, the first sub-semantic similarity and the second sub-semantic similarity have different weights respectively.
A third aspect of the present invention provides a terminal, comprising: at least one processor and memory;
the memory stores computer-executable instructions;
the at least one processor executes computer-executable instructions stored in the memory to cause the terminal to perform the above-described query method.
A fourth aspect of the present invention provides a computer-readable storage medium having stored thereon computer-executable instructions that, when executed by a processor, implement the above-mentioned query method.
The invention provides a query method, a terminal and a storage medium, wherein the method comprises the following steps: acquiring a query statement; acquiring semantic similarity between the query statement and each object in the terminal according to the query statement and a preset semantic similarity corresponding model of the query statement and the object of the terminal; and displaying the objects with the semantic similarity larger than the similarity threshold. According to the invention, the object corresponding to the current query statement of the user is obtained according to the corresponding relation between the preset query statement and the semantic similarity of each object in the terminal, so that the problem that the object is queried only by the name of the object in the prior art is avoided, and the query accuracy is improved.
Drawings
FIG. 1 is a first flowchart illustrating a query method according to the present invention;
FIG. 2 is a second flowchart illustrating a query method according to the present invention;
FIG. 3 is a schematic diagram of an interface of a terminal according to the present invention;
FIG. 4 is a schematic diagram of an interface of a terminal according to the present invention;
FIG. 5 is a third schematic flowchart of a query method provided by the present invention;
fig. 6 is a first schematic structural diagram of a terminal according to the present invention;
fig. 7 is a schematic structural diagram of a terminal according to the present invention;
fig. 8 is a schematic structural diagram of a terminal provided by the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the embodiments of the present invention. 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.
At present, when inquiring APP or files on a terminal, a user is required to input an inquiry word with the same or partially same name as the APP or files, the terminal can return correct APP or files to the user, and when inquiring by adopting the inquiry word related to the APP semantics, an accurate search result cannot be obtained; for example, when the user wants to query the APP of "salted fish", the terminal cannot return the APP when the query of "xianyu" or "second-hand transaction" is adopted.
The execution main body of the query method provided by the invention is a terminal, and a plurality of objects are stored in the terminal, specifically, the objects can be APP, documents, folders and the like. The terminal has an input function, so that a user can query a corresponding object through the terminal, specifically, the input may be text input by the user on the terminal, or may also be voice input by the user to query the object, where the text or the voice input by the user may be at least one word, or one sentence, or one segment of text, and the like, which is not limited in this embodiment. The terminal stores a pre-trained model which can output objects with higher semantic similarity with the query sentence.
Correspondingly, the terminal has a voice conversion function, for example, the voice input by the user can be converted, so that the converted voice can be input into the pre-trained model to obtain the corresponding object.
Fig. 1 is a first schematic flow chart of the query method provided by the present invention, and an execution main body of the method flow shown in fig. 1 may be a terminal, and the terminal may be implemented by any software and/or hardware. As shown in fig. 1, the query method provided in this embodiment may include:
s101, acquiring a query statement.
In this embodiment, a plurality of APPs are installed in the terminal, and a plurality of documents, photos or folders are stored in the terminal, and these APPs, documents, photos or folders can all be used as query objects in the terminal. In the prior art, when a user queries a target object in a large number of objects, for example, when the user searches for a target document in a terminal, the user may obtain the target document by inputting a name of a corresponding target document on the terminal, but when the user forgets the name of the document, the terminal in the prior art does not return the corresponding document to the user, and the user needs to query one document.
In this embodiment, when a user needs to query an acquisition object, an input interface is provided on the terminal, specifically, the user may input text or voice in the input interface, where the text or voice input by the user in this embodiment may be at least one word or a segment of text, and in this embodiment, information input by the user is used as a query statement.
S102, acquiring the semantic similarity between the query statement and each object in the terminal according to the query statement and the preset semantic similarity corresponding model between the query statement and the object of the terminal.
In this embodiment, a semantic similarity correspondence model between a preset query statement and an object of the terminal is stored in the terminal in advance. Specifically, the terminal may obtain the corresponding model before querying, where the terminal obtains a plurality of preset query statements, and the preset query statements may be preset query statements input by a user and obtained by the terminal.
For example, when the corresponding model is not set in the terminal, the terminal may obtain a plurality of historical query statements input by a user on a plurality of terminals, where the historical query statements may be preset in the terminal or may be imported by the user; such as user input "xianyu" on terminal a, user input "second-hand transaction" on terminal B, etc.
After the terminal obtains the preset query sentences, a user corresponding to the terminal can mark each query sentence and mark an object which the user desires to query. For example, for a query statement "second-hand transaction", the corresponding query object is APP, and the user may mark "salted fish" APP, "melon seed" APP, etc. as the object that the query statement desires to query.
After each preset query statement is labeled, the semantics of each query statement and the semantics of the labeled object can be obtained; specifically, the semantics of the labeled object may be the semantics of the identifier of the object and/or the semantics of the attribute of the object, the identifier of the object may be the name of the object, the attribute of the object may be the operation data of the object by the user, and the like, and the semantics of the labeled object is not limited in this embodiment. The semantics of the tag of the object are explained below as an example.
Since the object labeled by the object is the object expected to be output by the query semantics, the semantic similarity between the sentence of the query sentence and the semantic of the label of the object labeled by the object is labeled as higher similarity. Correspondingly, after the similarity between each object in the terminal and the corresponding query statement is obtained, the semantic similarity between each preset query statement, each preset query statement and each object identifier is used as a training sample, and a model corresponding to the semantic similarity between the preset query statement and the object of the terminal is trained and obtained.
Optionally, during the training of the correspondence relationship, the user corresponding to the terminal may label each preset query term with the positive example object identifier and the negative example object identifier, wherein, the positive example object can be an object expected to be input by a user according to the query statement, the negative example object is an object irrelevant to the semantics of the query statement, and labels the sign of the positive example object and the corresponding query sentence as higher semantic similarity, labels the sign of the negative example object and the corresponding query sentence as lower semantic similarity, labels the semantic similarity of each preset query sentence, each preset query sentence and the sign of each positive example object, and training to obtain a semantic similarity corresponding model of the preset query sentence and the object of the terminal by taking the semantic similarity of the mark of each preset query sentence and each negative case object as a training sample. In particular, in the training process, the method of Pairwise (namely, using Hinge Loss) can be adopted to optimize the semantic similarity of the positive example object and the negative example object.
In this embodiment, after the terminal acquires the model corresponding to the semantic similarity between the preset query statement and the object of the terminal, the terminal receives the query statement sent by the terminal, and specifically, the semantic similarity between the query statement and each object in the terminal is acquired according to the semantics of the query statement and the model corresponding to the semantic similarity between the preset query statement and the object of the terminal.
S103, displaying the object with the semantic similarity larger than the similarity threshold.
In this embodiment, a similarity threshold may be preset in the terminal, after the semantic similarity between the query statement sent by the terminal and each object in the terminal is obtained according to a preset semantic similarity corresponding model between the query statement and the object in the terminal, the semantic similarities between the multiple semantic similarities and the similarity threshold are determined, the object whose semantic similarity is greater than the similarity threshold is obtained, and the object whose semantic similarity is greater than the similarity threshold is displayed, so that the user can select the object in the terminal by clicking or replacing other operation modes to obtain the object required by the user.
Exemplarily, the similarity threshold is 0.7, the preset query statement in S202 includes "second-hand transaction", the semantic similarity between the preset query statement and the "salted fish" APP is 0.9, the semantic similarity between the preset query statement and the "melon seed" APP is 0.8, and the semantic similarity between the preset query statement and the "Tengchin video" is 0.1; and when the terminal acquires the query statement of the second-hand transaction sent by the terminal, the terminal displays a salted fish APP and a melon seed APP with semantic similarity larger than a similarity threshold.
The query method provided by the embodiment comprises the following steps: acquiring a query statement; acquiring semantic similarity between the query statement and each object in the terminal according to the query statement and a preset semantic similarity corresponding model of the query statement and the object of the terminal; and displaying the objects with the semantic similarity larger than the similarity threshold. According to the embodiment, the object corresponding to the current query statement of the user is obtained according to the corresponding relation between the preset query statement and the semantic similarity of each object in the terminal, so that the problem that the object is queried only by the name of the object in the prior art is solved, and the query accuracy is improved.
In the following, how to obtain the semantic similarity correspondence model between the preset query statement and the object of the terminal in the query method provided by the present invention is described in detail with reference to fig. 2, where fig. 2 is a schematic flow diagram of the query method provided by the present invention, and as shown in fig. 2, the query method provided by this embodiment may include:
s201, obtaining a historical query statement, and taking the historical query statement as a preset query statement.
In the semantic similarity correspondence model between the preset query statement and the object of the terminal in this embodiment, the semantic similarity correspondence model includes a correspondence between the query statement and the identifier of the object, and specifically, the correspondence between the query statement and the identifier of the object may be obtained in advance. The specific obtaining mode may be:
the terminal stores a history query statement, specifically, the history query statement may be a query statement input by a user corresponding to the terminal, or may be a statement packet corresponding to a history query statement downloaded by the terminal through a network, and the statement packet may be a set of all history query statements in a plurality of terminals governed by the server.
It should be noted that, in order to obtain a more effective preset query statement, the terminal may use a historical query statement in a preset time period as the preset query statement.
S202, acquiring a positive example object and a negative example object of a preset query statement.
In this embodiment, a first corresponding model may be established according to the semantics of the query statement and the semantics of the identifier of the corresponding object, where the first corresponding model is used to represent the corresponding relationship between the query statement and the identifier of the object, and specifically, before establishing the first corresponding model, a sample for establishing the first corresponding model needs to be obtained. Wherein the sample object includes a positive case object and a negative case object.
The regular example object can be an object with the identifier of the object containing a query statement, or the semantic of the identifier of the object and the semantic of the query statement having higher similarity; and negative examples objects are objects that have a lower degree of similarity to the semantics of the query statement.
In this embodiment, the similarity between the semantic of the identifier of the object and the semantic of the query statement may also be obtained in the prior art, where an object larger than a preset threshold is used as a positive example object, and an object smaller than the preset threshold is used as a negative example object.
Specifically, fig. 3 is an interface schematic diagram of the terminal provided by the present invention, and as shown in fig. 3, a specific process of acquiring a positive example object and a negative example object of a preset query statement in this embodiment may be: the terminal displays each preset query statement and a candidate object of each preset query statement; the candidate object may be an object that is expected to be output by each preset query statement input by the user in the terminal, or may be all objects in the terminal corresponding to each preset query statement, or the candidate object may be an object whose semantic meaning with respect to the preset query statement is greater than a preset threshold.
As exemplarily shown in fig. 3, the candidate objects corresponding to the preset query statement "second-hand transaction" are "salted fish" APP, "two-only" APP, "melon seed" APP, "X video" APP, "X cloud" APP.
In the embodiment, a user selects candidate objects through clicking or other operation modes, and a terminal takes an object selected by the user in the candidate objects as a positive example object and an object not selected by the user in the candidate objects as a negative example object according to an operation instruction of the user; the operation instruction comprises an identification of an object selected by a user, and the user is a user using the terminal.
Illustratively, if the user selects the "salted fish" APP, "only two" APP, "melon seed" APP by clicking or other operation manners, the "salted fish" APP, "only two" APP, "melon seed" APP is used as a positive example object corresponding to the preset query statement "second-hand transaction", and the "X video" APP "and the" X cloud "APP that are not selected by the user are used as a negative example object corresponding to the preset query statement" second-hand transaction ".
S203, training and acquiring a first corresponding model by taking the first semantic similarity of the preset query statement, the preset query statement and the identification of the positive example object and the second semantic similarity of the preset query statement and the identification of the negative example object as training samples.
In this embodiment, after acquiring a positive example object and a negative example object corresponding to each preset query statement, the semantics of the identifier of the positive example object corresponding to each preset query statement, and the semantics of the identifier of the negative example object corresponding to each preset query statement are acquired; the method includes the steps of obtaining a first semantic similarity of the preset query statement and the sign of the positive example object, and obtaining a second semantic similarity of the preset query statement and the sign of the negative example object, specifically, the way of obtaining the semantic similarity may refer to the way of semantic similarity in the prior art, and in this embodiment, an optimization way may also be adopted, for example, a Pairwise method is adopted, and after obtaining the first semantic similarity and the second semantic similarity of each preset query statement, the first semantic similarity of the object expected to be output by each preset query statement, and the second semantic similarity of the object not expected to be output by each preset query statement may be optimized.
In this embodiment, a first semantic similarity of the preset query statement, and the identifier of the positive example object, and a second semantic similarity of the preset query statement and the identifier of the negative example object are used as training samples, and a first corresponding model is obtained by training, where the first corresponding model is used to represent a corresponding relationship between the preset query statement and the semantic similarity of the identifier of each object. The query statement input by the user is input to the first corresponding model in this embodiment, and the semantic similarity between the query statement and the identifier of each object may be output.
S204, acquiring a query statement.
S205, according to the query statement and the preset semantic similarity corresponding model of the query statement and the object of the terminal, obtaining the semantic similarity between the query statement and each object in the terminal.
And S206, displaying the object with the semantic similarity larger than the similarity threshold.
S207, receiving the identification of the target object selected by the user.
In this embodiment, after the terminal displays the object whose semantic similarity is greater than the similarity threshold, the user may select the displayed object, where the selected object is an object required by the user. Fig. 4 is an interface schematic diagram of the terminal provided by the present invention, as shown in an interface 401 in fig. 4, an inquiry statement input by a user is "second-hand transaction", the interface jumps to 402, objects displayed on the interface by the terminal include "salted fish" APP, "only two" APP, "melon seed" APP, and the user selects "salted fish" APP by clicking or other operation modes, that is, an object that the user desires to obtain.
Specifically, in order to further optimize the first corresponding model in the terminal, in this embodiment, after the user selects an object whose semantic similarity is greater than the similarity threshold, the selected object is a target object, and the terminal sends an identifier of the target object to the terminal, so that the terminal optimizes the first corresponding model according to the identifier of the target object and the query statement corresponding to the identifier.
And S208, taking the object corresponding to the identification of the target object as a positive example object, and taking any one of the objects not selected by the user as a negative example object.
In this embodiment, when the terminal optimizes the first corresponding model, the first corresponding model is optimized according to the selection operation of the user on the object displayed by the terminal; the method comprises the following steps of taking an object corresponding to an identifier of a target object selected by a user as a positive example object, and taking any one of objects not selected by the user as a negative example object; furthermore, the corresponding query statement, the identification of the positive example object and the identification of the negative example object corresponding to the query statement may be input into the first corresponding model, and training is continued to optimize the first corresponding model, i.e., the result output by the first corresponding model is more suitable for the user's requirement.
It is conceivable that the terminal may obtain the selection data of the users returned by the plurality of terminals, and may input the received selection data of the users returned by the plurality of terminals to the first corresponding model to optimize the first corresponding model.
S209, inputting the third semantic similarity of the identifications of the query statement, the query statement and the positive example object and the fourth semantic similarity of the identifications of the query statement and the negative example object into the first corresponding model as training samples, and optimizing the first corresponding model.
In this embodiment, the third semantic similarity of the identifiers of the query statement and the positive example object and the fourth semantic similarity of the identifiers of the query statement and the negative example object are obtained, and the specific semantic similarity obtaining manner may refer to the manner in the above embodiments.
Specifically, the third semantic similarity of the identifications of the query statement, the query statement and the positive example object and the fourth semantic similarity of the identifications of the query statement and the negative example object are used as training samples and input into the first corresponding model, and the first corresponding model is optimized.
The implementation in S204-S206 in this embodiment may specifically refer to the description related to the embodiments S101-S103, and is not limited herein.
In this embodiment, the terminal takes a historical query statement as a preset query statement, trains and acquires a first corresponding model according to a first semantic similarity of the preset query statement, the preset query statement and the identifier of the positive example object, and a second semantic similarity of the preset query statement and the identifier of the negative example object as a training sample, and inputs the query statement input by the user into the first corresponding model, so that the present embodiment acquires the object corresponding to the query statement according to the semantic of the identifier of the object, thereby improving the query accuracy; further, in this embodiment, the first corresponding model is optimized according to the behavior data of the user, so that the result of the object output by the first corresponding model is more suitable for the user's requirement, and the user experience is further improved.
In addition to the semantics that the identification of the object can extend, the above embodiment obtains the object according to the semantics that the identification of the object extends, but in practical applications, besides the identification of the object, there is also semantic information that the identification cannot cover.
Fig. 5 is a schematic flow diagram of a third query method provided by the present invention, and as shown in fig. 5, the query method provided by this embodiment may include:
s501, obtaining a historical query statement, and taking the historical query statement as a preset query statement.
S502, acquiring a positive example object and a negative example object of a preset query statement.
S503, taking the first semantic similarity of the preset query statement, the preset query statement and the identification of the positive example object and the second semantic similarity of the preset query statement and the identification of the negative example object as training samples, and training to obtain a first corresponding model.
S504, the static attribute and the dynamic attribute of each object are obtained.
The preset semantic similarity correspondence model between the query statement and the object at the terminal further includes a correspondence between the query statement and the attribute of the object, and in this embodiment, the second correspondence model may be obtained by training according to the correspondence between the query statement and the attribute of the object.
Specifically, the static attribute in this embodiment is an attribute that each object has, for example, when the object is an APP, the static attribute of the APP includes, but is not limited to, a name of a product company of the APP, a pinyin corresponding to the APP name, a feature of an icon corresponding to the APP, and the like, and for example, as "good-looking video" APP, the product company "X degree" may be used, its function "short video software", and a feature of the icon "white icon software" may be used as a static feature of the "good-looking video" APP. Specifically, the terminal may obtain the static attribute of the object through information when the object in the terminal is installed and stored.
The dynamic attribute in this embodiment is operation data of a user corresponding to each object, where the operation data is operation data of an object in the terminal by the user, and is different from a selection operation of the user on the object after the terminal displays the object in the above embodiment. Illustratively, for example, "APP opened yesterday", "APP opened last time", "APP exceeding 1 GB", and the like may be used as the dynamic attribute of the object. Specifically, the terminal may obtain the dynamic attribute of the object through a log recorded in the terminal.
And S505, taking the fifth semantic similarity of the preset query statement, the preset query statement and the static attribute and the sixth semantic similarity of the preset query statement and the dynamic attribute as training samples, and training to obtain a second corresponding model.
In this embodiment, after obtaining a preset query statement, exemplarily "APP with white icon", and a static attribute and a dynamic attribute of each object, obtaining a semantic of each preset query statement, and a semantic of the static attribute and a semantic of the dynamic attribute of each object; and acquiring a fifth semantic similarity of the preset query statement and the static attribute and a sixth semantic similarity of the preset query statement and the dynamic attribute.
In this embodiment, the fifth semantic similarity between the preset query statement, the preset query statement and the static attribute, and the sixth semantic similarity between the preset query statement and the dynamic attribute are used as training samples, and a second corresponding model is obtained by training, where the second corresponding model is used to represent a correspondence between the preset query statement and the semantic similarity between the attributes of each object. The query statement input by the user is input to the second corresponding model in this embodiment, and the semantic similarity between the query statement and the attribute of each object can be output.
S506, obtaining the query statement.
S507, according to the query statement and the first corresponding model, obtaining a first sub-semantic similarity of the query statement and the identifier of each object.
Specifically, a first corresponding model is stored in the terminal, and the first corresponding model is used for representing the corresponding relation between the preset query statement and the semantic similarity of the identifier of each object; after the terminal acquires the query statement, the query statement is input into the first corresponding model, and the first sub-semantic similarity between the query statement and the identifier of each object is acquired.
S508, according to the query statement and the second corresponding model, obtaining a second sub-semantic similarity of the query statement and the identifier of each object.
In this embodiment, a second corresponding model is stored in the terminal, and the second corresponding model is used to represent a corresponding relationship between a preset query statement and semantic similarity of an attribute of each object.
Specifically, the terminal obtains a second sub-semantic similarity of the attribute of each object and the query statement according to the query statement and the preset corresponding relationship of the semantic similarity of the attribute of each object and the query statement.
S507 and S508 in this embodiment are not sequentially distinguished, and may be executed simultaneously.
S509, obtaining semantic similarity between the query statement and each object of the terminal according to the first sub-semantic similarity and the second sub-semantic similarity.
Specifically, the first sub-semantic similarity and the second sub-semantic similarity have different weights respectively; the terminal may store a corresponding relationship between a preset query statement and the identifier of each object, and a weight of the attribute of each object, specifically, the corresponding relationship may also be obtained by the above-mentioned method for obtaining the similarity model, and for each preset query statement, the semantic similarity of the corresponding identifier of the object and the weight of the similarity of the attribute of the object are different; illustratively, if the user input is "yesterday open APP", then the weight of the semantics of the object's attributes is larger and the weight of the semantics of the object's identifications is smaller.
In this embodiment, the weight of the first sub-semantic similarity and the weight of the second sub-semantic similarity may be obtained according to the first sub-semantic similarity, the second sub-semantic similarity, and the correspondence between the preset query statement and the identifier of each object and the weight of the attribute of each object; and acquiring the semantic similarity between the query statement and each object according to the first sub-semantic similarity, the second sub-semantic similarity, the weight of the first sub-semantic similarity and the weight of the second sub-semantic similarity. Specifically, the correspondence between the preset query statement and the identifier of each object and the weight of the attribute of each object is obtained by using an Attention authorization mechanism in this embodiment.
Illustratively, the user inputs "APP opened yesterday", and the terminal acquires a dynamic attribute "APP opened yesterday" according to the semantic meaning of the query statement, such as "good-looking video" APP, "salted fish" APP, and "melon seed" APP; the user inputs 'APP of yellow icon turned on yesterday', and the terminal displays 'salted fish' APP with static attribute 'yellow icon' in APP turned on yesterday.
And S510, displaying the object with the semantic similarity larger than the similarity threshold.
The implementation manners in S501 to S503 and S506 in this embodiment may specifically refer to the description related to the embodiments S501 to S503 and S504, and are not limited herein.
In this embodiment, in order to expand the semantics of the objects in the similarity model to a wider range, the static attribute and the dynamic attribute of each object are also obtained, the fifth semantic similarity of the preset query statement, the preset query statement and the static attribute, and the sixth semantic similarity of the preset query statement and the dynamic attribute are used as training samples, and a second corresponding model is obtained through training; and combining the query sentence, the preset corresponding relation of the semantic similarity between the query sentence and the identifier of each object and the preset corresponding relation of the semantic similarity between the query sentence and the attribute of each object to obtain the semantic similarity between the query sentence and each object, wherein the weight corresponding to the identifier and the attribute is adopted when the semantic similarity is obtained, so that the obtained semantic similarity is more attached to the semantic of the query sentence, and the accuracy of returned results is improved.
Fig. 6 is a schematic structural diagram of a terminal according to the present invention, as shown in fig. 6, the terminal 600 includes: a query sentence acquisition module 601, a semantic similarity acquisition module 602, and a display module 603.
The query statement obtaining module 601 is configured to obtain a query statement.
The semantic similarity obtaining module 602 is configured to obtain semantic similarities between the query statement and each object in the terminal according to the query statement and the semantic similarity corresponding model between the preset query statement and the object in the terminal.
A display module 603, configured to display an object whose semantic similarity is greater than a similarity threshold.
The principle and technical effect of the terminal provided by this embodiment are similar to those of the above-mentioned query method, and are not described herein again.
Optionally, fig. 7 is a schematic structural diagram of a terminal provided by the present invention, and as shown in fig. 7, the terminal 600 further includes: a first corresponding model obtaining module 604, an optimizing module 605, and a second corresponding model obtaining module 606.
Optionally, the preset semantic similarity correspondence model between the query statement and the object of the terminal includes a correspondence between the query statement and the identifier of the object.
A first corresponding model obtaining module 604, configured to obtain a historical query statement, where the historical query statement is used as a preset query statement; acquiring positive example objects and negative example objects of a preset query statement; and training to obtain a first corresponding model by taking the first semantic similarity of the preset query statement, the preset query statement and the identification of the positive example object and the second semantic similarity of the preset query statement and the identification of the negative example object as training samples, wherein the first corresponding model is used for representing the corresponding relation between the query statement and the identification of the object.
Optionally, the first corresponding model obtaining module 604 is specifically configured to display a candidate object of each preset query statement if there are multiple preset query statements; according to the operation instruction of the user, an object selected by the user in the candidate objects is used as a positive example object, an object not selected by the user in the candidate objects is used as a negative example object, the operation instruction comprises an identification of the object selected by the user, and the user is the user using the terminal.
An optimization module 605 for receiving an identification of a target object selected by a user; taking an object corresponding to the identification of the target object as a positive example object, and taking any one of objects not selected by the user as a negative example object; and inputting the third semantic similarity of the identifications of the query statement, the query statement and the positive example object and the fourth semantic similarity of the identifications of the query statement and the negative example object into the first corresponding model as training samples to optimize the first corresponding model.
Optionally, the preset semantic similarity correspondence model between the query statement and the object of the terminal further includes a correspondence between the query statement and the attribute of the object.
A second corresponding model obtaining module 606, configured to obtain a static attribute and a dynamic attribute of each object, where the static attribute is an attribute of each object, and the dynamic attribute is operation data of a user corresponding to each object; and training to obtain a second corresponding model by taking the fifth semantic similarity of the preset query statement, the preset query statement and the static attribute and the sixth semantic similarity of the preset query statement and the dynamic attribute as training samples, wherein the second corresponding model is used for expressing the corresponding relation between the query statement and the attribute of the object.
Optionally, the semantic similarity obtaining module 602 is specifically configured to obtain, according to the query statement and the first corresponding model, a first sub-semantic similarity between the query statement and each object identifier; acquiring a second sub-semantic similarity of the query statement and the identifier of each object according to the query statement and the second corresponding model; and obtaining the semantic similarity between the query statement and each object of the terminal according to the first sub-semantic similarity and the second sub-semantic similarity.
Optionally, the first sub-semantic similarity and the second sub-semantic similarity have different weights respectively.
Fig. 8 is a schematic structural diagram of a terminal according to a third embodiment of the present invention, and as shown in fig. 8, the terminal 800 includes: a memory 801 and at least one processor 802.
A memory 801 for storing program instructions.
The processor 802 is configured to implement the query method in this embodiment when the program instructions are executed, and specific implementation principles may be referred to in the foregoing embodiments, which are not described herein again.
The terminal 800 may also include an input/output interface 803.
The input/output interface 803 may include a separate output interface and input interface, or may be an integrated interface that integrates input and output. The output interface is used for outputting data, the input interface is used for acquiring input data, the output data is a general name output in the method embodiment, and the input data is a general name input in the method embodiment.
The present invention also provides a readable storage medium, in which an execution instruction is stored, and when at least one processor of the terminal executes the execution instruction, when the computer execution instruction is executed by the processor, the query method in the above embodiments is implemented.
The present invention also provides a program product comprising execution instructions stored in a readable storage medium. The at least one processor of the terminal may read the execution instruction from the readable storage medium, and the execution of the execution instruction by the at least one processor causes the terminal to implement the query method provided by the various embodiments described above.
In the embodiments provided in the present invention, it should be understood that the disclosed apparatus and method may be implemented in other ways. For example, the above-described apparatus embodiments are merely illustrative, and for example, the division of the units is only one logical division, and other divisions may be realized in practice, for example, a plurality of units or components may be combined or integrated into another system, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection through some interfaces, devices or units, and may be in an electrical, mechanical or other form.
The units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
In addition, functional units in the embodiments of the present invention may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit. The integrated unit can be realized in a form of hardware, or in a form of hardware plus a software functional unit.
The integrated unit implemented in the form of a software functional unit may be stored in a computer readable storage medium. The software functional unit is stored in a storage medium and includes several instructions to enable a computer device (which may be a personal computer, a server, or a network device) or a processor (processor) to execute some steps of the methods according to the embodiments of the present invention. And the aforementioned storage medium includes: a U disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk or an optical disk, and other various media capable of storing program codes.
In the foregoing embodiments of the network device or the terminal device, it should be understood that the Processor may be a Central Processing Unit (CPU), or may be other general-purpose processors, Digital Signal Processors (DSP), Application Specific Integrated Circuits (ASIC), etc. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like. The steps of a method disclosed in connection with the present application may be embodied directly in a hardware processor, or in a combination of the hardware and software modules in the processor.
Finally, it should be noted that: the above embodiments are only used to illustrate the technical solution of the present invention, and not to limit the same; while the invention has been described in detail and with reference to the foregoing embodiments, it will be understood by those skilled in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some or all of the technical features may be equivalently replaced; and the modifications or the substitutions do not make the essence of the corresponding technical solutions depart from the scope of the technical solutions of the embodiments of the present invention.

Claims (10)

1. A method of querying, comprising:
acquiring a query statement;
acquiring semantic similarity between the query statement and each object in the terminal according to the query statement and a preset semantic similarity corresponding model of the query statement and the object of the terminal; displaying the objects with the semantic similarity larger than a similarity threshold;
the corresponding models comprise a first corresponding model and a second corresponding model, the first corresponding model is used for representing the corresponding relation between the query statement and the mark of the object, and the second corresponding model is used for representing the corresponding relation between the query statement and the attribute of the object;
the first corresponding model is obtained by training based on a preset query statement, a first semantic similarity of the preset query statement and the identification of the positive example object, and a second semantic similarity of the preset query statement and the identification of the negative example object as training samples; the second corresponding model is obtained by training based on a fifth semantic similarity of the preset query statement, the preset query statement and the static attribute of the object in the terminal and a sixth semantic similarity of the preset query statement and the dynamic attribute in the terminal as training samples; the static attribute is an attribute of each object, and the dynamic attribute is operation data of a user corresponding to each object.
2. The method of claim 1,
the first corresponding model is obtained by:
acquiring a historical query statement, and taking the historical query statement as the preset query statement;
acquiring a positive example object and a negative example object of the preset query statement;
and training to obtain a first corresponding model by taking the first semantic similarity of the preset query statement, the preset query statement and the identification of the positive example object and the second semantic similarity of the preset query statement and the identification of the negative example object as training samples.
3. The method of claim 2, wherein if there are a plurality of preset query statements, the obtaining positive example objects and negative example objects of the preset query statements comprises:
displaying the candidate object of each preset query statement;
and according to an operation instruction of a user, taking an object selected by the user in the candidate objects as a positive example object, and taking an object not selected by the user in the candidate objects as a negative example object, wherein the operation instruction comprises an identifier of the object selected by the user, and the user is the user using the terminal.
4. The method of claim 3, wherein after displaying the objects with semantic similarity greater than the similarity threshold, further comprising:
receiving an identification of the user-selected target object;
taking an object corresponding to the identification of the target object as a positive example object, and taking any one of objects not selected by a user as a negative example object;
and inputting the third semantic similarity of the identifications of the query statement, the query statement and the positive example object and the fourth semantic similarity of the identifications of the query statement and the negative example object into the first corresponding model as training samples to optimize the first corresponding model.
5. The method of claim 2,
the second corresponding model is obtained by:
acquiring the static attribute and the dynamic attribute of each object;
and training to obtain a second corresponding model by taking the preset query statement, the fifth semantic similarity of the preset query statement and the static attribute, and the sixth semantic similarity of the preset query statement and the dynamic attribute as training samples.
6. The method of claim 5, wherein the obtaining semantic similarity between the query statement and each object in the terminal comprises:
acquiring a first sub-semantic similarity of the query statement and the identifier of each object according to the query statement and the first corresponding model;
acquiring a second sub-semantic similarity of the query statement and the identifier of each object according to the query statement and the second corresponding model;
and obtaining the semantic similarity between the query statement and each object of the terminal according to the first sub-semantic similarity and the second sub-semantic similarity.
7. The method of claim 6, wherein the first sub-semantic similarity and the second sub-semantic similarity have different weights, respectively.
8. A terminal, comprising:
a query statement acquisition module for acquiring a query statement;
a semantic similarity obtaining module, configured to obtain semantic similarities between the query statement and each object in the terminal according to the query statement and a semantic similarity correspondence model between a preset query statement and an object in the terminal; the display module is used for displaying the objects with the semantic similarity larger than the similarity threshold;
the corresponding models comprise a first corresponding model and a second corresponding model, the first corresponding model is used for representing the corresponding relation between the query statement and the mark of the object, and the second corresponding model is used for representing the corresponding relation between the query statement and the attribute of the object;
the first corresponding model is obtained by training based on a preset query statement, a first semantic similarity of the preset query statement and the identification of the positive example object, and a second semantic similarity of the preset query statement and the identification of the negative example object as training samples; the second corresponding model is based on a fifth semantic similarity of the preset query statement, the preset query statement and the static attributes of the objects in the terminal, and a sixth semantic similarity of the preset query statement and the dynamic attributes in the terminal as training samples; the static attribute is an attribute of each object, and the dynamic attribute is operation data of a user corresponding to each object.
9. A terminal, comprising: at least one processor and memory;
the memory stores computer-executable instructions;
the at least one processor executing the computer-executable instructions stored by the memory causes the terminal to perform the method of any of claims 1-7.
10. A computer-readable storage medium having computer-executable instructions stored thereon which, when executed by a processor, implement the method of any one of claims 1-7.
CN201811618142.9A 2018-12-28 2018-12-28 Query method, terminal and storage medium Active CN109815195B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201811618142.9A CN109815195B (en) 2018-12-28 2018-12-28 Query method, terminal and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201811618142.9A CN109815195B (en) 2018-12-28 2018-12-28 Query method, terminal and storage medium

Publications (2)

Publication Number Publication Date
CN109815195A CN109815195A (en) 2019-05-28
CN109815195B true CN109815195B (en) 2021-04-20

Family

ID=66602680

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201811618142.9A Active CN109815195B (en) 2018-12-28 2018-12-28 Query method, terminal and storage medium

Country Status (1)

Country Link
CN (1) CN109815195B (en)

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1667615A (en) * 2004-03-09 2005-09-14 微软公司 User intent discovery
CN103324728A (en) * 2013-06-26 2013-09-25 百度在线网络技术(北京)有限公司 Mobile terminal application program searching method and apparatus
CN104765873A (en) * 2015-04-24 2015-07-08 百度在线网络技术(北京)有限公司 Method and device for determining similarity among users
CN106294635A (en) * 2016-08-02 2017-01-04 北京百度网讯科技有限公司 Application program searching method, the training method of deep neural network model and device
CN107256267A (en) * 2017-06-19 2017-10-17 北京百度网讯科技有限公司 Querying method and device
CN107491534A (en) * 2017-08-22 2017-12-19 北京百度网讯科技有限公司 Information processing method and device
CN107766488A (en) * 2017-10-17 2018-03-06 广东欧珀移动通信有限公司 A kind of information query method, terminal, computer-readable recording medium

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1667615A (en) * 2004-03-09 2005-09-14 微软公司 User intent discovery
CN103324728A (en) * 2013-06-26 2013-09-25 百度在线网络技术(北京)有限公司 Mobile terminal application program searching method and apparatus
CN104765873A (en) * 2015-04-24 2015-07-08 百度在线网络技术(北京)有限公司 Method and device for determining similarity among users
CN106294635A (en) * 2016-08-02 2017-01-04 北京百度网讯科技有限公司 Application program searching method, the training method of deep neural network model and device
CN107256267A (en) * 2017-06-19 2017-10-17 北京百度网讯科技有限公司 Querying method and device
CN107491534A (en) * 2017-08-22 2017-12-19 北京百度网讯科技有限公司 Information processing method and device
CN107766488A (en) * 2017-10-17 2018-03-06 广东欧珀移动通信有限公司 A kind of information query method, terminal, computer-readable recording medium

Also Published As

Publication number Publication date
CN109815195A (en) 2019-05-28

Similar Documents

Publication Publication Date Title
CN108460014B (en) Enterprise entity identification method and device, computer equipment and storage medium
CN109947909B (en) Intelligent customer service response method, equipment, storage medium and device
WO2019153607A1 (en) Intelligent response method, electronic device and storage medium
EP2570974B1 (en) Automatic crowd sourcing for machine learning in information extraction
JP6404106B2 (en) Computing device and method for connecting people based on content and relationship distance
CN117056471A (en) Knowledge base construction method and question-answer dialogue method and system based on generation type large language model
CN110866091B (en) Data retrieval method and device
CN101373468A (en) Method for loading word stock, method for inputting character and input method system
US10936667B2 (en) Indication of search result
CN114840671A (en) Dialogue generation method, model training method, device, equipment and medium
CN106156111B (en) Patent document retrieval method, device and system
US20140351264A1 (en) Methods and systems for ranking images using semantic and aesthetic models
CN107798622B (en) Method and device for identifying user intention
WO2019102346A1 (en) Searching multilingual documents based on document structure extraction
CN112818111B (en) Document recommendation method, device, electronic equipment and medium
CN111737443B (en) Answer text processing method and device and key text determining method
CN110263127A (en) Text search method and device is carried out based on user query word
CN110442735B (en) Idiom synonym recommendation method and device
CN110245357B (en) Main entity identification method and device
CN110008807B (en) Training method, device and equipment for contract content recognition model
JP5020352B2 (en) Named element marking device, named element marking method and computer-readable medium thereof
CN113609847A (en) Information extraction method and device, electronic equipment and storage medium
JP2019133546A (en) Presentation device, presentation method and presentation program
CN109815195B (en) Query method, terminal and storage medium
CN117149804A (en) Data processing method, device, electronic equipment and storage medium

Legal Events

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