Text recommendation method and device
By automatically extracting and classifying hot texts from historical texts, the problem of bias in the summary of hot issues in the existing technology is solved, user experience improvement and customer service workload reduction is achieved, and the recommended text is highly accurate and diverse.
Patent Information
- Application Number
- CN201810149129.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2018-02-13
- Publication Date
- 2024-12-06
- Estimated Expiration
- 2038-02-13
AI Technical Summary
In the prior art, due to the differences in the observation ability and cognitive level of customer service personnel and the subjectivity of manual summary, there are deviations in the summary of hot issues, which cannot effectively reduce the user's manual input needs.
By automatically extracting hot text from multiple historical texts, using similarity to classify texts, and selecting standard texts for recommendations in categories containing a large number of historical texts, reducing manual input by users and improving the accuracy and variety of recommendations sex.
It realizes automatic statistics of recommended texts that reflect current consulting hot topics from a large number of historical texts, reduces user manual input, improves user experience, and reduces the workload of customer service personnel. The recommended text is not similar or duplicate text, and has Representative and covers more text categories.
Smart Images

Figure CN110309293B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer technology, and in particular to a text recommendation method and device. Background Art
[0002] In real life, users often consult about an item before or after the sale, and the questions are entered by the users themselves. If one or more hot issues about the item can be determined from the historical consultation questions of the item and provided to the user, the user's manual input can be reduced and their experience can be improved. In the prior art, the above hot issues are generally summarized by using the work experience of customer service staff.
[0003] In the process of implementing the present invention, the inventors found that the prior art has at least the following problems:
[0004] Due to the differences in observation ability and understanding level of different customer service personnel and the inevitable subjectivity of manual summary, there are deviations in the hot issues summarized in the existing technology. Summary of the invention
[0005] In view of this, an embodiment of the present invention provides a text recommendation method and device, which can automatically and accurately extract hot texts from multiple historical texts and recommend them to users, so that users do not need to perform manual input when consulting.
[0006] To achieve the above objective, according to one aspect of the present invention, a text recommendation method is provided.
[0007] The text recommendation method of the embodiment of the present invention includes the steps of: obtaining multiple historical texts, and classifying the multiple historical texts into at least one text category according to the similarity between the historical texts; grouping the text categories according to the number of historical texts they contain to obtain at least one text grouping; selecting a standard text from each text group as the text to be recommended; wherein the standard text of each text group is: the historical text with the largest number of repetitions in each text category of the text group.
[0008] Optionally, each of the multiple historical texts corresponds to a generation time; and the method of classifying the multiple historical texts into at least one text category according to the similarity between the historical texts includes the following steps: S201: forming an initial text set from the multiple historical texts; S202: determining the historical text with the latest generation time in the current text set as the basic text of the current text set, determining the historical text in the current text set whose similarity with the basic text meets preset conditions as similar text of the basic text, determining the basic text and its similar texts as a text category, and removing the text category from the current text set; S203: when it is determined that the text set without the text category is not empty, executing steps S202 and S203; until each text in the initial text set is classified into a text category.
[0009] Optionally, the preset condition includes: the similarity is not less than a preset similarity threshold.
[0010] Optionally, the text categories are grouped according to the number of historical texts contained therein to obtain at least one text group, specifically comprising: S301: arranging the at least one text category in descending order according to the number of historical texts contained therein to form a category sequence; taking the front part of the category sequence that contains a first preset number of text categories as the initial category sequence to be grouped; S302: for the first text category in the current category sequence to be grouped, determining the subsequent text categories whose adjacency ratios are continuously not less than a preset ratio threshold as the same quantity categories of the first text category, determining the first text category and its same quantity categories as a text group, and removing the text group from the current category sequence to be grouped; wherein the adjacency ratio of each text category in the current category sequence to be grouped is: the ratio of the number of historical texts contained in the text category and its previous text category; S303: when it is determined that the number of the current text group is less than the second preset number, executing steps S302 and S303; until the number of the current text group is equal to the second preset number.
[0011] Optionally, the method further comprises: after acquiring the plurality of historical texts, detecting noise data in the plurality of historical texts using a pre-established language model, and removing the detected noise data.
[0012] Optionally, the method further includes: for each historical text among multiple historical texts with noise data removed, determining its core word, and taking the sum of the word vectors of each core word as the text vector of the historical text; wherein the word vector is obtained in advance using a word vector calculation tool; and the similarity between any two historical texts is the cosine similarity determined using the text vectors of the two.
[0013] Optionally, the multiple historical texts are: historical consultation question texts for the same object.
[0014] To achieve the above objective, according to another aspect of the present invention, a text recommendation device is provided.
[0015] The text recommendation device of the embodiment of the present invention may include: a clustering module, used to obtain multiple historical texts, and classify the multiple historical texts into at least one text category according to the similarity between the historical texts; a recommendation module, used to group the text categories according to the number of historical texts they contain to obtain at least one text grouping; select standard text from each text group as the text to be recommended for recommendation; wherein the standard text of each text group is: the historical text with the largest number of repetitions in each text category of the text group.
[0016] Optionally, each of the multiple historical texts corresponds to a generation time; and the clustering module can be further used to perform the following steps: S201: an initial text set is formed by the multiple historical texts; S202: the historical text with the latest generation time in the current text set is determined as the basic text of the current text set, the historical text in the current text set whose similarity with the basic text meets preset conditions is determined as the similar text of the basic text, the basic text and its similar texts are determined as a text category, and the text category is removed from the current text set; S203: when it is determined that the text set after removing the text category is not empty, execute steps S202 and S203; until each text in the initial text set is classified into a text category.
[0017] Optionally, the preset condition includes: the similarity is not less than a preset similarity threshold.
[0018] Optionally, the recommendation module can be further used to perform the following steps: S301: Arrange the at least one text category in order from large to small according to the number of historical texts contained, to form a category sequence; use the front part of the category sequence that contains a first preset number of text categories as the initial category sequence to be grouped; S302: For the first text category in the current category sequence to be grouped, determine the subsequent text categories whose adjacency ratios are continuously not less than a preset ratio threshold as the same-quantity categories of the first text category, determine the first text category and its same-quantity categories as a text group, and remove the text group from the current category sequence to be grouped; wherein the adjacency ratio of each text category in the current category sequence to be grouped is: the ratio of the number of historical texts contained in the text category and its previous text category; S303: When it is determined that the number of the current text group is less than the second preset number, execute steps S302 and S303; until the number of the current text group is equal to the second preset number.
[0019] Optionally, the device may further include: a noise reduction module, which is used to detect noise data in the multiple historical texts using a pre-established language model after acquiring the multiple historical texts, and remove the detected noise data.
[0020] Optionally, the device may further include: a text vector calculation module, used to determine the core word of each historical text among multiple historical texts with noise data removed, and use the sum of the word vectors of each core word as the text vector of the historical text; wherein the word vector is pre-obtained using a word vector calculation tool; and the similarity between any two historical texts is the cosine similarity determined using the text vectors of the two.
[0021] Optionally, the multiple historical texts are: historical consultation question texts for the same object.
[0022] To achieve the above objective, according to another aspect of the present invention, an electronic device is provided.
[0023] An electronic device of the present invention comprises: one or more processors; a storage device for storing one or more programs, and when the one or more programs are executed by the one or more processors, the one or more processors implement the text recommendation method provided by the present invention.
[0024] To achieve the above objective, according to yet another aspect of the present invention, a computer-readable storage medium is provided.
[0025] A computer-readable storage medium of the present invention stores a computer program, and when the program is executed by a processor, the text recommendation method provided by the present invention is implemented.
[0026] According to the technical solution of the present invention, an embodiment of the above invention has the following advantages or beneficial effects: by automatically counting the texts to be recommended that reflect the current hot topics of consultation from a large number of historical texts and recommending them to users, the manual input of users is reduced, the user experience is improved, and the workload of customer service personnel is also reduced; when determining the texts to be recommended, first, the historical texts with higher similarity are classified into the same text category according to the similarity between the historical texts, and then, from the text categories containing a large number of historical texts, text categories containing a similar number of historical texts are selected to form a text group, and the standard text of each text group is used as the text to be recommended. Through the above processing, the multiple texts to be recommended recommended to users have the following three characteristics: 1. They are not similar texts or repeated texts; 2. Each text to be recommended is a hot text with strong representativeness in the historical texts; 3. They can cover more text categories; thereby improving the accuracy and diversity of text recommendations and further improving the user experience.
[0027] The further effects of the above-mentioned non-conventional optional manner will be described below in conjunction with the specific implementation manner. BRIEF DESCRIPTION OF THE DRAWINGS
[0028] The accompanying drawings are used to better understand the present invention and do not constitute an improper limitation of the present invention.
[0029] Figure 1 is a schematic diagram of main steps of a text recommendation method according to an embodiment of the present invention;
[0030] Figure 2 is a schematic diagram of text clustering of a text recommendation method according to an embodiment of the present invention;
[0031] Figure 3 is a schematic diagram of text category grouping according to a text recommendation method according to an embodiment of the present invention;
[0032] Figure 4 is a schematic diagram of the main components of a text recommendation device according to an embodiment of the present invention;
[0033] Figure 5 is an exemplary system architecture diagram in which embodiments of the present invention may be applied;
[0034] Figure 6 It is a schematic diagram of the structure of an electronic device used to implement the text recommendation method according to an embodiment of the present invention. DETAILED DESCRIPTION
[0035] The following is a description of exemplary embodiments of the present invention in conjunction with the accompanying drawings, including various details of the embodiments of the present invention to facilitate understanding, which should be considered as merely exemplary. Therefore, it should be recognized by those of ordinary skill in the art that various changes and modifications may be made to the embodiments described herein without departing from the scope and spirit of the present invention. Similarly, for clarity and conciseness, the description of well-known functions and structures is omitted in the following description.
[0036] The technical solution of the embodiment of the present invention reduces the manual input of users, improves the user experience, and also reduces the workload of customer service personnel by automatically counting the texts to be recommended from a large number of historical texts, when determining the texts to be recommended, firstly, the historical texts with higher similarity are classified into the same text category according to the similarity between the historical texts, and then, from the text categories containing a large number of historical texts, text categories containing a similar number of historical texts are selected to form a text group, and the standard text of each text group is used as the text to be recommended. Through the above processing, the multiple texts to be recommended recommended to the user have the following three characteristics: 1. They are not similar texts or repeated texts; 2. Each text to be recommended is a hot text with strong representativeness in the historical texts; 3. They can cover more text categories; thereby improving the accuracy and diversity of text recommendations and further improving the user experience.
[0037] It should be pointed out that the embodiments of the present invention and the technical features therein may be combined with each other without conflict.
[0038] Figure 1 4 is a schematic diagram of main steps of a text recommendation method according to an embodiment of the present invention.
[0039] like Figure 1 As shown, the text recommendation method of the embodiment of the present invention can perform the following steps:
[0040] Step S101: Acquire multiple historical texts, and classify the multiple historical texts into at least one text category according to the similarities between the historical texts.
[0041] In the embodiment of the present invention, the historical text may be a historical consultation question text for the same item. In practical applications, the user consultation questions for a certain item in the last three months or six months may be used as the above-mentioned multiple historical texts. Generally, each item may be identified by its SKU (Stock Keeping Unit) code.
[0042] It is understandable that among the above-mentioned multiple historical texts, there are repeated texts with a high probability. The so-called repeated texts can be multiple historical texts in which the words and their order are completely consistent, or multiple historical texts that meet the preset rules. For example, the preset rule can be: if the positions of the negative words in multiple historical texts are the same and the same proportion of the remaining words is greater than 90%, then the above-mentioned multiple historical texts are determined to be repeated texts. In a text set composed of historical texts, if a certain historical text corresponds to n (n is a natural number) repeated texts, then the number of repetitions of the historical text is n+1.
[0043] In a specific application, each of the multiple historical texts obtained in this step corresponds to a generation time, and the generation time of the historical text refers to the time point corresponding to when the user raises the corresponding consulting question.
[0044] In this step, after obtaining multiple historical texts, the following steps can be performed for preliminary processing:
[0045] 1. Data cleaning: Use pre-established algorithms to remove meaningless text from multiple historical texts. Meaningless texts include: "Are you there?" "How are you?" etc.
[0046] 2. Data noise reduction: Detect noise data in historical texts through a pre-established language model and remove the detected noise data. Among them, noise data is mostly low-value consulting question texts randomly entered by users. The language model is obtained by inputting a large amount of manually annotated historical text data into a text classification model for training. The text input model can be established using the Bayesian algorithm, random forest algorithm, logistic regression algorithm, etc.
[0047] 3. In order to reduce the amount of computation in subsequent processing, a certain number of historical texts with a later generation time (i.e., newer) can be selected from the historical texts after data cleaning and data denoising for subsequent processing. For example: select the latest 10,000 historical texts from the historical texts after data cleaning and data denoising for subsequent processing.
[0048] In this step, after completing the preliminary processing of the historical texts, all the historical texts can be classified into at least one text category to achieve text clustering. Figure 2 is a schematic diagram of text clustering according to a text recommendation method according to an embodiment of the present invention, such as Figure 2 As shown, text clustering can be achieved according to the following steps:
[0049] Step S201: An initial text set is formed from a plurality of historical texts, wherein the plurality of historical texts are texts that have undergone the aforementioned preliminary processing.
[0050] Step S202: Determine the historical text with the latest generation time in the current text set as the basic text of the current text set, determine the historical text in the current text set whose similarity with the basic text meets the preset conditions as the similar text of the basic text, determine the basic text and its similar text as a text category, and remove the text category from the current text set.
[0051] Before executing step S202, the current text set is the initial text set. Since the content and quantity of the historical texts in the text set will change continuously, the "current text set" may change accordingly with the change of the current time. In addition, when using historical texts for text recommendation, the latest historical text should have the greatest contribution to the recommendation results. Therefore, the historical text with the latest generation time (i.e., the latest) in the current text set should be used as the basic text, and the text set should be constructed on its basis.
[0052] As a preferred solution, the similarity in this step can be the cosine similarity calculated by the text vectors of the two historical texts, that is, for any two historical texts, the similarity can be the quotient obtained by dividing the inner product of the two text vectors by the modulus of each text vector. It can be understood that the above similarity can also be obtained based on other feasible operations on the two text vectors, such as calculating the similarity based on the Euclidean distance of the two text vectors, and the present invention does not limit this. In specific applications, the above preset conditions can be specifically set according to the application environment, for example, it can be set to: the similarity is not less than the preset similarity threshold of 0.8.
[0053] It should be noted that the text vector of each historical text is obtained in the following way: all historical texts within a relatively long time range (such as one year) are input into a word vector calculation tool (such as word2vec, which is a tool that can be trained efficiently on massive data sets to calculate word embeddings) in advance to obtain the word vector of each word. When calculating the text vector of a historical text, the historical text is sequentially segmented, stop words are removed (used to remove punctuation marks, function words, etc.), synonyms are replaced (used to replace the remaining words with pre-stored standard words with the same meaning according to a preset strategy, such as replacing New Year's Day with New Year), and core word extraction processing (used to extract nouns, verbs, etc. from the remaining words), and finally the sum of the word vectors of each core word is used as the text vector of the historical text.
[0054] Step S203: When it is determined that the text set without the text category is not empty, steps S202 and S203 are executed until each text in the initial text set is classified into a text category.
[0055] In this step, if it is determined that the current text set is empty, it means that each historical text has completed clustering; otherwise, the clustering step needs to be repeated until each historical text to be clustered is classified into a text category.
[0056] Through the above steps, the historical texts can be classified into at least one text category, and each text category contains at least one historical text. In addition, in each text category, the historical text with the largest number of repetitions is the standard text of the text category.
[0057] In specific applications, text clustering can also be achieved in a similar manner as follows: process each historical text in order from the latest to the earliest generation time: classify the first historical text into the first text category as the first historical text of the first text category. If the similarity between the second historical text and the first historical text of the first historical text category is greater than or equal to 0.8, classify it into the first text category; otherwise, classify it into the second text category and serve as the first historical text of the second text category. If the similarity between the third historical text and the first historical text of the first text category is greater than or equal to 0.8, classify it into the first text category; if there is a second text category, and the similarity between the third historical text and the first historical text of the second text category is greater than or equal to 0.8, classify it into the second text category; otherwise, classify it into the next text category and serve as the first historical text of the text category. Repeat the above process for each historical text until each historical text is classified into a text category.
[0058] Step S102: grouping the text categories according to the number of historical texts they contain to obtain at least one text group; selecting a standard text from each text group as the text to be recommended.
[0059] Figure 3 Schematic diagram of text grouping according to the text recommendation method of an embodiment of the present invention. The grouping of text categories in this step can be based on Figure 3 Perform the following steps as shown:
[0060] Step S301: Arrange at least one text category in descending order according to the number of historical texts contained therein to form a category sequence; and use the part of the category sequence that is at the front and contains a first preset number of text categories as an initial category sequence to be grouped.
[0061] In this step, in order to reduce the computation time and realize the real-time statistics of the texts to be recommended, it is necessary to select the text categories containing more historical texts from all the text categories for grouping and discard the remaining text categories. The first preset number can be set according to the actual environment. For example, when the total number of text categories is 200 to 500, the first preset number can be set to 100.
[0062] S302: For the first text category in the current sequence of categories to be grouped, the subsequent text categories whose adjacency ratios are continuously not less than a preset ratio threshold are determined as categories of the same quantity as the first text category, the first text category and its categories of the same quantity are determined as a text group, and the text group is removed from the current sequence of categories to be grouped.
[0063] Specifically, the first text category is the text category with the largest number of historical texts in the current sequence of categories to be grouped. The adjacency ratio of each text category in the current sequence of categories to be grouped refers to the ratio of the number of historical texts contained in the text category and its previous text category (in the current sequence of categories to be grouped). The previous text category of a text category refers to the text category that is adjacent to the above text category and in its front direction (i.e., the direction in which the number of historical texts contained increases) in the current sequence of categories to be grouped. It can be understood that the first text category in the sequence of categories to be grouped does not have a corresponding adjacency ratio.
[0064] In particular, the text category whose adjacency ratio is continuously not less than a preset ratio threshold refers to: for this text category, first, its adjacency ratio is greater than or equal to a preset ratio threshold (such as 0.9); and in the current sequence of categories to be grouped, there is no text category in the front of this text category whose adjacency ratio is less than the ratio threshold.
[0065] S303: When it is determined that the number of current text groups is less than the second preset number, step S302 and step S303 are executed until the number of current text groups is equal to the second preset number, wherein the second preset number can be set according to business requirements and is less than the first preset number.
[0066] The process of grouping text categories can be shown in the following example:
[0067] If the initial sequence of categories to be grouped is: {a,b,c,d,e,f,g}, the number of historical texts from a to g gradually decreases, and the direction from g to a is the forward direction of the category sequence. If the number of historical texts from a to h is 100, 90, 85, 65, 50, 49, 45, respectively, then the adjacency ratios from b to g are: 0.9, 0.94, 0.76, 0.77, 0.98, 0.92, respectively. For b and c, their adjacency ratios are both greater than or equal to the ratio threshold of 0.9, and there is no text category with an adjacency ratio less than 0.9 in their forward directions, then b and c belong to "text categories with adjacency ratios that are continuously not less than the ratio threshold". For d and e, their adjacency ratios are less than 0.9, so they do not belong to "text categories with adjacency ratios that are continuously not less than the ratio threshold". For f and g, their adjacency ratios are both greater than 0.9, but in the current sequence of categories to be grouped (still the initial sequence of categories to be grouped), both of them have text categories d and e with adjacency ratios less than 0.9 in the forward direction, so f does not belong to the "text category with adjacency ratios continuously not less than the ratio threshold". Therefore, b and c are taken as the same quantity categories of a to form a text group with a, and a, b, and c are removed from {a, b, c, d, e, f, g}, thus realizing the establishment of the first text group.
[0068] If it is determined that the current number of text groups 1 is less than the second preset number 3, it is necessary to continue grouping. In the current sequence of categories to be grouped {d, e, f, g}, d is the first text category, and the adjacency ratios of e, f, and g are 0.77, 0.98, and 0.92, respectively. There is no "text category whose adjacency ratio is continuously not less than the ratio threshold", that is, the same quantity category of d is empty, then d is taken as the second text group alone and removed from {d, e, f, g}.
[0069] It is determined that the current number of text groups 2 is less than the second preset number 3, and further grouping is required. In the current sequence of categories to be grouped {e, f, g}, e is the first text category, and the adjacency ratios of f and g are 0.98 and 0.92 respectively, both of which are "text categories whose adjacency ratios are continuously not less than the ratio threshold", that is, the same quantity category of e, then e, f, and g are formed into the third text group, so that the current number of text groups is equal to the second preset number 3, and the grouping of text categories is ended.
[0070] After obtaining the second preset number of text groups, a standard text can be randomly selected from each text group, and the second preset number of standard texts can be recommended to the user as the texts to be recommended. It can be understood that the multiple texts to be recommended obtained through the above clustering and grouping have low similarity to each other (so there will be no similar or repeated recommendations), can cover more text categories (because each recommendation is randomly selected from a large number of text categories in the text group), and are all highly representative hot texts (each text to be recommended has more similar texts and a large number of repetitions). Recommending the above texts to users can effectively improve their experience.
[0071] In practical applications, for a large number of items, the above method can be used to determine multiple text groups for each item, and the corresponding multiple text groups can be stored in the distributed system database HBase with the SKU code of the item as the rowkey. When text recommendation is needed, the text data can be read from HBase.
[0072] It should be noted that, although the above mainly describes the technical solution of the present invention in the scenario of recommending historical consultation question texts to users, this does not mean that the application scenario of the present invention is limited to this. In fact, the present invention can be applied to any appropriate text recommendation scenario.
[0073] In the technical solution of the embodiment of the present invention, by automatically counting the texts to be recommended from a large number of historical texts and recommending them to users, the manual input of users is reduced, the user experience is improved, and the workload of customer service personnel is also reduced; when determining the texts to be recommended, firstly, the historical texts with higher similarity are classified into the same text category according to the similarity between the historical texts, and then, from the text categories containing a large number of historical texts, text categories containing a similar number of historical texts are selected to form a text group, and the standard text of each text group is used as the text to be recommended. Through the above processing, the multiple texts to be recommended recommended to the user have the following three characteristics: 1. They are not similar texts or repeated texts; 2. Each text to be recommended is a hot text with strong representativeness in the historical texts; 3. They can cover more text categories; thereby improving the accuracy and diversity of text recommendations and further improving the user experience.
[0074] Figure 4 Schematic diagram of the main components of the text recommendation device according to an embodiment of the present invention.
[0075] like Figure 4 As shown, the text recommendation device 400 of the embodiment of the present invention may include: a clustering module 401 and a recommendation model 402. Among them:
[0076] The clustering module 401 may be used to obtain a plurality of historical texts, and classify the plurality of historical texts into at least one text category according to the similarities between the historical texts;
[0077] The recommendation module 402 can be used to group the text categories according to the number of historical texts they contain to obtain at least one text group; select standard text from each text group as the text to be recommended; wherein the standard text of each text group is: the historical text with the largest number of repetitions in each text category of the text group.
[0078] In an embodiment of the present invention, each of the multiple historical texts corresponds to a generation time; and the clustering module 401 can be further used to perform the following steps: S201: an initial text set is formed by the multiple historical texts; S202: the historical text with the latest generation time in the current text set is determined as the basic text of the current text set, the historical text in the current text set whose similarity with the basic text meets the preset conditions is determined as the similar text of the basic text, the basic text and its similar texts are determined as a text category, and the text category is removed from the current text set; S203: when it is determined that the text set after removing the text category is not empty, execute steps S202 and S203; until each text in the initial text set is classified into a text category.
[0079] Exemplarily, the preset condition includes: the similarity is not less than a preset similarity threshold.
[0080] In an optional implementation, the recommendation module 402 can be further used to perform the following steps: S301: Arrange the at least one text category in descending order according to the number of historical texts contained therein to form a category sequence; use the part of the category sequence that contains a first preset number of text categories in the front as the initial category sequence to be grouped; S302: For the first text category in the current category sequence to be grouped, determine the subsequent text categories whose adjacency ratios are continuously not less than a preset ratio threshold as the same-quantity categories of the first text category, determine the first text category and its same-quantity categories as a text group, and remove the text group from the current category sequence to be grouped; wherein the adjacency ratio of each text category in the current category sequence to be grouped is: the ratio of the number of historical texts contained in the text category and its previous text category; S303: When it is determined that the number of the current text group is less than the second preset number, execute steps S302 and S303; until the number of the current text group is equal to the second preset number.
[0081] In a specific application, the device 400 may further include: a noise reduction module, which is used to detect noise data in the multiple historical texts using a pre-established language model after obtaining the multiple historical texts, and remove the detected noise data.
[0082] In actual application scenarios, the device 400 may further include: a text vector calculation module, which is used to determine the core words of each historical text among multiple historical texts from which noise data is removed, and use the sum of the word vectors of each core word as the text vector of the historical text; wherein the word vector is obtained in advance using a word vector calculation tool; and the similarity between any two historical texts is the cosine similarity determined using the text vectors of the two.
[0083] As a preferred solution, the multiple historical texts are: historical consultation question texts for the same object.
[0084] According to the technical solution of the embodiment of the present invention, by automatically counting the texts to be recommended from a large number of historical texts and recommending them to users, the manual input of users is reduced, the user experience is improved, and the workload of customer service personnel is also reduced; when determining the texts to be recommended, firstly, the historical texts with higher similarity are classified into the same text category according to the similarity between the historical texts, and then, from the text categories containing a large number of historical texts, text categories containing a similar number of historical texts are selected to form a text group, and the standard text of each text group is used as the text to be recommended. Through the above processing, the multiple texts to be recommended recommended to the user have the following three characteristics: 1. They are not similar texts or repeated texts; 2. Each text to be recommended is a hot text with strong representativeness in the historical texts; 3. They can cover more text categories; thereby improving the accuracy and diversity of text recommendations and further improving the user experience.
[0085] Figure 5 An exemplary system architecture 500 is shown to which the text recommendation method or text recommendation apparatus according to the embodiment of the present invention can be applied.
[0086] like Figure 5 As shown, the system architecture 500 may include terminal devices 501, 502, 503, a network 504 and a server 505 (this architecture is only an example, and the components included in the specific architecture may be adjusted according to the specific application). The network 504 is used to provide a medium for a communication link between the terminal devices 501, 502, 503 and the server 505. The network 504 may include various connection types, such as wired, wireless communication links or optical fiber cables, etc.
[0087] Users can use terminal devices 501, 502, 503 to interact with server 505 through network 504 to receive or send messages, etc. Various communication client applications can be installed on terminal devices 501, 502, 503, such as shopping applications, web browser applications, search applications, instant messaging tools, email clients, social platform software, etc. (only as examples).
[0088] The terminal devices 501 , 502 , and 503 may be various electronic devices having a display screen and supporting web browsing, including but not limited to smart phones, tablet computers, laptop computers, desktop computers, and the like.
[0089] The server 505 may be a server that provides various services, such as a backend management server (only an example) that provides support for shopping websites browsed by users using the terminal devices 501, 502, and 503. The backend management server may analyze and process the received data such as product information query requests, and feed back the processing results (such as target push information, product information - only an example) to the terminal device.
[0090] It should be noted that the text recommendation method provided in the embodiment of the present invention is generally executed by the server 505 , and accordingly, the text recommendation device is generally disposed in the server 505 .
[0091] It should be understood that Figure 5 The number of terminal devices, networks and servers in the embodiment is only for illustration. Any number of terminal devices, networks and servers may be provided according to the implementation requirements.
[0092] The present invention also provides an electronic device. The electronic device of an embodiment of the present invention includes: one or more processors; a storage device for storing one or more programs, when the one or more programs are executed by the one or more processors, the one or more processors implement the text recommendation method provided by the present invention.
[0093] Reference below Figure 6 , which shows a schematic diagram of the structure of a computer system 600 of an electronic device suitable for implementing an embodiment of the present invention. Figure 6 The electronic device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present invention.
[0094] like Figure 6 As shown, the computer system 600 includes a central processing unit (CPU) 601, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 602 or a program loaded from a storage part 608 into a random access memory (RAM) 603. In the RAM 603, various programs and data required for the operation of the computer system 600 are also stored. The CPU 601, the ROM 602, and the RAM 603 are connected to each other via a bus 604. An input / output (I / O) interface 605 is also connected to the bus 604.
[0095] The following components are connected to the I / O interface 605: an input section 606 including a keyboard, a mouse, etc.; an output section 607 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker, etc.; a storage section 608 including a hard disk, etc.; and a communication section 609 including a network interface card such as a LAN card, a modem, etc. The communication section 609 performs communication processing via a network such as the Internet. A drive 610 is also connected to the I / O interface 605 as needed. A removable medium 611, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 610 as needed so that a computer program read therefrom is installed into the storage section 608 as needed.
[0096] In particular, according to the embodiments disclosed in the present invention, the process described in the main step diagram above can be implemented as a computer software program. For example, an embodiment of the present invention includes a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program contains program code for executing the method shown in the main step diagram. In the above embodiment, the computer program can be downloaded and installed from the network through the communication part 609, and / or installed from the removable medium 611. When the computer program is executed by the central processing unit 601, the above functions defined in the system of the present invention are executed.
[0097] It should be noted that the computer-readable medium shown in the present invention may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present invention, a computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in combination with an instruction execution system, device or device. In the present invention, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, which carries a computer-readable program code. This propagated data signal may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. Computer readable signal media may also be any computer readable medium other than computer readable storage media, which may send, propagate or transmit a program for use by or in conjunction with an instruction execution system, apparatus or device. The program code contained on the computer readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wire, optical cable, RF, etc., or any suitable combination of the above.
[0098] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present invention. In this regard, each box in the flow chart or block diagram can represent a module, a program segment or a part of a code, and the above-mentioned module, program segment or a part of a code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram or flow chart, and the combination of the boxes in the block diagram or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0099] The modules involved in the embodiments of the present invention may be implemented by software or hardware. The modules described may also be arranged in a processor, for example, it may be described as: a processor includes a clustering module and a recommendation module. The names of these modules do not constitute a limitation on the modules themselves in some cases, for example, the clustering module may also be described as a "module for sending text categories to the recommendation module".
[0100] As another aspect, the present invention also provides a computer-readable medium, which may be included in the device described in the above embodiment; or may exist independently and not be installed in the device. The above computer-readable medium carries one or more programs, and when the above one or more programs are executed by the device, the steps executed by the device include: obtaining multiple historical texts, and classifying the multiple historical texts into at least one text category according to the similarity between the historical texts; grouping the text categories according to the number of historical texts contained therein to obtain at least one text group; selecting a standard text from each text group as the text to be recommended for recommendation; wherein the standard text of each text group is: the historical text with the largest number of repetitions in each text category of the text group.
[0101] According to the technical solution of the embodiment of the present invention, by automatically counting the texts to be recommended from a large number of historical texts and recommending them to users, the manual input of users is reduced, the user experience is improved, and the workload of customer service personnel is also reduced; when determining the texts to be recommended, firstly, the historical texts with higher similarity are classified into the same text category according to the similarity between the historical texts, and then, from the text categories containing a large number of historical texts, text categories containing a similar number of historical texts are selected to form a text group, and the standard text of each text group is used as the text to be recommended. Through the above processing, the multiple texts to be recommended recommended to the user have the following three characteristics: 1. They are not similar texts or repeated texts; 2. Each text to be recommended is a hot text with strong representativeness in the historical texts; 3. They can cover more text categories; thereby improving the accuracy and diversity of text recommendations and further improving the user experience.
[0102] The above specific implementations do not constitute a limitation on the protection scope of the present invention. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions may occur depending on design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.
Claims
1. A text recommendation method, characterized in that: Includes steps: Acquire a plurality of historical texts, and classify the plurality of historical texts into at least one text category according to similarities between the historical texts; The text categories are grouped according to the number of historical texts they contain to obtain at least one text grouping; a standard text is selected from each text grouping as the text to be recommended; wherein the standard text of each text grouping is: the historical text with the largest number of repetitions in each text category of the text grouping, and the text categories in the same text grouping contain a similar number of historical texts.
2. The method according to claim 1, characterized in that: Each of the plurality of historical texts corresponds to a generation time; and the step of classifying the plurality of historical texts into at least one text category according to the similarity between the historical texts comprises the steps of: S201: forming an initial text set from the plurality of historical texts; S202: Determine the latest generated historical text in the current text set as the basic text of the current text set, determine the historical text in the current text set whose similarity with the basic text meets a preset condition as the similar text of the basic text, determine the basic text and its similar text as a text category, and remove the text category from the current text set; S203: When it is determined that the text set after removing the text category is not empty, execute steps S202 and S203 until each text in the initial text set is classified into a text category.
3. The method according to claim 2, characterized in that The preset condition includes: the similarity is not less than a preset similarity threshold.
4. The method according to claim 1, characterized in that: The step of grouping the text categories according to the number of historical texts they contain to obtain at least one text group specifically includes: S301: Arrange the at least one text category in descending order according to the number of historical texts contained therein to form a category sequence; and use the portion of the category sequence that is at the front and contains a first preset number of text categories as an initial category sequence to be grouped; S302: For the first text category in the current sequence of categories to be grouped, determine the subsequent text categories whose adjacency ratios are continuously not less than a preset ratio threshold as the same quantity categories of the first text category, determine the first text category and its same quantity categories as a text group, and remove the text group from the current sequence of categories to be grouped; wherein the adjacency ratio of each text category in the current sequence of categories to be grouped is: the ratio of the number of historical texts contained in the text category and its previous text category; S303: When it is determined that the number of the current text groups is less than the second preset number, step S302 and step S303 are executed until the number of the current text groups is equal to the second preset number.
5. The method according to claim 1, characterized in that The method further comprises: After acquiring the plurality of historical texts, noise data in the plurality of historical texts is detected using a pre-established language model, and the detected noise data is removed.
6. The method according to claim 5, characterized in that The method further comprises: for each of the multiple historical texts from which noise data is removed, determining its core word, and taking the sum of the word vectors of each core word as the text vector of the historical text; wherein the word vector is obtained in advance using a word vector calculation tool; and, The similarity between any two historical texts is the cosine similarity determined using their text vectors.
7. The method according to any one of claims 1 to 6, characterized in that: The multiple historical texts are: historical consultation question texts for the same object.
8. A text recommendation device, characterized in that: include: A clustering module, used for acquiring a plurality of historical texts, and classifying the plurality of historical texts into at least one text category according to similarities between the historical texts; The recommendation module is used to group the text categories according to the number of historical texts they contain to obtain at least one text grouping; select standard text from each text grouping as the text to be recommended; wherein the standard text of each text grouping is: the historical text with the largest number of repetitions in each text category of the text grouping, and the text categories in the same text grouping contain a similar number of historical texts.
9. The device according to claim 8, characterized in that Each of the multiple historical texts corresponds to a generation time; and the clustering module is further used to perform the following steps: S201: an initial text set is formed by the multiple historical texts; S202: the historical text with the latest generation time in the current text set is determined as the basic text of the current text set, the historical text in the current text set whose similarity with the basic text meets the preset conditions is determined as the similar text of the basic text, the basic text and its similar texts are determined as a text category, and the text category is removed from the current text set; S203: when it is determined that the text set after removing the text category is not empty, execute steps S202 and S203; until each text in the initial text set is classified into a text category.
10. The device according to claim 9, characterized in that The preset condition includes: the similarity is not less than a preset similarity threshold.
11. The device according to claim 8, characterized in that The recommendation module is further used to perform the following steps: S301: Arrange the at least one text category in descending order according to the number of historical texts contained therein to form a category sequence; use the part of the category sequence that contains a first preset number of text categories in the front as the initial category sequence to be grouped; S302: For the first text category in the current category sequence to be grouped, determine the subsequent text categories whose adjacency ratios are continuously not less than a preset ratio threshold as the same-quantity categories of the first text category, determine the first text category and its same-quantity categories as a text group, and remove the text group from the current category sequence to be grouped; wherein the adjacency ratio of each text category in the current category sequence to be grouped is: the ratio of the number of historical texts contained in the text category and its previous text category; S303: When it is determined that the number of the current text group is less than the second preset number, execute steps S302 and S303; until the number of the current text group is equal to the second preset number.
12. The device according to claim 8, characterized in that The device further comprises: The noise reduction module is used to detect noise data in the multiple historical texts using a pre-established language model after the multiple historical texts are acquired, and remove the detected noise data.
13. The device according to claim 12, characterized in that The device further comprises: A text vector calculation module is used to determine the core word of each historical text among multiple historical texts with noise data removed, and use the sum of the word vectors of each core word as the text vector of the historical text; wherein the word vector is pre-obtained using a word vector calculation tool; and the similarity between any two historical texts is the cosine similarity determined using the text vectors of the two.
14. The device according to any one of claims 8 to 13, characterized in that: The multiple historical texts are: historical consultation question texts for the same object.
15. An electronic device, characterized in that: include: one or more processors; a storage device for storing one or more programs, When the one or more programs are executed by the one or more processors, the one or more processors implement the method according to any one of claims 1 to 7.
16. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the method according to any one of claims 1 to 7 is implemented.
