Method and device for generating a pharmacological information extraction template

CN117312488BActive Publication Date: 2026-08-18BEIJING JINGDONG TUOXIAN TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202210694996.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-06-20
Publication Date
2026-08-18
Estimated Expiration
2042-06-20

AI Technical Summary

Technical Problem

[0003]对于前一方法,其信息抽取准确率高,但是由于自然语言的灵活性,需要人工编写和维护大量的规则模板,使得人工工作量较大,如果规则模板数量不足,则无法保证召回率

Benefits of technology

[0021] First, an existing and usable initial template for information extraction is obtained. Then, it is broken down into multiple components belonging to preset types to form multiple template units. Finally, these template units are rearranged in any random order or a random order under preset sorting rules, and one or more separator characters can be inserted to obtain multiple new templates. Finally, by judging the similarity between the new template and the initial template in the same corpus, the usable target templates in the new templates can be filtered out. In this way, a large number of usable templates can be generated quickly in an automated program, which can simultaneously ensure the accuracy and recall of the information extraction task and the low manual workload of template writing and maintenance.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117312488B_ABST
    Figure CN117312488B_ABST
Patent Text Reader

Abstract

The application discloses a kind of generation method and device of pharmaceutical information extraction template, it is related to natural language processing technical field.The specific embodiment of the method includes: obtaining at least one initial template for information extraction;Wherein, each initial template contains multiple components belonging to preset type, the component is at least one in matching symbol and fixed word, the preset type includes at least one in entity type and relationship type;Determine multiple template units according to the component in any initial template;With multiple preset sequences, form multiple new templates corresponding to the initial template for the multiple template units determined.This embodiment can automatically generate multiple new templates according to existing initial template to execute information extraction, so as to improve information extraction recall rate in the case of ensuring information extraction accuracy and not increasing artificial workload.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of natural language processing technology, and in particular to a method and apparatus for generating information extraction templates. Background Technology

[0002] Information extraction can currently be applied to the processing of various types of information, such as textual information in the pharmaceutical field (e.g., drug instructions, drug documents, etc.). Information extraction refers to extracting specific event or factual information from natural language text to help automatically classify, extract, and reconstruct massive amounts of content. This information typically includes entities, relations, and events. Currently, information extraction technology mainly focuses on two directions: template matching-based methods and deep learning-based methods.

[0003] The former method boasts high information extraction accuracy, but due to the flexibility of natural language, it requires the manual writing and maintenance of a large number of rule templates, resulting in a significant workload. Insufficient rule templates further complicate the recall rate. The latter method suffers from slightly lower interpretability of deep learning models, making it difficult to fine-tune for specific results; improvements are limited to statistical levels. Furthermore, current deep learning models do not yet achieve the practical accuracy required for some classic natural language understanding tasks (such as entity extraction and relation extraction). Summary of the Invention

[0004] In view of this, embodiments of the present invention provide a method and apparatus for generating information extraction templates, which can automatically generate multiple new templates based on existing initial templates to perform information extraction, thereby improving the information extraction recall rate while ensuring the accuracy of information extraction and without increasing the amount of manual work.

[0005] To achieve the above objectives, according to one aspect of the present invention, a method for generating an information extraction template is provided.

[0006] The method for generating an information extraction template according to an embodiment of the present invention includes: obtaining at least one initial template for information extraction; wherein each initial template contains multiple components belonging to a preset type, the components being at least one of matching symbols and fixed words, and the preset type including at least one of entity type and relation type; determining multiple template units based on the components in any initial template; arranging the determined multiple template units in multiple preset orders to form multiple new templates corresponding to the initial template.

[0007] Optionally, determining multiple template units based on the components in any initial template includes: determining each matching symbol in the initial template as a template unit; for a fixed word in the initial template belonging to any preset type: determining the fixed word as a template unit, or generating a matching symbol belonging to the preset type and determining the matching symbol as a template unit.

[0008] Optionally, the preset order is either any random order among the plurality of template units, or a random order among the plurality of template units that conforms to a preset sorting rule.

[0009] Optionally, arranging the determined multiple template units in multiple preset orders to form multiple new templates corresponding to the initial template includes: arranging the multiple template units in a preset order; inserting at least one spacer character between adjacent template units to form a new template; wherein the spacer character is used to match characters in the text to be extracted that do not belong to the preset type.

[0010] Optionally, the method further includes: after forming a plurality of new templates corresponding to the initial template, for any new template: obtaining matching texts of the new template and the initial template in the same preset corpus, calculating the similarity between each matching text of the new template and each matching text of the initial template; and when the average value of the similarity meets a preset similarity condition, determining the new template as the target template.

[0011] Optionally, the method further includes: after forming a plurality of new templates corresponding to the initial template, for any new template: obtaining matching texts of the new template and the initial template in the same preset corpus; when the quotient of the number of matching texts of the new template and the number of matching texts of the initial template is greater than a preset first threshold, calculating the similarity between each matching text of the new template and each matching text of the initial template; when the average value of the similarity meets a preset similarity condition, determining the new template as the target template.

[0012] Optionally, the spacing character has a character limit; the similarity condition includes: the average similarity is greater than a preset second threshold; the information extraction includes entity extraction and relation extraction.

[0013] To achieve the above objectives, according to another aspect of the present invention, an apparatus for generating information extraction templates is provided.

[0014] The information extraction template generation apparatus of this invention may include: an initial template acquisition unit, configured to: acquire at least one initial template for information extraction; wherein each initial template contains multiple components belonging to a preset type, the components being at least one of matching symbols and fixed words, and the preset type including at least one of entity type and relation type; and a new template generation unit, configured to determine multiple template units based on the components in any initial template; and arrange the determined multiple template units in multiple preset orders to form multiple new templates corresponding to the initial template.

[0015] Optionally, the preset order is: any random order among the multiple template units, or a random order among the multiple template units that conforms to a preset sorting rule; the new template generation unit is further configured to: determine each matching symbol in the initial template as a template unit; for a fixed word in the initial template belonging to any preset type: determine the fixed word as a template unit, or generate a matching symbol belonging to the preset type and determine the matching symbol as a template unit; arrange the multiple template units in a preset order; insert at least one separator character between adjacent template units to form a new template; wherein, the separator character is used to match text to be extracted that does not belong to the preset type. The device further includes a target template generation unit, configured to: acquire matching texts of the new template and the initial template in the same preset corpus; calculate the similarity between each matching text of the new template and each matching text of the initial template; determine the new template as a target template when the average similarity meets a preset similarity condition; or, acquire matching texts of the new template and the initial template in the same preset corpus; calculate the similarity between each matching text of the new template and each matching text of the initial template when the quotient of the number of matching texts of the new template and the number of matching texts of the initial template is greater than a preset first threshold; determine the new template as a target template when the average similarity meets a preset similarity condition.

[0016] To achieve the above objectives, according to another aspect of the present invention, an electronic device is provided.

[0017] An electronic device according to the present invention includes: one or more processors; and a storage device for storing one or more programs, wherein when the one or more programs are executed by the one or more processors, the one or more processors implement the method for generating information extraction templates provided by the present invention.

[0018] To achieve the above objectives, according to another aspect of the present invention, a computer-readable storage medium is provided.

[0019] The present invention provides a computer-readable storage medium having a computer program stored thereon, wherein the program, when executed by a processor, implements the method for generating information extraction templates provided by the present invention.

[0020] According to the technical solution of the present invention, the embodiments described above have the following advantages or beneficial effects:

[0021] First, an existing and usable initial template for information extraction is obtained. Then, it is broken down into multiple components belonging to preset types to form multiple template units. Finally, these template units are rearranged in any random order or a random order under preset sorting rules, and one or more separator characters can be inserted to obtain multiple new templates. Finally, by judging the similarity between the new template and the initial template in the same corpus, the usable target templates in the new templates can be filtered out. In this way, a large number of usable templates can be generated quickly in an automated program, which can simultaneously ensure the accuracy and recall of the information extraction task and the low manual workload of template writing and maintenance.

[0022] The further effects of the aforementioned unconventional alternative methods will be explained below in conjunction with specific implementation methods. Attached Figure Description

[0023] The accompanying drawings are provided to better understand the invention and are not intended to unduly limit the scope of the invention. Wherein:

[0024] Figure 1 This is a schematic diagram of the main steps of the method for generating information extraction templates in an embodiment of the present invention;

[0025] Figure 2 This is a schematic diagram illustrating the specific execution steps of the method for generating the information extraction template in an embodiment of the present invention;

[0026] Figure 3 This is a schematic diagram of the components of the information extraction template generation device in an embodiment of the present invention;

[0027] Figure 4 This is an exemplary system architecture diagram that can be applied thereto according to embodiments of the present invention;

[0028] Figure 5 This is a schematic diagram of the electronic device structure used to implement the information extraction template generation method in the embodiments of the present invention. Detailed Implementation

[0029] The following description, in conjunction with the accompanying drawings, illustrates exemplary embodiments of the present invention, including various details to aid understanding. These details should be considered merely exemplary. Therefore, those skilled in the art will recognize that various changes and modifications can be made to the embodiments described herein without departing from the scope and spirit of the invention. Similarly, for clarity and brevity, descriptions of well-known functions and structures are omitted in the following description.

[0030] Natural Language Processing (NLP) is a general term for various theories and methods for enabling effective communication between humans and computers using natural language. Among them, Information Extraction is an important branch of the field of NLP. It is a text processing technique that extracts factual information such as entities, relations, and events of a specified type from natural language text and forms structured data output. Information extraction mainly includes three sub-tasks: entity extraction (i.e., named entity recognition), relation extraction, and event extraction. The following uses entity extraction and relation extraction as examples to illustrate the technical solution of this invention.

[0031] Entity extraction is used to detect entity boundaries and corresponding entity types in natural language text, and is the foundation of text meaning understanding. The entities mentioned above are generally words composed of at least one character, and the entity types can be preset types such as personal names, place names, and organization names. It should be noted that the characters in this embodiment can be Chinese characters or words in a phonetic language, and the words in this embodiment can be Chinese phrases or phrases composed of at least one word in a phonetic language. The following explanation uses Chinese as an example.

[0032] Relation extraction, also known as triple extraction (a triple includes a subject, an object, and the relationship between them), is used to determine the semantic relationship between two entities in natural language text. In this embodiment of the invention, the relation type and the above entity types can be collectively referred to as preset types, that is, types that are pre-set and stored.

[0033] Currently, information extraction technology mainly focuses on two directions: template matching-based methods and deep learning-based methods. For deep learning-based methods, on the one hand, their interpretability is somewhat poor, making it difficult to optimize for specific results and only allowing for statistical improvements; on the other hand, the accuracy of current deep learning models in classic natural language understanding tasks such as entity extraction and relation extraction does not yet meet practical requirements.

[0034] Template matching-based information extraction methods summarize the patterns of natural language and create rule templates with specific rules, enabling computers to understand the corresponding text. For example, the template "{specific population} takes {medicine} at a dose of {weight}" can be used to match natural language text such as "the elderly take painkillers at a dose of 0.5g" and convert it into structured data. In the above template, each "{}" is a matching symbol belonging to a preset type. For example, {specific population} corresponds to the entity type "specific population", {medicine} corresponds to the entity type "medicine", and {weight} corresponds to the entity type "weight". Besides the matching symbols, the template above also contains words such as "take," "of," "dosage," "is," "one," and "time." Generally, these words or phrases other than the matching symbols can be divided into two types: one belongs to a preset type, for example, "one" in the template above belongs to the entity type "number," and this type of word or phrase can be called a fixed word; the other does not belong to a preset type, for example, "take" in the template above does not belong to any preset type, and this type of word or phrase can be called a spaced word or an unmatched word. In the embodiments of the present invention, the matching symbols and the fixed words mentioned above can be referred to as components of the template.

[0035] When using template matching to extract natural language text (hereinafter referred to as the text to be extracted), the matching symbols can match any character or word of the corresponding preset type. Fixed words and spacers need to appear in the corresponding positions of the text to be matched. Finally, after a successful match, entities in the text can be extracted. For example, after matching the text "The dosage of painkillers for the elderly is 0.5g at a time" using the above template, the matching symbols can be used to extract the entity type "elderly" belonging to "specific population", "painkillers" belonging to the entity type "medicine", and "0.5g" belonging to the entity type "weight". The above example is an entity extraction template. Similarly, for relation extraction templates such as "{medicine}{use level}for {disease}", it can match text such as "gastrointestinal tablets can be used for stomach acid", and can extract the entity type "gastrointestinal tablets" belonging to "medicine", "can" belonging to the relation type "use level", and "stomach acid" belonging to the entity type "disease". It should be noted that this article mainly uses pharmaceutical texts as examples for illustration, but this does not limit the information extraction scenarios of this invention.

[0036] Existing template-matching-based information extraction methods offer high accuracy, but due to the flexibility of natural language, they require significant manual effort to write and maintain numerous templates to ensure high recall, making it difficult to balance high recall with low manual workload. This invention addresses this problem. It should be noted that, unless otherwise specified, the embodiments of this invention and their technical features can be combined with each other.

[0037] Figure 1 It is a schematic diagram of the main steps of the method for generating an information extraction template in an embodiment of the present invention.

[0038] Such as Figure 1 As shown, the method for generating an information extraction template in an embodiment of the present invention can be specifically executed according to the following steps:

[0039] Step S101: Obtain at least one initial template for information extraction.

[0040] In this step, first obtain one or more initial templates for processing the current information extraction task. The above initial templates refer to valid templates that can be used, and are generally templates written manually. It can be understood that each initial template can be split into multiple components belonging to a preset type through a known text segmentation method. The above components can be matching symbols or fixed words, and the above preset types can include entity types or relationship types.

[0041] Step S102: Determine multiple template units according to the components in any one of the initial templates; arrange the determined multiple template units in multiple preset orders to form multiple new templates corresponding to the initial template.

[0042] In this step, first determine multiple template units according to the components of the initial template. The template unit is used to combine into a new template. In practical applications, there are two ways to determine the template unit. In the first way, for each matching symbol in the initial template, directly determine the matching symbol as a template unit; for each fixed word in the initial template, directly determine the fixed word as a template unit. In another more optimal way, for each matching symbol in the initial template, directly determine the matching symbol as a template unit; for any fixed word belonging to any preset type in the initial template, generate a matching symbol belonging to the preset type and determine the matching symbol as a template unit.

[0043] That is to say, for matching symbols, there is no difference between the two ways, and both directly use them as template units. However, for fixed words, in the first way, directly use them as template units, and in the second way, use the matching symbols corresponding to the preset types to which they belong as template units. Obviously, the new templates constructed by the matching symbols generated in the second way have stronger text matching performance than the new templates constructed by the corresponding fixed words. For example, for the fixed word "one" in the foregoing template "{Specific population} takes the dose of {Drug} once {Weight}", in the first way, directly use "one" as a template unit, and in the second way, generate the matching symbol {Number} corresponding to the entity type "number" to which "one" belongs as a template unit.

[0044] Subsequently, multiple template units determined from any initial template can be arranged in various preset orders to form multiple new templates generated from that initial template. Preferably, the preset order can be a random order among the multiple template units, that is, arranging the template units in a random order to form new templates. It can be understood that if the number of template units is m, then the number of different arrangements is m!. In specific applications, the preset order can also be a random order that satisfies preset sorting rules. These sorting rules can be formulated as needed after considering factors such as the mutual influence between the entity types of each template unit, for example, "specific groups of people and numbers cannot be adjacent" or "numbers must be adjacent to weights," etc.

[0045] In this embodiment of the invention, each template unit, after being arranged in the above manner, can be directly used as a new template. Considering that natural language text often contains spacers at various positions (the meaning of spacers in text is similar to that of spacers in templates, referring to characters or words that do not belong to a preset type), at least one spacer character can be inserted between adjacent template units to form a new template. The spacer character is used to match characters or words in the text to be extracted that do not belong to a preset type. For example, B followed by a sequence number can be used as the spacer character. The spacer character can have a character count limit; for example, B2[1:5] represents the second spacer character in the new template, and the number of spacers is between 1 and 5. It can be understood that a character count limit starting from zero can also cover the case where there is no spacer character at the current position.

[0046] In this way, multiple new templates can be generated from an initial template. In the case of random arrangement, there are m! possible arrangements of an initial template containing m template units. Each arrangement can form multiple new templates by inserting different numbers, positions, and word count limits of spacers. Ultimately, a considerable number of new templates can be generated from an initial template. The steps of segmenting the components, determining and arranging template units, and inserting spacers can all be automated. This enables the rapid generation of a large number of usable templates, which helps to ensure the accuracy and recall of information extraction tasks while reducing the manual workload of template writing and maintenance.

[0047] Since invalid templates may exist among the new templates generated using the above methods, filtering is necessary to obtain usable target templates. In an alternative technical solution, considering that the initial templates are generally manually written and have high accuracy and text matching performance, the usability of a new template can be detected by comparing the performance of the initial template with that of each new template it generates. In practical applications, this can be done in the following two ways.

[0048] In the first approach, matching texts of the new template to be detected and the initial template that generated it are first obtained from a pre-defined corpus. Then, the similarity between each matching text of the new template and each matching text of the initial template is calculated. It can be understood that calculating the similarity between two texts can be based on known text feature extraction and similarity calculation methods; the similarity can be any applicable form such as cosine similarity or Pearson correlation coefficient. Finally, it is determined whether the average of the above similarities meets a pre-defined similarity condition, such as whether it is greater than a pre-defined second threshold. If yes, it means that the text matched by the new template is sufficiently similar to the initial template, and the new template is identified as the target template; otherwise, it means that the accuracy of the new template is insufficient, and the new template is discarded. This approach primarily evaluates the accuracy of detecting new templates.

[0049] In the second approach, precision and recall are combined as evaluation metrics for new templates. Specifically, firstly, matching texts of the new template to be detected and the initial template that generated it are obtained from the same preset corpus. Then, it is determined whether the new template has matched enough texts. If so, a precision test similar to the previous approach is performed; otherwise, it is discarded. Optionally, it is determined whether the quotient of the number of matching texts of the new template and the number of matching texts of the initial template is greater than a preset first threshold. If not, the new template is discarded; if so, the similarity between each matching text of the new template and each matching text of the initial template is further calculated. If the average similarity meets the similarity condition, the new template is identified as the target template; if the average similarity does not meet the preset similarity condition, the new template is discarded. It can be understood that in the second approach, precision testing can be performed first, followed by recall testing, which can also effectively filter out target templates.

[0050] In this way, a large number of usable target templates can be obtained through automated programs, enabling template matching-based information extraction methods to simultaneously achieve high accuracy and recall in information extraction tasks, as well as low manual workload in template writing and maintenance.

[0051] Figure 2 This is a schematic diagram illustrating the specific execution steps of the method for generating information extraction templates in an embodiment of the present invention. See [link / reference]. Figure 2In step S201, one or more initial templates are obtained. In step S202, any initial template is split into multiple components. In step S203, a template unit is determined based on each component. In step S204, the template units are arranged in a random order or a random order under a preset sorting rule. In step S205, a separator character is inserted. In step S206, multiple new templates are generated. In step S207, the matching texts of the new template to be detected and the initial template that generated the new template are obtained in the same preset corpus. In step S208, it is determined whether the quotient of the number of matching texts of the new template and the number of matching texts of the initial template is greater than a first threshold: if not, the new template is discarded; if yes, step S209 is executed to determine whether the average similarity between each matching text of the new template and each matching text of the initial template meets the similarity condition; if yes, the new template is determined as the target template; otherwise, the new template is discarded. Finally, the initial template and the target template are used to process the current information extraction task.

[0052] The following describes two specific embodiments of the present invention.

[0053] The first embodiment is a scheme for entity extraction. The initial template is "{number} times {number} slice", and the template units are {number}, {Chinese character: times}, {number}, and {dose unit}. The "dose unit" is the entity type to which "slice" belongs, and the "Chinese character: times" can be considered an entity type. The partial new template formed after rearranging and combining the template units is as follows:

[0054] New Template 1: {Number}{Dosage Unit}{Number}{Chinese Character: times}

[0055] New Template 2: {Number}{Chinese Character:time}B1[1:5]{Number}{Dosage Unit}

[0056] New Template 3: {Number}{Number}{Chinese Character:time}{Dosage Unit}

[0057] The following are some natural language texts matched using the new templates in the corpus:

[0058] New Template 1: One tablet once, two bottles once

[0059] New Template 2: You can take one tablet at a time, or it is recommended to take two bottles at a time ("can take" and "recommended to take" are separated by words).

[0060] No text was matched in the new template 3.

[0061] Finally, the aforementioned template evaluation method was used to determine new templates 1 and 2 as target templates.

[0062] The second embodiment is a technical solution for relation extraction. The initial template is "{drug} prohibited from use in {disease}", and the determined template units are {drug}, {usage level}, and {disease}, where "usage level" is the relation type to which "prohibited" belongs. After arranging and combining the template units, a partial new template is formed as follows:

[0063] New Template 1: {Disease}{Usage Level}B1[1:4]{Medicine}

[0064] New Template 2: {Disease}B1[0:4]{Usage Level}B2[1:4]{Medicine}

[0065] New Template 3: {Medicine}B1[0:4]{Disease}B2[1:4]{Usage Level}

[0066] The following are some natural language texts matched using the new templates in the corpus:

[0067] New Template 1: Penicillin can be used for colds.

[0068] New Template 2: Antiplatelet aggregation drugs are generally contraindicated in cases of bleeding.

[0069] New Template 3: Gastrointestinal tablets are not prohibited from being used to treat diarrhea.

[0070] Finally, the aforementioned template evaluation method was used to determine new templates 1 and 2 as target templates. It should be noted that although the above explanation uses entity extraction and relation extraction as examples, this invention can also be applied to event extraction tasks and achieve similar technical effects.

[0071] In the technical solution of this invention, an automated program is used to solve the template generation task, thereby addressing the problem of significant manual intervention in template writing and maintenance. This maintains the high accuracy of template matching methods while reducing the degree of human intervention. During execution, the invention decomposes the initial template into fine-grained components and categorizes them into template units. Finally, these template units are dynamically combined in a random order to obtain multiple new templates. This automatically generates a large number of usable templates without increasing manual workload, significantly improving the recall rate of information extraction. Furthermore, this invention utilizes template matching for natural language understanding, achieving higher accuracy and interpretability than deep learning-based natural language understanding methods.

[0072] It should be noted that, for the sake of ease of description, the foregoing method embodiments are described as a series of actions. However, those skilled in the art should understand that the present invention is not limited to the described order of actions, and some steps may actually be performed in other orders or simultaneously. Furthermore, those skilled in the art should also understand that the embodiments described in the specification are preferred embodiments, and the actions and modules involved are not necessarily essential for implementing the present invention.

[0073] To facilitate better implementation of the above-described solutions of the embodiments of the present invention, related apparatus for implementing the above-described solutions is also provided below.

[0074] Please see Figure 3 As shown, the information extraction template generation device 300 provided in this embodiment of the invention may include: an initial template acquisition unit 301 and a new template generation unit 302.

[0075] The initial template acquisition unit 301 can be used to: acquire at least one initial template for information extraction; wherein each initial template contains multiple components belonging to a preset type, the components being at least one of matching symbols and fixed words, and the preset type including at least one of entity type and relation type; the new template generation unit 302 can be used to determine multiple template units based on the components in any initial template; and arrange the determined multiple template units in multiple preset orders to form multiple new templates corresponding to the initial template.

[0076] In this embodiment of the invention, the preset order is either any random order among the plurality of template units, or a random order among the plurality of template units that conforms to a preset sorting rule.

[0077] As a preferred embodiment, the new template generation unit 302 may be further configured to: determine each matching symbol in the initial template as a template unit; for a fixed word in the initial template belonging to any preset type: determine the fixed word as a template unit, or generate a matching symbol belonging to the preset type and determine the matching symbol as a template unit; arrange the multiple template units in a preset order; insert at least one spacer character between adjacent template units to form a new template; wherein the spacer character is used to match words in the text to be extracted that do not belong to the preset type.

[0078] Preferably, the apparatus 300 may further include: a target template generation unit, configured to: acquire matching texts of the new template and the initial template in the same preset corpus; calculate the similarity between each matching text of the new template and each matching text of the initial template; determine the new template as a target template when the average value of the similarity meets a preset similarity condition; or, acquire matching texts of the new template and the initial template in the same preset corpus; calculate the similarity between each matching text of the new template and each matching text of the initial template when the quotient of the number of matching texts of the new template and the number of matching texts of the initial template is greater than a preset first threshold; determine the new template as a target template when the average value of the similarity meets a preset similarity condition.

[0079] Furthermore, in this embodiment of the invention, the spacing character has a character limit range, the similarity condition includes: the average similarity is greater than a preset second threshold, and the information extraction includes entity extraction and relation extraction.

[0080] According to the technical solution of the present invention, a large number of usable templates can be dynamically generated through automated programs, thereby balancing the requirements of accuracy, recall, and low manual workload in information extraction. In specific implementation, the present invention decomposes existing and usable initial templates into multiple fine-grained components, thereby obtaining multiple template units. Subsequently, multiple new templates are formed by randomly arranging these template units. Finally, the final usable target templates are selected by judging the text similarity between the new templates and the initial templates in the same corpus.

[0081] Figure 4 An exemplary system architecture 400 is shown, in which the method or apparatus for generating information extraction templates according to embodiments of the present invention can be applied.

[0082] like Figure 4 As shown, system architecture 400 may include terminal devices 401, 402, and 403, network 404, and server 405 (this architecture is merely an example; the components included in a specific architecture may be adjusted according to the specific application). Network 404 serves as the medium for providing a communication link between terminal devices 401, 402, and 403 and server 405. Network 404 may include various connection types, such as wired or wireless communication links or fiber optic cables.

[0083] Users can use terminal devices 401, 402, and 403 to interact with server 405 via network 404 to receive or send messages, etc. Various communication client applications can be installed on terminal devices 401, 402, and 403, such as template auto-generation applications (for example only).

[0084] Terminal devices 401, 402, and 403 can be various electronic devices with displays that support web browsing, including but not limited to smartphones, tablets, laptops, and desktop computers.

[0085] Server 405 can be a server that provides various services, such as a backend server that supports the automatic template generation application operated by users using terminal devices 401, 402, and 403 (for example only). The backend server can process received template generation requests and feed back the processing results (such as the generated target template - for example only) to terminal devices 401, 402, and 403.

[0086] It should be noted that the method for generating the information extraction template provided in this embodiment of the invention is generally executed by the server 405, and correspondingly, the device for generating the information extraction template is generally located in the server 405.

[0087] It should be understood that Figure 4 The number of terminal devices, networks, and servers shown is merely illustrative. Depending on implementation needs, any number of terminal devices, networks, and servers can be included.

[0088] The present invention also provides an electronic device. The electronic device according to an embodiment of the present invention includes: one or more processors; and a storage device for storing one or more programs, wherein when the one or more programs are executed by the one or more processors, the one or more processors implement the information extraction template generation method provided by the present invention.

[0089] The following is for reference. Figure 5 It shows a schematic diagram of the structure of a computer system 500 suitable for implementing an electronic device according to embodiments of the present invention. Figure 5 The electronic device shown is merely an example and should not be construed as limiting the functionality and scope of use of the embodiments of the present invention.

[0090] like Figure 5 As shown, the computer system 500 includes a central processing unit (CPU) 501, which can perform various appropriate actions and processes based on programs stored in read-only memory (ROM) 502 or programs loaded from storage section 508 into random access memory (RAM) 503. The RAM 503 also stores various programs and data required for the operation of the computer system 500. The CPU 501, ROM 502, and RAM 503 are interconnected via a bus 504. An input / output (I / O) interface 505 is also connected to the bus 504.

[0091] The following components are connected to I / O interface 505: an input section 506 including a keyboard, mouse, etc.; an output section 507 including a cathode ray tube (CRT), liquid crystal display (LCD), etc., and speakers, etc.; a storage section 508 including a hard disk, etc.; and a communication section 509 including a network interface card such as a LAN card, modem, etc. The communication section 509 performs communication processing via a network such as the Internet. A drive 510 is also connected to I / O interface 505 as needed. A removable medium 511, such as a disk, optical disk, magneto-optical disk, semiconductor memory, etc., is installed on drive 510 as needed so that computer programs read from it can be installed into storage section 508 as needed.

[0092] In particular, according to the embodiments disclosed in this invention, the processes described in the above main step diagrams can be implemented as computer software programs. For example, embodiments of this invention include a computer program product comprising a computer program carried on a computer-readable medium, the computer program containing program code for performing the methods shown in the main step diagrams. In the above embodiments, the computer program can be downloaded and installed from a network via communication section 509, and / or installed from removable medium 511. When the computer program is executed by central processing unit 501, it performs the functions defined in the system of this invention.

[0093] It should be noted that the computer-readable medium shown in this invention can be a computer-readable signal medium or a computer-readable storage medium, or any combination thereof. A computer-readable storage medium can be, for example,—but not limited to—an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples of a computer-readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer disk, a hard disk, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination thereof. In this invention, a computer-readable storage medium can be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system, apparatus, or device. In this invention, a computer-readable signal medium can include a data signal propagated in baseband or as part of a carrier wave, carrying computer-readable program code. Such propagated data signals can take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. A computer-readable signal medium may also be any computer-readable medium other than a computer-readable storage medium, which can send, propagate, or transmit a program for use by or in connection with an instruction execution system, apparatus, or device. The program code contained on the computer-readable medium may be transmitted using any suitable medium, including but not limited to: wireless, wire, optical fiber, RF, etc., or any suitable combination thereof.

[0094] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of the present invention. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions indicated in the blocks may occur in a different order than those indicated in the drawings. For example, two consecutively indicated blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in a block diagram or flowchart, and combinations of blocks in a block diagram or flowchart, may be implemented using a dedicated hardware-based system that performs the specified function or operation, or using a combination of dedicated hardware and computer instructions.

[0095] The units described in the embodiments of the present invention can be implemented in software or hardware. The described units can also be housed in a processor; for example, a processor can be described as including an initial template acquisition unit and a new template generation unit. The names of these units do not necessarily limit the specific unit; for example, the initial template acquisition unit can also be described as "a unit that provides an initial template to the new template generation unit."

[0096] In another aspect, the present invention also provides a computer-readable medium, which may be included in the device described in the above embodiments; or it may exist independently and not assembled into the device. The computer-readable medium carries one or more programs, and when the device executes the one or more programs, the steps performed by the device include: obtaining at least one initial template for information extraction; wherein each initial template contains multiple components belonging to a preset type, the components being at least one of matching symbols and fixed words, the preset type including at least one of entity type and relation type; determining multiple template units based on the components in any initial template; and arranging the determined multiple template units in multiple preset orders to form multiple new templates corresponding to the initial template.

[0097] In the technical solution of this invention embodiment, an existing and usable initial template for information extraction is first obtained. Then, it is split into multiple components belonging to a preset type to form multiple template units. Finally, these template units are rearranged in any random order or a random order under a preset sorting rule, and one or more separator characters can be inserted to obtain multiple new templates. Finally, by judging the similarity between the new template and the initial template in the same corpus, the usable target templates in the new templates can be filtered out. In this way, a large number of usable templates are generated quickly in an automated program, which can simultaneously ensure the accuracy and recall of the information extraction task and the low manual workload of the template writing and maintenance process.

[0098] The specific embodiments described above do not constitute a limitation on the scope of protection of this invention. Those skilled in the art should understand that various modifications, combinations, sub-combinations, and substitutions can occur depending on design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of this invention should be included within the scope of protection of this invention.

Claims

1. A method for generating a pharmaceutical information extraction template, characterized in that, include: Obtain at least one initial template for information extraction; wherein each initial template contains multiple components belonging to a preset type, the components being at least one of matching symbols and fixed words, and the preset type including at least one of entity type and relation type; Multiple template units are determined based on the components in any initial template, wherein: any initial template is split into multiple components, and a template unit is determined based on each component; the determined multiple template units are arranged in multiple preset orders to form multiple new templates corresponding to the initial template; The step of determining multiple template units based on the components in any initial template includes: determining each matching symbol in the initial template as a template unit; for a fixed word in the initial template belonging to any preset type: determining the fixed word as a template unit, or generating a matching symbol belonging to the preset type and determining the matching symbol as a template unit.

2. The method according to claim 1, characterized in that, The preset order is any random order among the multiple template units.

3. The method according to claim 1, characterized in that, The preset order is a random order among the multiple template units that conforms to preset sorting rules.

4. The method according to claim 1, characterized in that, The step of arranging the determined multiple template units in multiple preset orders to form multiple new templates corresponding to the initial template includes: Arrange the multiple template units in a preset order; Insert at least one separator character between adjacent template units to form a new template; wherein the separator character is used to match characters in the text to be extracted that do not belong to the preset type.

5. The method according to claim 4, characterized in that, The method further includes: after forming a plurality of new templates corresponding to the initial template, for any new template: Obtain the matching texts of the new template and the initial template in the same preset corpus, and calculate the similarity between each matching text of the new template and each matching text of the initial template; When the average similarity meets the preset similarity criteria, the new template is determined as the target template.

6. The method according to claim 4, characterized in that, The method further includes: after forming a plurality of new templates corresponding to the initial template, for any new template: Retrieve the matching text of the new template and the initial template in the same preset corpus; When the quotient of the number of matching texts in the new template and the number of matching texts in the initial template is greater than a preset first threshold, the similarity between each matching text in the new template and each matching text in the initial template is calculated. When the average similarity meets the preset similarity criteria, the new template is determined as the target template.

7. The method according to claim 5 or 6, characterized in that, The number of characters in the separator character is limited. The similarity condition includes: the average similarity is greater than a preset second threshold; The information extraction includes entity extraction and relation extraction.

8. A device for generating a pharmaceutical information extraction template, characterized in that, include: An initial template acquisition unit is configured to: acquire at least one initial template for information extraction; wherein each initial template contains multiple components belonging to a preset type, the components being at least one of matching symbols and fixed words, and the preset type including at least one of entity type and relation type; The new template generation unit is used to determine multiple template units based on the components in any initial template, wherein: any initial template is split into multiple components, and a template unit is determined based on each component; the determined multiple template units are arranged in multiple preset orders to form multiple new templates corresponding to the initial template; The new template generation unit is further configured to: determine each matching symbol in the initial template as a template unit; for a fixed word in the initial template belonging to any preset type: determine the fixed word as a template unit, or generate a matching symbol belonging to the preset type and determine the matching symbol as a template unit.

9. The apparatus according to claim 8, characterized in that, The preset order is any random order among the multiple template units.

10. The apparatus according to claim 8, characterized in that, The preset order is a random order among the multiple template units that conforms to preset sorting rules.

11. The apparatus according to claim 8, characterized in that, The new template generation unit is further configured to: arrange the plurality of template units in a preset order; insert at least one spacer character between adjacent template units to form a new template; wherein the spacer character is used to match characters in the text to be extracted that do not belong to the preset type.

12. The apparatus according to claim 11, characterized in that, The apparatus further includes a target template generation unit, configured to: acquire matching texts of the new template and the initial template in the same preset corpus; calculate the similarity between each matching text of the new template and each matching text of the initial template; and determine the new template as the target template when the average value of the similarity meets a preset similarity condition.

13. The apparatus according to claim 11, characterized in that, The apparatus further includes a target template generation unit, configured to: acquire matching texts of the new template and the initial template in the same preset corpus; when the quotient of the number of matching texts of the new template and the number of matching texts of the initial template is greater than a preset first threshold, calculate the similarity between each matching text of the new template and each matching text of the initial template; and when the average value of the similarity meets a preset similarity condition, determine the new template as the target template.

14. An electronic device, characterized in that, include: One or more processors; Storage device for storing one or more programs. When the one or more programs are executed by the one or more processors, the one or more processors implement the method as described in any one of claims 1-7.

15. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the program is executed by the processor, it implements the method as described in any one of claims 1-7.

Citation Information

Patent Citations

  • Method and device for taking temperature for extracting entities

    CN105677632A

  • Method and device for generating text template, equipment and computer readable medium

    CN110162753A