A legal and regulatory retrieval system and method based on semantic information weighting

By adopting the semantic information weighting method in the legal and regulatory retrieval system and utilizing the domain analysis model and weight distribution technology, the problem of the inability to accurately distinguish the importance of semantic expressions in existing retrieval technologies is solved, and more accurate and scientific retrieval results are achieved.

CN116340485BActive Publication Date: 2025-09-09SHANDONG UNIV
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202310214197.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-03-08
Publication Date
2025-09-09
Estimated Expiration
2043-03-08

AI Technical Summary

Technical Problem

Existing legal and regulatory retrieval technologies cannot accurately distinguish the importance of words in a sentence to semantic expression, resulting in inaccurate retrieval results and affecting user experience.

Method used

A legal and regulatory retrieval method based on semantic information weighting is adopted. The semantic information of the query statement is extracted through a trained domain analysis model, and weights are assigned to each term. The document score is comprehensively calculated to optimize the retrieval results.

Benefits of technology

It improves the accuracy and scientificity of search results, meets the actual needs of searchers, optimizes search results and improves user experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116340485B_ABST
    Figure CN116340485B_ABST
Patent Text Reader

Abstract

The present invention relates to a legal and regulatory retrieval system and method based on semantic information weighting, belonging to the field of information. The system comprises an index generation module, a domain analysis module, a semantic weight assignment module, and a score normalization module. The index generation module is used to segment and index the data in the database by introducing an IK Analyzer, generate an index information table, and merge the data to form an index database; the domain analysis module is used to input the query statement input by the user into a trained domain analysis model for domain analysis, and match the domain analysis results with the index database to obtain domain-related temporary index information; the semantic weight assignment module is used to assign weights to each term in the query statement, and incorporate the weights assigned to each term into the document similarity calculation to comprehensively obtain the document score; and the score normalization module is used to normalize the document score. The present invention effectively improves the retrieval accuracy and optimizes the retrieval results.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to a law and regulation retrieval system and method based on semantic information weighting, belonging to the field of information technology. Background Art

[0002] The sheer volume and variety of laws and regulations promulgated by the state poses a significant challenge to legal practitioners, as they must accurately retrieve the required provisions from this vast amount of legal data within a limited timeframe. With the rapid development of information technology, numerous products intersecting law and information technology have emerged on the market. In legal practice and academic research, legal search functions such as legal provision association and similar case recommendations are the most widely used. However, these applications have not achieved the desired results, with most users preferring to conduct manual searches. Besides user unfamiliarity with emerging information technology, the main reasons for this are the inaccurate legal provisions and low-quality cases recommended by information retrieval technology.

[0003] When it comes to searching for laws and regulations, existing full-text search technology relies on calculating document similarity scores based on term frequency. However, existing search methods have certain flaws. For example, a user searching for "landscape credit assessment" expects to obtain relevant laws and regulations related to "credit assessment" within the "landscape" field. However, a search based on term frequency cannot distinguish the importance of different words in a sentence to the semantic expression. Documents outside the landscape field with a particularly high number of hits for "credit assessment," such as "Methods for Credit Assessment of Municipal Construction Enterprises," will be ranked higher. Such search results fail to meet users' actual needs, significantly impacting the searcher's user experience.

[0004] In order to solve such problems, it is urgent to design a legal and regulatory retrieval method based on semantic information weighting. After obtaining the semantic information of the query statement, the domain-related document sequence is matched in the index database. On this basis, different weights need to be assigned to terms with different semantic importance in the query statement, and the document score is calculated comprehensively so that the documents that hit important terms in the document sequence have higher scores and are ranked higher, thereby optimizing the retrieval results and improving the user experience. Summary of the Invention

[0005] In response to the deficiencies in the prior art, the present invention discloses a legal and regulatory retrieval system and method based on semantic information weighting. First, the query statement is input into a trained domain analysis model to extract domain information, the domain analysis results are matched with the index database, and temporary index information related to the domain is obtained. A trained semantic weight allocation model is used to assign weights to each term in the query statement, and the weights assigned to each term are included in the document similarity calculation to comprehensively obtain the document score.

[0006] The present invention also provides a method for normalization based on the term weights of query statements. For different queries, a normalization coefficient is designed based on the terms in the query statements and their weights. After multiplying by the document score, the results can be intuitively comparable. Domain information extraction ensures that the query results are all domain-related documents, thereby improving the accuracy of the query results. Semantic weight allocation realizes the automatic allocation of weights for different terms according to their semantic importance, making the query results more scientific, meeting the needs of the searcher, and realizing the optimization of the search. The score normalization method based on the length of the query statement and the term weight solves the problem that different queries cannot be quantitatively compared, further enhancing the user experience.

[0007] The present invention adopts the following technical solutions:

[0008] A legal and regulatory retrieval system based on semantic information weighting includes an index generation module, a domain analysis module, a semantic weight assignment module, and a score normalization module. The index generation module is used to introduce word segmentation and indexing processing of data in a legal and regulatory database into an IK Analyzer to generate an index information table, which is then structured and merged to form an index database.

[0009] The domain analysis module includes a domain analysis model, which is used to input the query statement input by the user into the trained domain analysis model for domain analysis, and match the domain analysis results with the index database to obtain domain-related temporary index information;

[0010] The semantic weight assignment module includes a trained semantic weight assignment model for assigning weights to each term in the query statement, and taking the weights assigned to each term into account in the document similarity calculation to comprehensively obtain a document score;

[0011] The score normalization module is used to perform normalization processing on document scores.

[0012] A method for retrieving laws and regulations based on semantic information weighting includes the following steps:

[0013] (1) The data in the legal and regulatory database is processed to generate an index information table, which is then structured and merged to form an index database. During this process, IK Analyzer is introduced to achieve better word segmentation results.

[0014] (2) Preprocess and analyze the query statement entered by the user, and take the top k domain analysis results to match and filter with the index database to obtain domain-related temporary index information;

[0015] (3) Assign reasonable weights to each term in the query statement, and include the weights assigned to each term in the document similarity calculation to obtain a comprehensive document score;

[0016] (4) Normalize the document scores obtained in step (3).

[0017] Preferably, the specific implementation of step (1) is as follows:

[0018] Divide the documents in the laws and regulations database into terms, and use an inverted index to implement the mapping relationship from terms to documents. Specifically:

[0019] Split the first document into several terms, add the terms to the term column of the index information table, and add the document ID to the information column after each term in the index information table. Then split the second document into several terms. If a term already exists in the index information table, directly add the ID of the second document after that term. If a new term appears, supplement it in the index column of the index information table. Repeat this process to process the original data into an index information table. For example: "Term 1": ID of Document 1, ID of Document 2...; "Term 2": List of document IDs with this keyword. Process all the original data to generate an index information table.

[0020] To achieve better word segmentation effect, IK Analyzer is introduced. IK Analyzer is an open-source, lightweight Chinese word segmentation toolkit developed based on the Java language. So far, IK Analyzer has implemented a simple algorithm for eliminating word segmentation ambiguity, and the IK word segmenter is gradually evolving towards simulating semantic word segmentation. In IK Analyzer, the quality of the dictionary directly affects the quality of the word segmentation results. Therefore, it is necessary to maintain a professional vocabulary library in the field of laws and regulations data as its extended dictionary for IK Analyzer. During the word segmentation process, these professional vocabulary are grouped into one word, which will greatly improve the accuracy of word segmentation in this field. In addition, many function words in Chinese do not have practical search significance. Therefore, it is also necessary to maintain a stop word library to make the indexing process and retrieval process ignore function words, reduce the impact of meaningless words on retrieval, and improve the retrieval accuracy.

[0021] Preferably, the preprocessing method in step (2) is as follows:

[0022] A. First, divide the laws and regulations data set into a training set and a test set;

[0023] B. Process the training set and the test set, including using IK Analyzer to divide the documents into several terms according to the finest granularity of word segmentation. For example, "People's Republic of China" is divided into "People's Republic of China, Chinese people, China, Chinese people, People's Republic, Republic, Republic, Country";

[0024] C. Further remove stop words, such as meaningless function words: "etc.", "of";

[0025] D. Perform a union operation on all the terms after removing the stop words to construct a dictionary containing all the words that appear in the document after word segmentation and removing the stop words.

[0026] Preferably, in step (2), when performing domain analysis, the information point space generated in the preprocessing stage ("information point space" refers to the set of remaining terms after deduplication and stop words are removed, which is called the information point space, and there are still many redundant words irrelevant to the domain analysis) is still relatively large for domain analysis, and the information points are sparse, which affects the retrieval efficiency and accuracy. Therefore, it is necessary to reduce the complexity of text information points. The process of domain analysis is:

[0027] (2.1) For each training sample, after word segmentation and stop word removal, we first filter out noise and information with low semantic contribution based on word frequency or information gain evaluation methods, and select information that is more important to semantic information and contributes more to semantic expression as the initial information point;

[0028] Term frequency refers to how often each term appears in the sample data. Information gain, a concept in information theory, refers to the increase in information each term brings to the training sample. The lower the probability of a term appearing across all documents, the higher the information gain it brings. For example, in the sentence "Law firms and their lawyers engaged in trademark agency business are subject to these Measures. "Law firms" as referred to in these Measures refer to lawyers' practice establishments. "Lawyers" as referred to in these Measures refer to practitioners who have obtained a lawyer's license in accordance with the law and are assigned by law firms to provide legal services to clients," the term "law firm" has a high frequency and should be retained during screening. However, "these Measures" likely appears frequently across all document data, so the information gain it brings is negligible and has little impact on expressing the main idea of ​​the sentence. Therefore, it can be removed during filtering. Taking both aspects into consideration, a low threshold is set to initially filter out only words with extremely low frequency and low information content.

[0029] (2.2) The initial information points are still of high dimensionality and contain many information points that do not contribute much to domain analysis. In order to preserve the structural information of the text while reducing irrelevant interference information, the domain-related information points are further extracted through the information point mapping conversion algorithm. This achieves the effect of using less data information to preserve more domain characteristics of the original data points. The mapping representation of each term for each domain is summed up and used as the domain information representation of the document. Specifically,

[0030] Most existing algorithms consider only one aspect, focusing on resolving the impact of a certain factor on the information conversion algorithm. For example, the mutual information algorithm focuses on high-frequency words and ignores rare words, resulting in the loss of some important words. The document frequency algorithm easily filters out uncommon words that are of great significance to the text. This invention integrates three influencing factors: mutual information, document frequency, and chi-square test. This method can overcome the shortcomings of existing methods and improve the efficiency and accuracy of domain analysis.

[0031]

[0032] in, is the domain information representation generated in the previous step, v m is the domain information representation, I(t i , m) represents the term t i Mutual information with domain m, the larger the value, the more likely the term t is i The higher the co-occurrence rate with domain m, the higher the 2 (t i , m) is the chi-square test used to test the gap between the actual value of statistical data and the theoretical inference, used to characterize the difference between the actual value of the statistical data and the theoretical inference. i The degree of correlation between the domain m, DF(t i , m) represents t i The ratio of the number of occurrences in domain m to the number of occurrences in all documents. E1, E2, and E3 represent the balance coefficients, which need to be determined based on specific data in the experiment.

[0033]

[0034] Calculate X 2 (t i , m), docNum represents the total number of documents, and A refers to the number of documents in all documents in field m. i The frequency of B represents the term t outside the domain m i The number of documents with a frequency of 0, C refers to the number of documents outside the field m. i The frequency of t in all documents in domain m is referred to as i The number of documents with a frequency of 0;

[0035] (2.3) The domain information representation is converted into the relative probability of domain information using the following function, which is easier to compare and calculate:

[0036]

[0037] Among them, m represents the field, the total number of fields is M, p m Indicates the ratio of the current field's index to the sum of all field's indexes.

[0038] Preferably, in step (2), after obtaining the domain information, the domain analysis model parameters are trained using the training set, and the optimal parameters are selected using the test set;

[0039] During the query process, after the query statement is input into the domain analysis module to obtain domain information, the top k domains are taken according to the threshold, and the index information table is matched and screened to obtain domain-related temporary index information. The threshold needs to obtain an appropriate value in the specific experiment.

[0040] Preferably, in step (3), in each query, a reasonable weight is assigned to each term according to its semantic importance; the query statement is divided into several terms using the finest granularity mode, the term information is regarded as an information sequence, and the query statement is used to search and select information in the information sequence, adopting a "soft" selection method to extract some from all information, and the more relevant information is extracted, the more it is extracted;

[0041] The weight calculation process is as follows: the information sequence is T{t1, t2, ..., t n}, t1~t n Represents the vector representation of each term generated by converting n terms into a text-to-vector. q represents the vector representation of the query statement after text-to-vector conversion. The two belong to the same dimensional space. Define an extraction variable z∈[1,n] to represent the term number of the selected information. That is, z=i means that the i-th input information is selected. Then calculate the probability w of selecting the i-th input information given q and T. i :

[0042]

[0043] Among them, w i The probability vector formed is called weight distribution, l i is the length of the i-th term, s(t i , q) is the scoring function, L is the length of the query statement, n refers to the number of partition terms or the dimension of the input information, t i T It represents the transpose of the vector generated after the text-vector conversion. The inner product of two vectors of the same dimension can be written as the transpose of one vector multiplied by another vector. The formula takes into account the influence of the term length li on its semantics and weight. Calculate the scoring function s(t i ,q) takes into account the influence of the query length in order to obtain a more reasonable weight distribution;

[0044] The weight distribution represents the information x of the i-th term in the input information vector X when a given query is given. iThe degree of relevance to the query q. After training, the longer the term, the greater the weight. Content words have greater weight than function words. Content words that appear less frequently in the database have greater weight than those that appear more frequently.

[0045] The frequency of each hit term in the document list in the temporary index information table obtained after the domain analysis is taken out and multiplied by the corresponding weight. However, simple weighting does not take into account the influence of document length. This solution takes document length into account, as shown in the following formula. After comprehensive analysis, the document score is obtained: i Represents word frequency, sorting the documents in the candidate sequence from high to low according to the score;

[0046]

[0047] Preferably, in step (4), the document scores are normalized based on the length of the query and the word segmentation. For longer queries, more terms are generated after word segmentation, and accordingly, the document scores are higher. In order to balance the problem that the document scores of different queries are too different and cannot be compared, this method is designed to normalize the document scores, specifically:

[0048] Get the word segmentation results and their weights for the query statement. For each document, calculate the normalization coefficient C as the inverse of the square root of the sum of the square weights of each term in the query multiplied by the query statement length. Multiply the score of each document in the query result by the score normalization coefficient, as shown in the following formula:

[0049]

[0050] docScore (Norm) =C·docScore

[0051] Among them, L represents the length of the query statement, l i represents the length of the i-th term, w n (n=1, 2, ..., n) is the weight distribution value assigned to each term. Since the scores of result documents of the same query are multiplied by the same coefficient, the score normalization module does not change the ranking of the search results.

[0052] Where the present invention is not exhaustive, please refer to the prior art.

[0053] The beneficial effects of the present invention are:

[0054] 1. The present invention provides a method for extracting domain information from query statements based on semantic analysis. It proposes to integrate three influencing factors on the initial semantic information, give balanced consideration to various types of words, extract domain information, and generate a domain-related temporary index information table based on the existing index information table. This eliminates the situation where documents from different fields appear in the retrieval results, effectively improves the retrieval accuracy, and realizes the optimization of the retrieval results.

[0055] 2. The present invention provides a query statement term weight assignment method based on semantic information, and proposes a term weight assignment scheme based on semantic matching. Taking into account the different importance of different terms in query statements, a model is trained to adaptively assign weights to each term of different queries, effectively improving the efficiency of legal and regulatory retrieval, while also making the retrieval results more scientific, bringing great convenience to the searcher.

[0056] 3. The present invention provides a document score normalization method based on query statements, and proposes to calculate a normalization coefficient for different query statements and include it in the document score of the query results, so that the query results can be intuitively compared, and it is convenient to further convert the document score into a percentage form for intuitive review and evaluation by searchers. BRIEF DESCRIPTION OF THE DRAWINGS

[0057] The drawings in the specification, which constitute a part of this application, are used to provide further understanding of this application. The illustrative embodiments of this application and their descriptions are used to explain this application and do not constitute improper limitations on this application.

[0058] Figure 1 A flowchart of a method for searching laws and regulations based on semantic information weighting provided by the present invention;

[0059] Figure 2 A schematic diagram of the inverted index information provided by the present invention;

[0060] Figure 3 Schematic diagram of the query statement domain analysis module provided by the present invention;

[0061] Figure 4 This is a schematic diagram of the semantic weight distribution of query statements provided by the present invention. DETAILED DESCRIPTION

[0062] In order to enable those skilled in the art to better understand the technical solutions in this specification, the technical solutions in the embodiments of the present invention are clearly and completely described below in conjunction with the drawings in the implementation of this specification, but are not limited to this. For matters not fully described in the present invention, reference may be made to conventional technology in the art.

[0063] Example 1

[0064] A legal and regulatory retrieval system based on semantic information weighting includes an index generation module, a domain analysis module, a semantic weight assignment module, and a score normalization module. The index generation module is used to introduce word segmentation and indexing processing of data in a legal and regulatory database into an IK Analyzer to generate an index information table, which is then structured and merged to form an index database.

[0065] The domain analysis module includes a domain analysis model, which is used to input the query statement input by the user into the trained domain analysis model for domain analysis, and match the domain analysis results with the index database to obtain domain-related temporary index information;

[0066] The semantic weight assignment module includes a trained semantic weight assignment model for assigning weights to each term in the query statement, and taking the weights assigned to each term into account in the document similarity calculation to comprehensively obtain a document score;

[0067] The score normalization module is used to perform normalization processing on document scores.

[0068] Example 2

[0069] A method for legal and regulatory retrieval based on semantic information weighting, such as Figure 1 As shown, the following steps are included:

[0070] (1) The data in the legal and regulatory database is processed to generate an index information table, which is then structured and merged to form an index database. During this process, IK Analyzer is introduced to achieve better word segmentation results.

[0071] (2) Preprocess and analyze the query statement entered by the user, and take the top k domain analysis results to match and filter with the index database to obtain domain-related temporary index information;

[0072] (3) Assign reasonable weights to each term in the query statement, and include the weights assigned to each term in the document similarity calculation to obtain a comprehensive document score;

[0073] (4) Normalize the document scores from step (3).

[0074] Example 3

[0075] A method for searching laws and regulations based on semantic information weighting is as described in Example 2, except that the specific implementation of step (1) is as follows:

[0076] For each unstructured Chinese text field in each data document in the laws and regulations database (each law and regulation data corresponding to an ID has multiple fields, such as the content of the law, the category and scope of the law, the issuing department, the issuing date, the document number, the type of the law, etc. These fields are all text fields. Among them, the content field of the law is an unstructured Chinese text field because the content of this field is long and does not contain elements such as format and text structure, only single words, and the retrieval is mainly carried out from the content of this field), use IK Analyzer to divide the Chinese text content into several terms, such as Figure 2 as shown (set short text for example description):

[0077] Doc1: The People's Republic of China

[0078] Its terms: The People's Republic of China, the Chinese people, China, the Chinese, the People's Republic, the Republic, republican, country

[0079] Doc2: The Chinese National Culture Promotion Society

[0080] Its terms: the Chinese nation, China, national culture, nation, culture, promotion society, promotion

[0081] When building an index, first add the 8 terms separated from Doc1 to the term column of the index information table. In this process, stop words should be removed. The ID of Doc1 and the term frequency corresponding to the term are added to the document information column together. When building an index for Doc2, new terms such as "the Chinese nation" and "national culture" are supplemented and added below the term column, and the ID of Doc2 and the term frequency corresponding to the term are also added. For the term "China" that already exists in the index information table, directly add the ID of Doc2 and its corresponding term frequency to the document information column corresponding to "China".

[0082] Example 4​​​​​​​​​​​​​​D. Perform a union operation on all the terms after removing the stop words to construct a dictionary containing all the words that appear in the document after word segmentation and removing the stop words.

[0088] When querying, the query statement is input into the trained domain analysis model to extract domain information. The domain analysis model structure is as follows: Figure 3 As shown in Figure 2, when performing domain analysis in step (2), the information point space generated in the preprocessing stage ("information point space" refers to the set of remaining terms after deduplication and stop words are removed, which still contains many redundant words irrelevant to the domain analysis) is still relatively large for domain analysis, and the information points are sparse, which affects the retrieval efficiency and accuracy. Therefore, it is necessary to reduce the complexity of text information points. The process of domain analysis is as follows:

[0089] (2.1) For each training sample, after word segmentation and stop word removal, we first filter out noise and information with low semantic contribution based on word frequency or information gain evaluation methods, and select information that is more important to semantic information and contributes more to semantic expression as the initial information point;

[0090] Term frequency refers to how often each term appears in the sample data. Information gain, a concept in information theory, refers to the increase in information each term brings to the training sample. The lower the probability of a term appearing across all documents, the higher the information gain it brings. For example, in the sentence "Law firms and their lawyers engaged in trademark agency business are subject to these Measures. "Law firms" as referred to in these Measures refer to lawyers' practice establishments. "Lawyers" as referred to in these Measures refer to practitioners who have obtained a lawyer's license in accordance with the law and are assigned by law firms to provide legal services to clients," the term "law firm" has a high frequency and should be retained during screening. However, "these Measures" likely appears frequently across all document data, so the information gain it brings is negligible and has little impact on expressing the main idea of ​​the sentence. Therefore, it can be removed during filtering. Taking both aspects into consideration, a low threshold is set to initially filter out only words with extremely low frequency and low information content.

[0091] (2.2) The initial information points are still of high dimensionality and contain many information points that do not contribute much to domain analysis. In order to preserve the structural information of the text while reducing irrelevant interference information, the domain-related information points are further extracted through the information point mapping conversion algorithm. This achieves the effect of using less data information to preserve more domain characteristics of the original data points. The mapping representation of each term for each domain is summed up and used as the domain information representation of the document. Specifically,

[0092] Most existing algorithms consider only one aspect, focusing on resolving the impact of a certain factor on the information conversion algorithm. For example, the mutual information algorithm focuses on high-frequency words and ignores rare words, resulting in the loss of some important words. The document frequency algorithm easily filters out uncommon words that are of great significance to the text. This invention integrates three influencing factors: mutual information, document frequency, and chi-square test. This method can overcome the shortcomings of existing methods and improve the efficiency and accuracy of domain analysis.

[0093]

[0094] in, is the domain information representation generated in the previous step, v m is the domain information representation, I(t i , m) represents the term t i Mutual information with domain m, the larger the value, the more likely the term t is i The higher the co-occurrence rate with domain m, the higher the 2 (ti, m) is the chi-square test used to test the gap between the actual value of statistical data and the theoretical inference, which is used to characterize the difference between the actual value of the statistical data and the theoretical inference. i The degree of correlation between the domain m, DF(t i , m) represents t i The ratio of the number of occurrences in domain m to the number of occurrences in all documents. E1, E2, and E3 represent the balance coefficients. E1, E2, and E3 can be 0.7, 1.5, and 3, respectively.

[0095]

[0096] Calculate X 2 (t i , m), docNum represents the total number of documents, and A refers to the number of documents in all documents in field m. i The frequency of B represents the term t outside the domain m i The number of documents with a frequency of 0, C refers to the number of documents outside the field m. i The frequency of t in all documents in domain m is referred to as i The number of documents with a frequency of 0;

[0097] (2.3) The domain information representation is converted into the relative probability of domain information using the following function, which is easier to compare and calculate:

[0098]

[0099] Among them, m represents the field, the total number of fields is M, p m Indicates the ratio of the current field's index to the sum of all field's indexes.

[0100] Preferably, in step (2), after obtaining the domain information, the domain analysis model parameters are trained using the training set, and the optimal parameters are selected using the test set;

[0101] During the query process, after the query statement is input into the domain analysis module to obtain domain information, the top k domains are taken according to the threshold, and the index information table is matched and screened to obtain domain-related temporary index information. The threshold needs to obtain an appropriate value in the specific experiment.

[0102] For example, if you query "Notice of Zhuhai Municipal Housing and Urban-Rural Development Bureau on Issuing the 'List of Spot Check Items of Zhuhai Municipal Housing and Urban-Rural Development Bureau (2022)' and the 'Joint Spot Check Work Plan of Zhuhai Municipal Housing and Urban-Rural Development Bureau in 2022'", you will get the analysis results of M fields, which are arranged in descending order of relative probability as follows:

[0103] [“Construction Industry”: p1, “Real Estate”: p2, “Land”: p3, “Government Work”: p4, … “Statistics”: p M 】

[0104] The optimal threshold is determined through experiments to make the intercepted field information as comprehensive as possible without being redundant. The top k results "construction industry", "real estate", and "land" are taken according to the threshold and matched with the index information to automatically obtain the index information of the relevant fields as a new temporary index information table.

[0105] Example 5

[0106] A method for searching for laws and regulations based on weighted semantic information is as described in Example 4, except that, in step (3), a reasonable weight is assigned to each term in each query according to its semantic importance; the query statement is divided into a number of terms using the finest granularity mode, the term information is regarded as an information sequence, and the query statement is used to search and select information in the information sequence, adopting a "soft" selection method to extract some information from all information, and the more relevant information is extracted, the more it is extracted;

[0107] The weight calculation process is as follows: the information sequence is T{t1, t2, ..., t n}, t1~t n Represents the vector representation of each term generated by converting n terms into a text-to-vector. q represents the vector representation of the query statement after text-to-vector conversion. The two belong to the same dimensional space. Define an extraction variable z∈[1,n] to represent the term number of the selected information. That is, z=i means that the i-th input information is selected. Then calculate the probability w of selecting the i-th input information given q and T. i :

[0108]

[0109] Among them, w i The probability vector formed is called weight distribution, l i is the length of the i-th term, s(t i , q) is the scoring function, L is the length of the query statement, n refers to the number of partition terms or the dimension of the input information, t i T It represents the transpose of the vector generated after the text-vector conversion. The inner product of two vectors of the same dimension can be written as the transpose of one vector multiplied by another vector. The formula takes the term length l into account. i The impact on its semantics and weight. Calculate the scoring function s(t i ,q) takes into account the influence of the query length in order to obtain a more reasonable weight distribution;

[0110] The weight distribution represents the information x of the i-th term in the input information vector X when a given query is given. i The degree of relevance to the query q. After training, the longer the term, the greater the weight. Content words have greater weight than function words. Content words that appear less frequently in the database have greater weight than those that appear more frequently.

[0111] The frequency of each hit term in the document list in the temporary index information table obtained after the domain analysis is taken out and multiplied by the corresponding weight. However, simple weighting does not take into account the influence of document length. This solution takes document length into account, as shown in the following formula. After comprehensive analysis, the document score is obtained: i Represents word frequency, sorting the documents in the candidate sequence from high to low according to the score;

[0112]

[0113] If the query is "People's Republic of China", Figure 4 As shown, according to the above word segmentation results, the sentence is divided into:

[0114] t1: People's Republic of China t2: Chinese People t3: China t4: Chinese

[0115] t5: People's Republic t6: Republic t7: Republic t8: Country

[0116] For these 8 terms, we match each term with the query and get the semantic information weights w1 to w8. The semantic information matching degree of t1: People’s Republic of China is the highest, and its assigned weight w1 is also the largest. For the document “Docl: People’s Republic of China”, the frequency of its hits t1 to t8 is 1, that is, x1 to x s are all 1, and the score of the document is calculated as Further calculate the scores of all documents in the candidate sequence and sort the results from high to low according to the document scores.

[0117] Example 6

[0118] A method for searching for laws and regulations based on weighted semantic information is as described in Example 5, except that for each query, after obtaining the terms and their corresponding weights for the query statement, a normalization coefficient is calculated, and the score of each document in the query result is multiplied by the score normalization coefficient. For example, for a query of "People's Republic of China", the terms t1 to t8 and the corresponding weights w1 to w8 generated after word segmentation are obtained, and the normalization coefficient of the query is:

[0119]

[0120] Here, L0 represents the query length (7), and 7, 4, 2, and so on represent the corresponding term lengths. The document scores for this query are multiplied by the normalization coefficient C0. This step normalizes the document scores, which can then be converted to percentages for a more intuitive interpretation.

[0121] The above is a preferred embodiment of the present invention. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principles of the present invention. These improvements and modifications should also be regarded as within the scope of protection of the present invention.

Claims

1. A legal and regulatory retrieval system based on semantic information weighting, characterized in that: It includes an index generation module, a domain analysis module, a semantic weight assignment module, and a score normalization module. The index generation module is used to introduce the data in the legal database into the IK Analyzer for word segmentation and indexing processing, generate an index information table, and form an index database after structured merging; The domain analysis module includes a domain analysis model, which is used to input the query statement input by the user into the trained domain analysis model for domain analysis, and match the domain analysis results with the index database to obtain domain-related temporary index information; The semantic weight assignment module includes a trained semantic weight assignment model for assigning weights to each term in the query statement, and taking the weights assigned to each term into account in the document similarity calculation to comprehensively obtain a document score; The score normalization module is used to normalize the document scores; The process of domain analysis is: (2.1) For each training sample, after word segmentation and stop word removal, we first filter out noise and information with low semantic contribution based on word frequency or information gain evaluation methods, and select information that is important to semantic information and contributes most to semantic expression as the initial information point; (2.2) The initial information points are further extracted from the domain-related information points through the information point mapping conversion algorithm. The mapping representations of each term for each domain are summed up and used as the domain information representation of the document. Specifically, Integrate mutual information, document frequency, and chi-square test to improve the efficiency and accuracy of domain analysis; in, is the domain information representation generated in the previous step, v m is the domain information representation, I(t i , m) represents the term t i Mutual information with domain m, the larger the value, the more likely the term t is i The higher the co-occurrence rate with domain m, the higher the 2 (t i , m) is the chi-square test used to test the gap between the actual value of statistical data and the theoretical inference, used to characterize the difference between the actual value of the statistical data and the theoretical inference. i The degree of correlation between the domain m, DF(t i , m) represents t i The ratio of the number of occurrences in domain m to the number of occurrences in all documents. E1, E2, and E3 represent the balance coefficients. Calculate X 2 (t i , m), docNum represents the total number of documents, and A refers to the number of documents in all documents in field m. i The frequency of B represents the term t outside the domain m. i The number of documents with a frequency of 0, C refers to the number of documents outside the field m. i The frequency of t in all documents in domain m is referred to as i The number of documents with a frequency of 0; (2.3) The domain information representation is converted into the relative probability of domain information using the following function, which is easier to compare and calculate: Among them, m represents the field, the total number of fields is M, p m Indicates the ratio of the current field's index to the sum of all field's indexes.

2. A method for legal and regulatory retrieval based on semantic information weighting, characterized in that: The steps include: (1) The data in the legal and regulatory database is processed to generate an index information table, which is then structured and merged to form an index database. In this process, IK Analyzer is introduced to achieve better word segmentation results. (2) Preprocess and perform domain analysis on the query statement input by the user, and take the top k domain analysis results to match and screen with the index database to obtain temporary index information related to the domain; (3) Assign reasonable weights to each term in the query statement, and include the weights assigned to each term in the document similarity calculation to obtain a comprehensive document score; (4) Normalize the document scores from step (3); The process of domain analysis in step (2) is: (2.1) For each training sample, after word segmentation and stop word removal, we first filter out noise and information with low semantic contribution based on word frequency or information gain evaluation methods, and select information that is important to semantic information and contributes most to semantic expression as the initial information point; (2.2) The initial information points are further extracted from the domain-related information points through the information point mapping conversion algorithm. The mapping representations of each term for each domain are summed up and used as the domain information representation of the document. Specifically, Integrate mutual information, document frequency, and chi-square test to improve the efficiency and accuracy of domain analysis; in, is the domain information representation generated in the previous step, v m is the domain information representation, I(t i , m) represents the term t i Mutual information with domain m, the larger the value, the more likely the term t is i The higher the co-occurrence rate with domain m, the higher the 2 (t i , m) is the chi-square test used to test the gap between the actual value of statistical data and the theoretical inference, used to characterize the difference between the actual value of the statistical data and the theoretical inference. i The degree of correlation between the domain m, DF(t i , m) represents t i The ratio of the number of occurrences in domain m to the number of occurrences in all documents. E1, E2, and E3 represent the balance coefficients. Calculate X 2 (t i , m), docNum represents the total number of documents, and A refers to the number of documents in all documents in field m. i The frequency of B represents the term t outside the domain m. i The number of documents with a frequency of 0, C refers to the number of documents outside the field m. i The frequency of t in all documents in domain m is referred to as i The number of documents with a frequency of 0; (2.3) The domain information representation is converted into the relative probability of domain information using the following function, which is easier to compare and calculate: Among them, m represents the field, the total number of fields is M, p m Indicates the ratio of the current field's index to the sum of all field's indexes.

3. The method for searching laws and regulations based on semantic information weighting according to claim 2 is characterized in that: The specific implementation of step (1) is as follows: The documents in the legal regulations database are divided into terms, and the inverted index is used to realize the mapping relationship between terms and documents. Specifically: Split the first document into several terms, add the terms into the term column of the index information table, and add the document ID into the information column after each term in the index information table. Then split the second document into several terms. If a word already exists in the index information table, add the ID of the second document after it. If a new word appears, add it to the index column of the index information table. Repeat this cycle to process the original data into an index information table. The IK Analyzer is introduced in the above process. It maintains a professional vocabulary library in the field of legal and regulatory data as its extended vocabulary. During the word segmentation process, these professional vocabulary are divided into one word to improve the accuracy of word segmentation in this field. In addition, a stop word library is maintained so that the indexing process and retrieval process ignore function words to improve retrieval accuracy.

4. The method for searching laws and regulations based on semantic information weighting according to claim 2 is characterized in that: The preprocessing method in step (2) is: A. First, the legal and regulatory dataset is divided into a training set and a test set; B. Process the training and test sets, including using IK Analyzer to segment documents into several terms according to the finest granularity; C. Remove stop words; D. Perform a union operation on all the terms after removing the stop words to construct a dictionary containing all the words that appear in the document after word segmentation and removing the stop words.

5. The method for searching laws and regulations based on semantic information weighting according to claim 4 is characterized in that: In step (2), after obtaining the domain information, the training set is used to train the domain analysis model parameters, and the test set is used to select the optimal parameters; During the query process, after the query statement is input into the domain analysis module to obtain domain information, the first k domains are taken, the index information table is matched and screened, and temporary index information related to the domain is obtained.

6. The method for searching laws and regulations based on semantic information weighting according to claim 5 is characterized in that: In step (3), in each query, a reasonable weight is assigned to each term according to its semantic importance; Divide the query into several terms using the finest granularity mode, treat the term information as an information sequence, and use the query to find and select information in the information sequence; The weight calculation process is as follows: the information sequence is T{t1, t2, ..., t n }, t1~t n Represents the vector representation of each term generated by converting n terms into a text-to-vector. q represents the vector representation of the query statement after text-to-vector conversion. The two belong to the same dimensional space. Define an extraction variable z∈[1,n] to represent the term number of the selected information. That is, z=i means that the i-th input information is selected. Then calculate the probability w of selecting the i-th input information given q and T. i : Among them, w i The probability vector formed is called weight distribution, l i is the length of the i-th term, s(t i , q) is the scoring function, L is the length of the query statement, n refers to the number of partition terms or the dimension of the input information, t i T Represents the transpose of the vector generated after text-to-vector conversion; The weight distribution represents the information x of the i-th term in the input information vector X when a given query is given. i The degree of relevance to the query q. After training, the longer the term, the greater the weight. Content words have greater weight than function words. Content words that appear less frequently in the database have greater weight than those that appear more frequently. The frequency of each hit term in the document list in the temporary index information table obtained after the domain analysis is taken out, and multiplied by the corresponding weight, and the document score is obtained after integration, where d represents the document length, x represents the document length, and i Represents word frequency, sorting the documents in the candidate sequence from high to low according to the score; 7. The method for searching laws and regulations based on semantic information weighting according to claim 6 is characterized in that: In step (4), the document score is normalized based on the length and word segmentation of the query statement, specifically: Get the word segmentation results and their weights for the query statement. For each document, calculate the normalization coefficient C as the inverse of the square root of the sum of the square weights of each term in the query multiplied by the query statement length. Multiply the score of each document in the query result by the score normalization coefficient, as shown in the following formula: docScore (Norm) =C·docScore Among them, L represents the length of the query statement, l i represents the length of the i-th term, w n (n=1, 2, ..., n) is the weight distribution value assigned to the term.

Citation Information

Patent Citations

  • Domain text extraction method and apparatus, terminal device and storage medium

    CN108804617A

  • Science and technology text classification method based on improved mutual information function

    CN111930892A