Legal provision retrieval method and device, electronic equipment and storage medium

By extracting the semantic vectors of legal issues and obtaining relevant legal field keywords, combined with the hierarchical labels of legal provisions, the target legal provisions can be quickly matched, solving the problems of low retrieval efficiency and low matching degree in existing technologies, and achieving efficient and accurate legal provision retrieval.

CN120804293APending Publication Date: 2025-10-17GUANGDONG ESHORE TECH

Patent Information

Application Number
CN202510978998.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-07-16
Publication Date
2025-10-17

AI Technical Summary

Technical Problem

In the existing technology, the legal question sentences input by users have a strong colloquial color and contain non-critical information, which leads to inaccurate semantic vectors of legal questions, low retrieval efficiency and prone to errors, and low matching degree between legal provisions and questions.

Method used

By extracting the semantic vector of the legal issue, we obtain the K most relevant legal field keywords, and use the legal provisions-legal field keywords-hierarchical label pairing in the preset database to quickly match the candidate legal provisions, and select the target legal provisions based on the semantic vector similarity.

Benefits of technology

It improves the efficiency of legal text retrieval and its matching degree with issues, ensuring that the retrieval results more accurately reflect the core content of legal issues.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120804293A_ABST
    Figure CN120804293A_ABST
Patent Text Reader

Abstract

The invention relates to a legal provision retrieval method and device, electronic equipment and a storage medium. The method comprises the following steps: extracting semantic vectors of legal questions; according to the semantic vector of the legal question, obtaining K legal field keywords most related to the legal question; and according to the K legal field keywords, obtaining a target legal provision comprising at least one legal field keyword in the K legal field keywords. According to the scheme provided by the invention, the efficiency of retrieving the legal provisions according to the legal questions can be improved, and the matching degree of the legal provisions and the legal questions is improved.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of information search, in particular to a legal provision retrieval method and device, an electronic device and a storage medium. BACKGROUND

[0002] A semantic vector is a technology for calculating the semantic similarity of text. It can convert text into a vector representation, and measure the semantic similarity between texts by calculating the distance or similarity between vectors.

[0003] In related technologies, relevant legal provisions are retrieved according to legal issues. The semantic vectors of legal issues and legal provisions are respectively obtained, and the legal provisions with higher relevance to the legal issues are retrieved by calculating the vector similarity between the semantic vectors of the legal issues and the semantic vectors of the legal provisions. However, the legal issue sentences input by the user often have strong colloquial characteristics, and contain not only directly related legal questions, but also a large amount of non-key information, such as habitual expressions in daily conversations, emotional expressions, unnecessary detailed descriptions, etc. The user may use lengthy descriptions to describe the process of a legal dispute, but in fact, the key information of the legal issue may only involve whether a specific provision or behavior is illegal. The non-key information input by the user may become "noise" in the semantic vectorization process of the legal issue, which may cover the useful key information, and the semantic vector of the legal issue is not accurate enough. Moreover, the number of legal provisions is large and the content is complex. Directly retrieving the legal provisions with higher relevance to the legal issues according to the vector similarity between the semantic vectors of the legal issues and the semantic vectors of the legal provisions not only takes a long time, but also is prone to retrieval errors, resulting in low matching between the retrieved legal provisions and the legal issues.

[0004] In summary, the related technologies retrieve relevant legal provisions according to the semantic vectors of legal issues, which has low retrieval efficiency, is prone to retrieval errors, and has low matching between the retrieved legal provisions and the legal issues. SUMMARY

[0005] To solve or partially solve the problems in the related technologies, the present application provides a legal provision retrieval method, device, electronic device and storage medium, which can improve the efficiency of retrieving legal provisions according to legal issues and improve the matching degree between legal provisions and legal issues.

[0006] The first aspect of the present application provides a legal provision retrieval method, which comprises: extracting a semantic vector of a legal issue; obtaining K legal field keywords most relevant to the legal issue according to the semantic vector of the legal issue; obtaining a target legal provision including at least one legal field keyword in the K legal field keywords according to the K legal field keywords.

[0007] In an embodiment, the obtaining, according to the semantic vector of the legal question, K legal field keywords most relevant to the legal question comprises: calculating vector cosine similarity between the semantic vector of the legal question and semantic vectors of the legal field keywords; obtaining K semantic vectors of legal field keywords nearest to the semantic vector of the legal question according to the vector cosine similarity; obtaining, according to the K semantic vectors of legal field keywords, K legal field keywords most relevant to the legal question.

[0008] In an embodiment, the obtaining, according to the K legal field keywords, a target legal provision comprising at least one legal field keyword in the K legal field keywords comprises: obtaining, according to the K legal field keywords, candidate legal provisions comprising at least one legal field keyword in the K legal field keywords from a preset database; obtaining, according to the legal question and the K legal field keywords, an augmented legal question corresponding to the legal question, wherein the augmented legal question comprises the legal question and the K legal field keywords; obtaining, according to the semantic vector of the augmented legal question, a target legal provision in the candidate legal provisions.

[0009] In an embodiment, the obtaining, according to the semantic vector of the augmented legal question, a target legal provision in the candidate legal provisions comprises: obtaining, in the preset database, k legal field keywords and hierarchical labels corresponding to the candidate legal provisions; obtaining, according to the candidate legal provision, the k legal field keywords and the hierarchical labels, an augmented candidate legal provision corresponding to the candidate legal provision, wherein the augmented candidate legal provision comprises the candidate legal provision, the k legal field keywords and the hierarchical labels; obtaining, according to vector cosine similarity between the semantic vector of the augmented legal question and semantic vectors of the augmented candidate legal provisions, L semantic vectors of the augmented candidate legal provisions nearest to the semantic vector of the augmented legal question; obtaining, according to the L semantic vectors of the augmented candidate legal provisions, L target legal provisions in the candidate legal provisions.

[0010] In an embodiment, the expanded legal issue is obtained in a splicing manner according to the legal issue, the K legal field keywords, and in order. The expanded candidate legal provision is obtained in a splicing manner according to the candidate legal provision, the k legal field keywords, and the hierarchical label, and in order.

[0011] In an embodiment, the preset database comprises a preset legal provision-legal field keyword-hierarchical label pairing database; wherein, the step of presetting the legal provision-legal field keyword-hierarchical label pairing database comprises: The hierarchical label of the legal provision is obtained. The semantic vector of the legal provision is obtained. The semantic vector of the legal field keyword is obtained. The semantic vector of the k legal field keywords nearest neighbor to the semantic vector of the legal provision is obtained according to the vector cosine similarity between the semantic vector of the legal provision and the semantic vector of the legal field keyword. The k legal field keywords of the legal provision are obtained according to the semantic vector of the k legal field keywords. The legal provision, the k legal field keywords, and the hierarchical label are one-to-one corresponding, and the preset legal provision-legal field keyword-hierarchical label pairing database is constructed.

[0012] In an embodiment, before the semantic vector of the legal issue is extracted, the legal issue is preprocessed to obtain a preprocessed legal issue.

[0013] The second aspect of the present application provides a legal provision retrieval device, the device comprises: The semantic vector of the legal issue is extracted. The K legal field keywords most relevant to the legal issue are obtained according to the semantic vector of the legal issue extracted by the semantic module. The target legal provision comprising at least one legal field keyword in the K legal field keywords is obtained according to the K legal field keywords obtained by the first retrieval module.

[0014] The third aspect of the present application provides an electronic device, comprising: A processor; and A memory having executable code stored thereon, when the executable code is executed by the processor, the processor executes the method as described above.

[0015] The fourth aspect of the present application provides a computer readable storage medium having executable code stored thereon, which, when executed by a processor of an electronic device, causes the processor to perform the method described above.

[0016] The fifth aspect of the present application provides a computer program product comprising computer instructions, which, when executed by a processor, implement the method described above.

[0017] The technical solution provided by the present application can include the following beneficial results: The technical solution of the present application obtains K legal field keywords most relevant to a legal question according to a semantic vector of the legal question, and obtains a target legal provision including at least one legal field keyword in the K legal field keywords according to the K legal field keywords. The legal question semantic vector is mapped to a legal field keyword space, and the core legal terms and concepts in the legal question are extracted through the legal field keywords to truly reflect the legal question. The legal provisions are pre-added with legal field keywords, so that during real-time retrieval of relevant legal provisions according to the legal question, the legal field keywords of the legal question and the legal field keywords of the legal provisions can be quickly matched to obtain candidate legal provisions; and according to the semantic vector of the legal question and the semantic vector of the candidate legal provisions, the target legal provision most relevant to the legal question is selected from the candidate legal provisions, which accelerates the retrieval and improves the efficiency of retrieving legal provisions according to legal questions and the matching degree of legal provisions and legal questions. It should be understood that the foregoing general description and the following detailed description are only exemplary and explanatory, and are not limiting to the present application. BRIEF DESCRIPTION OF DRAWINGS

[0018] The above and other objects, features and advantages of the present application will become more apparent from the following detailed description when taken in conjunction with the accompanying drawings, in which like reference characters refer to like parts throughout the several views, and in which:

[0019] Figure 1 is a flowchart of a legal provision retrieval method shown in an embodiment of the present application; Figure 2 is another flowchart of a legal provision retrieval method shown in an embodiment of the present application; Figure 3 is a flowchart of a legal provision retrieval method shown in an embodiment of the present application; Figure 4 is a flowchart of a legal provision retrieval method shown in an embodiment of the present application; Figure 5This is a flow chart of the legal text retrieval method for constructing a matching database shown in an embodiment of the present application; Figure 6 This is another flowchart of the legal text retrieval method for constructing a matching database shown in an embodiment of the present application; Figure 7 Schematic diagram of the structure of the legal text retrieval device shown in an embodiment of the present application; Figure 8 This is another structural diagram of the legal text retrieval device shown in an embodiment of the present application; Figure 9 It is a structural diagram of an electronic device shown in an embodiment of the present application. DETAILED DESCRIPTION

[0020] The following describes embodiments of the present application in more detail with reference to the accompanying drawings. Although the accompanying drawings illustrate embodiments of the present application, it should be understood that the present application can be implemented in various forms and should not be limited by the embodiments described herein. Rather, these embodiments are provided to make the present application more thorough and complete, and to fully convey the scope of the present application to those skilled in the art.

[0021] The terms used in this application are for the purpose of describing specific embodiments only and are not intended to limit this application. As used in this application and the appended claims, the singular forms "a," "an," "the," and "the" are intended to include the plural forms, unless the context clearly indicates otherwise. It should also be understood that the term "and / or" as used herein refers to and encompasses any and all possible combinations of one or more of the associated listed items.

[0022] It should be understood that although the terms "first", "second", "third", etc. may be used in this application to describe various information, this information should not be limited to these terms. These terms are only used to distinguish information of the same type from each other. For example, without departing from the scope of this application, the first information may also be referred to as the second information, and similarly, the second information may also be referred to as the first information. Thus, a feature defined as "first" or "second" may explicitly or implicitly include one or more of the features. In the description of this application, the meaning of "plurality" is two or more, unless otherwise clearly and specifically defined.

[0023] The embodiment of the present application provides a legal text retrieval method, which can improve the efficiency of retrieving legal texts based on legal issues and improve the matching degree between legal texts and legal issues.

[0024] The technical solutions of the embodiments of the present application are described in detail below with reference to the accompanying drawings.

[0025] Figure 1is a flowchart of a legal provision retrieval method shown in embodiments of the present application.

[0026] Referring to Figure 1 A legal provision retrieval method comprises: Step 101, extracting a semantic vector of a legal question.

[0027] In an embodiment, the legal question input by the user can be semantically processed to convert the legal question in text format into a semantic vector in vector representation, and the semantic vector of the legal question is obtained.

[0028] Step 102, obtaining K legal field keywords most relevant to the legal question according to the semantic vector of the legal question.

[0029] In an embodiment, the legal field keyword refers to a core term or phrase used for accurate positioning of legal information in legal retrieval, research and practical operation.

[0030] In an embodiment, each legal field keyword in the legal field keyword library can be semantically processed in advance to obtain a legal field keyword semantic vector library composed of semantic vectors of each legal field keyword in the legal field keyword library.

[0031] In an embodiment, the vector similarity between the semantic vector of the legal question and the semantic vector of each legal field keyword can be calculated according to the semantic vector of the legal question and the semantic vector of each legal field keyword in the legal field keyword semantic vector library; K semantic vectors of legal field keywords nearest to the semantic vector of the legal question are searched according to the similarity between the semantic vector of the legal question and the semantic vector of each legal field keyword; and K legal field keywords most relevant to the legal question are obtained according to the K semantic vectors of legal field keywords.

[0032] Step 103, obtaining a target legal provision including at least one legal field keyword in the K legal field keywords according to the K legal field keywords.

[0033] In an embodiment, the legal provision is a textual expression form of the culture of legal norms, which is a basic constitutive factor of normative legal documents, and it is a solid text basis for the construction of a rule-of-law society by conveying legal rules, legal concepts and legal principles to people through textual expression.

[0034] In an embodiment, according to the K legal field keywords, a legal provision including at least one of the K legal field keywords is searched in a preset legal provision-legal field keyword matching library, and the legal provision including at least one of the K legal field keywords is taken as a candidate legal provision; and a target legal provision most relevant to the legal question is obtained from the candidate legal provisions.

[0035] In an embodiment, the vector similarity is a quantitative index for measuring the closeness of two vectors in direction or distance. The vector similarity between the semantic vector of the legal question and the semantic vector of each candidate legal provision is calculated according to the semantic vector of each candidate legal provision and the semantic vector of the legal question; the semantic vector of the candidate legal provision nearest to the semantic vector of the legal question is obtained according to the vector similarity between the semantic vector of the legal question and the semantic vector of each candidate legal provision; and the target legal provision most relevant to the legal question is obtained from the candidate legal provisions according to the semantic vector of the candidate legal provision nearest to the semantic vector of the legal question.

[0036] The legal provision retrieval method of the embodiment of the present application obtains K legal field keywords most relevant to the legal question according to the semantic vector of the legal question; and obtains a target legal provision including at least one of the K legal field keywords according to the K legal field keywords. The legal question semantic vector is mapped to the legal field keyword space, and the core legal terms and concepts in the legal question are extracted through the legal field keywords to truly reflect the legal question. The legal field keywords are added to the legal provisions in advance, so that the candidate legal provisions can be quickly obtained by matching the legal field keywords of the legal question with the legal field keywords of the legal provisions during the real-time retrieval of the relevant legal provisions according to the legal question; and the target legal provision most relevant to the legal question is selected from the candidate legal provisions according to the semantic vector of the legal question and the semantic vector of the candidate legal provisions, thereby accelerating the retrieval and improving the efficiency of retrieving the legal provisions according to the legal question and the matching degree of the legal provisions and the legal question.

[0037] Figure 2 FIG. 6 is another flowchart of the legal provision retrieval method according to an embodiment of the present application; Figure 3 FIG. 7 is a flowchart of the formation of the candidate legal provision library according to the legal provision retrieval method according to an embodiment of the present application; Figure 4 FIG. 8 is a flowchart of the obtaining of the L target legal provisions according to the legal provision retrieval method according to an embodiment of the present application.

[0038] Referring to Figures 2-4 A legal provision retrieval method comprises the following steps: In step 201, a legal question is preprocessed to obtain a preprocessed legal question.

[0039] In an embodiment, the user input legal question can include some unnecessary descriptions. For example, the user input legal question can be: "I want to ask, if a cotton processing factory wants to export textiles listed in the restricted export directory, does it still need to comply with the special supervision requirements for cotton processing enterprises? For example, additional qualification application or special requirements, etc."

[0040] In an embodiment, the user input legal question can be preprocessed, including but not limited to removing stop words of the legal question, removing punctuation of the legal question, uniformizing case, etc.; by preprocessing the legal question, a preprocessed legal question is obtained.

[0041] In an embodiment, regular expressions can be used to remove punctuation (such as commas, periods, etc.) in the legal question text to avoid interfering with semantic processing. A custom legal stop word list can be used to remove non-meaningful words such as "of", "is", and administrative terms such as "hereby notified". English legal text can be converted to lowercase or uppercase.

[0042] Step 202, extracting a semantic vector of the legal question.

[0043] In an embodiment, the preprocessed legal question can be input into a pre-trained semantic vector model, and a semantic vector of the legal question can be extracted by the pre-trained semantic vector model.

[0044] In an embodiment, during the real-time legal question retrieval related legal provisions stage, the preprocessed legal question sentence can be semantically processed based on the pre-trained semantic vector model, a semantic vector Q_VEC (dimension E) of the preprocessed legal question can be extracted, and the preprocessed legal question can be converted to a corresponding semantic vector representation Q_VEC with a dimension of E.

[0045] In an embodiment, the semantic vector model is a deep learning model that can map words, phrases or sentences in a language to vectors in a high-dimensional space, through which the semantic information of each word, phrase or sentence in the language can be captured. The pre-trained semantic vector model can be a model based on BAAI / bge-m3 (an open-source multilingual text embedding model). The semantic vector length parameter of the pre-trained semantic vector model is E, which can be set to 2048. The semantic vector length parameter E represents the dimension size of the semantic vector output by the pre-trained semantic vector model, that is, the vector dimension (i.e., the dimension in the feature space) to which each word or text is encoded, also known as embedding dimension. For example, if the pre-trained semantic vector model outputs a semantic vector with a length of E = 2048, it will represent the input text (such as a sentence or a paragraph) as a floating-point number vector with a length of 2048.

[0046] In an embodiment, a training data set including 3000 long legal questions and 90000 short legal questions can be used, each legal question corresponding to 5 most relevant legal provisions as positive samples and 5 non-relevant legal provisions with high similarity as negative samples, and a model based on BAAI / bge-m3 is pre-trained to obtain a pre-trained semantic vector model.

[0047] In step 203, K legal domain keywords most relevant to the legal question are obtained according to the semantic vector of the legal question.

[0048] In an embodiment, the vector cosine similarity between the semantic vector of the legal question and the semantic vector of the legal domain keyword can be calculated according to the semantic vector of the legal question and the semantic vector of the legal domain keyword. According to the vector cosine similarity, the semantic vectors of the K legal domain keywords nearest to the semantic vector of the legal question are obtained, and according to the semantic vectors of the K legal domain keywords, the K legal domain keywords most relevant to the legal question are obtained.

[0049] In an embodiment, the semantic vector Q_VEC of the legal question can be searched in the legal domain keyword semantic vector library Faiss vector database LAW_KW_VEC_LIB_FS to find the index ID value corresponding to the semantic vector of the K legal domain keywords nearest to the semantic vector Q_VEC in terms of vector cosine similarity, and according to the index ID value, the legal domain keyword library is searched to obtain the K legal domain keywords most relevant to the legal question.

[0050] In an embodiment, a pre-trained semantic vector model can be used to perform semantic vectorization on the legal domain keyword library to obtain semantic vectors of each legal domain keyword in the legal domain keyword library, and a legal domain keyword semantic vector library can be formed by the semantic vectors of each legal domain keyword in the legal domain keyword library.

[0051] In an embodiment, the legal domain keyword library can be traversed (for example, the legal domain keyword library has B legal domain keywords, and B is 9896), and the pre-trained semantic vector model can be input with the N legal domain keywords of the batch data in sequence to output batch semantic vectors of the legal domain keywords with a shape of (N, E), and a legal domain keyword semantic vector library LAW_KW_VEC_LIB with a shape of (B, E) corresponding to the legal domain keyword library can be obtained.

[0052] In an embodiment, the K legal domain keyword semantic vectors nearest to the semantic vector Q_VEC of the legal question can be obtained by vector retrieval according to the semantic vector Q_VEC of the legal question from the semantic vector library LAW_KW_VEC_LIB, and the K legal domain keywords of the legal domain keyword library can be obtained according to the K legal domain keyword semantic vectors.

[0053] In an embodiment, the legal domain keyword semantic vector library LAW_KW_VEC_LIB can be loaded into Faiss (Facebook AI Similarity Search, an open-source high-dimensional vector similarity search library), and recorded as a Faiss vector database LAW_KW_VEC_LIB_FS. The semantic vector Q_VEC of the legal question can be passed to a first Faiss index constructed based on the legal domain keyword semantic vector library LAW_KW_VEC_LIB to calculate the vector cosine similarity between the semantic vector Q_VEC of the legal question and all legal domain keyword semantic vectors in the Faiss vector database LAW_KW_VEC_LIB_FS. According to the vector cosine similarity between the semantic vector of the legal question and each legal domain keyword semantic vector in the Faiss vector database LAW_KW_VEC_LIB_FS, the K legal domain keyword semantic vectors nearest to the semantic vector of the legal question can be returned. According to the K legal domain keyword semantic vectors, the K legal domain keywords corresponding to the K legal domain keyword semantic vectors in the legal domain keyword library can be obtained, and the K legal domain keywords can be used as the K legal domain keywords most relevant to the legal question. The value of K can be 3.

[0054] In an embodiment, the IndexIVFFlat (Approximate Nearest Neighbor (ANN) search index based on Inverted File (IVF) structure) index type can be adopted to construct the first Faiss index of the Faiss vector database LAW_KW_VEC_LIB_FS. The IndexIVFFlat index is an approximate index that trades off some search accuracy for faster search speed and lower memory footprint.

[0055] In an embodiment, the vector dimension of the legal field keywords (2048 dimensions) can be set; the number of cluster centers nlist (usually 1 / 100 of the amount of legal field keyword data B) can be set; the vector is clustered and trained; the vector and its corresponding index ID are added to the index. The Python code example for constructing the first Faiss index is as follows: import faiss import numpy as np # Assume that the legal field keyword library has been pre-processed and semantic vectors have been generated law_keyword_embeddings = LAW_KW_VEC_LIB law_keyword_ids = np.array(range(9896), dtype='int64') # Normalization processing faiss.normalize_L2(law_keyword_embeddings) # Create the first Faiss index, select the IndexIVFFlat type dim = 2048 nlist = 100# Number of cluster centers, usually 1 / 100 of the data amount index = faiss.index_factory(dim, f"IVF{nlist},Flat", faiss.METRIC_INNER_PRODUCT) # Train the cluster center index.train(law_keyword_embeddings) # Add the vector and its corresponding index ID index.add_with_ids(law_keyword_embeddings, law_keyword_ids) # Save the index to a file for later use faiss.write_index(index, 'law_keyword_index.index') Result analysis: From the retrieval results of the Faiss vector database LAW_KW_VEC_LIB_FS, obtain the index ID values corresponding to the K legal field keyword semantic vectors closest to the semantic vector of the legal problem. Through these index ID values, search the legal field keyword library to obtain K legal field keywords corresponding to the K legal field keyword semantic vectors.

[0056] For the example problem, the Python code implementation of the retrieval process is as follows: import faiss # Load the first pre-constructed Faiss index index = faiss.read_index('law_keyword_index.index') # Set search parameters K = 3# Return the top 3 most similar results # Perform retrieval D, I = index.search(Q_VEC, k)# D is the similarity score, I is the corresponding index ID # Analyze the retrieval results most_similar_keywords = [] for id in I[0]: # Find the legal field keyword library law_keyword_db by index ID to obtain the legal field keyword keyword = law_keyword_db.get_keyword_by_id(id) most_similar_keywords.append(keyword) print("The most relevant K legal field keywords:", most_similar_keywords) Retrieval result analysis: For the example user legal problem, the three most relevant legal field keywords retrieved by the system are "Textile Export Management Measures", "Cotton Processing Qualification and Market Management Interim Measures", and "Restricted Export Commodities". These 3 legal field keywords directly reflect the core content of the legal problem, i.e., textile export management, special supervision provisions for cotton processing enterprises, and relevant regulations on restricted export commodities.

[0057] Step 204, according to the K legal field keywords, obtaining candidate legal provisions including at least one legal field keyword in the K legal field keywords from a preset database.

[0058] In an embodiment, the preset database includes a preset legal provision-legal field keyword-hierarchical label pairing database. According to the K legal field keywords most relevant to the legal issue, the legal provision-legal field keyword-hierarchical label pairing database can be traversed, and when the legal field keywords corresponding to a certain legal provision include part or all of the K legal field keywords, the legal provision is taken as a candidate legal provision; the K legal field keywords and the hierarchical label corresponding to the candidate legal provision are obtained from the legal provision-legal field keyword-hierarchical label pairing database; all candidate legal provisions including at least one legal field keyword in the K legal field keywords, and the K legal field keywords and the hierarchical label corresponding to all candidate legal provisions are obtained, forming a candidate legal provision library including candidate legal provisions-legal field keywords-hierarchical labels.

[0059] In an embodiment, the legal field keywords of the legal field keyword table can be vectorized by a pre-trained semantic vector model, and the semantic vector representation thereof is extracted to obtain the semantic vector of each legal field keyword of the legal field keyword table. Each legal provision is vectorized by a pre-trained semantic vector model to obtain the semantic vector of each legal provision; according to the semantic vector of each legal provision and the semantic vector of each legal field keyword, the three legal field keywords closest to the semantic vector of each legal provision are retrieved as the legal field keywords of the legal provision. The multi-level regulation category label to which each legal provision belongs is obtained, and the hierarchical label of each legal provision is obtained, and the hierarchical label of each legal provision, the three legal field keywords and each legal provision are bound to form a legal provision-legal field keyword-hierarchical label pairing database.

[0060] In an embodiment, according to the semantic vector of the legal issue, the semantic vector of the legal issue can be retrieved in the legal field keyword semantic vector library to obtain the three legal field keywords with the highest similarity to the semantic vector of the legal issue, and then the legal provision-legal field keyword-hierarchical label pairing database is traversed. When any one or more of the three legal field keywords corresponding to a certain legal provision is the same as any one or more of the three legal field keywords corresponding to the legal issue, the legal provision and the three legal field keywords and the hierarchical label of the legal provision are included in the candidate legal provision library.

[0061] In an embodiment, a hierarchical label of the legal provision can be acquired; a semantic vector of the legal provision can be acquired; A semantic vector of the legal field keyword is acquired; according to a vector cosine similarity between the semantic vector of the legal provision and the semantic vector of the legal field keyword, a semantic vector of k legal field keywords nearest to the semantic vector of the legal provision is acquired; according to the semantic vectors of the k legal field keywords, k legal field keywords of the legal provision are acquired; the legal provision, the k legal field keywords and the hierarchical label are one-to-one corresponding, and a preset legal provision-legal field keyword-hierarchical label pairing database is constructed.

[0062] Figure 5 is a flowchart of constructing a pairing database by a legal provision retrieval method shown in an embodiment of the present application; Figure 6 is another flowchart of constructing a pairing database by a legal provision retrieval method shown in an embodiment of the present application. Referring to Figure 5 and Figure 6 The construction steps of the preset legal provision-legal field keyword-hierarchical label pairing database include: Step 600, a pre-trained semantic vector model is used to perform semantic vectorization processing on a legal provision library, and a legal provision semantic vector library corresponding to the legal provision library is acquired.

[0063] In an embodiment, the legal provision library (for example, a legal provision library with a total of A legal provisions) can be traversed, and batch data N legal provisions are sequentially input to the pre-trained semantic vector model, and batch semantic vectors with a shape of (N, E) are output, so that a legal provision semantic vector library with a shape of (A, E) corresponding to the legal provision library is acquired.

[0064] Step 610, a pre-trained semantic vector model is used to perform semantic vectorization processing on a legal field keyword library, and a legal field keyword semantic vector library corresponding to the legal field keyword library is acquired.

[0065] Step 620, according to the legal provision semantic vector library and the legal field keyword semantic vector library, k legal field keywords are matched for each legal provision of the legal provision library, and a legal provision-legal field keyword pairing library is formed.

[0066] In an embodiment, the legal provision semantic vector library LAW_VEC_LIB can be split into a list of C legal provision semantic vector groups (C is 10000), and the list is traversed in sequence, and each legal provision semantic vector group is input into the Faiss vector database LAW_KW_VEC_LIB_FS second Faiss index for retrieval, and the index ID value corresponding to the semantic vector group including k legal field keyword semantic vectors with the closest cosine similarity to the current legal provision semantic vector group is found, and the legal field keyword library is searched according to the index ID value, and the k legal field keywords matched with each legal provision in the legal provision library are obtained, and a legal provision-legal field keyword pairing library is formed; wherein the value of k can be 3.

[0067] In an embodiment, the value of C can be determined by considering the GPU server's video memory and computing power.

[0068] It should be noted that the value of K and the value of k can be the same or different.

[0069] In an embodiment, the index type of the second Faiss index is set to IndexFlatIP, which is an exact index with slow search speed but high accuracy. Indexing is based on inner product measurement, which is suitable for many similarity retrieval tasks, especially when the features have been normalized, the inner product can be directly used as a measure of cosine similarity.

[0070] Step 630, according to the hierarchical label of the legal provision, a legal provision-legal field keyword-hierarchical label pairing database is formed.

[0071] In an embodiment, the hierarchical label of the legal provision can be identified by dual labels of naming rules and effectiveness levels. According to the hierarchical dimensions of legal departments and executive power, the legal regulation category label (single or multi-level) of each law is obtained, each legal provision is corresponded to the law it belongs to, and the legal regulation category label of the law is corresponded to the legal provision, and the hierarchical label corresponding to the legal provision is obtained.

[0072] In an embodiment, the hierarchical label corresponding to the legal provision can be fused with the legal provision-legal field keyword pairing library to form a legal provision-legal field keyword-hierarchical label pairing database.

[0073] In an embodiment, legal provisions and their corresponding legal document information can be obtained from a legal database. Legal provision data can be crawled or imported from a legal database (e.g., a national legal regulations database), each legal provision including but not limited to a legal provision ID (a unique identifier), a corresponding legal name, a chapter and clause number, and a legal provision content text. For example: Legal provision ID: LW_202401019_001; Corresponding legal name: Measures for the Quality Management of Export Cotton; Chapter and clause number: Chapter 3 - Inspection and Management - Article 15; Legal provision content text: Picked cotton and small sawtooth processed cotton sold by farmers are not allowed to be exported.

[0074] In an embodiment, multi-level legal regulation category label annotation can be performed based on legal attributes. Legal experts or through rule engine / model recognition mechanisms can classify the corresponding laws according to the following dimensions to generate a multi-level label system: Primary label: indicating the main functional field of the law, such as “commodity inspection and animal and plant quarantine”, “import and export trade management”, “market supervision”, etc.; Secondary label: further refining the subfield under the primary label, such as “import and export commodity quality license”, “agricultural product export restriction”, “customs supervision”, etc.

[0075] For example, for the Measures for the Quality Management of Export Cotton, its core responsibility is to regulate the quality control of exported cotton, which belongs to the “import and export commodity quality license” sub-item under the “commodity inspection and animal and plant quarantine” field.

[0076] Therefore, the hierarchical label corresponding to the above “legal provision content text: Picked cotton and small sawtooth processed cotton sold by farmers are not allowed to be exported” is: Primary label: commodity inspection and animal and plant quarantine; Secondary label: import and export commodity quality license.

[0077] In an embodiment, the hierarchical label corresponding to the legal provision can be paired and fused with the legal provision and legal field keyword in the legal provision-legal field keyword pairing library to form a legal provision-legal field keyword-hierarchical label pairing database.

[0078] In an embodiment, based on the “legal provision-legal field keyword pairing library”, the hierarchical label corresponding to the legal provision can be fused to form a new three-layer paired legal provision-legal field keyword-hierarchical label pairing database. The fields of this database are shown in Table 1, including legal provision ID, legal provision content, primary label, secondary label, and legal field keyword.

[0079]

[0080] An example entry is as follows: { "Article ID": "LW_202401019_001", "Article Content": "Picked cotton and small sawtooth processed cotton sold by farmers are not allowed to be exported.", "Primary Tag": "Commodity Inspection and Animal and Plant Quarantine", "Secondary Tag": "Import and Export Commodity Quality Permit", "Legal Field Keywords": ["Textile Export Management Measures", "Cotton Processing Qualification and Market Management Interim Measures", "Restricted Export Commodities"] } In an embodiment, a legal article-legal field keyword-hierarchical tag pairing database can be established to support query optimization of a structured database. The legal article-legal field keyword-hierarchical tag pairing database can be imported into a relational database (e.g., MySQL, PostgreSQL) for subsequent system calls. At the same time, an index is established to speed up the query: An inverted index is established for the "Legal Field Keywords" field to quickly match related legal articles; A combined index is established for the "Primary Tag" and "Secondary Tag" fields to facilitate filtering of legal articles by regulatory categories.

[0081] Step 205: According to the legal issue and K legal field keywords, an augmented legal issue corresponding to the legal issue is obtained, wherein the augmented legal issue includes the legal issue and the K legal field keywords.

[0082] In an embodiment, the augmented legal issue corresponding to the legal issue can be obtained in a splicing manner according to the order of the legal issue and the K legal field keywords.

[0083] In an embodiment, the legal issue and the K legal field keywords most relevant to the legal issue can be spliced in the string format "<Legal Issue>, <Keyword 1>, <Keyword 2>, <Keyword 3>" to obtain the augmented legal issue corresponding to the legal issue.

[0084] Step 206: According to the candidate legal article, the k legal field keywords corresponding to the candidate legal article, and the hierarchical tag, an augmented candidate legal article corresponding to the candidate legal article is obtained, wherein the augmented candidate legal article includes the candidate legal article, the k legal field keywords, and the hierarchical tag.

[0085] In an embodiment, the k legal field keywords and the hierarchical label corresponding to the candidate legal provision can be obtained in a preset legal provision-legal field keyword-hierarchical label key label pair database; and the augmented candidate legal provision corresponding to the candidate legal provision can be obtained according to the candidate legal provision, the k legal field keywords and the hierarchical label, wherein the augmented candidate legal provision includes the candidate legal provision, the k legal field keywords and the hierarchical label.

[0086] In an embodiment, the augmented candidate legal provision can be obtained in a splicing manner in the order of the candidate legal provision, the k legal field keywords and the hierarchical label. The candidate legal provision library including the candidate legal provision-legal field keyword-hierarchical label is traversed, and for each candidate legal provision, the legal field keyword and the hierarchical label of each candidate legal provision, the string format “<legal provision>, <legal field keyword 1>, <legal field keyword 2>, <legal field keyword 3>, <hierarchical label 1>, <hierarchical label 2>” is spliced to obtain the augmented candidate legal provision corresponding to each candidate legal provision of the candidate legal provision library, and the augmented candidate legal provision library is composed of the augmented candidate legal provisions corresponding to each candidate legal provision of the candidate legal provision library.

[0087] In step 207, according to the vector cosine similarity between the semantic vector of the augmented legal problem and the semantic vector of the augmented candidate legal provision, the semantic vectors of L augmented candidate legal provisions nearest to the semantic vector of the augmented legal problem are obtained, and according to the semantic vectors of the L augmented candidate legal provisions, the L target legal provisions in the candidate legal provisions are obtained.

[0088] In an embodiment, the augmented legal problem can be semantically processed by a pre-trained semantic vector model to obtain a semantic vector Q_AUG_VEC of the augmented legal problem.

[0089] In an embodiment, the augmented candidate legal provision library (including D augmented candidate legal provisions) can be traversed, and the pre-trained semantic vector model is sequentially inputted in batches of N, and the batch semantic vector with a shape of (N, E) is outputted, the traversal is completed to obtain an augmented candidate legal provision semantic vector library with a shape of (D, E), the augmented candidate legal provision semantic vector library is loaded to Faiss, and is recorded as a Faiss vector database CAN_AUG_LAW_VEC_LIB_FS, and the index type of the Faiss vector database CAN_AUG_LAW_VEC_LIB_FS can be set as IndexFlatIP.

[0090] In an embodiment, the augmented semantic vector Q AUG_VEC of the legal problem can be input into the Faiss vector database CAN AUG LAW VE LIB FS to search for an index ID value corresponding to a vector group including L semantic vectors of augmented candidate legal provisions with the closest neighbor of the vector cosine similarity of the augmented semantic vector Q AUG_VEC of the legal problem, find the candidate legal provision library according to the index ID value, and obtain L target legal provisions corresponding to the L semantic vectors of the augmented candidate legal provisions.

[0091] The legal provision retrieval method of the embodiments of the present application obtains K legal field keywords most relevant to the legal problem according to the semantic vector of the legal problem, and obtains target legal provisions including at least one legal field keyword in the K legal field keywords according to the K legal field keywords. The legal problem semantic vector is mapped to the legal field keyword space, and the core legal terms and concepts in the legal problem are extracted through the legal field keywords to truly reflect the legal problem. The legal provisions are pre-added with legal field keywords, and in the stage of real-time retrieval of relevant legal provisions according to the legal problem, the legal field keywords of the legal problem and the legal field keywords of the legal provisions can be quickly matched to obtain candidate legal provisions; according to the semantic vector of the legal problem and the semantic vector of the candidate legal provisions, the target legal provisions most relevant to the legal problem are selected from the candidate legal provisions, the retrieval is accelerated, and the efficiency of retrieving legal provisions according to the legal problem can be improved, and the matching degree of the legal provisions and the legal problem can be improved.

[0092] Further, the legal provision retrieval method of the embodiments of the present application maps the legal problem semantic vector to the legal field keyword space to extract the core legal terms and concepts in the legal problem, weakens the influence of non-key information in the legal problem on the semantic processing of the legal problem, and reflects the real legal demand of the user through the legal field keyword; maps the legal provision semantic vector to the legal field keyword space, and pre-matches the legal field keyword for the legal provision; in the stage of retrieving the relevant legal provisions in real time according to the legal problem of the user, the legal field keyword of the legal problem and the legal field keyword of the legal provision can be quickly matched to form a candidate legal provision library; the augmented legal problem is obtained by splicing the legal field keyword of the legal problem, the augmented candidate legal provision is obtained by splicing the legal field keyword and the hierarchical label of the candidate legal provision, the vector cosine similarity calculation and sorting are performed based on the semantic vector of the augmented legal problem and the semantic vector of the augmented candidate legal provision, and L target legal provisions are obtained. The text splicing augmentation of the legal problem can better express the legal related key information involved in the legal problem, the text splicing augmentation of the candidate legal provision can better reflect the key information and structured semantics of the legal provision, and the matching of the legal problem and the legal provision can be more accurately completed. The search range is narrowed through the candidate legal provision, the search is accelerated, and the speed and accuracy of retrieving the legal provision according to the legal problem can be improved.

[0093] Corresponding to the foregoing application function implementation method embodiments, the present application also provides a legal provision retrieval device, an electronic device and corresponding embodiments.

[0094] Figure 7 FIG. 1 is a structural schematic diagram of a legal provision retrieval device according to an embodiment of the present application.

[0095] Referring to Figure 7 A legal provision retrieval device includes a semantic module 701, a first retrieval module 702 and a second retrieval module 703.

[0096] The semantic module 701 is configured to extract a semantic vector of a legal problem.

[0097] In an embodiment, the semantic module 701 can perform semantic processing on the legal problem input by the user, convert the legal problem in a text format into a semantic vector in a vector representation, and obtain the semantic vector of the legal problem.

[0098] The first retrieval module 702 is configured to obtain K legal field keywords most relevant to the legal problem according to the semantic vector of the legal problem extracted by the semantic module 701.

[0099] In an embodiment, the semantic module 701 can pre-process each legal field keyword in the legal field keyword library to obtain a legal field keyword semantic vector library composed of semantic vectors of each legal field keyword in the legal field keyword library.

[0100] In an embodiment, the first retrieval module 702 can calculate vector similarity between the semantic vector of the legal question and the semantic vector of each legal field keyword according to the semantic vector of the legal question and the semantic vector of each legal field keyword in the legal field keyword semantic vector library; find K semantic vectors of legal field keywords that are the nearest neighbors of the semantic vector of the legal question according to the similarity between the semantic vector of the legal question and the semantic vector of each legal field keyword; and obtain K legal field keywords that are most relevant to the legal question according to the K semantic vectors of legal field keywords.

[0101] The second retrieval module 703 is configured to obtain a target legal provision including at least one legal field keyword in the K legal field keywords according to the K legal field keywords obtained by the first retrieval module 702.

[0102] In an embodiment, the second retrieval module 703 can find legal provisions including at least one legal field keyword in the K legal field keywords in a preset legal provision-legal field keyword pairing library according to the K legal field keywords, take the legal provisions including at least one legal field keyword in the K legal field keywords as candidate legal provisions, and obtain the target legal provision that is most relevant to the legal question from the candidate legal provisions.

[0103] In an embodiment, the vector similarity is a quantitative index for measuring the closeness of two vectors in direction or distance. The second retrieval module 703 can calculate vector similarity between the semantic vector of the legal question and the semantic vector of each candidate legal provision according to the semantic vector of each candidate legal provision in the candidate legal provisions and the semantic vector of the legal question; find the semantic vector of the candidate legal provision that is the nearest neighbor of the semantic vector of the legal question according to the vector similarity between the semantic vector of the legal question and the semantic vector of each candidate legal provision; and obtain the target legal provision that is most relevant to the legal question from the candidate legal provisions according to the semantic vector of the candidate legal provision that is the nearest neighbor of the semantic vector of the legal question.

[0104] The technical scheme of the embodiment of the application is as follows: according to the semantic vector of a legal question, K legal field keywords most relevant to the legal question are obtained; and according to the K legal field keywords, a target legal provision including at least one legal field keyword in the K legal field keywords is obtained. The legal question semantic vector is mapped to a legal field keyword space, and the core legal terms and concepts in the legal question are extracted through the legal field keywords, so that the legal question is truly reflected. The legal field keywords are added to the legal provisions in advance, so that, in the stage of searching the relevant legal provisions according to the legal question, the legal field keywords of the legal question and the legal field keywords of the legal provisions can be matched quickly to obtain candidate legal provisions; and according to the semantic vector of the legal question and the semantic vector of the candidate legal provisions, the target legal provision most relevant to the legal question is selected from the candidate legal provisions, so that the searching is accelerated, the efficiency of searching the legal provisions according to the legal question is improved, and the matching degree of the legal provisions and the legal question is improved.

[0105] Figure 8 FIG. 6 is another structural schematic diagram of a legal provision searching device according to an embodiment of the application.

[0106] Referring to Figure 8 A legal provision searching device includes a preprocessing module 801, a semanticization module 701, a first searching module 702, and a second searching module 703.

[0107] The preprocessing module 801 is configured to preprocess a legal question and obtain the preprocessed legal question.

[0108] The semanticization module 701 is configured to input the legal question preprocessed by the preprocessing module 801 into a pre-trained semantic vector model, and extract a semantic vector of the legal question through the pre-trained semantic vector model.

[0109] The first searching module 702 is configured to calculate a vector cosine similarity between the semantic vector of the legal question and the semantic vector of a legal field keyword according to the semantic vector of the legal question and the semantic vector of the legal field keyword extracted by the semanticization module 701, and obtain the semantic vector of the K legal field keywords nearest to the semantic vector of the legal question according to the vector cosine similarity.

[0110] The second retrieval module 703 can acquire, according to the K legal field keywords, candidate legal provisions including at least one legal field keyword in the K legal field keywords from a preset database; acquire an augmented legal question corresponding to the legal question according to the legal question and the K legal field keywords, wherein the augmented legal question includes the legal question and the K legal field keywords; acquire k legal field keywords and a hierarchical label corresponding to the candidate legal provision from the preset database; acquire an augmented candidate legal provision corresponding to the candidate legal provision according to the candidate legal provision, the k legal field keywords and the hierarchical label corresponding to the candidate legal provision, wherein the augmented candidate legal provision includes the candidate legal provision, the k legal field keywords and the hierarchical label; acquire semantic vectors of L augmented candidate legal provisions that are nearest neighbors of a semantic vector of the augmented legal question according to a vector cosine similarity between the semantic vector of the augmented legal question and semantic vectors of the augmented candidate legal provisions, and acquire L target legal provisions in the candidate legal provisions according to the semantic vectors of the L augmented candidate legal provisions.

[0111] As to the apparatus in the above-described embodiments, specific manners in which various modules perform operations have been described in details in the embodiments about the method, and thus will not be described in details here.

[0112] Figure 9 FIG. 1 is a structural schematic diagram of an electronic device according to an embodiment of the present application.

[0113] Referring to FIG. 1, Figure 9 The electronic device 1000 includes a memory 1010 and a processor 1020.

[0114] The processor 1020 can be a central processing unit (CPU), and can also be other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs) or other programmable logic devices, discrete gates or transistor logic, discrete hardware components, etc. The general-purpose processor can be a microprocessor or the processor can also be any conventional processor. The memory 1010 can include various types of storage units such as a system memory, a read-only memory (ROM), and a permanent storage device. Among them, the ROM can store static data or instructions required by the processor 1020 or other modules of the computer. The permanent storage device can be a rewritable storage device. The permanent storage device can be a non-volatile storage device that does not lose stored instructions and data even after the computer is powered off. In some embodiments, the permanent storage device employs a mass storage device (e.g., a magnetic or optical disk, a flash memory) as a permanent storage device. In some other embodiments, the permanent storage device can be a removable storage device (e.g., a floppy disk, an optical drive). The system memory can be a readable and writable storage device or a volatile readable and writable storage device such as a dynamic random access memory. The system memory can store some or all of the instructions and data required by the processor during runtime. In addition, the memory 1010 can include a combination of any computer readable storage media, including various types of semiconductor storage chips (e.g., DRAM, SRAM, SDRAM, flash memory, programmable read-only memory), magnetic disks and / or optical disks. In some embodiments, the memory 1010 can include a readable and / or writable removable storage device such as a compact disc (CD), a read-only digital versatile disc (e.g., DVD-ROM, double-layer DVD-ROM), a read-only Blu-ray disc, an ultra-density optical disc, a flash memory card (e.g., an SD card, a min SD card, a Micro-SD card, etc.), a magnetic floppy disk, etc. The computer readable storage medium does not include a carrier wave and an instantaneous electronic signal transmitted by wireless or wired transmission.

[0115] The memory 1010 stores executable code, which, when processed by the processor 1020, can cause the processor 1020 to perform part or all of the above-mentioned methods.

[0116] In addition, the method according to the present application can also be implemented as a computer program or a computer program product, which includes computer program code instructions for executing part or all of the steps of the above-mentioned methods of the present application.

[0117] Alternatively, the present application can also be implemented as a computer readable storage medium (or non-transitory machine readable storage medium or machine readable storage medium) having executable code (or computer programs or computer instruction codes) stored thereon, which, when executed by a processor of an electronic device (or a server, etc.), causes the processor to perform part or all of the steps of the above-mentioned methods according to the present application.

[0118] The present application also provides a computer program product, which includes computer instructions, which, when executed by a processor, implement the method as described above.

[0119] Having described various embodiments of the application, it is to be understood that the above description is meant not to limit and not to encompass all of the possible embodiments. Many modifications and variations of this application can be apparent to those of ordinary skill in the art without departing from the scope and spirit of the described embodiments. It is intended that the scope of the application be defined by the scope of the patent and by the claims as allowed by the patent office, which can include adaptations based on the description, equivalents, and / or substitutions of elements individually or collectively to the entire disclosure.

Claims

1. A legal text retrieval method, characterized in that: include: Extracting semantic vectors of legal issues; Obtaining K legal field keywords most relevant to the legal issue based on the semantic vector of the legal issue; According to the K legal field keywords, a target legal provision including at least one legal field keyword among the K legal field keywords is obtained.

2. The method according to claim 1, characterized in that The step of obtaining K legal field keywords most relevant to the legal issue based on the semantic vector of the legal issue includes: Calculating the vector cosine similarity between the semantic vector of the legal issue and the semantic vector of the legal field keyword based on the semantic vector of the legal issue and the semantic vector of the legal field keyword; Obtaining semantic vectors of K legal field keywords that are nearest neighbors to the semantic vector of the legal issue based on the vector cosine similarity; According to the semantic vectors of the K legal field keywords, K legal field keywords that are most relevant to the legal issue are obtained.

3. The method according to claim 1, characterized in that The step of obtaining, based on the K legal field keywords, a target legal provision including at least one of the K legal field keywords comprises: According to the K legal field keywords, obtaining candidate legal provisions including at least one legal field keyword among the K legal field keywords from a preset database; Acquire, based on the legal issue and the K legal field keywords, an augmented legal issue corresponding to the legal issue, wherein the augmented legal issue includes the legal issue and the K legal field keywords; According to the semantic vector of the expanded legal issue, a target legal provision in the candidate legal provisions is obtained.

4. The method according to claim 3, characterized in that The step of obtaining a target legal provision from the candidate legal provisions based on the semantic vector of the expanded legal question includes: Obtaining k legal field keywords and hierarchical labels corresponding to the candidate legal provisions in the preset database; According to the candidate legal provision, the k legal field keywords and the hierarchical label, obtaining an expanded candidate legal provision corresponding to the candidate legal provision, wherein the expanded candidate legal provision includes the candidate legal provision, the k legal field keywords and the hierarchical label; Obtaining, based on the vector cosine similarity between the semantic vector of the augmented legal question and the semantic vector of the augmented candidate legal provision, the semantic vectors of L augmented candidate legal provisions that are nearest neighbors to the semantic vector of the augmented legal question; According to the semantic vectors of the L expanded candidate legal provisions, L target legal provisions in the candidate legal provisions are obtained.

5. The method according to claim 4, characterized in that :According to the order of the legal issues and the K legal field keywords, a splicing method is used to obtain the expanded legal issues; according to the order of the candidate legal provisions, the k legal field keywords and hierarchical labels, a splicing method is used to obtain the expanded candidate legal provisions.

6. The method according to claim 3, characterized in that The preset database includes a preset legal text-legal field keyword-hierarchical label pairing database; wherein the step of presetting the legal text-legal field keyword-hierarchical label pairing database includes: Obtaining a hierarchical label of the legal provision; and obtaining a semantic vector of the legal provision; Obtaining semantic vectors of keywords in the legal field; Obtaining, based on the vector cosine similarity between the semantic vector of the legal text and the semantic vector of the legal field keyword, the semantic vectors of k legal field keywords that are nearest neighbors to the semantic vector of the legal text; Obtaining k legal field keywords of the legal text according to the semantic vectors of the k legal field keywords; The legal provisions, the k legal field keywords, and the hierarchical labels are matched one by one to construct a preset legal provision-legal field keyword-hierarchical label pairing database.

7. The method according to claim 1, characterized in that Before extracting the semantic vector of the legal question, the method includes: preprocessing the legal question to obtain the preprocessed legal question.

8. A legal text search device, characterized in that: include: Semanticization module, used to extract semantic vectors of legal issues; A first retrieval module is configured to obtain K legal field keywords most relevant to the legal issue based on the semantic vector of the legal issue extracted by the semanticization module; The second retrieval module is configured to obtain, based on the K legal field keywords obtained by the first retrieval module, a target legal provision including at least one legal field keyword among the K legal field keywords.

9. An electronic device, characterized in that: include: processor; as well as A memory having executable codes stored thereon, which, when executed by the processor, causes the processor to execute the method according to any one of claims 1 to 7.

10. A computer-readable storage medium, characterized in that An executable code is stored thereon, and when the executable code is executed by a processor of an electronic device, the processor is caused to execute the method according to any one of claims 1 to 7.

Citation Information

Patent Citations

  • Legal provision determination method and device and storage medium

    CN111178072A

  • Method and model for obtaining legal provisions

    CN114756657A

  • Legal provision retrieval method for legal data embedding optimization and retrieval effect evaluation

    CN119377384A

  • The apparatus and method of continuation part repairing of drain pipe

    KR102079478B1

Cited By

  • Law and regulation retrieval processing method and device for large language model

    CN122153134A