A method and device for establishing a document recommendation model
By extracting key sentences in the mapped document, building the main mapped text, and using predicted mapping information and real mapping information to train the document recommendation model, solving the problems of time-consuming, high cost and insufficient master mapped text in the existing technology, and achieving efficient and low-cost document recommendation model establishment and application.
Patent Information
- Application Number
- CN202010088746.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-02-12
- Publication Date
- 2025-06-17
- Estimated Expiration
- 2040-02-12
AI Technical Summary
When establishing a document recommendation model, the prior art requires professionals to read through the sample document and mark the real mapping relationship. It takes a long time, is costly and is easily restricted by personnel's professional requirements. There may be insufficient main mapping text, affecting the effectiveness of the model.
By extracting key sentences in the mapped document, building the main mapped text, and training it with the mapped document input document recommendation model, using predicted mapping information and real mapping information for model training until convergence, avoiding the problem of dependence on professionals and insufficient master mapped text.
It shortens the time for model establishment, reduces costs, and is not restricted by professional professional requirements, and effectively avoids the impact of insufficient master map text on the effectiveness of the model, improving the accuracy of document recommendations.
Smart Images

Figure CN113254605B_ABST
Abstract
Description
Technical Field
[0001] Embodiments of the present application relate to the field of computers, and in particular, to a method and apparatus for establishing a document recommendation model. Background Art
[0002] With the development of computer technology and storage technology, the number of stored documents is extremely large. Users need to quickly find the documents that meet their needs among numerous and complicated documents.
[0003] For example, during the tender response process of software products, a customer will provide a Statement of Compliance (SOC) to describe the specific requirements for the software; after receiving the tender, the software provider needs to quickly find the software feature documents that can meet the requirements in the SOC from multiple software feature documents of the software products it can provide as Feature Descriptions (FDs) to respond to the SOC and improve the tender success rate.
[0004] Currently, document recommendation is mainly achieved by methods such as retrieving keywords and calculating document similarity. However, due to differences in writing language habits, there may be cases where the keywords of the requirements do not exist in the document, or the same content is described as different texts due to different language habits, resulting in low text similarity. Therefore, it is very difficult to achieve accurate document search using conventional keyword retrieval and document similarity calculation.
[0005] In response to the above phenomenon, the industry has proposed a model for building a mapped document library (a collection of multiple documents to be queried, also known as a queried document library). When a main mapped text (also known as a requirement text, which includes a paragraph) is input into the model, the model recommends the documents in the mapped document that are relevant to the main mapped text. The process of building the model includes: obtaining sample documents (including the main mapped text and the mapped document library), manually reading through the sample documents and marking which mapped documents are relevant to the main mapped text as the true mapping relationship, and using the sample documents with the marked mapping relationship as the training data set; then inputting the training data set into a language model to obtain the vector data of each document, inputting the vector data into a text classification model to obtain the predicted mapping relationship between the main mapped text and the mapped document in the sample documents; finally, training the model based on the predicted mapping relationship and the true mapping relationship to improve the accuracy of model prediction.
[0006] However, the above model building process requires professionals to read through the sample documents and mark the true mapping relationship, which is time-consuming, requires high professional skills of personnel, and has high labor costs; and there are defects that the lack of main mapped text in the sample data affects the effectiveness of the model. Summary of the Invention
[0007] The present application provides a method and device for establishing a document recommendation model, which can shorten the time consumption, is not limited by the professional requirements of personnel, and has low cost, while avoiding the influence of insufficient main mapping texts on the effectiveness of the model.
[0008] To achieve the above object, the present application adopts the following technical solutions:
[0009] In a first aspect, the present application provides a method for establishing a document recommendation model, which may include: obtaining a plurality of mapped documents; extracting key sentences from each mapped document; constructing one or more main mapping texts, where the main mapping text includes one or more key sentences; inputting each main mapping text and each mapped document into the document recommendation model to obtain prediction mapping information of each main mapping text and each mapped document; the prediction mapping information is used to indicate whether the main mapping text and the mapped document are predicted to be relevant; training the document recommendation model until convergence according to the prediction mapping information and the true mapping information of each main mapping text and each mapped document; the true mapping information is used to indicate whether the main mapping text and the mapped document are truly relevant; the main mapping text is truly relevant to the mapped document to which the key sentence it contains belongs.
[0010] By the method of establishing a document recommendation model, during modeling, first extract the key sentences of the mapped documents, construct the key sentences into main mapping texts, and then establish the model through training with the established main mapping texts and the mapped documents. On the one hand, the main mapping text is composed of key sentences, and the true mapping relationship between the main mapping text and the mapped document is determined by the subordinate relationship, without the need for professional personnel to determine after reading through, which is time-consuming, not limited by the professional requirements of personnel, and has low cost, and can construct rich main mapping texts for modeling, effectively avoiding the influence of insufficient main mapping texts on the effectiveness of the model.
[0011] Among them, the document recommendation model is used to process the main mapping text and the mapped text input into it, predict the relevance of each main mapping text and each mapped text, and output prediction mapping information.
[0012] Combined with the first aspect, in a possible implementation manner, a plurality of mapped documents may be input by an administrator of the device for establishing a document recommendation model.
[0013] Combined with the first aspect or any of the above possible implementation manners, in a possible implementation manner, a plurality of mapped documents may be a set of mapped documents stored in the device for establishing a document recommendation model or the server where it is located.
[0014] Combined with the first aspect or any of the above possible implementation manners, in a possible implementation, the document recommendation model may be a first-level model configured to output prediction mapping information.
[0015] Combined with the first aspect or any of the above possible implementation manners, in a possible implementation manner, the document recommendation model may include two levels of models for prediction. The first-level model is a neural network for identifying the semantics of the text input into it and outputting it in the form of a vector, and the second-level model is a model for predicting relevance based on the vector.
[0016] Combined with the first aspect or any of the above possible implementation manners, in a possible implementation manner, the document recommendation model may include a language model and a text classification model. Input each main mapping text and each mapped document into the document recommendation model to obtain the predicted mapping information of each main mapping text and each mapped document, including: input each main mapping text and each mapped document into the language model to obtain the feature vectors of each main mapping text and each mapped document; the feature vectors are used to reflect the semantics of the documents; input the feature vectors of each main mapping text and each mapped document into the text classification model to obtain the predicted mapping information of each main mapping text and each mapped document.
[0017] Combined with the first aspect or any of the above possible implementation manners, in a possible implementation manner, the predicted mapping information may include: indication information for indicating whether it is relevant; or, a correlation probability value for indicating the degree of relevance. In this possible implementation manner, when the prediction information is a correlation probability value for indicating the degree of relevance, since the output of the document recommendation model is the correlation probability of the degree of relevance, the mapped document determined according to this probability value has higher accuracy.
[0018] Combined with the first aspect or any of the above possible implementation manners, in a possible implementation manner, constructing one or more main mapping texts may include: constructing one or more main mapping texts according to a preset rule. In this possible implementation manner, the preset rule can be configured according to the user's needs, which can meet the various needs of the user and make the application range of the document recommendation model wider.
[0019] Combined with the first aspect or any of the above possible implementation manners, in a possible implementation manner, the preset rule may include: constructing the key sentences included in a mapped document into a main mapping text.
[0020] Combined with the first aspect or any of the above possible implementation manners, in a possible implementation manner, the preset rule may include: constructing a key sentence into a main mapping text.
[0021] Combined with the first aspect or any of the above possible implementation manners, in a possible implementation manner, the preset rule may include: randomly selecting Q from the key sentences included in all the mapped documents as a main mapping text.
[0022] Wherein, Q is greater than or equal to 1.
[0023] Combined with the first aspect or any of the above possible implementation manners, in a possible implementation manner, the preset rules may include: dividing the key sentences included in all the mapped documents into L groups, and each group serves as a main mapped text.
[0024] Combined with the first aspect or any of the above possible implementation manners, in a possible implementation manner, the key sentence is a sentence in which the typicality index X of the mapped document is greater than or equal to the threshold.
[0025] Wherein, the calculation formula for calculating X of the first sentence in the first mapped document satisfies the following relationship: TF is the number of times the first sentence appears in the first mapped document; D is the total number of multiple mapped documents; M is the number of mapped documents among the multiple mapped documents that contain the first sentence, and a is a preset base number.
[0026] Combined with the first aspect or any of the above possible implementation manners, in a possible implementation manner, the true mapping information may include: indication information for indicating whether it is relevant; or, the association relationship between the main mapped text and the mapped document, and the mutually associated documents are truly relevant.
[0027] Combined with the first aspect or any of the above possible implementation manners, in a possible implementation manner, the method may further include: obtaining multiple domain texts, where the domain text is a text in the professional domain to which the mapped document belongs; training a language model based on the multiple domain texts until convergence. In this possible implementation manner, the text recommendation model obtained by training the language model with the domain text has a higher accuracy in implementing document recommendation because of its higher semantic recognition of the domain text.
[0028] Combined with the first aspect or any of the above possible implementation manners, in a possible implementation manner, the method may further include: obtaining a query text including a paragraph input by the user; inputting the query text into the document recommendation model to obtain Y mapped documents related to the query text; Y is greater than or equal to 1; outputting N mapped documents among the Y mapped documents to the user, and N is greater than or equal to 1.
[0029] Combined with the first aspect or any of the above possible implementation manners, in a possible implementation manner, outputting N mapped documents among the Y mapped documents to the user may include: if N is greater than or equal to Y, outputting the Y mapped documents to the user; if N is less than Y, outputting the first N mapped documents among the Y mapped documents with the highest to lowest degree of relevance to the query text to the user.
[0030] Second aspect, the present application provides an apparatus for establishing a document recommendation model, which is used to implement the method described in the first aspect above. The apparatus for establishing the document recommendation model may be a server or an apparatus that supports the server to implement the method described in the first aspect. For example, the apparatus includes a chip system. For example, the apparatus for establishing the document recommendation model may include: a first acquisition unit, an extraction unit, a construction unit, a processing unit, and a training unit.
[0031] The first acquisition unit is used to acquire a plurality of mapped documents.
[0032] The extraction unit is used to extract key sentences in each mapped document.
[0033] The construction unit is used to construct one or more main mapped texts, and the main mapped text includes one or more key sentences.
[0034] The processing unit is used to input each main mapped text and each mapped document into the document recommendation model to obtain prediction mapping information between each main mapped text and each mapped document; the prediction mapping information is used to indicate whether the main mapped text and the mapped document are predicted to be relevant.
[0035] The training unit is used to train the document recommendation model until convergence according to the prediction mapping information and the true mapping information of each main mapped text and each mapped document; the true mapping information is used to indicate whether the main mapped text and the mapped document are truly relevant; the main mapped text and the mapped document to which the key sentences it contains belong are truly relevant.
[0036] It should be noted that the specific implementation of each unit in the second aspect is the same as the corresponding method description in the first aspect, and will not be elaborated here. The functional modules in the second aspect above can be implemented by hardware or by hardware executing corresponding software. The hardware or software includes one or more modules corresponding to the above functions. For example, a transceiver is used to complete the functions of the receiving unit and the sending unit, a processor is used to complete the functions of the processing unit, and a memory is used to store program instructions for the processor to process the method of the embodiments of the present application. The processor, transceiver, and memory are connected through a bus and complete communication with each other.
[0037] Third aspect, the present application provides another apparatus for establishing a document recommendation model. The apparatus for establishing the document recommendation model can implement the functions in the above method examples. The functions can be implemented by hardware or by hardware executing corresponding software. The hardware or software includes one or more modules corresponding to the above functions. The apparatus for establishing the document recommendation model may exist in the form of a chip product.
[0038] In combination with the third aspect, in a possible implementation, the structure of the apparatus for establishing a document recommendation model includes a processor and a transceiver. The processor is configured to support the apparatus for establishing a document recommendation model to execute the corresponding functions in the above method. The transceiver is used to support the communication between the apparatus for establishing a document recommendation model and other devices. The apparatus for establishing a document recommendation model may further include a memory, which is coupled to the processor and stores the necessary program instructions and data of the apparatus for establishing a document recommendation model.
[0039] In a fourth aspect, a computer-readable storage medium is provided, including instructions that, when running on a computer, cause the computer to execute the method for establishing a document recommendation model provided in any of the above aspects or any possible implementation.
[0040] In a fifth aspect, a computer program product containing instructions is provided that, when running on a computer, causes the computer to execute the method for establishing a document recommendation model provided in any of the above aspects or any possible implementation.
[0041] In a sixth aspect, an embodiment of the present application provides a chip system, which includes a processor and may further include a memory for implementing the functions in the above method. The chip system may be composed of chips or may include chips and other discrete devices.
[0042] It should be noted that, for any possible implementation of any of the above aspects, combinations can be made on the premise that the solutions do not conflict. BRIEF DESCRIPTION OF THE DRAWINGS
[0043] Figure 1 A schematic diagram of a process for establishing a model for a mapped document library provided by the prior art;
[0044] Figure 2 A schematic diagram of a document recommendation system provided by the present application;
[0045] Figure 3 A schematic diagram of an apparatus for establishing a document recommendation model provided by the present application;
[0046] Figure 4 A schematic diagram of a method flow for establishing a document recommendation model provided by an embodiment of the present application;
[0047] Figure 5 A schematic diagram of another method flow for establishing a document recommendation model provided by an embodiment of the present application;
[0048] Figure 6 A schematic diagram of the structure of another apparatus for establishing a document recommendation model provided by the present application;
[0049] Figure 7 This is a schematic structural diagram of another device for establishing a document recommendation model provided by this application;
[0050] Figure 8 This is a schematic structural diagram of another device for establishing a document recommendation model provided by this application. Specific embodiments
[0051] In the description of this application, terms such as "first", "second", and "third" in the specification, claims, and above-mentioned drawings of this application are used to distinguish different objects, rather than to limit a specific order.
[0052] In the embodiments of this application, words such as "exemplary" or "for example" are used to represent examples, illustrations, or explanations. Any embodiment or design solution described as "exemplary" or "for example" in the embodiments of this application should not be construed as being more preferred or having more advantages than other embodiments or design solutions. Rather, the use of words such as "exemplary" or "for example" is intended to present relevant concepts in a specific manner for easy understanding.
[0053] In the description of this application, unless otherwise specified, " / " indicates that the objects associated before and after are in an "or" relationship. For example, A / B can represent A or B; "and / or" in this application is merely a description of the association relationship of associated objects, indicating that three relationships can exist. For example, A and / or B can represent: A exists alone, A and B exist simultaneously, and B exists alone. These three situations, where A and B can be singular or plural. And, in the description of this application, unless otherwise specified, "multiple" means two or more than two. "At least one (item)" or its similar expression refers to any combination of these items, including any combination of single item (item) or plural items (items). For example, at least one (item) of a, b, or c can represent: a, b, c, a - b, a - c, b - c, or a - b - c, where a, b, c can be single or multiple.
[0054] In the embodiments of this application, at least one can also be described as one or more, and multiple can be two, three, four, or more. This application does not make limitations.
[0055] For ease of understanding, the nouns involved in this application are first explained.
[0056] A sentence is the basic unit of written language application. It is composed of words and phrases (phrases) and can express a complete meaning. There are relatively large pauses between different sentences, and the end of a sentence can have end-of-sentence marks such as a period, a question mark, an ellipsis, or an exclamation point.
[0057] Text refers to the form of expressing information through written language. A text contains a paragraph, and a paragraph can refer to a single sentence or a combination of multiple sentences with complete and systematic meanings.
[0058] A document refers to a collection of texts stored on a computer with a fixed name and fixed format. The documents described in this application refer to computer-recognizable documents, including but not limited to text information, program information, or others. For example, common documents include txt documents, doc documents, docx documents, pdf documents, etc.
[0059] A mapped document can refer to a document stored on a server for being queried. For example, during the tender response process of a software product, the mapped documents can be multiple FDs.
[0060] The main mapped text can refer to the text as a requirement, used to query related documents in the mapped documents. Among them, the main mapped text can be a text paragraph composed of one or more sentences. For example, the main mapped text in the embodiments of this application can be a text paragraph composed of the key sentences of the mapped documents.
[0061] The main mapped document can refer to the document as a requirement, containing one or more main mapped texts. For example, during the tender response process of a software product, the main mapped document can be an SOC, and each paragraph in the SOC can be used as the main mapped text.
[0062] A language model is a model based on a deep neural network, whose function is to identify the semantics and / or grammar in the text sequence input into it and output the recognized content in vector form. The role of the language model is to quantitatively represent the text, that is, to transform the text into a vector. The physical meaning is to represent the similarities and differences between one text and another text through multi-dimensional features. For example, language models can include: word2vec model, glove model, bert model.
[0063] A general language model can refer to a language model not limited to a specific domain.
[0064] A domain language model is obtained by training a general language model with texts in a specific professional domain to get a language model for that professional domain.
[0065] Document recommendation can refer to the process of finding and recommending documents related to the main mapped text in the mapped documents. Documents related to the main mapped text can express the meaning of the main mapped text or cover the text that expresses the meaning of the main mapped text.
[0066] A document recommendation model refers to a model for document recommendation for a group of mapped documents, used to find and recommend documents related to the main mapped text from this group of mapped documents.
[0067] Currently, the industry has proposed a method for establishing a model for a mapped document library, and document recommendations are realized through this model.
[0068] Figure 1 Illustrates a process for establishing a model for a mapped document library, which may include but is not limited to S101 and S102.
[0069] S101. Manually construct a training data set according to sample data.
[0070] S101 can be implemented as: Multiple main mapped texts and multiple mapped documents can be obtained as sample data through sample accumulation or other means. After professionals read all the main mapped texts and mapped documents in the sample data, mark the true mapping relationship between the main mapped text and the mapped document, and the sample data marked with the true mapping relationship is called the training data set.
[0071] It should be noted that when the requirement document contains document texts in multiple paragraphs, the document is segmented first, and each paragraph is used as a main mapped text to construct the training data set.
[0072] S102. Train a model for the mapped document library through the training data set.
[0073] Specifically, in S102, the training data set constructed in S101 can be input into the language model to obtain the vectors of the main mapped text and the mapped document, and the vector data is input into the text classification model. The text classification model outputs the predicted mapping relationship (whether relevant or the probability of relevance) between each main mapped text and each mapped document; then, according to the predicted mapping relationship and the true mapping relationship between each main mapped text and each mapped document, train the text classification model and / or the language model until convergence, and use the trained language model and text classification model as the model for the mapped document library.
[0074] After the model for the mapped document library is established, the specific recommendation process using this model is: Input the main mapped text (a text paragraph) into this model, and the model outputs one or more mapped documents related to the main mapped text.
[0075] However, when constructing the training data set in S101, professionals need to read all the main mapped texts and mapped documents in the sample data, and then manually judge the relevance (true mapping relationship) between each main mapped text and each mapped document. This process takes a long time, requires high professional skills of personnel, and has a high labor cost. In addition, in the above process of establishing the model, there may be a situation where the main mapped texts in the sample data are insufficient, resulting in insufficient effectiveness of the established model.
[0076] Based on this, an embodiment of the present application provides a method for establishing a document recommendation model. By extracting the key sentences of the mapped documents, constructing the key sentences into the main mapped text, and then training the established main mapped text and the mapped documents to establish a model. On the one hand, the main mapped text consists of key sentences, and the true mapping relationship between the main mapped text and the mapped documents is determined by the subordinate relationship, without the need for professionals to read through and determine, which takes less time, is not restricted by the professionalism of personnel, and has low cost. Moreover, a rich main mapped text for modeling can be constructed, effectively avoiding the impact of insufficient main mapped text on the effectiveness of the model.
[0077] The implementation manners of the embodiments of the present application will be described in detail below with reference to the accompanying drawings.
[0078] The method for establishing a document recommendation model provided by the embodiment of the present application is applied to Figure 2 the document recommendation system shown in the figure. As Figure 2 shown in the figure, the document recommendation system 20 may include a server 201 and an administrator 202.
[0079] Among them, the administrator 202 operates on the server 201 through the human-computer interaction interface of the server 201. Optionally, the human-computer interaction interface of the server 201 may be configured in the server 201, or the human-computer interaction interface of the server 201 may be configured in other devices used in matching with the server 201.
[0080] The administrator 202 may input the main mapped text through the human-computer interaction interface of the server 201, and the server 201 is used to search for and obtain relevant mapped documents and recommend them to the administrator 202 through its human-computer interaction interface.
[0081] Furthermore, the server 201 may include a document recommendation model 2011 and a mapped document library 2012. The server 201 may establish a document recommendation model 2011 for the mapped documents in the mapped document library 2012 through the solution provided by the present application. The server 201 may also be used to, when receiving the main mapped text input by the administrator 202, search the mapped document library 2012 through the document recommendation model 2011 to obtain the mapped documents related to the main mapped text for recommendation.
[0082] Among them, the server 201 may be a physical server, or a cloud server, or other devices with data processing capabilities and storage capabilities, and the present application does not limit this.
[0083] Optionally, the document recommendation model 2011 and the mapped document library 2012 included in the server 201 may exist in groups, and the server 201 may include multiple groups of document recommendation models 2011 and mapped document libraries 2012.
[0084] The following specifically elaborates on the method and apparatus for establishing a document recommendation model provided by the embodiments of the present application in conjunction with the accompanying drawings.
[0085] On the one hand, the embodiments of the present application provide an apparatus for establishing a document recommendation model, which is used to execute the method for establishing a document recommendation model provided by the present application. The apparatus for establishing a document recommendation model can be deployed in Figure 2 the server 201 in the document recommendation system 20 as shown, and the apparatus for establishing a document recommendation model can be part or all of the server 201. Alternatively, the apparatus for establishing a document recommendation model can also be independently deployed, and the apparatus for establishing a document recommendation model can be an electronic device or a chip system with relevant data processing and storage capabilities.
[0086] Figure 3 Figure 30 shows an apparatus 30 for establishing a document recommendation model provided by the embodiments of the present application. As Figure 3 shown, the apparatus 30 for establishing a document recommendation model can include a processor 301, a memory 302, and a transceiver 303.
[0087] The following specifically introduces each component of the apparatus 30 for establishing a document recommendation model in conjunction with Figure 3 the accompanying drawings:
[0088] Among them, the memory 302 can be a volatile memory, such as a random-access memory (RAM); or a non-volatile memory, such as a read-only memory (ROM), a flash memory, a hard disk drive (HDD), or a solid-state drive (SSD); or a combination of the above types of memories, and is used to store program codes, application programs, configuration files, data information, or other content that can implement the method of the present application.
[0089] The processor 301 is the control center of the device 30 for establishing a document recommendation model. For example, the processor 301 can be a central processing unit (CPU), or an application-specific integrated circuit (ASIC), or one or more integrated circuits configured to implement the embodiments of the present application, such as one or more digital signal processors (DSPs), or one or more field programmable gate arrays (FPGAs).
[0090] The transceiver 303 is used for information interaction between the device 30 for establishing a document recommendation model and other devices.
[0091] Specifically, the processor 301 performs the following functions by running or executing software programs and / or modules stored in the memory 302:
[0092] Obtain multiple mapped documents; extract the key sentences of each mapped document; construct one or more main mapped texts, where the main mapped text includes one or more key sentences; input each main mapped text and each mapped document into the document recommendation model to obtain the predicted mapping information between each main mapped text and each mapped document; the predicted mapping information is used to indicate whether the main mapped text and the mapped document are predicted to be relevant; train the document recommendation model until convergence according to the predicted mapping information and the true mapping information of each main mapped text and each mapped document; the true mapping information is used to indicate whether the main mapped text and the mapped document are truly relevant; the main mapped text is truly relevant to the mapped document to which the key sentence it contains belongs.
[0093] On the other hand, the embodiments of the present application provide a method for establishing a document recommendation model, which is used to establish a document recommendation model for a set of mapped documents, and the model is used to select documents related to the main mapped text from the set of mapped documents.
[0094] For the convenience of processing, each main mapped text and each mapped document can be numbered or identified. During the processing of this solution, the numbers or identifiers are transmitted, and the processor obtains the corresponding text or document according to the numbers or identifiers for corresponding processing.
[0095] As Figure 4 shown, the method may include:
[0096] S401. The device for establishing a document recommendation model obtains multiple mapped documents.
[0097] In a possible implementation, multiple mapped documents can be input by the administrator of the device that establishes the document recommendation model.
[0098] In another possible implementation, multiple mapped documents can be a set of mapped documents stored in the device that establishes the document recommendation model or the server where it is located.
[0099] Specifically, in S401, the device that establishes the document recommendation model obtains the format of each mapped document by detecting the suffix name of each mapped document (such as.pdf or.doc, etc.), and then calls the decoder that matches the format to read the content of each mapped document.
[0100] S402: The device that establishes the document recommendation model extracts the key sentences from each mapped document.
[0101] In a possible implementation, in S402, each mapped document can be regarded as a whole, and the key sentences in each mapped document are identified and extracted.
[0102] Specifically, in S402, the paragraphs included in each mapped document can be identified first, then the sentences in the paragraphs can be identified, and then the key sentences in the mapped document can be determined and extracted. For example, the device that establishes the document recommendation model uses a paragraph segmentation algorithm for each mapped document to identify the paragraphs of each mapped document, and uses a sentence splitting algorithm to identify the sentences. The types of the paragraph segmentation algorithm and the sentence splitting algorithm are not limited in this application.
[0103] Among them, the key sentence can be a sentence whose typicality index X in the mapped document is greater than or equal to the threshold. Specifically, to determine the key sentence in the mapped document, first calculate the typicality index of each sentence in its corresponding mapped document, and then compare it with the threshold. Among them, the threshold can be configured according to the user's experience, and this application does not limit this.
[0104] It should be noted that the method for calculating the typicality index of each sentence is the same. This application only takes the example of calculating the typicality index of a sentence in a mapped document for illustration, and others will not be elaborated one by one.
[0105] Optionally, the method for calculating the sentence typicality index can be based on the term frequency–inverse document frequency (TF-IDF) algorithm, or the TextRank algorithm, or the latent dirichlet allocation (LDA) algorithm, or any algorithm that can calculate the typicality index to calculate the sentence typicality index. This application does not make specific limitations on this.
[0106] Exemplarily, the calculation formula for calculating the typicality index X of the first sentence in the first mapped document based on the TF-IDF algorithm satisfies the following relationship: Wherein, TF is the number of times the first sentence appears in the first mapped document; D is the total number of the multiple mapped documents obtained in S401; M is the number of the mapped documents containing the first sentence among the multiple mapped documents obtained in S401, and a is a preset base number. The first sentence is any sentence included in the multiple mapped documents obtained in S401, and the first mapped document is any document among the multiple mapped documents obtained in S401 that contains the first sentence.
[0107] Wherein, the value of a can be configured according to actual requirements, and the present application does not limit it. For example, a can be 10 or the natural constant e or others.
[0108] For example, a mapped document a is as follows. After using the sentence splitting algorithm on this mapped document, the following sentences b and c are obtained.
[0109] Among them, the mapped document a: "When the customers of CBS system are consuming, charging, paying, and so on, after the customer information will change, the third party system obtains… When a CBS subscriber uses services, makes a recharge, makes a payment, or performs other activities which lead subscriber information changes, this feature enables CBS to……".
[0110] Sentence b: "When the customers of CBS system are consuming, charging, paying, and so on, after the customer information will change, the third party system obtains…".
[0111] Sentence c: "When a CBS subscriber uses services, makes a recharge, makes a payment, or performs other activities which lead to subscriber information changes, this feature enables CBS to……".
[0112] Suppose there are 10 mapped documents in total, and mapped document a is one of them. Among the 10 mapped documents, 2 mapped documents contain sentence b, and 5 mapped documents contain sentence c. Sentence b appears 2 times in mapped document a, and sentence c appears 3 times in mapped document a. Calculate the typicality indicators of sentence b and sentence c in mapped document a respectively as follows:
[0113] Typical value indicator of sentence b in mapped document a
[0114] Typical value indicator of sentence c in mapped document a
[0115] Suppose the threshold is 3, Xb is greater than the threshold, and Xc is less than the threshold. It can be determined that sentence b is a key sentence of mapped document a.
[0116] S403. The device for establishing a document recommendation model constructs one or more main mapped texts.
[0117] Among them, the main mapped text may include one or more key sentences among the key sentences included in the foregoing multiple mapped documents.
[0118] Optionally, S403 may have multiple implementation solutions, which may include but are not limited to the following implementation solution 1 or implementation solution. Implementation solution 1: The device for establishing a document recommendation model constructs one or more main mapped texts according to a preset rule.
[0119] Among them, the preset rule can be set according to the user's needs, and this application does not limit it. Exemplarily, the preset rule may include but is not limited to any of the following rules:
[0120] Rule 1: Construct the key sentences included in a mapped document into a main mapped text.
[0121] In Rule 1, the number of constructed main mapped texts is the same as the number of mapped documents.
[0122] Rule 2: Construct a key sentence into a main mapped text.
[0123] In Rule 2, the number of constructed main mapping texts is the same as the number of key sentences included in the mapped documents.
[0124] Rule 3: Randomly select Q key sentences from all the key sentences included in the mapped documents as a main mapping text. Here, Q is greater than or equal to 1.
[0125] Among them, the value of Q can be configured according to actual needs, and the embodiments of the present application do not limit it.
[0126] It should be noted that when using Rule 3, when the total number of key sentences included in all the mapped documents is not an integer multiple of Q, it is allowed that the number of key sentences included in a certain main mapping text is less than Q.
[0127] Rule 4: Divide all the key sentences included in the mapped documents into L groups, and each group is used as a main mapping text. Here, L is greater than or equal to 1.
[0128] It should be noted that when using Rule 4, when the total number of key sentences included in all the mapped documents is not an integer multiple of L, it is allowed that the number of key sentences included in different main mapping texts is different.
[0129] The above preset rules are only for illustrative purposes and do not constitute specific limitations.
[0130] Implementation solution 2: The device for establishing a document recommendation model constructs one or more main mapping texts according to requirements.
[0131] For example, in the process of tender response for software products, the key sentences describing the same software function in the FD document can be constructed into a main mapping text.
[0132] Furthermore, by constructing the main mapping text in S403, the true mapping relationship between the main mapping text and the mapped document can be obtained, that is, the main mapping text is truly related to the mapped document to which the key sentences it contains belong.
[0133] S404: The device for establishing a document recommendation model inputs each main mapping text and each mapped document into the document recommendation model to obtain the predicted mapping information of each main mapping text and each mapped document.
[0134] Among them, the predicted mapping information is used to indicate whether the main mapping text and the mapped document are predicted to be related.
[0135] In a possible implementation manner, the predicted mapping information may include: indication information for indicating whether it is related. When this indication information is used to indicate whether the main mapping text and the mapped document are predicted to be related, it can indicate two results: related or not related.
[0136] Specifically, the content and form of the indication information used to indicate whether it is relevant can be configured according to actual needs, and the embodiments of the present application do not limit this.
[0137] For example, the indication information can be 0 (indicating not relevant) or 1 (indicating relevant). Or, the indication information can be false (indicating not relevant) or true (indicating relevant).
[0138] For example, the prediction mapping information can be: (Z1, B1, 0), (Z1, B2, 1), where the first position in the parentheses is the number of the main mapping text, the second position is the number of the mapped text, and the third position is the document indication information for the first two positions. (Z1, B1, 0) indicates that the main mapping text Z1 is not relevant to the mapped document B1, and (Z1, B2, 1) indicates that the main mapping text Z1 is relevant to the mapped document B2.
[0139] In another possible implementation, the prediction mapping information can include: a correlation probability value used to indicate whether the relevant program is relevant. When this correlation probability value is used to indicate whether the main mapping text and the mapped document are predicted to be relevant, two results can be indicated in combination with a relevant threshold: if the correlation probability value is greater than the relevant threshold, it indicates relevance, if the correlation probability value is less than the relevant threshold, it indicates irrelevance, and if the correlation probability value is equal to the relevant threshold, it can be configured according to actual needs to indicate relevance or irrelevance.
[0140] Among them, the specific value of the relevant threshold can be configured according to actual needs, and the embodiments of the present application do not limit this.
[0141] For example, the prediction mapping information is: (Z1, B1, 0.3), (Z1, B2, 0.9), where the first position in the parentheses is the number of the main mapping text, the second position is the number of the mapped text, and the third position is the correlation probability value of the document for the first two positions. Assuming the relevant threshold is 0.5, (Z1, B1, 0.3) indicates that the main mapping text Z1 is not relevant to the mapped document B1, and (Z1, B2, 0.9) indicates that the main mapping text Z1 is relevant to the mapped document B2.
[0142] Among them, the document recommendation model is used to process the input main mapping text and mapped text, predict the relevance of each main mapping text and each mapped text, and output the prediction mapping information.
[0143] In one possible implementation, the document recommendation model can be a first-level model configured to output prediction mapping information, and the embodiments of the present application do not limit the architecture and type of this document recommendation model. This model can be a neural network.
[0144] In another possible implementation, the document recommendation model may include two levels of models for prediction. The first-level model is a neural network that is used to identify the semantics of the text input into it and output it in the form of a vector. The second-level model is a model that is used to predict the relevance based on the vector.
[0145] For example, the first-level model can be a language model, which is used to identify the semantics of the text input into it and output it in the form of a vector. Exemplarily, the language model may include: word2vec model, glove model, bert model.
[0146] For example, the second-level model can be a text classification model, which is used to identify the relevance between the main mapping text and the mapped document and output the preset mapping information. Exemplarily, the text classification model may include: logistic regression model, multi-layer perceptron, neural network model.
[0147] Furthermore, the language model can be a general language model or a domain language model.
[0148] In order to improve the domain adaptability of the model and thus improve the prediction accuracy, the general language model can be subjected to domain training. The details of the domain training process are described in the following steps S406 to S407 and will not be elaborated here.
[0149] Specifically, when the document recommendation model includes a language model and a text classification model, S404 can be specifically implemented as S4041 and S4042.
[0150] S4041. The device for establishing the document recommendation model inputs each main mapping text and each mapped document into the language model to obtain the feature vectors of each main mapping text and each mapped document.
[0151] Among them, the feature vector is used to reflect the semantics of the document.
[0152] Optionally, in S4041, the device for establishing the document recommendation model can input each main mapping text and each mapped document itself, or input the numbers or identifiers of each main mapping text and each mapped document into the language model. The language model processes the corresponding text or document according to the number or identifier and outputs the feature vectors of each main mapping text and each mapped document.
[0153] S4042. The device for establishing the document recommendation model inputs the feature vectors of each main mapping text and each mapped document into the text classification model to obtain the predicted mapping information of each main mapping text and each mapped document.
[0154] For example, the prediction mapping information obtained by the device for building a document recommendation model can be as shown in Table 1. The prediction mapping information shown in Table 1 includes indication information for indicating whether it is relevant. When the indication information is 0, it means not relevant, and when it is 1, it means relevant.
[0155] Table 1
[0156]
[0157]
[0158] It should be noted that Table 1 only illustrates the prediction mapping information by way of example and does not specifically limit it.
[0159] S405. The device for building a document recommendation model trains the document recommendation model until convergence according to the prediction mapping information, the true mapping information of each main mapping text and each mapped document.
[0160] Among them, the true mapping information is used to indicate whether the main mapping text and the mapped document are truly relevant. The main mapping text is truly relevant to the mapped document to which the key sentence it contains belongs.
[0161] Optionally, the true mapping information may include: indication information for indicating whether it is relevant, or the association relationship between the main mapping text and the mapped document. Documents that are mutually associated are relevant.
[0162] For example, when the true mapping information includes the association relationship between the main mapping text and the mapped document, the true mapping information can be as shown in Table 2. As shown in Table 2, the main mapping text Z1 is relevant to the mapped documents B2 and B3.
[0163] Table 2
[0164]
[0165] It should be noted that Table 2 only illustrates the true mapping relationship by way of example and does not specifically limit it.
[0166] Specifically, S405 can be specifically implemented as: The device for building a document recommendation model calculates the difference between the true mapping information and the prediction mapping information according to the prediction mapping information, the true mapping information of each main mapping text and each mapped document. If the difference is greater than the training threshold, the document recommendation model is trained in the reverse direction (adjusting the parameters of the document recommendation model, such as weights, biases, etc.), and then prediction is performed to obtain new prediction mapping information, and the difference between the true mapping information and the prediction mapping information is calculated until the difference is less than the training threshold, then the document recommendation model has converged.
[0167] Among them, the difference between the true mapping information and the predicted mapping information can be the similarity between the two, or other factors such as the proportion of different parts, which are not limited in the embodiments of the present application.
[0168] It should be noted that the value of the training threshold can be configured according to actual needs, and the embodiments of the present application do not specifically limit this either. For the case where the difference between the true mapping information and the predicted mapping information is equal to the training threshold, it can be configured to perform backpropagation training or not perform backpropagation training according to actual needs.
[0169] For the method of backpropagation training, the embodiments of the present application do not limit it either. For example, the error backpropagation (BP) algorithm can be used for backpropagation training.
[0170] Optionally, when the document recommendation model includes multiple models, backpropagation training of the document recommendation model can train some or all of the models.
[0171] In a possible implementation, when the document recommendation model includes a language model and a text classification model, the device for establishing the document recommendation model in S405 can train the text classification model in the document recommendation model until the text classification model converges.
[0172] Exemplarily, the process of training the text classification model can be: when the device for establishing the document recommendation model determines that the predicted mapping information of each main mapping text and each mapped document is different from the true mapping information, then adjust the weights and biases in the training text classification model through backpropagation until the text classification model converges.
[0173] In a possible implementation, when the document recommendation model includes a language model and a text classification model, the device for establishing the document recommendation model in S405 can train the text classification model and the language model in the document recommendation model until convergence.
[0174] Exemplarily, training the text classification model and the language model can be: when the device for establishing the document recommendation model determines that the predicted mapping information of each main mapping text and each mapped document is different from the true mapping information, adjust the weights and biases in the training text classification model and the language model through backpropagation until convergence.
[0175] Optionally, the text classification model can be trained by the device for establishing the document recommendation model, or the device for establishing the document recommendation model can request other devices to train it.
[0176] The present application does not limit the method of training the text classification model and fine-tuning the language model at the same time.
[0177] The embodiments of the present application provide a method for establishing a document recommendation model. By extracting key sentences from the mapped document, constructing the key sentences into the main mapped text, and then training the established main mapped text and the mapped document to establish a model. On the one hand, the main mapped text consists of key sentences, and the true mapping relationship between the main mapped text and the mapped document is determined by the subordinate relationship, without the need for professionals to read through and determine, which takes a short time, is not restricted by the professionalism of personnel, and has low cost. Moreover, rich main mapped texts for modeling can be constructed, effectively avoiding the influence of insufficient main mapped texts on the effectiveness of the model.
[0178] It should be noted that if the language types of the main mapped text and the mapped document in the embodiments of the present application are not limited, and if the main mapped text and the mapped document are of the same language type (for example, both are English), directly execute the method for establishing a document recommendation model provided in the embodiments of the present application.
[0179] If the main mapped text and the mapped document do not belong to the same language type (for example, the main mapped text is English and the mapped document is Chinese), at this time, it is necessary to first convert the main mapped text and the mapped document into the same language type (English or Chinese), and then execute the method for establishing a document recommendation model provided in the embodiments of the present application.
[0180] The present application does not make specific limitations on the way of language conversion. Exemplarily, after converting the main mapped text and the mapped document into texts of the same language on other devices, they can be imported into the device for establishing a document recommendation model of the present application, or the device for establishing a document recommendation model of the present application can directly perform language conversion (for example, language conversion can be achieved through the bert language model).
[0181] Furthermore, in order to improve the domain adaptability of the model and improve the prediction accuracy, the general language model can be domain-trained, such as Figure 5 As shown, before S404, the method for establishing a document recommendation model provided by the embodiments of the present application may further include S406 and S407.
[0182] S406: The device for establishing a document recommendation model obtains multiple domain texts.
[0183] Among them, the domain text can be the text of the professional field to which the mapped document belongs.
[0184] For example, the domain text may include industry standard documents, all historical main mapped texts, and mapped documents, etc. in the professional field to which the mapped document belongs.
[0185] For example, if the professional field to which the mapped document belongs is a billing software system, then the publicly available billing standard document is used as the domain document.
[0186] S407. The device for establishing a document recommendation model trains a language model based on multiple domain texts until convergence.
[0187] Among them, the language model is the language model included in the document recommendation model.
[0188] Specifically, in S407, the device for establishing a document recommendation model first adjusts the output layer of the language model to predict the missing part in the text, and then performs domain training on the language model.
[0189] Among them, the process of domain training can be: randomly delete some words in each domain text, input each domain text with some words deleted into the language model, analyze the semantics of each domain text by the language model, predict the missing part of each domain text, if the predicted missing part is different from the deleted part, adjust the weights and biases in the language model through backpropagation until the predicted missing part is the same as the deleted part, and at this time the language model converges. The language model after domain training is called a domain language model.
[0190] Furthermore, after the domain training is completed, the output layer of the language model can be adjusted so that the output of the language model is vector data.
[0191] The method of using domain texts to train the language model in this application is not limited.
[0192] Optionally, the language model can be trained by the device for establishing a document recommendation model, or the device for establishing a document recommendation model can request other devices to train it.
[0193] Furthermore, as Figure 5 shown, the method for establishing a document recommendation model provided in the embodiments of this application may further include S408 to S410.
[0194] S408. The device for establishing a document recommendation model obtains a query text including a paragraph input by the user.
[0195] In a possible implementation, the user inputs a paragraph, and this paragraph is used as the query text in S408.
[0196] In another possible implementation, the user inputs multiple paragraphs, and each paragraph is used as the query text in S408 respectively. For each query text, the processes of S409 and S410 are performed respectively.
[0197] S409. The device for establishing a document recommendation model inputs the query text into the document recommendation model and obtains Y mapped documents related to the query text.
[0198] Among them, Y is greater than or equal to 1. The Y mapped documents related to the query text refer to the mapped documents indicated in the predicted mapping information output by the document recommendation model as being related to the query text.
[0199] Exceptionally, if there is no document in the mapped documents that is related to the query text, then Y is 0, and the operation of S410 is not performed, and the query result can be directly output as empty.
[0200] S410. The device for establishing the document recommendation model outputs N mapped documents out of the Y mapped documents to the user.
[0201] Among them, N is greater than or equal to 1. N is the number of recommendations and can be configured according to actual needs.
[0202] In a possible implementation, if N is greater than or equal to Y, the Y mapped documents are output to the user.
[0203] In another possible implementation, if N is less than Y, the top N mapped documents with the highest to lowest degree of relevance to the query text among the Y mapped documents are output to the user.
[0204] For example, if N is equal to 1, the mapped document with the highest degree of relevance (the largest relevant probability value) to the query text among the Y mapped documents is output to the user.
[0205] Of course, the recommendation rules in S410 can also be configured according to actual needs, and the present application does not limit this.
[0206] Furthermore, when multiple query texts are obtained in S408, and S409 is executed for each query text to obtain the mapped documents related to each query text, in S410, the union of the mapped documents related to each query document can be obtained, and then some or all of the mapped documents can be recommended.
[0207] In a possible implementation, the union of the mapped documents related to each query document is obtained, and some or all of the mapped documents are recommended. Specifically, it can be implemented as: obtaining the number of times each mapped document in the union is used as a relevant document, and recommending the top N in the order from high to low.
[0208] It should be noted that the execution order of each step in the method described in the embodiments of the present application can be configured according to actual needs, and the present application does not limit this. The attached drawings are only for illustrative purposes.
[0209] It should also be noted that when implementing document recommendation for the same set of mapped documents, the process of establishing the document recommendation model is executed once, and then according to different input main mapped texts, the model recommends relevant mapped documents to the user.
[0210] When implementing document recommendation for different groups of mapped documents, it is necessary to execute the process of establishing the document recommendation model of this application once for each group of mapped documents to obtain multiple document recommendation models. When performing document recommendation, first select the document recommendation model of the mapped documents to be recommended according to the query text, and then input the main mapped text into the model, and the model recommends relevant mapped documents to the user.
[0211] Taking the tender reply scenario of software products as an example, a process of establishing a document recommendation model provided by an embodiment of this application will be described in detail below.
[0212] The software provider establishes a document recommendation model based on its own software products (10 FD documents), and then the server inputs the SOC document provided by the customer into the model. The model outputs the 3 FD documents with the highest degree of relevance to the SOC, and the server outputs these documents to the user.
[0213] The specific process of establishing this document recommendation model may include but is not limited to the following steps 1 to 8.
[0214] Step 1: The server obtains 10 FD documents (mapped documents) and numbers the 10 FD documents (mapped documents) as: 101, 102, 103, 104, 105, 106, 107, 108, 109, 110.
[0215] Step 2: The server extracts the key sentences in each FD document.
[0216] Exemplarily, the key sentences extracted by the server from each FD document are shown in Table 3.
[0217] Table 3
[0218] Key sentence FD number to which the key sentence belongs If the number of… 101 When a subscriber enters… 101 Call center invoke CBS… 101 The carriers can define X days… 102 …… …… …… 110
[0219] Step 3: The server takes the key sentences contained in one FD document as a main mapped text, constructs 10 main mapped texts, and numbers the 10 main mapped texts as Z1, Z2, Z3, Z4, Z5, Z6, Z7, Z8, Z9, Z10.
[0220] Step 4: The server inputs the 10 main mapped texts and the 10 FD documents into the document recommendation model, and the document recommendation model outputs the corresponding predicted mapping information.
[0221] Among them, the predicted mapping information can be shown in Table 4.
[0222] Table 4
[0223] Main mapping text number FD document number Relevant probability value Whether relevant Z1 101 93% Yes Z1 102 23% No Z1 …… …… …… Z1 110 74% Yes Z2 101 67% Yes …… …… …… …… Z10 110 12% No
[0224] Step 5: The server obtains 10 master mapping texts and the true mapping relationships of 10 FD document input documents.
[0225] Among them, the true mapping relationships can be as shown in Table 5.
[0226] Table 5
[0227] Main mapping text number FD document number Whether relevant Z1 101 Yes Z1 102 No Z1 …… …… Z1 110 No Z2 101 No …… …… …… Z10 110 No
[0228] Step 6: The server trains the document recommendation model based on the predicted mapping information and the true mapping information of 10 master mapping texts and 10 FD documents until convergence.
[0229] Step 7: The server obtains the SOC document (including 13 software requirements), takes each requirement in the SOC document as a query text, and inputs them into the document recommendation model respectively. The document recommendation model outputs the FD documents related to each text paragraph, as shown in Table 6.
[0230] Table 6
[0231] Query text Relevant FD document number C1 101、103 C2 102、103、105 C3 101、107 C4 103、106、108、109 …… …… C13 103、105、110
[0232] Step 8: The server counts the number of times each FD document is used as a relevant document, and outputs the FD documents numbered 103, 105, and 101 with the top three numbers of times to the user.
[0233] The above mainly introduces the solution provided in the embodiment of the present application from the perspective of the working principle of the device for establishing a document recommendation model. It can be understood that, in order to implement the above functions, the device for establishing a document recommendation model includes the corresponding hardware structure and / or software module for executing each function. Those skilled in the art should easily realize that, combined with the units and algorithm steps of each example described in the embodiments disclosed herein, the present application can be implemented in the form of hardware or a combination of hardware and computer software. Whether a certain function is executed in the way of hardware or computer software driving hardware depends on the specific application and design constraints of the technical solution. Professional technicians can use different methods to implement the described functions for each specific application, but such implementation should not be considered to exceed the scope of the present application.
[0234] The embodiments of the present application can divide the functions of the device for establishing a document recommendation model according to the above method examples. For example, each function module can be divided corresponding to each function, or two or more functions can be integrated into one processing module. The above integrated module can be implemented in the form of hardware or in the form of a software function module. It should be noted that the division of modules in the embodiments of the present application is illustrative, only a logical function division, and there can be other division methods in actual implementation.
[0235] In the case where each function is divided into corresponding function modules, Figure 6 FIG. shows a possible structural diagram of the apparatus 60 for establishing a document recommendation model involved in the above embodiments. The apparatus for establishing a document recommendation model may be a server, or a functional module or chip in the server, or an apparatus used in cooperation with the server. As Figure 6 shown, the apparatus 60 for establishing a document recommendation model may include: a first acquisition unit 601, an extraction unit 602, a construction unit 603, a processing unit 604, and a training unit 605. The first acquisition unit 601 is configured to execute Figure 4 or Figure 5 the process S401 in Figure 5 or Figure 4 the process S406 in Figure 5 ; the extraction unit 602 is configured to execute Figure 4 or Figure 5 the process S402 in Figure 4 or Figure 5 the process S404 in Figure 5 or the S409 in Figure 4 or Figure 5 the process S405 in Figure 5 or the S407 in
[0236] Further, as Figure 7 shown, the apparatus 60 for establishing a document recommendation model may further include a second acquisition unit 606 and an output unit 607. Among them, the second acquisition unit 606 is configured to execute Figure 5 the process S408 in Figure 5 , and the output unit 607 is configured to execute
[0237] In the case where integrated units are adopted, Figure 8 FIG. shows a possible structural diagram of the apparatus 80 for establishing a document recommendation model involved in the above embodiments. The apparatus for establishing a document recommendation model may be a server, or a functional module or chip in the server, or an apparatus used in cooperation with the server. As Figure 8 shown, the apparatus 80 for establishing a document recommendation model may include: a processing module 801, a communication module 802. The processing module 801 is configured to control and manage the operations of the apparatus 80 for establishing a document recommendation model. For example, the processing module 801 is configured to execute Figure 4 or Figure 5 S401 to S405 in Figure 5The processes S406 to S410 therein. The communication module 802 is used to support the communication between the device 80 for establishing a document recommendation model and other units. The device 80 for establishing a document recommendation model may further include a storage module 803 for storing the program code and data of the device 80 for establishing a document recommendation model.
[0238] Among them, the processing module 801 may be Figure 3 The processor 301 in the physical structure of the device 30 for establishing a document recommendation model shown, which may be a processor or a controller. For example, it may be a CPU, a general-purpose processor, a DSP, an ASIC, an FPGA or other programmable logic devices, transistor logic devices, hardware components or any combination thereof. It can implement or execute various exemplary logical blocks, modules and circuits described in combination with the disclosure of the present application. The processing module 801 may also be a combination that realizes computing functions, such as a combination including one or more microprocessors, a combination of a DSP and a microprocessor, and so on. The communication module 802 may be Figure 3 The transceiver 303 in the physical structure of the device 30 for establishing a document recommendation model shown. The communication module 802 may be a communication port, or may be a transceiver, a transceiver circuit or a communication interface, etc. Alternatively, the above communication interface may implement communication with other devices through the above elements having transceiver functions. The above elements having transceiver functions may be implemented by an antenna and / or a radio frequency device. The storage module 803 may be Figure 3 The memory 302 in the physical structure of the device 30 for establishing a document recommendation model shown.
[0239] When the processing module 801 is a processor, the communication module 802 is a transceiver, and the storage module 803 is a memory, the device 80 for establishing a document recommendation model involved in the embodiments of the present application Figure 8 may be Figure 3 The device 30 for establishing a document recommendation model shown.
[0240] As described above, the device 60 for establishing a document recommendation model or the device 80 for establishing a document recommendation model provided in the embodiments of the present application may be used to implement the functions in the methods implemented in the above embodiments of the present application. For the sake of convenience of description, only the parts related to the embodiments of the present application are shown. For the specific technical details not disclosed, please refer to the embodiments of the present application.
[0241] As another form of this embodiment, a computer-readable storage medium is provided, on which instructions are stored, and when the instructions are executed, the method for establishing a document recommendation model in the above method embodiments is executed.
[0242] As another form of this embodiment, a computer program product containing instructions is provided. When the computer program product runs on a computer, it causes the computer to execute the method of establishing a document recommendation model in the above method embodiment when executed.
[0243] Another embodiment of the present application provides a chip system. The chip system includes a processor for implementing the technical method of the embodiments of the present invention. In a possible design, the chip system further includes a memory for storing the necessary program instructions and / or data of the embodiments of the present invention. In a possible design, the chip system further includes a memory for the processor to call the application program code stored in the memory. The chip system may be composed of one or more chips, or may include chips and other discrete devices, and the embodiments of the present application do not make specific limitations on this.
Claims
1. A method for establishing a document recommendation model, characterized in that, Including: Obtain multiple mapped documents; Extract key sentences from each of the mapped documents; Construct one or more main mapped texts, where the main mapped text includes one or more of the key sentences; Input each of the main mapped texts and each of the mapped documents into a document recommendation model to obtain prediction mapping information for each of the main mapped texts and each of the mapped documents; The prediction mapping information is used to indicate whether the main mapped text and the mapped document are predicted to be relevant; Train the document recommendation model until convergence according to the prediction mapping information and the true mapping information of each of the main mapped texts and each of the mapped documents; the true mapping information is used to indicate whether the main mapped text and the mapped document are truly relevant; the main mapped text and the mapped document to which the key sentence it contains belongs are truly relevant; The document recommendation model includes a language model and a text classification model. The step of inputting each of the main mapped texts and each of the mapped documents into the document recommendation model to obtain prediction mapping information for each of the main mapped texts and each of the mapped documents includes: Input each of the main mapped texts and each of the mapped documents into the language model to obtain feature vectors for each of the main mapped texts and each of the mapped documents; the feature vectors are used to reflect the semantics of the documents; Input the feature vectors of each of the main mapped texts and each of the mapped documents into the text classification model to obtain prediction mapping information for each of the main mapped texts and each of the mapped documents.
2. The method according to claim 1, characterized in that, The prediction mapping information includes: An indication information for indicating whether it is relevant; Or, A correlation probability value for indicating the degree of relevance.
3. The method according to claim 1 or 2, characterized in that, The step of constructing one or more main mapped texts includes: Construct one or more of the main mapped texts according to a preset rule.
4. The method according to claim 3, characterized in that, The preset rule includes: Construct the key sentences included in one of the mapped documents into one of the main mapped texts; Or, Construct one of the key sentences into one of the main mapped texts; Or, Randomly select Q key sentences from the key sentences included in all the mapped documents as one of the main mapped texts, where Q is greater than or equal to 1; Or, Divide the key sentences included in all the mapped documents into L groups, and each group serves as one of the main mapped texts.
5. The method according to claim 1, characterized in that, The key sentence is a sentence whose typicality index X in the mapped document is greater than or equal to a threshold; Among them, the calculation formula for calculating X of the first sentence in the first mapped document satisfies the following relationship: The TF is the number of times the first sentence appears in the first mapped document; D is the total number of the multiple mapped documents; M is the number of the mapped documents among the multiple mapped documents that contain the first sentence, and a is a preset base number.
6. The method according to claim 1, characterized in that, The true mapping information includes: An indication information for indicating whether it is relevant; Or, The association relationship between the main mapped text and the mapped document, and the mutually associated documents are truly relevant.
7. The method according to claim 1, characterized in that, The method further includes: Obtain multiple domain texts, where the domain texts are texts in the professional field to which the mapped documents belong; Train the language model to convergence according to the multiple domain texts.
8. The method according to claim 1, characterized in that, The method further includes: Obtain a query text input by the user, which includes a paragraph; Input the query text into the document recommendation model to obtain Y of the mapped documents related to the query text; Y is greater than or equal to 1; Output N of the Y mapped documents to the user, where N is greater than or equal to 1.
9. The method according to claim 8, characterized in that, Outputting N of the Y mapped documents to the user includes: If N is greater than or equal to Y, outputting the Y mapped documents to the user; If N is less than Y, outputting the top N mapped documents among the Y mapped documents to the user in descending order of relevance to the query text.
10. An apparatus for building a document recommendation model, characterized in that, It includes: A first acquisition unit for acquiring a plurality of mapped documents; An extraction unit for extracting key sentences from each of the mapped documents; A construction unit for constructing one or more main mapped texts, where the main mapped text includes one or more of the key sentences; A processing unit for inputting each of the main mapped texts and each of the mapped documents into a document recommendation model to obtain prediction mapping information of each of the main mapped texts and each of the mapped documents; The prediction mapping information is used to indicate whether the main mapped text and the mapped document are predicted to be relevant; A training unit for training the document recommendation model until convergence according to the prediction mapping information and the true mapping information of each of the main mapped texts and each of the mapped documents; the true mapping information is used to indicate whether the main mapped text and the mapped document are truly relevant; the main mapped text and the mapped document to which the key sentence it contains belongs are truly relevant; The document recommendation model includes a language model and a text classification model, and the processing unit is specifically used for: Inputting each of the main mapped texts and each of the mapped documents into the language model to obtain feature vectors of each of the main mapped texts and each of the mapped documents; The feature vectors are used to reflect the semantics of the documents; Inputting the feature vectors of each of the main mapped texts and each of the mapped documents into the text classification model to obtain prediction mapping information of each of the main mapped texts and each of the mapped documents.
11. The apparatus according to claim 10, characterized in that, The prediction mapping information includes: An indication information for indicating whether it is relevant; Or, A correlation probability value for indicating the degree of relevance.
12. The apparatus according to claim 10 or 11, characterized in that, The construction unit is specifically used for: Constructing one or more of the main mapped texts according to a preset rule.
13. The apparatus according to claim 12, characterized in that, The preset rule includes: Constructing the key sentences included in one mapped document into one main mapped text; Or, Constructing one key sentence into one main mapped text; Or, Randomly selecting Q of the key sentences included in all the mapped documents as one main mapped text, where Q is greater than or equal to 1; Or, Dividing the key sentences included in all the mapped documents into L groups, and each group is used as one main mapped text.
14. The apparatus according to claim 10, characterized in that, The key sentence is a sentence whose typicality index X in the mapped document is greater than or equal to a threshold; Among them, the calculation formula for calculating X of the first sentence in the first mapped document satisfies the following relationship: The TF is the number of times the first sentence appears in the first mapped document; the D is the total number of the multiple mapped documents; the M is the number of the mapped documents among the multiple mapped documents that contain the first sentence, and the a is a preset base number.
15. The device according to claim 10, characterized in that, The true mapping information includes: An indication information for indicating whether it is relevant; Or, The association relationship between the main mapped text and the mapped document, and the mutually associated documents are truly relevant.
16. The device according to claim 10, characterized in that, The first acquisition unit is further used for acquiring a plurality of domain texts, where the domain texts are texts in the professional field to which the mapped documents belong; The training unit is further used for training the language model to convergence according to the plurality of domain texts.
17. The device according to claim 10, characterized in that, The device further includes a second acquisition unit, configured to acquire a query text input by a user and including a paragraph; The processing unit is further configured to input the query text into the document recommendation model to acquire Y mapped documents related to the query text; Y is greater than or equal to 1; The device further includes an output unit, configured to output N mapped documents out of the Y mapped documents to the user, N is greater than or equal to 1.
18. The device according to claim 17, characterized in that, Specifically, the output unit is configured to: If N is greater than or equal to Y, output the Y mapped documents to the user; If N is less than Y, output the first N mapped documents with the highest to lowest relevance to the query text among the Y mapped documents to the user.
19. A device for establishing a document recommendation model, characterized in that, The device for establishing a document recommendation model includes: a processor and a memory; The memory is connected to the processor, and the memory is configured to store computer instructions. When the processor executes the computer instructions, the device for establishing a document recommendation model executes the method for establishing a document recommendation model according to any one of claims 1-9.
20. A computer-readable storage medium, characterized in that, Including instructions which, when running on a computer, cause the computer to execute the method for establishing a document recommendation model according to any one of claims 1 to 9.
21. A computer program product, characterized in that, Containing instructions which, when running on a computer, cause the computer to execute the method for establishing a document recommendation model according to any one of claims 1 to 9.
Citation Information
Patent Citations
Candidate document sorting method and device
CN109241243A
Intelligent semantic document recommendation method and device and computer readable storage medium
CN110222160A