Text word recommendation method, device, electronic device and readable storage medium

By obtaining keywords or keyword sentences, making recommendation predictions and screening, and displaying candidate words and sentences that meet the filtering conditions, solving the problem of low efficiency and accuracy of text search recommendation in the prior art, and achieving efficient and accurate text word and sentence recommendations.

CN114064877BActive Publication Date: 2025-03-18BEIJING SOGOU TECHNOLOGY DEVELOPMENT CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202111166940.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-09-30
Publication Date
2025-03-18
Estimated Expiration
2041-09-30

AI Technical Summary

Technical Problem

In the prior art, the efficiency and accuracy of text search recommendations are low, resulting in a large gap between the search recommendation results and user intentions.

Method used

By obtaining keywords or keywords, making recommendation predictions, M recommended words and sentences are obtained, and N candidate words and sentences are filtered out according to preset filter conditions, and finally displayed to the user.

Benefits of technology

It improves the accuracy and efficiency of text word recommendations, realizes convenience and intelligence, and solves the problem of low efficiency and accuracy of search recommendations in the prior art.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114064877B_ABST
    Figure CN114064877B_ABST
Patent Text Reader

Abstract

The present invention discloses a method, device, electronic device and readable storage medium for recommending text words and sentences. The method comprises: obtaining a keyword or a key sentence, wherein the keyword or the key sentence is a keyword or a key sentence selected in the text, or a keyword or a key sentence obtained in an input box; performing recommendation prediction on the keyword or the key sentence to obtain M recommended words and sentences; screening out N candidate words and sentences that meet preset screening conditions from the M recommended words and sentences; and displaying the N candidate words and sentences. The above scheme realizes the convenience and intelligence of text word and sentence recommendation and improves the accuracy of text word and sentence recommendation.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of computer technology, and in particular to a text word recommendation method, device, electronic device and readable storage medium. Background Art

[0002] At present, some search recommendation systems usually search for information in the document library according to certain strategies based on the search request input by the user, thereby providing document search services to users. For example, in the Kingsoft search service system, after receiving the query statement input by the user, it can perform keyword matching search on each document in the document library according to the query statement, and then recommend excellent examples or model essays recorded in the document to the user.

[0003] However, in practice, it is found that after receiving a search request, the search recommendation system must first segment the search sentence contained in the request, and then use these segmented words as keywords to perform literal search recommendations in the document library, and finally merge the search recommendation results and return them to the user. This will result in low efficiency of search recommendations, and a large gap between the search recommendation results and the user's intentions, resulting in low accuracy of search recommendations. Summary of the invention

[0004] The embodiments of the present invention solve the technical problem of low efficiency and accuracy of text retrieval recommendation in the prior art by providing a text word recommendation method, device, electronic device and readable storage medium.

[0005] In a first aspect, an embodiment of the present invention provides a text word recommendation method, comprising:

[0006] Acquire a keyword or a key sentence, where the keyword or the key sentence is a keyword or a key sentence selected in the text, or a keyword or a key sentence acquired in an input box;

[0007] Perform recommendation prediction on the keywords or key sentences to obtain M recommended words and sentences, where M is a positive integer;

[0008] Filter out N candidate words and sentences that meet a preset filtering condition from the M recommended words and sentences, where N is a positive integer less than or equal to M;

[0009] N candidate phrases are displayed.

[0010] Optionally, the method further comprises:

[0011] Determine a target word, where the target word is one of the N candidate words or is generated based on the N candidate words;

[0012] The target words and sentences are displayed according to preset display rules.

[0013] Optionally, each candidate word or phrase is configured with a copy control, and the determining of the target word or phrase includes:

[0014] In response to a copy operation on a copy control corresponding to a target word, obtaining the target word copied by the copy operation, wherein the target word is one of the N candidate words;

[0015] The displaying of the target words and sentences according to the preset display rules includes:

[0016] In response to the pasting operation, the target word or sentence is pasted and displayed according to a preset display rule.

[0017] Optionally, displaying the target phrase according to a preset display rule includes any one of the following:

[0018] Displaying the target word or phrase at a display position adjacent to the keyword or the key sentence;

[0019] Displaying the target phrase at a preset cursor position;

[0020] If the keyword or the key sentence is a keyword or a key sentence selected in the text, the keyword or the key sentence is replaced with the target word or sentence;

[0021] The target word or sentence is displayed in the form of text annotation in a pre-built annotation box of the keyword or the key sentence.

[0022] Optionally, determining the target phrase includes:

[0023] Selecting A selected phrases from the N candidate phrases, where A is a positive integer less than or equal to N;

[0024] A selected words and sentences are fused to obtain the target word and sentence.

[0025] Optionally, the performing fusion processing on the A selected words and sentences to obtain the target word and sentence comprises:

[0026] A preset text fusion algorithm is used to fuse the A selected words and sentences to obtain the target word and sentence.

[0027] Optionally, each of the selected words and sentences includes at least one participle, and the fusion processing of the A selected words and sentences to obtain the target words and sentences includes:

[0028] Calculating the similarity of at least one participle included in each of the A selected words and phrases to obtain the similarity between any two participles;

[0029] If the similarity between any two participles does not exceed the preset similarity, the any two participles are retained;

[0030] If the similarity between any two participles exceeds a preset similarity, retaining any one of the two participles;

[0031] All the retained word segments are combined into the target sentence according to syntactic semantics.

[0032] Optionally, the preset screening condition includes any one of the following:

[0033] The correlation between the candidate word and the keyword or the key sentence exceeds a first threshold;

[0034] The matching degree between the sentence style of the candidate sentence and the text style of the text exceeds a second threshold;

[0035] The degree of match between the sentence topic of the candidate sentence and the text topic of the text exceeds a third threshold;

[0036] The number of words in the candidate phrase is less than or equal to a fourth threshold;

[0037] The phrase length of the candidate phrase is less than or equal to the fifth threshold.

[0038] Optionally, the displaying of N candidate words and phrases includes:

[0039] Sorting the N candidate words and sentences according to the screening index corresponding to the preset screening condition to obtain a sorting result;

[0040] According to the sorting results, display N candidate words and sentences;

[0041] Among them, the screening indicators include any one of the following: the correlation between the candidate word and the keyword or the key sentence, the matching degree between the word style of the candidate word and the text style of the text, the matching degree between the word theme of the candidate word and the text theme of the text, the word count of the candidate word and the word length of the candidate word.

[0042] Optionally, displaying the N candidate words and phrases according to the sorting result includes:

[0043] When N is less than or equal to the preset display number, N candidate words and phrases are displayed in accordance with the sorting result; or,

[0044] When N is greater than a preset display number, expand and display the target candidate words and sentences in the sorting results, and fold and display other candidate words and sentences in the sorting results except the target candidate words and sentences;

[0045] The target candidate words and phrases are the first B candidate words and phrases in the sorting result, and B is determined according to the preset display number.

[0046] In a second aspect, an embodiment of the present invention provides a text word recommendation device, comprising:

[0047] An acquisition module, used to acquire a keyword or a key sentence, wherein the keyword or the key sentence is a keyword or a key sentence selected in the text, or a keyword or a key sentence acquired in an input box;

[0048] A recommendation module, used to make recommendation predictions for the keywords or key sentences, and obtain M recommended words and sentences, where M is a positive integer;

[0049] A screening module, used to screen out N candidate words and sentences that meet a preset screening condition from the M recommended words and sentences, where N is a positive integer less than or equal to M;

[0050] The display module is used to display the N candidate words and sentences.

[0051] For the contents not introduced or described in the embodiments of the present application, please refer to the relevant introduction in the aforementioned method embodiments, which will not be repeated here.

[0052] In a third aspect, an embodiment of the present invention provides an electronic device comprising a memory and one or more programs, wherein the one or more programs are stored in the memory and are configured to be executed by one or more processors to execute operation instructions corresponding to the text word recommendation method provided in the first aspect.

[0053] In a fourth aspect, an embodiment of the present invention provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps corresponding to the text word and sentence recommendation method provided in the first aspect.

[0054] One or more technical solutions provided by the embodiments of the present invention achieve at least the following technical effects or advantages:

[0055] The solution provided by the embodiment of the present invention obtains keywords or key sentences, performs recommendation prediction on the keywords or key sentences to obtain M recommended words and sentences, screens out N candidate words and sentences that meet preset screening conditions from the M recommended words and sentences, and displays the N candidate words and sentences. In the above scheme, after recommending words and sentences for keywords or key sentences, the obtained M recommended words and sentences are screened according to the preset screening conditions, and finally the N candidate words and sentences that meet the screening conditions are recommended and displayed to the user. This can improve the accuracy of text word and sentence recommendations, and realize the convenience and intelligence of text word and sentence recommendations, thereby improving the efficiency of text word and sentence recommendations, and also solves the technical problem of low efficiency and accuracy of text retrieval recommendations in the prior art. BRIEF DESCRIPTION OF THE DRAWINGS

[0056] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on the provided drawings without paying creative work.

[0057] Figure 1 It is a flowchart of a text word and sentence recommendation method provided by an embodiment of the present invention.

[0058] Figure 2 It is a schematic diagram of an interface for obtaining keywords or key sentences provided by an embodiment of the present invention.

[0059] Figure 3 It is a schematic diagram of another interface for obtaining keywords or key sentences provided by an embodiment of the present invention.

[0060] Figure 4 It is a schematic diagram of an interface for selecting a target word or sentence provided by an embodiment of the present invention.

[0061] Figure 5 It is a structural diagram of a text word recommendation device provided by an embodiment of the present invention.

[0062] Figure 6 It is a schematic diagram of an electronic device provided by an embodiment of the present invention.

[0063] Figure 7 It is a structural diagram of a server provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0064] The present invention provides a text word recommendation method, device, electronic device and readable storage medium to solve the technical problem of low efficiency and accuracy of text retrieval recommendation in the prior art. The overall idea is as follows:

[0065] Obtain keywords or key sentences, where the keywords or key sentences are keywords or key sentences selected in the text, or keywords or key sentences obtained in the input box; perform recommendation prediction on the keywords or key sentences to obtain M recommended words and sentences, where M is a positive integer; filter out N candidate words and sentences that meet preset filtering conditions from the M recommended words and sentences, where N is a positive integer less than or equal to M; and display the N candidate words and sentences.

[0066] Through the above technical solution, after recommending words and phrases for keywords or key sentences, the M recommended words and phrases are screened according to the preset screening conditions, and finally N candidate words and phrases that meet the screening conditions are recommended and displayed to the user. This can improve the accuracy of text word and phrase recommendations, and achieve the convenience and intelligence of text word and phrase recommendations, thereby improving the efficiency of text word and phrase recommendations, and also solves the technical problem of low efficiency and accuracy of text retrieval recommendations in the prior art.

[0067] See also Figure 1 , is a flow chart of a text word recommendation method provided by an embodiment of the present invention. Figure 1 The method shown includes the following implementation steps:

[0068] S101. Acquire a keyword or a key sentence, where the keyword or key sentence is a keyword or key sentence selected in a text, or a keyword or key sentence acquired in an input box.

[0069] The keywords or key sentences described in the present invention are keywords or key sentences selected by the user in the text, or can be keywords or key sentences input by the user in the input box, or can be received from other terminal devices. The acquisition method is not limited in the present invention. Among them, the number of the keywords or key sentences is not limited, and it can be one or more. Usually, in order to ensure the accuracy of the system's word and sentence recommendations, the number of the keywords or key sentences is multiple. The text can include custom text in any format, such as txt text, Doc text, etc.; it can also include text obtained by using text recognition technology, etc. The text recognition technology includes but is not limited to optical character recognition (OCR), geometric feature extraction technology, or other technologies for text or text recognition.

[0070] For example, see Figure 2 and Figure 3 The following are schematic diagrams of interfaces for obtaining two types of keywords or key sentences. Figure 2In the interface shown, when the user selects the option "Select key words and sentences in the text to generate recommendations", the user can customize and drag the interface cursor to select the input keywords or key sentences in the text. For example, the key sentence selected in the text in the figure is "Above the winding lotus pond, there are lush leaves as far as the eye can see."

[0071] like Figure 3 In the interface shown, when the user selects the option of "custom input key words and phrases to generate recommendations", the user can customize the input of corresponding keywords or key phrases in the input box of the interface according to the user's personal needs or personal preferences. For example, in the figure, the key phrase entered by the user in the input box is "autumn in Beijing", etc. Further, the user can also click a button such as "click to generate recommendations" in the interface to trigger the system to provide a corresponding recommended word or phrase function or service, and enter step S102.

[0072] S102: Perform recommendation prediction on the keyword or the key sentence to obtain M recommended words and sentences, where M is a positive integer.

[0073] In one embodiment, the present invention can call a pre-trained language model to perform recommendation prediction on the keyword or the key words, and output M recommended words and phrases. The language model includes but is not limited to a feedforward neural network model, a convolutional neural network model, a deep residual network model, a recurrent neural network model, a long short-term memory model, or other machine learning models.

[0074] In another embodiment, the present invention can query M recommended words and sentences matching the keyword or the key sentence from a preset word and sentence database according to the keyword or the key sentence. The word and sentence database stores multiple text words and sentences, and the recommended word and sentence is one of the multiple text words and sentences.

[0075] It should be noted that the text words and sentences, the recommended words and sentences, and the subsequent candidate words and sentences involved in the present invention can refer to either individual word segments or individual sentences, and the present invention does not limit this.

[0076] S103: Filter out N candidate words and sentences that meet preset filtering conditions from the M recommended words and sentences, where N is a positive integer less than or equal to M.

[0077] The preset screening conditions of the present invention are user-defined conditions for screening candidate word segmentation, and the present invention does not limit them. In some embodiments, the preset screening conditions include but are not limited to any one of the following: the correlation between the candidate word and the keyword or the key sentence exceeds a first threshold, the match between the word style of the candidate word and the text style of the text exceeds a second threshold, the match between the word theme of the candidate word and the text theme of the text exceeds a third threshold, the word count of the candidate word is less than or equal to a fourth threshold, the word length of the candidate word is less than or equal to a fifth threshold, or other screening conditions.

[0078] The first threshold, the second threshold, the third threshold, the fourth threshold and the fifth threshold are customized by the system or the user. For example, they may be thresholds set by the system according to actual needs, or empirical values ​​set according to user experience.

[0079] The degree of association described in the present invention refers to the degree of association between the candidate words and the keywords or the key sentences, which can also be understood as the degree of similarity or matching between them to a certain extent. The matching degree refers to the degree of conformity between the two. For example, the degree of matching between the word style of the candidate words and the text style of the text can specifically refer to the degree of conformity between the two styles. The word style refers to the characteristics or style used to describe or summarize the words and sentences, and the text style refers to the characteristics or style used to describe or summarize the text. They may include but are not limited to court style, melancholic style, martial arts style, spoken style, written style, dialect style, witty style, or other custom language styles. The word theme refers to the word meaning or central idea used to describe or summarize the candidate words and sentences. The text theme refers to the text meaning or central idea used to describe or summarize the text.

[0080] S104: Display N candidate words and phrases.

[0081] The present invention can display the N candidate words and phrases in a preset display area of ​​the target page. Several possible implementations of step S104 are described below.

[0082] In one embodiment, the present invention can sort the N candidate words and sentences according to the screening index corresponding to the preset screening condition to obtain a sorting result, specifically, for example, sorting the N candidate words and sentences in descending order according to the screening index, etc. Then, the N candidate words and sentences are displayed according to the sorting result, for example, the N candidate words and sentences are displayed in a preset display area of ​​the target page according to the sorting result from large to small.

[0083] The screening index corresponds to the preset screening condition one by one, and may include but is not limited to any of the following: the correlation between the candidate phrase and the keyword or the key sentence, the matching degree between the phrase style of the candidate phrase and the text style of the text, the matching degree between the phrase theme of the candidate phrase and the text theme of the text, the phrase word count of the candidate phrase and the phrase length of the candidate phrase, etc. For example, if the preset screening condition adopted by the candidate phrase is: the correlation between the candidate phrase and the keyword or the key sentence, then in step S104, the N candidate phrases may be sorted according to the correlation between each candidate phrase and the keyword or the key sentence.

[0084] In another embodiment, the specific implementation of displaying N candidate words and phrases according to the sorting result may be: when N is relatively small, for example, less than or equal to the preset display number supported by the display area, the present invention may directly expand and display the N candidate words and phrases in the display area. Conversely, when N is relatively large, for example, greater than the preset display number supported by the display area, the present invention may expand and display the target candidate words and phrases in the sorting result, and fold and display the remaining candidate words and phrases in the sorting result except the target candidate words and phrases, etc. The target candidate words and phrases are the first B candidate words and phrases in the sorting result, where B is determined according to the preset display number, and may specifically be the preset display number, and B is a positive integer less than N.

[0085] Some optional embodiments of the present invention are described below.

[0086] In some optional embodiments, the present invention can determine a target phrase based on the N candidate phrases, and the target phrase can be any one of the N candidate phrases, or can be generated based on the N candidate phrases. Several possible implementations are described below.

[0087] In one embodiment, the present invention configures a copy control for each candidate word or sentence displayed in the display area of ​​the target page, and the user can arbitrarily select a copy control to copy the corresponding candidate word or sentence according to his or her own needs or personal preferences. Specifically, the present invention can respond to the user's copy operation on the copy control corresponding to the target word or sentence, and obtain the target word or sentence copied by the copy operation, and the target word or sentence is any one of the N candidate words or sentences. The copy operation is used to trigger the operation of the copy control to select the target word or sentence corresponding to the copy control. The copy operation may include but is not limited to a click operation (such as a single click, double click, or triple click, etc.), a long press operation, a drag operation, and the like on the copy control.

[0088] For example, see Figure 4FIG. 1 is a schematic diagram of a possible interface for selecting a target word or phrase according to the present invention. Figure 4 In the interface shown, a corresponding copy control (shown as copy) is configured for each candidate word or phrase. As shown in the display area of ​​the interface, 5 candidate words or phrases are displayed, and the user clicks to select the copy control corresponding to the first candidate word or phrase. In response to the click operation on the copy control, the present invention can obtain the first candidate word or phrase corresponding to the copy control as the target word or phrase selected by the user.

[0089] Optionally, the user can perform a paste operation on the target phrase at any position on the target page. After detecting the user's paste operation, the present invention can paste the target phrase in response to the paste operation, so as to paste and display the target phrase according to a preset display rule, and its specific implementation will be described in detail below in the present invention.

[0090] In another embodiment, the present invention can select A selected words and sentences from the N candidate words and sentences, where A is a positive integer less than or equal to N. Specifically, the selected words and sentences can be arbitrarily selected by the user from the N candidate words and sentences according to his own needs or personal preferences, or can be selected by the system from the N candidate words and sentences according to actual needs, such as words and sentences that conform to a certain text style or text theme, etc., and the present invention does not limit this. Furthermore, the present invention can perform a fusion process on the A selected words and sentences to obtain the final target words and sentences. Several possible specific implementations of the fusion process are introduced below.

[0091] In a specific embodiment, the present invention can use a preset text fusion algorithm to fuse the A selected words and sentences to obtain the target words and sentences. The text fusion algorithm is a system-defined algorithm for generating text words and sentences, which may include but is not limited to a multi-task learning algorithm, a text word and sentence generation algorithm based on a knowledge graph, a text word and sentence generation algorithm based on a memory network, and an algorithm for generating text words and sentences in combination with distribution-sampling, or other algorithms for generating text words and sentences.

[0092] In another specific embodiment, each of the selected words and sentences includes at least one participle. The present invention can perform similarity calculation on at least one participle included in each of the A selected words and sentences to obtain the similarity between any two participles. Then, according to the similarity between the any two participles, the A selected words and sentences are fused to obtain the final target words and sentences. Specifically, for example, if the similarity between the any two participles does not exceed the preset similarity, it means that the difference between the any two participles is large, and the any two participles are retained. On the contrary, if the similarity between the any two participles exceeds the preset similarity, it means that the any two participles are very similar and the difference is not obvious. At this time, the present invention can arbitrarily retain one of the participles from the any two participles and eliminate the other participle. Further, the present invention can combine all the retained participles into the target words and sentences according to their original positions, and combine all these participles with elements such as syntax and semantics.

[0093] The preset similarity is a similarity customized by a user or a system, for example, it may be an experience value set according to user experience, or a similarity value set according to actual system requirements, etc., which is not limited in the present invention.

[0094] In some optional embodiments, after obtaining the target word or sentence, the present invention may display the target word or sentence according to a preset display rule. There are several possible implementations as follows.

[0095] In some embodiments, the present invention may display the target word or phrase in a display position adjacent to the keyword or the key sentence, and the display position is adjacent to the position where the keyword or the key sentence is located, for example, immediately behind the keyword or the key word, in the next paragraph position or the previous paragraph position, etc., and the present invention is not limited thereto.

[0096] In other implementations, the present invention may display the target word or phrase at a preset cursor position, and specifically may display the target word or phrase at the cursor position where the current cursor is located in the target page.

[0097] In other embodiments, if the keyword or the key sentence is a keyword or key sentence selected in the text, the present invention can directly use the target word to replace the keyword or key sentence. In other words, in the scenario where the text is divided into keywords or key words, the present invention can directly use the target word to replace the originally selected keyword or key sentence.

[0098] In other embodiments, the present invention can display the target words and sentences in the form of text annotations in a pre-built comment box of the keyword or the key sentence. Specifically, the present invention can create a corresponding pre-built comment box for the keyword or the key sentence in advance, and the position of the pre-built comment box is not limited. Preferably, the pre-built comment box is established at the position of the keyword or the key sentence. Furthermore, the present invention can display the target words and sentences in the pre-built comment box for the user to view.

[0099] By implementing the embodiments of the present invention, the present invention obtains keywords or key sentences, performs recommendation prediction on the keywords or key sentences to obtain M recommended words and sentences, screens out N candidate words and sentences that meet preset screening conditions from the M recommended words and sentences, and displays the N candidate words and sentences. In the above scheme, after recommending words and sentences for keywords or key sentences, the obtained M recommended words and sentences are screened according to the preset screening conditions, and finally the N candidate words and sentences that meet the screening conditions are recommended and displayed to the user. This can improve the accuracy of text word and sentence recommendations, and realize the convenience and intelligence of text word and sentence recommendations, thereby improving the efficiency of text word and sentence recommendations, and also solves the technical problem of low efficiency and accuracy of text retrieval recommendations in the prior art.

[0100] Based on the same inventive concept, the present invention also provides a text word recommendation device, electronic device and server. Figure 5 , is a schematic diagram of the structure of a text word recommendation device provided by an embodiment of the present invention. Figure 5 The device 50 shown includes: an acquisition module 501, a recommendation module 502, a screening module 503 and a display module 504, wherein:

[0101] The acquisition module 501 is used to acquire a keyword or a key sentence, where the keyword or key sentence is a keyword or key sentence selected in the text, or a keyword or key sentence acquired in the input box;

[0102] The recommendation module 502 is used to perform recommendation prediction on the keywords or key sentences to obtain M recommended words and sentences, where M is a positive integer;

[0103] The screening module 503 is used to screen out N candidate words and sentences that meet a preset screening condition from the M recommended words and sentences, where N is a positive integer less than or equal to M;

[0104] The display module 504 is used to display the N candidate words and sentences.

[0105] Optionally, the apparatus 50 may further include a determination module 505, wherein:

[0106] The determination module 505 is used to determine a target word, where the target word is one of the N candidate words or is generated based on the N candidate words;

[0107] The display module 504 is further configured to display the target word or sentence according to a preset display rule.

[0108] Optionally, each candidate word or phrase is configured with a copy control, and the determination module 505 is specifically used to:

[0109] In response to a copy operation on a copy control corresponding to a target word, obtaining the target word copied by the copy operation, wherein the target word is one of the N candidate words;

[0110] The display module 504 is specifically used for:

[0111] In response to the pasting operation, the target word or sentence is pasted and displayed according to a preset display rule.

[0112] Optionally, the display module 504 is specifically used for any one of the following:

[0113] Displaying the target word or phrase at a display position adjacent to the keyword or the key sentence;

[0114] Displaying the target phrase at a preset cursor position;

[0115] If the keyword or the key sentence is a keyword or a key sentence selected in the text, the keyword or the key sentence is replaced with the target word or sentence;

[0116] The target word or sentence is displayed in the form of text annotation in a pre-built annotation box of the keyword or the key sentence.

[0117] Optionally, the determining module 505 is further specifically configured to:

[0118] Selecting A selected phrases from the N candidate phrases, where A is a positive integer less than or equal to N;

[0119] A selected words and sentences are fused to obtain the target word and sentence.

[0120] Optionally, the determining module 505 is specifically configured to:

[0121] A preset text fusion algorithm is used to fuse the A selected words and sentences to obtain the target word and sentence.

[0122] Optionally, each of the selected words and sentences includes at least one participle, and the determination module 505 is specifically configured to:

[0123] Calculating the similarity of at least one participle included in each of the A selected words and phrases to obtain the similarity between any two participles;

[0124] If the similarity between any two participles does not exceed the preset similarity, the any two participles are retained;

[0125] If the similarity between any two participles exceeds a preset similarity, retaining any one of the two participles;

[0126] All the retained word segments are combined into the target sentence according to syntactic semantics.

[0127] Optionally, the preset screening condition includes any one of the following:

[0128] The correlation between the candidate word and the keyword or the key sentence exceeds a first threshold;

[0129] The degree of match between the sentence style of the candidate sentence and the text style of the text exceeds a second threshold;

[0130] The degree of match between the sentence topic of the candidate sentence and the text topic of the text exceeds a third threshold;

[0131] The number of words in the candidate phrase is less than or equal to a fourth threshold;

[0132] The phrase length of the candidate phrase is less than or equal to the fifth threshold.

[0133] Optionally, the display module 504 is specifically used for:

[0134] Sorting the N candidate words and sentences according to the screening index corresponding to the preset screening condition to obtain a sorting result;

[0135] According to the sorting results, display N candidate words and sentences;

[0136] Among them, the screening indicators include any one of the following: the correlation between the candidate word and the keyword or the key sentence, the matching degree between the word style of the candidate word and the text style of the text, the matching degree between the word theme of the candidate word and the text theme of the text, the word count of the candidate word and the word length of the candidate word.

[0137] Optionally, the display module 504 is specifically used for:

[0138] When N is less than or equal to the preset display number, N candidate words and phrases are displayed in accordance with the sorting result; or,

[0139] When N is greater than a preset display number, expand and display the target candidate words and sentences in the sorting results, and fold and display other candidate words and sentences in the sorting results except the target candidate words and sentences;

[0140] The target candidate words and phrases are the first B candidate words and phrases in the sorting result, and B is determined according to the preset display number.

[0141] Regarding the device in the above embodiment, the specific manner in which each module performs operations has been described in detail in the embodiment of the method, and will not be elaborated here.

[0142] Based on the same inventive concept, an embodiment of the present invention provides an electronic device 800, Figure 6 8 is a block diagram of an electronic device 800 according to an exemplary embodiment. For example, the device 800 may be a mobile phone, a computer, a digital broadcast terminal, a messaging device, a game console, a tablet device, a medical device, a fitness device, a personal digital assistant, etc.

[0143] Reference Figure 6 , device 800 may include one or more of the following components: a processing component 802 , a memory 804 , a power component 806 , a multimedia component 808 , an audio component 810 , an input / output (I / O) interface 812 , a sensor component 814 , and a communication component 816 .

[0144] The processing component 802 generally controls the overall operation of the device 800, such as operations associated with display, phone calls, data communications, camera operations, and recording operations. The processing component 802 may include one or more processors 820 to execute instructions to complete all or part of the steps of the above-mentioned method. In addition, the processing component 802 may include one or more modules to facilitate the interaction between the processing component 802 and other components. For example, the processing component 802 may include a multimedia module to facilitate the interaction between the multimedia component 808 and the processing component 802.

[0145] The memory 804 is configured to store various types of data to support operations on the device 800. Examples of such data include instructions for any application or method operating on the device 800, contact data, phone book data, messages, pictures, videos, etc. The memory 804 can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic disk or optical disk.

[0146] The power component 806 provides power to the various components of the device 800. The power component 806 may include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power for the device 800.

[0147] The multimedia component 808 includes a screen that provides an output interface between the device 800 and the user. In some embodiments, the screen may include a liquid crystal display (LCD) and a touch panel (TP). If the screen includes a touch panel, the screen may be implemented as a touch screen to receive input signals from the user. The touch panel includes one or more touch sensors to sense touch, slide, and gestures on the touch panel. The touch sensor may not only sense the boundaries of the touch or slide action, but also detect the duration and pressure associated with the touch or slide operation. In some embodiments, the multimedia component 808 includes a front camera and / or a rear camera. When the device 800 is in an operating mode, such as a shooting mode or a video mode, the front camera and / or the rear camera may receive external multimedia data. Each front camera and rear camera may be a fixed optical lens system or have a focal length and optical zoom capability.

[0148] The audio component 810 is configured to output and / or input audio signals. For example, the audio component 810 includes a microphone (MIC), and when the device 800 is in an operating mode, such as a call mode, a recording mode, and a speech recognition mode, the microphone is configured to receive an external audio signal. The received audio signal can be further stored in the memory 804 or sent via the communication component 816. In some embodiments, the audio component 810 also includes a speaker for outputting audio signals.

[0149] I / O interface 812 provides an interface between processing component 802 and peripheral interface modules, such as keyboards, click wheels, buttons, etc. These buttons may include but are not limited to: home button, volume button, start button, and lock button.

[0150] The sensor assembly 814 includes one or more sensors for providing various aspects of status assessment for the device 800. For example, the sensor assembly 814 can detect the open / closed state of the device 800, the relative positioning of components, such as the display and keypad of the device 800, and the sensor assembly 814 can also detect the position change of the device 800 or a component of the device 800, the presence or absence of user contact with the device 800, the orientation or acceleration / deceleration of the device 800, and the temperature change of the device 800. The sensor assembly 814 may include a proximity sensor configured to detect the presence of nearby objects without any physical contact. The sensor assembly 814 may also include a light sensor, such as a CMOS or CCD image sensor, for use in imaging applications. In some embodiments, the sensor assembly 814 may also include an acceleration sensor, a gyroscope sensor, a magnetic sensor, a pressure sensor, or a temperature sensor.

[0151] The communication component 816 is configured to facilitate wired or wireless communication between the device 800 and other devices. The device 800 can access a wireless network based on a communication standard, such as WiFi, 2G or 3G, or a combination thereof. In an exemplary embodiment, the communication component 816 receives a broadcast signal or broadcast-related information from an external broadcast management system via a broadcast channel. In an exemplary embodiment, the communication component 816 also includes a near field communication (NFC) module to facilitate short-range communication. For example, the NFC module can be implemented based on radio frequency identification (RFID) technology, infrared data association (IrDA) technology, ultra-wideband (UWB) technology, Bluetooth (BT) technology and other technologies.

[0152] In an exemplary embodiment, the device 800 may be implemented by one or more application-specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DSPDs), programmable logic devices (PLDs), field programmable gate arrays (FPGAs), controllers, microcontrollers, microprocessors, or other electronic components to perform the above methods.

[0153] In an exemplary embodiment, a non-transitory computer-readable storage medium including instructions is also provided, such as a memory 804 including instructions, which can be executed by a processor 820 of the device 800 to perform the above method. For example, the non-transitory computer-readable storage medium can be a ROM, a random access memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, an optical data storage device, etc.

[0154] Figure 71 is a schematic diagram of the structure of the server in some embodiments of the present invention. The server 1900 may have relatively large differences due to different configurations or performances, and may include one or more central processing units (CPU) 1922 (for example, one or more processors) and memory 1932, and one or more storage media 1930 (for example, one or more mass storage devices) storing application programs 1942 or data 1944. Among them, the memory 1932 and the storage medium 1930 can be short-term storage or permanent storage. The program stored in the storage medium 1930 may include one or more modules (not shown in the figure), and each module may include a series of instruction operations in the server. Furthermore, the central processing unit 1922 can be configured to communicate with the storage medium 1930 and execute a series of instruction operations in the storage medium 1930 on the server 1900.

[0155] The server 1900 may also include one or more power supplies 1926, one or more wired or wireless network interfaces 1950, one or more input and output interfaces 1958, one or more keyboards 1956, and / or, one or more operating systems 1941, such as Windows ServerTM, Mac OS XTM, UnixTM, LinuxTM, FreeBSDTM, etc.

[0156] A non-transitory computer-readable storage medium, when the instructions in the storage medium are executed by a processor of a device (server or terminal), enables the device to perform the text word recommendation method of the above embodiments, for example, the method includes:

[0157] Acquire a keyword or a key sentence, where the keyword or the key sentence is a keyword or a key sentence selected in the text, or a keyword or a key sentence acquired in an input box;

[0158] Perform recommendation prediction on the keyword or the key sentence to obtain M recommended words and sentences, where M is a positive integer;

[0159] Filter out N candidate words and sentences that meet a preset filtering condition from the M recommended words and sentences, where N is a positive integer less than or equal to M;

[0160] N candidate phrases are displayed.

[0161] One or more technical solutions provided by the embodiments of the present invention achieve at least the following technical effects or advantages: the present invention obtains keywords or key sentences, performs recommendation prediction on the keywords or key sentences to obtain M recommended words and sentences, screens out N candidate words and sentences that meet preset screening conditions from the M recommended words and sentences, and displays the N candidate words and sentences. In the above scheme, after recommending words and sentences for keywords or key sentences, the M recommended words and sentences obtained are screened according to the preset screening conditions, and finally the N candidate words and sentences that meet the screening conditions are recommended and displayed to the user. This can improve the accuracy of text word and sentence recommendations, and realize the convenience and intelligence of text word and sentence recommendations, thereby improving the efficiency of text word and sentence recommendations, and also solves the technical problem of low efficiency and accuracy of text retrieval recommendations in the prior art.

[0162] Those skilled in the art will readily appreciate other embodiments of the invention after considering the specification and practicing the invention disclosed herein. The present invention is intended to cover any variations, uses or adaptations of the present invention that follow the general principles of the present invention and include common knowledge or customary techniques in the art that are not disclosed in this disclosure. The description and examples are to be considered exemplary only, and the true scope and spirit of the present invention are indicated by the following claims.

[0163] It should be understood that the present invention is not limited to the precise structure described above and shown in the accompanying drawings, and various modifications and changes can be made without departing from the scope thereof. The scope of the present invention is limited only by the appended claims. The above are only preferred embodiments of the present invention and are not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present invention shall be included in the scope of protection of the present invention.

Claims

1. A text word recommendation method, characterized in that: include: Acquire a keyword or a key sentence, where the keyword or the key sentence is a keyword or a key sentence selected in the text, or a keyword or a key sentence acquired in an input box; Perform recommendation prediction on the keyword or the key sentence to obtain M recommended words and sentences, where M is a positive integer; From the M recommended words and sentences, N candidate words and sentences that meet the preset screening conditions are screened out, where N is a positive integer less than or equal to M; the preset screening conditions include any one of the following: the correlation between the candidate words and sentences and the keywords or the key sentences exceeds a first threshold; the matching degree between the word style of the candidate words and sentences and the text style of the text exceeds a second threshold; the matching degree between the word theme of the candidate words and sentences and the text theme of the text exceeds a third threshold; the word count of the candidate words and sentences is less than or equal to a fourth threshold; the word length of the candidate words and sentences is less than or equal to a fifth threshold; Display N candidate words and sentences; Determine a target word, where the target word is one of the N candidate words or is generated based on the N candidate words; Displaying the target words and sentences according to preset display rules; The target phrases are determined as follows: Selecting A selected phrases from the N candidate phrases, where A is a positive integer less than or equal to N; A selected words and sentences are fused to obtain the target word and sentence.

2. The method according to claim 1, characterized in that Each candidate phrase is correspondingly configured with a copy control, and the determination of the target phrase includes: In response to a copy operation on a copy control corresponding to a target word, obtaining the target word copied by the copy operation, wherein the target word is one of the N candidate words; The displaying of the target words and sentences according to the preset display rules includes: In response to the pasting operation, the target word or sentence is pasted and displayed according to a preset display rule.

3. The method according to claim 2, characterized in that Displaying the target phrase according to the preset display rule includes any one of the following: Displaying the target word or phrase at a display position adjacent to the keyword or the key sentence; Displaying the target phrase at a preset cursor position; If the keyword or the key sentence is a keyword or a key sentence selected in the text, the keyword or the key sentence is replaced with the target word or sentence; The target word or sentence is displayed in the form of text annotation in a pre-built annotation box of the keyword or the key sentence.

4. The method according to claim 1, characterized in that The fusion processing of the A selected words and sentences to obtain the target words and sentences includes: A preset text fusion algorithm is used to fuse the A selected words and sentences to obtain the target word and sentence.

5. The method according to claim 4, characterized in that Each of the selected words and sentences includes at least one participle, and the fusion processing of the A selected words and sentences to obtain the target words and sentences includes: Calculating the similarity of at least one participle included in each of the A selected words and phrases to obtain the similarity between any two participles; If the similarity between any two participles does not exceed the preset similarity, the any two participles are retained; If the similarity between any two participles exceeds a preset similarity, retaining any one of the two participles; All the retained word segments are combined into the target sentence according to syntactic semantics.

6. The method according to claim 1, characterized in that The displaying of N candidate phrases comprises: Sorting the N candidate words and sentences according to the screening index corresponding to the preset screening condition to obtain a sorting result; According to the sorting results, display N candidate words and sentences; Among them, the screening indicators include any one of the following: the correlation between the candidate word and the keyword or the key sentence, the matching degree between the word style of the candidate word and the text style of the text, the matching degree between the word theme of the candidate word and the text theme of the text, the word count of the candidate word and the word length of the candidate word.

7. The method according to claim 6, characterized in that The displaying of N candidate words and phrases according to the sorting results includes: When N is less than or equal to the preset display number, N candidate words and phrases are displayed in accordance with the sorting result; or, When N is greater than a preset display number, expand and display the target candidate words and sentences in the sorting results, and fold and display other candidate words and sentences in the sorting results except the target candidate words and sentences; The target candidate words and phrases are the first B candidate words and phrases in the sorting result, and B is determined according to the preset display number.

8. A text word recommendation device, characterized in that: include: An acquisition module, used to acquire a keyword or a key sentence, wherein the keyword or the key sentence is a keyword or a key sentence selected in the text, or a keyword or a key sentence acquired in an input box; A recommendation module, used to make recommendation predictions for the keywords or key sentences, and obtain M recommended words and sentences, where M is a positive integer; A screening module is used to screen out N candidate words and sentences that meet preset screening conditions from the M recommended words and sentences, where N is a positive integer less than or equal to M; the preset screening conditions include any one of the following: the correlation between the candidate words and sentences and the keywords or the key sentences exceeds a first threshold; the matching degree between the word style of the candidate words and sentences and the text style of the text exceeds a second threshold; the matching degree between the word theme of the candidate words and sentences and the text theme of the text exceeds a third threshold; the word count of the candidate words and sentences is less than or equal to a fourth threshold; the word length of the candidate words and sentences is less than or equal to a fifth threshold; A display module, used for displaying the N candidate words and sentences; A determination module, configured to determine a target word or phrase, wherein the target word or phrase is one of the N candidate words or phrases, or is generated based on the N candidate words or phrases; The display module is further used to display the target words and sentences according to a preset display rule; The determining module is further specifically used for: Selecting A selected phrases from the N candidate phrases, where A is a positive integer less than or equal to N; A selected words and sentences are fused to obtain the target word and sentence.

9. An electronic device, characterized in that: The invention comprises a memory and one or more programs, wherein the one or more programs are stored in the memory and are configured to be executed by one or more processors to execute the operation instructions corresponding to the method according to any one of claims 1 to 7 contained in the one or more programs.

10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the steps corresponding to the method according to any one of claims 1 to 7 are implemented.

Citation Information

Patent Citations

  • Poem statement input recommendation method and device and electronic device

    CN109766013A