CN109508390B - Input prediction method and device based on knowledge graph and electronic equipment - Google Patents
Input prediction method and device based on knowledge graph and electronic equipment Download PDFInfo
- Publication number
- CN109508390B CN109508390B CN201811621349.1A CN201811621349A CN109508390B CN 109508390 B CN109508390 B CN 109508390B CN 201811621349 A CN201811621349 A CN 201811621349A CN 109508390 B CN109508390 B CN 109508390B
- Authority
- CN
- China
- Prior art keywords
- keyword
- preset
- knowledge
- relation chain
- acquiring
- 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
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F3/00—Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
- G06F3/01—Input arrangements or combined input and output arrangements for interaction between user and computer
- G06F3/02—Input arrangements using manually operated switches, e.g. using keyboards or dials
- G06F3/023—Arrangements for converting discrete items of information into a coded form, e.g. arrangements for interpreting keyboard generated codes as alphanumeric codes, operand codes or instruction codes
- G06F3/0233—Character input methods
- G06F3/0236—Character input methods using selection techniques to select from displayed items
Landscapes
- Engineering & Computer Science (AREA)
- General Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Human Computer Interaction (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Document Processing Apparatus (AREA)
- Machine Translation (AREA)
Abstract
The application provides an input prediction method and device based on a knowledge graph and electronic equipment, wherein the method comprises the following steps: acquiring a text in an input box before an input cursor and acquiring a current pinyin character string; performing word segmentation on the text to obtain a plurality of word segments in the text; detecting whether the multiple participles comprise a first keyword and a relation chain connected with the first keyword, and if the participles comprise the first keyword and the relation chain, querying a preset knowledge map database to obtain a second keyword corresponding to the first keyword and the relation chain; and if the editing distance between the current pinyin character string and the pinyin string corresponding to the second keyword is smaller than or equal to a preset distance threshold, displaying the second keyword at a first preset position of the prediction bar. Therefore, input prediction is quickly given through the knowledge map database, the accuracy and the certainty of error correction are improved, and the communication efficiency of users is improved.
Description
Technical Field
The present application relates to the field of intelligent input technologies, and in particular, to an input prediction method and apparatus based on a knowledge graph, and an electronic device.
Background
Currently, the main function of the input method is to provide a keyboard for the user to complete the input by typing. However, the input requirement is a communication requirement, and if the input method can predict what the user wants to input in the current scene and how to complete input and send quickly, the most fundamental input requirement of the user is solved.
In the related technology, the error correction of the input method is counted and realized based on the information of adjacent key positions or the information of frequent input errors of the user, for example, in the process that the user inputs 'women' on 26 keys, e is frequently input as an adjacent letter r by mistake, so that an original input string is changed into 'womrn', and the input method corrects the error string and gives 'us' as a candidate word according to the information of the adjacent key positions.
However, in the above-mentioned techniques, the correct pinyin string is not corrected as much as possible, and since many unreasonable candidate words appear, the pinyin of "yong" is not corrected, and only for ee, which is an illegal word, a legal entry is searched from the lexicon and displayed.
Disclosure of Invention
The present application is directed to solving, at least to some extent, one of the technical problems in the related art.
Therefore, the input prediction method based on the knowledge graph is provided, the input prediction is rapidly given through the knowledge graph database, the accuracy and the certainty of error correction are improved, and the communication efficiency of users is improved.
The application provides an input prediction device based on a knowledge graph.
The application provides an electronic device.
The present application provides a computer-readable storage medium.
The embodiment of the first aspect of the application provides an input prediction method based on a knowledge graph, which comprises the following steps:
acquiring a text in an input box before an input cursor and acquiring a current pinyin character string;
performing word segmentation on the text to obtain a plurality of word segments in the text;
detecting whether the multiple participles comprise a first keyword and a relation chain connected with the first keyword, and if the participles comprise the first keyword and the relation chain, querying a preset knowledge map database to obtain a second keyword corresponding to the first keyword and the relation chain;
and if the edit distance between the current pinyin character string and the pinyin string corresponding to the second keyword is smaller than or equal to a preset distance threshold, displaying the second keyword at a first preset position of a prediction bar.
Optionally, as a first possible implementation manner of the first aspect of the present application, before querying a preset knowledge graph database to obtain a second keyword corresponding to the first keyword and the relationship chain, the method further includes:
acquiring a plurality of knowledge entries;
identifying the plurality of knowledge entries to obtain keywords and a relationship chain in each knowledge entry;
and storing the plurality of keywords and the plurality of relationship chains according to a preset mode to generate a preset knowledge map database.
Optionally, as a second possible implementation manner of the first aspect of the present application, the detecting whether the multiple participles include the first keyword and the relationship chain includes:
recognizing the multiple word segments through a preset entity recognition algorithm to obtain multiple corresponding entities;
and if the entities are matched with a first keyword and a relation chain connected with the first keyword in a preset relation chain word bank, determining that the participles comprise the first keyword and the relation chain connected with the first keyword.
Optionally, as a third possible implementation manner of the first aspect of the present application, the relationship chain includes: a first relationship chain and a second relationship chain;
the querying a preset knowledge map database to obtain a second keyword corresponding to the first keyword and the relation chain comprises the following steps:
acquiring a corresponding third key word in a preset knowledge graph database according to the first key word and the first relation chain;
and acquiring a corresponding second keyword in a preset knowledge graph database according to the third keyword and the second relation chain.
Optionally, as a fourth possible implementation manner of the first aspect of the present application, after querying a preset knowledge graph database to obtain a second keyword corresponding to the first keyword and the relationship chain, the method further includes:
matching a fourth keyword in a preset hot word library according to the first keyword and the second keyword;
and displaying the fourth keyword at a second preset position of the prediction bar.
In a second aspect, an embodiment of the present application provides a knowledge-graph-based input prediction apparatus, including:
the acquisition module is used for acquiring a text in the input box before an input cursor and acquiring a current pinyin character string;
the word segmentation module is used for segmenting words of the text to obtain a plurality of word segments in the text;
the detection module is used for detecting whether the multiple participles comprise a first keyword and a relation chain or not;
the query module is used for querying a preset knowledge map database to obtain a second keyword corresponding to the first keyword and the relation chain if the first keyword and the relation chain connected with the first keyword are known;
and the display module is used for displaying the second keyword at a first preset position of the prediction bar if the edit distance between the current pinyin character string and the pinyin string corresponding to the second keyword is less than or equal to a preset distance threshold.
Optionally, as a first possible implementation manner of the second aspect of the present application, the apparatus further includes:
the first acquisition module is used for acquiring a plurality of knowledge entries;
the second acquisition module is used for identifying the plurality of knowledge entries and acquiring keywords and relationship chains in each knowledge entry;
and the generating module is used for storing the plurality of keywords and the plurality of relationship chains according to a preset mode to generate a preset knowledge map database.
Optionally, as a second possible implementation manner of the second aspect of the present application, the detection module is specifically configured to:
recognizing the multiple word segments through a preset entity recognition algorithm to obtain multiple corresponding entities;
and if the entities are matched with a first keyword and a relation chain connected with the first keyword in a preset relation chain word bank, determining that the participles comprise the first keyword and the relation chain connected with the first keyword.
Optionally, as a third possible implementation manner of the second aspect of the present application, the relationship chain includes: a first relationship chain and a second relationship chain;
the query module is specifically configured to:
acquiring a corresponding third key word in a preset knowledge graph database according to the first key word and the first relation chain;
and acquiring a corresponding second keyword in a preset knowledge graph database according to the third keyword and the second relation chain.
Optionally, as a fourth possible implementation manner of the second aspect of the present application, the apparatus further includes:
the matching module is used for matching a fourth keyword in a preset hot-spot word library according to the first keyword and the second keyword;
the display module is further used for displaying the fourth keyword at a second preset position of the prediction bar.
An embodiment of a third aspect of the present application provides an electronic device, including: a memory, a processor and a computer program stored on the memory and executable on the processor, the processor implementing the method of knowledge-graph based input prediction of the first aspect when executing the program.
An embodiment of a fourth aspect of the present application provides a computer-readable storage medium, on which a computer program is stored, which, when executed by a processor, implements the method for knowledge-graph-based input prediction according to the first aspect.
The technical scheme provided by the embodiment of the application can have the following beneficial effects:
the method comprises the steps of obtaining a text in front of an input cursor in an input box, obtaining a current pinyin character string, cutting words of the text, obtaining a plurality of participles in the text, detecting whether the participles comprise a first keyword and a relation chain, inquiring a preset knowledge graph database to obtain a second keyword corresponding to the first keyword and the relation chain if the participles comprise the first keyword and the relation chain connected with the first keyword, and displaying the second keyword at a first preset position of a prediction column if an edit distance between the current pinyin character string and the pinyin string corresponding to the second keyword is smaller than or equal to a preset distance threshold. Therefore, input prediction is quickly given through the knowledge map database, the accuracy and the certainty of error correction are improved, and the communication efficiency of users is improved.
Drawings
The foregoing and/or additional aspects and advantages of the present application will become apparent and readily appreciated from the following description of the embodiments, taken in conjunction with the accompanying drawings of which:
FIG. 1 is a schematic flow chart of a method for input prediction based on knowledge-graph according to an embodiment of the present application;
fig. 2 is a schematic flow chart illustrating a preset poetry corpus generation process according to an embodiment of the present disclosure;
FIG. 3 is a schematic illustration of a knowledge-graph based input prediction provided by an embodiment of the present application;
FIG. 4 is a schematic structural diagram of an input prediction apparatus based on a knowledge-graph according to an embodiment of the present application;
FIG. 5 is a schematic diagram of another knowledge-graph based input prediction apparatus provided in an embodiment of the present application;
FIG. 6 is a schematic structural diagram of another input prediction apparatus based on a knowledge-graph according to an embodiment of the present application; and
fig. 7 is a schematic structural diagram of an embodiment of an electronic device according to the present application.
Detailed Description
Reference will now be made in detail to embodiments of the present application, examples of which are illustrated in the accompanying drawings, wherein like or similar reference numerals refer to the same or similar elements or elements having the same or similar function throughout. The embodiments described below with reference to the drawings are exemplary and intended to be used for explaining the present application and should not be construed as limiting the present application.
The knowledge-graph-based input prediction method, apparatus, and electronic device according to embodiments of the present application are described below with reference to the accompanying drawings.
Fig. 1 is a schematic flowchart of an input prediction method based on a knowledge graph according to an embodiment of the present disclosure.
As shown in fig. 1, the method comprises the steps of:
And 102, segmenting words of the text to obtain a plurality of segmented words in the text.
In practical applications, the user may input text at a location such as a dialog input box of the instant messaging application or a search input box of the search application, as desired.
Optionally, the text before the user inputs the cursor in the input box is obtained, it is understood that the text may be a word, or a sentence, or a paragraph, etc., and the pinyin character string input by the user is obtained, it is understood that the pinyin character string may be a pinyin character string of a word, or a pinyin character string of a sentence, or a pinyin character string of a paragraph, etc.
Therefore, word segmentation is performed on the text through a word segmentation model or a word segmentation algorithm to obtain a plurality of word segments corresponding to the text, for example, the text is 'Xiaoming Ladies', and the word segmentation is performed on the text to obtain 'Xiaoming', 'Ladies' and 'Ladies'.
And 104, if the edit distance between the current pinyin character string and the pinyin string corresponding to the second keyword is smaller than or equal to a preset distance threshold, displaying the second keyword at a first preset position of the prediction bar.
Optionally, after obtaining the multiple segmented words, it may be detected whether the multiple segmented words include the first keyword and a relationship chain connected to the first keyword, for example, as follows:
in a first example, the predetermined knowledge graph database is queried to determine whether a first keyword is included in the database, and a relationship chain is connected to the first keyword.
In a second example, a plurality of participles are identified through a preset entity identification algorithm, a plurality of corresponding entities are obtained, and if the plurality of entities match a first keyword in a preset relation chain word bank and a relation chain connected with the first keyword, the plurality of participles are determined to include the first keyword and the relation chain connected with the first keyword.
That is, the query can be directly performed through a preset knowledge map database, and the query can also be performed through setting a relation database.
In the embodiment of the application, the knowledge graph is based on knowledge, all knowledge of the internet is accumulated, the real world is really understood, information collection is improved to be accumulated as knowledge, and the world is understood by the knowledge.
Optionally, before querying a preset knowledge graph database to obtain a second keyword corresponding to the first keyword and the relationship chain, a preset knowledge graph database needs to be generated, as shown in fig. 2 specifically:
And 203, storing the plurality of keywords and the plurality of relationship chains according to a preset mode to generate a preset knowledge map database.
Specifically, all knowledge entries of the internet are collected, keywords and relationship chains in each knowledge entry are identified, the keywords and the relationship chains are stored according to a preset mode to generate a preset knowledge map database, for example, the keyword "xiaming" and the "xiahong" are identified to obtain the keywords "xiaming" and the "xiahong" and the relationship chain "wife", and therefore the "xiaming", "wife" and the "xiahong" are stored in a mapping table mode to generate the preset knowledge map database.
Therefore, after the preset knowledge map database is queried to obtain the second keyword corresponding to the first keyword and the relationship chain, the edit distance between the current pinyin character string and the pinyin string corresponding to the second keyword needs to be calculated, and the second keyword is displayed at the first preset position of the prediction bar when the edit distance is smaller than or equal to the preset distance threshold. The first preset position can be selected and set according to actual application requirements, and in order to further improve the input efficiency, the second keyword can be displayed at the preferred position of the local prediction bar, so that the use requirements of users are met.
The preset distance threshold value can be set according to the actual application requirements, generally, the smaller the preset distance threshold value is, the more accurate the second keyword is, for example, the editing distance between the current pinyin character string and the pinyin string corresponding to the second keyword is less than or equal to 2, and the second keyword is displayed at the first preset position of the prediction bar as a candidate result.
For example, as shown in fig. 3, a text before the input cursor in the input box is "xiamingming" and a current pinyin character string "xiaoahang" is obtained, a plurality of participles in the text are "xiaming", "and" wife ", it is detected that the" xiaming "," the "and" wife "include a first keyword" xiaming "and a relation chain" wife ", a preset knowledge map database is queried to obtain a second keyword" xiahong "corresponding to the" xiaming "and the" wife ", the pinyin character string corresponding to the" xiaohang "and the" xiahong "is compared, and the edit distance is found to be equal to 1, so that the error correction result of the" xiahong "is returned and displayed even if the current pinyin character string" xiaohang "is the correct pinyin string.
In the input prediction method based on the knowledge graph, a text in front of an input cursor in an input box is obtained, a current pinyin character string is obtained, the text is cut into words, a plurality of participles in the text are obtained, whether the plurality of participles include a first keyword and a relation chain is detected, if the plurality of participles include the first keyword and the relation chain connected with the first keyword, a preset knowledge graph database is queried to obtain a second keyword corresponding to the first keyword and the relation chain, and if an edit distance between the current pinyin character string and the pinyin string corresponding to the second keyword is smaller than or equal to a preset distance threshold, the second keyword is displayed at a first preset position of a prediction column. Therefore, input prediction is quickly given through the knowledge map database, the accuracy and the certainty of error correction are improved, and the communication efficiency of users is improved.
Based on the foregoing embodiments, it can also be understood that, in a case where there are a plurality of relation chains in the plurality of word segments, as one possible implementation manner, the relation chains include: and the first relation chain and the second relation chain acquire corresponding third key words in a preset knowledge graph database according to the first key words and the first relation chain, and acquire corresponding second key words in the preset knowledge graph database according to the third key words and the second relation chain.
For example, a text before a cursor is input in an input box is acquired as a "Duoming Ladies" mother, a plurality of participles in the text are acquired as "Xiaoming", "Durio", Lavero "and" mom ", a first keyword" Xiaoming "and a relation chain" Lavero "and" mom "are detected to be included in the" Xiaoming "," Durio ", the" Lavero "and" mom ", a preset knowledge map database is inquired to acquire a third keyword" Xiaohong "corresponding to the" Duoming "and the" Lavero ", then a second keyword" Xiao Li "corresponding to the" Xiaohong "and the" mom "is acquired, and the" XiaoLi "is displayed at a preferred position of a prediction column. Semantic analysis and understanding are further performed, reasonable input recommendation is given quickly, the flexibility of input recommendation is improved, and the communication efficiency of users is greatly improved.
Based on the above embodiment, it can be further understood that after the preset knowledge graph database is queried to obtain the second keyword corresponding to the first keyword and the relationship chain, the fourth keyword may be matched in the preset hotspot dictionary database according to the first keyword and the second keyword, and the fourth keyword is displayed at the second preset position of the prediction bar. The hot word bank is a word which is obtained in advance and has the click rate or the search rate larger than a preset threshold value in the network, and hot words are sorted according to the click rate or the search rate. And determining the first hot words in the hot words matched according to the first key words and the second key words as fourth key words, or determining N hot words in the top sequence as the fourth key words.
For example, the text before the input cursor in the input box is "xiaoming wife", a plurality of participles in the text are "xiaoming", "dong" and "wife", it is detected that the "xiaoming", "dong" and "wife" include a first keyword "xiaoming" and a relation chain "wife", a preset knowledge graph database is queried to obtain a second keyword "xiaohong" corresponding to the "xiaoming" and the "wife", the "xiaoming" and the "xiaohong" are matched to a fourth keyword "xiaohua" in a preset hot word library, and the "xianhua" is displayed in a second preset position of the prediction bar, for example, in a second selected position of the prediction bar, so as to further meet the input requirements of the user.
In order to implement the above embodiments, the present application also provides an input prediction apparatus based on a knowledge graph.
Fig. 4 is a schematic structural diagram of an input prediction apparatus based on a knowledge graph according to an embodiment of the present application.
As shown in fig. 4, the apparatus includes: the system comprises an acquisition module 41, a word segmentation module 42, a detection module 43, a query module 44 and a presentation module 45.
The obtaining module 41 is configured to obtain a text in the input box before the input cursor and obtain a current pinyin character string.
And the word segmentation module 42 is configured to segment words of the text to obtain multiple word segments in the text.
The detecting module 43 is configured to detect whether the plurality of segmented words include a first keyword and a relationship chain connected to the first keyword.
And the query module 44 is configured to query a preset knowledge map database to obtain a second keyword corresponding to the first keyword and the relationship chain if the first keyword and the relationship chain are known.
And the display module 45 is configured to display the second keyword at the first preset position of the prediction bar if the edit distance between the current pinyin character string and the pinyin string corresponding to the second keyword is less than or equal to a preset distance threshold.
Based on the foregoing embodiments, the present application further provides a possible implementation manner of a knowledge-graph-based input prediction apparatus, fig. 5 is a schematic structural diagram of another knowledge-graph-based input prediction apparatus provided in the present application, and on the basis of fig. 4, the apparatus further includes: a first acquisition module 46, a second acquisition module 47, and a generation module 48.
The first obtaining module 46 is configured to obtain a plurality of knowledge entries.
And the second obtaining module 47 is configured to identify the multiple knowledge entries, and obtain the keywords and the relationship chain in each knowledge entry.
And a generating module 48, configured to store the multiple keywords and the multiple relationship chains according to a preset manner to generate a preset knowledge graph database.
Based on the foregoing embodiment, the present application further provides a possible implementation manner of the input prediction apparatus based on the knowledge graph, and the detection module 43 is specifically configured to: recognizing the multiple word segments through a preset entity recognition algorithm to obtain a plurality of corresponding entities; and if the plurality of entities are matched with the first keyword and the relation chain connected with the first keyword in a preset relation chain word bank, determining that the plurality of participles comprise the first keyword and the relation chain connected with the first keyword.
Based on the foregoing embodiments, the present application further provides a possible implementation manner of the input prediction apparatus based on the knowledge graph, where the relationship chain includes: a first relationship chain and a second relationship chain; the query module 44 is specifically configured to: acquiring a corresponding third key word in a preset knowledge graph database according to the first key word and the first relation chain; and acquiring a corresponding second keyword in a preset knowledge graph database according to the third keyword and the second relation chain.
The embodiment of the present application further provides a possible implementation manner of a knowledge-graph-based input prediction apparatus, fig. 6 is a schematic structural diagram of another knowledge-graph-based input prediction apparatus provided in the embodiment of the present application, and on the basis of fig. 4, the apparatus further includes: a matching module 49.
And the matching module 49 is configured to match a fourth keyword in a preset hot-spot thesaurus according to the first keyword and the second keyword.
The displaying module 45 is further configured to display the fourth keyword at a second preset position of the prediction bar.
It should be noted that the foregoing explanation of the method embodiment is also applicable to the apparatus of this embodiment, and is not repeated herein.
In the input prediction device based on the knowledge graph, a text in front of an input cursor in an input box is obtained, a current pinyin character string is obtained, the text is cut into words, a plurality of participles in the text are obtained, whether the participles comprise a first keyword or not and a relation chain connected with the first keyword are detected, if the participles comprise the first keyword and the relation chain, a preset knowledge graph database is inquired to obtain a second keyword corresponding to the first keyword and the relation chain, and if an edit distance between the current pinyin character string and the pinyin string corresponding to the second keyword is smaller than or equal to a preset distance threshold, the second keyword is displayed at a first preset position of a prediction column. Therefore, input prediction is quickly given through the knowledge map database, the accuracy and the certainty of error correction are improved, and the communication efficiency of users is improved.
In order to implement the above embodiments, the present application also provides an electronic device, including: a memory, a processor and a computer program stored on the memory and executable on the processor, the program when executed by the processor implementing the method for knowledge-graph based input prediction as described in the method embodiments above.
An embodiment of the present application further provides an electronic device, which includes the apparatus according to any of the foregoing embodiments.
Fig. 7 is a schematic structural diagram of an embodiment of an electronic device of the present application, which may implement a flow of the method embodiment shown in fig. 1-2 of the present application, and as shown in fig. 7, the electronic device may include: the electronic device comprises a shell 91, a processor 92, a memory 93, a circuit board 94 and a power supply circuit 95, wherein the circuit board 94 is arranged inside a space enclosed by the shell 91, and the processor 92 and the memory 93 are arranged on the circuit board 94; a power supply circuit 95 for supplying power to each circuit or device of the electronic apparatus; the memory 93 is used to store executable program code; the processor 92 executes a program corresponding to the executable program code by reading the executable program code stored in the memory 93, for executing the video generation method described in any one of the foregoing embodiments.
For a specific execution process of the above steps by the processor 92 and further steps executed by the processor 92 by running the executable program code, reference may be made to the description of the method embodiment shown in fig. 1-2 in this application, which is not described herein again.
The electronic device exists in a variety of forms, including but not limited to:
(1) a mobile communication device: such devices are characterized by mobile communications capabilities and are primarily targeted at providing voice, data communications. Such terminals include: smart phones (e.g., iphones), multimedia phones, functional phones, and low-end phones, among others.
(2) Ultra mobile personal computer device: the equipment belongs to the category of personal computers, has calculation and processing functions and generally has the characteristic of mobile internet access. Such terminals include: PDA, MID, and UMPC devices, etc., such as ipads.
(3) A portable entertainment device: such devices can display and play multimedia content. This type of device comprises: audio, video players (e.g., ipods), handheld game consoles, electronic books, and smart toys and portable car navigation devices.
(4) A server: the device for providing the computing service comprises a processor, a hard disk, a memory, a system bus and the like, and the server is similar to a general computer architecture, but has higher requirements on processing capacity, stability, reliability, safety, expandability, manageability and the like because of the need of providing high-reliability service.
(5) And other electronic equipment with data interaction function.
In order to implement the above embodiments, the present application further proposes a computer-readable storage medium having stored thereon a computer program which, when executed by a processor, implements the method for knowledge-graph based input prediction as described in the aforementioned method embodiments.
In the description herein, reference to the description of the term "one embodiment," "some embodiments," "an example," "a specific example," or "some examples," etc., means that a particular feature, structure, material, or characteristic described in connection with the embodiment or example is included in at least one embodiment or example of the application. In this specification, the schematic representations of the terms used above are not necessarily intended to refer to the same embodiment or example. Furthermore, the particular features, structures, materials, or characteristics described may be combined in any suitable manner in any one or more embodiments or examples. Furthermore, various embodiments or examples and features of different embodiments or examples described in this specification can be combined and combined by one skilled in the art without contradiction.
Furthermore, the terms "first", "second" and "first" are used for descriptive purposes only and are not to be construed as indicating or implying relative importance or implicitly indicating the number of technical features indicated. Thus, a feature defined as "first" or "second" may explicitly or implicitly include at least one such feature. In the description of the present application, "plurality" means at least two, e.g., two, three, etc., unless specifically limited otherwise.
Any process or method descriptions in flow charts or otherwise described herein may be understood as representing modules, segments, or portions of code which include one or more executable instructions for implementing steps of a custom logic function or process, and alternate implementations are included within the scope of the preferred embodiment of the present application in which functions may be executed out of order from that shown or discussed, including substantially concurrently or in reverse order, depending on the functionality involved, as would be understood by those reasonably skilled in the art of the present application.
The logic and/or steps represented in the flowcharts or otherwise described herein, e.g., an ordered listing of executable instructions that can be considered to implement logical functions, can be embodied in any computer-readable medium for use by or in connection with an instruction execution system, apparatus, or device, such as a computer-based system, processor-containing system, or other system that can fetch the instructions from the instruction execution system, apparatus, or device and execute the instructions. For the purposes of this description, a "computer-readable medium" can be any means that can contain, store, communicate, propagate, or transport the program for use by or in connection with the instruction execution system, apparatus, or device. More specific examples (a non-exhaustive list) of the computer-readable medium would include the following: an electrical connection (electronic device) having one or more wires, a portable computer diskette (magnetic device), a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber device, and a portable compact disc read-only memory (CDROM). Additionally, the computer-readable medium could even be paper or another suitable medium upon which the program is printed, as the program can be electronically captured, via for instance optical scanning of the paper or other medium, then compiled, interpreted or otherwise processed in a suitable manner if necessary, and then stored in a computer memory.
It should be understood that portions of the present application may be implemented in hardware, software, firmware, or a combination thereof. In the above embodiments, the various steps or methods may be implemented in software or firmware stored in memory and executed by a suitable instruction execution system. If implemented in hardware, as in another embodiment, any one or combination of the following techniques, which are known in the art, may be used: a discrete logic circuit having a logic gate circuit for implementing a logic function on a data signal, an application specific integrated circuit having an appropriate combinational logic gate circuit, a Programmable Gate Array (PGA), a Field Programmable Gate Array (FPGA), or the like.
It will be understood by those skilled in the art that all or part of the steps carried by the method for implementing the above embodiments may be implemented by hardware related to instructions of a program, which may be stored in a computer readable storage medium, and when the program is executed, the program includes one or a combination of the steps of the method embodiments.
In addition, functional units in the embodiments of the present application may be integrated into one processing module, or each unit may exist alone physically, or two or more units are integrated into one module. The integrated module can be realized in a hardware mode, and can also be realized in a software functional module mode. The integrated module, if implemented in the form of a software functional module and sold or used as a stand-alone product, may also be stored in a computer readable storage medium.
The storage medium mentioned above may be a read-only memory, a magnetic or optical disk, etc. Although embodiments of the present application have been shown and described above, it is understood that the above embodiments are exemplary and should not be construed as limiting the present application, and that variations, modifications, substitutions and alterations may be made to the above embodiments by those of ordinary skill in the art within the scope of the present application.
Claims (12)
1. A method for predicting input based on knowledge graph is characterized by comprising the following steps:
acquiring a text before a user inputs a cursor in an input box, and acquiring a pinyin character string currently input by the user;
performing word segmentation on the text to obtain a plurality of word segments in the text;
detecting whether the multiple participles comprise a first keyword and a relation chain connected with the first keyword, and if the participles comprise the first keyword and the relation chain, querying a preset knowledge map database to obtain a second keyword corresponding to the first keyword and the relation chain;
and if the edit distance between the current pinyin character string and the pinyin string corresponding to the second keyword is smaller than or equal to a preset distance threshold, displaying the second keyword at a first preset position of a prediction bar.
2. The method of claim 1, further comprising, prior to querying a pre-provisioned knowledge-graph database for second keywords corresponding to the first keyword and the relationship chain:
acquiring a plurality of knowledge entries;
identifying the plurality of knowledge entries to obtain keywords and a relationship chain in each knowledge entry;
and storing the plurality of keywords and the plurality of relationship chains according to a preset mode to form a preset knowledge map database.
3. The method of claim 1, wherein the detecting whether the plurality of participles includes a first keyword, and a relationship chain connected to the first keyword comprises:
recognizing the multiple word segments through a preset entity recognition algorithm to obtain multiple corresponding entities;
and if the entities are matched with a first keyword and a relation chain connected with the first keyword in a preset relation chain word bank, determining that the participles comprise the first keyword and the relation chain connected with the first keyword.
4. The method of claim 1, wherein the relationship chain comprises: a first relationship chain and a second relationship chain;
the querying a preset knowledge map database to obtain a second keyword corresponding to the first keyword and the relation chain comprises the following steps:
acquiring a corresponding third key word in a preset knowledge graph database according to the first key word and the first relation chain;
and acquiring a corresponding second keyword in a preset knowledge graph database according to the third keyword and the second relation chain.
5. The method of claim 1, wherein after querying the pre-provisioned knowledge-graph database for second keywords corresponding to the first keywords and the relationship chain, further comprising:
matching a fourth keyword in a preset hot word library according to the first keyword and the second keyword;
and displaying the fourth keyword at a second preset position of the prediction bar.
6. A knowledge-graph based input prediction apparatus, the apparatus comprising:
the acquisition module is used for acquiring a text before a user inputs a cursor in an input box and acquiring a pinyin character string currently input by the user;
the word segmentation module is used for segmenting words of the text to obtain a plurality of word segments in the text;
the detection module is used for detecting whether the multiple participles comprise a first keyword and a relation chain or not;
the query module is used for querying a preset knowledge map database to obtain a second keyword corresponding to the first keyword and the relation chain if the first keyword and the relation chain connected with the first keyword are known;
and the display module is used for displaying the second keyword at a first preset position of the prediction bar if the edit distance between the current pinyin character string and the pinyin string corresponding to the second keyword is less than or equal to a preset distance threshold.
7. The apparatus of claim 6, further comprising:
the first acquisition module is used for acquiring a plurality of knowledge entries;
the second acquisition module is used for identifying the plurality of knowledge entries and acquiring keywords and relationship chains in each knowledge entry;
and the generating module is used for storing the plurality of keywords and the plurality of relationship chains according to a preset mode to generate a preset knowledge map database.
8. The apparatus of claim 6, wherein the detection module is specifically configured to:
recognizing the multiple word segments through a preset entity recognition algorithm to obtain multiple corresponding entities;
and if the entities are matched with a first keyword and a relation chain connected with the first keyword in a preset relation chain word bank, determining that the participles comprise the first keyword and the relation chain connected with the first keyword.
9. The apparatus of claim 6, wherein the relationship chain comprises: a first relationship chain and a second relationship chain;
the query module is specifically configured to:
acquiring a corresponding third key word in a preset knowledge graph database according to the first key word and the first relation chain;
and acquiring a corresponding second keyword in a preset knowledge graph database according to the third keyword and the second relation chain.
10. The apparatus of claim 6, further comprising:
the matching module is used for matching a fourth keyword in a preset hot-spot word library according to the first keyword and the second keyword;
the display module is further used for displaying the fourth keyword at a second preset position of the prediction bar.
11. An electronic device, comprising: memory, processor and computer program stored on the memory and executable on the processor, the processor when executing the program implementing the method of knowledge-graph based input prediction according to any of claims 1-5.
12. A computer-readable storage medium, on which a computer program is stored which, when being executed by a processor, carries out a method for knowledge-graph based input prediction according to any one of claims 1-5.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201811621349.1A CN109508390B (en) | 2018-12-28 | 2018-12-28 | Input prediction method and device based on knowledge graph and electronic equipment |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201811621349.1A CN109508390B (en) | 2018-12-28 | 2018-12-28 | Input prediction method and device based on knowledge graph and electronic equipment |
Publications (2)
Publication Number | Publication Date |
---|---|
CN109508390A CN109508390A (en) | 2019-03-22 |
CN109508390B true CN109508390B (en) | 2021-12-14 |
Family
ID=65755616
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201811621349.1A Active CN109508390B (en) | 2018-12-28 | 2018-12-28 | Input prediction method and device based on knowledge graph and electronic equipment |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN109508390B (en) |
Families Citing this family (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN111291571A (en) * | 2020-01-17 | 2020-06-16 | 华为技术有限公司 | Semantic error correction method, electronic device and storage medium |
CN111291265B (en) * | 2020-02-10 | 2023-10-03 | 青岛聚看云科技有限公司 | Recommendation information generation method and device |
Citations (9)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN102915313A (en) * | 2011-08-05 | 2013-02-06 | 腾讯科技(深圳)有限公司 | Error correction relation generation method and system in web search |
CN103853722A (en) * | 2012-11-29 | 2014-06-11 | 腾讯科技(深圳)有限公司 | Query based keyword extension method, device and system |
CN103927299A (en) * | 2014-04-25 | 2014-07-16 | 百度在线网络技术(北京)有限公司 | Method for providing candidate sentences in input method and method and device for recommending input content |
CN104866593A (en) * | 2015-05-29 | 2015-08-26 | 中国电子科技集团公司第二十八研究所 | Database searching method based on knowledge graph |
CN106202382A (en) * | 2016-07-08 | 2016-12-07 | 南京缘长信息科技有限公司 | Link instance method and system |
CN106844658A (en) * | 2017-01-23 | 2017-06-13 | 中山大学 | A kind of Chinese text knowledge mapping method for auto constructing and system |
CN107315734A (en) * | 2017-05-04 | 2017-11-03 | 中国科学院信息工程研究所 | A kind of method and system for becoming pronouns, general term for nouns, numerals and measure words standardization based on time window and semanteme |
CN107369098A (en) * | 2016-05-11 | 2017-11-21 | 华为技术有限公司 | The treating method and apparatus of data in social networks |
CN107844526A (en) * | 2017-10-12 | 2018-03-27 | 广州艾媒数聚信息咨询股份有限公司 | A kind of lexical relation link analysis method, system and device in knowledge based storehouse |
Family Cites Families (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US7098896B2 (en) * | 2003-01-16 | 2006-08-29 | Forword Input Inc. | System and method for continuous stroke word-based text input |
US9024882B2 (en) * | 2011-07-18 | 2015-05-05 | Fleksy, Inc. | Data input system and method for a touch sensor input |
CN104142938A (en) * | 2013-05-07 | 2014-11-12 | 腾讯科技(深圳)有限公司 | Data processing method, device and system of micro-blog |
CN106527757A (en) * | 2016-10-28 | 2017-03-22 | 上海智臻智能网络科技股份有限公司 | Input error correction method and apparatus |
CN107169010A (en) * | 2017-03-31 | 2017-09-15 | 北京奇艺世纪科技有限公司 | A kind of determination method and device of recommendation search keyword |
-
2018
- 2018-12-28 CN CN201811621349.1A patent/CN109508390B/en active Active
Patent Citations (9)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN102915313A (en) * | 2011-08-05 | 2013-02-06 | 腾讯科技(深圳)有限公司 | Error correction relation generation method and system in web search |
CN103853722A (en) * | 2012-11-29 | 2014-06-11 | 腾讯科技(深圳)有限公司 | Query based keyword extension method, device and system |
CN103927299A (en) * | 2014-04-25 | 2014-07-16 | 百度在线网络技术(北京)有限公司 | Method for providing candidate sentences in input method and method and device for recommending input content |
CN104866593A (en) * | 2015-05-29 | 2015-08-26 | 中国电子科技集团公司第二十八研究所 | Database searching method based on knowledge graph |
CN107369098A (en) * | 2016-05-11 | 2017-11-21 | 华为技术有限公司 | The treating method and apparatus of data in social networks |
CN106202382A (en) * | 2016-07-08 | 2016-12-07 | 南京缘长信息科技有限公司 | Link instance method and system |
CN106844658A (en) * | 2017-01-23 | 2017-06-13 | 中山大学 | A kind of Chinese text knowledge mapping method for auto constructing and system |
CN107315734A (en) * | 2017-05-04 | 2017-11-03 | 中国科学院信息工程研究所 | A kind of method and system for becoming pronouns, general term for nouns, numerals and measure words standardization based on time window and semanteme |
CN107844526A (en) * | 2017-10-12 | 2018-03-27 | 广州艾媒数聚信息咨询股份有限公司 | A kind of lexical relation link analysis method, system and device in knowledge based storehouse |
Non-Patent Citations (1)
Title |
---|
基于Lucene算法的移动终端资源搜索引擎研究与设计;曾庆祥等;《北京工商大学学报(自然科学版)》;20080915;第36-40页,第49页 * |
Also Published As
Publication number | Publication date |
---|---|
CN109508390A (en) | 2019-03-22 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN109508391B (en) | Input prediction method and device based on knowledge graph and electronic equipment | |
CN109657213B (en) | Text similarity detection method and device and electronic equipment | |
EP3648099B1 (en) | Voice recognition method, device, apparatus, and storage medium | |
CN108491433B (en) | Chat response method, electronic device and storage medium | |
US20200210468A1 (en) | Document recommendation method and device based on semantic tag | |
CN108549656B (en) | Statement analysis method and device, computer equipment and readable medium | |
CN108959559B (en) | Question and answer pair generation method and device | |
CN109815487B (en) | Text quality inspection method, electronic device, computer equipment and storage medium | |
CN113139387B (en) | Semantic error correction method, electronic device and storage medium | |
CN107330023A (en) | Content of text based on focus recommends method and apparatus | |
CN109656385B (en) | Input prediction method and device based on knowledge graph and electronic equipment | |
CN111382260A (en) | Method, device and storage medium for correcting retrieved text | |
CN109325201A (en) | Generation method, device, equipment and the storage medium of entity relationship data | |
CN109033244B (en) | Search result ordering method and device | |
CN109885180B (en) | Error correction method and apparatus, computer readable medium | |
CN111259262A (en) | Information retrieval method, device, equipment and medium | |
CN113094519B (en) | Method and device for searching based on document | |
CN109508390B (en) | Input prediction method and device based on knowledge graph and electronic equipment | |
CN112183117A (en) | Translation evaluation method and device, storage medium and electronic equipment | |
CN115146081B (en) | Construction method and diagnosis method of fault diagnosis knowledge graph of production equipment | |
CN111179904B (en) | Mixed text-to-speech conversion method and device, terminal and computer readable storage medium | |
CN111198936A (en) | Voice search method and device, electronic equipment and storage medium | |
CN111222328B (en) | Label extraction method and device and electronic equipment | |
CN112541069A (en) | Text matching method, system, terminal and storage medium combined with keywords | |
CN116662583B (en) | Text generation method, place retrieval method and related devices |
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 |