Cross-domain problem processing methods and apparatuses, electronic device and storage medium

By using the domain lexicon and text classification model in the natural language processing model to classify input problems, the problem of inaccurate information and slow text classification in the prior art is solved, and higher question-and-answer accuracy and user experience are achieved.

WO2025044865A1PCT designated stage expired Publication Date: 2025-03-06HANVON CORP

Patent Information

Application Number
PCT/CN2024/113681
Authority / Receiving Office
WO · WO
Patent Type
Applications
Current Assignee / Owner
Priority Date
2023-08-30
Filing Date
2024-08-21
Publication Date
2025-03-06

AI Technical Summary

Technical Problem

Existing natural language processing models may generate inaccurate or misleading information when generating text, making it difficult to implement. At the same time, text classification methods based on deep learning have limitations in speed and resource consumption, and rules-based methods are difficult to deal with complex semantics and language changes.

Method used

By using the domain lexicon of preset fields and a pre-trained text classification model, the input questions are classified and processed, and the domain classification results are obtained, and this result is used as input to the preset language processing model to improve the accuracy of question and answer.

Benefits of technology

It has achieved the improvement of the accuracy of the preset language processing model Q&A, reduced classification errors, improved user experience and satisfaction, and improved work efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN2024113681_06032025_PF_FP_ABST
    Figure CN2024113681_06032025_PF_FP_ABST
Patent Text Reader

Abstract

The present application belongs to the technical field of natural language processing. Disclosed are cross-domain problem processing methods and apparatuses. A method comprises: on the basis of a preset domain-specific domain thesaurus and a pre-trained text classification model, performing question classification processing on an input question so as to obtain a domain classification result of the input question; and then using the domain classification result and the input problem as inputs of a preset language processing model, and obtaining an answer corresponding to the input question by means of the preset language processing model. The method can effectively improve the accuracy of question answering of the preset language processing model.
Need to check novelty before this filing date? Find Prior Art

Description

Cross-domain problem processing method, device, electronic device and storage medium

[0001] This disclosure claims priority to a Chinese patent application filed with the Patent Office of China on August 30, 2023, with application number 202311105721.4 and invention name “Cross-domain problem processing method, device, electronic device and storage medium”, the entire contents of which are incorporated by reference into this disclosure. Technical Field

[0002] The present application relates to the field of natural language processing technology, and in particular to a method, device, electronic device, and computer-readable storage medium for processing cross-domain problems. Background Art

[0003] In the field of natural language processing (NLP), with the development of deep learning technology, preset language processing models based on Transformers (such as ChatGPT, ChatGLM, etc.), namely large models, have achieved remarkable success. These preset language processing models rely on large amounts of text data for training, giving them strong generation and comprehension capabilities. However, although these preset language processing models can generate fluent and seemingly reasonable text, they may generate inaccurate or even misleading information, making the implementation of preset language processing models more difficult.

[0004] Commonly used text classification methods in the prior art include: methods that use deep learning related technologies to implement text classification, and methods that implement text classification based on rules. Among them, the method that uses deep learning related technologies to implement text classification (such as classification based on BERT) includes larger model parameters, resulting in slower classification speed, and the training data set is large in scale. The training process takes up more resources and takes a longer time, which limits the rapid iteration and real-time application of the classification model. The method that implements text classification based on rules usually requires manual writing of rules, which makes the generalization ability weak when processing new unseen samples, and it is difficult to handle complex semantics and language changes. On the other hand, this method is based on classification based on some explicit rules, which cannot capture implicit semantics and contextual information.

[0005] Summary of the Invention

[0006] The embodiments of the present application provide a cross-domain problem processing method and device, electronic device and storage medium, which can promote the implementation of the preset language processing model and improve the accuracy of the overall question and answer of the preset language processing model.

[0007] In a first aspect, the embodiments of the present application provide a method for handling cross-domain problems, including:

[0008] Based on the preset domain vocabulary of each field and the pre-trained text classification model, the input question is classified and the domain classification result of the input question is obtained;

[0009] The domain classification result and the input question are used as inputs of a preset language processing model, and the answer corresponding to the input question is obtained through the preset language processing model.

[0010] In a second aspect, an embodiment of the present application provides a cross-domain problem handling device, including:

[0011] A question classification module is used to classify input questions based on preset domain lexicons and pre-trained text classification models, and obtain domain classification results for the input questions;

[0012] The question answering module is used to use the field classification result and the input question as inputs of a preset language processing model, and obtain the answer corresponding to the input question through the preset language processing model.

[0013] In a third aspect, the present application provides a method for handling cross-domain issues, including:

[0014] Perform keyword matching on the input question based on the preset domain lexicon of each domain, and obtain a first index value of the input question hitting the keyword in each domain lexicon, as well as the sub-domain to which the hit keyword belongs;

[0015] Classifying the input question by a preset first classification model to obtain a second indicator value of the input question matching each of the fields;

[0016] Determining a target domain matching the input question according to the first indicator value and the second indicator value;

[0017] Classifying the input question using a preset second classification model corresponding to the target domain to obtain a third indicator value of the input question matching each preset sub-domain of the target domain;

[0018] The input question is classified in the sub-field according to the third index value and the sub-field to which the hit keyword belongs, and a field classification result of the input question is obtained.

[0019] In a fourth aspect, an embodiment of the present application provides a cross-domain problem handling device, including:

[0020] A keyword matching module is used to match the input question with keywords based on the domain vocabulary of each domain, and obtain a first index value of the input question hitting the keywords in each domain vocabulary, as well as the sub-domain to which the hit keywords belong;

[0021] A first classification module is configured to classify the input question using a preset first classification model to obtain a second indicator value of the input question matching each of the fields;

[0022] A first classification result determination module is used to determine a target domain that the input question matches based on the first indicator value and the second indicator value;

[0023] A second classification module is configured to classify the input question using a preset second classification model corresponding to the target domain, and obtain a third indicator value of the input question matching each preset sub-domain of the target domain;

[0024] The classification result acquisition module is used to classify the input question in the sub-field according to the third indicator value and the sub-field to which the hit keyword belongs, and obtain the field classification result of the input question.

[0025] In a fifth aspect, an embodiment of the present application further discloses an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the cross-domain problem processing method described in the embodiment of the present application when executing the computer program.

[0026] In a sixth aspect, an embodiment of the present application provides a computer-readable storage medium on which a computer program is stored. When the program is executed by a processor, the steps of the cross-domain problem processing method disclosed in the embodiment of the present application are performed.

[0027] The cross-domain problem processing method disclosed in the embodiment of the present application performs keyword matching on the input question based on the domain vocabulary of each preset domain to obtain a first index value of the input question hitting the keyword in each domain vocabulary, and the sub-domain to which the hit keyword belongs; classifies the input question through a preset first classification model to obtain a second index value of the input question matching each domain; determines the target domain matched by the input question based on the first index value and the second index value; classifies the input question through a preset second classification model corresponding to the target domain to obtain a third index value of the input question matching each preset sub-domain of the target domain; classifies the input question in the sub-domain based on the third index value and the sub-domain to which the hit keyword belongs to, and obtains the domain classification result of the input question, which can quickly perform cross-domain classification on the input question with high classification accuracy.

[0028] On the other hand, an embodiment of the present application also discloses a cross-domain problem processing method, which performs problem classification processing on the input question based on the preset domain vocabulary of each domain and a pre-trained text classification model to obtain the domain classification result of the input question; then, the domain classification result and the input question are used as the input of the preset language processing model, and the answer corresponding to the input question is obtained through the preset language processing model, which can effectively improve the accuracy of the question and answer of the preset language processing model.

[0029] The above description is only an overview of the technical solution of the present application. In order to more clearly understand the technical means of the present application, it can be implemented in accordance with the contents of the specification. In order to make the above and other purposes, features and advantages of the present application more obvious and easy to understand, the specific implementation methods of the present application are listed below. BRIEF DESCRIPTION OF THE DRAWINGS

[0030] To make the purpose, technical solutions, and advantages of the embodiments of this application more clear, the technical solutions in the embodiments of this application will be clearly and completely described below in conjunction with the drawings in the embodiments of this application. Obviously, the described embodiments are part of the embodiments of this application, not all of the embodiments. Based on the embodiments in this application, all other embodiments obtained by ordinary technicians in this field without making creative efforts are within the scope of protection of this application.

[0031] FIG1 is a flow chart of a cross-domain problem solving method disclosed in an embodiment of the present application;

[0032] FIG2 is a schematic diagram of the structures of the first classification model and the second classification model in the cross-domain problem processing method disclosed in an embodiment of the present application;

[0033] FIG3 is a second flow chart of the cross-domain problem processing method disclosed in an embodiment of the present application;

[0034] FIG4 is a third flow chart of the cross-domain problem processing method disclosed in an embodiment of the present application;

[0035] FIG5 is a flow chart of a classification step in the cross-domain problem processing method disclosed in an embodiment of the present application;

[0036] FIG6 is a schematic diagram of a cross-domain problem processing device according to an embodiment of the present application;

[0037] FIG7 is a second structural diagram of the cross-domain problem processing device disclosed in an embodiment of the present application;

[0038] FIG8 schematically shows a block diagram of an electronic device for executing the method according to the present application; and

[0039] FIG9 schematically shows a storage unit for storing or carrying program codes for implementing the method according to the present application. DETAILED DESCRIPTION

[0040] The following will be combined with the drawings in the embodiments of this application to clearly and completely describe the technical solutions in the embodiments of this application. Obviously, the embodiments described are part of the embodiments of this application, not all of them. Based on the embodiments in this application, all other embodiments obtained by ordinary technicians in this field without making creative efforts are within the scope of protection of this application.

[0041] An embodiment of the present application further discloses a method for processing cross-domain problems, as shown in FIG1 , the method includes: step 110 and step 120 .

[0042] Step 110: Based on the preset domain lexicon of each domain and the pre-trained text classification model, the input question is classified to obtain the domain classification result of the input question;

[0043] Step 120 : Using the domain classification result and the input question as inputs to a preset language processing model, an answer corresponding to the input question is obtained through the preset language processing model.

[0044] The preset language processing model described in the embodiments of the present application can be a cross-domain preset language processing model in the prior art. For example, based on a large model such as ChatGPT, ChatGLM, etc. The preset language processing model supports outputting a corresponding answer based on the question text entered by the user.

[0045] Optionally, the preset fields may include business fields such as education, healthcare, and law. The preset fields match the business fields supported by the preset language processing model. For example, if the preset language processing model is trained based on data from the three business fields of education, healthcare, and law, that is, the preset language processing model supports knowledge questions and answers in the three business fields of education, healthcare, and law, then the preset fields include education, healthcare, and law.

[0046] In the embodiments of this application, for each pre-defined domain, a domain vocabulary is pre-built for each domain. The domain vocabulary contains keywords for that domain and the sub-domains to which each keyword belongs. The specific implementation method for building the domain vocabulary for each domain is described below and will not be repeated here.

[0047] In the embodiment of the present application, the pre-trained text classification model is a lightweight text classification model, which has the ability to process a large amount of text classification and unknown text classification, and has high classification accuracy and classification speed.

[0048] In some embodiments of the present application, the training data for the text classification model is obtained after fine-tuning based on the training data set of the preset language processing model. The text classification model can adopt a two-stage classification model, where the text classification model used in the first stage (i.e., the preset first classification model) is used to classify the input question into a certain business field, and the text classification model used in the second stage (i.e., the preset second classification model) is used to classify the input question into a sub-field classification of the business field.

[0049] The text classification model at each stage, i.e., the preset first classification model and the preset second classification model, can adopt the structure shown in Figure 2. As shown in Figure 2, the preset first classification model and the preset second classification model respectively include: a character vector encoding sub-model 210, a word vector encoding sub-model 220, and a text classification sub-model 230.

[0050] Among them, the character vector encoding sub-model can adopt the FastText encoding model, the word vector encoding sub-model can adopt the Word2Vec encoding model, and the text classification sub-model can adopt the TextCNN model.

[0051] The structure and training method of the text classification model are described below and will not be repeated here.

[0052] Optionally, the text classification model includes: a preset first classification model and a preset second classification model, which performs question classification processing on the input question based on the preset domain vocabulary of each field and the pre-trained text classification model to obtain the domain classification result of the input question, including: performing keyword matching on the input question based on the preset domain vocabulary of each field to obtain a first index value of the input question hitting the keyword in each of the domain vocabulary, and the sub-field to which the hit keyword belongs; classifying the input question through the preset first classification model to obtain a second index value of the input question matching each of the fields; determining the target field matching the input question based on the first index value and the second index value; classifying the input question through the preset second classification model corresponding to the target field to obtain a third index value of the input question matching each of the preset sub-fields of the target field; classifying the input question in the sub-field based on the third index value and the sub-field to which the hit keyword belongs to obtain the field classification result of the input question.

[0053] Based on the preset domain vocabulary of each field, the input question is matched with keywords to obtain the first index value of the input question hitting the keywords in each domain vocabulary, as well as the specific implementation method of the sub-field to which the hit keyword belongs. Please refer to the description below and will not be repeated here.

[0054] Optionally, the input question is classified by a preset first classification model to obtain a second index value of the input question matching each of the fields, including: character vector encoding of the input question to obtain a first vector; word vector encoding of the input question to obtain a second vector; fusing the first vector and the second vector to obtain a third vector; performing text classification processing based on the third vector to obtain a second index value of the input question matching each of the preset fields.

[0055] For example, the input question is classified by the preset first classification model to obtain the second index value of the input question matching each of the fields, including: character vector encoding of the input question by the word vector encoding sub-model 210 to obtain a first vector; word vector encoding of the input question by the word vector encoding sub-model 220 to obtain a second vector; fusing the first vector and the second vector by the text classification sub-model 230 to obtain a third vector, and performing text classification processing based on the third vector to obtain the second index value of the input question matching each of the preset fields.

[0056] The specific implementation of performing word vector encoding on the input question to obtain the first vector is described below and will not be repeated here.

[0057] The specific implementation method of performing word vector encoding on the input question to obtain the second vector is described below and will not be repeated here.

[0058] The specific implementation of fusing the first vector and the second vector to obtain the third vector is described below and will not be repeated here.

[0059] The specific implementation method of performing text classification processing based on the third vector to obtain the second indicator value of the input question matching each preset field is described below and will not be repeated here.

[0060] Optionally, determining a target domain that the input question matches based on the first indicator value and the second indicator value includes:

[0061] Using a preset weight value to perform a weighted summation on the first indicator value and the second indicator value to obtain a matching score corresponding to each preset field;

[0062] The preset domain with the highest matching score is determined as the target domain for matching the input question.

[0063] The first indicator value and the second indicator value are weighted and summed using a preset weight value to obtain a matching score corresponding to each preset field, and the preset field with the highest matching score is determined as the target field for matching the input question. The specific implementation method is described below and will not be repeated here.

[0064] Optionally, the input question is classified by the preset second classification model corresponding to the target domain to obtain a third indicator value of the input question matching the preset sub-domains of the target domain, including: character vector encoding of the input question to obtain a fourth vector; word vector encoding of the input question to obtain a fifth vector; fusing the fourth vector and the fifth vector to obtain a sixth vector; performing text classification processing based on the sixth vector to obtain the third indicator value of the input question matching the preset sub-domains of the target domain.

[0065] For example, the input question is classified by the preset second classification model corresponding to the target domain to obtain the third indicator value of the input question matching the preset sub-domains of the target domain, including: character vector encoding of the input question by the character vector encoding sub-model 210 to obtain a fourth vector; word vector encoding of the input question by the word vector encoding sub-model 220 to obtain a fifth vector; fusing the fourth vector and the fifth vector by the text classification sub-model 230 to obtain a sixth vector, and performing text classification processing based on the sixth vector to obtain the third indicator value of the input question matching the preset sub-domains of the target domain.

[0066] The specific implementation of performing word vector encoding on the input question to obtain the fourth vector is described below and will not be repeated here.

[0067] The specific implementation method of performing word vector encoding on the input question to obtain the fifth vector is described below and will not be repeated here.

[0068] The specific implementation of fusing the fourth vector and the fifth vector to obtain the sixth vector is described below and will not be repeated here.

[0069] The specific implementation method of performing text classification processing based on the sixth vector to obtain the third indicator values ​​of the preset sub-fields of the target field for matching the input question is described below and will not be repeated here.

[0070] Furthermore, the input question is classified in the sub-field according to the third index value and the sub-field to which the hit keyword belongs. The specific implementation method for obtaining the field classification result of the input question is described below and will not be repeated here.

[0071] Optionally, the domain vocabulary is constructed by the following method:

[0072] For the target preset field, one or more of the following keyword extraction methods are used to obtain the keywords of the target preset field: extract the first keyword from the sample text based on the preset rules; extract the long-tail keyword from the sample text by word splicing as the second keyword; cluster the subwords of the preset long-tail keyword to obtain the target subword as the third keyword; and construct the domain vocabulary of the target preset field based on one or more keywords among the first keyword, the second keyword and the third keyword.

[0073] The specific implementation method of extracting the first keyword from the sample text based on the preset rules is described below and will not be repeated here.

[0074] Optionally, the method of extracting long-tail keywords from the sample text by word splicing as the second keyword includes: dividing the sample text into sentences according to preset symbols and text length to obtain sentences to be processed; performing word segmentation on the obtained sentences to be processed to obtain candidate word segmentations; screening and part-of-speech tagging on the candidate word segmentations to obtain target candidate word segmentations with preset parts of speech; splicing noun phrases based on the target candidate word segmentations as candidate long-tail keywords; obtaining importance scores of the candidate long-tail keywords; and selecting the candidate long-tail keywords as the second keyword based on the importance scores.

[0075] The specific implementation of this step of extracting long-tail keywords as the second keywords from the sample text by word splicing is described below and will not be repeated here.

[0076] The specific implementation of clustering the subwords of the preset long-tail keyword and obtaining the target subword as the third keyword is described below and will not be repeated here.

[0077] The specific implementation of constructing the domain vocabulary of the target preset domain based on one or more keywords among the first keyword, the second keyword and the third keyword is described below and will not be repeated here.

[0078] In the aforementioned step 110, the user's input question can first be pre-classified based on the preset domain vocabulary of each field and the pre-trained text classification model to obtain the sub-domain of the business field to which the input question belongs. Afterwards, the sub-domain information and the input question are used together as inputs of the preset language processing model, and the preset language processing model combines the input question and the sub-domain described in the input question to output the answer.

[0079] The specific implementation method of the preset language processing model to obtain the corresponding answer based on the input question text is the existing technology and will not be repeated in the embodiments of this application.

[0080] An embodiment of the present application discloses a cross-domain problem processing method, which classifies input questions based on preset domain lexicons of various fields and a pre-trained text classification model to obtain domain classification results of the input questions; then, the domain classification results and the input questions are used as inputs of a preset language processing model, and the answers corresponding to the input questions are obtained through the preset language processing model, which can effectively improve the accuracy of questions and answers of the preset language processing model.

[0081] Furthermore, this method uses a pre-classification algorithm to first accurately classify user questions into specific fields, and then further classify user questions into sub-fields of that field, which can reduce classification errors. Through precise classification, the preset language processing model can understand and answer questions based on the knowledge content of the sub-field, avoiding the generation of irrelevant content, thereby improving the accuracy of the overall question and answer, making the implementation of the preset language processing model possible. The introduction of hierarchical question classification and question-answering systems can provide more accurate and comprehensive answers to user questions, improving user experience and satisfaction.

[0082] The text classification model used in the embodiment of the present application can quickly classify user input questions with high accuracy. Using the classification labels output by the preset first classification model, the preset second classification model of the corresponding industry field can be directly called to obtain the sub-field classification results. Then, based on the sub-field classification results, the preset language processing model can query the sub-field knowledge base under the corresponding industry field, thereby achieving rapid result output. Through this process, the preset language processing model can respond to problems more efficiently, improve work efficiency, and enhance the professionalism and accuracy of the preset language processing model.

[0083] The present embodiment introduces an efficient text classification model to accurately categorize user-entered questions. This classification process not only categorizes questions into different categories, but more importantly, provides strong support for further processing in the large-scale model. By accurately classifying questions and calling the corresponding modules in the large-scale model based on the classification results, accuracy is improved in the question-answering environment.

[0084] In the embodiments of this application, the text classification model serves to enhance the accuracy of question-answering in the large-scale model. By finely categorizing questions, the large-scale model can more effectively focus on specific problem areas, thereby improving overall question-answering accuracy. The introduction of text classification technology provides key support for the optimization of large-scale models and lays a solid foundation for solving practical question-answering problems.

[0085] The embodiment of the present application further discloses a method for processing cross-domain problems. As shown in FIG3 , the method includes steps 310 to 350 .

[0086] Step 310 , performing keyword matching on the input question based on the preset domain lexicon of each domain, obtaining a first index value of the input question hitting the keywords in each domain lexicon, and the sub-domain to which the hit keywords belong.

[0087] Optionally, the first indicator value may be the number of keywords in each of the domain lexicons that are hit by the input question.

[0088] When implementing this application, it is first necessary to build a domain vocabulary for the corresponding field based on the question-answering requirements of the preset language processing model. As shown in Figure 4, the input question is matched with keywords based on the preset domain vocabulary of each field, and the first index value of the input question hitting the keywords in each domain vocabulary is obtained, as well as the sub-field to which the hit keyword belongs, which also includes:

[0089] Step 300: construct domain vocabulary for each preset domain.

[0090] The domain vocabulary includes: keywords of the corresponding domain, and the sub-domain to which each keyword belongs.

[0091] For example, for a preset language processing model that supports professional fields such as the legal field, the medical field, and the educational field, a domain vocabulary of the corresponding professional field is first pre-built. Each of the domain vocabulary includes a number of keywords corresponding to the professional field of the domain vocabulary. For example, for a domain vocabulary in the legal field, it may include the names of laws and regulations, crimes, etc. For another example, for a domain vocabulary in the medical field, it may include: drug names, disease names, typical symptom names, medical institution names, etc.

[0092] Furthermore, during the application process, for a designated domain vocabulary, the input question can be compared with keywords in the designated domain vocabulary to determine a list of keywords in the designated domain vocabulary that the input question hits, as well as the sub-domains to which each hit keyword belongs. By counting the sub-domains of the hit keywords in the list, keywords that hit each sub-domain of the domain corresponding to the designated domain vocabulary can be further determined. The number of keywords that hit each sub-domain in the domain can be accumulated to obtain the number of keywords that hit the domain, which is used as the first indicator value.

[0093] In some embodiments of the present application, a keyword hit by an input question can be determined by inclusion matching. For example, when the input question text contains a keyword D1 in the domain vocabulary, the input question can be considered to have hit the keyword D1. For another example, when a keyword D2 in the domain vocabulary contains the input question text, the input question can be considered to have hit the keyword D2.

[0094] In specific implementation, the keyword hit judgment criteria can be set according to the actual matching accuracy requirements. In the embodiment of the present application, the specific implementation method of keyword matching between the input question and the domain vocabulary of a preset domain is not limited.

[0095] In order to improve the accuracy of keyword matching and the accuracy of subsequent classification, it is important to build a rich and accurate domain vocabulary. In an embodiment of the present application, the domain vocabulary is constructed by the following method: for a target preset domain, one or more of the following keyword extraction methods are used to obtain the keywords of the target preset domain: extracting a first keyword from a sample text based on a preset rule; extracting a long-tail keyword from a sample text by word splicing as a second keyword; clustering the subwords of the preset long-tail keyword to obtain the target subword as the third keyword; and constructing a domain vocabulary of the target preset domain based on one or more of the first keyword, the second keyword, and the third keyword.

[0096] The sample text in the embodiment of the present application can be selected from a classification problem dataset used to train a preset language processing model.

[0097] The following are examples to illustrate the above-mentioned various keyword extraction methods.

[0098] (1) Extract the first keyword from the sample text based on preset rules

[0099] Optionally, the preset rule can be determined based on industry keywords given by industry professionals. For example, the preset rule can be to perform keyword exact matching based on a keyword table given by industry professionals.

[0100] For example, in the medical field, a keyword table for the medical field can be constructed by professionals in the industry, including, for example: pharmacopoeia name, designated hospital name, hospital name, disease name, and field keywords such as: "medical insurance", "hospital", "chief physician", "expert number", "disease", etc. Afterwards, the sample text is subjected to keyword extraction according to the above preset rules to obtain the first keyword. For example, for the sample text: "Which website can I get an expert number for cardiovascular and cerebrovascular diseases?", this text involves three keywords in the medical field, namely "cardiovascular and cerebrovascular", "disease" and "expert number", and the three first keywords can be extracted from this sample text.

[0101] According to the above method, several first keywords in the medical field can be extracted from several sample texts.

[0102] Similarly, by setting up keyword tables in other fields, keywords in the corresponding fields can be extracted according to the above method, thereby obtaining several first keywords in the field.

[0103] (2) Use word splicing to extract long-tail keywords from sample text as the second keyword

[0104] Each industry field typically includes many sub-fields, which are referred to as "sub-fields" in the examples of this application. Taking the legal field as an example, its sub-fields mainly include: marriage and family, contract disputes, intellectual property, internet disputes, traffic accidents, debts and credits, criminal cases, real estate disputes, inheritance, medical disputes, damages, land acquisition and demolition, etc. Taking the medical field as an example, its sub-fields mainly include: ophthalmology, dentistry, otolaryngology, orthopedics, gastroenterology, endocrinology, surgery, internal medicine, pediatrics, obstetrics and gynecology, etc.

[0105] Due to the particularity of industry data, the knowledge content involved in its sub-fields contains many relatively long proprietary words, which are recorded as "long-tail keywords" in the embodiments of this application, for example, "Personal Information Protection Law of the People's Republic of China". Traditional keyword extraction methods cannot effectively extract such long-tail keywords. In the embodiments of this application, a method of extracting long-tail keywords from sample text by word splicing is proposed, which integrates the sub-field knowledge of various industry fields and performs keyword extraction.

[0106] Optionally, long-tail keywords are extracted from the sample text by word concatenation as the second keywords, including sub-steps S1 to S6.

[0107] Sub-step S1, dividing the sample text into sentences according to preset symbols and text length to obtain sentences to be processed.

[0108] Optionally, the preset symbol may be a punctuation mark indicating the end of a sentence, such as a period, a question mark, an exclamation mark, etc. The text length is determined according to a specific field, for example, the text length may be 20.

[0109] For example, the sample text (such as the question text in the classification data set) can be divided according to periods and pairs of words with a length of 20, and one or more sentences included in the sample text are obtained as sentences to be processed.

[0110] Sub-step S2, performing word segmentation processing on the obtained sentence to be processed to obtain candidate word segmentations.

[0111] Next, the sentences to be processed may be segmented based on the custom dictionary to obtain the segmented words included in each sentence to be processed as candidate segmented words.

[0112] Sub-step S3, screening and part-of-speech tagging the candidate participles to obtain target candidate participles with preset parts of speech.

[0113] The resulting candidate segmentation words are then screened, including but not limited to one or more of the following: removing stop words, removing meaningless words, etc. Part-of-speech tagging is then performed on the remaining candidate segmentation words. For example, the remaining candidate segmentation words are tagged with a part-of-speech such as noun or adjective. Furthermore, candidate segmentation words tagged with a noun part-of-speech and an adjective part-of-speech are obtained and used as target candidate segmentation words.

[0114] Sub-step S4: Based on the target candidate segmented words, noun phrases are concatenated to serve as candidate long-tail keywords.

[0115] Next, the target candidate segmented words obtained in the previous step, i.e., the segmented words of the noun part of speech and the adjective part of speech, can be spliced ​​according to preset rules to obtain a noun phrase. The spliced ​​noun phrase is used as a candidate long-tail keyword. In an embodiment of the present application, a regular expression can be used to splice two or more target candidate segmented words into a noun phrase as a candidate long-tail keyword in the form of, for example, adjective + noun, noun + noun, noun + noun + noun, etc.

[0116] For example, for the text "When was the "Personal Information Protection Law of the People's Republic of China" promulgated?", after word segmentation, word screening and part-of-speech tagging, we can get the following nouns and adjectives "People's Republic of China", "Personal Information", "Protection Law", "Time" and "Law". Then, after noun splicing, we can get the candidate long-tail keyword "Personal Information Protection Law of the People's Republic of China".

[0117] Sub-step S5, obtaining the importance score of the candidate long-tail keyword.

[0118] Next, calculate the importance score of each candidate long-tail keyword relative to the original sentence (such as the sentence that obtains the candidate long-tail keyword by word segmentation). Optionally, a method such as ELMO (Embeddings from Language Models, a word vector encoding method for sentence patterns) can be used to calculate the word vector of each candidate long-tail keyword, and a pre-trained model such as SIF (Smooth Inverse Frequency) is used to calculate the sentence vector of the original sentence. Then, the cosine distance is used to calculate the similarity between the word vector and the sentence vector as the importance score of the candidate long-tail keyword. The higher the similarity, the more important the importance score, indicating that the candidate long-tail keyword is more important. The more important the candidate keyword is, the more it can represent the meaning of the input text.

[0119] For example, for the original sentence "What are the difficulties in learning the probability part of high school mathematics? Are there any effective methods or learning tools to assist learning?", the candidate long-tail keywords obtained by splicing "high school mathematics", "probability knowledge", and "learning tools" have a high importance score and can represent the core point of the problem.

[0120] Sub-step S6: selecting the candidate long-tail keyword as the second keyword based on the importance score.

[0121] Finally, the candidate long-tail keywords whose importance scores meet the preset conditions can be selected as the second keywords. For example, N candidate long-tail keywords with the highest importance scores can be selected as the second keywords. Wherein, N can be an integer greater than 1 and can take different values ​​according to actual conditions.

[0122] (3) Cluster the subwords of the preset long-tail keywords and obtain the target subword as the third keyword

[0123] Optionally, the preset long-tail keywords may be long-tail keywords extracted using the above method, or may be long-tail keywords obtained using other methods.

[0124] In the industry, questions from non-professional users often do not contain complete professional terms. Due to the long-tail effect of long-tail keywords, these keywords may not exist in the existing vocabulary. However, questions raised by professional users usually involve a large number of professional terms, which often belong to long-tail vocabulary. In order to effectively process these long-tail vocabulary, in the embodiment of the present application, by clustering the subwords that make up the long-tail keywords, the core subwords that constitute the long-tail keywords are obtained, thereby improving the classification accuracy of questions raised by professional users.

[0125] Optionally, clustering the subwords of the preset long-tail keyword to obtain the target subword as the third keyword includes: obtaining the subwords that constitute the preset long-tail keyword; clustering the subwords according to semantic similarity to obtain one or more subword clusters; and selecting the subwords in the subword cluster as the third keyword based on the number and part of speech of the subwords included in the subword cluster.

[0126] In some embodiments of the present application, the core subwords constituting the long-tail keywords can be obtained by the subword clustering method. For example, the subwords constituting the long-tail keywords can first be subjected to text preprocessing to remove special characters, stop words, and redundant punctuation marks. Then, each preprocessed subword is converted into a word vector using a word vector encoding method (such as the word2vec method). For example, in order to facilitate subsequent cluster analysis, the principal component analysis (PCA) method can be used to reduce the space of the word vector to two dimensions, and then the two-dimensional data after dimensionality reduction is used as the input of a clustering algorithm (such as the k-means clustering algorithm), and a clustering operation is performed to finally obtain the clustering result of the subwords, that is, one or more subword clusters. Next, the subwords in the subword cluster whose number of subwords is greater than a preset number threshold can be selected as the third keyword; or, the nouns in the subword cluster whose number of subwords is greater than a preset number threshold can be selected as the third keyword.

[0127] After clustering, the clustering results are some subwords. For example, the subwords that make up the long-tail keyword are: [purulent, conjunctivitis], [severe, blepharitis]. Clustering these words will result in subwords such as: blepharitis, conjunctivitis. These subwords that make up the long-tail keyword are clustered together due to their semantic similarity. Furthermore, the nouns in these clustered subwords can be used as part of the keyword, that is, the third keyword.

[0128] Afterwards, the first keyword, second keyword, and third keyword of domain X obtained through the above three methods can all be used as keywords of domain X and added to the domain vocabulary of domain X. According to the above method, domain vocabulary of each domain corresponding to the problem of the preset language processing model can be constructed.

[0129] In the embodiment of the present application, it is also necessary to set a sub-field attribute for each first keyword to mark the sub-field to which the keyword belongs. For example, for the medical field, the sub-fields included are: ophthalmology, dentistry, gastroenterology, etc. When constructing the domain vocabulary of each field, a sub-field attribute can be set for each keyword in the domain vocabulary at the same time to mark the sub-field to which each keyword belongs. For example, the sub-field attribute value is set to "ophthalmology" for the keywords "myopia", "astigmatism", "cataract", "blepharitis", "meibomitis", "conjunctivitis", and "dry eye", and the sub-field attribute value is set to "dentistry" for the keywords "tooth decay", "Endodontics", and "gingivitis".

[0130] Taking the medical field as an example, the keywords included in the vocabulary can be shown in the following table.

[0131] Table 1. Keywords in the medical field vocabulary

[0132] In the embodiments of this application, by concatenating words with preset parts of speech to obtain long-tail keywords, the classification accuracy of questions raised by professionals in the field can be improved. For example, when a user enters the question "Does the "Personal Information Protection Law of the People's Republic of China" include regulations related to the protection of personal network information?", the long-tail keyword "Personal Information Protection Law of the People's Republic of China" can be accurately matched, thereby classifying the question as a legal field question.

[0133] On the other hand, by clustering the subwords of long-tail keywords and extracting third keywords to construct a domain vocabulary, the classification accuracy of questions posed by non-professionals can be improved. For example, clustering the subwords of the long-tail keyword "Criminal Procedure Law of the People's Republic of China" obtained using the second method yields the third keywords "criminal" and "litigation law," which are then added to the domain vocabulary of the legal field. This domain vocabulary of the legal field now includes both the long-tail keyword "Criminal Procedure Law of the People's Republic of China" and the third keywords "criminal" and "litigation law." When classifying questions, legal professionals may ask a question containing a relatively long, specialized vocabulary, such as "Do you know when the Criminal Procedure Law of the People's Republic of China was promulgated?" In this case, by matching the input question with the long-tail keyword (i.e., the aforementioned second keyword) in the domain vocabulary, "Criminal Procedure Law of the People's Republic of China" is found, thereby classifying the question into the legal field. For ordinary users, questions are more colloquial, such as "When was the criminal law promulgated?" In this case, by matching the input question with the keywords in the domain vocabulary, "criminal" is found, thereby classifying the question into the legal field.

[0134] Step 320: Classify the input question using a preset first classification model to obtain a second indicator value of whether the input question matches each of the fields.

[0135] The preset first classification model and the preset second classification model used in the embodiment of the present application need to be pre-trained,

[0136] As shown in FIG3 , the input question is matched with keywords based on the domain vocabulary of each domain preset to obtain the first index value of the input question hitting the keywords in each domain vocabulary, and the sub-domain to which the hit keyword belongs, further comprising:

[0137] Step 301: train a preset first classification model and a preset second classification model.

[0138] The specific implementation methods of training the preset first classification model and the preset second classification model are described below and will not be repeated here.

[0139] In the embodiment of the present application, there is no limitation on the execution order of step 300 and step 301 .

[0140] On the other hand, the input question is classified based on text features to obtain a second index value of whether the input question matches each of the fields.

[0141] Optionally, as shown in Figure 5, the input question is classified by a preset first classification model to obtain a second indicator value of the input question matching each of the fields, including: sub-step 3201, sub-step 3202, sub-step 3203 and sub-step 3204.

[0142] Sub-step 3201: perform word vector encoding on the input question to obtain a first vector.

[0143] Sub-step 3202: perform word vector encoding on the input question to obtain a second vector.

[0144] Sub-step 3203: Fusing the first vector and the second vector to obtain a third vector.

[0145] Sub-step 3204: performing text classification processing based on the third vector to obtain a second index value of whether the input question matches each preset field.

[0146] Optionally, the classifying of the input question by a preset first classification model to obtain a second index value of the input question matching each of the fields includes: performing word vector encoding on the input question by a word vector encoding sub-model 210 to obtain a first vector; performing word vector encoding on the input question by a word vector encoding sub-model 220 to obtain a second vector; fusing the first vector and the second vector by the text classification sub-model 230 to obtain a third vector, and performing text classification processing based on the third vector to obtain a second index value of the input question matching each of the preset fields.

[0147] As shown in FIG2 , the preset first classification model includes: a character vector encoding sub-model 210, a word vector encoding sub-model 220, and a text classification sub-model 230

[0148] Among them, the character vector encoding sub-model can adopt the FastText encoding model, the word vector encoding sub-model can adopt the Word2Vec encoding model, and the text classification sub-model can adopt the TextCNN model.

[0149] Character vector encoding is a technique for mapping characters to continuous vector representations. Given the diversity, complexity, and massive nature of categorical data, this application embodiment employs FastText-based character vector encoding. This technique captures character-level information, helping to capture the internal structure of words, such as affixes and morphological changes, and understand the meaning and context of characters. Furthermore, FastText training is very fast, especially with good computational efficiency on large-scale corpora.

[0150] At the same time, word vector encoding technology can better handle rare and unregistered words (i.e., words that do not appear in the training data) and has better generalization capabilities. Because the FastText encoding model uses character-level information, it can more effectively handle low-frequency and unregistered words. This means that the FastText encoding model can generate reasonable vector representations for these words, while other word-level methods may not be able to do so. In real-world business, the text content involved is particularly broad, and there are also many low-frequency and unregistered words. Word vector encoding technology can effectively solve this problem.

[0151] In addition, FastText-based character vector encoding can support multiple languages. Since character-level representation is universal, the FastText encoding model can be easily applied to text representation in different languages, especially those with rich vocabulary structures.

[0152] In some embodiments of the present application, the FastText encoding model structure may include three parts: an input layer, a hidden layer, and an output layer. The input layer is a vector of words and N-GramFeature of words in the text. The hidden layer mainly averages the hidden layer vectors input by the input layer. The output layer directly outputs the encoded value of the input text as the first vector. Wherein, N represents the length of the original word segmentation. N can be customized. For example, N can be set to 3. The method for generating N-GramFeature of words can be found in the prior art and will not be repeated here.

[0153] In the application phase, in the aforementioned sub-step 3201 , the input question is input to the FastText encoding model, and the FastText encoding model outputs a first vector of the input question.

[0154] The above-mentioned word vector encoding based on the FastText encoding model still has some defects. For example, compared with word vectors, word vectors may be slightly less capable of capturing word semantic relationships.

[0155] Word2Vec word vector encoding is a technology that maps words to a semantic space and obtains semantic space vectors. The Word2Vec encoding model is usually implemented by means of neural networks. Considering the contextual relationship of the text, there are two models, CBOW and Skip-Gram. These two models are similar in the training process. The Skip-Gram model uses a word as input to predict the context around it, and the CBOW model uses the context of a word as input to predict the word itself. Skip-Gram has better training speed and processing effect for large data. This embodiment selects Skip-Gram to implement word vector representation in combination with actual business needs. The specific processing steps are as follows:

[0156] (1) Determine the window size window and generate 2window training samples for each word, (i,i-window), (i,i-window+1), ..., (i,i+window-1), (i,i+window), where i represents the window number.

[0157] (2) Determine the number of samples batch_size. Note that the size of batch_size must be an integer multiple of 2window to ensure that each batch of samples contains all samples corresponding to a vocabulary.

[0158] (3) There are two training algorithms: Hierarchical Softmax and NegativeSampling.

[0159] (4) The neural network is iterated for a certain number of times to obtain a parameter matrix from the input layer to the hidden layer. The transpose of each row in the matrix is ​​the word vector of the corresponding word.

[0160] In the application stage, in the aforementioned sub-step 3202, the input question is input into the pre-trained Word2Vec word vector encoding sub-model, and the word vector output by the Word2Vec word vector encoding sub-model is obtained as the second vector.

[0161] Next, in the aforementioned sub-step 3203, the first vector (ie, character vector) and the second vector (ie, word vector) may be concatenated to obtain a third vector.

[0162] Merging the word vectors (i.e., the aforementioned first vectors) output by the FastText model and the term vectors (i.e., the aforementioned second vectors) output by the Word2Vec model can provide richer semantic information. That is, the word vectors and word vectors capture semantic information at the word and character levels, respectively. Combining them helps provide richer semantic information, thereby improving the performance of natural language processing tasks. At the same time, after merging word vectors and term vectors, they can make up for their respective shortcomings. Specifically, word vectors perform poorly in processing unregistered words and low-frequency words, while word vectors are relatively weak in capturing word meaning relationships. Merging the word vectors and term vectors of the input question can make up for their respective shortcomings and provide a more accurate and comprehensive text representation.

[0163] For more complex classification tasks across multiple industry sub-fields, combining word vectors and character vectors can help improve model classification accuracy and enhance robustness. For example, a model that combines word vectors and character vectors is more robust when dealing with spelling errors, grammatical errors, or unregistered words, thereby improving the stability and reliability of classification tasks in practical applications. Furthermore, since there are many long-tail words in the training data, there is a long-tail problem (in text classification tasks, the long-tail problem refers to the fact that the number of samples in some categories is far smaller than that in other categories). Combining word vectors and character vectors can improve the model's ability to recognize these low-frequency words and rare categories, thereby improving the long-tail problem.

[0164] In summary, the combination of character vectors and word vectors can bring richer semantic information, better generalization ability and stronger robustness to text classification tasks, thereby improving the performance of classification tasks.

[0165] In some embodiments of the present application, the TextCNN model may include: an embedding layer, a convolutional layer, a pooling layer, and an output layer. The embedding layer is used to concatenate the word vectors output by the Word2Vec model with the word vectors output by the FastText model to obtain a third vector of the input question text.

[0166] The convolution layer of the TextCNN model is used to perform a convolution operation on the third vector, and the pooling layer is used to perform a pooling operation on the hidden layer vector output by the convolution layer. Finally, the output layer performs feature mapping on the hidden layer vector output by the pooling layer, and outputs the category label of the preset category and the classification prediction probability value corresponding to the category.

[0167] In the aforementioned sub-step 3204, the merged third vector is classified and mapped through the convolution layer, pooling layer and output layer of the TextCNN model to obtain the classification prediction probability value of each preset category matching the input problem. The classification prediction probability value of each preset category can be used as the second indicator value of the preset field corresponding to the corresponding category.

[0168] In order to make the scheme of classifying the input problem by the preset first classification model and obtaining the second indicator value of the input problem matching each of the fields clearer, the training process of the preset first classification model is explained below in conjunction with Figure 2.

[0169] The character vector encoding sub-model 210, word vector encoding sub-model 220, and text classification sub-model 230 used in the embodiments of the present application can be obtained by fine-tuning the training data used by the preset language processing models in each field. Based on a data set containing data from multiple fields, a preset first classification model is trained. The sample data for training the preset first classification model is the question text, and the sample label is the true value of the field category corresponding to the question text.

[0170] To give a specific example, first, the questions input by the user are classified and mapped to the corresponding industry fields. For example, for the user question "My eyes hurt, it seems that I have blepharitis, what should I do?", this question obviously belongs to the medical field and should be answered by the preset language processing model in the medical field. Therefore, it is necessary to process the QA (question and answer) dataset trained by the large medical model and use it as a classification dataset.

[0171] When working with medical QA datasets, the questions and answers must first be separated, each considered part of the training data. Before processing the data, preprocessing and cleaning are required, including but not limited to removing noise such as irrelevant information or distracting text, and removing insignificant content such as stop words and punctuation. The cleaned text can then be used as sample data, labeled with the corresponding medical sample label.

[0172] Similarly, for predefined fields such as law and education, corresponding data processing and preprocessing steps are also required to ultimately generate classification datasets for each field. For example, the sample labels of a classification dataset may include label values ​​corresponding to the medical, legal, and educational fields.

[0173] During the training process of the preset first classification model, for each training sample in the classification data set, the word vector encoding sub-model 210 is first used to encode the input question in the training sample into a word vector to obtain a first vector; the word vector encoding sub-model 220 is used to encode the input question in the training sample into a word vector to obtain a second vector; the first vector and the second vector are concatenated by the text classification sub-model 230 to obtain a third vector; then, text classification processing is performed based on the third vector to obtain the probability value of the input question in the training sample matching each preset field; then, the classification loss of the training sample is calculated based on the probability value and the sample label of the training sample. Then, based on the classification loss of all training samples, the loss value of the preset first classification model is calculated, and with the goal of minimizing the loss value, the model parameters are optimized and the preset first classification model is iteratively trained.

[0174] In the embodiment of the present application, there is no limitation on the loss function for calculating the loss value of the model.

[0175] The character vector encoding sub-model 210, word vector encoding sub-model 220, and text classification sub-model 230 used in the embodiments of the present application can adopt the model structure in the existing technology, and the loss function of the preset first classification model can adopt the existing technology.

[0176] Step 330: Determine the target domain that the input question matches based on the first indicator value and the second indicator value.

[0177] In some embodiments of the present application, the target domain for matching the input question is determined based on the first indicator value and the second indicator value, including: using a preset weight value to weightedly sum the first indicator value and the second indicator value to obtain a matching score corresponding to each preset domain; and determining the preset domain with the highest matching score as the target domain for matching the input question.

[0178] For example, the first index value obtained in the aforementioned step 310 and the second index value obtained in the aforementioned step 320 can be used to calculate the matching score score1 of the input question matching each preset field according to the preset weight value using the formula: score1 = α1 * first index value + β1 * second index value. The weight values ​​α1 and β1 are preset based on the number of keywords hit (i.e., the first index value) and the importance of the output result of the first classification model. For example, when the importance of the keyword is considered to be higher, α1 can be set to be greater than β1.

[0179] Finally, the comprehensive matching score score1 has the largest matching score, which means that the corresponding category is the target category for discrimination.

[0180] Step 340: Classify the input question using a preset second classification model corresponding to the target domain to obtain third indicator values ​​of whether the input question matches preset sub-domains of the target domain.

[0181] After determining the domain that the input question matches, further domain segmentation is performed. For example, after classifying the input question into the medical domain, the input question is further segmented to determine which sub-domain of the medical domain the input question belongs to.

[0182] Optionally, the input question is classified by a preset second classification model corresponding to the target domain to obtain a third indicator value of the input question matching the preset sub-domains of the target domain, including: character vector encoding of the input question to obtain a fourth vector; word vector encoding of the input question to obtain a fifth vector; fusing the fourth vector and the fifth vector to obtain a sixth vector; and performing text classification processing based on the sixth vector to obtain the third indicator value of the input question matching the preset sub-domains of the target domain.

[0183] Optionally, the structure of the preset second classification model is shown in Figure 2, including: a character vector encoding sub-model 210, a word vector encoding sub-model 220, and a text classification sub-model 230. The character vector encoding sub-model can adopt the FastText encoding model, the word vector encoding sub-model can adopt the Word2Vec encoding model, and the text classification sub-model can adopt the TextCNN model.

[0184] In the embodiments of the present application, for each preset domain, a sub-domain classification model for that domain, i.e., a preset second classification model, is pre-trained based on the data of that preset domain. Thus, during the application phase, after the input question undergoes preliminary domain classification and is classified into the target domain, the sub-domain classification model of the target domain, i.e., the preset second classification model trained based on the data of the target domain, can be used to further classify the input question into sub-domains within the target domain.

[0185] The training data for the preset second classification model comes from the sub-categorized knowledge base data within various industry fields, as well as data that has been fine-tuned from the training data for the preset second classification model. The process for processing this data can be referred to the specific method for processing the training data for the preset second classification model mentioned above, and will not be repeated here.

[0186] For example, we process knowledge text related to sub-fields within each field, such as knowledge in the legal field's sub-fields of medical disputes, contract disputes, and damages. This knowledge is then constructed into classification datasets for each sub-field within the legal field, and each training example is assigned a sub-field label within the legal field. For example, sub-field labels within the legal field include criminal cases, labor disputes, and contract disputes. We then implement classification of sub-fields within the legal field using a pre-configured second classification model based on the FastText+Word2Vec+TextCNN architecture.

[0187] The training method for presetting the second classification model refers to the training method for presetting the first classification model in the previous article, which will not be repeated here.

[0188] Correspondingly, the input question is classified by the preset second classification model corresponding to the target domain to obtain the third indicator value of the input question matching the preset sub-domains of the target domain, including: character vector encoding of the input question by the character vector encoding sub-model 210 to obtain a fourth vector; word vector encoding of the input question by the word vector encoding sub-model 220 to obtain a fifth vector; fusing the fourth vector and the fifth vector by the text classification sub-model 230 to obtain a sixth vector, and performing text classification processing based on the sixth vector to obtain the third indicator value of the input question matching the preset sub-domains of the target domain.

[0189] The specific implementation method of classifying the input question by the preset second classification model corresponding to the target field to obtain the third indicator value of the input question matching the preset sub-fields of the target field can be referred to the specific implementation method of classifying the input question by the preset first classification model to obtain the second indicator value of the input question matching each of the fields mentioned above, which will not be repeated here.

[0190] Step 350 : Classify the input question in the sub-field according to the third index value and the sub-field to which the hit keyword belongs, and obtain a field classification result of the input question.

[0191] Optionally, the input question is classified in the sub-field according to the third index value and the sub-field to which the hit keyword belongs, and the field classification result of the input question is obtained, including: obtaining the fourth index value of the keyword in each sub-field hit by the input question according to the sub-field to which the hit keyword belongs; using a preset weight value to perform weighted summation on the third index value and the fourth index value to obtain a matching score corresponding to each sub-field; and determining the classification result of the input question in the sub-field of the target field according to the matching score.

[0192] Next, based on the sub-field to which the keywords hit by the input question obtained in step 310 belong, the number of keywords hit by the input question in each sub-field is further determined as the fourth index value of the keywords hit by the input question in the sub-field. Then, the third index value and the fourth index value obtained in the aforementioned step 340 can be calculated according to the pre-set weight value using the formula: score2 = α2 * fourth index value + β2 * third index value to obtain the matching score score2 of each sub-field of the input question. Among them, the weight values ​​α2 and β2 are pre-set according to the number of keywords hit and the importance of the output results of the second classification model. For example, when the importance of the keywords is considered to be higher, α2 can be set to be greater than β2.

[0193] Finally, the comprehensive matching score score2 is used to determine the classification result of the input question in the sub-domain of the target domain. For example, the sub-domain corresponding to the maximum matching score can be selected as the target category for the input question to match.

[0194] The cross-domain problem processing method disclosed in the embodiment of the present application performs keyword matching on the input question based on the domain vocabulary of each preset domain to obtain a first index value of the input question hitting the keyword in each domain vocabulary, and the sub-domain to which the hit keyword belongs; classifies the input question through a preset first classification model to obtain a second index value of the input question matching each domain; determines the target domain matched by the input question based on the first index value and the second index value; classifies the input question through a preset second classification model corresponding to the target domain to obtain a third index value of the input question matching each preset sub-domain of the target domain; classifies the input question in the sub-domain based on the third index value and the sub-domain to which the hit keyword belongs to, and obtains the domain classification result of the input question, which can quickly perform cross-domain classification on the input question with high classification accuracy.

[0195] The present application also discloses a cross-domain problem processing device, as shown in FIG6 , comprising:

[0196] The question classification module 610 is used to classify the input question based on the preset domain vocabulary of each field and the pre-trained text classification model to obtain the domain classification result of the input question;

[0197] The question answering module 620 is configured to use the domain classification result and the input question as inputs to a preset language processing model, and obtain an answer corresponding to the input question through the preset language processing model.

[0198] Optionally, the text classification model includes: a preset first classification model and a preset second classification model, and the question classification module 610 is further used to:

[0199] Perform keyword matching on the input question based on the preset domain lexicon of each domain, and obtain a first index value of the input question hitting the keyword in each domain lexicon, as well as the sub-domain to which the hit keyword belongs;

[0200] Classify the input question using the preset first classification model to obtain a second indicator value of the input question matching each of the fields;

[0201] Determining a target domain matching the input question according to the first indicator value and the second indicator value;

[0202] Classifying the input question using the preset second classification model corresponding to the target domain to obtain third indicator values ​​of the input question matching preset sub-domains of the target domain;

[0203] The input question is classified in the sub-field according to the third index value and the sub-field to which the hit keyword belongs, and a field classification result of the input question is obtained.

[0204] Optionally, the classifying the input question by using the preset first classification model to obtain a second indicator value of the input question matching each of the fields includes:

[0205] Performing word vector encoding on the input question to obtain a first vector;

[0206] Performing word vector encoding on the input question to obtain a second vector;

[0207] fusing the first vector and the second vector to obtain a third vector;

[0208] Text classification processing is performed based on the third vector to obtain a second index value of the input question matching each preset field.

[0209] Optionally, the domain vocabulary is constructed by the following method:

[0210] For a target preset field, one or more of the following keyword extraction methods are used to obtain keywords for the target preset field: extracting a first keyword from a sample text based on a preset rule; extracting a long-tail keyword from the sample text as a second keyword by word concatenation; clustering subwords of the preset long-tail keyword to obtain a target subword as a third keyword;

[0211] A domain vocabulary of the target preset domain is constructed based on one or more keywords among the first keyword, the second keyword and the third keyword.

[0212] Optionally, extracting long-tail keywords from the sample text as second keywords by word concatenation includes:

[0213] Divide the sample text into sentences according to preset symbols and text length to obtain sentences to be processed;

[0214] Performing word segmentation processing on the obtained sentence to be processed to obtain candidate word segmentations;

[0215] Screening and part-of-speech tagging the candidate participles to obtain target candidate participles with preset parts of speech;

[0216] According to the target candidate segmentation words, noun phrases are obtained by splicing as candidate long-tail keywords;

[0217] Obtaining the importance score of the candidate long-tail keyword;

[0218] According to the importance score, the candidate long-tail keyword is selected as the second keyword.

[0219] Optionally, determining the target domain that the input question matches based on the first indicator value and the second indicator value includes:

[0220] Using a preset weight value to perform a weighted summation on the first indicator value and the second indicator value to obtain a matching score corresponding to each preset field;

[0221] The preset domain with the highest matching score is determined as the target domain for matching the input question.

[0222] The cross-domain problem processing device disclosed in the embodiment of the present application is used to implement the cross-domain problem processing method described in the embodiment of the present application. The specific implementation methods of each module of the device will not be repeated here. Please refer to the specific implementation methods of the corresponding steps in the method embodiment.

[0223] The cross-domain problem processing device disclosed in the embodiment of the present application performs problem classification processing on the input question based on the preset domain vocabulary of each domain and a pre-trained text classification model to obtain the domain classification result of the input question; then, the domain classification result and the input question are used as the input of the preset language processing model, and the answer corresponding to the input question is obtained through the preset language processing model, which can effectively improve the accuracy of the question and answer of the preset language processing model.

[0224] The present embodiment introduces an efficient text classification model to accurately categorize user-entered questions. This classification process not only categorizes questions into different categories, but more importantly, provides strong support for further processing in the large-scale model. By accurately classifying questions and calling the corresponding modules in the large-scale model based on the classification results, accuracy is improved in the question-answering environment.

[0225] In the embodiments of this application, the text classification model serves to enhance the accuracy of question-answering in the large-scale model. By finely categorizing questions, the large-scale model can more effectively focus on specific problem areas, thereby improving overall question-answering accuracy. The introduction of text classification technology provides key support for the optimization of large-scale models and lays a solid foundation for solving practical question-answering problems.

[0226] Furthermore, when performing text classification, the input question is matched with keywords based on the preset domain vocabulary of each field to obtain a first index value of the input question hitting the keywords in each of the domain vocabulary, as well as the sub-field to which the hit keywords belong; the input question is classified by a preset first classification model to obtain a second index value of the input question matching each of the fields; based on the first index value and the second index value, the target field matched by the input question is determined; the input question is classified by a preset second classification model corresponding to the target field to obtain a third index value of the input question matching each of the preset sub-fields of the target field; based on the third index value and the sub-field to which the hit keywords belong, the input question is classified in the sub-field to obtain the field classification result of the input question, which can quickly perform cross-field classification on the input question with high classification accuracy.

[0227] The present application also discloses a cross-domain problem processing device, as shown in FIG7 , comprising:

[0228] The keyword matching module 710 is configured to perform keyword matching on the input question based on the domain vocabulary of each domain, and obtain a first index value of the input question matching the keywords in each domain vocabulary, as well as the sub-domain to which the hit keywords belong;

[0229] A first classification module 720 is configured to classify the input question using a preset first classification model to obtain a second indicator value of the input question matching each of the fields;

[0230] A first classification result determination module 730 is configured to determine a target domain that the input question matches based on the first indicator value and the second indicator value;

[0231] A second classification module 740 is configured to classify the input question using a preset second classification model corresponding to the target domain, and obtain a third indicator value of the input question matching each preset sub-domain of the target domain;

[0232] The classification result acquisition module 750 is configured to classify the input question into the sub-field according to the third indicator value and the sub-field to which the hit keyword belongs, and obtain a field classification result of the input question.

[0233] Optionally, the first classification module 720 is further configured to:

[0234] Performing word vector encoding on the input question to obtain a first vector;

[0235] Performing word vector encoding on the input question to obtain a second vector;

[0236] fusing the first vector and the second vector to obtain a third vector;

[0237] Text classification processing is performed based on the third vector to obtain a second index value of the input question matching each preset field.

[0238] Optionally, the domain vocabulary is constructed by the following method:

[0239] For a target preset field, one or more of the following keyword extraction methods are used to obtain keywords for the target preset field: extracting a first keyword from a sample text based on a preset rule; extracting a long-tail keyword from the sample text as a second keyword by word concatenation; clustering subwords of the preset long-tail keyword to obtain a target subword as a third keyword;

[0240] A domain vocabulary of the target preset domain is constructed based on one or more keywords among the first keyword, the second keyword and the third keyword.

[0241] Optionally, extracting long-tail keywords from the sample text as second keywords by word concatenation includes:

[0242] Divide the sample text into sentences according to preset symbols and text length to obtain sentences to be processed;

[0243] Performing word segmentation processing on the obtained sentence to be processed to obtain candidate word segmentations;

[0244] Screening and part-of-speech tagging the candidate participles to obtain target candidate participles with preset parts of speech;

[0245] According to the target candidate segmentation words, noun phrases are obtained by splicing as candidate long-tail keywords;

[0246] Obtaining the importance score of the candidate long-tail keyword;

[0247] According to the importance score, the candidate long-tail keyword is selected as the second keyword.

[0248] Optionally, the first classification result determination module 730 is further configured to:

[0249] Using a preset weight value to perform a weighted summation on the first indicator value and the second indicator value to obtain a matching score corresponding to each preset field;

[0250] The preset domain with the highest matching score is determined as the target domain for matching the input question.

[0251] The cross-domain problem processing device disclosed in the embodiment of the present application is used to implement the cross-domain problem processing method described in the embodiment of the present application. The specific implementation methods of each module of the device will not be repeated here. Please refer to the specific implementation methods of the corresponding steps in the method embodiment.

[0252] The cross-domain problem processing device disclosed in the embodiment of the present application performs keyword matching on the input question based on the domain vocabulary of each preset domain to obtain a first index value of the input question hitting the keyword in each domain vocabulary, and the sub-domain to which the hit keyword belongs; classifies the input question through a preset first classification model to obtain a second index value of the input question matching each domain; determines the target domain matched by the input question based on the first index value and the second index value; classifies the input question through a preset second classification model corresponding to the target domain to obtain a third index value of the input question matching each preset sub-domain of the target domain; classifies the input question in the sub-domain based on the third index value and the sub-domain to which the hit keyword belongs to, and obtains the domain classification result of the input question, which can quickly perform cross-domain classification on the input question with high classification accuracy.

[0253] Each embodiment in this specification is described in a progressive manner, with each embodiment focusing on the differences from other embodiments. Similar or identical parts between the various embodiments can be referred to in conjunction with each other. For the device embodiments, since they are generally similar to the method embodiments, their description is relatively simple, and for relevant parts, reference can be made to the description of the method embodiments.

[0254] The above is a detailed introduction to a cross-domain problem-solving method and device provided by the present application. Specific examples are used in this article to illustrate the principles and implementation methods of the present application. The description of the above embodiments is only used to help understand the method of the present application and its core idea; at the same time, for general technical personnel in this field, based on the ideas of the present application, there will be changes in the specific implementation methods and application scope. In summary, the content of this specification should not be understood as a limitation on the present application.

[0255] The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate, and the components shown as units may or may not be physical units, i.e., they may be located in one location or distributed across multiple network units. Some or all of the modules may be selected based on actual needs to achieve the objectives of the present embodiment. Persons of ordinary skill in the art will be able to understand and implement the present invention without inventive effort.

[0256] The various component embodiments of the present application can be implemented in hardware, or in software modules running on one or more processors, or in a combination thereof. It will be appreciated by those skilled in the art that a microprocessor or digital signal processor (DSP) can be used in practice to implement some or all of the functions of some or all of the components in the electronic device according to the embodiment of the present application. The application can also be implemented as a device or apparatus program (for example, a computer program and a computer program product) for performing a part or all of the methods described herein. Such a program implementing the present application can be stored on a computer-readable medium, or can have the form of one or more signals. Such a signal can be downloaded from an Internet website, or provided on a carrier signal, or provided in any other form.

[0257] For example, FIG8 illustrates an electronic device that can implement the methods according to the present application. The electronic device can be a PC, a mobile terminal, a personal digital assistant, a tablet computer, or the like. The electronic device conventionally includes a processor 810, a memory 820, and a program code 830 stored on the memory 820 and executable on the processor 810. When the processor 810 executes the program code 830, the methods described in the above embodiments are implemented. The memory 820 can be a computer program product or a computer-readable medium. The memory 820 can be an electronic memory such as a flash memory, an EEPROM (Electrically Erasable Programmable Read-Only Memory), an EPROM, a hard disk, or a ROM. The memory 820 has a storage space 8201 for program code 830 of a computer program for executing any of the method steps described above. For example, the storage space 8201 for program code 830 can include individual computer programs for implementing various steps in the above methods. The program code 830 is computer-readable code. These computer programs can be read from or written into one or more computer program products. These computer program products include program code carriers such as hard disks, compact disks (CDs), memory cards or floppy disks. The computer program includes computer readable code that, when run on an electronic device, causes the electronic device to perform the method according to the above embodiments.

[0258] The embodiment of the present application further discloses a computer-readable storage medium having a computer program stored thereon. When the program is executed by a processor, the steps of the cross-domain problem processing method as described in the embodiment of the present application are implemented.

[0259] Such a computer program product may be a computer-readable storage medium having a storage segment, storage space, etc. arranged similarly to the memory 820 in the electronic device shown in FIG8 . The program code may be compressed, for example, in an appropriate form and stored in the computer-readable storage medium. The computer-readable storage medium is typically a portable or fixed storage unit as described with reference to FIG9 . Typically, the storage unit includes computer-readable code 830 ′, which is code read by a processor. When the code is executed by the processor, the various steps in the method described above are implemented.

[0260] References herein to "one embodiment," "an embodiment," or "one or more embodiments" mean that a particular feature, structure, or characteristic described in connection with the embodiment is included in at least one embodiment of the present application. Furthermore, please note that instances of the phrase "in one embodiment" do not necessarily all refer to the same embodiment.

[0261] In the description provided herein, a large number of specific details are described. However, it is understood that the embodiments of the present application can be practiced without these specific details. In some instances, well-known methods, structures, and techniques are not shown in detail so as not to obscure the understanding of this description.

[0262] In the claims, any reference signs placed between brackets shall not be construed as limiting the claim. The word "comprising" does not exclude the presence of elements or steps not listed in the claim. The word "a" or "an" preceding an element does not exclude the presence of a plurality of such elements. The present application may be implemented by means of hardware comprising several different elements and by means of a suitably programmed computer. In a unit claim enumerating several means, several of these means may be embodied by one and the same item of hardware. The use of the words first, second, and third etc. does not indicate any order. These words may be interpreted as names.

[0263] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present application.

Claims

1. A cross-domain problem processing method, characterized in that: The method comprises: Based on the preset domain vocabulary of each field and the pre-trained text classification model, the input question is classified and processed to obtain the domain classification result of the input question; The domain classification result and the input question are used as inputs of a preset language processing model, and an answer corresponding to the input question is obtained through the preset language processing model.

2. The method according to claim 1, characterized in that The text classification model includes: a preset first classification model and a preset second classification model. The text classification model based on the preset domain vocabulary of each domain and the pre-trained text classification model performs question classification processing on the input question to obtain the domain classification result of the input question, including: Perform keyword matching on the input question based on the preset domain vocabulary of each domain, and obtain the first index value of the input question hitting the keywords in each domain vocabulary, and the sub-domain to which the hit keywords belong; Classify the input question by using the preset first classification model to obtain a second indicator value of the input question matching each of the fields; Determining a target domain that matches the input question according to the first index value and the second index value; Classify the input question by using the preset second classification model corresponding to the target field to obtain a third indicator value of the input question matching each preset sub-field of the target field; The input question is classified in the sub-field according to the third index value and the sub-field to which the hit keyword belongs, and a field classification result of the input question is obtained.

3. A cross-domain problem processing method, characterized in that: The method comprises: Perform keyword matching on the input question based on the preset domain vocabulary of each domain, and obtain the first index value of the input question hitting the keywords in each domain vocabulary, and the sub-domain to which the hit keywords belong; Classify the input question by using a preset first classification model to obtain a second indicator value of the input question matching each of the fields; Determining a target domain that matches the input question according to the first index value and the second index value; Classify the input question by using a preset second classification model corresponding to the target field, and obtain a third indicator value of the input question matching each preset sub-field of the target field; The input question is classified in the sub-field according to the third index value and the sub-field to which the hit keyword belongs, and a field classification result of the input question is obtained.

4. The method according to claim 3, characterized in that The step of classifying the input question by using a preset first classification model to obtain a second indicator value of the input question matching each of the fields includes: Performing word vector encoding on the input question to obtain a first vector; Performing word vector encoding on the input question to obtain a second vector; Merging the first vector and the second vector to obtain a third vector; Text classification processing is performed based on the third vector to obtain a second index value of the input question matching each preset field.

5. The method according to claim 3, characterized in that: The domain vocabulary is constructed by the following method: For a target preset field, one or more of the following keyword extraction methods are used to obtain keywords for the target preset field: extracting a first keyword from a sample text based on a preset rule; extracting a long-tail keyword from the sample text as a second keyword by word concatenation; Cluster the subwords of the preset long-tail keyword and obtain the target subword as the third keyword; A domain vocabulary of the target preset domain is constructed according to one or more keywords among the first keyword, the second keyword and the third keyword.

6. The method according to claim 5, characterized in that The method of extracting long-tail keywords from the sample text as the second keywords by word concatenation includes: According to the preset symbols and text length, the sample text is divided into sentences to obtain sentences to be processed; Performing word segmentation processing on the obtained sentence to be processed to obtain candidate word segmentations; Screening and part-of-speech tagging the candidate participles to obtain target candidate participles with preset part-of-speech; According to the target candidate segmentations, a noun phrase is concatenated to be a candidate long-tail keyword; Obtaining the importance score of the candidate long-tail keyword; According to the importance score, the candidate long-tail keyword is selected as the second keyword.

7. The method according to claim 3, characterized in that The step of determining a target domain that matches the input question according to the first index value and the second index value includes: Using a preset weight value to perform a weighted summation on the first indicator value and the second indicator value to obtain a matching score corresponding to each preset field; The preset domain with the highest matching score is determined as the target domain for matching the input question.

8. A cross-domain problem processing device, characterized in that: The device comprises: A question classification module is used to classify input questions based on preset domain lexicons of various fields and pre-trained text classification models, and obtain domain classification results of the input questions; The question answering module is used to use the field classification result and the input question as inputs of a preset language processing model, and obtain an answer corresponding to the input question through the preset language processing model.

9. A cross-domain problem processing device, characterized in that: The device comprises: A keyword matching module, used to perform keyword matching on the input question based on the domain vocabulary of each domain preset, and obtain a first index value of the input question hitting the keyword in each domain vocabulary, and the sub-domain to which the hit keyword belongs; A first classification module, used to classify the input question by using a preset first classification model to obtain a second indicator value of the input question matching each of the fields; A first classification result determination module, used for determining a target field that the input question matches according to the first index value and the second index value; A second classification module is used to classify the input question by using a preset second classification model corresponding to the target field, and obtain a third indicator value of the input question matching each preset sub-field of the target field; The classification result acquisition module is used to classify the input question in the sub-field according to the third indicator value and the sub-field to which the hit keyword belongs, and obtain the field classification result of the input question.

10. An electronic device comprising a memory, a processor, and a program code stored in the memory and executable on the processor, characterized in that: When the processor executes the program code, the cross-domain problem processing method described in any one of claims 1 to 7 is implemented.

11. A computer-readable storage medium having a program code stored thereon, characterized in that: When the program code is executed by a processor, the steps of the cross-domain problem processing method described in any one of claims 1 to 7 are implemented.

Citation Information

Patent Citations

  • Generation method and device for answers of natural language questions and server

    CN108446286A

  • Futures question and answer-oriented user intention identification method and system

    CN114218392A

  • Cloud ERP community cross-domain problem classification method based on BERT-TextCNN

    CN115062145A

  • Cross-domain problem processing method and device, electronic equipment and storage medium

    CN116842168A

  • System and method for dynamically creating a domain ontology

    US20180189284A1

Cited By

  • Data encryption processing method and device for medical question and answer large model and medium

    CN120910883A

  • Information management method based on intelligent classification and efficient retrieval

    WO2026188779A1