Natural language instruction control method and system, storage medium and equipment
Through word segmentation technology and a locally constructed multi-layer neural network model, the problem of large language models being large in size, high cost and poor flexibility in human-computer interaction is solved, and efficient and flexible human-computer interaction and personalized adaptation are achieved, which is suitable for natural language instruction control in vertical business fields.
Patent Information
- Application Number
- CN202411823190.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-11
- Publication Date
- 2025-04-15
AI Technical Summary
The existing large language model has problems such as large size, high cost, inability to identify vocabulary in specific business fields, fixed architecture and inflexible architecture in human-computer interaction, which is difficult to meet the personalized needs of enterprises.
Through word segmentation technology and natural language processing, natural language text is split into keywords, and a multi-layer neural network is built locally to train intelligent response language model, realizing the conversion of natural language to business operation instructions, and using a custom dictionary library and intelligent reply module for personalized adaptation.
It realizes efficient and flexible human-computer interaction, reduces deployment costs, supports rapid expansion and personalized adaptation of business systems, and improves the system's response accuracy and flexibility.
Smart Images

Figure CN119829733A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of natural language processing, and in particular to a natural language instruction control method, system, storage medium and device. Background Art
[0002] With the rapid development of artificial intelligence technology, natural language processing (NLP), as one of its core areas, is gradually penetrating into all aspects of life, especially in the field of human-computer interaction, showing great potential. Traditional human-computer interaction often relies on preset command sets or graphical user interfaces, which limits the user's freedom of expression and the flexibility of the system. Therefore, it is crucial to explore how to enable computer systems to understand and execute instructions in human natural language.
[0003] The large language model combined with the AI Agent technology can achieve the same function, but there are the following shortcomings in the actual production environment. First of all, the large language models currently on the market are relatively large in size, generally occupying more than several GB of space, with relatively high costs, and need to be deployed independently, and cannot be integrated with the business system. Secondly, the general large speech model may not be able to recognize vocabulary in specific business fields during word segmentation retrieval. As a result, it is impossible to accurately convert instructions and it is difficult to meet the personalized needs of enterprises. Furthermore, the architecture of the intelligent agent application is relatively fixed and can only be deployed independently. At the same time, if the business changes or expands, the original trained model may not be able to adapt, and can only be re-fine-tuned to meet the business changes, which is not flexible enough. Summary of the invention
[0004] In response to the deficiencies in the prior art, the present application provides a natural language instruction control method, system, storage medium and device, which utilizes word segmentation technology and natural language processing (NLP) technology to split natural language text into instructions and data and then call the business system API to achieve a natural and efficient human-computer interaction mode.
[0005] This application is implemented through the following technical solutions:
[0006] A natural language instruction control method, comprising:
[0007] S1, matching the natural language text to be converted with the predefined dictionary library using word segmentation technology, and determining the keywords corresponding to the natural language text according to the matching results;
[0008] S2, build and train the intelligent response language model locally based on machine learning technology and multi-layer neural network;
[0009] S3. Convert the keywords corresponding to the natural language text, output the corresponding business operation instructions, perform business control through the business operation instructions, and use the intelligent response language model to feedback the business operation results.
[0010] In some embodiments, determining the keyword corresponding to the natural language text according to the matching result further includes:
[0011] The longest matching word with the natural language text is retrieved from a large-scale dictionary library and a user-defined dictionary library and segmented into N independent words, and then keywords are retrieved from the N independent words obtained by segmentation, where N>1.
[0012] In some embodiments, the locally constructing and training the intelligent response language model based on machine learning technology and a multi-layer neural network further includes:
[0013] A three-layer fully connected neural network is constructed, and the collected question sets and answer sets are converted into vector matrices using ONE-HOT encoding. The vector matrices are then passed into the neural network. After multiple rounds of training, a question-answering model is obtained. When the input data passes through the network, a double-type digital result is obtained, which represents the matching degree between the input data and the questions in the training set. When it exceeds the predefined threshold, it means that the question is matched with the training set, and the answer corresponding to the question is determined.
[0014] In some embodiments, converting the keywords corresponding to the natural language text and outputting the corresponding business operation instructions further includes:
[0015] Based on the word segmentation results obtained, including the words and parts of speech of the keywords, verbs, place names and nouns are screened out, the operations to be performed by the natural language are calculated, the operations are converted into http requests, and the business system API is called to complete the execution of the instructions.
[0016] The present application also provides a natural language instruction control system for implementing the aforementioned method, the system comprising:
[0017] A keyword extraction module is used to match the natural language text to be converted with the predefined dictionary library using word segmentation technology, and determine the keywords corresponding to the natural language text according to the matching results;
[0018] Smart reply module, which is used to build and train smart reply language models locally based on machine learning technology and multi-layer neural networks;
[0019] The instruction conversion module is used to convert the keywords corresponding to the natural language text, output the corresponding business operation instructions, perform business control through the business operation instructions, and use the intelligent response language model to feedback the business operation results.
[0020] In some embodiments, the keyword extraction module is further used to:
[0021] The longest matching word with the natural language text is retrieved from a large-scale dictionary library and a user-defined dictionary library and segmented into N independent words, and then keywords are retrieved from the N independent words obtained by segmentation, where N>1.
[0022] In some embodiments, the intelligent reply module is further used to:
[0023] A three-layer fully connected neural network is constructed, and the collected question sets and answer sets are converted into vector matrices using ONE-HOT encoding. The vector matrices are then passed into the neural network. After multiple rounds of training, a question-answering model is obtained. When the input data passes through the network, a double-type digital result is obtained, which represents the matching degree between the input data and the questions in the training set. When it exceeds the predefined threshold, it means that the question is matched with the training set, and the answer corresponding to the question is determined.
[0024] In some embodiments, the instruction conversion module is further used to:
[0025] Based on the word segmentation results obtained, including the words and parts of speech of the keywords, verbs, place names and nouns are screened out, the operations to be performed by the natural language are calculated, the operations are converted into http requests, and the business system API is called to complete the execution of the instructions.
[0026] The present application also provides a computer-readable storage medium storing one or more programs, which, when executed, can implement the aforementioned natural language instruction control method.
[0027] The present application also provides a device, comprising a processor, a communication interface, a computer-readable storage medium, and a communication bus; wherein the processor, the communication interface, and the computer-readable storage medium communicate with each other via the communication bus;
[0028] The processor is configured to execute a program stored in a computer-readable storage medium.
[0029] Compared with the prior art, this application has the following advantages:
[0030] No independent deployment is required, no reliance on third-party language models, and no network overhead. Developed in Java, the business system can rely on this device very conveniently. At the same time, since the model training files of the custom dictionary library and the smart reply module are all inside the device, secondary development and expansion can be carried out quickly, which is easy to maintain and upgrade. The model training files and logic of the custom dictionary library and the smart reply module are separate and independent. According to the expansion or changes of the business, the model can be retrained and the custom dictionary library can be configured at any time to achieve personalized adaptation and enhance practicality.
[0031] Other features and advantages of the present application will be described in the following description, and partly become apparent from the description, or be understood by practicing the present application. The purpose and other advantages of the present application can be realized and obtained by the structures indicated in the description, claims and drawings. BRIEF DESCRIPTION OF THE DRAWINGS
[0032] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0033] Figure 1 The overall flow chart of the application for calling the business interface process through natural language is shown.
[0034] Figure 2 A flow chart from natural language to instruction execution of the present application is shown.
[0035] Figure 3 A schematic diagram showing the sentence form of the present application after being split by a word segmenter is shown.
[0036] Figure 4 A schematic diagram of the question set vector matrix after one-hot numbering in this application is shown.
[0037] Figure 5 It is a structural schematic diagram of a device according to an embodiment of the present application. DETAILED DESCRIPTION
[0038] In order to make the purpose, technical solution and advantages of the embodiments of the present application clearer, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0039] This application involves the application of natural language in vertical business fields. By building an independent multi-layer neural network, a small language question-answering model is obtained based on a small amount of corpus (relative to large models) training. It does not require independent deployment, does not rely on third-party language models, and does not have network overhead. It can be used as a module of a business system or published as an independent component to provide dependencies.
[0040] See also Figure 1 , the method of the present application comprises:
[0041] S1. Match the natural language text to be converted with a predefined dictionary library using word segmentation technology, and determine keywords corresponding to the natural language text according to the matching results.
[0042] First, keyword extraction is performed. Using word segmentation technology, based on a large-scale dictionary library and a user-defined dictionary library, the input natural language text is matched with the words in the dictionary library, the longest matching word is retrieved and N independent words are segmented, and then keywords are retrieved from the N independent words obtained by segmentation, where N>1. The user-defined dictionary library is configured to solve the problem that the large-scale dictionary library cannot recognize certain professional terms and nouns. Word segmentation technology is a basic and key technology in natural language processing (NLP), which directly affects the accuracy of the subsequent intelligent reply module and instruction conversion module response.
[0043] In a preferred embodiment, N shortest segmentation words (NShortSegment) and custom dictionary segmentation words are used simultaneously to split the natural language (NL) into N words ( Figure 3 As shown). The prerequisite is to load a comprehensive dictionary library, such as the open source modern Chinese dictionary library (open source corpus), and also need to customize the personalized dictionary library. The dictionary library exists in the form of a txt file, each line represents a word, and the format conforms to `[word][part of speech A], such as: 'Beijing NS', NS represents the part of speech, representing the place name.
[0044] S2. Build and train the intelligent response language model locally based on machine learning technology and multi-layer neural networks.
[0045] Based on machine learning technology, by designing a multi-layer neural network and combining training data sets and test data sets, an intelligent response language model is constructed to realize simple communication and dialogue functions. This model is built based on localized training and is small in scale. It is only used to recognize and process semantic text in vertical business fields.
[0046] First, a three-layer fully connected (DenseLayer) neural network is constructed, and the collected question sets and answer sets are converted into vector matrices (such as Figure 4The width of the matrix is the set of characters (non-repeated) in the question set and the answer set, and the height is the number of question sets. The vector matrix is then passed into the neural network, and a question-answering model is obtained after multiple rounds of training. When the input data passes through the network, a double-type digital result is obtained, which represents the matching degree between the input data and the questions in the training set. When it exceeds the predefined threshold, it means that the question in the training set is matched, and the answer corresponding to the question is determined.
[0047] S3. Convert the keywords corresponding to the natural language text, output the corresponding business operation instructions, perform business control through the business operation instructions, and use the intelligent response language model to feedback the business operation results.
[0048] Based on the keywords extracted by splitting, they are translated into specific business operation instructions. In a specific embodiment, verbs (v), place names (ns) and nouns (n) are screened out according to the segmentation results (words and parts of speech), and the operations to be performed in the natural language (NL) are calculated. The operations are converted into HTTP requests, and the business system API is called to complete the execution of the instructions.
[0049] For example, if a user enters the text: "Please help me check flights from Beijing to Shanghai tomorrow", the keywords "query", "flight", "tomorrow", "Beijing", and "Shanghai" are extracted, and this module will convert it into an operation instruction: {api: / flightquery, param: {date:yyyy-MM-dd, departure:pek, arrival:sha}}. Then the flight query interface of the business system is called to complete the business operation process.
[0050] In a specific example, the entire business process is as follows Figure 2 As shown:
[0051] Step 1: When the project is first started, train and export a multi-layer neural network intelligent response model based on the prepared training data and test data. Subsequent project starts only require loading the model for direct use.
[0052] Step 2: Load the general dictionary and custom dictionary. The general dictionary contains a corpus of various words that we can use in daily life, which is marked with parts of speech, such as place names, city names, names of people, etc. The custom dictionary is a supplement to the general dictionary, which contains various professional terms or terms that are not included in the general dictionary, which helps to improve the accuracy of keyword matching.
[0053] Step 3: Use word segmentation technology to split the input text into phrases, nouns, verbs, prepositions, etc. Then filter out keywords such as verbs, prepositions, city names, etc. based on the part of speech.
[0054] Step 4: Based on the extracted keywords, calculate the specific business interface that needs to be called, extract the interface parameters, and then execute the remote call; if the information provided by the input text is insufficient or not enough key information is extracted, a natural language response is given through the intelligent reply module.
[0055] Step 5: After translating the natural language into operation instructions, convert the instructions into the message data required for the network request, and then call the business interface.
[0056] Step 6: Based on the result of instruction extraction or the result of business interface call, the intelligent reply module calculates the answer through the pre-trained neural network model.
[0057] Another aspect of the present application provides a natural language command control system, including an intelligent reply module, a keyword extraction module and a command conversion module.
[0058] The keyword extraction module is used to match the natural language text to be converted with the predefined dictionary library using word segmentation technology, and determine the keywords corresponding to the natural language text according to the matching results;
[0059] The intelligent reply module is used to locally build and train an intelligent response language model based on machine learning technology and a multi-layer neural network;
[0060] The instruction conversion module is used to convert keywords corresponding to the natural language text, output corresponding business operation instructions, perform business control through the business operation instructions, and use the intelligent response language model to feedback business operation results.
[0061] It can be seen that the natural language command control method proposed in this application has the following advantages compared with the related technologies:
[0062] No independent deployment is required, no reliance on third-party language models, and no network overhead. Developed in Java, the business system can rely on this device very conveniently. At the same time, since the model training files of the custom dictionary library and the smart reply module are all inside the device, secondary development and expansion can be carried out quickly, which is easy to maintain and upgrade. The model training files and logic of the custom dictionary library and the smart reply module are separate and independent. According to the expansion or changes of the business, the model can be retrained and the custom dictionary library can be configured at any time to achieve personalized adaptation and enhance practicality.
[0063] Based on the same inventive concept, the present application also provides a computer-readable storage medium storing one or more programs, which, when executed, can implement the aforementioned natural language instruction control method.
[0064] like Figure 5 As shown, the embodiment of the present application further provides a device, including a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory communicate with each other via the communication bus.
[0065] The memory is a computer-readable storage medium for storing one or more programs.
[0066] The processor is used to execute the program stored in the computer-readable storage medium.
[0067] The computer-readable storage medium may be included in the device / apparatus described in the above embodiments; or may exist independently without being assembled into the device / apparatus.
[0068] Although the present application has been described in detail with reference to the aforementioned embodiments, a person of ordinary skill in the art should understand that it is still possible to modify the technical solutions described in the aforementioned embodiments, or to make equivalent replacements for some of the technical features therein; and these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present application.
Claims
1. A natural language command control method, characterized in that: include: S1, matching the natural language text to be converted with a predefined dictionary library using word segmentation technology, and determining keywords corresponding to the natural language text according to the matching results; S2: Build and train the intelligent response language model locally based on machine learning technology and multi-layer neural network; S3. Convert the keywords corresponding to the natural language text, output the corresponding business operation instructions, perform business control through the business operation instructions, and use the intelligent response language model to feedback the business operation results.
2. The method according to claim 1, characterized in that The step of determining the keywords corresponding to the natural language text according to the matching results further includes: The longest matching word with the natural language text is retrieved from a large-scale dictionary library and a user-defined dictionary library and segmented into N independent words, and then keywords are retrieved from the N independent words obtained by segmentation, where N>1.
3. The method according to claim 1, characterized in that The method of constructing and training the intelligent response language model locally based on machine learning technology and a multi-layer neural network further includes: A three-layer fully connected neural network is constructed, and the collected question sets and answer sets are converted into vector matrices using ONE-HOT encoding. The vector matrices are then passed into the neural network. After multiple rounds of training, a question-answering model is obtained. When the input data passes through the network, a double-type digital result is obtained, which represents the matching degree between the input data and the questions in the training set. When it exceeds the predefined threshold, it means that the question is matched with the training set, and the answer corresponding to the question is determined.
4. The method according to claim 1, characterized in that: The converting the keywords corresponding to the natural language text and outputting the corresponding business operation instructions further includes: Based on the word segmentation results obtained, including the words and parts of speech of the keywords, verbs, place names and nouns are screened out, the operations to be performed by the natural language are calculated, the operations are converted into http requests, and the business system API is called to complete the execution of the instructions.
5. A natural language command control system, characterized in that: The system comprises: A keyword extraction module is used to match the natural language text to be converted with the predefined dictionary library using word segmentation technology, and determine the keywords corresponding to the natural language text according to the matching results; Smart reply module, which is used to build and train smart reply language models locally based on machine learning technology and multi-layer neural networks; The instruction conversion module is used to convert the keywords corresponding to the natural language text, output the corresponding business operation instructions, perform business control through the business operation instructions, and use the intelligent response language model to feedback the business operation results.
6. The system according to claim 5, characterized in that The keyword extraction module is further used for: The longest matching word with the natural language text is retrieved from a large-scale dictionary library and a user-defined dictionary library and segmented into N independent words, and then keywords are retrieved from the N independent words obtained by segmentation, where N>1.
7. The system according to claim 5, characterized in that The intelligent reply module is further used for: A three-layer fully connected neural network is constructed, and the collected question sets and answer sets are converted into vector matrices using ONE-HOT encoding. The vector matrices are then passed into the neural network. After multiple rounds of training, a question-answering model is obtained. When the input data passes through the network, a double-type digital result is obtained, which represents the matching degree between the input data and the questions in the training set. When it exceeds the predefined threshold, it means that the question is matched with the training set, and the answer corresponding to the question is determined.
8. The system according to claim 5, characterized in that The instruction conversion module is further used for: Based on the word segmentation results obtained, including the words and parts of speech of the keywords, verbs, place names and nouns are screened out, the operations to be performed by the natural language are calculated, the operations are converted into http requests, and the business system API is called to complete the execution of the instructions.
9. A computer-readable storage medium storing one or more programs, characterized in that: When the one or more programs are executed, the natural language instruction control method described in any one of claims 1 to 4 can be implemented.
10. A device comprising a processor, a communication interface, the computer-readable storage medium of claim 9, and a communication bus; wherein: The processor, the communication interface, and the computer-readable storage medium communicate with each other via a communication bus; It is characterized in that The processor is configured to execute a program stored in a computer-readable storage medium.