Auto-suggestion with rich objects
According to implementations of the subject matter described herein, a solution is proposed for auto-suggesting. In this solution, a trigger indication for suggesting is provided based on an input sentence. In response to the trigger indication being confirmed, a suggestion for the sentence is provided and the suggestion comprises one or more rich objects. In response to a selection of the suggestion, supplementary information for supplementing the sentence is provided based on at least one selected rich object. In this way, various auto-suggestions comprising rich objects may be provided, and thus rich supplementary information may be provided to supplement the input sentence to enhance the user experience.
1 . A computer-implemented method, comprising:
performing, by a computing device, real-time monitoring of an input sentence being entered via a user interface;
using a trained machine learning predictor to predict a probability that a next word to be input for the sentence is an entity, the predictor trained with a training dataset comprising training sentences labeled to indicate whether a subsequent word is an entity;
determining whether the predicted probability exceeds a threshold;
based on the predicted probability exceeding the threshold:
determining that providing, via the user interface, a trigger indication for a suggestion is feasible based on the input sentence, the suggestion having a type; and
displaying the trigger indication as a mark at a location in the user interface associated with the input sentence, the mark having a type, wherein the trigger mark type is based on the suggestion type;
in response to the trigger indication being feasible, querying, based on the sentence, a database generated with a search engine tool and having an index for querying, the database comprising a knowledge graph storing a plurality of entities as nodes and associated relations between the entities as edges, each of the plurality of entities being uniquely identified;
identifying, based on a result of the querying using an entity linking algorithm that performs entity disambiguation, at least one of the plurality of entities in the database that matches an entity mentioned in the sentence;
determining, using embeddings of the identified at least one entity in the knowledge graph, a sentence suggestion for the sentence, the sentence suggestion comprising one or more rich objects having information of the at least one identified entity;
displaying the sentence suggestion via the user interface; and
in response to a selection of the sentence suggestion, providing supplementary information for supplementing the sentence based on at least one selected rich object.
2 . The method of claim 1 , wherein supplementing the sentence comprises at least one of:
continuing the sentence,
providing reference information associated with the sentence, or
calling a service associated with the sentence.
3 . The method of claim 1 , wherein the one or more rich objects comprise at least one of text information, image information, audio information or hyperlinks.
4 . The method of claim 1 , further comprising:
providing a new trigger indication based on the supplemented sentence; and
in response to the new trigger indication being confirmed, providing a new suggestion for the supplemented sentence.
5 . The method of claim 1 , wherein providing the sentence suggestion comprises determining the suggestion based on at least one of:
literal information of the sentence,
semantic information of the sentence, or
user preference.
6 . The method of claim 1 , wherein providing the sentence suggestion comprises:
querying, based on the sentence, a database with an index for querying;
identifying, based on a result of the querying, at least one of a plurality of entities in the database, each of the plurality of entities being uniquely identified; and
determining the sentence suggestion based on the at least one identified entity.
7 . The method of claim 1 , wherein providing the sentence suggestion comprises:
recognizing an entity mention in the sentence;
identifying, from a plurality of entities in a database, at least one entity that matches the entity mention, each of the plurality of entities being uniquely identified; and
determining the sentence suggestion based on the at least one identified entity.
8 . The method of claim 1 , wherein providing the sentence suggestion comprises:
determining a query statement corresponding to the sentence by at least identifying an entity in the sentence;
querying, based on the query statement, a database comprising a plurality of entities, each of the plurality of entities being uniquely identified; and
determining the sentence suggestion based on at least one entity queried from the database.
9 . The method of claim 1 , wherein providing the trigger indication for suggesting comprises at least one of:
predicting a probability that the next word to be input for the sentence is an entity, or
determining similarities between at least one word in the sentence and entities in a database.
10 . An electronic device, comprising:
a processing unit; and
a memory coupled to the processing unit and comprising instructions stored thereon which, when executed by the processing unit, cause the device to perform acts comprising:
performing real-time monitoring of an input sentence being entered via a user interface;
using a trained machine learning predictor to predict a probability that a next word to be input for the sentence is an entity, the predictor trained with a training dataset comprising training sentences labeled to indicate whether a subsequent word is an entity;
determining whether the predicted probability exceeds a threshold;
based on the predicted probability exceeding the threshold:
determining that providing, via the user interface and based on an input sentence, a trigger indication for a suggestion is feasible based on the input sentence, the suggestion having a type; and
displaying the trigger indication as a mark at a location in the user interface associated with the input sentence, the mark having a type, wherein the trigger mark type is based on the suggestion type;
in response to the trigger indication being feasible, querying, based on the sentence, a database generated with a search engine tool and having an index for querying, the database comprising a knowledge graph storing a plurality of entities as nodes and associated relations between the entities as edges, each of the plurality of entities being uniquely identified;
identifying, based on a result of the querying using an entity linking algorithm that performs entity disambiguation, at least one of the plurality of entities in the database that matches an entity mentioned in the sentence;
determining, using embeddings of the identified at least one entity in the knowledge graph, a sentence suggestion for the sentence, the sentence suggestion comprising one or more rich objects having information of the at least one identified entity;
displaying the sentence suggestion via the user interface; and
in response to a selection of the sentence suggestion, providing supplementary information for supplementing the sentence based on at least one selected rich object.
11 . The device of claim 10 , wherein supplementing the sentence comprises at least one of:
continuing the sentence;
providing reference information associated with the sentence; or
calling a service associated with the sentence.
12 . The device of claim 10 , wherein providing the sentence comprises:
querying, based on the sentence, a database with an index for querying;
identifying, based on a result of the querying, at least one of a plurality of entities in the database, each of the plurality of entities being uniquely identified; and
determining the sentence suggestion based on the at least one identified entity.
13 . The device of claim 10 , wherein providing the sentence suggestion comprises:
recognizing an entity mention in the sentence;
identifying, from a plurality of entities in a database, at least one entity that matches the entity mention, each of the plurality of entities being uniquely identified; and
determining the sentence suggestion based on the at least one identified entity.
14 . The device of claim 10 , wherein providing the sentence suggestion comprises:
determining a query statement corresponding to the sentence by at least identifying an entity in the sentence;
querying, based on the query statement, a database comprising a plurality of entities, each of the plurality of entities being uniquely identified; and
determining the sentence suggestion based on at least one entity queried from the database.
15 . A computer program product, comprising machine-executable instructions stored in a non-transitory computer storage medium which, when executed by a device having a processor, cause the processor to perform operations comprising:
performing real-time monitoring of an input sentence being entered via a user interface;
using a trained machine learning predictor to predict a probability that a next word to be input for the sentence is an entity, the predictor trained with a training dataset comprising training sentences labeled to indicated whether a subsequent word is an entity;
determining whether the predicted probability exceeds a threshold;
based on the predicted probability exceeding the threshold:
determining that providing, via the user interface and based on an input sentence, a trigger indication for a suggestion is feasible based on the input sentence, the suggestion having a type; and
displaying the trigger indication as a mark at a location in the user interface associated with the input sentence, the mark having a type, wherein the trigger mark type is based on the suggestion type;
in response to the trigger indication being feasible, querying, based on the sentence, a database generated with a search engine tool and having an index for querying, the database comprising a knowledge graph storing a plurality of entities as nodes and associated relations between the entities as edges, each of the plurality of entities being uniquely identified;
identifying, based on a result of the querying using an entity linking algorithm that performs entity disambiguation, at least one of the plurality of entities in the database that matches an entity mentioned in the sentence;
determining, using embeddings of the identified at least one entity in the knowledge graph, a sentence suggestion for the sentence, the sentence suggestion comprising one or more rich objects having information of the at least one identified entity;
displaying the sentence suggestion via the user interface; and
in response to a selection of the sentence suggestion, providing supplementary information for supplementing the sentence based on at least one selected rich object.