CN110765256B - Method and equipment for generating online legal consultation automatic reply - Google Patents

Method and equipment for generating online legal consultation automatic reply Download PDF

Info

Publication number
CN110765256B
CN110765256B CN201911348595.9A CN201911348595A CN110765256B CN 110765256 B CN110765256 B CN 110765256B CN 201911348595 A CN201911348595 A CN 201911348595A CN 110765256 B CN110765256 B CN 110765256B
Authority
CN
China
Prior art keywords
legal
knowledge
legal knowledge
legend
legends
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201911348595.9A
Other languages
Chinese (zh)
Other versions
CN110765256A (en
Inventor
钱烽
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Hangzhou Real Intelligence Technology Co ltd
Original Assignee
Hangzhou Real Intelligence Technology Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Hangzhou Real Intelligence Technology Co ltd filed Critical Hangzhou Real Intelligence Technology Co ltd
Priority to CN201911348595.9A priority Critical patent/CN110765256B/en
Publication of CN110765256A publication Critical patent/CN110765256A/en
Application granted granted Critical
Publication of CN110765256B publication Critical patent/CN110765256B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/30Information retrieval; Database structures therefor; File system structures therefor of unstructured textual data
    • G06F16/33Querying
    • G06F16/332Query formulation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/30Information retrieval; Database structures therefor; File system structures therefor of unstructured textual data
    • G06F16/33Querying
    • G06F16/3331Query processing
    • G06F16/334Query execution
    • G06F16/3344Query execution using natural language analysis
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/30Information retrieval; Database structures therefor; File system structures therefor of unstructured textual data
    • G06F16/36Creation of semantic tools, e.g. ontology or thesauri
    • G06F16/367Ontology
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06QINFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
    • G06Q50/00Information and communication technology [ICT] specially adapted for implementation of business processes of specific business sectors, e.g. utilities or tourism
    • G06Q50/10Services
    • G06Q50/18Legal services

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Business, Economics & Management (AREA)
  • Computational Linguistics (AREA)
  • Data Mining & Analysis (AREA)
  • Databases & Information Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • Tourism & Hospitality (AREA)
  • Technology Law (AREA)
  • General Health & Medical Sciences (AREA)
  • Life Sciences & Earth Sciences (AREA)
  • Mathematical Physics (AREA)
  • Animal Behavior & Ethology (AREA)
  • Health & Medical Sciences (AREA)
  • Economics (AREA)
  • Artificial Intelligence (AREA)
  • Human Resources & Organizations (AREA)
  • Marketing (AREA)
  • Primary Health Care (AREA)
  • Strategic Management (AREA)
  • General Business, Economics & Management (AREA)
  • Management, Administration, Business Operations System, And Electronic Commerce (AREA)

Abstract

The invention discloses a method and equipment for generating an online legal consultation automatic reply, which comprises the steps of constructing a legal knowledge graph case base and a query index thereof in an offline manner by depending on key phrases and connection relations which are correspondingly extracted from each legal knowledge point; retrieving one or more corresponding legal knowledge legends according to the online user consultation problem extraction key words; selecting a splicing template according to the quantity of the legal knowledge legends, adjusting the length-width ratio of the legal knowledge legends, filling, and finally exporting the filled splicing template into picture formats such as JPG (joint graphic group) or PNG (public network group); generating simple reply sentences, and returning the reply sentences to the user together with the generated pictures, wherein the key reply sentences are combined with the spliced pictures of the corresponding legal knowledge legends to serve as reply contents, so that the consultation problems provided by the user can be explained in a more targeted, highly generalized, refined and understandable manner.

Description

Method and equipment for generating online legal consultation automatic reply
Technical Field
The invention relates to the technical field of legal consultation, in particular to a method and equipment for generating an online legal consultation automatic reply.
Background
This section is intended to provide a background or context to the embodiments of the invention that are recited in the claims. The description herein may include concepts that could be pursued, but are not necessarily ones that have been previously conceived or pursued. Therefore, unless otherwise indicated herein, what is described in this section is not admitted to be prior art by inclusion in this section of the specification and claims hereof.
The online legal consultation is a basic function of a plurality of legal mobile phone applications or applets, and a user puts forward legal consultation questions online and replies consultation answers by a manual attorney or a computer program. When the function is started, manual reply is usually performed by a manual attorney, and sometimes a user needs to wait for hours or even days to see the reply content.
With the development of information retrieval technology, semantic analysis technology, machine learning and deep learning technology, the automatic reply online legal consultation problem of a computer is gradually mature, and two automatic reply technical schemes based on standard question and answer pair matching and based on legal knowledge base entry combination appear.
(1) Matching based on standard question-answer pairs: a standard question-answer pair set is prepared in advance, when a user presents a question for online consultation, the most similar question is matched from the standard question-answer pair by a computer program through technologies such as information retrieval and the like, and an answer corresponding to the question is returned. For example, the problem with users presenting online consultations is: the "16 years old, Dolabo" program matched the most similar questions from the set of standard question-answer pairs: "do you get married up just 16 years old" so the program returns the answer to the standard question: "not possible". Legal marrying age, men should not be older than 22 years and women should not be older than 20 years. "
(2) And combining the entries based on the legal knowledge base: when a user puts forward a question of online consultation, a computer program matches corresponding legal knowledge points from the legal knowledge base through technologies such as information retrieval and the like, and explains of the legal knowledge points are combined together to be used as consultation answers to be replied to the user. For example, the online consultation questions posed by the user are: "i have two children, how to share the divorce raising fee, how to divide the property" computer program matches two knowledge points in the legal knowledge base, respectively: "divorce + foster fee" and "divorce + property + segmentation". The computer program then combines the two knowledge point interpretations together, returning the user as an answer: "child care when divorced generally … …. The mutual sex of the couples should be agreed … … "by you and the other party.
However, the above two technical solutions have drawbacks, such as that the technical solution based on the standard question-answer pair matching can only answer simple consultation questions, and a huge standard question set needs to be prepared in advance; the technical scheme based on the combination of the items of the legal knowledge base is that after the items are extracted and summarized based on the legal provision, a plurality of knowledge point interpretations are subjected to text combination and reply, and the contents have a plurality of branching logics, for example, for the consultation problem of how to divorce a marriage when no marriage registration is handled at first, the consultation problem needs to be respectively explained before 1994 and after 1994 according to the living time of the beginning; the content is often tedious and obscure, and the user needs to spend much time and effort to see it, sometimes even not.
Disclosure of Invention
Aiming at the defects in the prior art, the invention aims to provide a method and equipment for generating an online legal consultation automatic reply, wherein a key reply sentence is combined with a spliced picture of a corresponding legal knowledge legend to serve as reply content, the reply sentence and the spliced picture are generated online in real time, compared with a standard question-answer matching consultation reply mode, the method has the advantages of flexibility, expandability and the like, and meanwhile, the method has the capability of processing complex question-answers, and compared with a combined consultation reply mode based on legal knowledge base entries, the method and equipment can explain consultation problems proposed by a user more pertinently, highly generally, finely and easily.
For example, for the above-mentioned consultation about "how to divorce when no marriage registration is handled at first, the present invention will automatically recover the contents as shown in fig. 1: replying sentences and legends, wherein the legends are divided into two specific laws and regulations under different time nodes according to time separation lines, explanations of some key words are removed at the same time, and specific conditions or requirements for explaining the key words by using the legend separation points are provided.
Compared with the prior art, the method can better improve the content quality and the user experience of the online legal consultation automatic reply, and avoid the user from spending longer time and energy to check the obscure and lengthy text content; because the legends are retrieved based on the legal knowledge elements, the quantity of the legal knowledge elements is limited, generally about hundreds of thousands, and therefore, the scheme can cover automatic reply of most of user consultation problems in practical situations.
In this context, the embodiments of the present invention are intended to provide a method and a device for generating an automatic reply for online legal consultation, and the above technical objectives of the present invention are achieved by the following technical solutions:
in a first aspect of the embodiments of the present invention, there is provided a method for generating an online legal consultation automatic reply, which is composed of four parts on a functional module: the system comprises a legal knowledge graph example base construction module, a legal knowledge graph retrieval module, a graph splicing template selection and filling module and a legal consultation reply inference and coloring module. The legal knowledge graph instance library construction module is an offline calculation module, the other three modules are online calculation modules, and the three modules are in a sequential relationship, as shown in fig. 2.
The generation method in the above embodiment is specifically as follows:
constructing a legal knowledge map case base and a query index thereof in an off-line manner by a legal knowledge map case base construction module according to key phrases and connection relations which are extracted correspondingly by each legal knowledge point;
the legal knowledge legend retrieval module retrieves one or more corresponding legal knowledge legends according to the on-line user consultation problem extraction key words;
the legend splicing template selecting and filling module selects splicing templates according to the quantity of legal knowledge legends, adjusts the length-width ratio of the legal knowledge legends and fills the legal knowledge legends, and finally exports the filled splicing templates into picture formats, wherein the existing picture formats comprise JPEG, JPEG2000, PNG, GIF, PDF, PSD, SVG, TIFF, BMP, EMF and other picture formats;
and the legal consultation reply inference and retouching module generates a simple reply sentence and returns the sentence to the user together with the generated picture.
In some embodiments, according to the method of any of the above embodiments of the present invention, the step of constructing the legal knowledge example base is as follows:
step S1, based on legal documents and relevant legal data summarized by legal expert experience, a legal knowledge map is constructed, and the processing method is as follows:
step S1.1, firstly, natural language processing is carried out on each legal provision or expert experience, Chinese word segmentation, stop word removal, named entity extraction and part of speech filtering are included, a group of keywords are obtained to represent each legal provision or expert experience, and the acquisition of the keywords only needs to calculate the group of keywords on the title or abstract of the legal provision or the expert experience, but does not need to calculate the content of specific provision;
s1.2, connecting related legal terms or expert experience through simple rules or an unsupervised machine learning algorithm; whether two legal knowledge points are related or not is judged by a simple rule, when two groups of keywords contain one or more same keywords, the two groups of keywords are considered to be related, or an unsupervised machine learning algorithm is adopted for determination, a similarity matching algorithm based on a neural word vector can be adopted, and the similarity of the two groups of keywords is calculated to be more than or equal to a preset threshold value, and the two groups of keywords are considered to be related;
s1.3, connecting all related items in legal terms or expert experience to form an integral network structure which is a legal knowledge map;
step S2, adopting unsupervised machine learning algorithms such as community discovery algorithm and the like to divide the legal knowledge map into a plurality of different parts, wherein each part is a legal knowledge point; the keywords of the legal knowledge points are the keyword combination intersection of each data object in the community, and the keyword explanation is the specific clause content intersection of each data object;
step S3, generating a knowledge legend for each obtained legal knowledge point, and the processing method is as follows:
s3.1, defining a description relation and a knowledge legend structure in advance, wherein the description relation comprises a total score relation, a causal relation, a parallel relation, a supplementary relation and a progressive relation;
s3.2, for each sentence of the keyword interpretation part in the legal knowledge point, calculating a single description relation between different parts in the sentence; the calculation method may employ a previously defined regular expression, for example: the regular expression "has one of the following cases: "etc. can extract the total score relation, and each part of the total score; a regular expression ". about." etc. may extract cause-effect relationships, as well as portions of cause and effects;
s3.3, writing a knowledge legend generation program based on image processing libraries such as Qt, OpenCV, Pilot, OpenGL and the like for the extracted description relation, and drawing the knowledge legend corresponding to each knowledge point;
step S4, based on the generated legal knowledge legend, supplementing description relations which are not detected manually, and modifying the knowledge legend which is analyzed wrongly, wherein manual operation can be performed in graphics making and processing software such as Photoshop and the like;
and step S5, after manual supplement and modification, storing all legal knowledge legends to a disk medium, and establishing keyword inverted indexes for keywords corresponding to each legend by using an information retrieval system, so that the legends can be retrieved quickly in an online computing stage conveniently, and the information retrieval system can adopt information retrieval systems such as Elasticissearch, Solr, Lucene, OpenSearch, Xapia and the like.
In some embodiments, according to the method of any of the above embodiments of the present invention, the specific processing steps of the above-mentioned legend splicing template selecting and filling module are as follows:
screening splicing templates with corresponding quantity from the candidate splicing template library according to the quantity of the legal knowledge legends obtained through retrieval; for example, there may be several splicing templates with three legends, and the program randomly selects one of the splicing templates with a certain pre-defined probability distribution;
selecting a filling area of the legal knowledge legend in the splicing template by adopting a certain rule, wherein the selection rule of the filling area is to calculate the proportion of black pixels in each legal knowledge legend, correspond the legal knowledge legend with the largest proportion to the filling area with the largest area, and randomly select one filling area if the areas of the rest filling areas are the same; secondly, filling each legal knowledge legend into corresponding filling areas respectively, wherein the filling method comprises the steps of aligning the centers of the filling areas in the center of the legal knowledge legend, gradually amplifying the legal knowledge legend according to the unchanged length-width ratio of the legal knowledge legend until the legal knowledge legend contacts the edges of the filling areas, and filling empty white in the unfilled areas;
exporting the filled splicing template into picture formats such as JPEG, JPEG2000, PNG, GIF, PDF, PSD, SVG, TIFF, BMP, EMF and the like, adding a watermark for tracing and commercial LOGO on the picture, wherein the picture formats can be completed through an image processing program library such as OpenCV and the like.
In some embodiments, the legal consultant reply inference and touch-up module according to the method of any of the above embodiments of the present invention comprises the following processing steps:
based on the causal relationship extracted in step S3 of the legal knowledge map example library construction module, direct inference is attempted, and the processing method is as follows: calculating the similarity of the user consultation problem and the reason part in the legal knowledge legend of each causal relationship based on a similarity matching algorithm of the neural word vector, and if the similarity is higher than a preset threshold, determining that an explicit result can be deduced, for example, the result can be or cannot be obtained; otherwise no explicit result can be inferred;
the machine learning classification model is used for scoring, the input of the classification model is the text content of the user consultation question, the output is the inferred result score, if the inferred result score is higher than a preset threshold value, an explicit result can be considered to be inferred, and for example, the inferred result may or may not be inferred; otherwise, a clear result cannot be deduced, and the machine learning classification model needs to be obtained by training based on the manually marked training corpus in advance;
if an unambiguous result can be deduced, then reply words of a certain tendency, for example "may" or "may" are loaded, otherwise reply words of an uncertain tendency, for example, your question as the case may be, are loaded; meanwhile, the reply sentence is retouched based on the language model of statistical learning, for example: "not" is replaced with "is not possible", etc.;
and loading the characters and the pictures, and returning the characters and the pictures to the user together on the mobile phone application or other product client pages.
In a second aspect of the embodiment of the present invention, there is provided a generating device of the above-mentioned method for generating an online legal consultation automatic reply.
The technical purpose of the invention is realized by the following technical scheme:
an apparatus for generating an automatic reply for an online legal consultation, comprising:
the offline construction module of the legal knowledge map case base builds the legal knowledge map case base and the query index thereof offline by depending on key phrases and connection relations which are extracted correspondingly by each legal knowledge point;
the legal knowledge legend retrieval module is used for retrieving one or more corresponding legal knowledge legends according to the on-line user consultation problem extraction key words;
the legend splicing template selecting and filling module selects splicing templates according to the quantity of legal knowledge legends, adjusts the length-width ratio of the legal knowledge legends and fills the legal knowledge legends, and finally exports the filled splicing templates into picture formats such as JPEG, JPEG2000, PNG, GIF, PDF, PSD, SVG, TIFF, BMP, EMF and the like;
and the legal consultation reply inference and coloring module generates simple reply sentences and returns the simple reply sentences to the user together with the generated pictures.
In summary, compared with the prior art, the beneficial effects of the invention are as follows: the consultation reply form combining simple characters with pictures is adopted, the consultation problems proposed by the user are explained in a targeted, highly generalized, refined and understandable manner, and the method has the advantages of one picture to thousands of words; meanwhile, the reply sentences and the spliced pictures provided by the scheme are generated on line in real time, and the method has the advantages of flexibility, expandability and the like.
Drawings
The above and other objects, features and advantages of exemplary embodiments of the present invention will become readily apparent from the following detailed description read in conjunction with the accompanying drawings. Several embodiments of the invention are illustrated by way of example, and not by way of limitation, in the figures of the accompanying drawings and in which:
FIG. 1 schematically shows an example of automated reply content generated according to an embodiment of the present invention (consultation questions: how to divorce now when no marriage registration was transacted at first);
FIG. 2 schematically illustrates a structural framework diagram of an overall solution according to an embodiment of the invention;
FIG. 3 schematically illustrates one exemplary scenario in which an embodiment of the present invention may be implemented;
FIG. 4 schematically illustrates a legal knowledge graph library building step according to one embodiment of the present invention;
FIG. 5 schematically illustrates a knowledge graph describing a relationship structure according to one embodiment of the invention;
FIG. 6 schematically illustrates a knowledge legend query index, according to one embodiment of the invention;
FIG. 7 schematically illustrates an exemplary stitching template selection and filling step, according to one embodiment of the present invention;
FIG. 8 schematically illustrates a stitching template having 3 legends, according to one embodiment of the present invention;
FIG. 9 schematically illustrates a method of populating a legal knowledge legend, in accordance with one embodiment of the present invention;
FIG. 10 schematically illustrates the flow steps of a legal consultant reply inference and touch-up module, according to one embodiment of the invention.
In the drawings, the same or corresponding reference numerals indicate the same or corresponding parts.
Detailed description of the preferred embodiments
The principles and spirit of the present invention will be described with reference to a number of exemplary embodiments. It is understood that these embodiments are given solely for the purpose of enabling those skilled in the art to better understand and to practice the invention, and are not intended to limit the scope of the invention in any way. Rather, these embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the scope of the disclosure to those skilled in the art. Reference in the specification to "an embodiment" or "an implementation" may mean either one embodiment or one implementation or some instances of embodiments or implementations.
As will be appreciated by one skilled in the art, embodiments of the present invention may be embodied as a system, apparatus, device, method, or computer program product. Accordingly, the present disclosure may be embodied in the form of: entirely hardware, entirely software (including firmware, resident software, micro-code, etc.), or a combination of hardware and software.
According to the embodiment of the invention, a method and equipment for generating an automatic reply for online legal consultation are provided.
It is to be noted that any number of elements in the figures are provided by way of example and not limitation, and any nomenclature is used for distinction only and not in any limiting sense.
Technical terms involved in the present invention will be briefly described below so that the related person can better understand the present solution.
Unsupervised machine learning: unsupervised machine learning is a branch of artificial intelligence, and refers to a process of classifying data samples to know the internal structure of the data without knowing the real category of the data samples. Common unsupervised machine learning techniques include clustering, principal component analysis, outlier testing, and the like.
Supervised machine learning classification algorithms: the set of data is fitted using a mathematical model and an optimization algorithm using a set of training data sets labeled with classes, and the fitted mathematical model can be used to predict training sample classes for unknown classes. Such algorithms are for example: a logistic classification algorithm, a naive bayes algorithm, a support vector machine algorithm, etc.
Classification models: and fitting the training data set by using a supervised machine learning classification algorithm to obtain a mathematical model.
Similarity matching algorithm based on neural word vector: for any group of keyword input, the similarity matching algorithm based on the neural word vector replaces each keyword with a one-dimensional vector represented by a number (the vector is calculated by other prepositioning tasks in advance or can be directly downloaded and used by an open source vector file), and adds the number vectors of all the keywords. And when the similarity of the two groups of keywords needs to be matched, calculating the Cosine distance of the digital vectors corresponding to the two groups of keywords based on the similarity matching algorithm of the neural word vectors, and returning the Cosine distance as the similarity.
The community discovery algorithm: the algorithm for finding the local community structure in the network structure divides the network structure into different communities according to certain specific standards, so that the similarity of data objects in each community is as large as possible, and the difference of the data objects in the same community is not larger as much as possible. After the community discovery algorithm is calculated, data objects of the same class are aggregated in the same community as much as possible, and different data are separated as much as possible.
The regular expression is as follows: the method is a logic formula for operating on character strings and special characters, namely a 'regular character string' is formed by using a plurality of specific characters defined in advance and a combination of the specific characters, and the 'regular character string' is used for expressing a filtering logic for the character strings. A regular expression is a text pattern that describes one or more strings of characters to be matched when searching for text.
Qt: a cross-platform C + + graphical user interface application development framework can be used for writing programs and drawing various vector graphics.
Inverted indexing: an indexing method is used to store a mapping of the storage location of a keyword in a document or a group of documents under a full-text search. Which is the most common data structure in document retrieval systems. By the inverted index, the document list containing the keyword can be quickly obtained according to the word. The inverted index is mainly composed of two parts: "keyword dictionary" and "inverted document" (corresponding knowledge legend document in this case).
Natural language processing techniques: it is a branch of artificial intelligence and is used to research various theories and methods for effective communication between human and computer by using natural language. The specific algorithm in the natural language processing technology comprises the following steps: chinese word segmentation, named entity recognition, part of speech filtering, etc. Most of these algorithms are developed using theories and techniques based on machine learning and deep learning.
OpenCV: the system is a cross-platform computer vision library which is licensed based on BSD and can run on Linux, Windows, Android and MacOS operating systems; the method is light and efficient, is composed of a series of C functions and a small number of C + + classes, provides interfaces of languages such as Python, Ruby, MATLAB and the like, and realizes a plurality of general algorithms in the aspects of image processing and computer vision.
Language model based on statistical learning: a language model is usually constructed as a probability distribution p(s) of a string s, where p(s) actually reflects the probability that s appears as a sentence. Probability here refers to the likelihood of this combination of constituent strings appearing in the corpus, regardless of whether the sentence is grammatically appropriate. Assuming that the corpus is from human language, this probability can be considered as the probability of whether a sentence is human or not.
Summary of The Invention
The inventor finds that in the prior art, the technical scheme based on the standard question-answer pair matching can only answer simple consultation questions, and a huge standard question set needs to be prepared in advance; according to the technical scheme based on the combination of the legal knowledge base items, since the multiple knowledge point interpretations are subjected to text combination and reply after the multiple knowledge point interpretations are extracted and summarized based on the legal provisions, the contents have many branching logics, the contents are usually long and obscure, and a user needs to spend much time and energy to understand the contents, sometimes even cannot understand the contents; by combining the key reply sentences with the spliced pictures of the corresponding legal knowledge legends as reply contents, the content quality and the user experience of the on-line legal consultation automatic reply can be better improved, and the user is prevented from spending longer time and energy to check the obscure and lengthy text contents.
Having described the general principles of the invention, various non-limiting embodiments of the invention are described in detail below.
Application scene overview
Referring to fig. 3, fig. 3 schematically illustrates an exemplary application scenario in which embodiments of the present invention may be implemented. Wherein, the client uploads a client consultation problem to the server, namely that my debtor can not pay money, but has a set of house, and can apply for the mortgage house to pay money.
The server extracts keywords from the obtained consultation problems and retrieves corresponding legal knowledge legends, wherein the number of the legal knowledge legends can be multiple, such as legend one, legend two and legend three; and the server fills the existing legend into the splicing template to finally form the picture, and simultaneously prepares the generated simple reply sentence (may. see the following figure explanation) and returns the sentence to the client together for the user of the client to preview and click on the viewing details. The server may be a Web server or other type of server, such as an APP server. Those skilled in the art will appreciate that the schematic diagram shown in fig. 3 is merely one example in which embodiments of the present invention may be implemented. The scope of applicability of embodiments of the present invention is not limited in any way by this framework.
Exemplary method
A method for generating an automatic reply for online legal consultancy according to an exemplary embodiment of the present invention is described below with reference to fig. 2 in conjunction with the application scenario of fig. 3. It should be noted that the above application scenarios are merely illustrated for the convenience of understanding the spirit and principles of the present invention, and the embodiments of the present invention are not limited in this respect. Rather, embodiments of the present invention may be applied to any scenario where applicable.
Referring to fig. 2, a flow chart of a method for generating an online legal consultation automatic reply according to an embodiment of the present invention is schematically shown, for example, the method may be executed by a server, and the method may specifically include, for example:
firstly, constructing a legal knowledge map case base and a query index thereof in an off-line manner by a legal knowledge map case base construction module according to key phrases and connection relations which are correspondingly extracted from each legal knowledge point;
secondly, the online user inputs a consultation problem, and the legal knowledge legend retrieval module retrieves one or more corresponding legal knowledge legends according to the online user consultation problem and the extracted key words;
thirdly, a legend splicing template selecting and filling module selects splicing templates according to the quantity of legal knowledge legends, adjusts the length-width ratio of the legal knowledge legends and fills the legal knowledge legends, and finally exports the filled splicing templates into picture formats such as JPEG, JPEG2000, PNG, GIF, PDF, PSD, SVG, TIFF, BMP, EMF and the like;
fourthly, the legal consultation reply inference and retouching module generates simple reply sentences which are returned to the user together with the generated pictures.
In another preferred embodiment of the present invention, as shown in fig. 4, the construction steps of the legal knowledge map example library are as follows:
step S1, based on legal documents and legal expert experience summaries, the legal knowledge map is constructed, the processing method is as follows:
step S1.1, firstly, performing natural language processing such as Chinese word segmentation, stop word removal, named entity extraction, part of speech filtering and the like on each legal provision or expert experience to obtain a group of keywords for representing each legal provision or expert experience, wherein the group of keywords are usually calculated only on the title or abstract of the legal provision or the expert experience, and the specific provision content is not required to be calculated;
s1.2, connecting related legal terms or expert experience through simple rules or an unsupervised machine learning algorithm; whether two legal knowledge points are related or not can be determined by a simple rule, for example, two groups of keywords comprise one or more same keywords, namely, the two legal knowledge points are considered to be related, or an unsupervised machine learning algorithm is adopted, for example, a similarity matching algorithm based on a nerve word vector is adopted, and the similarity of the two groups of keywords is calculated to be more than or equal to a preset threshold value, namely, the two groups of keywords are considered to be related;
s1.3, connecting related items in all legal terms or expert experiences to form an integral network structure which is a legal knowledge map;
step S2, adopting unsupervised machine learning algorithms such as community discovery algorithm and the like to divide the legal knowledge map into a plurality of different parts, wherein each part is a legal knowledge point; the keywords of the legal knowledge points are the keyword combination intersection of each data object in the community, and the keyword explanation is the specific clause content intersection of each data object;
step S3, generating a knowledge legend for each legal knowledge point obtained by the above calculation, and the processing method is as follows:
step S3.1, defining some description relations and knowledge legend structures in advance, wherein the description relations include general score relations, causal relations, parallel relations, supplementary relations and progressive relations, but are not limited to the description relations;
s3.2, for each sentence of the keyword interpretation part in the legal knowledge point, calculating the description relation between different parts in the sentence; the calculation method may employ a previously defined regular expression, for example: the regular expression "has one of the following cases: "etc. can extract the total score relation, and each part of the total score; a regular expression ". about." etc. may extract cause-effect relationships, as well as portions of cause and effects;
s3.3, writing a knowledge legend generation program based on graphics libraries such as Qt, OpenCV, Pilot, OpenGL and the like for the extracted description relation, and drawing the knowledge legend corresponding to each knowledge point; for example, the structure of the legend of knowledge of score and cause is shown in FIG. 5;
step S4, based on the generated legal knowledge legend, supplementing description relations which are not detected manually, and modifying the knowledge legend which is analyzed wrongly, wherein manual operation can be performed in graphics making and processing software such as Photoshop and the like;
step S5, storing all legal knowledge legends obtained after manual supplementation and modification to a disk medium, and establishing a keyword inverted index for the keyword corresponding to each legend using information retrieval systems such as Elasticsearch, Solr, Lucene, OpenSearch, xapaian and the like (an index method is used to store the mapping of the storage location of a certain keyword in a document or a group of documents under full-text search, which is the most common data structure in a document retrieval system), and by inverted index, a document list containing the keyword can be quickly obtained according to the word, and the inverted index mainly consists of two parts, namely, a keyword dictionary and an inverted file, which correspond to knowledge legend files in the present case), so that the legend can be quickly retrieved in an online computing stage, as shown in the schematic diagram of fig. 6.
In another preferred embodiment of the present invention, the processing steps of the legal knowledge legend retrieval module are as follows:
step S1, extracting keywords from the questions input by the user by using natural language processing technologies such as Chinese word segmentation, stop word removal, named entity recognition, part of speech filtering and the like;
and step S2, based on the extracted keywords, retrieving one or more corresponding legal knowledge legends from the inverted index.
In another preferred embodiment of the present invention, referring to fig. 7, the specific processing steps of the above-mentioned legend splicing template selecting and filling module are as follows:
step S1, screening splicing templates with corresponding quantity from the candidate splicing template library according to the quantity of the legal knowledge legends obtained by retrieval; for example, referring to fig. 8, there may be several splicing templates with three legends, and the program randomly selects one of the splicing templates with a certain pre-defined probability distribution;
step S2, selecting a filling area of the legal knowledge legend in the mosaic template by using a certain rule, for example, three positions in the first mosaic template in fig. 8: a knowledge legend I, a knowledge legend II and a knowledge legend III; the filling region selection rule is that the proportion of black pixels in each legal knowledge legend is calculated firstly, the legal knowledge legend with the largest proportion is corresponding to the filling region with the largest area, the corresponding knowledge legend III is arranged in the first splicing template in the graph 8, and if the areas of the rest filling regions are the same, one filling region is selected randomly;
secondly, filling each legal knowledge legend into corresponding filling areas respectively, wherein the filling method comprises the steps of aligning the centers of the filling areas in the center of the legal knowledge legend, gradually amplifying the legal knowledge legend according to the unchanged length-width ratio of the legal knowledge legend until the legal knowledge legend contacts the edges of the filling areas, and filling empty white in the unfilled areas; referring to fig. 9, fig. 9 shows the filling method in both cases when the filled region is wider or higher than the knowledge legend size;
step S3, exporting the filled stitching template into image formats such as JPG or PNG, and adding a watermark for tracing and a commercial LOGO to the image, which can be completed by an image processing program library, such as OpenCV.
In another preferred embodiment of the present invention, the processing steps of the above legal consultation reply inference and touch-up module are as shown in fig. 10, and specifically as follows:
step S1, directly performing inference based on the causal relationship extracted in step S3 of the legal knowledge map building module, and the processing method is as follows: calculating the similarity of the user consultation problem and the reason part in the legal knowledge legend of each causal relationship based on a similarity matching algorithm of the neural word vector, and if the similarity is higher than a preset threshold, determining that an explicit result can be deduced, for example, the result can be or cannot be obtained; otherwise no explicit result can be inferred;
step S2, using machine learning classification model to score, the input of classification model is the text content of user consultation question, the output is the inference result score, if it is higher than the threshold value set in advance, then it is considered that clear result can be inferred, for example, it is possible or impossible; otherwise, a clear result cannot be deduced, and the machine learning classification model needs to be obtained by training based on the manually marked training corpus in advance;
step S3, if an explicit result can be inferred, loading the reply words with determined tendencies, for example, "may" or "may not", otherwise loading the reply words with uncertain tendencies, for example, your question as the case may be; meanwhile, the reply sentence is retouched based on the language model of statistical learning, for example: "not" is replaced with "is not possible", etc.;
and step S4, loading the characters and pictures, and returning the characters and pictures to the user together on the mobile phone application or other product client pages.
The other purpose of the present invention is to provide the generating device of the generating method for automatic reply of online legal consultation, wherein the construction of each functional module in the generating device of the present invention is developed and designed according to the content of the generating method, and the detail content not developed in the generating device can be explained according to the content of the generating method.
An apparatus for generating an automatic reply for an online legal consultation, comprising:
the offline construction module of the legal knowledge map case base builds the legal knowledge map case base and the query index thereof offline by depending on key phrases and connection relations which are extracted correspondingly by each legal knowledge point;
the legal knowledge legend retrieval module is used for retrieving one or more corresponding legal knowledge legends according to the on-line user consultation problem extraction key words;
the legend splicing template selecting and filling module selects splicing templates according to the quantity of legal knowledge legends, adjusts the length-width ratio of the legal knowledge legends and fills the legal knowledge legends, and finally exports the filled splicing templates into picture formats such as JPEG, JPEG2000, PNG, GIF, PDF, PSD, SVG, TIFF, BMP, EMF and the like;
and the legal consultation reply inference and coloring module generates simple reply sentences and returns the simple reply sentences to the user together with the generated pictures.
The above description is intended to be illustrative of the present invention and not to limit the scope of the invention, which is defined by the claims appended hereto.

Claims (5)

1. A method for generating an automatic reply for online legal consultation is characterized by comprising the following steps:
step S1, based on legal documents and legal expert experience to summarize the relevant legal data, building a legal knowledge map;
step S2, adopting an unsupervised machine learning algorithm to divide the legal knowledge map into a plurality of different parts, wherein each part is a legal knowledge point; the keywords of the legal knowledge points are the keyword combination intersection of each data object in the community, and the keyword explanation is the specific clause content intersection of each data object;
step S3, generating a knowledge legend for each obtained legal knowledge point, and the processing method is as follows:
s3.1, defining a description relationship and a knowledge legend structure in advance, wherein the description relationship comprises a general score relationship, a causal relationship, a parallel relationship, a supplement relationship and a progressive relationship;
s3.2, for each sentence of the keyword interpretation part in the legal knowledge point, calculating a single description relation between different parts in the sentence;
s3.3, compiling a knowledge legend generation program based on a graphic library for the extracted description relation, and drawing the knowledge legend corresponding to each knowledge point;
step S4, based on the generated legal knowledge legend, manually supplementing the undetected description relationship, modifying the knowledge legend analyzed wrongly, and manually operating in the graph making and processing software;
step S5, after manual supplement and modification, storing all legal knowledge legends to a disk medium, and establishing keyword reverse indexes for keywords corresponding to each legend by using an information retrieval system, so that the legends can be retrieved quickly in an online calculation stage;
step S6, retrieving one or more corresponding legal knowledge legends according to the on-line user consultation question extraction key words;
step S7, selecting a splicing template according to the quantity of the retrieved legal knowledge legends, adjusting the length-width ratio of the legal knowledge legends, filling, and finally exporting the filled splicing template into a picture format;
and step S8, generating a simple reply sentence, and returning the reply sentence to the user together with the generated picture.
2. The method for generating an automatic reply for online legal consultation as claimed in claim 1, wherein in the legal knowledge base constructing step S1, the legal knowledge base processing method is as follows:
step S1.1, firstly, natural language processing is carried out on each legal provision or expert experience, Chinese word segmentation, stop word removal, named entity extraction and part of speech filtering are included, and a group of keywords are obtained and used for representing each legal provision or expert experience;
s1.2, connecting related legal terms or expert experience through simple rules or an unsupervised machine learning algorithm; whether two legal knowledge points are related or not is determined by simple rules or unsupervised machine learning algorithm;
and S1.3, connecting all related items in the legal provision or the expert experience to form an integral network structure, namely the legal knowledge graph.
3. The method for generating an automatic reply for online legal consultation as claimed in claim 1, wherein the specific processing steps of selecting and filling the splicing template are as follows:
screening splicing templates with corresponding quantity from the candidate splicing template library according to the quantity of the legal knowledge legends obtained through retrieval; under various conditions of the splicing templates corresponding to the number of legends, the program randomly selects one splicing template according to certain pre-defined probability distribution;
selecting filling areas of the legal knowledge legends in the splicing template by adopting a certain rule, and filling each legal knowledge legend into the corresponding filling area respectively;
exporting the filled splicing template into a picture format, and adding a watermark for tracing and a commercial LOGO on the picture.
4. The method as claimed in claim 3, wherein the rule for selecting the filling area is to calculate the black pixel ratio in each legal knowledge legend, and to map the legal knowledge legend with the largest ratio to the filling area with the largest area, and if the areas of the remaining filling areas are the same, to randomly select one filling area; the filling method of the filling area is that firstly, the center of the center filling area of the legal knowledge legend is aligned, the legal knowledge legend is gradually enlarged according to the unchanged length-width ratio of the legal knowledge legend, until the edge of the filling area is contacted, and the unfilled area is filled with white space.
5. The method for generating an automatic reply for online legal consultation as claimed in claim 1, wherein the reply sentence is generated by the steps of:
directly deducing to clarify the result based on the causal relationship extracted in the legal knowledge map example base construction step S3; the processing method for deducing the clear result is as follows: calculating the similarity of the user consultation problem and the reason part in the legal knowledge legend of each causal relationship based on a similarity matching algorithm of a neural word vector, and if the similarity is higher than a preset threshold value, determining that a definite result can be deduced, otherwise, determining that the definite result cannot be deduced;
the machine learning classification model is used for scoring, the input of the classification model is the text content of the user consultation problem, the output is the score of an inference result, and if the score is higher than a preset threshold value, a clear result can be inferred; otherwise, a clear result cannot be deduced, and the machine learning classification model is obtained by training based on the manually marked training corpus in advance;
if an explicit result can be deduced, loading recovery words with determined tendencies, otherwise loading recovery words with uncertain tendencies; meanwhile, the reply sentences are faded based on the language model of statistical learning;
and loading characters and pictures, and returning the characters and pictures to the user together with the mobile phone application or other human-computer interaction pages.
CN201911348595.9A 2019-12-24 2019-12-24 Method and equipment for generating online legal consultation automatic reply Active CN110765256B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201911348595.9A CN110765256B (en) 2019-12-24 2019-12-24 Method and equipment for generating online legal consultation automatic reply

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201911348595.9A CN110765256B (en) 2019-12-24 2019-12-24 Method and equipment for generating online legal consultation automatic reply

Publications (2)

Publication Number Publication Date
CN110765256A CN110765256A (en) 2020-02-07
CN110765256B true CN110765256B (en) 2020-07-07

Family

ID=69341558

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201911348595.9A Active CN110765256B (en) 2019-12-24 2019-12-24 Method and equipment for generating online legal consultation automatic reply

Country Status (1)

Country Link
CN (1) CN110765256B (en)

Families Citing this family (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111309890B (en) * 2020-02-28 2021-01-05 重庆百事得大牛机器人有限公司 Sensitive scene processing system and method for legal consultation
CN111402092B (en) * 2020-06-08 2020-09-15 杭州识度科技有限公司 Law and regulation retrieval system based on multilevel semantic analysis
CN114860894A (en) * 2021-01-20 2022-08-05 京东科技控股股份有限公司 Method and device for querying knowledge base, computer equipment and storage medium
CN113886554B (en) * 2021-12-03 2022-03-22 北京大学 Legal consultation question-answering method and device

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101122915A (en) * 2007-09-18 2008-02-13 武汉易博迅信息科技有限公司 Search engine based on parameter
CN104317949A (en) * 2014-11-06 2015-01-28 北京德塔普博软件有限公司 Extraction method, device and system of document fragments
CN104965868A (en) * 2015-06-09 2015-10-07 广西中烟工业有限责任公司 Data inquiring and analyzing system and method based on WeChat public platform
CN110188346A (en) * 2019-04-29 2019-08-30 浙江工业大学 A kind of network security bill part intelligence analysis method based on information extraction
CN110334178A (en) * 2019-03-28 2019-10-15 平安科技(深圳)有限公司 Data retrieval method, device, equipment and readable storage medium storing program for executing

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107122444A (en) * 2017-04-24 2017-09-01 北京科技大学 A kind of legal knowledge collection of illustrative plates method for auto constructing
CN108073569B (en) * 2017-06-21 2021-08-27 北京华宇元典信息服务有限公司 Law cognition method, device and medium based on multi-level multi-dimensional semantic understanding
CN109977237B (en) * 2019-05-27 2019-09-10 南京擎盾信息科技有限公司 A kind of dynamic law occurrence diagram spectrum construction method towards legal field
CN110377715A (en) * 2019-07-23 2019-10-25 天津汇智星源信息技术有限公司 Reasoning type accurate intelligent answering method based on legal knowledge map

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101122915A (en) * 2007-09-18 2008-02-13 武汉易博迅信息科技有限公司 Search engine based on parameter
CN104317949A (en) * 2014-11-06 2015-01-28 北京德塔普博软件有限公司 Extraction method, device and system of document fragments
CN104965868A (en) * 2015-06-09 2015-10-07 广西中烟工业有限责任公司 Data inquiring and analyzing system and method based on WeChat public platform
CN110334178A (en) * 2019-03-28 2019-10-15 平安科技(深圳)有限公司 Data retrieval method, device, equipment and readable storage medium storing program for executing
CN110188346A (en) * 2019-04-29 2019-08-30 浙江工业大学 A kind of network security bill part intelligence analysis method based on information extraction

Also Published As

Publication number Publication date
CN110765256A (en) 2020-02-07

Similar Documents

Publication Publication Date Title
CN110765256B (en) Method and equipment for generating online legal consultation automatic reply
CN109885672B (en) Question-answering type intelligent retrieval system and method for online education
US10878197B2 (en) Self-learning user interface with image-processed QA-pair corpus
US11631234B2 (en) Automatically detecting user-requested objects in images
EP3926531B1 (en) Method and system for visio-linguistic understanding using contextual language model reasoners
CN113011186B (en) Named entity recognition method, named entity recognition device, named entity recognition equipment and computer readable storage medium
CN111539197A (en) Text matching method and device, computer system and readable storage medium
CN113159013B (en) Paragraph identification method, device, computer equipment and medium based on machine learning
CN113392179A (en) Text labeling method and device, electronic equipment and storage medium
US10558760B2 (en) Unsupervised template extraction
CN113761377B (en) False information detection method and device based on attention mechanism multi-feature fusion, electronic equipment and storage medium
US20220284343A1 (en) Machine teaching complex concepts assisted by computer vision and knowledge reasoning
CN111382243A (en) Text category matching method, text category matching device and terminal
Tüselmann et al. Recognition-free question answering on handwritten document collections
CN110580294B (en) Entity fusion method, device, equipment and storage medium
CN111881695A (en) Audit knowledge retrieval method and device
CN116049376A (en) Method, device and system for retrieving and replying information and creating knowledge
Dahanayake et al. Plagiarism Detection Tool for Enhanced Entity-Relationship Diagrams
US11615618B2 (en) Automatic image annotations
US11501071B2 (en) Word and image relationships in combined vector space
CN114972884A (en) Image event recognition method based on multi-mode event ontology
Vilalta et al. Studying the impact of the full-network embedding on multimodal pipelines
Bhagat et al. Complex document classification and integration with indexing
US11907643B2 (en) Dynamic persona-based document navigation
Portal et al. Comparative analysis of supervised classifiers for classification of musical notes on mobile based applications

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant