Prompt-based text object recognition method and device, equipment, medium and program
The prompt-based method enhances text object recognition accuracy and efficiency by using structured prompts to guide a large model for precise entity and qualifier identification, addressing the limitations of existing technologies.
Patent Information
- Application Number
- CN202411288209.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-13
- Publication Date
- 2025-01-03
AI Technical Summary
Existing text object recognition technologies suffer from low accuracy and efficiency due to high data annotation costs, inflexibility, and difficulty in adapting to language diversity, particularly in fields like food, real estate, and medical health.
A prompt-based method that constructs a first target prompt structure with recognition task description, background content, and multi-dimensional hierarchical description to guide a large model for accurate and efficient text object recognition, including entities and qualifiers.
Improves the accuracy and efficiency of text object recognition by reducing reliance on annotation data and enhancing flexibility, allowing the model to output precise results through structured prompts.
Smart Images

Figure CN119250074A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of data processing technology, and in particular to natural language processing and artificial intelligence technology. Background Art
[0002] Text object recognition in the field of data processing, such as named entity recognition, is a basic technology in the field of natural language processing. Its main goal is to automatically identify and classify text object types waiting to be recognized by named entities with specific meanings in the text, which has important application value in the field of text processing. Summary of the invention
[0003] The embodiments of the present disclosure provide a prompt-based text object recognition method, apparatus, device, medium and program, which can improve the accuracy and efficiency of text object recognition.
[0004] In a first aspect, an embodiment of the present disclosure provides a prompt-based text object recognition method, comprising:
[0005] Determine a first target prompt structure in the target text object recognition field; wherein the first target prompt structure includes a recognition task description, background content, and a multi-dimensional hierarchical description of the recognition task;
[0006] Filling the first target prompt structure to obtain a first target prompt; wherein the multi-dimensional hierarchical description of the recognition task in the first target prompt includes task description information of different levels in multiple dimensions;
[0007] The first target prompt is input into a target macromodel, and a target text object of the content specified in the first target prompt is identified through the target macromodel; wherein the target text object includes entities and / or qualifiers in the target text object identification field.
[0008] In a second aspect, an embodiment of the present disclosure provides a prompt-based text object recognition device, comprising:
[0009] A first target prompt structure determination module, used to determine a first target prompt structure in the target text object recognition field; wherein the first target prompt structure includes a recognition task description, background content, and a multi-dimensional hierarchical description of the recognition task;
[0010] A first target prompt acquisition module is used to fill the first target prompt structure to obtain a first target prompt; wherein the multi-dimensional hierarchical description of the recognition task in the first target prompt includes task description information of different levels in multiple dimensions;
[0011] A target text object recognition module is used to input the first target prompt into a target macro model, and recognize the target text object of the specified content in the first target prompt through the target macro model; wherein the target text object includes entities and / or qualifiers in the target text object recognition field.
[0012] In a third aspect, an embodiment of the present disclosure provides an electronic device, including:
[0013] at least one processor; and
[0014] a memory communicatively connected to the at least one processor; wherein,
[0015] The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to execute the prompt-based text object recognition method provided by the embodiment of the first aspect.
[0016] In a fourth aspect, an embodiment of the present disclosure further provides a non-transitory computer-readable storage medium storing computer instructions, wherein the computer instructions are used to enable the computer to execute the prompt-based text object recognition method provided by the embodiment of the first aspect.
[0017] In a fifth aspect, an embodiment of the present disclosure further provides a computer program product, including a computer program, which, when executed by a processor, implements the prompt-based text object recognition method provided in the embodiment of the first aspect.
[0018] The disclosed embodiment determines the first target prompt structure in the target text object recognition field, fills the recognition task description, background content, and multi-dimensional hierarchical description of the recognition task in the first target prompt structure, and obtains the first target prompt, thereby inputting the first target prompt into the target macro model, so as to recognize the target text objects such as entities and / or qualifiers of the specified content in the first target prompt through the target macro model. Since the multi-dimensional hierarchical description of the recognition task in the first target prompt includes task description information of different levels in multiple dimensions, the target macro model can be instructed from multiple dimensions to output the target text objects that meet the requirements on demand, which can solve the problem of low accuracy and efficiency of existing text object recognition, and can improve the accuracy and efficiency of text object recognition.
[0019] It should be understood that the content described in this section is not intended to identify the key or important features of the embodiments of the present disclosure, nor is it intended to limit the scope of the present disclosure. Other features of the present disclosure will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS
[0020] The accompanying drawings are used to better understand the present solution and do not constitute a limitation of the present disclosure.
[0021] Figure 1 is a flowchart of a prompt-based text object recognition method provided by an embodiment of the present disclosure;
[0022] Figure 2 is a flowchart of another prompt-based text object recognition method provided by an embodiment of the present disclosure;
[0023] Figure 3 is a structural diagram of a prompt-based text object recognition device provided by an embodiment of the present disclosure;
[0024] Figure 4 It is a structural schematic diagram of an electronic device used to implement the prompt-based text object recognition method of an embodiment of the present disclosure. DETAILED DESCRIPTION
[0025] The following is a description of exemplary embodiments of the present disclosure in conjunction with the accompanying drawings, including various details of the embodiments of the present disclosure to facilitate understanding, which should be considered as merely exemplary. Therefore, it should be recognized by those of ordinary skill in the art that various changes and modifications may be made to the embodiments described herein without departing from the scope and spirit of the present disclosure. Similarly, for the sake of clarity and conciseness, descriptions of well-known functions and structures are omitted in the following description.
[0026] At present, entity recognition and qualifier extraction in a certain field usually rely on machine learning models in the field of artificial intelligence, such as named entity recognition (NER) models, or can be directly identified using rule matching technology. Although some related technologies use large models for information extraction, they basically use fixed prompt words to directly call the large model for information extraction.
[0027] However, when using machine learning models to perform entity recognition and qualifier extraction, a large amount of manually annotated data is required, and the data preparation cost is high. The rule matching method lacks flexibility and is difficult to cope with language diversity. At the same time, a large amount of manual maintenance of auxiliary data such as alias tables is required. The information extracted by directly calling a large model with fixed prompt words is difficult to strictly comply with the specifications of the original information system.
[0028] In one example, Figure 1This is a flowchart of a prompt-based text object recognition method provided by an embodiment of the present disclosure. This embodiment is applicable to the situation where a target large model is indicated to recognize a target text object on demand according to prompts of task description information including multi-dimensional and different levels. The method can be executed by a prompt-based text object recognition device, which can be implemented by software and / or hardware and can generally be integrated into an electronic device. The electronic device can be a terminal device or a server device, as long as it can execute the prompt-based text object recognition method. The embodiment of the present disclosure does not limit the specific device type of the electronic device. Accordingly, if Figure 1 As shown, the method includes the following operations:
[0029] S110, determining a first target prompt structure in the target text object recognition field; wherein the first target prompt structure includes a recognition task description, background content, and a multi-dimensional hierarchical description of the recognition task.
[0030] Among them, the target text object recognition field can be a related field where target text object recognition is required, for example, it can include but is not limited to the food field, real estate field, and medical and health field, etc., as long as there is a need for target text object recognition, the embodiment of the present disclosure does not limit the specific field type of the target text object recognition field. The first target prompt structure can be a structure used to construct the first target prompt. The recognition task description can be used to describe and define a specific recognition task. The background content can be used to provide relevant background technology in the field of target text object recognition. The multi-dimensional hierarchical description of the recognition task can be defined from multiple different dimensions, including a detailed description of the recognition task with a multi-level structural layout.
[0031] In the disclosed embodiment, a prompt-based text object recognition method can be completed by a large model. The large model is also called a large language model or a large language model (Large Language Model, LLM), which refers to a deep learning model that can process text sequences using a large amount of relevant data (such as text data, voice data, or text-image data, etc.), which can generate natural language text or understand the meaning of language text. Such models usually have a parameter scale of more than billions. The large model can handle a variety of natural language tasks, such as text classification, question and answer, and dialogue, and is widely used. The input of the large model is data, such as text data, voice data, or text-image data, etc. The large model can obtain the corresponding word vector representation by encoding the input data, and further decodes the word vector obtained by the encoding, thereby automatically completing the processing of the input data and obtaining the output data corresponding to the input data. Exemplarily, the text can be input to the large model, and the large model processes and predicts the input text, and outputs the answer text corresponding to the text.
[0032] The training process of a large model can be divided into two stages: pre-training and fine-tuning. In the pre-training stage, unsupervised learning can be used to perform pre-training on large-scale, unlabeled text datasets (such as online encyclopedias, online articles, and books, etc.). Specifically, the missing part or the next word can be predicted based on the context, and statistical laws and language structures such as semantics and syntax can be learned. The prediction loss can be minimized through back-propagation and optimization algorithms, and the model parameters can be iteratively updated to gradually improve the model's ability to understand language. In the fine-tuning stage, corresponding supervised learning tasks such as text classification, named entity recognition, question-answering systems, and dialogue systems can be selected according to specific application scenarios and task requirements, and task-specific text datasets can be prepared, so that the pre-trained model can be used as the starting point for fine-tuning. Fine-tuning training can be performed on task-specific text datasets using supervised learning. Specifically, the task can be performed based on the text dataset, and the loss used to measure the performance of the model in processing specific tasks can be minimized through back-propagation and optimization algorithms. The model parameters are iteratively updated, so that the performance of the large model on specific tasks is gradually improved.
[0033] The prompt of the large model, also known as Prompt, is the key to guide the large model to generate specific output. The design and adjustment of the prompt is crucial to optimizing the output quality and accuracy of the model. Therefore, before using the large model to recognize the target text object, the first target prompt structure can be configured for the target text object recognition field. The first target prompt structure can define the basic composition structure of the first target prompt. In the embodiment of the present disclosure, the first target prompt structure can include three main structures such as recognition task description, background content, and recognition task multi-dimensional hierarchical description. Optionally, each layer of structure can also include multiple substructures. For example, the recognition task description can specify one or more tasks that the large model needs to complete. When it is necessary to specify that the large model completes multiple tasks, multiple substructures can be used to describe each task type respectively. The background content can provide reference background data for the large model. When the large model needs to understand multiple aspects of background data, the background content can use multiple substructures to describe each aspect of background data respectively. Similarly, the multi-dimensional hierarchical description of the recognition task can specify that the large model executes multiple levels of task steps from different dimensions in sequence.
[0034] S120: Fill the first target prompt structure to obtain a first target prompt; wherein the multi-dimensional hierarchical description of the recognition task in the first target prompt includes task description information of different levels in multiple dimensions.
[0035] The first target prompt may be a prompt input into the target macromodel to instruct the target macromodel to output the target text object as required. The target macromodel may be a macromodel for receiving the first target prompt and implementing a text object recognition function based on the first target prompt. As long as the text object recognition function can be completed based on the prompt, the disclosed embodiment does not limit the model type of the target macromodel.
[0036] Correspondingly, after determining the first target prompt structure in the target text object recognition field, the recognition task description, background content, and multi-dimensional hierarchical description of the recognition task in the first target prompt structure in the target text object recognition field can be filled with content as needed to obtain the first target prompt. It can be understood that since the multi-dimensional hierarchical description of the recognition task includes a description structure of different levels of multiple dimensions, the data structure of the multi-dimensional hierarchical description of the recognition task in the generated first target prompt can include task description information of different levels of multiple dimensions.
[0037] S130. Input the first target prompt into a target macro model, and identify a target text object of the content specified in the first target prompt through the target macro model; wherein the target text object includes entities and / or qualifiers in the target text object recognition field.
[0038] The target text object is also the text object such as entities and / or qualifiers that the target macro model needs to identify for the data paragraph specified by the first target prompt.
[0039] After the first target prompt is obtained by filling in the structure of the first target prompt, the first target prompt can be input into the target macro model. After receiving the first target prompt, the target macro model can parse the data content corresponding to the recognition task description, background content and multi-dimensional hierarchical description of the recognition task included in the first target prompt according to the structure sequence of the first target prompt, so as to gradually identify the target text objects such as entities and / or qualifiers included in the specified content in the first target prompt according to the parsing results.
[0040] Since most large models are autoregressive generative models, the structural framework of the recognition task description is laid out in the first target prompt structure and filled in, and the relevant content corresponding to the recognition task description in the first target prompt is obtained, which can be used as the recognition task instruction. Configuring the recognition task instruction by filling in the data content of the recognition task description can help the target large model reduce the misjudgment of the context meaning and avoid the target large model from generating irrelevant content.
[0041] The target large model has a strong context-dependency capability. Therefore, by laying out the structural framework of the background content in the first target prompt structure and filling it, the background information corresponding to the background content in the first target prompt can be obtained. By providing additional background information, the target large model can more accurately infer entities and / or qualifiers related to the target text object recognition field when it is generated, and understand the special meaning of the recognized target text object according to the context.
[0042] The target large model relies on its autoregressive characteristics when processing tasks. By laying out the structural framework of the multi-dimensional hierarchical description of the recognition task in the first target prompt structure and filling it, the multi-dimensional and different-level task description information corresponding to the multi-dimensional hierarchical description of the recognition task in the first target prompt can be obtained. The multi-dimensional and different-level task description information can describe and refine the task information from different dimensions and different levels, so that the target large model can perform the recognition operation of the target text object layer by layer from different angles, which can effectively reduce the accumulation of errors in complex problems and further improve the reliability of the recognition result output.
[0043] It can be seen that the above technical solution can dynamically construct the first target prompt as needed by following the first target prompt structure of the recognition task description, background content, and multi-dimensional hierarchical description of the recognition task. The first target prompt can guide the target large model to generate accurate recognition results of target text objects such as entities and / or qualifiers through specific keywords and structures, reducing the dependence on annotation data and improving the flexibility and speed of text object processing.
[0044] The disclosed embodiment determines the first target prompt structure in the target text object recognition field, fills the recognition task description, background content, and multi-dimensional hierarchical description of the recognition task in the first target prompt structure, and obtains the first target prompt, thereby inputting the first target prompt into the target macro model, so as to recognize the target text objects such as entities and / or qualifiers of the specified content in the first target prompt through the target macro model. Since the multi-dimensional hierarchical description of the recognition task in the first target prompt includes task description information of different levels in multiple dimensions, the target macro model can be instructed from multiple dimensions to output the target text objects that meet the requirements on demand, which can solve the problem of low accuracy and efficiency of existing text object recognition, and can improve the accuracy and efficiency of text object recognition.
[0045] In one example, Figure 2It is a flowchart of another prompt-based text object recognition method provided by an embodiment of the present disclosure. Based on the technical solutions of the above-mentioned embodiments, the embodiment of the present disclosure has been optimized and improved, and a variety of specific optional implementation methods for filling the first target prompt structure to obtain the first target prompt are provided. At the same time, specific operations for subsequent text processing of the target text object recognized by using the target large model are provided.
[0046] like Figure 2 A prompt-based text object recognition method is shown, comprising:
[0047] S210: Determine a first target prompt structure in the target text object recognition field.
[0048] Among them, the first target prompt structure includes recognition task description, background content and multi-dimensional hierarchical description of the recognition task; wherein the multi-dimensional hierarchical description of the recognition task includes task description information of different levels of multiple dimensions.
[0049] S220: Fill the first target prompt structure to obtain a first target prompt.
[0050] S230: Input the first target prompt into a target macro model, and identify a target text object of the content specified in the first target prompt through the target macro model.
[0051] The target text object includes entities and / or qualifiers in the target text object recognition field.
[0052] In a specific example, taking real estate as the target text object recognition field as an example, when it is necessary to identify and extract entities and / or qualifiers from an article, a paragraph or a corresponding data set in the real estate field, the recognition task description in the first target prompt structure in the real estate field can be filled in, such as the content filled in the recognition task description can be "Extract entities, types and their modifying features related to real estate from news, papers, government reports and other documents. For example, the type can be "residential", and the modifying features may include "close to the subway" or "close to the school", etc.". Further, after the recognition task description is filled in, the background content in the first target prompt structure in the real estate field can be further filled in, such as the content filled in the background content can be "In the text of the real estate industry, entities with specific modifiers often appear, usually describing characteristics such as location, function and price. The extraction results of these entities and their modifying features will be used for statistics and applications such as domain analysis and market forecasting.".
[0053] In a specific example, taking medical health as the target text object recognition field as an example, when it is necessary to identify and extract entities and / or qualifiers from an article, a paragraph or a corresponding data set in the medical health field, the recognition task description in the first target prompt structure in the medical health field can be filled in, such as the content filled in the recognition task description can be "Task: Named Entity Recognition (NER) is used to identify disease entities." Furthermore, after the recognition task description is filled in, the background content in the first target prompt structure in the medical health field can be further filled in, such as the content filled in the background content can be "Background: In this task, you need to identify disease-related entities from the provided medical text."
[0054] In an optional embodiment of the present disclosure, the multi-dimensional hierarchical description of the recognition task includes a step-by-step task description; the step-by-step task description includes multi-level task steps; the filling of the first target prompt structure to obtain the first target prompt may include: when it is determined that the background content is filled in, generating the recognition task description content of the first-level task step in the step-by-step task description; after determining that the recognition task description content of the first-level task step is filled in, generating the recognition result classification marking description content of the second-level task step in the step-by-step task description; the identifying the target text object of the specified content in the first target prompt through the target big model may include: understanding the multi-level task steps in sequence through the target big model, and identifying and marking the target text objects included in the specified content in the first target prompt according to the understanding results of each of the multi-level task steps.
[0055] Among them, the step-by-step task description can be a framework structure that uses multiple decomposition steps to describe the task description. Multi-level task steps can be task execution steps including multiple levels, and there can be an association relationship between the task execution steps at each level. The first-level task step can be the first task step that needs to be executed. The recognition task description content can include relevant task description instructions for the recognition task. The second-level task step can be the second task step that needs to be executed. The recognition result classification mark description content can be a task description description for classifying and marking the recognition results after the target large model completes the target text object recognition according to the recognition task description content of the first-level task step. The data content filled in each multi-level task step belongs to the task description information of one of the levels provided from the task description dimension.
[0056] In the disclosed embodiment, optionally, the identification task multi-dimensional hierarchical description structure may include a substructure of step-by-step task description. Further, the substructure of step-by-step task description may be composed of multi-level task steps. Accordingly, when the background content in the first target prompt structure is filled, the multi-level task steps included in the identification task multi-dimensional hierarchical description may be further filled.
[0057] In a specific example, taking the real estate field as an example, the step-by-step task description in the first target prompt structure in the real estate field can be filled in. For example, the content of the step-by-step task description can be "The specific steps include: First, identify real estate-related entities in the text, such as school, community names, etc., and extract modifying features related to these entities, such as "close to the subway", "sea view room" or "reasonable price". Then, classify the entity into real estate project types such as "residential", "commercial real estate", "office building". Finally, associate each entity with its modifying features to form a structured data pair." Among them, "First, identify real estate-related entities in the text, such as school, community names, etc., and extract modifying features related to these entities, such as "close to the subway", "sea view room" or "reasonable price". "Belongs to the recognition result classification mark description content of the second-level task step. If it is necessary to extract entities and qualifiers at the same time, the third-level task step can be dynamically adapted to be added in the step-by-step task description. For example, in the above example, "Finally, associate each entity with its modifying features to form a structured data pair." This is a third-level task step in the step-by-step task description, which can establish an association relationship between the identified entities and qualifiers.
[0058] In a specific example, taking the medical and health field as an example, the step-by-step task instructions in the first target prompt structure in the medical and health field can be filled in. For example, the step-by-step task instructions can be filled in as "Step 1: First identify all disease-related entities in the text. Step 2: Classify each entity and use [AA] to mark it." Among them, "Step 1: First identify all disease-related entities in the text." belongs to the recognition task instructions of the first-level task step. "Step 2: Classify each entity and use [AA] to mark it." belongs to the recognition result classification mark instructions of the second-level task step.
[0059] Correspondingly, after receiving the first target prompt, the target large model can reason step by step according to the task steps of each level in the step-by-step task instructions, that is, understand the multi-level task steps in order, and identify and mark the target text objects included in the specified content in the first target prompt according to the understanding results of each multi-level task step.
[0060] The above technical solution, by adding a step-by-step task description structure of multi-level task steps to the multi-dimensional hierarchical description of the recognition task, enables the target large model to reason step by step according to the multi-level task steps, thereby reducing the accumulation of errors in complex problems and guiding the target model to focus on the accuracy of each level step through phased tasks.
[0061] In an optional embodiment of the present disclosure, the multi-dimensional hierarchical description of the recognition task also includes a classification step; the filling of the first target prompt structure to obtain the first target prompt may include: when it is determined that the step-by-step task description is completed, generating the classification step content of the entity; wherein the classification step content of the entity is used to indicate the classification method of the entity; the identifying the target text object of the specified content in the first target prompt through the target macro model may include: classifying the marked entity according to the classification step content of the entity through the target macro model.
[0062] The classification step may be a framework structure for determining the classification method. The data content filled in the classification step belongs to task description information of one level provided from the classification indication dimension.
[0063] Accordingly, when the step-by-step task description is filled, the data content of the classification step can be further filled in the framework of the step-by-step task description. Accordingly, after the target large model receives the first target prompt, it recognizes and marks the target text object included in the specified content in the first target prompt according to the task steps of each level in the step-by-step task description, and further classifies the marked entity according to the classification step content of the entity.
[0064] In a specific example, taking the real estate field as an example, the classification step in the first target prompt structure in the real estate field can be filled in. For example, the content filled in the classification step can be "When classifying real estate-related entities, only the following categories are considered: residential, commercial properties, office buildings, factories, public buildings, and commercial centers."
[0065] In a specific example, taking the medical and health field as an example, the classification step in the first target prompt structure in the medical and health field can be filled, such as "classify each entity as a disease (DIS)." DIS represents the classification label of the disease entity.
[0066] Since the target large model may generate excessive or irrelevant information when outputting, explicitly limiting the generation of entities in the target text object recognition field through the classification step can reduce the target large model's erroneous generation of entities in other fields, thereby improving the accuracy of entity classification in the target text object recognition field.
[0067] In an optional embodiment of the present disclosure, the multi-dimensional hierarchical description of the recognition task may include self-checking; filling the first target prompt structure to obtain the first target prompt may include: generating self-checking content; wherein the self-checking content is used to instruct the target macro model to perform self-checking on the recognition and classification results of the target text object; after the target macro model identifies the target text object with the specified content in the first target prompt, it may also include: the target macro model responds to the self-checking content to review and verify the classified target text object.
[0068] The self-check can be a framework structure for prompting the target large model to check and recheck the recognition and classification results of the target text object. The data content filled in the self-check belongs to one of the levels of task description information provided from the recognition and classification result review dimension.
[0069] It is understandable that the recognition and classification results of the target text object by the target large model will inevitably have certain errors. In order to further improve the recognition accuracy of the target text object, a self-check framework can also be configured in the multi-dimensional hierarchical description of the recognition task of the first target prompt structure. Optionally, the self-check can be filled in and the self-check content can be generated after it is determined that the classification step is filled in. Correspondingly, after the target large model receives the first target prompt, it can review and verify the target text object that has been identified and classified according to the self-check content in the self-check.
[0070] In a specific example, taking the real estate field as an example, the self-check in the first target prompt structure in the real estate field can be filled in. For example, the content of the self-check can be "When performing a task, you need to self-check the results. First, confirm whether the entity extraction accurately identifies real estate-related vocabulary; second, ensure that the extracted modifying features truly reflect the description in the text; finally, check whether the association between the entity and the modifying features is appropriate."
[0071] In a specific example, taking the medical and health field as an example, the self-check in the first target prompt structure in the medical and health field can be filled in. For example, the content filled in for the self-check can be "After completing the identification and classification, review and verify whether the classification is correct."
[0072] Since the generation process of the target large model depends on the context, self-checking provides an opportunity for iteration, which allows the target large model to reflect on and modify the incorrect generated output, especially by repeating the evaluation task to reduce the error in the initial generation. The self-checking mechanism allows the target large model to use its context window to review the generated content again, further improving the reliability of the output.
[0073] In an optional embodiment of the present disclosure, the multi-dimensional hierarchical description of the recognition task may include context guidance; filling the first target prompt structure to obtain the first target prompt may include: generating context guidance content; wherein the context guidance content is used to instruct the target macro model to distinguish the meanings of different target text objects; after identifying the target text object with the specified content in the first target prompt through the target macro model, it may also include: identifying and deleting misclassified text objects in the target text objects after review and verification according to the context guidance content through the target macro model.
[0074] The context guidance may be a framework structure of natural language text consisting of task description and examples as prompts. The data content filled in the context guidance belongs to one of the levels of task description information provided from the context dimension. The misclassified text object may be a text object that is incorrectly recognized and / or classified by the target large model, and may include but is not limited to entity words and / or qualifiers.
[0075] In the disclosed embodiment, optionally, a context guidance framework can also be configured in the multi-dimensional hierarchical description of the recognition task of the first target prompt structure. Optionally, the context guidance can be filled in and the context guidance content can be generated when it is determined that the self-check filling is completed. Accordingly, after receiving the first target prompt, the target large model can identify and delete the misclassified text objects in the target text objects after review and verification according to the context guidance content in the context guidance.
[0076] In a specific example, taking the real estate field as an example, the context guidance in the first target prompt structure in the real estate field can be filled in. For example, the content of the context guidance can be "When processing text, pay attention to descriptive language, especially vocabulary related to location, facilities, price, and environment. This information is usually expressed through adjective phrases or prepositional phrases, and is particularly likely to appear in texts related to real estate."
[0077] In a specific example, taking the medical and health field as an example, the context guidance in the first target prompt structure in the medical and health field can be filled in. For example, the content of the context guidance can be "If an entity refers to treatment or symptoms, do not classify it as a disease."
[0078] Since the target model is highly sensitive to context, providing contextual guidance can enable the target model to more accurately understand the meaning of different entities, thereby reducing misclassification. For example, it will be easier for the model to distinguish between diseases and treatments.
[0079] In an optional embodiment of the present disclosure, the multi-dimensional hierarchical description of the recognition task may include target domain specific prompts; filling the first target prompt structure to obtain the first target prompt may include: generating target domain specific prompt content based on the domain knowledge of the target text object recognition field; wherein the target domain specific prompt content is used to activate the reasoning ability of the target big model; identifying the target text object of the specified content in the first target prompt through the target big model may include: acquiring the target domain knowledge of the target text object recognition field according to the target domain specific prompt content through the target big model, and refining the target text object included in the specified content in the first target prompt according to the target domain knowledge.
[0080] The target domain specific prompt can be a framework structure configured for the target text object recognition domain for the prompt target macro model, which is used to gather knowledge related to the target text object recognition domain. The data content filled in the target domain specific prompt belongs to one of the levels of task description information provided from the special focus knowledge dimension. The target domain knowledge can be the knowledge related to the target text object recognition domain that the target macro model focuses on, as indicated by the target domain specific prompt content.
[0081] For different target text object recognition fields, the field knowledge that is focused on is also different. Therefore, in order to further improve the recognition accuracy of the target text object, the framework of the target field specific prompt can also be configured in the multi-dimensional hierarchical description of the recognition task of the first target prompt structure. Optionally, the target field specific prompt can be filled in when it is determined that the context guidance filling is completed, and the target field specific prompt content is generated to activate the reasoning ability of the target large model. Correspondingly, after the target large model receives the first target prompt, the target field specific prompt content in the target field specific prompt can be parsed to locate the target field knowledge in the target text object recognition field, thereby using the target field knowledge to further refine the recognition of the target text object that is initially identified and classified by the specified content in the first target prompt.
[0082] In a specific example, taking the real estate field as an example, the target field specific prompt in the first target prompt structure in the real estate field can be filled in. For example, the content filled in the target field specific prompt can be "Common entities in the real estate field include residential, commercial properties, office buildings, factory buildings, etc. Modifying features are usually related to information such as location, supporting facilities, transportation and price."
[0083] In a specific example, taking the medical health field as an example, the target field specific prompt in the first target prompt structure in the medical health field can be filled, such as "In the medical field, a disease is defined as a specific health condition or pathology, such as 'AA disease' or 'BB pressure'." In this example, "AA disease" and "BB pressure" refer to specific disease types.
[0084] Although the target large model contains a lot of domain knowledge in its pre-training, it can still activate relevant reasoning capabilities through target domain-specific prompts. Target domain-specific prompts can help the target large model accurately focus on relevant knowledge during reasoning, reduce ambiguous understanding of domain terms, and improve the accuracy of domain terminology understanding.
[0085] In an optional embodiment of the present disclosure, the multi-dimensional hierarchical description of the recognition task may include counterexamples; filling the first target prompt structure to obtain the first target prompt may include: generating target field counterexample content based on special scenario knowledge in the target text object recognition field; identifying the target text object with specified content in the first target prompt through the target macro model may include: deleting non-relevant target text objects included in the specified content in the first target prompt according to the target domain counterexample content through the target macro model.
[0086] Among them, the counterexample can be the framework structure of the reverse reference content when the target large model recognizes and classifies the target text object. The data content filled in the counterexample belongs to one of the levels of task description information provided from the reverse thinking dimension. The target domain counterexample content can be the counterexample content adapted to the target text object recognition domain. Non-relevant target text objects can be text objects of entities and / or qualifiers that do not belong to the target text object recognition domain.
[0087] In the disclosed embodiment, a counter-example framework can also be configured in the multi-dimensional hierarchical description of the recognition task of the first target prompt structure. Optionally, the counter-example can be filled in and the counter-example content can be generated when it is determined that the target domain specific prompt is filled in. Accordingly, after the target large model receives the first target prompt, it can assist in completing the recognition and classification of the target text object according to the counter-example content in the counter-example.
[0088] In a specific example, taking the real estate field as an example, the counterexamples in the first target prompt structure in the real estate field can be filled in. For example, the content of the counterexample filling can be "When extracting, common mistakes include extracting "residential" as "subway", or extracting "close to school" as an independent entity. The correct extraction should be that the entity is "residential", and the modifying features are "close to subway" and "close to school", etc.".
[0089] In a specific example, taking the medical health field as an example, the counterexamples in the first target prompt structure in the medical health field can be filled in. For example, the content of the counterexample filling can be "Ignore entities such as 'dizziness' or 'pain', which are symptoms rather than diseases."
[0090] Since the target large model uses the attention mechanism to associate context, the framework of counterexamples is configured in the first target prompt structure. The counterexamples can be used to prompt the target large model to clearly state what should not be recognized as entities, thereby helping the model to reduce irrelevant entity recognition when classifying entities and avoid misclassification in the task.
[0091] In an optional embodiment of the present disclosure, the multi-dimensional hierarchical description of the recognition task includes an output format; filling the first target prompt structure to obtain the first target prompt may include: generating the output format content of the target text object according to the output requirements of the target text object; identifying the target text object with specified content in the first target prompt through the target macro model may include: outputting the target text object identified with the specified content in the first target prompt according to the output format specified by the output format content of the target text object through the target macro model.
[0092] In the disclosed embodiment, the framework of the output format can also be configured in the multi-dimensional hierarchical description of the recognition task of the first target prompt structure. Optionally, when it is determined that the counterexample filling is completed, the output format can be filled to generate the output format content. Accordingly, after the target large model receives the first target prompt, the target text object that has been recognized and classified can be output according to the output format content in the output format.
[0093] In a specific example, taking the real estate field as an example, the output format in the first target prompt structure in the real estate field can be filled, such as the content filled in the output format can be "the return result is in the following JSON format: [{
[0094] "Entity":"New Lakeside Industrial Park",
[0095] "Type":"Factory",
[0096] "Modified features": ["Close to subway", "Close to school"]
[0097] }]".
[0098] In a specific example, taking the medical and health field as an example, the output format in the first target prompt structure in the medical and health field can be filled in. For example, the content filled in the output format can be "the return result is in the following JSON format: {'entities':[{'entity':'<entity name>','category':'DIS'}]}".
[0099] In the above example, JSON (JavaScript Object Notation) is a lightweight data exchange format.
[0100] The generation of the target large model depends on the input prompt format. By configuring the output format in the first target prompt structure, structured output requirements can be provided for the target large model, thereby ensuring that the target large model generates expected content. At the same time, limiting the generation scope helps avoid the output of irrelevant information and improves the readability and accuracy of the output results.
[0101] It should be noted that the multidimensional hierarchical description of the recognition task includes structures such as self-check, context guidance, target domain specific prompts, counterexamples, and output formats, and the order thereof in the multidimensional hierarchical description structure of the recognition task can be arranged as needed. For example, it can be configured in the order of step-by-step task description-classification steps-self-check-context guidance-target domain specific prompts-counterexamples-output format, or it can also be arranged as needed according to the importance of each structure in the multidimensional hierarchical description structure of the recognition task. It can be understood that the later the order of the above-mentioned structure in the multidimensional hierarchical description of the recognition task is, the higher the priority of the target large model reference processing is.
[0102] In a specific example, taking the real estate field as an example, in order to output the entities and / or qualifiers of the real estate in the specified data set on demand at one time, the first target prompt can be filled and generated as shown below according to the first target prompt structure:
[0103] Extract entities, types and their modifying features related to real estate from the given corpus CONTENT. For example, the type may be "residential", while the modifying features may include "close to subway" or "close to school".
[0104] Background: In the text of real estate industry, entities with specific modifiers often appear, usually describing the characteristics of location, function, price, etc. The extraction results of these entities and their modified features will be used for statistics and applications such as domain analysis and market forecasting.
[0105] The specific steps include:
[0106] First, identify real estate-related entities in the text, such as school and community names.
[0107] The entity is then classified into real estate project types such as "residential", "commercial property", "office building", etc.
[0108] Thirdly, extract the modified features related to these entities, such as "close to subway", "sea view room" or "reasonable price".
[0109] Finally, each entity is associated with its modified features to form a structured data pair.
[0110] When classifying real estate related entities, only the following categories are considered: residential, commercial property, office buildings, factories, public buildings, business centers.
[0111] When performing tasks, you need to self-check the results:
[0112] First, we need to confirm whether entity extraction accurately identifies real estate-related terms;
[0113] Secondly, we need to ensure whether the extracted modification features truly reflect the description in the text;
[0114] Finally, check whether the association between the entity and the modifying features is appropriate.
[0115] When processing texts, pay attention to descriptive language, especially words related to location, facilities, price, environment, etc. This information is often expressed through adjective phrases or prepositional phrases, and is particularly likely to appear in texts related to real estate.
[0116] Common entities in the real estate field include residential properties, commercial properties, office buildings, office buildings, factories, etc. Modification features are usually related to information such as location, supporting facilities, transportation and price.
[0117] When extracting, common mistakes include extracting "residence" as "subway" or extracting "close to school" as an independent entity. The correct extraction should be "residence" as the entity, and the modified features should be "close to subway" and "close to school".
[0118] The returned result is in the following JSON format: [{
[0119] "Entity":"New Lakeside Industrial Park",
[0120] "Type":"Factory",
[0121] "Modified features": ["Close to subway", "Close to school"]
[0122] }]
[0123] ```{CONTENT}```
[0124] S240: Determine a second target prompt structure in the target text object recognition field.
[0125] The second target prompt structure includes generating task instructions and generating task multi-dimensional hierarchical description instructions.
[0126] The second target prompt structure may be a structure for constructing the second target prompt. The generation task description may be used to describe and define a specific generation task. The generation task multi-dimensional hierarchical description may be a detailed description of a generation task defined from multiple different dimensions, including a multi-level structural layout.
[0127] S250: Fill the second target prompt structure to obtain a second target prompt.
[0128] The second target prompt may be a prompt for inputting into the target macromodel to instruct the target macromodel to output a synonymous text object of the target text object as required. The multi-dimensional hierarchical description of the generated task in the second target prompt includes task description information of different levels in multiple dimensions.
[0129] In the embodiment of the present disclosure, after the first target prompt is input into the target macro model and the target text object of the specified content in the first target prompt is identified by the target macro model, the second target prompt structure in the target text object identification field can also be determined for the target macro model, so as to fill the generated task description and the generated task multi-dimensional hierarchical description in the second target prompt structure in the target text object identification field with content as needed, and obtain the second target prompt. It can be understood that since the generated task multi-dimensional hierarchical description includes the description structure of different levels of multiple dimensions, the data structure of the generated task multi-dimensional hierarchical description in the generated second target prompt can include task description information of different levels of multiple dimensions.
[0130] S260: Input the second target prompt into the target macromodel, and generate a synonymous text object of the target text object according to the second target prompt through the target macromodel.
[0131] The synonymous text object may be a text object such as a synonym or a near synonym of the target text object.
[0132] Correspondingly, after generating the second target prompt, the second target prompt can be input into the target macro model, and a synonymous text object of the target text object can be generated according to the second target prompt through the target macro model. Multiple expressions of entities and / or qualifiers in the target text object recognition field can be generated, thereby enriching the semantic information of the target text object.
[0133] In a specific example, taking medical health as the target text object recognition field, after extracting the entities and / or qualifiers of the specified paragraph through the first prompt, the target text objects such as the entities and / or qualifiers of the specified paragraph extracted through the first prompt can be used to construct the input corpus applicable to the second target prompt, and fill in the second target prompt structure to generate the following second target prompt:
[0134] Task: Please read the content of the following <entity / qualifier> and perform the following tasks. Note that when outputting in JSON format, the key cannot be omitted:
[0135] For each disease name and qualifier in <entity / qualifier>, generate related synonyms and antonyms. For each disease name, please give its common medical synonyms; for each qualifier, please give its common descriptive synonyms or antonyms. If there is no suitable synonym or antonym, please return "None".
[0136] For each disease name and qualifier in <entity / qualifier>, generate related synonyms and antonyms. For each disease name, please give its common medical synonyms; for each qualifier, please give its common descriptive synonyms or antonyms, and list all possible, non-standard expressions. For example, "ALK-negative" can be expanded to "ALK negative", "ALK-negative", "ALK-negative", "ALK negative", etc.
[0137] Please make sure to generate synonyms that cover all possible spellings, hyphenation, capitalization variations, etc. If no synonyms or antonyms are suitable, return "None".
[0138] Please output each disease name and its corresponding synonym, as well as each qualifier and its corresponding synonym in standard JSON format. The output format is {"Disease Name 1":"Synonym 1; Synonym 2;...","Qualifier 1":"Synonym 1; Synonym 2;...","Disease Name 2":"Synonym 1; Synonym 2;...","Qualifier 2":"Synonym 1; Synonym 2;...",...}.
[0139] {Entity / Qualifier}
[0140] In an optional embodiment of the present disclosure, the synonymous text object of the target text object can be applied to one of the following application scenarios: performing specific data statistics on the original document data in the target text object recognition field; training a target recognition model as sample data; the target recognition model is used to recognize the target text object in the target text object recognition field; and serving as reference data to formulate industry standards in the target text object recognition field.
[0141] Among them, the target recognition model can be a model for recognizing the target text object, and its model type can be any available type as long as it can automatically recognize the target text object. The embodiment of the present disclosure does not limit the model type of the target recognition model.
[0142] Specifically, the various expressions of the target text object in the target text object recognition field generated by the target large model can be matched to the standard name of the database of the original information system to obtain the identification of the target text object in the system, which is convenient for subsequent efficient retrieval and statistics, thereby ensuring the accuracy and comprehensiveness of the data stored in the database of the original information system, improving the reference value of the data stored in the database of the original information system, and improving the system processing speed, which is suitable for large-scale data analysis.
[0143] Optionally, the synonymous text objects of the target text objects generated by the target macro model can be used as benchmark data to perform statistics on the target text object data for a large amount of original data in the field of target text object recognition. Alternatively, the synonymous text objects of the target text objects generated by the target macro model can also be used as sample data to train the target recognition model, so that the trained target recognition model has a high-precision recognition function for the target text objects. Alternatively, the synonymous text objects of the target text objects generated by the target macro model can also be used as reference data to formulate industry standards in the field of target text object recognition, etc., thereby improving the efficiency of formulating industry standards and the uniformity of standard data.
[0144] It is understandable that in the related art, for more complex tasks, it is often necessary to input multiple different prompts to the target large model, that is, it is necessary to interact with the target large model multiple times before the target large model can be gradually guided to finally output the target text object including the specified content. This method of outputting the recognized target text object through multiple interactions with the target large model through prompts has problems such as low accuracy and efficiency of target text object recognition.
[0145] The first target prompt generated by the first target prompt structure provided by the embodiment of the present disclosure includes multi-dimensional and multi-level task description information, thereby clarifying the detailed recognition tasks of target text objects such as entities and / or qualifiers from multiple angles, so that the target large model can accurately output the target text objects such as entities and / or qualifiers included in the specified content based on the input first target prompt at one time, that is, through the first target prompt, a single interaction with the target large model can instruct the target large model to accurately output the recognized target text object, which provides a more flexible target text object description extraction capability and can adapt to complex language structures, which not only improves the recognition accuracy of the target text object, but also improves the recognition efficiency of the target text object.
[0146] In the technical solution of the present disclosure, the collection, storage, use, processing, transmission, provision and disclosure of user personal information are in compliance with the relevant laws and regulations and do not violate public order and good morals.
[0147] It should be noted that any arrangement and combination of the technical features in the above embodiments also falls within the protection scope of the present disclosure.
[0148] In one example, Figure 3 This is a structural diagram of a prompt-based text object recognition device provided by an embodiment of the present disclosure. The embodiment of the present disclosure can be applied to the target large model to recognize the target text object on demand according to the prompt language of the task description information including multi-dimensional and different levels. The device is implemented by software and / or hardware and is specifically configured in an electronic device. The electronic device can be a terminal device or a server device. The embodiment of the present disclosure does not limit the specific device type of the electronic device.
[0149] like Figure 3 The prompt-based text object recognition device 300 shown in the figure includes: a first target prompt structure determination module 310, a first target prompt acquisition module 320 and a target text object recognition module 330.
[0150] A first target prompt structure determination module 310 is used to determine a first target prompt structure in the target text object recognition field; wherein the first target prompt structure includes a recognition task description, background content, and a multi-dimensional hierarchical description of the recognition task;
[0151] A first target prompt acquisition module 320 is used to fill the first target prompt structure to obtain a first target prompt; wherein the multi-dimensional hierarchical description of the recognition task in the first target prompt includes task description information of different levels in multiple dimensions;
[0152] The target text object recognition module 330 is used to input the first target prompt into the target macro model, and recognize the target text object of the specified content in the first target prompt through the target macro model; wherein the target text object includes entities and / or qualifiers in the target text object recognition field.
[0153] The disclosed embodiment determines the first target prompt structure in the target text object recognition field, fills the recognition task description, background content, and multi-dimensional hierarchical description of the recognition task in the first target prompt structure, and obtains the first target prompt, thereby inputting the first target prompt into the target macro model, so as to recognize the target text objects such as entities and / or qualifiers of the specified content in the first target prompt through the target macro model. Since the multi-dimensional hierarchical description of the recognition task in the first target prompt includes task description information of different levels in multiple dimensions, the target macro model can be instructed from multiple dimensions to output the target text objects that meet the requirements on demand, which can solve the problem of low accuracy and efficiency of existing text object recognition, and can improve the accuracy and efficiency of text object recognition.
[0154] Optionally, the multi-dimensional hierarchical description of the recognition task includes a step-by-step task description; the step-by-step task description includes multi-level task steps; the first target prompt acquisition module 320 is also used to: when it is determined that the background content is filled in, generate the recognition task description content of the first-level task step in the step-by-step task description; after determining that the recognition task description content of the first-level task step is filled in, generate the recognition result classification marking description content of the second-level task step in the step-by-step task description; the target text object recognition module 330 is also used to: understand the multi-level task steps in sequence through the target large model, and recognize and mark the target text objects included in the specified content in the first target prompt according to the understanding results of each of the multi-level task steps.
[0155] Optionally, the multi-dimensional hierarchical description of the recognition task also includes a classification step; the first target prompt acquisition module 320 is also used to: when it is determined that the step-by-step task description is completed, generate the classification step content of the entity; wherein the classification step content of the entity is used to indicate the classification method of the entity; the target text object recognition module 330 is also used to: classify the marked entities according to the classification step content of the entity through the target large model.
[0156] Optionally, the multi-dimensional hierarchical description of the recognition task includes self-checking; the first target prompt acquisition module 320 is also used to: generate self-checking content; wherein the self-checking content is used to instruct the target macro model to perform a self-check on the recognition and classification results of the target text object; the target text object recognition module 330 is also used to: respond to the self-checking content through the target macro model to review and verify the classified target text object.
[0157] Optionally, the multi-dimensional hierarchical description of the recognition task includes context guidance; the first target prompt acquisition module 320 is also used to: generate context guidance content; wherein the context guidance content is used to instruct the target macro model to distinguish the meanings of different target text objects; the target text object recognition module 330 is also used to: identify and delete misclassified text objects in the target text objects after review and verification based on the context guidance content through the target macro model.
[0158] Optionally, the multi-dimensional hierarchical description of the recognition task includes target domain-specific prompts; the first target prompt acquisition module 320 is also used to: generate target domain-specific prompt content based on the domain knowledge of the target text object recognition field; wherein the target domain-specific prompt content is used to activate the reasoning ability of the target macro model; the target text object recognition module 330 is also used to: obtain the target domain knowledge of the target text object recognition field according to the target domain-specific prompt content through the target macro model, and perform refined recognition of the target text object included in the specified content in the first target prompt based on the target domain knowledge.
[0159] Optionally, the multi-dimensional hierarchical description of the recognition task includes counterexamples; the first target prompt acquisition module 320 is also used to: generate target field counterexample content based on special scenario knowledge in the target text object recognition field; the target text object recognition module 330 is also used to: delete non-relevant target text objects included in the specified content in the first target prompt according to the target field counterexample content through the target macro model.
[0160] Optionally, the multi-dimensional hierarchical description of the recognition task includes an output format; the first target prompt acquisition module 320 is also used to: generate the output format content of the target text object according to the output requirements of the target text object; the target text object recognition module 330 is also used to: output the target text object recognized for the specified content in the first target prompt according to the output format specified by the output format content of the target text object through the target macro model.
[0161] Optionally, the above-mentioned device also includes: a second target prompt structure determination module, which is used to determine the second target prompt structure in the target text object recognition field; wherein the second target prompt structure includes a generation task description and a multi-dimensional hierarchical description of the generation task; a second target prompt acquisition module, which is used to fill in the second target prompt structure to obtain a second target prompt; wherein the multi-dimensional hierarchical description of the generation task in the second target prompt includes task description information at different levels of multiple dimensions; a synonymous text object generation module, which is used to input the second target prompt into the target macro model, and generate a synonymous text object of the target text object according to the second target prompt through the target macro model.
[0162] Optionally, the synonymous text object of the target text object is applied to one of the following application scenarios: performing specific data statistics on original document data in the target text object recognition field; training a target recognition model as sample data; using the target recognition model to recognize target text objects in the target text object recognition field; and formulating industry standards in the target text object recognition field as reference data.
[0163] The above-mentioned prompt-based text object recognition device can execute the prompt-based text object recognition method provided by any embodiment of the present disclosure, and has the corresponding functional modules and beneficial effects of the execution method. For technical details not fully described in this embodiment, please refer to the prompt-based text object recognition method provided by any embodiment of the present disclosure.
[0164] Since the above-mentioned prompt-based text object recognition device is a device that can execute the prompt-based text object recognition method in the embodiment of the present disclosure, based on the prompt-based text object recognition method introduced in the embodiment of the present disclosure, the technical personnel in the field can understand the specific implementation of the prompt-based text object recognition device of the present embodiment and its various variations, so how the prompt-based text object recognition device implements the prompt-based text object recognition method in the embodiment of the present disclosure will not be described in detail here. As long as the technical personnel in the field implement the device adopted by the prompt-based text object recognition method in the embodiment of the present disclosure, it belongs to the scope of protection of the present disclosure.
[0165] In one example, the present disclosure also provides an electronic device, a readable storage medium, and a computer program product.
[0166] Figure 4 A schematic block diagram of an example electronic device 400 that can be used to implement an embodiment of the present disclosure is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present disclosure described and / or required herein.
[0167] like Figure 4As shown, the device 400 includes a computing unit 401, which can perform various appropriate actions and processes according to a computer program stored in a read-only memory (ROM) 402 or a computer program loaded from a storage unit 408 into a random access memory (RAM) 403. In the RAM 403, various programs and data required for the operation of the device 400 can also be stored. The computing unit 401, the ROM 402, and the RAM 403 are connected to each other via a bus 404. An input / output (I / O) interface 405 is also connected to the bus 404.
[0168] A number of components in the device 400 are connected to the I / O interface 405, including: an input unit 406, such as a keyboard, a mouse, etc.; an output unit 407, such as various types of displays, speakers, etc.; a storage unit 408, such as a disk, an optical disk, etc.; and a communication unit 409, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 409 allows the device 400 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks.
[0169] The computing unit 401 may be a variety of general and / or special processing components with processing and computing capabilities. Some examples of the computing unit 401 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special artificial intelligence (AI) computing chips, various computing units running machine learning model algorithms, a digital signal processor (DSP), and any appropriate processor, controller, microcontroller, etc. The computing unit 401 performs the various methods and processes described above, such as the prompt-based text object recognition method.
[0170] For example, in some embodiments, the prompt-based text object recognition method can be implemented as a computer software program, which is tangibly contained in a machine-readable medium, such as storage unit 408. In some embodiments, part or all of the computer program can be loaded and / or installed on device 400 via ROM 402 and / or communication unit 409. When the computer program is loaded into RAM 403 and executed by computing unit 401, one or more steps of the prompt-based text object recognition method described above can be performed. Alternatively, in other embodiments, computing unit 401 can be configured to perform the prompt-based text object recognition method in any other suitable manner (e.g., by means of firmware).
[0171] Various implementations of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), complex programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various implementations can include: being implemented in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.
[0172] The program code for implementing the method of the present disclosure may be written in any combination of one or more programming languages. These program codes may be provided to a processor or controller of a general-purpose computer, a special-purpose computer, or other programmable data processing device, so that the program code, when executed by the processor or controller, enables the functions / operations specified in the flow chart and / or block diagram to be implemented. The program code may be executed entirely on the machine, partially on the machine, partially on the machine and partially on a remote machine as a stand-alone software package, or entirely on a remote machine or server.
[0173] In the context of the present disclosure, a machine-readable medium may be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, device, or equipment. A machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or equipment, or any suitable combination of the foregoing. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
[0174] To provide interaction with a user, the systems and techniques described herein can be implemented on a computer having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and pointing device (e.g., a mouse or trackball) through which the user can provide input to the computer. Other types of devices can also be used to provide interaction with the user; for example, the feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including acoustic input, voice input, or tactile input).
[0175] The systems and techniques described herein may be implemented in a computing system that includes backend components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes frontend components (e.g., a user computer with a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such backend components, middleware components, or frontend components. The components of the system may be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: a local area network (LAN), a wide area network (WAN), a blockchain network, and the Internet.
[0176] A computer system may include a client and a server. The client and the server are generally remote from each other and usually interact through a communication network. The relationship between the client and the server is generated by computer programs running on the corresponding computers and having a client-server relationship with each other. The server may be a cloud server, also known as a cloud computing server or cloud host, which is a host product in the cloud computing service system to solve the defects of difficult management and weak business scalability in traditional physical hosts and VPS services. The server can also be a server of a distributed system, or a server combined with a blockchain.
[0177] The disclosed embodiment determines the first target prompt structure in the target text object recognition field, fills the recognition task description, background content, and multi-dimensional hierarchical description of the recognition task in the first target prompt structure, and obtains the first target prompt, thereby inputting the first target prompt into the target macro model, so as to recognize the target text objects such as entities and / or qualifiers of the specified content in the first target prompt through the target macro model. Since the multi-dimensional hierarchical description of the recognition task in the first target prompt includes task description information of different levels in multiple dimensions, the target macro model can be instructed from multiple dimensions to output the target text objects that meet the requirements on demand, which can solve the problem of low accuracy and efficiency of existing text object recognition, and can improve the accuracy and efficiency of text object recognition.
[0178] It should be understood that the various forms of processes shown above can be used to reorder, add or delete steps. For example, the steps recorded in this disclosure can be executed in parallel, sequentially or in different orders, as long as the desired results of the technical solutions disclosed in this disclosure can be achieved, and this document does not limit this.
[0179] The above specific implementations do not constitute a limitation on the protection scope of the present disclosure. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions can be made according to design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present disclosure shall be included in the protection scope of the present disclosure.
Claims
1. A prompt-based text object recognition method, comprising: Determine a first target prompt structure in the target text object recognition field; wherein the first target prompt structure includes a recognition task description, background content, and a multi-dimensional hierarchical description of the recognition task; Filling the first target prompt structure to obtain a first target prompt; wherein the multi-dimensional hierarchical description of the recognition task in the first target prompt includes task description information of different levels in multiple dimensions; The first target prompt is input into a target macromodel, and a target text object of the content specified in the first target prompt is identified through the target macromodel; wherein the target text object includes entities and / or qualifiers in the target text object identification field.
2. The method according to claim 1, wherein: The multi-dimensional hierarchical description of the recognition task includes a step-by-step task description; the step-by-step task description includes multi-level task steps; the filling of the first target prompt structure to obtain the first target prompt includes: When it is determined that the background content is filled, generating identification task description content of the first-level task steps in the step-by-step task description; After determining that the identification task description content of the first-level task step is filled, generating the identification result classification mark description content of the second-level task step in the step-by-step task description; The step of identifying the target text object of the specified content in the first target prompt by using the target macro model includes: The multi-level task steps are understood in sequence through the target macro model, and the target text objects included in the specified content in the first target prompt are identified and marked according to the understanding results of each of the multi-level task steps.
3. The method according to claim 2, wherein: The multi-dimensional hierarchical description of the recognition task also includes a classification step; the filling of the first target prompt structure to obtain the first target prompt includes: When it is determined that the step-by-step task description is completed, generating the classification step content of the entity; wherein the classification step content of the entity is used to indicate the classification method of the entity; The step of identifying the target text object of the specified content in the first target prompt by using the target macro model includes: The marked entities are classified according to the classification step contents of the entities through the target macro model.
4. The method according to claim 3, wherein: The multi-dimensional hierarchical description of the recognition task includes self-examination; the filling of the first target prompt structure to obtain the first target prompt includes: Generate self-check content; wherein the self-check content is used to instruct the target large model to perform a self-check on the recognition and classification results of the target text object; After identifying the target text object of the specified content in the first target prompt by the target macro model, the method further includes: The target macro model responds to the self-check content to review and verify the classified target text object.
5. The method according to claim 3, wherein: The multi-dimensional hierarchical description of the recognition task includes context guidance; the filling of the first target prompt structure to obtain the first target prompt includes: Generate context guidance content; wherein the context guidance content is used to instruct the target macro model to distinguish the meanings of different target text objects; After identifying the target text object of the specified content in the first target prompt by the target macro model, the method further includes: The target macromodel is used to identify and delete misclassified text objects in the target text objects after review and verification according to the context guidance content.
6. The method according to claim 3, wherein: The multi-dimensional hierarchical description of the recognition task includes target domain specific prompts; The step of filling the first target prompt structure to obtain the first target prompt includes: Generate target domain specific prompt content according to the domain knowledge of the target text object recognition domain; wherein the target domain specific prompt content is used to activate the reasoning ability of the target large model; The step of identifying the target text object of the specified content in the first target prompt by using the target macro model includes: The target domain knowledge of the target text object recognition field is acquired through the target macro model according to the target domain specific prompt content, and the target text object included in the specified content in the first target prompt is refined and recognized according to the target domain knowledge.
7. The method according to claim 3, wherein: The multi-dimensional hierarchical description of the recognition task includes a counterexample; the filling of the first target prompt structure to obtain the first target prompt includes: Generate target domain counterexample content based on special scenario knowledge in the target text object recognition field; The step of identifying the target text object of the specified content in the first target prompt by using the target macro model includes: The non-relevant target text objects included in the specified content in the first target prompt are deleted through the target macro model according to the counterexample content in the target domain.
8. The method according to claim 3, wherein: The multi-dimensional hierarchical description of the recognition task includes an output format; the filling of the first target prompt structure to obtain the first target prompt includes: Generate output format content of the target text object according to the output requirement of the target text object; The step of identifying the target text object of the specified content in the first target prompt by using the target macro model includes: The target text object identified from the specified content in the first target prompt is outputted through the target macro model in accordance with the output format specified by the output format content of the target text object.
9. The method according to claim 1, further comprising: Determine a second target prompt structure in the target text object recognition field; wherein the second target prompt structure includes a generation task description and a generation task multi-dimensional hierarchical description; Filling the second target prompt structure to obtain a second target prompt; wherein the multi-dimensional hierarchical description of the generated task in the second target prompt includes task description information of different levels in multiple dimensions; The second target prompt is input into the target macro model, and a synonymous text object of the target text object is generated according to the second target prompt by the target macro model.
10. The method according to claim 9, wherein: The synonymous text object of the target text object is applied to one of the following application scenarios: Performing specific data statistics on the original document data in the target text object recognition field; as sample data to train a target recognition model; the target recognition model is used to recognize the target text object in the target text object recognition field; The industry standard in the target text object recognition field is formulated as reference data.
11. A prompt-based text object recognition device, comprising: A first target prompt structure determination module, used to determine a first target prompt structure in the target text object recognition field; wherein the first target prompt structure includes a recognition task description, background content, and a multi-dimensional hierarchical description of the recognition task; A first target prompt acquisition module is used to fill the first target prompt structure to obtain a first target prompt; wherein the multi-dimensional hierarchical description of the recognition task in the first target prompt includes task description information of different levels in multiple dimensions; A target text object recognition module is used to input the first target prompt into a target macro model, and recognize the target text object of the specified content in the first target prompt through the target macro model; wherein the target text object includes entities and / or qualifiers in the target text object recognition field.
12. The device according to claim 11, wherein: The multi-dimensional hierarchical description of the recognition task includes a step-by-step task description; the step-by-step task description includes multi-level task steps; the first target prompt acquisition module is also used to: When it is determined that the background content is filled, generating identification task description content of the first-level task steps in the step-by-step task description; After determining that the identification task description content of the first-level task step is filled, generating the identification result classification mark description content of the second-level task step in the step-by-step task description; The target text object recognition module is also used to understand the multi-level task steps in sequence through the target large model, and recognize and mark the target text objects included in the specified content in the first target prompt according to the understanding results of each multi-level task step.
13. The device according to claim 12, wherein: The multi-dimensional hierarchical description of the recognition task also includes a classification step; the first target prompt acquisition module is also used to: When it is determined that the step-by-step task description is completed, generating the classification step content of the entity; wherein the classification step content of the entity is used to indicate the classification method of the entity; The target text object recognition module is also used to classify the marked entities according to the classification step content of the entities through the target large model.
14. The device according to claim 13, wherein: The multi-dimensional hierarchical description of the recognition task includes self-examination; the first target prompt acquisition module is also used for: Generate self-check content; wherein the self-check content is used to instruct the target large model to perform a self-check on the recognition and classification results of the target text object; The target text object identification module is also used to: respond to the self-check content through the target macro model to review and verify the classified target text object.
15. The device according to claim 13, wherein: The multi-dimensional hierarchical description of the recognition task includes context guidance; the first target prompt acquisition module is also used for: Generate context guidance content; wherein the context guidance content is used to instruct the target macro model to distinguish the meanings of different target text objects; The target text object recognition module is also used for: The target macromodel is used to identify and delete misclassified text objects in the target text objects after review and verification according to the context guidance content.
16. The device according to claim 13, wherein: The multi-dimensional hierarchical description of the recognition task includes target domain specific prompts; the first target prompt acquisition module is also used to: Generate target domain specific prompt content according to the domain knowledge of the target text object recognition domain; wherein the target domain specific prompt content is used to activate the reasoning ability of the target large model; The target text object recognition module is also used to: obtain the target domain knowledge of the target text object recognition field according to the target domain specific prompt content through the target large model, and perform detailed recognition of the target text object included in the specified content in the first target prompt according to the target domain knowledge.
17. The device according to claim 13, wherein: The multi-dimensional hierarchical description of the recognition task includes counterexamples; the first target prompt acquisition module is also used to: generate target field counterexample content based on special scene knowledge in the target text object recognition field; The target text object recognition module is also used for: The non-relevant target text objects included in the specified content in the first target prompt are deleted through the target macro model according to the counterexample content in the target domain.
18. The device according to claim 13, wherein: The multi-dimensional hierarchical description of the recognition task includes an output format; the first target prompt acquisition module is also used to: Generate output format content of the target text object according to the output requirement of the target text object; The target text object recognition module is also used to: output the target text object recognized from the specified content in the first target prompt through the target macro model according to the output format specified by the output format content of the target text object.
19. The apparatus according to claim 11, further comprising: A second target prompt structure determination module is used to determine a second target prompt structure in the target text object recognition field; wherein the second target prompt structure includes a generation task description and a generation task multi-dimensional hierarchical description description; A second target prompt acquisition module is used to fill the second target prompt structure to obtain a second target prompt; wherein the multi-dimensional hierarchical description of the generated task in the second target prompt includes task description information of different levels in multiple dimensions; The synonymous text object generation module is used to input the second target prompt into the target macro model, and generate a synonymous text object of the target text object according to the second target prompt through the target macro model.
20. The device according to claim 19, wherein The synonymous text object of the target text object is applied to one of the following application scenarios: Performing specific data statistics on the original document data in the target text object recognition field; as sample data to train a target recognition model; the target recognition model is used to recognize the target text object in the target text object recognition field; The industry standard in the target text object recognition field is formulated as reference data.
21. An electronic device comprising: at least one processor; as well as a memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the prompt-based text object recognition method according to any one of claims 1 to 10.
22. A non-transitory computer-readable storage medium storing computer instructions, wherein the computer instructions are used to cause a computer to execute the prompt-based text object recognition method according to any one of claims 1 to 10.
23. A computer program product comprising a computer program / instructions, wherein: When the computer program / instruction is executed by a processor, the prompt-based text object recognition method described in any one of claims 1 to 10 is implemented.