Method for intelligently identifying user input and querying document template in case
Through BERT model training and hyperparameter optimization, the problem of template retrieval relying on user keywords in existing technologies has been solved, and efficient and accurate document template matching and real-time updates have been achieved, improving user experience and performance.
Patent Information
- Application Number
- CN202510809308.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-06-17
- Publication Date
- 2025-09-23
AI Technical Summary
Existing technologies rely on keywords entered by users in template retrieval and are unable to implement semantic search, resulting in a poor search experience and low performance, and are unable to quickly and accurately return the template information required by users.
By collecting and preprocessing document template data, using the BERT model for training and fine-tuning, combining hyperparameter optimization and adversarial training, generating word vectors and performing document template matching, we can intelligently identify user intent and query document templates.
It achieves efficient and accurate identification of user intent, rapid template matching, improved operational efficiency and accuracy, and can synchronously update the template library at any time to ensure real-time performance.
Smart Images

Figure CN120688467A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of data processing technology, and in particular to a method for intelligently identifying user input and querying document templates in a case. Background Art
[0002] With the continuous development of computer technology, a large number of document templates are stored in business systems. While the template titles are similar, they belong to different categories, have different paths, and contain different contents. The content and number of document templates are constantly changing. In this case, assuming that the user does not clearly understand the template name but can describe the key words of the template, and in addition to minimizing user interaction, the system can also quickly and accurately understand the user's intent and return the required template information.
[0003] Currently, template retrieval involves technicians inserting templates into a database. Users then enter keywords into the business system, which then searches through a search engine. The backend service then filters the search results and selects the template they need. If no results are found, the user must change the search terms and search again until the desired template is found. This method relies heavily on the user's search keywords and fails to implement semantic search capabilities.
[0004] Technicians pre-insert the template into a database and then use the user's keywords to filter the database for the template information they need using a fuzzy query. If no results are found, the user is required to change the keywords and search again until a result is found. This method also relies on the user's search terms and word order, resulting in a poor search experience and often requiring users to be very familiar with the template information. Furthermore, it doesn't produce semantically relevant search results, and its performance is low.
[0005] Therefore, to address the above issues, a method is needed to intelligently identify user input and query document templates in cases. Summary of the Invention
[0006] The present invention aims to provide a method for intelligently identifying user input and querying document templates in a case. Based on a given template document, the method can parse and search for template results according to user intent. It can parse user-input keywords, their synonyms, and quickly match templates, achieving high efficiency and accuracy.
[0007] The present invention is achieved in that:
[0008] The present invention provides a method for intelligently identifying user input and querying document templates in a case; the method is specifically performed in the following steps:
[0009] S1: Prepare the dataset, collect and prepare the training dataset related to the document template; ensure the dataset quality and annotation accuracy, and perform data cleaning and preprocessing;
[0010] Follow these steps:
[0011] S1.1: Collect case-related document template data through court public documents, legal databases, and historical case records, including legal documents, contracts, and indictments;
[0012] S1.2: Use hashing algorithms or text similarity detection to remove duplicate documents, then perform denoising to remove irrelevant characters, special symbols, and HTML tags, and use regular expressions to match and clean up unstructured text;
[0013] S1.3: Detect and process documents that are too long or too short, such as documents whose length exceeds 3σ; after normalization using Z-Score, remove outliers with an absolute value greater than 3; perform data normalization as follows;
[0014]
[0015] Where x is the document length, μ is the mean, and σ is the standard deviation;
[0016] S1.4: Annotate the key fields of the document template, including party information, case type, and legal basis. The annotation format is JSON or XML, and includes field name, start position, and end position information.
[0017] S1.5: Use Jieba and HanLP tools to perform Chinese word segmentation and vectorize the data. Specifically, use the Word2Vec, GloVe, or BERT pre-trained model to generate word vectors as follows:
[0018] e i =Embedding(w i )
[0019] Among them, e i is the word vector, w i is the i-th word.
[0020] S2: Based on the nature of the target task and the characteristics of the dataset, select a pre-trained model for model training. Set a fine-tuning strategy for the pre-trained model and determine the hyperparameters for fine-tuning based on the task requirements and available resources. Specifically, the hyperparameters include a learning rate of 0.001 and a number of training rounds of 3. Fine-tune the model using these hyperparameters and train the model's performance and convergence speed.
[0021] Specifically select the BERT model for training, and follow the steps below:
[0022] S2.1: Set the learning rate according to the task: lr = 0.001; or (e.g., lr∈[1e-5,1e-3]). Adjust the number of training rounds according to the dataset size: epochs = 3; set the batch size batch_size = 16 or 32; and freeze the bottom layers. The fine-tuning strategy includes fine-tuning the top classifier when training on a small dataset, and fine-tuning all layers when training on a large dataset.
[0023] S2.2: Hyperparameter training optimization is performed using the AdamW optimizer with weight decay, as shown in the following formula:
[0024] m t =β1m t-1 +(1-β1)g t
[0025]
[0026] Among them, gt is the gradient, β1=0.9,β2=0.999,∈=1e-8, and λ is the weight attenuation coefficient.
[0027] S3: Initialize the parameters of the fine-tuning model based on the weights of the pre-trained model and perform fine-tuning training. Use the prepared dataset and fine-tuning strategy to train the model. During the training process, gradually adjust the model parameters to minimize the loss function based on the set hyperparameters and optimization algorithm.
[0028] Follow these steps:
[0029] S3.1: Fine-tune model training. First, initialize the model and load the pre-trained model weights including bert-base-chinese; and replace the top classifier, including the fully connected layer + Softmax;
[0030] S3.2: Forward propagation, input document sequence, and output logits through model calculation; as follows:
[0031] logits=W·h cls +b
[0032] Among them, hcls is the hidden state of [CLS] token;
[0033] S3.3: Calculate the cross entropy loss as follows;
[0034]
[0035] Among them, y i is the true label, is the predicted probability;
[0036] S3.3: Calculate the gradient update parameters for back propagation optimization, as follows:
[0037]
[0038] S4: During the training process, the model is regularly evaluated using the validation set, and hyperparameters or fine-tuning strategies are adjusted based on the evaluation results to improve the performance and generalization ability of the model.
[0039] S5: Test model performance. After fine-tuning is complete, use the test set to evaluate the final fine-tuned model to obtain the final performance indicators. Evaluate the performance of the model in actual applications; specifically, follow these steps:
[0040] S5.1: Model evaluation and adjustment First, evaluate the validation set. Calculate the metrics on the validation set every fixed number of steps (for example, every 100 steps), as shown below:
[0041]
[0042] in,
[0043] S5.2: Perform hyperparameter adjustments again, decay the learning rate, and if the validation loss does not decrease for n consecutive rounds, adjust lr←lr×0.1; if the validation loss does not decrease for n consecutive patience rounds, stop training.
[0044] S5.3: Perform fine-tuning strategy optimization, experimenting with different numbers of fine-tuning layers (e.g., fine-tuning only the last three layers). Also introduce adversarial training, including FGM or PGD, to improve robustness. After optimizing the fine-tuning strategy, generate a confusion matrix and analyze error types, including misclassification and missed classification. Specifically, calculate overall model performance metrics such as accuracy and F1-score on the test set.
[0045] After the overall performance index reaches the set standard value, deployment preparation is carried out.
[0046] Export the model to ONNX or TorchScript format to optimize inference speed, and integrate it into the case processing system to achieve real-time query capabilities.
[0047] S6: Deploy the fine-tuned model to actual applications.
[0048] Furthermore, the present invention provides a system for intelligently identifying user input and querying document templates in cases, including a data management module. The module integrates a web crawler tool to crawl template data of legal documents, contracts, indictments, etc. from the court's public document network, legal database, and historical case system, and realizes automatic data import through API interface connection; and performs data cleaning, data labeling, and data storage.
[0049] Model training module, integrating pre-trained models in the legal field for model training;
[0050] Model evaluation module for validation set monitoring and hyperparameter optimization;
[0051] The model deployment module exports and converts models into ONNX or TorchScript formats to optimize inference speed. It also uses FastAPI or Flask to build a RESTful API, providing a real-time query interface and service-oriented deployment.
[0052] The user interaction module supports users to upload documents or enter query criteria, including case type and party information, through a web form;
[0053] API interface, accepts structured queries including field-value pairs in JSON format;
[0054] Output display, through template matching results, highlights the matching fields in the document, including the name of the party and legal basis; and generates a visual report, generating a PDF or Word document containing key information.
[0055] Furthermore, the present invention provides a computer device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, the processor implements the steps of any one of the above-mentioned methods for intelligently identifying user input and querying document templates in a case.
[0056] Furthermore, the present invention provides a computer-storable medium, which includes an embedded processing system and a stored program, and controls the method of intelligently identifying user input and querying document templates in a case when the embedded system control program runs.
[0057] Compared with the prior art, the present invention has the following beneficial effects:
[0058] The present invention allows users to input key template information for searching according to their own habits. The algorithm can identify the user's intention, query the document template that best meets the user's intention from the vector database, and return template-related information with high accuracy. Moreover, the template database can keep up with the latest changes in the business system at any time, and quickly synchronize updates to ensure real-time synchronization of the template library. BRIEF DESCRIPTION OF THE DRAWINGS
[0059] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the following is a brief introduction to the drawings required for use in the embodiments. It is understood that the following drawings only illustrate certain embodiments of the present invention and therefore should not be regarded as limiting the scope. For ordinary technicians in this field, other relevant drawings can be obtained based on these drawings without creative work.
[0060] Figure 1 It is a system operation flow chart of the present invention;
[0061] Figure 2 It is a system structure diagram of the present invention;
[0062] Figure 3 A data retrieval diagram according to an embodiment of the present invention;
[0063] Figure 4 It is the data annotation code diagram of the present invention;
[0064] Figure 5 It is a screenshot of the data API interface code of the present invention. DETAILED DESCRIPTION
[0065] In order to make the purpose, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present invention. Therefore, the following detailed description of the embodiments of the present invention provided in the drawings is not intended to limit the scope of the invention for which protection is sought, but is merely for selected embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present invention.
[0066] See also Figure 1-Figure 5 The present invention provides a method for intelligently identifying user input and querying document templates in a case; the method is specifically performed in the following steps:
[0067] S1: Prepare the dataset, collect and prepare the training dataset related to the document template; ensure the dataset quality and annotation accuracy, and perform data cleaning and preprocessing;
[0068] Follow these steps:
[0069] S1.1: Collect case-related document template data through court public documents, legal databases, and historical case records, including legal documents, contracts, and indictments;
[0070] S1.2: Use hashing algorithms or text similarity detection to remove duplicate documents, then perform denoising to remove irrelevant characters, special symbols, and HTML tags, and use regular expressions to match and clean up unstructured text;
[0071] S1.3: Detect and process documents that are too long or too short, such as documents whose length exceeds 3σ; after normalization using Z-Score, remove outliers with an absolute value greater than 3; perform data normalization as follows;
[0072]
[0073] Where x is the document length, μ is the mean, and σ is the standard deviation;
[0074] S1.4: Annotate the key fields of the document template, including party information, case type, and legal basis. The annotation format is JSON or XML, and includes field name, start position, and end position information.
[0075] S1.5: Use Jieba and HanLP tools to perform Chinese word segmentation and vectorize the data. Specifically, use the Word2Vec, GloVe, or BERT pre-trained model to generate word vectors as follows:
[0076] e i =Embedding(w i )
[0077] Among them, e i is the word vector, w i is the i-th word.
[0078] S2: Based on the nature of the target task and the characteristics of the dataset, select a pre-trained model for model training. Set a fine-tuning strategy for the pre-trained model and determine the hyperparameters for fine-tuning based on the task requirements and available resources. Specifically, the hyperparameters include a learning rate of 0.001 and a number of training rounds of 3. Fine-tune the model using these hyperparameters and train the model's performance and convergence speed.
[0079] Specifically select the BERT model for training, and follow the steps below:
[0080] S2.1: Set the learning rate according to the task: lr = 0.001; or (e.g., lr∈[1e-5,1e-3]). Adjust the number of training rounds according to the dataset size: epochs = 3; set the batch size batch_size = 16 or 32; and freeze the bottom layers. The fine-tuning strategy includes fine-tuning the top classifier when training on a small dataset, and fine-tuning all layers when training on a large dataset.
[0081] S2.2: Hyperparameter training optimization is performed using the AdamW optimizer with weight decay, as shown in the following formula:
[0082] m t =β1m t-1 +(1-β1)g t
[0083]
[0084] Among them, gt is the gradient, β1=0.9,β2=0.999,∈=1e-8, and λ is the weight attenuation coefficient.
[0085] S3: Initialize the parameters of the fine-tuning model based on the weights of the pre-trained model and perform fine-tuning training. Use the prepared dataset and fine-tuning strategy to train the model. During the training process, gradually adjust the model parameters to minimize the loss function based on the set hyperparameters and optimization algorithm.
[0086] Follow these steps:
[0087] S3.1: Fine-tune model training. First, initialize the model and load the pre-trained model weights including bert-base-chinese; and replace the top classifier, including the fully connected layer + Softmax;
[0088] S3.2: Forward propagation, input document sequence, and output logits through model calculation; as follows:
[0089] logits=W·h cls +b
[0090] Among them, hcls is the hidden state of [CLS] token;
[0091] S3.3: Calculate the cross entropy loss as follows;
[0092]
[0093] Among them, y i is the true label, is the predicted probability;
[0094] S3.3: Calculate the gradient update parameters for back propagation optimization, as follows:
[0095]
[0096] S4: During the training process, the model is regularly evaluated using the validation set, and hyperparameters or fine-tuning strategies are adjusted based on the evaluation results to improve the performance and generalization ability of the model.
[0097] S5: Test model performance. After fine-tuning is complete, use the test set to evaluate the final fine-tuned model to obtain the final performance indicators. Evaluate the performance of the model in actual applications; specifically, follow these steps:
[0098] S5.1: Model evaluation and adjustment First, evaluate the validation set. Calculate the metrics on the validation set every fixed number of steps (for example, every 100 steps), as shown below:
[0099]
[0100] in,
[0101] S5.2: Perform hyperparameter adjustments again, decay the learning rate, and if the validation loss does not decrease for n consecutive rounds, adjust lr←lr×0.1; if the validation loss does not decrease for n consecutive patience rounds, stop training.
[0102] S5.3: Perform fine-tuning strategy optimization, experimenting with different numbers of fine-tuning layers (e.g., fine-tuning only the last three layers). Also introduce adversarial training, including FGM or PGD, to improve robustness. After optimizing the fine-tuning strategy, generate a confusion matrix and analyze error types, including misclassification and missed classification. Specifically, calculate overall model performance metrics such as accuracy and F1-score on the test set.
[0103] After the overall performance index reaches the set standard value, deployment preparation is carried out.
[0104] Export the model to ONNX or TorchScript format to optimize inference speed, and integrate it into the case processing system to achieve real-time query capabilities.
[0105] S6: Deploy the fine-tuned model to actual applications.
[0106] In this embodiment, the present invention provides a system for intelligently identifying user input and querying document templates in cases, including a data management module. The module integrates a web crawler tool to crawl template data such as legal documents, contracts, and indictments from the court's public document network, legal databases, and historical case systems, and connects to the API interface to achieve automated data import; and performs data cleaning, data labeling, and data storage.
[0107] Model training module, integrating pre-trained models in the legal field for model training;
[0108] Model evaluation module for validation set monitoring and hyperparameter optimization;
[0109] The model deployment module exports and converts models into ONNX or TorchScript formats to optimize inference speed. It also uses FastAPI or Flask to build a RESTful API, providing a real-time query interface and service-oriented deployment.
[0110] The user interaction module supports users to upload documents or enter query criteria, including case type and party information, through a web form;
[0111] API interface, accepts structured queries including field-value pairs in JSON format;
[0112] Output display, through template matching results, highlights the matching fields in the document, including the name of the party and legal basis; and generates a visual report, generating a PDF or Word document containing key information.
[0113] In this embodiment, Figure 3 - Figure 6. First, the present invention collected 100 simulated legal documents including contracts, indictments, and judgments. By calculating the document similarity, two duplicate contents were removed, and regular expressions were used to clean up HTML tags and special symbols. At the same time, documents with abnormal length (Z-Score absolute value greater than 3) were eliminated to ensure data quality. In the data annotation link, the present invention annotated key fields such as party information, case type, legal basis, etc., and saved them in JSON format to provide structured data for subsequent model training.
[0114] During the model training phase, we selected bert-base-chinese as the pre-trained model and performed full fine-tuning. By setting hyperparameters, including a learning rate of 0.001, three training epochs, and a batch size of 16, we used the AdamW optimizer for parameter updates and calculated the loss using the cross-entropy loss function. Simulated training showed that with increasing training epochs, the loss gradually decreased, while the accuracy steadily improved, ultimately achieving a high level of performance on the training set.
[0115] To verify the model's generalization ability, the accuracy and F1-score were calculated on the validation set, reaching 0.89 and 0.88, respectively. Furthermore, the present invention implemented a learning rate decay and early stopping strategy to prevent overfitting and further optimize model performance. During the testing phase, the model performed stably on an unseen test set, achieving an accuracy of 0.87 and an F1-score of 0.86, respectively, demonstrating good generalization ability.
[0116] Finally, this invention deploys the trained model as a RESTful API, providing a real-time query interface via the FastAPI framework. Users can upload documents or enter query criteria to retrieve key fields predicted by the model, such as case type, party information, and legal basis. This deployment approach enables the model to be easily integrated into legal business systems, providing intelligent support for actual case processing.
[0117] In this embodiment, the present invention provides a computer device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, the steps of any one of the above-mentioned methods for intelligently identifying user input and querying document templates in a case are implemented.
[0118] In this embodiment, the present invention provides a computer-storable medium, which includes an embedded processing system and a stored program, and controls the method of intelligently identifying user input and querying document templates in a case when the embedded system control program runs.
[0119] The foregoing description is merely a preferred embodiment of the present invention and is not intended to limit the present invention. Those skilled in the art will readily appreciate that various modifications and variations of the present invention are possible. Any modifications, equivalent substitutions, or improvements made within the spirit and principles of the present invention are intended to be within the scope of protection of the present invention.
Claims
1. A method for intelligently identifying user input and querying document templates in a case, characterized by: Follow these steps: S1: Prepare the dataset, collect and prepare the training dataset related to the document template; ensure the dataset quality and annotation accuracy, and perform data cleaning and preprocessing; S2: Based on the nature of the target task and the characteristics of the dataset, select a pre-trained model for model training; set a fine-tuning strategy in the pre-trained model, and determine the hyperparameters of the fine-tuning process based on the task requirements and available resources; S3: Initialize the parameters of the fine-tuning model according to the weights of the pre-trained model, perform fine-tuning training, and train the model using the prepared dataset and fine-tuning strategy; During the training process, the model parameters are gradually adjusted to minimize the loss function according to the set hyperparameters and optimization algorithm; S4: During the training process, the model is regularly evaluated using the validation set, and hyperparameters or fine-tuning strategies are adjusted based on the evaluation results to improve the performance and generalization ability of the model. S5: Test model performance. After fine-tuning is completed, the final fine-tuned model is evaluated using the test set to obtain the final performance indicators. S6: Deploy the fine-tuned model to actual applications.
2. The method for intelligently identifying user input and querying document templates in a case according to claim 1, characterized in that: In step S1, the following steps are specifically performed: S1.1: Collect case-related document template data through court public documents, legal databases, and historical case records, including legal documents, contracts, and indictments; S1.2: Use hashing algorithms or text similarity detection to remove duplicate documents, then perform denoising to remove irrelevant characters, special symbols, and HTML tags, and use regular expressions to match and clean up unstructured text; S1.3: Detect and process documents that are too long or too short, normalize using the Z-Score, and remove outliers with an absolute value greater than 3; perform data normalization as follows; Where x is the document length, μ is the mean, and σ is the standard deviation; S1.4: Annotate the key fields of the document template, including party information, case type, and legal basis. The annotation format is JSON or XML, and includes field name, start position, and end position information. S1.5: Use Jieba and HanLP tools to perform Chinese word segmentation and vectorize the data. Specifically, use the Word2Vec, GloVe, or BERT pre-trained model to generate word vectors as follows: e i =Embedding(w i ) Among them, e i is the word vector, w i is the i-th word.
3. The method for intelligently identifying user input and querying document templates in a case according to claim 1, characterized in that: In step S2, the BERT model is selected for training, and the following steps are performed: S2.1: Set the learning rate to 0.001 based on the task; adjust the number of training rounds to 3 based on the dataset size; set the batch size to 16 or 32; and freeze the bottom layers. The fine-tuning strategy includes fine-tuning the top layer classifier when training on a small dataset, and fine-tuning all layers when training on a large dataset. S2.2: Hyperparameter training optimization is performed using the AdamW optimizer with weight decay, as shown in the following formula: m t =β1m t-1 +(1-β1)g t Among them, gt is the gradient, β1=0.9,β2=0.999,∈=1e-8, and λ is the weight attenuation coefficient.
4. The method for intelligently identifying user input and querying document templates in a case according to claim 1, characterized in that: In step S3, the following steps are specifically performed: S3.1: Fine-tune model training. First, initialize the model and load the pre-trained model weights including bert-base-chinese; and replace the top classifier, including the fully connected layer + Softmax; S3.2: Forward propagation, input document sequence, and output logits through model calculation; as follows: logits=W·h cls +b Among them, hcls is the hidden state of [CLS] token; S3.3: Calculate the cross entropy loss as follows; Among them, y i is the true label, is the predicted probability; S3.3: Calculate the gradient update parameters for back propagation optimization, as follows:
5. The method for intelligently identifying user input and querying document templates in a case according to claim 1, characterized in that: In step S5, the following steps are specifically performed: S5.1: Model evaluation and adjustment First, evaluate the validation set. Calculate the metrics on the validation set every fixed number of steps, as shown below; in, S5.2: Perform hyperparameter adjustments again, decay the learning rate, and if the validation loss does not decrease for n consecutive rounds, adjust lr←lr×0.1; if the validation loss does not decrease for n consecutive patience rounds, stop training. S5.3: Optimize the fine-tuning strategy and try different numbers of fine-tuning layers. Introduce adversarial training, including FGM or PGD, to improve robustness.
6. The method for intelligently identifying user input and querying document templates in a case according to claim 5, characterized in that: After fine-tuning the strategy optimization, the confusion matrix is generated to analyze the error types including misclassification and missed classification; Model performance specifically includes calculating overall performance indicators such as accuracy and F1-Score on the test set; After the overall performance indicators are calculated to reach the set standard value, deployment preparation is carried out, the model is exported to ONNX or TorchScript format, the inference speed is optimized, and it is integrated into the case processing system to realize real-time query function.
7. A system for intelligently identifying user input and querying document templates in a case, characterized by: It includes a data management module that integrates a web crawler tool to capture template data such as legal documents, contracts, and indictments from the court's public document network, legal database, and historical case system, and connects to the API interface to achieve automated data import; and performs data cleaning, data labeling, and data storage; Model training module, integrating pre-trained models in the legal field for model training; Model evaluation module for validation set monitoring and hyperparameter optimization; The model deployment module exports and converts models into ONNX or TorchScript formats to optimize inference speed. It also uses FastAPI or Flask to build a RESTful API, providing a real-time query interface and service-oriented deployment. The user interaction module supports users to upload documents or enter query criteria, including case type and party information, through a web form; API interface, accepts structured queries including field-value pairs in JSON format; Output display, through template matching results, highlights the matching fields in the document, including the name of the party and legal basis; and generates a visual report, generating a PDF or Word document containing key information.
8. A computer device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein: When the processor executes the computer program, the processor implements the steps of a method for intelligently identifying user input and querying document templates in a case according to any one of claims 1 to 6.
9. A computer storable medium, characterized in that: The computer-readable storage medium includes an embedded processing system and a stored program, which controls the method of intelligently identifying user input and querying document templates in a case when the embedded system control program runs.