Question and answer strategy construction method based on Java language and large model

By adopting a question-and-answer strategy construction method based on Java language and big models in the question-and-answer system, problems in the data preprocessing process are solved, the accuracy and stability of the question-and-answer strategy construction are improved, and the needs of diverse user needs and complex problem scenarios are met.

CN119623599APending Publication Date: 2025-03-14TRANSN IOL TECH CO LTD
View PDF 0 Cites 2 Cited by

Patent Information

Application Number
CN202411775710.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-05
Publication Date
2025-03-14

AI Technical Summary

Technical Problem

The existing Q&A system has problems such as data reading errors, data cleaning loss, and inaccurate feature extraction in the data preprocessing process, resulting in low accuracy and unstable construction of Q&A strategy, which is difficult to meet the needs of diverse user and complex problem scenarios.

Method used

The method of question-and-answer strategy based on Java language and big models is adopted to improve the data quality through steps such as data reading, cleaning, feature extraction and domain model matching, and the answer data is generated using big models, and combined with Elasticsearch for data entry and statistical analysis.

Benefits of technology

It improves the accuracy and stability of the construction of question-and-answer strategies, can better meet diverse user needs and complex problem scenarios, and improves user experience and system performance.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119623599A_ABST
    Figure CN119623599A_ABST
Patent Text Reader

Abstract

The invention discloses a question and answer strategy construction method based on a Java language and a large model. The method specifically comprises the following steps: preprocessing question data based on the Java language; the corresponding domain model receives the preprocessed problem data, vector matching is carried out based on a QA knowledge base, and a matching score is set; selecting a corresponding cue word template from a preset cue word template library based on features extracted from the question data, and then calling a large model to generate answer data; inputting the answer data into a client library, and forming customer evaluation data after customer evaluation; counting and analyzing the reply accuracy and generating a report based on customer evaluation data; and setting a threshold value of the accuracy rate of the reply. According to the method, the Java language and the large model are combined, data reading, cleaning, feature extraction and domain model matching are efficiently and accurately processed, the precision and stability of follow-up question and answer strategy construction are improved, diversified user requirements are met, and complex problem scenes are dealt with.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of question-answering strategy construction, and in particular to a question-answering strategy construction method based on Java language and a large model. Background Art

[0002] Question-answering systems are an important means for humans to obtain information from large-scale data. Question-answering systems based on natural language processing technology enable users to ask questions in an intuitive and natural way to obtain the information they need. Question-answering systems based on knowledge graphs have difficulties in parsing natural language questions, while large models have stronger generalization capabilities in question-answering formats and stronger language parsing capabilities. Secondly, although large models exceed large-scale knowledge graphs in terms of the order of magnitude of knowledge, the quality of the knowledge base is a big problem, and the accuracy of knowledge questions and answers is low.

[0003] The existing question-and-answer systems have problems in the data preprocessing process, such as data reading errors, data cleaning loss, and inaccurate feature extraction. These problems affect the quality of the data and lead to inaccurate and unstable question-and-answer strategy construction, making it difficult to meet the diverse needs of users and deal with complex problem scenarios.

[0004] Therefore, it is urgent to propose a method for constructing a question-answering strategy. Summary of the invention

[0005] The present invention provides a question-answering strategy construction method based on Java language and large models, which combines Java language and large models to efficiently and accurately process data reading, cleaning, feature extraction and matching domain models, improve the accuracy and stability of subsequent question-answering strategy construction, meet diverse user needs and cope with complex problem scenarios.

[0006] The technical solution adopted by the present invention is:

[0007] A method for constructing a question-answering strategy based on Java language and a large model includes the following specific steps:

[0008] S1. Obtain problem data;

[0009] S2. Preprocess the problem data based on Java language, including data reading, data cleaning, feature extraction and domain model matching;

[0010] S3. The corresponding domain model receives the preprocessed question data, performs vector matching based on the QA knowledge base, and sets a matching score: if the set matching score is reached, the corresponding question and answer information is directly returned; otherwise, proceed to the next step;

[0011] S4, based on the features extracted from the question data, select the corresponding prompt word template from the preset prompt word template library, and then call the large model to generate the answer data;

[0012] S5, entering the answer data into the client database, and waiting for the customer evaluation to form the customer evaluation data;

[0013] S6. Based on customer evaluation data, count and analyze the accuracy of responses and generate reports;

[0014] S7. Setting a threshold for the accuracy of the response: if the accuracy of the response exceeds the threshold, the question data and the answer data are input into the large model for classification training; otherwise, the question data and the answer data are not enabled;

[0015] S8. Based on the classification results of the large model, the question data and answer data are re-entered into the corresponding type of QA knowledge base to obtain the target QA knowledge base.

[0016] Furthermore, the step S2 is as follows:

[0017] 1) Data reading: Use Java's BufferedReader class in combination with FileReader to read the problem data in blocks and adopt a buffering mechanism;

[0018] 2) Data cleaning: Use Java regular expression Pattern and Matcher classes to identify and remove noise data, duplicate data, and invalid data;

[0019] 3) Feature extraction: Perform part-of-speech tagging, named entity recognition, and keyword extraction on the cleaned data; based on the natural language processing library, analyze word frequency, part-of-speech, and context information to extract feature vectors representing the core content of the question;

[0020] 4) Domain model matching: A fast matching algorithm based on a hash table or tree structure is used to match the extracted feature vector with the pre-built domain model. Based on the corresponding feature identifiers of each domain model, the domain to which the problem belongs is determined through multiple comparisons. The cosine similarity calculation method is introduced to evaluate the matching degree between the feature vector and the domain model.

[0021] Furthermore, the vector matching based on the QA knowledge base in step S3 is specifically as follows:

[0022] 1) Based on the vector space model, the question and the question-answer pairs in the QA knowledge base are converted into vector form;

[0023] 2) Use the vector calculation method in the Apache Commons Math library to calculate the similarity between vectors, and then set the matching score: when the similarity reaches the matching score, directly return the corresponding question and answer information; otherwise, proceed to the next step.

[0024] Furthermore, it also includes: using a B+ tree or an inverted index structure to optimize the index of the knowledge base.

[0025] Furthermore, the step S4 is as follows:

[0026] 1) Select a prompt word template from a preset prompt word template library based on the feature information extracted from the question data and the result of matching the domain model;

[0027] 2) Generate targeted input through prompt word templates and call the large model to generate answer data;

[0028] Furthermore, the step S5 is specifically as follows:

[0029] Use the Java Elasticsearch client library, where the Elasticsearch client library can use elasticsearch-rest-high-level-client, to enter the answer data generated by the big model corresponding to the question data into Elasticsearch in JSON format.

[0030] Furthermore, it also includes: creating different indexes for the questions and the answers generated by the corresponding large model, and setting the types and analyzers of related fields.

[0031] Furthermore, the step S6 is specifically as follows:

[0032] 1) Start the background thread regularly to execute the statistics of customer evaluation data;

[0033] 2) Extracting valuable information from customer evaluation data through data mining technology to obtain target customer evaluation data;

[0034] 3) Use statistical algorithms to analyze the accuracy of target customer evaluation data and question data responses to obtain analysis results;

[0035] 4) Generate detailed statistical reports based on the analysis results.

[0036] Furthermore, the step S8 is specifically as follows:

[0037] 1) Use the TensorFlow or PyTorch deep learning framework interface in Java to input question data and answer data into the big model for classification training;

[0038] 2) According to the classification results, the question data and answer data are re-entered into the corresponding type of QA knowledge base to obtain the target QA knowledge base.

[0039] Compared with the prior art, the present invention has the following beneficial effects:

[0040] The present invention uses a data preprocessing process based on the Java language to efficiently handle data reading, cleaning, feature extraction and matching domain models; after receiving question data, different domain models give priority to vector matching in the QA knowledge base, and directly return the corresponding question and answer data when the set matching score is reached; otherwise, the matching prompt word template is called according to the question data features and the model, and the large model is called to generate the answer data; the answer data is entered into the Elasticsearch client library to facilitate the regular reply statistics work; the accuracy of the reply is analyzed and a threshold is set. When the accuracy of the reply is higher than the set threshold, the large model is used for classification operation, and then the question data and the answer data are entered into the corresponding type of QA knowledge base to ensure seamless connection with the large model, thereby realizing high-precision and stable question and answer strategy construction, and improving user experience and system performance. BRIEF DESCRIPTION OF THE DRAWINGS

[0041] The present invention will be further described below in conjunction with the accompanying drawings and specific embodiments:

[0042] Figure 1 It is a flow chart of a method for constructing a question-answering strategy based on Java language and a large model according to the present invention. DETAILED DESCRIPTION

[0043] Example

[0044] like Figure 1 As shown, a method for constructing a question-answering strategy based on Java language and a large model includes the following specific steps:

[0045] S1. Obtain problem data;

[0046] S2. Preprocess the problem data based on Java language, including data reading, data cleaning, feature extraction and domain model matching;

[0047] Among them, 1) the data reading process: using Java's Buffered Reader class in combination with File Reader to read the problem data in blocks and adopt a buffering mechanism; the block reading and buffering mechanism are used to reduce the number of disk I / O operations;

[0048] Specifically, large-scale data files are divided into blocks of fixed size, and read and stored block by block, so as to avoid loading large-scale data files into memory at one time, which may cause memory overflow and affect subsequent efficiency.

[0049] 2) Data cleaning process: Use Java regular expression Pattern and Matcher classes to identify and remove noise data, duplicate data, and invalid data;

[0050] Specifically, when removing punctuation marks and special characters, duplicate rows are detected and removed through a hash table; format conversion and standardization are performed on data with irregular formats to ensure data consistency and availability;

[0051] 3) Feature extraction process: perform part-of-speech tagging, named entity recognition and keyword extraction on the cleaned data; analyze word frequency, part-of-speech and context information based on the natural language processing library to extract feature vectors representing the core content of the question;

[0052] Specifically, based on Stanford Core NLP, the cleaned data is about questions about "weather", and part-of-speech tagging, named entity recognition and keyword extraction are performed on it; word frequency, part-of-speech and context information are analyzed, and "weather", "temperature" and "forecast" representing the core content of the question are extracted as feature vectors;

[0053] 4) Domain model matching process: Based on a fast matching algorithm with a hash table or tree structure, the extracted feature vector is matched with the pre-built domain model; based on the corresponding feature identifiers of each domain model, the domain to which the problem belongs is determined through multiple comparisons; the cosine similarity calculation method is introduced to evaluate the matching degree between the feature vector and the domain model to ensure accurate matching.

[0054] S3. The corresponding domain model receives the preprocessed question data, performs vector matching based on the QA knowledge base, and sets a matching score: if the set matching score is reached, the corresponding question and answer information is directly returned; otherwise, proceed to the next step;

[0055] Specifically, 1) based on the vector space model, the question and the question-answer pairs in the QA knowledge base are converted into vector form;

[0056] 2) Use the vector calculation method in the Apache Commons Math library to calculate the similarity between vectors, and then set the matching score: when the similarity reaches the matching score, directly return the corresponding question and answer information; otherwise, proceed to the next step;

[0057] As a further step of this embodiment, a B+ tree or an inverted index structure is used to optimize the index of the knowledge base to further improve the matching efficiency;

[0058] S4, based on the features extracted from the question data, select the corresponding prompt word template from the preset prompt word template library, and then call the large model to generate the answer data;

[0059] 1) Select a prompt word template from a preset prompt word template library based on the feature information extracted from the question data and the result of matching the domain model;

[0060] 2) Generate targeted input through prompt word templates and call the large model to generate answer data;

[0061] Specifically, for questions asking about "the performance of a new type of electronic product", a prompt word template containing key information such as product features and technical specifications is selected from a preset prompt word template library, and the large model is called to generate the answer corresponding to the question;

[0062] S5, entering the answer data into the client database, and waiting for the customer evaluation to form the customer evaluation data;

[0063] Specifically, using the Java Elasticsearch client library, wherein the Elasticsearch client library may adopt elasticsearch-rest-high-level-client, the answer data generated by the large model corresponding to the question data is entered into Elasticsearch in JSON format;

[0064] In addition, during the input process, the index structure and mapping relationship can be defined to facilitate subsequent search and query operations. Specifically, different indexes are created for the question data and the corresponding answer data generated by the large model, and the types and analyzers of the relevant fields are set to improve the accuracy and efficiency of the search.

[0065] S6. Based on customer evaluation data, count and analyze the accuracy of responses and generate reports;

[0066] Specifically, 1) regularly start a background thread to execute statistics of customer evaluation data;

[0067] 2) Extracting valuable information from customer evaluation data through data mining technology to obtain target customer evaluation data, such as user satisfaction with answers and the difficulty level of questions;

[0068] 3) Use statistical algorithms to analyze the accuracy of target customer evaluation data and question data responses to obtain analysis results;

[0069] 4) Generate detailed statistical reports based on the analysis results to provide a basis for system optimization and improvement;

[0070] S7. Setting a threshold for the accuracy of the response: if the accuracy of the response exceeds the threshold, the question data and the answer data are input into the large model for classification training; otherwise, the question data and the answer data are not enabled;

[0071] Specifically, the threshold of the accuracy of the reply is set to 0.8: when the accuracy of the reply exceeds 0.8, the large model is used to further refine the classification of the question data and the answer data; otherwise, the question data and the answer data are not enabled;

[0072] S8. Based on the classification results of the large model, the question data and the answer data are re-entered into the corresponding type of QA knowledge base to obtain the target QA knowledge base;

[0073] Specifically, 1) use the interface of TensorFlow or PyTorch deep learning framework in Java to input question data and answer data into the big model for classification training;

[0074] 2) According to the classification results, the question data and answer data are re-entered into the corresponding type of QA knowledge base to obtain the target QA knowledge base, continuously enriching and improving the content and structure of the knowledge base, and improving the adaptability and accuracy of the system.

[0075] The embodiments described above are merely descriptions of preferred implementation modes of the present invention and are not intended to limit the scope of the present invention. Without departing from the principles and essence of the present invention, various modifications and improvements made to the technical solutions of the present invention by ordinary technicians in this field should all fall within the scope of protection determined by the claims of the present invention.

Claims

1. A method for constructing a question-answering strategy based on Java language and a large model, characterized in that: The specific steps include: S1. Obtain problem data; S2. Preprocess the problem data based on Java language, including data reading, data cleaning, feature extraction and domain model matching; S3. The corresponding domain model receives the preprocessed question data, performs vector matching based on the QA knowledge base, and sets a matching score: if the set matching score is reached, the corresponding question and answer information is directly returned; Otherwise, proceed to the next step; S4, based on the features extracted from the question data, select the corresponding prompt word template from the preset prompt word template library, and then call the large model to generate the answer data; S5, entering the answer data into the client database, and waiting for the customer evaluation to form the customer evaluation data; S6. Based on customer evaluation data, count and analyze the accuracy of responses and generate reports; S7. Setting a threshold for the accuracy of the response: If the accuracy of the response exceeds the threshold, the question data and the answer data are input into the large model for classification training; Otherwise, question data and answer data are not enabled; S8. Based on the classification results of the large model, the question data and answer data are re-entered into the corresponding type of QA knowledge base to obtain the target QA knowledge base.

2. According to claim 1, a method for constructing a question-answering strategy based on Java language and a large model is characterized in that: The specific steps of step S2 are as follows: 1) Data reading: Use Java's BufferedReader class in combination with FileReader to read the problem data in blocks and adopt a buffering mechanism; 2) Data cleaning: Use Java regular expression Pattern and Matcher classes to identify and remove noise data, duplicate data, and invalid data; 3) Feature extraction: perform part-of-speech tagging, named entity recognition, and keyword extraction on the cleaned data; Based on the natural language processing library, word frequency, part of speech and context information are analyzed to extract feature vectors representing the core content of the question; 4) Domain model matching: A fast matching algorithm based on a hash table or tree structure is used to match the extracted feature vector with the pre-built domain model. Based on the corresponding feature identifiers of each domain model, the domain to which the problem belongs is determined through multiple comparisons. The cosine similarity calculation method is introduced to evaluate the matching degree between the feature vector and the domain model.

3. According to claim 1, a method for constructing a question-answering strategy based on Java language and a large model is characterized in that: The vector matching based on the QA knowledge base in step S3 is specifically as follows: 1) Based on the vector space model, the question and the question-answer pairs in the QA knowledge base are converted into vector form; 2) Use the vector calculation method in the Apache Commons Math library to calculate the similarity between vectors, and then set the matching score: when the similarity reaches the matching score, directly return the corresponding question and answer information; otherwise, proceed to the next step.

4. According to claim 3, a method for constructing a question-answering strategy based on Java language and a large model is characterized in that: Also includes: Use B+ tree or inverted index structure to optimize the knowledge base index.

5. According to claim 1, a method for constructing a question-answering strategy based on Java language and a large model is characterized in that: The specific details of step S4 are as follows: 1) Select a prompt word template from a preset prompt word template library based on the feature information extracted from the question data and the result of matching the domain model; 2) Generate targeted input through prompt word templates and call the large model to generate answer data; 6. The method for constructing a question-answering strategy based on Java language and a large model according to claim 1, characterized in that: The specific details of step S5 are as follows: Use the Java Elasticsearch client library, where the Elasticsearch client library can use elasticsearch-rest-high-level-client, to enter the answer data generated by the big model corresponding to the question data into Elasticsearch in JSON format.

7. According to claim 1, a method for constructing a question-answering strategy based on Java language and a large model is characterized in that: Also includes: Create different indexes for questions and the answers generated by the corresponding large model, and set the types and analyzers of related fields.

8. The method for constructing a question-answering strategy based on Java language and a large model according to claim 1, characterized in that: The specific steps of step S6 are as follows: 1) Start the background thread regularly to execute the statistics of customer evaluation data; 2) Extracting valuable information from customer evaluation data through data mining technology to obtain target customer evaluation data; 3) Use statistical algorithms to analyze the accuracy of target customer evaluation data and question data responses to obtain analysis results; 4) Generate detailed statistical reports based on the analysis results.

9. The method for constructing a question-answering strategy based on Java language and a large model according to claim 1, characterized in that: The specific steps of step S8 are as follows: 1) Use the TensorFlow or PyTorch deep learning framework interface in Java to input question data and answer data into the big model for classification training; 2) According to the classification results, the question data and answer data are re-entered into the corresponding type of QA knowledge base to obtain the target QA knowledge base.

Citation Information

Cited By

  • Large model question and answer optimization method and device, equipment and storage medium

    CN120144727A

  • A Method, Device, Equipment and Storage Medium for Optimizing Large Model Q&A

    CN120144727B