Template generation method and related equipment
Through the template generation method, the problem of insufficient text processing capabilities of non-high resource languages is solved, and the corpus quality and model performance are improved by building named entity templates.
Patent Information
- Application Number
- CN202311461269.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Priority Date
- 2023-08-02
- Filing Date
- 2023-11-03
- Publication Date
- 2025-02-14
AI Technical Summary
The prior art is difficult to effectively process texts in non-high resource languages, especially in entity naming and recognition tasks in target languages such as Arabic. The lack of sufficient corpus leads to weak processing capabilities and insufficient generalization capabilities.
Provide a template generation method, which improves the quality and quantity of named entity corpus by obtaining named entities of the target language, determining signal subwords and non-signal subwords, and constructing named entity templates, thereby improving model performance.
This method can easily and efficiently obtain named entity templates of the target language, improve corpus quality and quantity, and thus improve the performance of the model in named entity tasks.
Smart Images

Figure CN119443069A_ABST
Abstract
Description
[0001] This application claims the priority of the Chinese patent application filed with the State Intellectual Property Office on August 2, 2023, with application number 202310966755.6 and invention name “A text processing method and related equipment”, all contents of which are incorporated by reference in this application. Technical Field
[0002] The present application relates to the field of named entity technology, and in particular to a template generation method and related equipment. Background Art
[0003] Currently, in the field of natural language processing, it is usually used to process high-resource languages such as English. However, due to the scarcity of corpora in many languages , in actual application scenarios, the text processing capabilities of many other languages still cannot meet the requirements.
[0004] For example, in entity naming recognition tasks for target languages such as Arabic, general models and processing procedures are usually used. It is difficult for such general models and processing procedures to obtain a large amount of corpus in target languages such as Arabic for training and application, and it is difficult to extract the characteristics of target languages such as Arabic, resulting in weak processing capabilities for target languages such as Arabic and insufficient generalization capabilities, which makes the processing performance of entity naming recognition tasks for target languages such as Arabic poor. Summary of the invention
[0005] The embodiment of the present application provides a template generation method, which can conveniently and efficiently obtain named entity templates for a target language, thereby improving the quality and quantity of named entity corpora in the target language, and helping to improve the model performance in named entity tasks in the target language. The present application also provides corresponding devices, equipment, computer-readable storage media, and computer program products, etc.
[0006] A first aspect of the present application provides a template generation method, which includes: obtaining a first named entity in a target language; determining a signal subword in the first named entity, or a signal subword and a non-signal subword in the first named entity, wherein the signal subword in the first named entity is used to mark the first named entity; and constructing a first named entity template corresponding to the first named entity based on the signal subword in the first named entity, or the signal subword and the non-signal subword in the first named entity.
[0007] In the first aspect, the template structure can be determined based on the signal subwords in the first named entity or the signal subwords and non-signal subwords in the first named entity, so that the named entity templates about the target language can be obtained conveniently and efficiently, thereby improving the quality and quantity of the named entity corpus of the target language, and helping to improve the model performance in the named entity tasks about the target language.
[0008] In a possible implementation manner of the first aspect, the first named entity template includes a tag, where the tag is used to indicate a category of the named entity described by the first named entity template.
[0009] In a possible implementation manner of the first aspect, the first named entity template includes structural information, where the structural information is used to describe a position of a signal subword or a signal subword and a non-signal subword in the first named entity template.
[0010] In this possible implementation, the structural information of the first named entity template is used to describe the word formation rule in the first named entity template.
[0011] In a possible implementation of the first aspect, the first named entity includes non-signal sub-words, and in the structural information of the first named entity template, the position corresponding to the non-signal sub-word is a slot; the first named entity template also includes a slot instance, and the slot instance is a sub-word that can fill the corresponding slot.
[0012] In this possible implementation, the named entities included in the first named entity template can be conveniently reflected through slots and slot examples.
[0013] In a possible implementation of the first aspect, there are multiple first named entities; based on the signal subwords in the first named entities, or the signal subwords and non-signal subwords in the first named entities, a first named entity template corresponding to the first named entity is constructed, including: based on the signal subwords, or the signal subwords and non-signal subwords in each first named entity, an initial named entity template corresponding to each first named entity is obtained; among the initial named entity templates corresponding to multiple first named entities, the initial named entity templates with the same signal subword information are merged to obtain the corresponding first named entity template, and based on the general subwords in the merged initial named entity templates, a slot instance in the corresponding first named entity template is obtained.
[0014] In a possible implementation manner of the first aspect, the structural information of the first named entity template also includes constraint information corresponding to at least one slot.
[0015] In this possible implementation, the constraint information can constrain the selection of the slot instance to avoid over-generalization. Exemplarily, the constraint information includes part of speech.
[0016] In a possible implementation of the first aspect, the first named entity template includes a first quantity and / or a second quantity, the first quantity being the number of named entities that can be formed by the first named entity template, and the second quantity being the number of times the first named entity template is successfully matched in a corpus including named entities.
[0017] In this possible implementation, in the first named entity template, different slot instances can be used to generate different named entities. It can be seen that by recording the first number of slot instances, the scale of the named entities involved in the first named entity template can be easily understood.
[0018] The second number can reflect the possibility of the first named entity template being matched during actual application. Generally speaking, the higher the second number, the higher the possibility of the corresponding first named entity template being matched during actual application. Therefore, the second number can also reflect the importance of the first named entity template in actual application, thereby facilitating reasonable application according to the importance of the first named entity template during actual application.
[0019] In a possible implementation of the first aspect, the method further includes: expanding the signal subwords and / or non-signal subwords according to the parts of speech of the signal subwords and / or non-signal subwords in the first named entity template to obtain at least one new named entity template relative to the first named entity template.
[0020] In this possible implementation, for example, signal subwords and / or non-signal subwords can be expanded by synonymy based on a machine learning model and / or an Arabic synonym dictionary, etc., to obtain at least one new named entity template relative to the first named entity template, thereby efficiently achieving named entity template expansion.
[0021] In a possible implementation of the first aspect, the method also includes: in a corpus including named entities, retrieving the co-occurrence relationship of signal subwords included in a first named entity template; and obtaining at least one new named entity template relative to the first named entity template based on the retrieved co-occurrence relationship of the signal subwords and the first named entity template.
[0022] In this possible implementation, based on the co-occurrence relationship of signal subwords and according to the first named entity template, new named entity templates can be fully mined from the corpus including the named entity to achieve template expansion.
[0023] In a possible implementation of the first aspect, the method also includes: matching a first named entity template in a corpus including named entities; if there are named entities in the corpus including named entities that do not match the first named entity template, obtaining a new named entity template relative to the first named entity template based on the named entities that do not match the first named entity.
[0024] In a possible implementation of the first aspect, the method also includes: matching a first named entity template in a corpus including named entities; if there is a second named entity in the corpus including named entities that partially matches the first named entity template and has new subwords compared to the first named entity template, then obtaining a new named entity template relative to the first named entity template based on the new subwords in the second named entity and the first named entity template.
[0025] In this possible implementation, in one example, the second named entity and the first named entity template have the same general sub-words, but the signal sub-words are partially the same or completely different, or the relative positions of the signal sub-words are different, then a new named entity template can be generated based on the different signal sub-words.
[0026] In a possible implementation of the first aspect, after obtaining a new named entity template relative to the first named entity template, it also includes: setting one or more subwords in any new named entity template as editable subwords and displaying them, the editable subwords include multiple candidate items, and / or the editable subwords indicate that the user can edit the corresponding subwords, and the multiple candidate items are obtained based on the target language morphological knowledge and / or regular expressions corresponding to the corresponding subwords; and obtaining a revised new named entity template based on user feedback information about the editable subwords.
[0027] In this possible implementation, template amplification can be performed based on the corpus including the named entities and the first named entity template to obtain one or more new named entity templates, and after obtaining the new named entity templates, the new named entity templates can be confirmed based on user interaction, thereby introducing a user interaction mechanism to ensure that the template generation process has both high accuracy and practicality.
[0028] The second aspect of the present application provides a template generation device, which has the function of implementing the method of the first aspect or any possible implementation of the first aspect. The function can be implemented by hardware, or by hardware executing corresponding software. The hardware or software includes one or more modules corresponding to the above functions, such as an acquisition module and a processing module.
[0029] A third aspect of the present application provides a computing device cluster, which includes at least one computing device, each computing device including a processor and a memory, and the memory of at least one computing device stores computer execution instructions that can be run on the processor. When the computer execution instructions are executed by the processor, the processor executes the method as described in the first aspect or any possible implementation method of the first aspect.
[0030] A fourth aspect of the present application provides a computer-readable storage medium storing one or more computer-executable instructions. When the computer-executable instructions are executed by a computing device cluster, the computing device cluster executes a method as described in the first aspect or any possible implementation of the first aspect.
[0031] In a fifth aspect, the present application provides a computer program product storing one or more computer execution instructions. The computer program product includes computer execution instructions. When the computer execution instructions are executed by a computing device cluster, the computing device cluster executes a method as described in the first aspect or any possible implementation of the first aspect.
[0032] In a sixth aspect of the present application, a chip system is provided, which includes a processor for supporting a computing device cluster to implement the functions involved in the first aspect or any possible implementation of the first aspect. In a possible design, the chip system may also include a memory, which is used to store necessary program instructions and data. The chip system may be composed of a chip, or may include a chip and other discrete devices.
[0033] Among them, the technical effects brought about by the second to sixth aspects or any possible implementation methods thereof can refer to the technical effects brought about by the first aspect or the relevant possible implementation methods of the first aspect, and will not be repeated here. BRIEF DESCRIPTION OF THE DRAWINGS
[0034] Figure 1 is an exemplary schematic diagram of a data center provided in an embodiment of the present application;
[0035] Figure 2 It is a schematic diagram of an embodiment of the template generation method provided in the embodiment of the present application;
[0036] Figure 3 This is an exemplary schematic diagram of a method for preprocessing corpus using the template generation method provided in the embodiment of the present application;
[0037] Figure 4 This is an exemplary schematic diagram of a training corpus annotation process for a named entity task using a template generation method provided in an embodiment of the present application;
[0038] Figure 5 is a schematic diagram of an embodiment of a template generation device provided in an embodiment of the present application;
[0039] Figure 6 is a schematic diagram of a structure of a computing device provided in an embodiment of the present application;
[0040] Figure 7 is a schematic diagram of a structure of a computing device cluster provided in an embodiment of the present application;
[0041] Figure 8 It is a structural diagram of a computing device cluster provided in an embodiment of the present application. DETAILED DESCRIPTION
[0042] The following describes the embodiments of the present application in conjunction with the drawings in the embodiments of the present application. The terms used in the implementation method section of the present application are only used to explain the specific embodiments of the present application, and are not intended to limit the present application.
[0043] Those skilled in the art may appreciate that, with the development of technology and the emergence of new scenarios, the technical solutions provided in the embodiments of the present application are also applicable to similar technical problems.
[0044] In the present application, "at least one" means one or more, and "plurality" means two or more. "And / or" describes the association relationship of associated objects, indicating that three relationships may exist. For example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone, where A and B can be singular or plural. The character " / " generally indicates that the objects associated before and after are in an "or" relationship. "At least one of the following" or similar expressions refers to any combination of these items, including any combination of singular or plural items. The terms "first", "second", etc. in the specification and claims of this application and the above-mentioned drawings are used to distinguish similar objects, and do not have to be used to describe a specific order or sequence. It should be understood that the terms used in this way can be interchangeable where appropriate, and this is merely a description of the way in which objects with the same attributes are described in the embodiments of the present application. Furthermore, the terms "comprises," "comprising," and "having," and any variations thereof, are intended to cover a non-exclusive inclusion, so that a process, method, system, product, or apparatus that comprises a list of elements is not necessarily limited to those elements but may include other elements not expressly listed or inherent to such process, method, product, or apparatus.
[0045] Currently, in the field of natural language processing, it is usually used to process languages such as English. However, due to the scarcity of corpora in many languages , in actual application scenarios, the text processing capabilities of many other languages still cannot meet the requirements.
[0046] The following is an introduction to the named entity recognition task in Arabic and other languages.
[0047] Arabic is the official language of the 22 member states of the League of Arab States and one of the six working languages used by the United Nations General Assembly. Arabic is an inflectional language with complex morphological changes, rich in morphological changes and complex subword combination structures. In the field of natural language processing, artificial intelligence models for analyzing Arabic are highly dependent on the size and quality of Arabic corpora. However, due to the scarcity of Arabic corpora and other related data, the relevant artificial intelligence models are insufficient in processing Arabic-related text processing tasks.
[0048] For example, in the task of entity naming recognition in Arabic, a commonly used method is currently based on statistical models. Among them, commonly used statistical models include hidden Markov model (HMM), conditional random field model (CRF), support vector machine (SVM), etc.
[0049] In the method based on the statistical model, training can be performed based on a training set of a specific field (such as the target language), so that the extraction of named entities can be achieved after training. However, the method based on the statistical model requires a large amount of labeled data for training. However, the Arabic corpus is scarce, which makes it difficult to obtain the relevant corpus and the acquisition cost is high. In addition, although there is the concept of template in the statistical model, it cannot well reflect the characteristics of the target language such as Arabic. The structure of the template involved in the model is relatively simple and the amount of information is small, which is difficult to provide significant help for improving the performance of the model.
[0050] In the task of entity naming recognition in Arabic, another commonly used method is based on deep learning. Common deep learning models include recurrent neural network (RNN), long short term memory (LSTM), Transformer model and bidirectional encoder representation from Transformers (BERT).
[0051] The deep learning-based method also requires a large amount of Arabic corpus. However, the Arabic corpus is scarce, which makes it difficult and costly to obtain the relevant corpus. In addition, the current Arabic corpus cannot highlight the language characteristics of Arabic well, which makes it inconvenient for deep learning models to extract Arabic named entity features.
[0052] It can be seen that in entity naming recognition tasks for target languages such as Arabic, a general model and processing flow are usually used. This general model and processing flow makes it difficult to obtain a large amount of corpus in target languages such as Arabic for training and application, and it is difficult to extract the characteristics of target languages such as Arabic, resulting in weak processing capabilities for target languages such as Arabic and insufficient generalization capabilities, which makes the processing performance of entity naming recognition tasks for target languages such as Arabic poor.
[0053] Based on this, an embodiment of the present application provides a template generation method, which can conveniently and efficiently obtain named entity templates related to the target language, thereby improving the quality and quantity of named entity corpus in the target language, and helping to improve the model performance in named entity tasks related to the target language.
[0054] The method of the embodiment of the present application may be applied to a computing device cluster, which may include one or more computing devices.
[0055] The type of any computing device is not limited herein. Exemplarily, any computing device may be a terminal device, or a server, a container, or a virtual machine.
[0056] In one example, the computing device cluster can be used to implement a cloud platform. In this case, the embodiments of the present application can be applied to the cloud platform.
[0057] The cloud platform can provide computing, network and storage capabilities based on services of hardware resources and software resources. Exemplarily, the cloud platform can include one or more data centers to provide cloud resources through one or more data centers.
[0058] Combine the following Figure 1 An architectural diagram is shown to introduce a data center.
[0059] Figure 1 In the data center, the cloud management platform communicates with one or more servers (such as Figure 1The server 1 and server 2 in the server exchange information. The server includes a hardware layer and a software layer. The hardware layer includes the hardware configured by the server, wherein the PCI device may be, for example, a network card, a graphics processing unit (GPU), an offload card, etc., which can be inserted into the peripheral component interconnect standard (PCI) or peripheral component interconnect express (PCIe) slot of the server. The software layer includes an operating system installed and running on the server (relative to the operating system of the virtual machine, it can be called the host operating system). The host operating system is provided with a virtual machine manager (also called a hypervisor). The role of the virtual machine manager is to realize the computing virtualization, network virtualization and storage virtualization of the virtual machine, and is responsible for managing the virtual machine. Among them, a virtual machine (virtual machine) refers to a complete computer system with complete hardware system functions simulated by software and running in a completely isolated environment. Figure 1 In the system architecture shown, a data center is equipped with multiple servers, which can be used to run virtual machines. The specifications of each virtual machine can be the same or different. Among them, the virtual machine can also be called a cloud server (elastic compute service, ECS), elastic instance, etc. Different cloud service providers may have different names.
[0060] In one example of an embodiment of the present application, the cloud platform may be a public cloud platform. In this case, cloud service providers such as individuals or software developers with cloud resource development capabilities may provide cloud services to users. Users obtain cloud services through the Internet but do not own cloud computing resources.
[0061] Specifically, in Figure 1 In the example shown, the cloud management platform can provide an access interface (such as an interface or application programming interface (API)). Users of the cloud platform and cloud service providers can operate the client remote access access interface to register a cloud account and password on the cloud management platform, and log in to the cloud management platform after the cloud management platform successfully authenticates the cloud account and password, thereby creating, managing, logging in and operating virtual machines in the cloud data center.
[0062] For example, when it is necessary to perform training tasks on machine learning models such as natural language models, some enterprises, organizations or individuals can purchase cloud services and use the cloud resources of the cloud platform to execute the template generation method of the embodiment of the present application to obtain multiple named entity templates about the target language, thereby performing model training or executing other applications based on the multiple named entity templates about the target language.
[0063] In addition, in some other examples, developers of a service provider that provides a cloud management platform may execute the template generation method of the embodiment of the present application based on the resources of the cloud management platform to obtain multiple named entity templates about the target language. Then, after logging into the cloud management platform, some enterprises, organizations or individuals may purchase or obtain the multiple named entity templates about the target language and purchase cloud services to perform model training or execute other applications based on the multiple named entity templates about the target language and the cloud resources of the cloud platform.
[0064] Of course, the cloud platform may also be other types of cloud platforms, which is not limited in the embodiments of the present application.
[0065] Based on the above computing device cluster, such as Figure 2 As shown, the template generation method may include steps 201-203.
[0066] Step 201: Obtain a first named entity in a target language.
[0067] In the embodiment of the present application, the specific type of the target language is not specifically limited here. In many cases, the named entity of the target language may include one or more subwords. Exemplarily, the target language may be Arabic, Ethiopian, Persian or Turkish, etc.
[0068] Among them, subword refers to a commonly used basic vocabulary that can be derived by adding, reducing or changing the letters of the subword through lexical, syntactic, grammatical and other rules.
[0069] Taking Arabic as the target language as an example, subwords in Arabic have more complex morphological changes. An Arabic word usually includes one or more subwords, and Arabic named entities also include one or more subwords, usually including signal subwords and general subwords. In some cases, they may only include signal subwords. In addition, in some cases, subwords in named entities appear in the form of affixes, that is, some subwords that cannot be used independently and appear at the beginning and end. In the embodiments of the present application, subwords that exist in the form of affixes are also collectively referred to as subwords.
[0070] In the subsequent embodiments, for the sake of convenience, Arabic is taken as an example for the target language. However, it should be noted that the target language of the embodiments of the present application may also be other languages with subwords besides Arabic.
[0071] The source of the first named entity is not limited here. For example, if the target language is Arabic, the first named entity can be obtained based on standard Arabic knowledge resources such as Arabic subword knowledge, a named entity list, an Arabic dictionary, and a teaching material.
[0072] In one example, a named entity list of the target language may be pre-stored in a computing device cluster or other device, and the named entity list may include multiple named entities of the target language, and the template generation method of the embodiment of the present application is executed according to each named entity in the named entity list, thereby obtaining multiple named entity templates according to the multiple named entities in the named entity list. During the execution process, the computing device cluster may read any named entity from the named entity list as the first named entity in the template generation method of the embodiment of the present application.
[0073] If in some scenarios, the method is applied to a specific field, for example, in the medical field, the financial field, etc., then a named entity list or a sub-word list such as sub-word knowledge or a named entity list in the specific field can be obtained through user upload or other means to obtain the first named entity in the specific field, thereby constructing the first named entity template of the specific field.
[0074] Exemplarily, the first named entity may be locally stored in a computing device cluster executing an embodiment of the present application, or may be transmitted to the computing device cluster by other devices, or may be collected by the computing device cluster through a web page or other applications, or may be obtained after the computing device cluster processes the corpus of the target language.
[0075] Step 202: determine a signal subword in a first named entity, or a signal subword and a non-signal subword in the first named entity, wherein the signal subword in the first named entity is used to mark the first named entity.
[0076] In the embodiment of the present application, signal subwords and non-signal subwords may be determined from the first named entity of the target language.
[0077] Among them, the signal subword is a subword that is highly related to the named entity judgment and is used to mark the corresponding named entity. Among them, marking the named entity refers to the characteristics that can reflect the named entity.
[0078] For example, the signal subwords may be: Common named entities in the category of (committee) and place names Common named entities in the categories of (square) and person names (prince).
[0079] Non-signal subwords are subwords in named entities that cannot mark named entities. Generally speaking, non-signal subwords can be subwords that play a modifying, distinguishing, and filling role, such as: (currency), (spring), (Abdullah). Signal subwords can be combined with general subwords to form named entities in the target language.
[0080] There are many ways to determine signal subwords and non-signal subwords from the first named entity, which are not limited here. For example, the importance of each subword in the first named entity can be determined through a machine learning model or a statistical model, so as to determine the signal subwords and non-signal subwords from the first named entity. Alternatively, the signal subwords and non-signal subwords in the first named entity can also be determined based on information such as manual feedback or historical marked corpus.
[0081] Step 203: construct a first named entity template corresponding to the first named entity according to the signal subword in the first named entity, or the signal subword and the non-signal subword in the first named entity.
[0082] In an embodiment of the present application, after determining the signal subwords and non-signal subwords in the first named entity, the structural rules of the corresponding named entity can be determined based on the position information of the signal subwords and / or non-signal subwords in the first named entity, thereby constructing a first named entity template.
[0083] In the embodiment of the present application, the specific content of the first named entity template may be in various situations, which are not limited here.
[0084] Exemplarily, the first named entity template may include one or more of a label, structure information, a slot instance, and quantity information. The following is an exemplary introduction to the contents that may be included in the first named entity template.
[0085] 1. Label.
[0086] In some embodiments, the first named entity template includes a tag, where the tag is used to indicate a category of the named entity described by the first named entity template.
[0087] The label of each named entity template is used to indicate the category of the named entity described by the corresponding named entity template. The category can have multiple situations and can be configured by the user or by relevant developers. The specific form of the label can be multiple, for example, it can be text, numbers, other symbolic forms, or a combination of multiple forms. For example, any label can be an organization, a person's name, a place name, or a time.
[0088] 2. Structural information.
[0089] In some embodiments, the first named entity template includes structural information, where the structural information is used to describe the positions of signal subwords or signal subwords and non-signal subwords in the first named entity template.
[0090] In the embodiment of the present application, the structural information of the first named entity template is used to describe the word formation rules in the first named entity template.
[0091] The structural information is obtained according to the position information of the signal subword in the first named entity, or the signal subword and the non-signal subword in the first named entity.
[0092] The following takes the Arabic named entity template as an example for introduction.
[0093] An Arabic word usually includes one or more sub-words, and an Arabic named entity also includes one or more sub-words, usually including signal sub-words and general sub-words. In some cases, it may also include only signal sub-words.
[0094] For example, for the named entity template [S (International)] (Money Fund)] [S (organize)]," (International)" and " "(Organization)" is a signal subword in the named entity of the common organizational category. (Money Fund)" is a non-signal subword in the named entity.
[0095] In addition, in the named entity template [S (International)] (Money Fund)] [S (Organization)], signal subwords are marked with S in named entity templates, while non-signal subwords are marked with N in named entity templates.
[0096] It should be noted that in any example of this application, the brackets and Chinese translation corresponding to the target language (for example, the target language “S "(International)" corresponding to " is only used for illustration and is not actually included in the actual named entity and named entity template. Other subsequent examples also adopt this approach and will not be described in detail later.
[0097] 3. Slot instance.
[0098] In some embodiments, the first named entity includes non-signal sub-words, and in the structural information of the first named entity template, the position corresponding to the non-signal sub-word is a slot; the first named entity template also includes a slot instance, and the slot instance is a sub-word that can fill the corresponding slot.
[0099] For example, in the named entity template [S (International)] (Money Fund)] [S (organization)], the non-signal subword " (Money Fund)" forms a slot, which can correspond to a slot instance.
[0100] A slot instance is a subword that can fill a corresponding slot. The specific method for obtaining a slot instance corresponding to any slot is not limited here.
[0101] Exemplarily, the slot instance may come from the annotated corpus of the named entity, for example, it may include filler words at corresponding positions in the phrases in the annotated corpus that match the structure of the first named entity template. In addition, the matched low-frequency filler words may be pruned according to user needs, and the corresponding slot instance may be obtained after pruning. Alternatively, the non-signal subwords in the first named entity may be expanded according to a machine learning model, a synonym dictionary and / or a synonym dictionary, etc., to obtain new filler words corresponding to the slot as slot instances, for example, the non-signal subwords [N (Agriculture)] can be expanded to [N (Industry)]. In other examples, some or all of the slot instances may be manually configured.
[0102] For example, for the named entity template [S (International)] (Money Fund)] [S (organization)], a slot instance may include one or more of the following: (Money Fund), (FAO), (Automobile trade), etc.
[0103] In addition, in some embodiments, the structural information of the first named entity template also includes constraint information corresponding to at least one slot.
[0104] The constraint information can constrain the selection of the slot instance to avoid over-generalization. Exemplarily, the constraint information includes part of speech.
[0105] Part of speech is an attribute that describes the grammatical function of a word. For example, part of speech may include noun, verb, adjective, etc.
[0106] For example, in one example, an exemplary structure of a named entity template is as follows:
[0107] [S (International)] (Money Fund)] [S (Organization)],[POS N+]
[0108] Among them, N refers to the noun part of speech, and N+ represents multiple consecutive nouns.
[0109] 4. Quantity information.
[0110] In some embodiments, in the first named entity template, application data of the first named entity template may be recorded through some numerical values.
[0111] Exemplarily, the quantity information of the first named entity template includes the first quantity and / or the second quantity.
[0112] The first number is the number of named entities that can be formed by the first named entity template.
[0113] The first number may be determined according to the number of slot instances corresponding to the slots in the first named entity template.
[0114] If the first named entity template has one slot, the first number may be the number of slot instances corresponding to the slot.
[0115] If the first named entity template has multiple slots, the first quantity can be determined according to the number of slot instances corresponding to each slot. For example, the first named entity template includes slot 1 and slot 2, there are 50 slot instances of slot 1, there are 10 slot instances of slot 2, and the slot instances of slot 1 and slot 2 can be combined, then the first quantity of the first named entity template can be 50*10=500.
[0116] In the first named entity template, different slot instances can be used to generate different named entities. It can be seen that by recording the first number of slot instances, the scale of the named entities involved in the first named entity template can be easily understood.
[0117] The second number is the number of times the first named entity template is successfully matched in the corpus including the named entity.
[0118] The source and specific content of the corpus including the named entity are not limited here. Exemplarily, the corpus including the named entity can be a corpus in the target language with the named entity annotations.
[0119] For example, the first named entity template can form 58 named entities, such as " (International Monetary Fund)" (Food and Agriculture Organization of the United Nations)", etc., then the first number TypeFreq = 58. The number of successful matches of the first named entity in the corpus including the named entity is 1776, then the second number TokenFreq = 1776.
[0120] The second number can reflect the possibility of the first named entity template being matched during actual application. Generally speaking, the higher the second number, the higher the possibility of the corresponding first named entity template being matched during actual application. Therefore, the second number can also reflect the importance of the first named entity template in actual application, thereby facilitating reasonable application according to the importance of the first named entity template during actual application.
[0121] It should be noted that in the embodiment of the present application, there is no restriction on the number of first named entities, and there is no restriction on the number of first named entity templates obtained.
[0122] Exemplarily, a first named entity may be acquired, and based on the first named entity, a first named entity template may be obtained through any of the above embodiments.
[0123] Or, in another example, the number of the first named entity is plural;
[0124] Constructing a first named entity template corresponding to the first named entity according to the signal subword in the first named entity, or the signal subword and the non-signal subword in the first named entity, including:
[0125] According to the signal subwords or the signal subwords and the non-signal subwords in each first named entity, obtaining the initial named entity templates corresponding to each first named entity;
[0126] Among the initial named entity templates corresponding to multiple first named entities, the initial named entity templates with the same signal subword information are merged to obtain the corresponding first named entity templates, and the slot instances in the corresponding first named entity templates are obtained based on the general subwords in the merged initial named entity templates.
[0127] In an embodiment of the present application, initial named entity templates with the same structure (for example, the content and position of signal subwords are the same) among multiple initial named entity templates are merged, and slot instances in the first named entity template are obtained based on the general subwords in the initial named entity templates that need to be merged.
[0128] In addition, in some examples, the initial naming template, the merged initial naming template and / or the first named entity template can be displayed, for example, by a display device of a computing device cluster, or sent to a client device to instruct the client device to display, so that the user can confirm through the displayed initial naming template, the merged initial naming template and / or the first named entity template, for example, whether the subwords in the corresponding named entity template are correct, etc.
[0129] In addition, after the first named entity template is obtained, it can be expanded according to the first named entity template to generate multiple named entity templates.
[0130] In an embodiment of the present application, the first named entity template may be amplified by a computing device cluster, etc., and in some cases, the quality of the amplified named entity template may be improved based on human-computer interaction.
[0131] The method of amplifying the first named entity template includes one or a combination of the following:
[0132] 1. Rule-based template amplification method.
[0133] Among them, the rule-based template amplification method may include static rule amplification and / or dynamic rule amplification, which are exemplarily introduced below.
[0134] 1) Static rule expansion.
[0135] In one embodiment, the method further comprises:
[0136] According to the parts of speech of the signal subwords and / or non-signal subwords in the first named entity template, the signal subwords and / or non-signal subwords are expanded to obtain at least one new named entity template relative to the first named entity template.
[0137] Exemplarily, signal subwords and / or non-signal subwords may be expanded synonymously based on a machine learning model and / or an Arabic synonym dictionary, etc., to obtain at least one new named entity template relative to the first named entity template.
[0138] Such as signal words [S (Organization)] can be expanded into [S (organization)], non-signal subword [N (Agriculture)] can be expanded to [N (Industry)], thereby generating new named entity templates.
[0139] 2) Dynamic rule expansion.
[0140] In some embodiments, the method further comprises:
[0141] In the corpus including the named entity, searching for the co-occurrence relationship of the signal subwords included in the first named entity template;
[0142] At least one new named entity template relative to the first named entity template is obtained according to the co-occurrence relationship of the retrieved signal subwords and the first named entity template.
[0143] In the embodiment of the present application, the quantity and source of the corpus including the named entity are not limited here. Exemplarily, the corpus including the named entity can be part or all of the corpus about the target language in the preset corpus. If the preset corpus is stored in other devices (such as a database) outside the computing device cluster, a search instruction can be sent to the other device to instruct the other device to search for the signal subword included in the first named entity template in the corpus including the named entity.
[0144] Exemplarily, the first named entity template includes a signal subword [S (organization)], then the signal subword [S (Organization)], and retrieved the named entity with the signal subword [S (Organization)] signal subwords [S (nation)].
[0145] Therefore, it can be considered that [S (Country)] and [S (Organization)] are two signal subwords that appear in pairs, and the two signal subwords are used as a group of high-frequency co-occurring subword pairs. A window range can be set between the signal subword pairs. For example, if the target language is Arabic, the value of the window range can be 3, that is, 1-3 subwords can be included between the signal subword pairs. In this way, according to the window orientation and the signal subword pairs, a search is performed in the corpus including the named entities, and the co-occurring character strings within the specified window range between the two signal subwords in the signal subword pairs are counted to form a list of co-occurring general subwords sandwiched by the two signal subwords in each signal subword pair. In the list, the co-occurring general subwords can be arranged in order of the number of co-occurrences from high to low. The high-frequency co-occurring signal subword pair and the set of general subwords it sandwiches are regarded as a combination, and the information entropy of the combination is calculated. The calculation method of the information entropy can refer to the relevant algorithm of Shannon information entropy in the prior art.
[0146] Then, a new named entity template can be generated based on the signal subword pair with a higher entropy value (for example, the entropy value is greater than a preset entropy value threshold) and the enclosed general subwords, wherein the enclosed general subwords become the filling items of the corresponding word slots in the new named entity template.
[0147] For example, the following example:
[0148] [S (Country)][N (Industry)] / [N (Agriculture)]]]S (organize)]
[0149] Among them, [S (Country)] and [S (Organization)] are two signal subwords that appear in pairs. There are two general subwords in between, that is, [S (Country)] and [S (Organization)] includes a slot, which has two slot instances, namely [N (Industry)] and [N (agriculture)].
[0150] It can be seen that this example includes two configurable parameters: the window range size and the entropy threshold. In the scenario where Arabic is the target language, the window range value can be 3, of course, it can also be other values. There are also many cases for the value of the entropy threshold. For example, a new named entity template can be generated by taking the entropy threshold in the top 20% of the list of all signal subword pairs and their co-occurring general subwords. The entropy threshold can also be automatically adjusted by the system as the number of operations increases, or it can be adjusted by the user according to needs.
[0151] In this way, based on the co-occurrence relationship of signal subwords and according to the first named entity template, new named entity templates can be fully mined from the corpus including the named entities to achieve template expansion.
[0152] 2. Data-based template amplification method.
[0153] In some examples, template augmentation may be performed based on a corpus including named entities and a first named entity template.
[0154] 1) Perform template expansion based on the named entities in the corpus that do not match the first named entity template.
[0155] In some embodiments, the method further comprises:
[0156] In a corpus including named entities, matching a first named entity template;
[0157] If there are named entities that do not match the first named entity template in the corpus including the named entities, a new named entity template relative to the first named entity template is obtained according to the named entities that do not match the first named entity.
[0158] The corpus including the named entities may include multiple annotated named entities. In addition, in some examples, in order to facilitate matching, the corpus including the named entity may also include annotated information such as the part of speech of the subwords in the named entity.
[0159] In this way, the first named entity template can be matched in the corpus including the named entity. If there is a named entity in the corpus that does not match the first named entity template, a new named entity template can be obtained based on the named entity and referring to any of the above embodiments.
[0160] 2) Perform template expansion based on the named entities in the corpus that partially match the first named entity template.
[0161] In some embodiments, the method further comprises:
[0162] In a corpus including named entities, matching a first named entity template;
[0163] If there is a second named entity in the corpus including named entities that partially matches the first named entity template and has new subwords compared to the first named entity template, a new named entity template relative to the first named entity template is obtained based on the new subwords in the second named entity and the first named entity template.
[0164] In one example, the second named entity and the first named entity template have the same general subwords, but the signal subwords are partially the same or completely different, or the relative positions of the signal subwords are different, then a new named entity template can be generated based on the different signal subwords.
[0165] For example, for the first named entity template [S (International)] (Money Fund)] [S (organization)], the second named entity is (International Monetary Fund), both have the same signal subword [S (International)] and non-signal subwords [N (Money Fund)], then according to the signal subword [S (International)] and non-signal subwords [N (Money Fund)] and new signal sub-words (Committee), obtain a new named entity template.
[0166] It can be seen that template expansion can be performed based on the corpus including the named entity and the first named entity template to obtain one or more new named entity templates.
[0167] Furthermore, in some embodiments, after obtaining a new named entity template, the new named entity template may be confirmed based on user interaction, thereby introducing a user interaction mechanism to ensure that the template generation process has both high accuracy and practicality.
[0168] The specific confirmation process includes one or more of the following steps:
[0169] 1. Determine whether one or more subwords in the new named entity template are correct. The one or more subwords may be subwords in the new named entity template that are different from the corresponding first named entity template. If the judgment is yes, the entry of the subword is retained. Otherwise, it is not retained and is recorded in the blacklist. In the subsequent template expansion process, the same or highly similar named entities are no longer recorded.
[0170] 2. Revise one or more subwords in the new named entity template.
[0171] Specifically, after obtaining a new named entity template relative to the first named entity template, the method further includes:
[0172] Setting one or more subwords in any new named entity template as editable subwords and displaying them, wherein the editable subwords include a plurality of candidates, and / or the editable subwords indicate that the user can edit the corresponding subwords, and the plurality of candidates are obtained based on target language morphological knowledge and / or regular expressions corresponding to the corresponding subwords;
[0173] According to the user's feedback information on the editable subwords, a revised new named entity template is obtained.
[0174] In the embodiment of the present application, the display may be performed by a display device of the computing device cluster, or the computing device cluster may instruct other devices such as a client device to perform the display.
[0175] The editable sub-words may include sub-words in the new named entity template that are different from the corresponding first named entity template.
[0176] In an embodiment of the present application, multiple candidates in the editable sub-words can be obtained based on the target language morphological knowledge, so that the letter changes in the process of the sub-words forming named entities can be corrected in the form of candidates.
[0177] Taking Arabic as the target language, the candidate options can be the most widely covered conjugation methods in Arabic. The options are as follows:
[0178] Table 1: Candidates obtained based on Arabic morphological knowledge
[0179]
[0180] In some examples, based on the candidate items obtained according to the morphological changes, the morphologies that the user has used and written in the past can also appear as candidate items in the corresponding relationship of "form before correction - form after correction". As the number of tasks processed increases, the content of the candidate items will gradually become richer.
[0181] In some examples, a machine learning model can be used to incrementally learn the frequency records of user interaction operations and contextual comparison information (such as the comparison of the first named entity template with the named entity in the corpus). The ranking of candidate content can be automatically given by the machine learning model after incremental learning. The user can set the length of the candidate menu according to needs, and specially set the order and content of the options in the configuration file. In addition, the ranking of the candidates is also arranged in reverse order according to the frequency of occurrence of each letter form. Users can also set other personalized candidates according to their own needs.
[0182] Furthermore, in one example, a user or developer may write a regular expression through editable subwords to constrain the morphology of corresponding subwords.
[0183] For example, you can write a regular expression N+ to represent multiple consecutive nouns, or write [NV]{2,3} to represent 2 to 3 nouns or verbs or their combination. The machine learning model can give subword morphological instances as default content in each candidate item based on the constraints of the regular expression, the frequency of historical user operations, and the probability in the context after incremental learning.
[0184] In addition, in some examples, the editable subword may indicate that the user can edit the corresponding subword. In this way, the user can directly edit the characters of the editable subword.
[0185] In some scenarios, the subword morphology input by the user through the editable subword to directly edit the corresponding subword and / or the constraint information of the subword morphology implemented by the user through the editable subword inputting the regular expression can be counted. After executing multiple tasks, the frequencies of the correspondences of the subword morphology before and after modification in the statistical results can be arranged in descending order, and the correspondences of the subword morphology exceeding the specified threshold (e.g., 20%) in the statistical results can be enriched to be added to the candidate items of the subsequent editable subword. The specified threshold will be adjusted by the system as the number of user operations increases, or it can be adjusted by the user according to needs.
[0186] The specific use of the named entity template obtained by the template generation method of any of the above embodiments is not limited here.
[0187] Exemplarily, the named entity template obtained by the template generation method of any of the above embodiments can be applied to any scenario where a named entity recognition operation needs to be performed on a text in a target language. The named entity template obtained by the template generation method of any of the above embodiments can be used as a pre-processing method or as a post-processing method to improve the accuracy of the prediction results of the machine learning model.
[0188] For example, in an exemplary scenario, the template generation method of any of the above embodiments can be used as a corpus preprocessing method. The named entity template obtained by the template generation method of any of the above embodiments can quickly generate domain- and language-specific named entity information under limited user interaction. In addition, the named entity template obtained by the template generation method of any of the above embodiments can be used to embed the corpus to be processed, fine-tune the deep learning model, or serve as pre-processing or post-processing to improve the performance of named entity recognition.
[0189] For example, Figure 3 In the example shown, the following steps may be included:
[0190] 1. Read the named entities in the named entity list of the target language in the specific field, and perform subword analysis on the named entities to determine the signal subwords and non-signal subwords therein, thereby generating named entity templates based on the signal subwords and non-signal subwords in the named entities. In this way, multiple first named entity templates can be obtained based on multiple first named entities in the named entity list.
[0191] 2. Obtain the corpus of the target language in a specific field, and count the density of named entities in the corpus to obtain the number K of named entities per thousand words.
[0192] 3. In the corpus, match the first named entity template.
[0193] 4. Based on the matching result, perform template amplification according to the rule-based template amplification method and / or the data-based template amplification method in any of the above embodiments.
[0194] 5. After template amplification, named entity matching is performed on the corpus based on all named entity templates obtained after amplification.
[0195] 6. Count the density of named entities in the corpus identified after matching again. If the density of named entities in the corpus identified after matching meets the user's requirements (for example, the number of named entities per thousand words>K), execute step 7, otherwise repeat steps 3-5.
[0196] 7. Based on the corpus labeled with named entities, the training process of the relevant machine learning model is carried out.
[0197] 8. Perform named entity recognition tasks based on the trained machine learning model.
[0198] In this example, the named entities annotated in the corpus of the target language can be effectively expanded at a low cost, and the number of named entity corpora in machine learning steps such as pre-training, fine-tuning, and incremental training can be increased, thereby improving the prediction performance of subsequent named entity tasks. In addition, in this example, the named entity template is designed based on the subword structure of the target language, so embedding it in the corpus can facilitate the machine learning model to perform subword granular modeling for named entity recognition, thereby improving the flexibility and scalability of the relevant machine learning model.
[0199] In another exemplary scenario, the named entity template obtained by the template generation method of any of the above embodiments can be used as a post-processing method. For example, the named entity template obtained by the template generation method of any of the above embodiments can be used in the post-processing process of the named entities generated by the deep learning model to screen out the high-confidence parts of the named entities generated by the deep learning model and improve the system accuracy.
[0200] For example, in one example, Figure 4 As shown, any of the above embodiments can be used in the training corpus annotation process of the named entity task to improve the annotation efficiency and accuracy.
[0201] Specifically, the target language is Arabic, Figure 4 The example shown may include the following steps:
[0202] 1. Obtain multiple first named entity templates.
[0203] 2. Perform template amplification based on the template amplification method in any of the above embodiments according to the corpus to be annotated and the plurality of first named entity templates. Figure 4 In the example shown, the user can confirm whether the morphology correction is passed, so that the accuracy of template amplification can be improved through interaction with the user.
[0204] 3. After template amplification, the corpus is annotated according to all named entity templates obtained after amplification.
[0205] 4. The annotated named entities can supplement the named entity list used to generate the first named entity template. Figure 4 In the example shown, the history record may include the list of named entities.
[0206] Figure 4 The Chinese translation is only for interpretation. In actual application, there is no corresponding Chinese translation information in Arabic.
[0207] In this example, the efficiency of named entity recognition is improved by pre-matching multiple first named entity templates in the template library, and the actual amount of named entity annotation is greatly reduced. In addition, in this example, in the annotation task, templated structural knowledge other than the named entity itself can be accumulated, so as to continuously improve the efficiency of named entity screening in subsequent tasks.
[0208] The template generation method provided in the embodiment of the present application is introduced above from multiple aspects. The template generation device provided in the embodiment of the present application is introduced below in conjunction with the accompanying drawings.
[0209] like Figure 5 As shown, the embodiment of the present application provides a template generating device 50, and the template generating device 50 includes:
[0210] An acquisition module 501 is used to acquire a first named entity in a target language;
[0211] The processing module 502 is used to:
[0212] Determine a signal subword in a first named entity, or a signal subword and a non-signal subword in the first named entity, wherein the signal subword in the first named entity is used to mark the first named entity;
[0213] A first named entity template corresponding to the first named entity is constructed according to the signal subword in the first named entity, or the signal subword and the non-signal subword in the first named entity.
[0214] Optionally, the first named entity template includes a tag, and the tag is used to indicate a category of the named entity described by the first named entity template.
[0215] Optionally, the first named entity template includes structural information, and the structural information is used to describe the position of the signal subword or the signal subword and the non-signal subword in the first named entity template.
[0216] Optionally, the first named entity includes a non-signal subword, and in the structure information of the first named entity template, a position corresponding to the non-signal subword is a slot;
[0217] The first named entity template also includes a slot instance, where the slot instance is a subword that can fill a corresponding slot.
[0218] Optionally, the number of the first named entity is multiple;
[0219] The processing module 502 is used for:
[0220] According to the signal subwords or the signal subwords and the non-signal subwords in each first named entity, obtaining the initial named entity templates corresponding to each first named entity;
[0221] Among the initial named entity templates corresponding to multiple first named entities, the initial named entity templates with the same signal subword information are merged to obtain the corresponding first named entity templates, and the slot instances in the corresponding first named entity templates are obtained based on the general subwords in the merged initial named entity templates.
[0222] Optionally, the structural information of the first named entity template also includes constraint information corresponding to at least one slot.
[0223] Optionally, the first named entity template includes a first quantity and / or a second quantity, the first quantity being the number of named entities that can be formed by the first named entity template, and the second quantity being the number of times the first named entity template is successfully matched in a corpus including named entities.
[0224] Optionally, the processing module 502 is further used to: expand the signal subwords and / or non-signal subwords according to the parts of speech of the signal subwords and / or non-signal subwords in the first named entity template to obtain at least one new named entity template relative to the first named entity template.
[0225] Optionally, the processing module 502 is further configured to:
[0226] In the corpus including the named entity, searching for the co-occurrence relationship of the signal subwords included in the first named entity template;
[0227] At least one new named entity template relative to the first named entity template is obtained according to the co-occurrence relationship of the retrieved signal subwords and the first named entity template.
[0228] Optionally, the processing module 502 is further configured to:
[0229] In a corpus including named entities, matching a first named entity template;
[0230] If there are named entities that do not match the first named entity template in the corpus including the named entities, a new named entity template relative to the first named entity template is obtained according to the named entities that do not match the first named entity.
[0231] Optionally, the processing module 502 is further configured to:
[0232] In a corpus including named entities, matching a first named entity template;
[0233] If there is a second named entity in the corpus including named entities that partially matches the first named entity template and has new subwords compared to the first named entity template, a new named entity template relative to the first named entity template is obtained based on the new subwords in the second named entity and the first named entity template.
[0234] Optionally, the processing module 502 is further configured to:
[0235] Setting one or more subwords in any new named entity template as editable subwords and displaying them, wherein the editable subwords include a plurality of candidates, and / or the editable subwords indicate that the user can edit the corresponding subwords, and the plurality of candidates are obtained based on target language morphological knowledge and / or regular expressions corresponding to the corresponding subwords;
[0236] According to the user's feedback information on the editable subwords, a revised new named entity template is obtained.
[0237] In an embodiment of the present application, a module is taken as an example of a software functional unit, and the template generation device may include code running on a computing instance. The computing instance may be at least one of a physical host (computing device), a virtual machine, a container, and other computing devices. Furthermore, the above-mentioned computing device may be one or more. For example, the template generation device may include code running on multiple hosts / virtual machines / containers. It should be noted that the multiple hosts / virtual machines / containers used to run the application may be distributed in the same region or in different regions. The multiple hosts / virtual machines / containers used to run the code may be distributed in the same available zone (AZ) or in different AZs, each AZ including a data center or multiple data centers with close geographical locations. Generally, a region may include multiple AZs.
[0238] Similarly, multiple hosts / virtual machines / containers used to run the code can be distributed in the same virtual private cloud (VPC) or in multiple VPCs. Usually, a VPC is set up in a region. For cross-region communication between two VPCs in the same region and between VPCs in different regions, a communication gateway must be set up in each VPC to achieve interconnection between VPCs through the communication gateway.
[0239] As an example of a hardware functional unit, the template generation device may include at least one computing device, such as a server, etc. Alternatively, the template generation device may also be a device implemented by an application specific integrated circuit (ASIC) or a programmable logic device (PLD). The PLD may be a complex PLD (CPLD), a field programmable gate array (FPGA), a generic array logic (GAL) or any combination thereof.
[0240] The multiple computing devices included in the template generation device can be distributed in the same region or in different regions. The multiple computing devices included in the template generation device can be distributed in the same AZ or in different AZs. Similarly, the multiple computing devices included in the template generation device can be distributed in the same VPC or in multiple VPCs. The multiple computing devices can be any combination of computing devices such as servers, ASICs, PLDs, CPLDs, FPGAs, and GALs.
[0241] It should be noted that, in other embodiments, the acquisition module can be used to execute any step in the template generation method, and the processing module can be used to execute any step in the template generation method. The steps that the acquisition module and the processing module are responsible for implementing can be specified as needed. The full functions of the template generation device can be realized by respectively implementing different steps in the template generation method through the acquisition module and the processing module.
[0242] The present application embodiment also provides a computing device 60. Figure 6 As shown, the computing device 60 includes: a bus 62, a processor 64, a memory 66 and a communication interface 68. The processor 64, the memory 66 and the communication interface 68 communicate with each other through the bus 62. The computing device 60 can be a server or a terminal device. It should be understood that the present application does not limit the number of processors and memories in the computing device 60.
[0243] The bus 62 may be a peripheral component interconnect (PCI) bus or an extended industry standard architecture (EISA) bus. The bus may be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 6 The bus 64 is shown as a single line, but does not mean that there is only one bus or one type of bus. The bus 64 may include a path for transmitting information between various components of the computing device 60 (eg, the memory 66, the processor 64, and the communication interface 68).
[0244] The processor 64 may include any one or more of a central processing unit (CPU), a graphics processing unit (GPU), a microprocessor (MP), or a digital signal processor (DSP).
[0245] The memory 66 may include a volatile memory, such as a random access memory (RAM). The processor 64 may also include a non-volatile memory, such as a read-only memory (ROM), a flash memory, a hard disk drive (HDD), or a solid state drive (SSD).
[0246] The memory 66 stores executable program code, and the processor 64 executes the executable program code to respectively implement the functions of the aforementioned acquisition module and training module, thereby realizing the template generation method applied to the computing device cluster in the above-mentioned embodiment, that is, the memory 66 stores instructions for executing the template generation method applied to the computing device cluster in the above-mentioned embodiment.
[0247] The communication interface 68 uses a transceiver module such as, but not limited to, a network interface card or a transceiver to implement communication between the computing device 60 and other devices or a communication network.
[0248] The embodiment of the present application also provides a computing device cluster. The computing device cluster includes at least one computing device. The computing device can be a server, such as a central server, an edge server, or a local server in a local data center. In some embodiments, the computing device can also be a terminal device such as a desktop computer, a laptop computer, or a smart phone.
[0249] like Figure 7 As shown, the computing device cluster includes at least one computing device 60. The memory 66 in one or more computing devices 60 in the computing device cluster may store the same instructions for executing the template generation method.
[0250] In some possible implementations, the memory 66 of one or more computing devices 60 in the computing device cluster may also store partial instructions for executing the template generation method. In other words, the combination of one or more computing devices 60 may jointly execute instructions for executing the template generation method.
[0251] It should be noted that the memory 66 in different computing devices 60 in the computing device cluster can store different instructions, which are respectively used to execute part of the functions of the template generation method. That is, the instructions stored in the memory 66 in different computing devices 60 can implement the functions of one or more modules in the acquisition module and the training module.
[0252] In some possible implementations, one or more computing devices in the computing device cluster may be connected via a network, which may be a wide area network or a local area network. Figure 8 A possible implementation is shown. Figure 8 As shown, two computing devices 60A and 60B are connected via a network. Specifically, they are connected to the network via the communication interface in each computing device. In this type of possible implementation, the memory 66 in the computing device 60A may store instructions for executing the functions of the acquisition module. At the same time, the memory 66 in the computing device 60B may store instructions for executing the functions of the processing module. Alternatively, the memory 66 in the computing device 60A may store instructions for executing part of the functions of the processing module. At the same time, the memory 66 in the computing device 60B may store instructions for executing another part of the functions of the processing module.
[0253] It should be understood that Figure 8 The functions of the computing device 60A shown in FIG. 6A may also be performed by multiple computing devices 60. Similarly, the functions of the computing device 60B may also be performed by multiple computing devices 60.
[0254] The present application embodiment also provides another computing device cluster. The connection relationship between the computing devices in the computing device cluster can be similar to that of Figure 7 and Figure 8 Connection mode of computing device cluster. The difference is that the memory 66 in one or more computing devices 60 in the computing device cluster may store the same instructions for executing the template generation method.
[0255] In some possible implementations, the memory 66 of one or more computing devices 60 in the computing device cluster may also store partial instructions for executing the template generation method. In other words, the combination of one or more computing devices 60 may jointly execute instructions for executing the template generation method.
[0256] It should be noted that the memory 66 in different computing devices 60 in the computing device cluster can store different instructions for executing part of the functions of the template generation method. That is, the instructions stored in the memory 66 in different computing devices 60 can implement the functions of one or more modules in the acquisition module and the training module.
[0257] The embodiment of the present application also provides a computer program product including instructions. The computer program product may be software or a program product including instructions that can be run on a computing device or stored in any available medium. When the computer program product is run on at least one computing device, the at least one computing device executes the template generation method.
[0258] The embodiment of the present application also provides a computer-readable storage medium. The computer-readable storage medium can be any available medium that can be stored by the computing device or a data storage device such as a data center containing one or more available media. The available medium can be a magnetic medium (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), or a semiconductor medium (e.g., a solid-state hard disk). The computer-readable storage medium includes instructions that instruct the computing device to execute the template generation method.
[0259] The embodiment of the present application also provides a chip system, which includes a processor, and the processor is used to implement the steps performed by the above-mentioned computing device cluster. In a possible design, the chip system may also include a memory, and the memory is used to store necessary program instructions and data. The chip system can be composed of a chip, or it can include a chip and other discrete devices.
[0260] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the systems, devices and units described above can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.
[0261] In the several embodiments provided in the present application, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of units is only a logical function division. There may be other division methods in actual implementation. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be an indirect coupling or communication connection through some interfaces, devices or units, which can be electrical, mechanical or other forms.
[0262] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0263] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.
[0264] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product, which is stored in a storage medium and includes several instructions for a computer device (which can be a personal computer, server, or network device, etc.) to perform all or part of the steps of the various embodiments of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, read-only memory), random access memory (RAM, random access memory), disk or optical disk, etc. Various media that can store program codes.
Claims
1. A template generation method, characterized in that: The method comprises: Get the first named entity in the target language; Determine a signal subword in the first named entity, or a signal subword and a non-signal subword in the first named entity, wherein the signal subword in the first named entity is used to mark the first named entity; A first named entity template corresponding to the first named entity is constructed according to the signal subword in the first named entity, or the signal subword and the non-signal subword in the first named entity.
2. The method according to claim 1, characterized in that The first named entity template includes a tag, and the tag is used to indicate a category of the named entity described by the first named entity template.
3. The method according to claim 1 or 2, characterized in that: The first named entity template includes structural information, and the structural information is used to describe the position of the signal subword or the signal subword and the non-signal subword in the first named entity template.
4. The method according to any one of claims 1 to 3, characterized in that: The first named entity includes a non-signal subword, and in the structure information of the first named entity template, a position corresponding to the non-signal subword is a slot; The first named entity template also includes a slot instance, where the slot instance is a subword that can fill a corresponding slot.
5. The method according to claim 4, characterized in that The number of the first named entities is multiple; The step of constructing a first named entity template corresponding to the first named entity according to the signal subword in the first named entity, or the signal subword and the non-signal subword in the first named entity, includes: According to the signal subword, or the signal subword and the non-signal subword in each of the first named entities, obtaining an initial named entity template corresponding to each of the first named entities; Among the initial named entity templates corresponding to the multiple first named entities, the initial named entity templates with the same signal sub-word information are merged to obtain the corresponding first named entity template, and the slot instance in the corresponding first named entity template is obtained based on the general sub-words in the merged initial named entity templates.
6. The method according to claim 4 or 5, characterized in that: The structural information of the first named entity template also includes constraint information corresponding to at least one of the slots.
7. The method according to any one of claims 1 to 6, characterized in that: The first named entity template includes a first quantity and / or a second quantity, the first quantity being the number of named entities that can be formed by the first named entity template, and the second quantity being the number of times the first named entity template is successfully matched in a corpus including named entities.
8. The method according to any one of claims 1 to 7, characterized in that: The method further comprises: According to the parts of speech of the signal subwords and / or the non-signal subwords in the first named entity template, the signal subwords and / or the non-signal subwords are expanded to obtain at least one new named entity template relative to the first named entity template.
9. The method according to any one of claims 1 to 7, characterized in that: The method further comprises: In a corpus including named entities, searching for a co-occurrence relationship of the signal subwords included in the first named entity template; At least one new named entity template relative to the first named entity template is obtained according to the retrieved co-occurrence relationship of the signal subwords and the first named entity template.
10. The method according to any one of claims 1 to 7, characterized in that: The method further comprises: In a corpus including named entities, matching the first named entity template; If there are named entities that do not match the first named entity template in the corpus including the named entities, a new named entity template relative to the first named entity template is obtained according to the named entities that do not match the first named entity.
11. The method according to any one of claims 1 to 7, characterized in that: The method further comprises: In a corpus including named entities, matching the first named entity template; If there is a second named entity in the corpus including the named entities that partially matches the first named entity template and has new subwords compared to the first named entity template, then a new named entity template relative to the first named entity template is obtained based on the new subwords in the second named entity and the first named entity template.
12. The method according to any one of claims 8 to 11, characterized in that: After obtaining a new named entity template relative to the first named entity template, the method further includes: Setting one or more subwords in any of the new named entity templates as editable subwords and displaying them, wherein the editable subwords include a plurality of candidate items, and / or the editable subwords indicate that a user can edit the corresponding subword, wherein the plurality of candidate items are obtained based on target language morphological knowledge and / or regular expressions corresponding to the corresponding subwords; A revised new named entity template is obtained according to the user's feedback information on the editable sub-words.
13. A template generating device, characterized in that: include: An acquisition module, used for acquiring a first named entity in a target language; Processing modules for: Determine a signal subword in the first named entity, or a signal subword and a non-signal subword in the first named entity, wherein the signal subword in the first named entity is used to mark the first named entity; A first named entity template corresponding to the first named entity is constructed according to the signal subword in the first named entity, or the signal subword and the non-signal subword in the first named entity.
14. The device according to claim 13, characterized in that The first named entity template includes a tag, and the tag is used to indicate a category of the named entity described by the first named entity template.
15. The device according to claim 13 or 14, characterized in that The first named entity template includes structural information, and the structural information is used to describe the position of the signal subword or the signal subword and the non-signal subword in the first named entity template.
16. The device according to any one of claims 13 to 15, characterized in that: The first named entity includes a non-signal subword, and in the structure information of the first named entity template, a position corresponding to the non-signal subword is a slot; The first named entity template also includes a slot instance, where the slot instance is a subword that can fill a corresponding slot.
17. The device according to claim 16, characterized in that The number of the first named entities is multiple; The processing module is used for: According to the signal subword, or the signal subword and the non-signal subword in each of the first named entities, obtaining an initial named entity template corresponding to each of the first named entities; Among the initial named entity templates corresponding to the multiple first named entities, the initial named entity templates with the same signal sub-word information are merged to obtain the corresponding first named entity template, and the slot instance in the corresponding first named entity template is obtained based on the general sub-words in the merged initial named entity templates.
18. The device according to any one of claims 13 to 17, characterized in that: The first named entity template includes a first quantity and / or a second quantity, the first quantity being the number of named entities that can be formed by the first named entity template, and the second quantity being the number of times the first named entity template is successfully matched in a corpus including named entities.
19. The device according to any one of claims 13 to 18, characterized in that: The processing module is also used to: expand the signal subwords and / or the non-signal subwords according to the parts of speech of the signal subwords and / or the non-signal subwords in the first named entity template to obtain at least one new named entity template relative to the first named entity template.
20. The device according to any one of claims 13 to 18, characterized in that The processing module is also used for: In a corpus including named entities, searching for a co-occurrence relationship of the signal subwords included in the first named entity template; At least one new named entity template relative to the first named entity template is obtained according to the retrieved co-occurrence relationship of the signal subwords and the first named entity template.
21. The device according to any one of claims 13 to 18, characterized in that The processing module is also used for: In a corpus including named entities, matching the first named entity template; If there are named entities that do not match the first named entity template in the corpus including the named entities, a new named entity template relative to the first named entity template is obtained according to the named entities that do not match the first named entity.
22. The device according to any one of claims 13 to 18, characterized in that The processing module is also used for: In a corpus including named entities, matching the first named entity template; If there is a second named entity in the corpus including the named entities that partially matches the first named entity template and has new subwords compared to the first named entity template, then a new named entity template relative to the first named entity template is obtained based on the new subwords in the second named entity and the first named entity template.
23. The device according to any one of claims 19 to 22, characterized in that The processing module is also used for: Setting one or more subwords in any of the new named entity templates as editable subwords and displaying them, wherein the editable subwords include a plurality of candidate items, and / or the editable subwords indicate that a user can edit the corresponding subword, wherein the plurality of candidate items are obtained based on target language morphological knowledge and / or regular expressions corresponding to the corresponding subwords; A revised new named entity template is obtained according to the user's feedback information on the editable sub-words.
24. A computing device cluster, characterized in that: comprising at least one computing device, the at least one computing device comprising a processor and a memory; The processor is used to execute instructions stored in the memory so that the computing device cluster executes the method according to any one of claims 1-12.
25. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program runs on a processor, the processor is enabled to execute the method according to any one of claims 1 to 12.