A method, device and electronic device for calculating multi-paragraph text similarity
Patent Information
- Application Number
- CN202411300118.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-18
- Publication Date
- 2025-09-05
- Estimated Expiration
- 2044-09-18
AI Technical Summary
[0005]有鉴于此,有必要提供一种多段式文本相似度的计算方法、装置及电子设备,用以解决现有技术中通过sql关键字查询匹配项目时导致的精度低的问题
[0044] The beneficial effects of the present invention are as follows: the present invention provides a method, device and electronic device for calculating multi-paragraph text similarity, which first obtains the text weight word and text weight word score of each field in the field of the target software table, and then obtains the synonyms corresponding to the text weight word.
Smart Images

Figure CN119226812B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of natural language processing, and in particular to a method, device and electronic device for calculating the similarity of multi-segment texts. Background Art
[0002] The unified resource management platform is an information resource management platform. Its core management goal is to coordinate the rational utilization of information resources, optimize and eliminate inefficient resource utilization, and manage project applications to avoid duplication of investment. The system's main functions include the approval of new project applications. This approval function requires the use of past similar projects as a basis for the approver's decision-making, which leads to the need for project similarity comparison.
[0003] The current technical solution is to input the query keywords, and then use SQL's fuzzy query to query and match multiple text segments of project information, including project name, project type, construction goals, user roles, function introduction and keywords. As long as a match is found, it is considered a similar project.
[0004] The existing method is an active search, where the approver uses keywords they have summarized during the approval process to match maintained project information. This method not only places high demands on the searcher's summary skills, but also suffers from issues with the accuracy of fuzzy matching. It often results in an awkward situation where one missing keyword fails to match, while one missing keyword results in a large number of matches, resulting in low precision in the matching of projects. Summary of the Invention
[0005] In view of this, it is necessary to provide a method, device and electronic device for calculating multi-segment text similarity to solve the problem of low accuracy caused by matching items through SQL keyword queries in the prior art.
[0006] In order to solve the above problems, the present invention provides a method for calculating the similarity of multi-segment texts, comprising:
[0007] Obtain the text weight word and text weight word score for each field in the target software table;
[0008] Obtaining synonyms corresponding to the text weight words;
[0009] Obtaining a row total score for each row of data in the target software table based on the score of the text weight word;
[0010] Perform word segmentation on the fields in the project to be added to obtain the new project fields after word segmentation;
[0011] determining a total score of the new item field based on the text weight words, the synonyms, and the scores of the text weight words;
[0012] Based on the total score of the row, the total score of the new item field, and a preset value, the similarity between the new item to be added and each row of data in the target software table is obtained. In one possible implementation, the text weight word and text weight word score of each field in the target software table are obtained, including:
[0013] Preprocessing the text of the field to obtain a preprocessed field;
[0014] Calculating the scores of the segmented words of the preprocessed field, and sorting the segmented words according to the scores to obtain sorted segmented words;
[0015] A preset number of segmentations are selected from the sorted segmentations as text weight words of the corresponding fields, and the scores of the segmentations corresponding to the text weight words are the text weight word scores.
[0016] In a possible implementation, preprocessing the text of the field to obtain a preprocessed field includes:
[0017] Perform word segmentation processing and stop word processing on the field to obtain a preprocessed field.
[0018] In a possible implementation, calculating the word segmentation score of the preprocessed field includes:
[0019] The word segmentation score of the preprocessed field is calculated based on the BM25 algorithm.
[0020] In a possible implementation, obtaining a synonym corresponding to the text weight word includes:
[0021] Adding the target software business logic-specific synonyms to the preset standard synonym library to obtain the target synonym library;
[0022] Acquire synonyms corresponding to the text weight words based on the target synonym library.
[0023] In a possible implementation, obtaining the total score of each row of data in the table based on the score of the text weight word includes:
[0024] Adding each text weight word of the field to obtain first data;
[0025] Determine the weight coefficient of each field according to the business logic of the target software;
[0026] The weight coefficient of each field is multiplied by the first data to obtain second data, where the second data is the total score of each row of data in the table.
[0027] In a possible implementation, determining the total score of the new item field based on the text weight word, the synonym, and the score of the text weight word includes:
[0028] Perform word segmentation on the fields in the project to be added to obtain the new project fields after word segmentation;
[0029] Compare each word in the new item field with the text weight words and synonyms of each field in the table to determine whether there is a hit;
[0030] When a hit is determined, the score of the new item field is obtained based on the sum of the segmentation scores of the hits.
[0031] In a possible implementation, obtaining the similarity between the to-be-added item and each row of data in the target software table based on the row total score, the total score of the new item field, and a preset value includes:
[0032] Determine the difference between the absolute value of the row total score and the total score of the new item field;
[0033] The items corresponding to the difference values being smaller than the preset value are determined as items that match the similarity with the item to be added.
[0034] On the other hand, the present invention also provides a device for calculating the similarity of multi-segment texts, comprising:
[0035] The first word segmentation acquisition module is used to obtain the text weight word and text weight word score of each field in the target software table;
[0036] A synonym acquisition module, used to acquire synonyms corresponding to the text weight words;
[0037] A first total score acquisition module is used to obtain a row total score for each row of data in the target software table based on the score of the text weight word;
[0038] The second word segmentation acquisition module is used to perform word segmentation on the fields in the to-be-added project to obtain the new project fields after word segmentation;
[0039] a second total score acquisition module, configured to determine a total score of the new item field based on the text weight words, the synonyms, and the scores of the text weight words;
[0040] The similar project acquisition module is used to obtain the similarity between the project to be added and each row of data in the target software table based on the total score of the row, the total score of the new project field and a preset value.
[0041] On the other hand, the present invention also provides an electronic device, including a memory and a processor, wherein:
[0042] The memory is used to store programs;
[0043] The processor is coupled to the memory and is configured to execute the program stored in the memory to implement the steps of the method for calculating the similarity of multiple paragraphs of text described in any one of the above implementations.
[0044] The beneficial effects of the present invention are as follows: the present invention provides a method, device and electronic device for calculating multi-paragraph text similarity, which first obtains the text weight word and text weight word score of each field in the field of the target software table, and then obtains the synonyms corresponding to the text weight word.
[0045] Further based on the score of the text weight word, the total score of each row of data in the target software table is obtained. Through the above steps, each field in the target software is scored to obtain the total score of each data, so that the newly added project can quickly determine the similarity of the project with high similarity by comparing the total score. The field in the project to be added is further segmented to obtain the new project field after segmentation. The total score of the new project field is determined based on the text weight word, the synonym and the score of the text weight word. Finally, the similarity between the data to be added and each row in the target software table is obtained based on the total score of the row, the total score of the new project field and the preset value. The present invention obtains the total score of each row of data by obtaining the text weight word of each field in the target software and the score of the corresponding text weight word, and by calculating the total score of the field in the newly added project, the total score of the field in the newly added project is compared with the total score of the original data of the target software, thereby determining the project similar to the newly added project, thereby improving the accuracy of the retrieval. BRIEF DESCRIPTION OF THE DRAWINGS
[0046] Figure 1 A flowchart of an embodiment of a method for calculating multi-paragraph text similarity provided by the present invention;
[0047] Figure 2 For the present invention Figure 1 A schematic flow chart of an embodiment of S101;
[0048] Figure 3 For the present invention Figure 1 A schematic flow chart of an embodiment of S102;
[0049] Figure 4 For the present invention Figure 1 A schematic flow chart of an embodiment of S103;
[0050] Figure 5 For the present invention Figure 1 A schematic flow chart of an embodiment of S105;
[0051] Figure 6 A schematic flow chart of an embodiment of a device for calculating multi-segment text similarity provided by the present invention;
[0052] Figure 7 This is a schematic structural diagram of an embodiment of the electronic device provided by the present invention. DETAILED DESCRIPTION
[0053] The preferred embodiments of the present invention will be described in detail below in conjunction with the accompanying drawings, wherein the accompanying drawings constitute a part of this application and are used together with the embodiments of the present invention to illustrate the principles of the present invention, and are not used to limit the scope of the present invention.
[0054] Before presenting the embodiments, the following terms are explained.
[0055] The BM25 algorithm is a widely used ranking algorithm in information retrieval and is part of the probabilistic information retrieval model. The core concept of BM25 is based on the term frequency and inverse document frequency (TF-IDF) model. It further optimizes term frequency processing, allowing it to better reflect the importance of words across different document lengths and term frequency distributions. However, it has certain limitations in semantic understanding.
[0056] Synonym Forest: A Chinese lexical resource, similar to the English WordNet, is used to identify synonymous relationships and semantic categorization. It contains a large number of synonyms and near-synonyms, and organizes the vocabulary hierarchically according to semantic categories, constructing a structured semantic network. Synonym Forest allows for word expansion and replacement, improving model performance in natural language processing (NLP) tasks such as information retrieval, text classification, and sentiment analysis.
[0057] Multi-paragraph text similarity: Each entity is described by multiple paragraphs of text in different dimensions, and the similarity of entities is determined by comparing the multi-paragraph text descriptions of different entities.
[0058] The present invention provides a method, device and electronic device for calculating the similarity of multi-segment texts, which are described below respectively.
[0059] Figure 1 A flow chart of an embodiment of a method for calculating the similarity of multi-segment texts provided by the present invention is shown as follows: Figure 1 As shown, the method for calculating the similarity of multi-paragraph text includes:
[0060] S101, obtaining text weight words and text weight word scores for each field in the target software table;
[0061] S102, obtaining synonyms corresponding to the text weight words;
[0062] S103, obtaining a row total score for each row of data in the target software table based on the score of the text weight word;
[0063] S104: Segment the fields in the new project to obtain new project fields after segmentation;
[0064] S105, determining a total score of the new item field based on the text weight word, the synonym and the score of the text weight word;
[0065] S106: Obtain the similarity between the to-be-added item and each row of data in the target software table based on the row total score, the total score of the new item field, and a preset value.
[0066] Compared with the prior art, this embodiment provides a method, device, and electronic device for calculating multi-paragraph text similarity. The method first obtains the text weight word and text weight word score of each field in the target software table, and then obtains the synonyms corresponding to the text weight word.
[0067] Further based on the score of the text weight word, the total score of each row of data in the target software table is obtained. Through the above steps, each field in the target software is scored to obtain the total score of each data, so that the newly added project can quickly determine the similarity of the project with high similarity by comparing the total score. The field in the project to be added is further segmented to obtain the new project field after segmentation. The total score of the new project field is determined based on the text weight word, the synonym and the score of the text weight word. Finally, the similarity between the data to be added and each row in the target software table is obtained based on the total score of the row, the total score of the new project field and the preset value. The present invention obtains the total score of each row of data by obtaining the text weight word of each field in the target software and the score of the corresponding text weight word, and by calculating the total score of the field in the newly added project, the total score of the field in the newly added project is compared with the total score of the original data of the target software, thereby determining the project similar to the newly added project, thereby improving the accuracy of the retrieval.
[0068] It should be noted that the application scenario of the present invention is software that requires query tables. In this embodiment, the target software is an information resource management platform. The project information includes project name, project type, construction objectives, user role, function description, and keywords. It is understood that the method of the present invention is applicable to all software that requires query.
[0069] In a specific embodiment of the present invention, when maintaining existing projects in the unified resource management platform, keyword extraction and similarity calculation are performed on the projects, and the results are stored in the database. When a new project application is submitted, the stored data is automatically compared, and projects with a similarity difference between the two meeting the set value are identified as similar projects and their relationships are stored for automatically bringing out similar projects for decision-making during approval. Specifically, the corresponding relationships between a project to be newly applied for and a maintained project are as shown in Table 1 below:
[0070] Table 1: Corresponding relationship table between a project to be newly applied for and a maintained project
[0071]
[0072] Specifically, based on the standard thesaurus, business-specific synonyms are filled in, such as: government affairs service and government-enterprise service, to obtain the target thesaurus. It should be noted that the standard thesaurus is a thesaurus existing in the prior art.
[0073] In some embodiments of the present invention, in step S101, as Figure 2 shown, the obtaining of the text weight words and text weight word scores for each field in the target software table includes:
[0074] S201. Preprocess the text of the field to obtain the preprocessed field;
[0075] S202. Calculate the scores of the word segments of the preprocessed field, and sort the word segments according to the scores to obtain the sorted word segments;
[0076] S203. Select a preset number of word segments from the sorted word segments as the text weight words for the corresponding field, and the score of the word segment corresponding to the text weight word is the text weight word score.
[0077] In some embodiments of the present invention, the preprocessing of the text of the field to obtain the preprocessed field includes:
[0078] Perform word segmentation processing and stop word processing on the field to obtain the preprocessed field.
[0079] In a specific embodiment of the present invention, word segmentation and stop word (referring to removing common excessive words or punctuation marks or subject-predicate-object or those added by the business itself, such as excessive words like "of" and "and") processing are performed on the text of each field. For example, the word segmentation of the project name text field is: [xx City, Digital店小二].
[0080] In some embodiments of the present invention, the calculation of the scores of the word segments of the preprocessed field includes:
[0081] Calculate the scores of the word segments of the preprocessed fields based on the BM25 algorithm.
[0082] In a specific embodiment of the present invention, the word segments of each field are scored through the BM25 algorithm, and the top x (x is a custom coefficient, and 3 is taken this time) words with the highest scores are selected and sorted as the text weight words of this field. Since there are only two words after this word segmentation, the words and their scores are expressed as [{"word": "Digital店小二", "bm25_score": 0.41097438921682977}, {"word": "xx City", "bm25_score": 0.28768207245178}].
[0083] Perform synonym processing on the selected maximum weight words, obtain synonyms and save them together with the Score of this text. [{"word": "Digital店小二|Government-Enterprise Service|Online Government Affairs", "bm25_score": 0.41097438921682977}, {"word": "xx City|Jiangcheng|City-Level", "bm25_score": 0.28768207245178}]. Sum(TopN(Score(Project Name Keyword Array, Project Name))) = 0.41097438921682977 + 0.28768207245178
[0084] Perform weighted calculation on each row of data in each field of the existing projects in the unified resource management platform to obtain the total score. The calculation formula for the total score is:
[0085] Score Total = Sum(TopN(Score(Project Name Keyword Array, Project Name))) * 0.2 Weight Coefficient
[0086] + Sum(TopN(Score(Building Goal Keyword Array, Building Goal))) * 0.4 Weight Coefficient
[0087] + Sum(TopN(Score(User Role Keyword Array, User Role))) * 0.2 Weight Coefficient
[0088] + Sum(TopN(Score(Function Introduction Keyword Array, Function Introduction))) * 0.2 Weight Coefficient
[0089] Where the value of the weight coefficient of each field is set according to the business logic.
[0090] In some embodiments of the present invention, in step S102, as Figure 3 shown, the obtaining of the synonyms corresponding to the text weight words includes:
[0091] S301, adding the target software business logic-specific synonyms to the preset standard synonym library to obtain a target synonym library;
[0092] S303: Acquire synonyms corresponding to the text weight words based on the target synonym library.
[0093] In some embodiments of the present invention, in step S103, as Figure 4 As shown, the total score of each row of data in the table is obtained based on the score of the text weight word, including:
[0094] S401, adding each text weight word of the field to obtain first data;
[0095] S402, determining a weight coefficient for each field according to the business logic of the target software;
[0096] S403: Multiply the weight coefficient of each field by the first data to obtain second data, where the second data is the total score of each row of data in the table.
[0097] In some embodiments of the present invention, in step S105, as Figure 5 As shown, the determining of the total score of the new item field based on the text weight words, the synonyms, and the scores of the text weight words includes:
[0098] S501: Segment the fields in the project to be added to obtain new project fields after segmentation.
[0099] S502: Compare each word in the new item field with the text weight words and synonyms of each field in the table to determine whether there is a hit;
[0100] S503: When a hit is determined, the score of the new item field is obtained based on the sum of the segmentation scores of the hits.
[0101] In some embodiments of the present invention, obtaining the similarity between the to-be-added item and each row of data in the target software table based on the row total score, the total score of the new item field, and a preset value includes:
[0102] Determine the difference between the absolute value of the row total score and the total score of the new item field;
[0103] The items corresponding to the difference values being smaller than the preset value are determined as items that match the similarity with the item to be added.
[0104] In a specific embodiment of the present invention, the steps for processing the project to be applied for include:
[0105] Segment the fields in the project to be applied for, score the segmentation of each field using the BM25 algorithm, and select the top x (x is a custom coefficient, 3 is taken this time) words with the highest scores and sort them as the text weight words of the project field to be applied for. For example, the data after segmentation is [{"word": "xx"},{"word": "Enterprise Benefit Services"},{"word": "Platform"}].
[0106] Filter all matching maintained projects based on project type and its synonyms for comparison and calculation. The calculation with a maintained project is shown in Table 2:
[0107] Table 2: Synonym comparison table
[0108]
[0109] According to the above table, the word segmentation of the proposed new project is compared with the word segmentation of a certain maintained project in turn. When any word of the proposed new project hits the word segmentation of a certain maintained project, the score is calculated only once regardless of how many times the word hits. Finally, the sum of all hit scores is the similarity score of the text field. The specific explanation is as follows:
[0110] Assume that the word segmentation of the proposed new project 1 hits the word segmentation 1 and word segmentation 2 of the maintained project, the score will be calculated twice, and the other subsequent words do not need to be calculated. The sum of the score of word segmentation 1 and the score of word segmentation 2 will be used as the score of the word segmentation of the proposed new project 1;
[0111] Assume that the segmentation of the proposed new project 1 hits the segmentation of the maintained project 1, and the segmentation of the proposed new project 2 hits the segmentation of the maintained project 1, only one score is counted;
[0112] All text fields of the new project to be applied for will be calculated and weighted according to the Score total formula to obtain the total score.
[0113] The total scores of the two sides are compared by calculating the absolute value, and the range of the difference is adjusted according to the accuracy of the business to confirm the similarity. In this embodiment, an absolute value difference of less than 0.25 is considered to be similar.
[0114] In order to better implement a method for calculating the similarity of multiple paragraphs of text in an embodiment of the present invention, based on a method for calculating the similarity of multiple paragraphs of text, correspondingly, Figure 6 As shown, an embodiment of the present invention further provides a device for calculating the similarity of multiple paragraphs of text. The device 600 for calculating the similarity of multiple paragraphs of text includes:
[0115] The first word segmentation acquisition module 601 is used to obtain the text weight word and text weight word score of each field in the target software table;
[0116] A synonym acquisition module 602 is used to acquire synonyms corresponding to the text weight word;
[0117] A first total score acquisition module 603 is configured to obtain a row total score for each row of data in the target software table based on the score of the text weight word;
[0118] The second word segmentation acquisition module 604 is used to perform word segmentation on the fields in the to-be-added item to obtain the new item fields after word segmentation;
[0119] A second total score acquisition module 605 is configured to determine a total score of the new item field based on the text weight words, the synonyms, and the scores of the text weight words;
[0120] The similar item acquisition module 606 is configured to obtain the similarity between the to-be-added item and each row of data in the target software table based on the row total score, the total score of the new item field, and a preset value.
[0121] The device 600 for calculating the similarity of multiple paragraphs of text provided in the above embodiment can implement the technical solution described in the embodiment of the method for calculating the similarity of multiple paragraphs of text. The specific implementation principles of the above modules or units can be found in the corresponding contents in the embodiment of the method for calculating the similarity of multiple paragraphs of text, which will not be repeated here.
[0122] like Figure 7 As shown, the present invention also provides an electronic device 700. The electronic device 700 includes a processor 701, a memory 702 and a display 703. Figure 7 Only some of the components of the electronic device 700 are shown, but it should be understood that it is not required to implement all of the shown components, and more or fewer components may be implemented instead.
[0123] In some embodiments, the processor 701 may be a central processing unit (CPU), a microprocessor, or other data processing chip, configured to execute program codes or process data stored in the memory 702 , such as a method for calculating multi-segment text similarity in the present invention.
[0124] In some embodiments, the processor 701 may be a single server or a server group. The server group may be centralized or distributed. In some embodiments, the processor 701 may be local or remote. In some embodiments, the processor 701 may be implemented on a cloud platform. In some embodiments, the cloud platform may include a private cloud, a public cloud, a hybrid cloud, a community cloud, a distributed cloud, an internal cloud, multiple clouds, or any combination thereof.
[0125] In some embodiments, the memory 702 may be an internal storage unit of the electronic device 700, such as a hard disk or memory of the electronic device 700. In other embodiments, the memory 702 may also be an external storage device of the electronic device 700, such as a plug-in hard disk, a smart media card (SMC), a secure digital (SD) card, a flash card, etc. equipped on the electronic device 700.
[0126] Furthermore, the memory 702 may include both an internal storage unit of the electronic device 700 and an external storage device. The memory 702 is used to store application software installed in the electronic device 700 and various data.
[0127] In some embodiments, display 703 can be an LED display, a liquid crystal display, a touch-sensitive liquid crystal display, or an OLED (Organic Light-Emitting Diode) touchscreen. Display 703 is used to display information on electronic device 700 and to display a visual user interface. Components 701-703 of electronic device 700 communicate with each other via a system bus.
[0128] In one embodiment, when the processor 701 executes a multi-segment text similarity calculation program in the memory 702, the following steps may be implemented:
[0129] Obtain the text weight word and text weight word score for each field in the target software table;
[0130] Obtaining synonyms corresponding to the text weight words;
[0131] Obtaining a row total score for each row of data in the target software table based on the score of the text weight word;
[0132] Perform word segmentation on the fields in the project to be added to obtain the new project fields after word segmentation;
[0133] determining a total score of the new item field based on the text weight words, the synonyms, and the scores of the text weight words;
[0134] The similarity between the to-be-added item and each row of data in the target software table is obtained based on the total score of the row, the total score of the new item field and a preset value.
[0135] It should be understood that, when the processor 701 executes a multi-segment text similarity calculation program in the memory 702 , in addition to the above functions, it can also implement other functions. For details, please refer to the description of the corresponding method embodiment above.
[0136] Furthermore, the embodiment of the present invention does not specifically limit the type of the electronic device 700 mentioned. The electronic device 700 may be a portable electronic device such as a mobile phone, a tablet computer, a personal digital assistant (PDA), a wearable device, a laptop computer, or the like. Exemplary embodiments of portable electronic devices include but are not limited to portable electronic devices equipped with IOS, Android, Microsoft, or other operating systems. The above-mentioned portable electronic devices may also be other portable electronic devices, such as a laptop computer with a touch-sensitive surface (e.g., a touch panel). It should also be understood that in some other embodiments of the present invention, the electronic device 700 may not be a portable electronic device, but a desktop computer with a touch-sensitive surface (e.g., a touch panel).
[0137] Those skilled in the art will appreciate that all or part of the process steps of the above-described embodiments can be implemented by instructing related hardware through a computer program, and the program can be stored in a computer-readable storage medium, such as a magnetic disk, an optical disk, a read-only memory, or a random access memory.
[0138] The above description is only a preferred specific embodiment of the present invention, but the scope of protection of the present invention is not limited thereto. Any changes or substitutions that can be easily thought of by any technician familiar with this technical field within the technical scope disclosed by the present invention should be covered by the scope of protection of the present invention.
Claims
1. A method for calculating the similarity of multi-paragraph texts, characterized in that: include: Obtain the text weight word and text weight word score for each field in the target software table; Obtaining synonyms corresponding to the text weight words; Obtaining a row total score for each row of data in the target software table based on the score of the text weight word; Perform word segmentation on the text of the field in the project to be added to obtain the segmented new project field text; determining a total score of the new item field text based on the text weight words, the synonyms, and the scores of the text weight words; Calculate the similarity between the new item and each row of data in the target software table based on the total score of the row, the total score of the new item field text, and a preset value; The determining of the total score of the new item field text based on the text weight words, the synonyms, and the scores of the text weight words includes: Compare each word in the new project field text with the text weight words and synonyms of each field in the table to determine whether it is a hit; When determining a hit, the total score of the new item field text is obtained based on the sum of the scores of the hit text weight words.
2. The method for calculating the similarity of multi-paragraph text according to claim 1, wherein: The step of obtaining the text weight word and the text weight word score of each field in the target software table includes: Preprocessing the text of the field to obtain preprocessed field text; Calculating the scores of the segmented words of the preprocessed field text, and sorting the segmented words according to the scores to obtain sorted segmented words; A preset number of segmentations are selected from the sorted segmentations as text weight words of the corresponding fields, and the scores of the segmentations corresponding to the text weight words are the text weight word scores.
3. The method for calculating the similarity of multi-paragraph text according to claim 2, wherein: The preprocessing of the text of the field to obtain the preprocessed field text includes: Perform word segmentation and stop word processing on the text of the field to obtain preprocessed field text.
4. The method for calculating the similarity of multi-paragraph text according to claim 2, wherein: Calculating the word segmentation score of the preprocessed field text includes: The word segmentation score of the preprocessed field text is calculated based on the BM25 algorithm.
5. The method for calculating the similarity of multi-paragraph text according to claim 1, wherein: The obtaining of synonyms corresponding to the text weight words includes: Adding the target software business logic-specific synonyms to the preset standard synonym library to obtain the target synonym library; Acquire synonyms corresponding to the text weight words based on the target synonym library.
6. The method for calculating the similarity of multi-paragraph text according to claim 1, wherein: The total score of each row of data in the table is obtained based on the score of the text weight word, including: Adding the score of each text weight word of the field to obtain first data; Determine the weight coefficient of each field according to the business logic of the target software; The weight coefficient of each field is multiplied by the first data to obtain second data, where the second data is the total score of each row of data in the table.
7. The method for calculating the similarity of multi-paragraph text according to claim 1, wherein: The similarity between the to-be-added item and each row of data in the target software table is obtained based on the total row score, the total score of the new item field text, and a preset value, including: Determine the difference between the absolute value of the row total score and the total score of the new item field text; The items corresponding to the difference values being smaller than the preset value are determined as items that match the similarity with the item to be added.
8. A device for calculating the similarity of multi-paragraph texts, characterized in that: include: The first word segmentation acquisition module is used to obtain the text weight word and text weight word score of each field in the target software table; A synonym acquisition module, used to acquire synonyms corresponding to the text weight words; A first total score acquisition module is used to obtain a row total score for each row of data in the target software table based on the score of the text weight word; The second word segmentation acquisition module is used to perform word segmentation on the field text in the to-be-added project to obtain the segmented field text of the new project; a second total score acquisition module, configured to determine a total score of the new item field text based on the text weight words, the synonyms, and the scores of the text weight words; A similar project acquisition module is used to obtain the similarity between the project to be added and each row of data in the target software table based on the total score of the row, the total score of the new project field text and a preset value; The determining of the total score of the new item field text based on the text weight words, the synonyms, and the scores of the text weight words includes: Compare each word in the new project field text with the text weight words and synonyms of each field in the table to determine whether it is a hit; When determining a hit, the total score of the new item field text is obtained based on the sum of the scores of the hit text weight words.
9. An electronic device, characterized in that: comprising a memory and a processor, wherein, The memory is used to store programs; The processor is coupled to the memory and is configured to execute the program stored in the memory to implement the steps of the method for calculating the similarity of multi-paragraph texts as described in any one of claims 1 to 7.
Citation Information
Patent Citations
Synonym analysis-based science and technology project declaration similarity detection method
CN107122340A
Text comparison method based on synonymous related words
CN107908622A