Text labeling method and device, electronic equipment and storage medium

By using a joint annotation model and a text annotation neural network, the problems of low accuracy and slow processing speed in traditional text segmentation and word classification methods are solved, achieving more efficient text segmentation and classification, and making it suitable for various text processing scenarios.

CN118897892APending Publication Date: 2024-11-05ZHEJIANG ZEEKR INTELLIGENT TECH CO LTD +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202310508163.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-05-05
Publication Date
2024-11-05

Smart Images

  • Figure CN118897892A_ABST
    Figure CN118897892A_ABST
Patent Text Reader

Abstract

The invention discloses a text labeling method and device, electronic equipment and a storage medium. The method comprises the following steps: determining a pre-word segmentation result for a target text, wherein the pre-word segmentation result comprises pre-segmented words obtained by carrying out word segmentation processing on the target text and pre-segmented word tags respectively corresponding to characters contained in each pre-segmented word; determining a pre-classification result for the pre-segmented words, wherein the pre-classification result comprises pre-classification segmented words obtained by performing classification processing on the pre-segmented words of the target text and pre-classification labels corresponding to characters contained in the pre-classification segmented words; and jointly inputting the target text and the pre-word segmentation tag and the pre-classification tag labeled for each character contained in the target text into a pre-trained text labeling neural network, and obtaining a word segmentation classification result output by the text labeling neural network. The invention provides a text annotation technical scheme based on a text annotation neural network, so as to output a more accurate text annotation result.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] One or more embodiments of the present application relate to the field of text processing, and specifically to a text annotation method and device, an electronic device, and a storage medium. Background Art

[0002] With the rapid development of the Internet, the growth of data volume and the expansion of scale, text information processing has become one of the important research directions in the field of information technology. Text segmentation and word classification are the basic operations of text information processing. Text segmentation refers to the segmentation of a text according to the rules of words, which is a necessary step in Chinese text processing; text word classification refers to the classification of words in the text, which plays an important role in the processing and application of text information.

[0003] Traditional text processing methods have many problems in word segmentation and word classification annotation, such as low accuracy and slow processing speed. In recent years, in addition to manual word segmentation and classification annotation, traditional text segmentation and word classification methods are usually two processes of word segmentation and classification that are carried out in series, that is, the word segmentation tool is first used to segment the text, and then the classifier is used to use the word segmentation results for text classification. However, this method has some disadvantages. For example, word segmentation usually requires the maintenance of a word segmentation vocabulary, and the text has the characteristics of many combinations and misspellings. Some texts cannot be effectively segmented through the preset vocabulary, and word segmentation errors may lead to classification errors, which in turn affect the accuracy of the text word classification results; word classification usually only considers the information of the word itself, but ignores the relationship between words, which will also lead to a decrease in the accuracy of the final word segmentation classification. Therefore, the present application proposes to regard text segmentation and word classification as a joint task, and use a joint annotation model to realize the joint annotation of text segmentation and classification, so as to accurately obtain the key information in the text, so as to improve the efficiency and accuracy of text understanding. Summary of the invention

[0004] The present application provides a text annotation method and device, an electronic device, and a storage medium to address deficiencies in the related art.

[0005] According to a first aspect of one or more embodiments of the present application, a text annotation method is provided, the method comprising:

[0006] Determine a pre-segmentation result for the target text, wherein the pre-segmentation result includes pre-segmentation obtained by segmenting the target text and pre-segmentation labels corresponding to each character contained in each pre-segmentation;

[0007] Determine a pre-classification result for the pre-segmentation of the target text, wherein the pre-classification result includes pre-classification segmentations obtained by classifying the pre-segmentation of the target text and pre-classification labels corresponding to each character contained in each pre-classification segmentation;

[0008] The target text and the pre-segmentation labels and pre-classification labels annotated for each word contained in the target text are jointly input into a pre-trained text annotation neural network, and the segmentation and classification results output by the text annotation neural network are obtained, and the segmentation and classification results include the predicted classification segmentation of the target text and the predicted segmentation and classification labels corresponding to each word contained in the target text.

[0009] Optionally, the method for determining the pre-segmentation result of the training sample for the text annotation neural network is the same as the method for determining the pre-segmentation result for the target text;

[0010] The method for determining the pre-classification result of the pre-segmentation of the training samples of the text annotation neural network is the same as the method for determining the pre-classification result of the pre-segmentation of the target text.

[0011] Optionally, the text annotation neural network belongs to the annotation layer of a pre-trained text annotation model, and the text annotation model also includes a pre-segmentation layer and a pre-classification layer;

[0012] The determining of the pre-segmentation result for the target text includes: inputting the target text into the pre-segmentation layer;

[0013] The determining of the pre-classification result for the target text pre-segmentation includes: inputting the target text pre-segmentation into the pre-classification layer.

[0014] Optionally, the determining a pre-classification result for the pre-segmentation of the target text includes:

[0015] A pre-classification result of the target text pre-segmentation is determined according to the importance weight of the target text pre-segmentation, wherein the pre-classification result includes pre-classification segmentations obtained by classifying the target text pre-segmentations according to the importance information of the target text pre-segmentations and pre-classification labels corresponding to each character contained in each pre-classification segmentation, wherein the pre-classification labels include KW, RW, URW and NW; wherein the pre-classification segmentations marked with KW are keywords, the pre-classification segmentations marked with RW are related words, the pre-classification segmentations marked with URW are irrelevant words, and the pre-classification segmentations marked with NW are noise words.

[0016] Optionally, determining the pre-classification result of the target text pre-segmentation word according to the importance information of the target text pre-segmentation word comprises the following steps:

[0017] Step 1: Determine the importance weight of the target text pre-segmentation words:

[0018]

[0019] Among them, w qis the importance weight of any pre-segmentation word q, N is the amount of text content in the corpus, n q is the number of text contents containing any pre-segmentation word q;

[0020] Step 2: Determine the importance information of the pre-segmentation words of the target text:

[0021]

[0022] Among them, f q is the frequency of any pre-segmented word q in the target text, and F is the total number of words in the target text;

[0023] Step 3: Determine the classification of the target text pre-segmentation words according to the importance information ranking of the target text pre-segmentation words, wherein the importance information of keywords, related words, irrelevant words, and noise words are ranked in descending order.

[0024] Optionally, the determining of the pre-segmentation result for the target text, the pre-segmentation result including the pre-segmentation obtained by segmenting the target text and the pre-segmentation labels corresponding to the characters contained in each pre-segmentation, includes:

[0025] Jieba word segmentation is used to perform word segmentation processing on the target text, and each word contained in each pre-segmented word is labeled with a pre-segmentation label according to four pre-segmentation labels of B, I, E, and S; wherein the pre-segmentation label is used to represent the corresponding position of the corresponding word in the corresponding pre-segmented word.

[0026] Optionally, the text annotation neural network includes an encoding module, a front neural network module, an attention mechanism module and a decoding module, wherein the attention mechanism module includes a word segmentation feature attention network and a classification feature attention network;

[0027] The step of inputting the target text and the pre-segmentation labels and pre-classification labels annotated for each word contained in the target text into a pre-trained text annotation neural network, and obtaining the segmentation and classification results output by the text annotation neural network, comprises the following steps:

[0028] Step 1: Input the target text marked with pre-segmentation labels and pre-classification labels into an encoding module to perform index conversion and output an initialization vector;

[0029] Step 2: input the initialization vector into the front neural network module to generate an initial vector representation v1;

[0030] Step 3.1, the initial vector representation v1 is used as Q (Query), the initialization vector converted from the pre-segmentation result is used as K (Key), and the pre-segmentation feature matrix is ​​used as V (Value) to input the segmentation feature attention network of the attention mechanism modules at both ends, and output the segmentation feature vector v2;

[0031] Step 3.2: The initial vector representation v1 is used as Q (Query), the initialization vector converted by the pre-classification result is used as K (Key), and the pre-classification feature matrix is ​​used as V (Value) to input the classification feature attention network of the attention mechanism modules at both ends, and the classification feature vector v3 is output;

[0032] Step 4: Concatenate the initial vector representation v1, the word segmentation feature vector v2, and the classification feature vector v3 and input them into the decoding module to output the word segmentation classification result of the target text. The word segmentation classification result includes the predicted classification word segmentation of the target text and the predicted word segmentation classification labels corresponding to each word contained in the target text.

[0033] Optionally, the text annotation model is trained in the following manner:

[0034] Determine a pre-segmentation result for the sample text, the pre-segmentation result comprising pre-segmentations obtained by segmenting the sample text and pre-segmentation labels corresponding to each character contained in each pre-segmentation; wherein each character contained in the sample text corresponds to a standard segmentation classification label;

[0035] Determine a pre-classification result for the pre-segmentation of the sample text, wherein the pre-classification result includes pre-classification segmentations obtained by classifying the pre-segmentation of the sample text and pre-classification labels corresponding to each character contained in each pre-classification segmentation;

[0036] The sample text and the pre-segmentation labels and pre-classification labels annotated for each word contained in the sample text are jointly input into the original text annotation neural network as training samples, and the segmentation classification result output by the text annotation neural network is obtained, and the segmentation classification result includes the predicted classification segmentation of the sample text and the predicted segmentation classification label corresponding to each word contained in the sample text;

[0037] The original text neural network is trained according to the word segmentation and classification results and the standard word segmentation and classification labels of the sample text to obtain a trained text annotation neural network.

[0038] According to a second aspect of one or more embodiments of the present application, a text annotation device is provided, the device comprising:

[0039] A pre-segmentation unit is used to determine a pre-segmentation result for a target text, wherein the pre-segmentation result includes pre-segmentations obtained by segmenting the target text and pre-segmentation labels corresponding to each character contained in each pre-segmentation;

[0040] A pre-classification unit, used to determine a pre-classification result for the pre-segmentation of the target text, wherein the pre-classification result includes pre-classified segmentations obtained by classifying the pre-segmentation of the target text and pre-classification labels corresponding to each character contained in each pre-classified segmentation;

[0041] A determination unit is used to jointly input the target text and the pre-segmentation labels and pre-classification labels annotated for each word contained in the target text into a pre-trained text annotation neural network, and obtain the segmentation and classification results output by the text annotation neural network, wherein the segmentation and classification results include the predicted classification segmentation of the target text and the predicted segmentation and classification labels corresponding to each word contained in the target text.

[0042] According to a third aspect of one or more embodiments of the present application, an electronic device is provided, comprising a communication interface, a processor, a memory and a bus, wherein the communication interface, the processor and the memory are interconnected via a bus; machine-readable instructions are stored in the memory, and the processor implements an optional text annotation method when executing the machine-readable instructions by calling the machine-readable instructions.

[0043] According to a fourth aspect of one or more embodiments of the present application, a machine-readable storage medium is provided, wherein the machine-readable storage medium stores machine-readable instructions, and when the machine-readable instructions are called and executed by a processor, an optional text annotation method is implemented.

[0044] By using the embodiments provided by the present application, the target text pre-segmentation and pre-classification results are input into the trained text annotation neural network to avoid the situation where the wrong segmentation error leads to the wrong classification. Compared with the pre-segmentation and pre-classification, the segmentation and classification results obtained after verification and adjustment of the neural network are more accurate, which is conducive to the recognition and understanding of the text, solves the problem of low accuracy of text segmentation and classification, and can improve the efficiency of text segmentation and classification. At the same time, the text annotation neural network can also be applied to a variety of text processing scenarios after adaptive training, expanding the application scope of text annotation. BRIEF DESCRIPTION OF THE DRAWINGS

[0045] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments recorded in the embodiments of the present application. For ordinary technicians in this field, other drawings can also be obtained based on these drawings.

[0046] Figure 1 is a system architecture diagram of a text annotation method shown in an exemplary embodiment of the present application;

[0047] Figure 2 It is a flowchart of a text annotation method shown in a specific embodiment of the present application;

[0048] Figure 3 is a schematic diagram of a process for determining a pre-classification result shown in a specific embodiment of the present application;

[0049] Figure 4 It is a flowchart of a text annotation network prediction shown in an exemplary embodiment of the present application;

[0050] Figure 5 is a schematic diagram of an attention network structure shown in an exemplary embodiment of the present application;

[0051] Figure 6 is a block diagram of a text annotation device shown in an exemplary embodiment of the present application;

[0052] Figure 7 It is a hardware structure diagram of a computer device where a text annotation device of an exemplary embodiment of the present application is located. DETAILED DESCRIPTION

[0053] Exemplary embodiments will be described in detail herein, examples of which are shown in the accompanying drawings. When the following description refers to the drawings, the same numbers in different drawings represent the same or similar elements unless otherwise indicated. The implementations described in the following exemplary embodiments do not represent all implementations consistent with the present application. Instead, they are merely examples of devices and methods consistent with some aspects of the present application as detailed in the appended claims.

[0054] The terms used in this application are for the purpose of describing specific embodiments only and are not intended to limit this application. The singular forms of "a", "said" and "the" used in this application and the appended claims are also intended to include plural forms unless the context clearly indicates other meanings. It should also be understood that the term "and / or" used herein refers to and includes any or all possible combinations of one or more associated listed items.

[0055] It should be understood that although the terms first, second, third, etc. may be used in the present application to describe various information, these information should not be limited to these terms. These terms are only used to distinguish the same type of information from each other. For example, without departing from the scope of the present application, the first information may also be referred to as the second information, and similarly, the second information may also be referred to as the first information. Depending on the context, the word "if" as used herein may be interpreted as "at the time of" or "when" or "in response to determining".

[0056] Before explaining the text annotation method and the text segmentation and classification annotation device, electronic device, and storage medium of the present application, some technical terms appearing in the present application are briefly explained.

[0057] (1) Natural Language Processing

[0058] Natural Language Processing (NLP) is a type of artificial intelligence that specializes in analyzing human language. (Hereinafter referred to as "NLP"). Natural language evolved through human natural use, receives and translates natural language, analyzes natural language through probability-based algorithms and outputs results to solve language problems in human-computer interaction.

[0059] (2) Machine Learning

[0060] Machine Learning (ML) is a multi-disciplinary interdisciplinary subject involving probability theory, statistics, approximation theory, convex analysis, algorithm complexity theory and other disciplines. It specifically studies how computers simulate or implement human learning behavior to acquire new knowledge or skills and reorganize existing knowledge structures to continuously improve their performance. Machine learning is the core of artificial intelligence and the fundamental way to make computers intelligent. Its applications are spread across all areas of artificial intelligence. Machine learning and deep learning usually include artificial neural networks, belief networks, reinforcement learning, transfer learning, inductive learning and other technologies. Machine learning can be divided into two categories according to the methods: supervised learning and unsupervised learning. Among them, supervised learning mainly consists of classification and regression problems, and unsupervised learning mainly consists of clustering and association analysis problems. Deep learning is a type of supervised learning. The concept of deep learning originated from the study of artificial neural networks. A multilayer perceptron with multiple hidden layers is a deep learning structure. Deep learning combines low-level features to form more abstract high-level representation attribute categories or features to discover distributed feature representations of data.

[0061] The embodiments of the present application will be described in detail below with reference to the accompanying drawings.

[0062] Figure 1FIG. 1 is a schematic diagram of an exemplary system 100 in which various methods and apparatuses described herein may be implemented according to an embodiment of the present application. Figure 1 , the system 100 includes one or more client devices 101, 102, 103 and / or 104, a server 120, and one or more communication networks 110 coupling the one or more client devices to the server 120. The client devices 101, 102, 103 and / or 104 may be configured to execute one or more applications.

[0063] In an embodiment of the present application, the server 120 may run one or more services or software applications that enable the method of text segmentation, classification and tagging to be performed.

[0064] In some embodiments, server 120 may also provide other services or software applications, which may include non-virtualized environments and virtualized environments. In some embodiments, these services may be provided as web-based services or cloud services, such as provided to users of client devices 101, 102, 103, and / or 104 under a software as a service (SaaS) model.

[0065] exist Figure 1 In the configuration shown, server 120 may include one or more components that implement the functions performed by server 120. These components may include software components, hardware components, or a combination thereof that can be executed by one or more processors. Users operating client devices 101, 102, 103, and / or 104 may in turn utilize one or more client applications to interact with server 120 to utilize the services provided by these components. It should be understood that a variety of different system configurations are possible, which may differ from system 100. Therefore, Figure 1 is one example of a system for implementing the various methods described herein and is not intended to be limiting.

[0066] The user may use client devices 101, 102, 103 and / or 104 to input search text. The client device may provide an interface that enables the user of the client device to interact with the client device. The client device may also output information to the user via the interface. Figure 1 Only four client devices are depicted, but those skilled in the art will appreciate that the present application may support any number of client devices.

[0067] Client devices 101, 102, 103 and / or 104 may include various types of computer devices, such as portable handheld devices, general-purpose computers (such as personal computers and laptop computers), workstation computers, wearable devices, smart screen devices, self-service terminal devices, service robots, game systems, thin clients, various messaging devices, sensors or other sensing devices, etc. These computer devices may run various types and versions of software applications and operating systems, such as MICROSOFT Windows, APPLE iOS, UNIX-like operating systems, Linux or Linux-like operating systems (such as GOOGLE Chrome OS); or include various mobile operating systems, such as MICROSOFT Windows Mobile OS, iOS, Windows Phone, Android. Portable handheld devices may include cellular phones, smart phones, tablet computers, personal digital assistants (PDAs), etc. Wearable devices may include head-mounted displays (such as smart glasses) and other devices. Game systems may include various handheld game devices, Internet-enabled game devices, etc. Client devices are capable of executing various different applications, such as various Internet-related applications, communication applications (such as email applications), short message service (SMS) applications, and may use various communication protocols.

[0068] The network 110 may be any type of network known to those skilled in the art that may support data communications using any of a variety of available protocols, including but not limited to TCP / IP, SNA, IPX, etc. By way of example only, the one or more networks 110 may be a local area network (LAN), an Ethernet-based network, a token ring, a wide area network (WAN), the Internet, a virtual network, a virtual private network (VPN), an intranet, an extranet, a blockchain network, a public switched telephone network (PSTN), an infrared network, a wireless network (e.g., Bluetooth, WIFI), and / or any combination of these and / or other networks.

[0069] Server 120 may include one or more general purpose computers, dedicated server computers (e.g., PC (personal computer) servers, UNIX servers, mid-range servers), blade servers, mainframe computers, server clusters, or any other suitable arrangement and / or combination. Server 120 may include one or more virtual machines running virtual operating systems, or other computing architectures involving virtualization (e.g., one or more flexible pools of logical storage devices that may be virtualized to maintain a server's virtual storage device). In various embodiments, server 120 may run one or more services or software applications that provide the functionality described below.

[0070] The computing units in the server 120 may run one or more operating systems including any of the above operating systems and any commercially available server operating systems. The server 120 may also run any of a variety of additional server applications and / or middle-tier applications, including HTTP servers, FTP servers, CGI servers, JAVA servers, database servers, etc.

[0071] In some implementations, server 120 may include one or more applications to analyze and consolidate data feeds and / or event updates received from users of client devices 101, 102, 103, and / or 104. Server 120 may also include one or more applications to display data feeds and / or real-time events via one or more display devices of client devices 101, 102, 103, and / or 104.

[0072] In some embodiments, the server 120 may be a server of a distributed system, or a server combined with a blockchain. The server 120 may also be a cloud server, or an intelligent cloud computing server or intelligent cloud host with artificial intelligence technology. A cloud server is a host product in a cloud computing service system to solve the defects of difficult management and weak business scalability in traditional physical hosts and virtual private servers (VPS) services.

[0073] The system 100 may also include one or more databases 130. In some embodiments, these databases may be used to store data and other information. For example, one or more of the databases 130 may be used to store information such as models, templates, preset label data, etc. The databases 130 may reside in various locations. For example, the database used by the server 120 may be local to the server 120, or may be remote from the server 120 and may communicate with the server 120 via a network-based or dedicated connection. The databases 130 may be of different types. In some embodiments, the databases used by the server 120 may be, for example, relational databases. One or more of these databases may store, update, and retrieve data to and from the databases in response to commands.

[0074] In some embodiments, one or more of the databases 130 may also be used by applications to store application data. The databases used by the applications may be different types of databases, such as a key-value store, an object store, or a conventional store backed by a file system.

[0075] Figure 1The system 100 can be configured and operated in various ways to enable the application of various methods and devices described in this application. When a user needs to annotate a text, the target text can be sent to the server through the client, and the server performs word segmentation and classification on the target text, and then sends the word segmentation and classification results to the client, or directly performs further business processing based on the word segmentation and classification results.

[0076] Text information processing is one of the important research directions in the field of information technology. Text segmentation and word classification are the basic operations of text information processing. Text segmentation refers to dividing a text according to the rules of words, which is a necessary step in Chinese text processing; text word classification refers to classifying text content, which plays an important role in the processing and application of text information.

[0077] Traditional text processing methods have many problems in word segmentation and word classification annotation, such as low accuracy and slow processing speed. In recent years, in addition to manual word segmentation and classification annotation, traditional text segmentation and word classification methods are usually two processes of word segmentation and classification that are carried out in series, that is, the word segmentation tool is first used to segment the text, and then the classifier is used to use the word segmentation results for text classification. However, this method has some disadvantages. For example, word segmentation usually requires the maintenance of a word segmentation vocabulary, and the text has the characteristics of many combinations and misspellings. Some texts cannot be effectively segmented through the preset vocabulary, and word segmentation errors may lead to classification errors, which in turn affect the accuracy of the text word classification results; word classification usually only considers the information of the word itself, but ignores the relationship between words, which will also lead to a decrease in the accuracy of the final word segmentation classification. Therefore, the present application proposes to regard text segmentation and word classification as a joint task, and use a joint annotation model to realize the joint annotation of text segmentation and classification, so as to accurately obtain the key information in the text, so as to improve the efficiency and accuracy of text understanding.

[0078] Search is a typical scenario for text understanding. Understanding the search text and extracting key information from the search text not only helps to conduct efficient retrieval, but also provides users with truly valuable information. It is an important part of guiding retrieval recall and sorting strategies. At the same time, the search text is open input data, and the input text forms are diverse. For short texts containing little information, it usually does not conform to grammatical rules, resulting in a high probability of misspellings. For long texts containing many modifiers / noise words, search engines are also prone to matching irrelevant words in the input for result output, which will cause inaccurate search results. The search text has the characteristics of many combinations and misspellings. Some texts cannot be effectively segmented through the preset word library. Therefore, accurately extracting key information from the search text for search can improve the accuracy of search results based on the meaning of the search text. Figure 2 is a flowchart of a text annotation method provided in an embodiment of the present application, such as Figure 2As shown, the text annotation method may include the following steps S210 to S230:

[0079] S210: Determine a pre-segmentation result for the target text, wherein the pre-segmentation result includes pre-segmentation results obtained by segmenting the target text and pre-segmentation labels corresponding to respective characters contained in each pre-segmentation result.

[0080] S220: Determine a pre-classification result for the pre-segmentation of the target text, wherein the pre-classification result includes pre-classification segmentations obtained by classifying the pre-segmentation of the target text and pre-classification labels corresponding to respective characters contained in each pre-classification segmentation.

[0081] S230: jointly input the target text and the pre-segmentation labels and pre-classification labels annotated for each character contained in the target text into a pre-trained text annotation neural network, and obtain the segmentation and classification results output by the text annotation neural network, wherein the segmentation and classification results include the predicted classification segmentation of the target text and the predicted segmentation and classification labels corresponding to each character contained in the target text.

[0082] In one embodiment, the target text in step S210 can be a sentence, a paragraph, a chapter, or a character string. In a broad sense, a text can be any speech fixed by writing. The target text in this application refers to a text used to implement the various methods described herein, and is not intended to be limited thereto. A single target text consists of multiple characters, that is, it can be input into a client or server as a character string. The step S210 can be implemented by a text segmentation device. Further, the text segmentation device can be an intelligent terminal, such as a mobile phone, a tablet computer, a notebook computer, or a mobile terminal with wireless communication capabilities, or a desktop computer with computing capabilities, such as a desktop computer, a desktop computer, or other inconveniently movable device. Segmentation is to decompose a text into a data structure with words (generally referred to as tokens or terms) as units. In this application, words include single-word words and words with multiple words, which are not limited here. Any suitable segmentation tool can be used to segment the search text. In some examples, LAC (Lexical Analysis of Chinese) can be used to implement Chinese word segmentation, part-of-speech tagging, proper name recognition and other word segmentation functions. A word segmentation method based on a vocabulary (dictionary) can also be used, as well as a word segmentation method based on a statistical model (HMM and n-gram), and a word segmentation tool suitable for different application scenarios that combines a rule method and a statistical method to implement word segmentation. The present application does not limit the word segmentation algorithm or word segmentation tool used when implementing step S210. In a specific embodiment, the present application can use Jieba word segmentation to perform word segmentation on the target text. The word segmentation principle of Jieba word segmentation is to use a Chinese word library to determine the association probability between Chinese characters, and the probability of Chinese characters forming a phrase is large to form a word segmentation result. In addition to the word segmentation word library, users can also add custom phrases.

[0083] After the word segmentation process is performed to obtain the pre-segmented words, each character contained in each pre-segmented word is labeled with a pre-segmented word label according to the four pre-segmented word labels B, I, E, and S; wherein the pre-segmented word label is used to represent the corresponding position of the corresponding character in the corresponding pre-segmented word. B represents that the character is at the Begin position of the word segmentation, I represents that the character is at the Inside position of the word segmentation, E represents that the character is at the End position of the word segmentation, and S represents that a single character represents a word. In addition to this annotation mode, other annotation modes such as BIO can also be selected, which can be determined by oneself based on the existing data annotation set or code engineering. The segmentation result can be obtained by segmenting the target text through a preset segmentation algorithm or segmentation tool, wherein the segmentation result includes at least one pre-segmented word, and can also include the position information of each pre-segmented word, and any character in the target text is labeled with a pre-segmented word label according to the segmentation result. For example, the target text is: Will turning on the air conditioner remotely in summer ventilate the air? The target text can be segmented by Jieba word segmentation to obtain the following pre-segmented words: summer, remote, turn on, air conditioner, will, ventilate, will, and annotated according to the BIES annotation mode. The pre-segmented word label annotation result of any character in the target text is: summer / B, day / E, far / B, process / E, turn on / B, turn on / E, air / B, adjust / E, will / S, change / B, air / E, will / S, do / S.

[0084] In step S220, the determination method for classifying the pre-segmentation of the target text may include classification according to part of speech, classification according to importance, and a custom classification method. The pre-segmentation of the target text may be classified into nouns, transitive verbs, intransitive verbs and other parts of speech according to part of speech; it may also be classified into keywords, related words, irrelevant words, noise words and other types according to importance weight; it may also be classified according to the application scenario according to preset requirements, for example, in the field of public opinion tendency survey, the text involved in the public opinion may be pre-segmented and classified into positive words, negative words, neutral words and other types according to emotional tendency, and in the medical field, the pre-segmentation may be classified into patient name words, department words, doctor title words and other types according to statistical needs. Different classification methods have different classification methods, which can be classified by classifiers or classification models, such as random forest models. Random forest refers to a classifier that uses multiple decision trees to train and predict samples, and the output category is determined by the mode of the category output by the individual tree. This application does not limit the classification method and classification method adopted when implementing step S220.

[0085] In a specific embodiment of the present application, the text annotation neural network belongs to the annotation layer of the pre-trained text annotation model, and the text annotation model also includes a pre-segmentation layer and a pre-classification layer; when step S210 is implemented, the determination of the pre-segmentation result for the target text includes: inputting the target text into the pre-segmentation layer, and outputting the pre-segmentation result after processing by the pre-segmentation layer, and the pre-segmentation result includes the pre-segmentation obtained by segmenting the target text and the pre-segmentation labels corresponding to the characters contained in each pre-segmentation. When step S220 is implemented, the determination of the pre-classification result for the pre-segmentation of the target text includes: inputting the pre-segmentation of the target text into the pre-classification layer, and outputting the pre-classification result of the pre-segmentation of the target text after processing by the pre-classification layer, and the pre-classification result includes the pre-classification segmentation obtained by classifying the pre-segmentation of the target text and the pre-classification labels corresponding to the characters contained in each pre-classification segmentation.

[0086] In a specific embodiment of the present application, a pre-classification result of the target text pre-segmentation is determined according to the importance weight of the target text pre-segmentation, and the pre-classification result includes the pre-classification segmentation obtained by classifying the pre-segmentation of the target text according to the importance information of the target text pre-segmentation and the pre-classification labels corresponding to each character contained in each pre-classification segmentation, and the pre-classification labels include KW, RW, URW and NW; wherein, the pre-classification segmentation marked with KW is a keyword, the pre-classification segmentation marked with RW is a related word, the pre-classification segmentation marked with URW is an irrelevant word, and the pre-classification segmentation marked with NW is a noise word. In this embodiment, the importance weight can be obtained by a preset weight strategy, by presetting the relationship between the pre-segmentation word part of speech, position, etc. and the weight. For example, the pre-segmentation result of the target text "Simply have a serving of afternoon tea" includes the pre-segmentation words: simple, eat, one serving, afternoon tea, and their parts of speech are adverb, verb, and numeral, respectively; when the pre-segmentation weight is expressed as a decimal between 0 and 1, by pre-setting the relationship between the pre-segmentation word part of speech, position, etc. and the weight, the importance weights of the pre-segmentation words of the target text are determined to be 0.1, 0.3, 0, and 0.6, respectively, and are marked as URW, RW, NW, and KW according to the importance weight, that is, the pre-segmentation word "simple" is an irrelevant word, the pre-segmentation word "eat" is a related word, the pre-segmentation word "one serving" is a noise word, and the pre-segmentation word "afternoon tea" is a keyword. The classification results may not appear in the target text at the same time. For example, in a specific embodiment, the pre-segmentation result of the target text "Raining and holding an umbrella" includes the pre-segmentation words: raining and holding an umbrella. The two words have the same part of speech and only differ in the front and back positions. At this time, when the pre-segmentation weight is expressed as a decimal between 0 and 1, by presetting the relationship between the pre-segmentation part of speech, position, etc. and the weight, it can be determined that the importance weights of the pre-segmentation words of the target text are 0.4 and 0.6 respectively, and are marked as RW and KW respectively according to the importance weights, that is, the pre-segmentation word "raining" is a related word, and the pre-segmentation word "holding an umbrella" is a keyword.

[0087] In a specific embodiment, the pre-classification result of the target text pre-segmentation word can also be determined according to the importance information of the target text pre-segmentation word. Figure 3 is a schematic diagram of a process for determining a pre-classification result provided in an embodiment of the present application, such as Figure 3 As shown, the method for determining the pre-classification result may include the following steps S310 to S330: including the following steps:

[0088] Step S310: Determine the importance weight of the target text pre-segmentation words:

[0089]

[0090] Among them, w q is the importance weight of any pre-segmentation word q, N is the amount of text content in the corpus, nq is the number of text contents containing any pre-segmented word q; wherein the text contents in the corpus may be text contents in the target domain within a recent period of time.

[0091] Step S320: Determine the importance information of the target text pre-segmentation words:

[0092]

[0093] Among them, f q is the word frequency of any pre-segmented word q in the target text, and F is the total number of words in the target text.

[0094] Step S330: Determine the classification of the target text pre-segmentation words according to the importance information ranking of the target text pre-segmentation words, wherein the importance information of keywords, related words, irrelevant words, and noise words are ranked in descending order.

[0095] After obtaining the importance information, the classification is determined according to the importance information. Specifically, the classification can be performed in the following way: first, convert the pre-segmentation word length to 1, set the classification label to NW, and if the number of remaining pre-segmentation words in the target text is 2, then follow I q Set the classification labels to KW, RW in descending order. If the number of remaining pre-segmented words in the target text is greater than 2, then follow I q The first pre-segmentation word classification label is set to KW, the last pre-segmentation word classification label is set to URW, and the other pre-segmentation word classification labels are set to RW in descending order. Then the preset features and original character features are indexed and converted to input into the subsequent network. For example, the target text is: Will the air conditioning be ventilated when it is turned on remotely in summer? Its pre-segmentation words are: summer, remote, turn on, air conditioning, will, ventilate, will? According to the above equation, the importance weight w of each pre-segmentation word is obtained. q and importance informationI q According to this classification standard, the pre-classification labels corresponding to each word contained in the target text are as follows: summer / B_URW, day / E_URW, far / B_KW, cheng / E_KW, fight / B_URW, open / E_URW, empty / B_KW, adjust / E_KW, meet / S_NW, change / B_RW, air / E_RW, do / S_NW.

[0096] In a specific embodiment, the text annotation model includes a pre-segmentation layer, a pre-classification layer and a text annotation network, wherein the method for determining the pre-segmentation result of the training sample for the text annotation neural network is the same as the method for determining the pre-segmentation result for the target text; the method for determining the pre-classification result of the pre-segmentation of the training sample for the text annotation neural network is the same as the method for determining the pre-classification result of the pre-segmentation of the target text. Because different pre-segmentation and classification methods may affect the parameters obtained by training the text annotation neural network, using the same pre-segmentation and classification method can ensure that the text neural network can show the trained credibility as much as possible.

[0097] The text annotation neural network in step S230 includes an encoding module, a front neural network module, an attention mechanism module and a decoding module, wherein the attention mechanism module includes a word segmentation feature attention network and a classification feature attention network.

[0098] The target text and the pre-segmentation labels and pre-classification labels annotated for each word contained in the target text are jointly input into a pre-trained text annotation neural network, and the word segmentation classification result output by the text annotation neural network is obtained. Figure 4 is a flowchart of a text annotation network prediction provided by an exemplary embodiment of the present application, such as Figure 4 As shown, the text annotation network prediction method may include the following steps S410 to S440: including the following steps:

[0099] Step S410: Input the target text marked with the pre-segmentation label and the pre-classification label into an encoding module to perform index conversion and output an initialization vector.

[0100] Step S420: Input the initialization vector into the front neural network module to generate an initial vector representation v1.

[0101] Step S431: The initial vector representation v1 is used as Q (Query), the initialization vector converted from the pre-segmentation result is used as K (Key), and the pre-segmentation feature matrix is ​​used as V (Value) to input the segmentation feature attention network of the attention mechanism modules at both ends, and output the segmentation feature vector v2.

[0102] Step S432: The initial vector representation v1 is used as Q (Query), the initialization vector converted by the pre-classification result is used as K (Key), and the pre-classification feature matrix is ​​used as V (Value) to input the classification feature attention network of the attention mechanism modules at both ends, and the classification feature vector v3 is output.

[0103] Step S440: concatenate the initial vector representation v1, the word segmentation feature vector v2, and the classification feature vector v3 and input them into the decoding module, and output the word segmentation classification result of the target text, wherein the word segmentation classification result includes the predicted classification word segmentation of the target text and the predicted word segmentation classification labels corresponding to each character contained in the target text.

[0104] In a specific embodiment of the present application, a trainable neural network based on Transformer is used. The neural network is constructed by stacking Transformers, and Transformer is essentially an Encoder-Decoder structure. For example, by constructing an encoder and a decoder with 6 layers each, a total of 12 layers of Encoder-Decoder, the distance between any two positions in the sequence is reduced to a constant; at the same time, the output of the encoder will be used as the input of the decoder, so that the data is continuously weighted summed. In step S410, the target text and each word contained in the target text will be converted into an id after index conversion. In addition to the character-level id, these ids also include the word combination id of the pre-segmentation, the joint id of the pre-segmentation and pre-classification tag combination, and the mask encoding information used by the attention mechanism module and the encoding module, as well as the attention mechanism matrix information. After the id is input into the text annotation neural network, the encoding module will initialize a vector of a preset length for each id, and calculate and convert it in combination with other mask encoding information. Mask represents a mask, which masks certain values ​​so that they have no effect when the parameters are updated. The neural network mentioned in this application does not limit its implementation method, nor does it limit the number of encoders and decoders. In some embodiments, a machine learning model based on a gating model and CRF construction can also be used as a text annotation neural network, or a convolutional neural network (CNN), a recursive neural network (RNN), and a feedforward neural network (FNN). In the text neural network of this application, the role of the attention mechanism is to save resources and quickly obtain the most effective information by focusing limited attention on key information. In steps S431 and S432, this application uses an end-to-end Attention network to construct an attention mechanism module, which are a word segmentation feature attention network and a classification feature attention network. Based on the results of the joint word segmentation and classification labeling training of the end-to-end Attention network, the model initial vector representation is input into the word segmentation feature attention network and the classification feature attention network. For any of the attention networks, its operating mechanism can be obtained by Figure 5 The following is a schematic diagram of the attention network structure, taking the classification feature attention network as an example. Figure 5As shown, the initial vector representation v1 is used as Q (Query), the initialization vector of the pre-classification result conversion is used as K (Key), and the pre-classification feature matrix is ​​used as V (Value) to input the classification feature attention network of the attention mechanism modules at both ends, and output the classification feature vector v3.

[0105] The core formula of the attention mechanism module is:

[0106]

[0107] Among them, Q is Query, input information, corresponding to the hidden layer output of the decoding module at the previous moment, K is Key, content information, corresponding to all hidden layer outputs of the encoding module, and V is Value, the information itself, corresponding to the encoding vector.

[0108] In a specific embodiment, the text annotation model can be trained in the following manner:

[0109] Determine a pre-segmentation result for the sample text, the pre-segmentation result comprising pre-segmentations obtained by segmenting the sample text and pre-segmentation labels corresponding to each character contained in each pre-segmentation; wherein each character contained in the sample text corresponds to a standard segmentation classification label.

[0110] A pre-classification result for the pre-segmentation of the sample text is determined, wherein the pre-classification result includes pre-classification segmentations obtained by classifying the pre-segmentation of the sample text and pre-classification labels corresponding to respective characters contained in each pre-classification segmentation.

[0111] The sample text and the pre-segmentation labels and pre-classification labels annotated for each word contained in the sample text are jointly input into the original text annotation neural network as training samples, and the word segmentation classification result output by the text annotation neural network is obtained, and the word segmentation classification result includes the predicted classification word segmentation of the sample text and the predicted word segmentation classification label corresponding to each word contained in the sample text.

[0112] The original text neural network is trained according to the word segmentation and classification results and the standard word segmentation and classification labels of the sample text to obtain a trained text annotation neural network.

[0113] Combined with the text annotation training set, the text annotation neural network is trained. During the text annotation neural network training process, the input sample is forward propagated according to the aforementioned network, and the word segmentation classification result is output. The word segmentation classification result includes the predicted classification word segmentation of the sample text and the predicted word segmentation classification label corresponding to each word contained in the sample text. The loss value is calculated according to the index label converted from the predicted word segmentation classification label and the standard word segmentation classification label. The gradient back propagation is performed to update the network weight with the goal of minimizing the loss value. After a certain number of iterations or the loss value meets the conditions, the model training is stopped, and the network weight with the best evaluation effect of the validation set is used as the model weight parameter. The sample text is divided into a training set, a validation set, and a test set according to a certain ratio (such as 8:1:1). The training set samples can be used to train the text annotation neural network, the validation set samples can be used to evaluate the text annotation neural network, and the test set samples are used to calculate the error of the text annotation neural network. When the accuracy of the trained text annotation neural network in the validation set no longer increases and the loss value decays steadily to a preset value, it is considered that the text annotation neural network has converged, and the iterative training is terminated to obtain the trained text annotation neural network.

[0114] In a specific embodiment, at the end of each preset update cycle and / or when the cumulative number of sample texts with standard word segmentation classification labels added reaches a preset update sample threshold, the trained text annotation neural network is updated and trained. The trained network model is deployed in a software application to provide users with the function of being able to annotate sample texts with word segmentation classification labels online or offline, that is, to confirm the word segmentation classification results of sample texts, set a certain time period and / or set a sample threshold, and at the end of the preset update cycle or when the cumulative number of sample texts with standard word segmentation classification labels added reaches a preset update sample threshold, the sample texts annotated with word segmentation classification labels by users are uploaded to the database and collected as new training set samples. In order to reduce the possibility of incorrect annotation by users, the annotation results are randomly sampled for review and verification. The present application can improve the overall effect of the text neural network through the above process.

[0115] Corresponding to the embodiments of the aforementioned method, the embodiments of the present application further provide a text annotation device for supporting the text annotation method provided by any one of the above embodiments or a combination thereof.

[0116] Figure 6 It is a schematic diagram of the structure of a text annotation device shown in an exemplary embodiment. The device includes: a pre-segmentation unit 61, a pre-classification unit 62, and a determination unit 63.

[0117] The pre-segmentation unit is used to determine the pre-segmentation result for the target text, wherein the pre-segmentation result includes the pre-segmentation obtained by segmenting the target text and the pre-segmentation labels corresponding to the characters contained in each pre-segmentation.

[0118] The pre-classification unit 62 is used to determine a pre-classification result for the pre-segmentation of the target text, wherein the pre-classification result includes pre-classified segmented words obtained by classifying the pre-segmented words of the target text and pre-classification labels corresponding to each character contained in each pre-classified segmented word.

[0119] The determination unit 63 is used to input the target text and the pre-segmentation label and pre-classification label annotated for each word contained in the target text into a pre-trained text annotation neural network, and obtain the segmentation and classification result output by the text annotation neural network, wherein the segmentation and classification result includes the predicted classification segmentation of the target text and the predicted segmentation and classification label corresponding to each word contained in the target text.

[0120] In an exemplary embodiment, the pre-segmentation unit 61 is also used to indicate that the method for determining the pre-segmentation result of the training sample of the text annotation neural network is the same as the method for determining the pre-segmentation result of the target text; the pre-classification unit 62 is also used to indicate that the method for determining the pre-classification result of the pre-segmentation of the training sample of the text annotation neural network is the same as the method for determining the pre-classification result of the pre-segmentation of the target text.

[0121] In another exemplary embodiment, the determination unit 63 is also used to illustrate that the text annotation neural network belongs to the annotation layer of a pre-trained text annotation model, and the text annotation model also includes a pre-segmentation layer and a pre-classification layer; the pre-segmentation unit 61 is also used to input the target text into the pre-segmentation layer; the pre-classification unit 62 is also used to input the pre-segmentation of the target text into the pre-classification layer.

[0122] In a specific embodiment, the pre-segmentation unit 61 is also used to use Jieba segmentation to perform segmentation processing on the target text, and to annotate each character contained in each pre-segmentation word with a pre-segmentation label according to four pre-segmentation labels of B, I, E, and S; wherein the pre-segmentation label is used to represent the corresponding position of the corresponding character in the corresponding pre-segmentation word.

[0123] In a specific embodiment, the pre-classification unit 62 is further used to determine the pre-classification result of the target text pre-segmentation according to the importance weight of the target text pre-segmentation, and the pre-classification result includes the pre-classified segmentation obtained by classifying the pre-segmentation of the target text according to the importance information of the target text pre-segmentation and the pre-classification labels corresponding to each character contained in each pre-classified segmentation, and the pre-classification labels include KW, RW, URW and NW; wherein, the pre-classified segmentation marked with KW is a keyword, the pre-classified segmentation marked with RW is a related word, the pre-classified segmentation marked with URW is an irrelevant word, and the pre-classified segmentation marked with NW is a noise word.

[0124] Wherein, determining the pre-classification result of the target text pre-segmentation word according to the importance information of the target text pre-segmentation word comprises the following steps:

[0125] Step 1: Determine the importance weight of the target text pre-segmentation words:

[0126]

[0127] Among them, w q is the importance weight of any pre-segmentation word q, N is the amount of text content in the corpus, n q is the number of text contents containing any pre-segmented word q; wherein the text contents in the corpus may be text contents in the target domain within a recent period of time.

[0128] Step 2: Determine the importance information of the pre-segmentation words of the target text:

[0129]

[0130] Among them, f q is the word frequency of any pre-segmented word q in the target text, and F is the total number of words in the target text.

[0131] Step 3: Determine the classification of the target text pre-segmentation words according to the importance information ranking of the target text pre-segmentation words, wherein the importance information of keywords, related words, irrelevant words, and noise words are ranked in descending order.

[0132] In a specific embodiment, the determination unit 63 is also used to indicate that the text annotation neural network includes an encoding module, a front neural network module, an attention mechanism module and a decoding module, wherein the attention mechanism module includes a word segmentation feature attention network and a classification feature attention network.

[0133] The step of inputting the target text and the pre-segmentation labels and pre-classification labels annotated for each word contained in the target text into a pre-trained text annotation neural network, and obtaining the segmentation and classification results output by the text annotation neural network, comprises the following steps:

[0134] Step 1: Input the target text marked with pre-segmentation labels and pre-classification labels into an encoding module to perform index conversion and output an initialization vector.

[0135] Step 2: Input the initialization vector into the front neural network module to generate an initial vector representation v1.

[0136] Step 3.1, use the initial vector representation v1 as Q (Query), the initialization vector converted by the pre-segmentation result as K (Key), and the pre-segmentation feature matrix as V (Value) to input the segmentation feature attention network of the attention mechanism modules at both ends, and output the segmentation feature vector v2.

[0137] Step 3.2: Use the initial vector representation v1 as Q (Query), the initialization vector converted by the pre-classification result as K (Key), and the pre-classification feature matrix as V (Value) to input the classification feature attention network of the attention mechanism modules at both ends, and output the classification feature vector v3.

[0138] Step 4: Concatenate the initial vector representation v1, the word segmentation feature vector v2, and the classification feature vector v3 and input them into the decoding module to output the word segmentation classification result of the target text. The word segmentation classification result includes the predicted classification word segmentation of the target text and the predicted word segmentation classification labels corresponding to each word contained in the target text.

[0139] In addition, the text annotation device of the embodiment of the present application further includes: a training unit ( Figure 6(not shown). A training unit is used to determine a pre-segmentation result for a sample text, wherein the pre-segmentation result includes pre-segmentations obtained by segmenting the sample text and pre-segmentation labels corresponding to each character contained in each pre-segmentation. Each character contained in the sample text corresponds to a standard segmentation classification label; determine a pre-classification result for the pre-segmentation of the sample text, wherein the pre-classification result includes pre-classification segmentations obtained by classifying the pre-segmentations of the sample text and pre-classification labels corresponding to each character contained in each pre-classification segmentation; input the sample text and the pre-segmentation labels and pre-classification labels annotated for each character contained in the sample text as training samples into the original text annotation neural network, and obtain a segmentation classification result output by the text annotation neural network, wherein the segmentation classification result includes a predicted classification segmentation for the sample text and a predicted segmentation classification label corresponding to each character contained in the sample text; train the original text neural network according to the segmentation classification result and the standard segmentation classification label of the sample text to obtain a trained text annotation neural network.

[0140] The text annotation device of the embodiment of the present application further includes: an updating unit ( Figure 6 An updating unit is used to update the trained text annotation neural network at the end of each preset update cycle and / or when the cumulative number of sample texts annotated with standard word segmentation classification labels reaches a preset update sample threshold.

[0141] The embodiments of the text annotation device of the present application can be applied to computer devices, such as servers or terminal devices. The device embodiments can be implemented by software, or by hardware or a combination of software and hardware. Taking software implementation as an example, as a device in a logical sense, it is formed by the processor in which the text annotation is located to read the corresponding computer program instructions in the non-volatile memory into the memory and run them. From the hardware level, if Figure 7 As shown in FIG. 1 , a hardware structure diagram of a computer device where the text annotation device of the embodiment of the present application is located is shown in FIG. Figure 7 In addition to the processor 702, internal bus 704, network interface 706, memory 708, and non-volatile memory 710 shown, other hardware may also be included according to the actual function of the computer device, which will not be described in detail.

[0142] The implementation process of the functions and effects of each unit in the above-mentioned device is specifically described in the implementation process of the corresponding steps in the above-mentioned method, and will not be repeated here.

[0143] For the device embodiment, since it basically corresponds to the method embodiment, the relevant parts can refer to the partial description of the method embodiment. The device embodiment described above is only schematic, wherein the modules described as separate components may or may not be physically separated, and the components displayed as modules may or may not be physical modules, that is, they may be located in one place, or they may be distributed on multiple network modules. Some or all of the modules may be selected according to actual needs to achieve the purpose of the present application scheme. A person of ordinary skill in the art can understand and implement it without paying creative labor.

[0144] The above describes specific embodiments of the present application. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recorded in the claims can be performed in an order different from that in the embodiments and still achieve the desired results. In addition, the processes depicted in the accompanying drawings do not necessarily require the specific order or continuous order shown to achieve the desired results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.

[0145] Those skilled in the art will readily appreciate other embodiments of the present application after considering the specification and practicing the inventions claimed herein. The present application is intended to cover any variations, uses or adaptations of the present application, which follow the general principles of the present application and include common knowledge or customary techniques in the art that are not claimed in the present application. The specification and examples are intended to be exemplary only, and the true scope and spirit of the present application are indicated by the following claims.

[0146] It should be understood that the present application is not limited to the precise structures that have been described above and shown in the drawings, and that various modifications and changes may be made without departing from the scope thereof. The scope of the present application is limited only by the appended claims.

[0147] The above description is only a preferred embodiment of the present application and is not intended to limit the present application. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present application shall be included in the scope of protection of the present application.

Claims

1. A text annotation method, characterized in that: include: Determine a pre-segmentation result for the target text, wherein the pre-segmentation result includes pre-segmentation obtained by segmenting the target text and pre-segmentation labels corresponding to each character contained in each pre-segmentation; Determine a pre-classification result for the pre-segmentation of the target text, wherein the pre-classification result includes pre-classification segmentations obtained by classifying the pre-segmentation of the target text and pre-classification labels corresponding to each character contained in each pre-classification segmentation; The target text and the pre-segmentation labels and pre-classification labels annotated for each word contained in the target text are jointly input into a pre-trained text annotation neural network, and the segmentation and classification results output by the text annotation neural network are obtained, and the segmentation and classification results include the predicted classification segmentation of the target text and the predicted segmentation and classification labels corresponding to each word contained in the target text.

2. The method according to claim 1, characterized in that include: The method for determining the pre-segmentation result of the training sample of the text annotation neural network is the same as the method for determining the pre-segmentation result of the target text; The method for determining the pre-classification result of the pre-segmentation of the training samples of the text annotation neural network is the same as the method for determining the pre-classification result of the pre-segmentation of the target text.

3. The method according to claim 1, characterized in that: The text annotation neural network belongs to the annotation layer of a pre-trained text annotation model, and the text annotation model also includes a pre-segmentation layer and a pre-classification layer; The determining of the pre-segmentation result for the target text includes: inputting the target text into the pre-segmentation layer; The determining of the pre-classification result for the target text pre-segmentation includes: inputting the target text pre-segmentation into the pre-classification layer.

4. The method according to claim 1, characterized in that: The determining of the pre-classification result of the pre-segmentation of the target text includes: A pre-classification result of the target text pre-segmentation is determined according to the importance weight of the target text pre-segmentation, wherein the pre-classification result includes pre-classification segmentations obtained by classifying the target text pre-segmentations according to the importance information of the target text pre-segmentations and pre-classification labels corresponding to each character contained in each pre-classification segmentation, wherein the pre-classification labels include KW, RW, URW and NW; wherein the pre-classification segmentations marked with KW are keywords, the pre-classification segmentations marked with RW are related words, the pre-classification segmentations marked with URW are irrelevant words, and the pre-classification segmentations marked with NW are noise words.

5. The method according to claim 4, characterized in that Determining the pre-classification result of the target text pre-segmentation word according to the importance information of the target text pre-segmentation word comprises the following steps: Step 1: Determine the importance weight of the target text pre-segmentation words: Among them, w q is the importance weight of any pre-segmentation word q, N is the amount of text content in the corpus, n q is the number of text contents containing any pre-segmentation word q; Step 2: Determine the importance information of the pre-segmentation words of the target text: Among them, f q is the frequency of any pre-segmented word q in the target text, and F is the total number of words in the target text; Step 3: Determine the classification of the target text pre-segmentation words according to the importance information ranking of the target text pre-segmentation words, wherein the importance information of keywords, related words, irrelevant words, and noise words are ranked in descending order.

6. The method according to claim 1, characterized in that The determining of the pre-segmentation result for the target text, wherein the pre-segmentation result includes the pre-segmentation obtained by segmenting the target text and the pre-segmentation labels corresponding to the characters contained in each pre-segmentation, including: Jieba word segmentation is used to perform word segmentation processing on the target text, and each word contained in each pre-segmented word is labeled with a pre-segmentation label according to four pre-segmentation labels of B, I, E, and S; wherein the pre-segmentation label is used to represent the corresponding position of the corresponding word in the corresponding pre-segmented word.

7. The method according to claim 1, characterized in that The text annotation neural network includes an encoding module, a front neural network module, an attention mechanism module and a decoding module, wherein the attention mechanism module includes a word segmentation feature attention network and a classification feature attention network; The step of inputting the target text and the pre-segmentation labels and pre-classification labels annotated for each word contained in the target text into a pre-trained text annotation neural network, and obtaining the segmentation and classification results output by the text annotation neural network, comprises the following steps: Step 1: Input the target text marked with pre-segmentation labels and pre-classification labels into an encoding module to perform index conversion and output an initialization vector; Step 2: input the initialization vector into the front neural network module to generate an initial vector representation v1; Step 3.1, the initial vector representation v1 is used as Q (Query), the initialization vector converted from the pre-segmentation result is used as K (Key), and the pre-segmentation feature matrix is ​​used as V (Value) to input the segmentation feature attention network of the attention mechanism modules at both ends, and output the segmentation feature vector v2; Step 3.2: The initial vector representation v1 is used as Q (Query), the initialization vector converted by the pre-classification result is used as K (Key), and the pre-classification feature matrix is ​​used as V (Value) to input the classification feature attention network of the attention mechanism modules at both ends, and the classification feature vector v3 is output; Step 4: Concatenate the initial vector representation v1, the word segmentation feature vector v2, and the classification feature vector v3 and input them into the decoding module to output the word segmentation classification result of the target text. The word segmentation classification result includes the predicted classification word segmentation of the target text and the predicted word segmentation classification labels corresponding to each word contained in the target text.

8. The method according to claim 1, characterized in that The text annotation model is trained in the following way: Determine a pre-segmentation result for the sample text, the pre-segmentation result comprising pre-segmentations obtained by segmenting the sample text and pre-segmentation labels corresponding to each character contained in each pre-segmentation; wherein each character contained in the sample text corresponds to a standard segmentation classification label; Determine a pre-classification result for the pre-segmentation of the sample text, wherein the pre-classification result includes pre-classification segmentations obtained by classifying the pre-segmentation of the sample text and pre-classification labels corresponding to each character contained in each pre-classification segmentation; The sample text and the pre-segmentation labels and pre-classification labels annotated for each word contained in the sample text are jointly input into the original text annotation neural network as training samples, and the segmentation classification result output by the text annotation neural network is obtained, and the segmentation classification result includes the predicted classification segmentation of the sample text and the predicted segmentation classification label corresponding to each word contained in the sample text; The original text neural network is trained according to the word segmentation and classification results and the standard word segmentation and classification labels of the sample text to obtain a trained text annotation neural network.

9. A text annotation device, characterized in that: include: A pre-segmentation unit is used to determine a pre-segmentation result for a target text, wherein the pre-segmentation result includes pre-segmentations obtained by segmenting the target text and pre-segmentation labels corresponding to each character contained in each pre-segmentation; A pre-classification unit, used to determine a pre-classification result for the pre-segmentation of the target text, wherein the pre-classification result includes pre-classified segmentations obtained by classifying the pre-segmentation of the target text and pre-classification labels corresponding to each character contained in each pre-classified segmentation; A determination unit is used to jointly input the target text and the pre-segmentation labels and pre-classification labels annotated for each word contained in the target text into a pre-trained text annotation neural network, and obtain the segmentation and classification results output by the text annotation neural network, wherein the segmentation and classification results include the predicted classification segmentation of the target text and the predicted segmentation and classification labels corresponding to each word contained in the target text.

10. An electronic device, comprising a communication interface, a processor, a memory and a bus, wherein the communication interface, the processor and the memory are interconnected via the bus; The memory stores machine-readable instructions, and the processor executes the text annotation method according to any one of claims 1 to 8 by calling the machine-readable instructions.

11. A machine-readable storage medium storing machine-readable instructions, wherein the machine-readable instructions, when called and executed by a processor, implement the text annotation method according to any one of claims 1 to 8.