Text recognition method and device, computer equipment and computer readable storage medium
By recognizing flat entities and calculating relevance to find candidate segments, non-continuous entities are efficiently extracted from text, addressing the limitations of existing algorithms that assume continuity.
Patent Information
- Application Number
- CN202310787721.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-06-29
- Publication Date
- 2024-12-31
AI Technical Summary
Existing named entity recognition algorithms assume entities are continuous and fail to recognize non-continuous entities, such as those composed of multiple discontinuous fragments.
Perform entity recognition on the text to identify flat entities, calculate relevance with the text to find candidate segments, and determine non-continuous entities without enumerating all continuous segments, using models like BERT and BiLSTM-CRF for efficient recognition.
Improves the recognition efficiency of non-continuous entities by identifying hidden segments highly correlated with flat entities, enabling complete extraction of non-continuous entities without exhaustive segment enumeration.
Smart Images

Figure CN119227683A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of natural language processing, and in particular to a text recognition method, apparatus, computer equipment and computer-readable storage medium. Background Art
[0002] Named entity recognition is the foundation of system architectures such as intelligent question answering, user intent recognition, and chatbots. In many related fields such as medicine and justice, as well as in application scenarios such as user spoken commands, there are a large number of discontinuous entities composed of discontinuous fragments, which need to be recognized during named entity recognition. However, existing named entity recognition algorithms usually assume that entities are continuous and cannot recognize discontinuous entities. Summary of the invention
[0003] The embodiments of the present application provide a text recognition method, apparatus, computer device and computer-readable storage medium, which can extract all non-continuous entities from the text to be recognized and improve the recognition efficiency of non-continuous entities.
[0004] The technical solution adopted by the present invention to solve the problem is as follows:
[0005] On the one hand, the present application provides a text recognition method, comprising:
[0006] Performing entity recognition on the acquired text to be recognized to obtain a flat entity of the text to be recognized;
[0007] Calculate the relevance between the flat entity and the text to be recognized to obtain candidate segments of the flat entity;
[0008] Based on the flat entities and candidate segments, non-continuous entities of the text to be recognized are determined.
[0009] In some embodiments of the present application, a correlation is calculated between a flat entity and a text to be recognized to obtain a candidate segment of the flat entity, including:
[0010] Calculating the correlation between the flat entity and the text to be recognized, and obtaining the correlation information between the flat entity and the text to be recognized;
[0011] Based on the relevance information, determining a text word score of the text to be recognized, where the text word score is used to characterize the relevance between each word in the text to be recognized and the flat entity;
[0012] Based on the text word scores, candidate segments for flat entities are determined.
[0013] In some embodiments of the present application, the relevance calculation is performed on the flat entity and the text to be recognized to obtain the relevance information between the flat entity and the text to be recognized, including:
[0014] Encoding the flat entity to obtain first encoding information, and encoding the text to be recognized to obtain second encoding information;
[0015] Extracting features from the first coded information to obtain a first feature, and extracting features from the second coded information to obtain a second feature;
[0016] Based on the first feature and the second feature, correlation information between the flat entity and the text to be recognized is determined.
[0017] In some embodiments of the present application, based on the relevance information, determining the text word score of the text to be recognized includes:
[0018] Get the entity length of the flat entity and the text length of the text to be recognized;
[0019] The relevance information is segmented based on the entity length and the text length to obtain multiple blocks of information;
[0020] Performing a circular convolution operation on each of the multiple block information to obtain multiple block information after the convolution operation;
[0021] Splicing multiple block information after the convolution operation to obtain splicing information;
[0022] The concatenated information is applied to a preset activation function to obtain the text word score of the text to be recognized.
[0023] In some embodiments of the present application, based on the flat entity and the candidate segment, determining the non-continuous entity of the text to be recognized includes:
[0024] Building a candidate data set based on the flat entity and the candidate segments, the candidate data set includes multiple segments, and the multiple segments form multiple segment combinations;
[0025] determining a combination feature of each of the plurality of segment combinations;
[0026] Based on the combination features, the combination probability of each fragment combination is determined, and the combination probability is used to characterize the probability that each fragment combination constitutes an entity;
[0027] Based on the combined probability, non-continuous entities of the text to be recognized are determined.
[0028] In some embodiments of the present application, based on the combined probability, determining the non-continuous entities of the text to be recognized includes:
[0029] Based on the combination probability and a preset probability threshold, determine a target segment combination, where the target segment combination is a segment combination whose combination probability is greater than the probability threshold among the multiple segment combinations;
[0030] The candidate data set is updated based on the target segment combination, and the step of determining the combination feature of each segment combination in the plurality of segment combinations is continued until the target segment combination no longer changes or the candidate data set is updated a preset number of times;
[0031] Based on the target segment combination, the non-continuous entities of the text to be recognized are determined.
[0032] In some embodiments of the present application, entity recognition is performed on the acquired text to be recognized to obtain a flat entity of the text to be recognized, including:
[0033] Extracting features of the acquired text to be recognized to obtain a third feature of the text to be recognized;
[0034] Performing label mapping processing on the third feature to obtain a target label sequence of the text to be recognized;
[0035] Based on the target label sequence, the flat entities of the text to be recognized are determined.
[0036] In a second aspect, an embodiment of the present invention further provides a text recognition device, comprising:
[0037] A first recognition unit is used to perform entity recognition on the acquired text to be recognized to obtain a flat entity of the text to be recognized;
[0038] A segment determination unit, used for calculating the relevance between the flat entity and the text to be recognized, and obtaining candidate segments of the flat entity;
[0039] The second recognition unit is used to determine the non-continuous entities of the text to be recognized based on the flat entities and the candidate segments.
[0040] In a third aspect, the present application further provides a computer device, the computer device comprising:
[0041] one or more processors;
[0042] Memory; and
[0043] One or more applications, wherein the one or more applications are stored in the memory and configured to be executed by the processor to implement any one of the text recognition methods in the first aspect.
[0044] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium having a computer program stored thereon, and the computer program is loaded by a processor to execute the steps in any one of the text recognition methods in the first aspect.
[0045] The beneficial effects of the present invention are as follows: by calculating the correlation between flat entities and the text to be recognized, hidden segments that are highly correlated with the flat entities but are not recognized due to omission or redundancy in spoken language can be mined from the text to be recognized; by performing non-continuous entity recognition based on the flat entities and candidate segments, all non-continuous entities can be extracted from the text to be recognized, and there is no need to enumerate all continuous segments for judgment, thereby improving the recognition efficiency of non-continuous entities. BRIEF DESCRIPTION OF THE DRAWINGS
[0046] In order to more clearly illustrate the embodiments of the present invention 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 present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0047] Figure 1 is a flowchart of a text recognition method provided by an embodiment of the present invention;
[0048] Figure 2 is a flowchart of a specific embodiment of the text recognition method provided by an embodiment of the present invention;
[0049] Figure 3 is a structural schematic diagram of a flat entity extraction module provided by an embodiment of the present invention;
[0050] Figure 4 is a structural diagram of a text relevance calculation module provided by an embodiment of the present invention;
[0051] Figure 5 It is a schematic diagram of the structure of a candidate segment extraction module and a discontinuous entity recognition module provided by an embodiment of the present invention;
[0052] Figure 6 is a principle block diagram of a text recognition device provided by an embodiment of the present invention;
[0053] Figure 7 It is a schematic diagram of the structure of a computer device provided in an embodiment of the present invention. DETAILED DESCRIPTION
[0054] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of this application.
[0055] In the description of the present application, it should be understood that the terms "center", "longitudinal", "lateral", "length", "width", "thickness", "up", "down", "front", "back", "left", "right", "vertical", "horizontal", "top", "bottom", "inside", "outside" and the like indicate positions or positional relationships based on the positions or positional relationships shown in the drawings, which are only for the convenience of describing the present application and simplifying the description, rather than indicating or implying that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation, and therefore cannot be understood as a limitation of the present application. In addition, the terms "first", "second", "third", "fourth", "fifth", "sixth", "seventh" and the like are only used for descriptive purposes, and cannot be understood as indicating or implying relative importance or implicitly indicating the number of technical features indicated. Therefore, the features defined as "first", "second", "third", "fourth", "fifth", "sixth", "seventh" and the like may explicitly or implicitly include one or more of the features. In the description of the present application, "multiple" means two or more, and "several" means one or more, unless otherwise clearly and specifically defined.
[0056] In this application, the word "exemplary" is used to mean "used as an example, illustration, or description." Any embodiment described in this application as "exemplary" is not necessarily to be construed as being preferred or advantageous over other embodiments. The following description is given to enable any technician in the field to implement and use the present application. In the following description, details are listed for the purpose of explanation. It should be understood that a person of ordinary skill in the art can recognize that the present application can be implemented without using these specific details. In other instances, well-known structures and processes will not be elaborated in detail to avoid obscuring the description of the present application with unnecessary details. Therefore, the present application is not intended to be limited to the embodiments shown, but is consistent with the widest scope consistent with the principles and features disclosed in the present application.
[0057] It should be noted that since the method of the embodiment of the present application is executed in a computer device, the processing objects of each computer device exist in the form of data or information. For example, time is actually time information. It can be understood that if size, quantity, position, etc. are mentioned in subsequent embodiments, they are all corresponding data for processing by the computer device. The details will not be repeated here.
[0058] The inventors have found through research that traditional named entity recognition algorithms usually assume that entities are continuous and cannot recognize non-continuous entities. For example, the most commonly used named entity recognition algorithm uses the BiLSTM-CRF model for named entity recognition, which can only recognize continuous entities. In order to be able to recognize non-continuous entities, there are also existing methods that use extended tags combined with sequence labeling models for named entity recognition. Although this method can recognize non-continuous entities, it cannot cover all combinations of non-continuous entities and cannot recognize non-continuous entities composed of more than two continuous fields.
[0059] Based on this, in an embodiment of the present application, entity recognition is performed on the acquired text to be recognized to obtain a flat entity of the text to be recognized; the correlation between the flat entity and the text to be recognized is calculated to obtain a candidate segment of the flat entity; based on the flat entity and the candidate segment, the non-continuous entity of the text to be recognized is determined, and all non-continuous entities can be extracted from the text to be recognized without enumerating all continuous segments for judgment, which can improve the recognition efficiency of non-continuous entities.
[0060] The content of this application is further illustrated below through the description of embodiments in conjunction with the accompanying drawings.
[0061] This embodiment provides a text recognition method, such as Figure 1 As shown in , the method includes:
[0062] Step S10: Perform entity recognition on the acquired text to be recognized to obtain a flat entity of the text to be recognized.
[0063] The text to be recognized is the text that needs to be recognized by named entity recognition. The text to be recognized can be a sentence or a paragraph input by a user through a computer device (for example, a smart phone), or it can be text data obtained by converting the collected user conversations into text through a computer device. The entities in the text to be recognized can include flat entities (flat NER), nested entities (nested NER) and discontinuous entities (discontinuous NER). Flat entities are entities that do not overlap with each other, nested entities are entities that partially overlap or even completely nested, and discontinuous entities refer to entities composed of multiple discontinuous text fragments. For example, the text to be recognized is "Zhang San takes the subway from Bao'an District, Shenzhen to Nanshan District to work every day", the two entities "Zhang San" and "Shenzhen" are flat entities, the entity "Shenzhen Bao'an District" is a nested entity, and the entity "Shenzhen Nanshan District" is a discontinuous entity.
[0064] Considering that existing named entity recognition methods usually assume that entities are continuous and cannot recognize non-continuous entities in the text to be recognized, after obtaining the text to be recognized, this embodiment performs entity recognition on the obtained text to be recognized, identifies flat entities from the text to be recognized, and then recognizes non-continuous entities in the text to be recognized based on the identified flat entities. For example, when the text to be recognized is "Zhang San takes the subway from Bao'an District, Shenzhen to Nanshan District to work every day", the flat entities "Zhang San" and "Shenzhen" in the text to be recognized are recognized, and then the non-continuous entities in the text to be recognized are recognized based on the flat entities "Zhang San" and "Shenzhen".
[0065] In a specific implementation, the text recognition method is applied to a text recognition model, such as Figure 2 As shown, the text recognition model includes a flat entity extraction module 100, and the flat entity extraction module 100 is used to perform entity recognition on the acquired text to be recognized to obtain the flat entity of the text to be recognized. Accordingly, the step of performing entity recognition on the acquired text to be recognized to obtain the flat entity of the text to be recognized specifically includes: inputting the acquired text to be recognized into the flat entity extraction module 100, and performing entity recognition on the acquired text to be recognized by the flat entity extraction module 100 to obtain the flat entity of the text to be recognized.
[0066] Furthermore, the flat entity extraction module 100 can be obtained by training a preset first network model through a first training data set, and the first training data set includes multiple first training texts and a true label sequence of each first training text. The training process of the first network model is: multiple first training texts in the first training data set are input into the first network model, the scores of all candidate label sequences of each first training text are output through the first network model, and the first loss value is determined based on the true label sequence of each first training text, the scores of all candidate label sequences of each first training text and the loss function of the first network model. When the first loss value does not meet the preset conditions, the model parameters of the first network model are corrected, and the step of inputting multiple first training texts in the first training data set into the first network model is continued until the first loss value meets the preset conditions. Among them, the calculation formula of the first loss value is: f represents the first loss value, i represents the i-th training text, Y′ represents the candidate label sequence set, s(X (i) ,y i ) indicates the first i-th training text in the true label sequence y i The score under s(X (i) , y′) represents the score of the i-th first training text under the candidate label sequence y′.
[0067] It should be noted that the text to be recognized in this embodiment may include one sentence or multiple sentences. When the text to be recognized includes multiple sentences, entity recognition is performed on each sentence in the text to be recognized, flat entities are identified from each sentence of the text to be recognized, and then non-continuous entity recognition is performed on the sentence based on the flat entities identified in each sentence.
[0068] In a specific implementation, step S10 includes:
[0069] Step S11, extracting features of the acquired text to be recognized to obtain a third feature of the text to be recognized;
[0070] Step S12: performing label mapping processing on the third feature to obtain a target label sequence of the text to be recognized;
[0071] Step S13: Determine the flat entity of the text to be recognized based on the target label sequence.
[0072] Specifically, the third feature is a vector matrix obtained by extracting context features from the word vector matrix of the text to be recognized. The third feature contains the context vector of each word in the text to be recognized. For example, the text to be recognized is x = [x1, x2, x3, x4], and the third feature of the text to be recognized is Then the context vector corresponding to word x1 can be determined from the third feature as [h 00 ,h 01 ,h 02 ,h 03 ], the context vector corresponding to word x2 is [h 10 ,h 11 ,h 12 ,h 13 ], the context vector corresponding to word x3 is [h 20 ,h 21 ,h 22 ,h 23 ], the context vector corresponding to word x4 is [h 30 ,h 31 ,h 32 ,h 33 ].
[0073] In a specific implementation, the step of extracting features from the acquired text to be recognized in step S11 to obtain the third feature of the text to be recognized may specifically include: encoding the acquired text to be recognized to obtain third encoding information of the text to be recognized; extracting features from the third encoding information to obtain the third feature of the text to be recognized. The third encoding information is a vectorized representation of the text to be recognized obtained by encoding the characters in the text to be recognized and mapping the characters in the text to be recognized into vectors, and the third encoding information contains the vectorized representation of each character in the text to be recognized. For example, the text to be recognized is x=[x1, x2, x3, x4], and the third encoding information of the text to be recognized is Then the vectorized representation corresponding to the character x1 can be determined from the third encoding information as [e 00 , e 01 , e 02 , e 03 ], the vector representation of word x2 is [e 10 , e 11 , e 12 , e 13 ], the vector representation of word x3 is [e 20 , e 21 , e 22 , e 23 ], the vectorized representation of word x4 is [e 30 , e 31 , e 32 , e 33 ].
[0074] Furthermore, the vectorized representation v of each word in the text to be recognized consists of three parts: word vector, block vector and position vector. v The expression is v = v t +v s +v p , v t =e t W t , v s =e s W s , v p =e p W p , v t Represents the word vector, v s represents a block vector, v p represents the position vector, e t Represents the unique hot vector corresponding to each word, e s Indicates the block code corresponding to each word. The block code corresponding to each word is the serial number of the block where each word is located. When the text to be recognized is a single block, the block codes of all words are 0. p represents the positional one-hot encoding, Wt , W s , W p They represent word vector matrix, block vector matrix, and position vector matrix respectively.
[0075] In a specific implementation, the step of performing label mapping processing on the third feature in step S12 specifically includes: performing a linear operation on the third feature to obtain initial score information of the text to be recognized; and determining a target label sequence of the text to be recognized based on the initial score information and predetermined conversion score information.
[0076] The initial score information is used to represent the label score of each word in the text to be recognized under multiple preset entity labels. For example, the initial score information is The multiple entity tags are [y1 y2 y3]. From the initial score information, we can determine that the tag scores of word x1 under multiple entity tags are t 00 ,t 01 and t 02 , the label scores of word x2 under multiple entity labels are t 10 ,t 11 and t 12 , the label scores of word x3 under multiple entity labels are t 20 ,t 21 and t 22 , the label scores of word x4 under multiple entity labels are t 30 ,t 31 and t 32 .
[0077] The conversion score information is used to represent the score of the transfer from one label to another label among multiple entity labels. For example, the conversion score information of multiple entity labels [y1 y2 y3] is t 40 ,t 41 and t 42 They represent the fraction of label y1 transferred to labels y1, y2, and y3, respectively, 50 ,t s1 and t 52 They represent the fraction of label y2 transferred to labels y1, y2, and y3, respectively, 60 ,t 61 and t 62 They represent the scores of label y3 being transferred to labels y1, y2, and y3 respectively.
[0078] Based on the initial score information, multiple candidate label sequences of the text to be recognized can be determined. The target label sequence is the label sequence with the highest score among the multiple candidate label sequences. The number of candidate label sequences is n. N, n represents the number of tags, and N represents the length of the text to be recognized. In a specific implementation, the step of determining the target tag sequence based on the initial score information and the conversion score information in step S12 may specifically include: determining the score of each candidate tag sequence in multiple candidate tag sequences based on the initial score information and the conversion score information; based on the score of each candidate tag sequence, selecting the tag sequence with the highest score from the multiple candidate tag sequences as the target tag sequence. The calculation formula for the score of each candidate tag sequence is: Represents the label y i-1 Followed by label y i The probability of Represents the word v i Mapped to label y i probability.
[0079] In a specific implementation, Figure 3 As shown, the flat entity recognition module 100 includes a first encoding layer 110, a first feature extraction layer 120 and a sequence annotation layer 130. The first encoding layer 110 is used to encode the text to be recognized to obtain the third encoding information of the text to be recognized; the first feature extraction layer 120 is used to extract features from the third encoding information to obtain the third feature of the text to be recognized; the sequence annotation layer 130 is used to determine the target label sequence of the text to be recognized based on the initial initial score information and the conversion score information. In a specific embodiment, the first encoding layer 110 can adopt a BERT (Bidirectional Encoder Representations from Transformer) model, the first feature extraction layer 120 can adopt a BiLSTM (Bi-directional long-short term memory) model, and the sequence annotation layer 130 can adopt a conditional random field (Conditional Random Fields, CRF) model.
[0080] Correspondingly, the step of performing entity recognition on the acquired text to be recognized in step S10 to obtain the flat entity of the text to be recognized may specifically include: inputting the acquired text to be recognized into the first encoding layer 110, encoding the text to be recognized through the first encoding layer 110, and obtaining third encoding information of the text to be recognized; inputting the third encoding information into the first feature extraction layer 120, performing feature extraction on the third encoding information through the first feature extraction layer 120, and obtaining a third feature of the text to be recognized; performing linear operation on the third feature to obtain initial score information of the text to be recognized; inputting the initial score information into the sequence annotation layer 130, and determining the target label sequence of the text to be recognized based on the initial score information and the conversion score information through the sequence annotation layer 130; and determining the flat entity of the text to be recognized based on the target label sequence.
[0081] Step S20: Calculate the relevance between the flat entity and the text to be recognized to obtain candidate segments of the flat entity.
[0082] Specifically, the candidate segment is a segment in the text to be recognized that is highly correlated with the flat entity. After obtaining the flat entity of the text to be recognized, this embodiment calculates the correlation between the flat entity and the text to be recognized, and can find hidden segments that are highly correlated with the flat entity and are not extracted due to sentence omission or redundancy from the text to be recognized. Discontinuous entity recognition is performed based on the candidate segment. When recognizing discontinuous entities, there is no need to enumerate all continuous segments for judgment, which can improve the efficiency of discontinuous entity recognition.
[0083] In a specific implementation, step S20 includes:
[0084] Step S21, calculating the correlation between the flat entity and the text to be recognized, and obtaining the correlation information between the flat entity and the text to be recognized;
[0085] Step S22: determining a text word score of the text to be recognized based on the relevance information, where the text word score is used to characterize the relevance between each word in the text to be recognized and the flat entity;
[0086] Step S23: Determine candidate segments of flat entities based on the text word scores.
[0087] The relevance information is used to characterize the relevance between the flat entity and the text to be recognized, and the text word score is used to characterize the relevance between each word in the text to be recognized and the flat entity. The higher the text word score, the higher the relevance between the word and the flat entity, and vice versa. Therefore, based on the text word score, hidden segments that are highly relevance to the flat entity and are not extracted due to sentence omission or redundancy can be found from the text to be recognized.
[0088] In a specific implementation, continue to refer to Figure 2As shown, the text recognition model also includes a text relevance calculation module 200 and a candidate segment extraction module 300. The text relevance calculation module 200 is used to perform relevance calculation on the flat entity and the text to be recognized to obtain relevance information between the flat entity and the text to be recognized. The candidate segment extraction module 300 is used to determine the text word score of the text to be recognized based on the relevance information, and determine the candidate segment of the flat entity based on the text word score. Accordingly, the step of performing relevance calculation on the flat entity and the text to be recognized to obtain the candidate segment of the flat entity specifically includes: inputting the flat entity and the text to be recognized into the text relevance calculation module 200, performing relevance calculation on the flat entity and the text to be recognized by the text relevance calculation module 200, and obtaining the relevance information between the flat entity and the text to be recognized; inputting the relevance information into the candidate segment extraction module 300, determining the text word score of the text to be recognized based on the relevance information by the candidate segment extraction module 300, and determining the candidate segment of the flat entity based on the text word score.
[0089] Further, refer to Figure 5 As shown, the candidate segment extraction module 300 includes a feature mapping layer 310 and a decoder 320. The feature mapping layer 310 is used to determine the text word score of the text to be recognized based on the relevance information, and the decoder 320 is used to determine the candidate segment of the flat entity based on the text word score. Accordingly, the steps of determining the text word score of the text to be recognized based on the relevance information by the candidate segment extraction module 300, and determining the candidate segment of the flat entity based on the text word score specifically include: inputting the relevance information into the feature mapping layer 310, determining the text word score of the text to be recognized based on the relevance information by the feature mapping layer 310; inputting the text word score into the decoder 320, and determining the candidate segment of the flat entity based on the text word score by the decoder 320.
[0090] In a specific implementation, when the decoder 320 determines the candidate segments of the flat entity based on the text word score, it can first remove irrelevant words from the text to be recognized based on the text word score and the preset hyperparameter, and then sort the remaining words in descending order according to the text word score, starting from the word with the highest text word score, to determine whether the word and other related words form a continuous segment, if so, then the continuous segment is determined as a candidate segment, otherwise, the word is discarded, thereby determining the candidate field with a very high correlation with the flat entity from the text to be recognized. Among them, the hyperparameter can be set according to the text to be recognized, for example, when the hyperparameter is 0.5, the words with text word scores below 0.5 in the text to be recognized are removed, and then the continuous segment is determined as the candidate segment from the remaining unremoved words.
[0091] In a specific implementation, the text relevance calculation module 200 can be obtained by training a preset second network model through a second training data set, and the second training data set includes multiple second training text pairs and the real score label of each second training text pair. The training process of the second network model is: multiple second training text pairs in the second training data set are input into the second network model, and the label score of each second training text pair under the preset multiple score labels is output through the second network model, and the second loss value is determined based on the real score label of each second training text pair, the label score of each second training text pair under the preset multiple score labels and the loss function of the second network model. When the second loss value does not meet the preset conditions, the model parameters of the second network model are corrected, and the step of inputting multiple second training texts in the second training data set into the second network model is continued until the second loss value meets the preset conditions. Among them, the calculation formula of the second loss value is: Loss1 represents the second loss value, C represents the number of score labels, T represents the number of second training text pairs, represents the label score of the t-th second training text pair under the c-th score label, and St represents the label score of the t-th second training text pair under the true score label.
[0092] In a specific implementation, step S21 includes:
[0093] Step S211, encoding the flat entity to obtain first encoding information, and encoding the text to be recognized to obtain second encoding information;
[0094] Step S212: extracting features from the first coded information to obtain a first feature, and extracting features from the second coded information to obtain a second feature;
[0095] Step S213: Determine the correlation information between the flat entity and the text to be recognized based on the first feature and the second feature.
[0096] Reference Figure 4As shown, the text relevance calculation module 200 includes a second encoding layer 210, a second feature extraction layer 220 and a feature interaction layer 230. The second encoding layer 210 is used to encode the flat entity and the text to be recognized respectively to obtain the first encoding information and the second encoding information. The second feature extraction layer 220 is used to extract features from the first encoding information and the second encoding information respectively to obtain the first feature and the second feature. The feature interaction layer 230 is used to determine the relevance information between the flat entity and the text to be recognized based on the first feature and the second feature. Among them, the second encoding layer 210 can adopt the Bert model, and the second feature extraction layer 220 can adopt the BiLSTM model. The process of the second encoding layer 210 encoding the flat entity and the text to be recognized can be expressed as: v1=Bert(B1), v2=Bert(B2), and the process of the second feature extraction layer 220 extracting features from the first encoded information and the second encoded information can be expressed as: P1=BiLSTM(v1), P2=BiLSTM(v2), B1 represents the flat entity, B2 represents the text to be recognized, v1 represents the first encoded information, v2 represents the second encoded information, P1 represents the first feature, and P2 represents the second feature.
[0097] Correspondingly, the step of calculating the correlation between the flat entity and the text to be recognized and obtaining the correlation information between the flat entity and the text to be recognized may specifically include: inputting the flat entity and the text to be recognized into the second encoding layer 210, encoding the flat entity and the text to be recognized respectively through the second encoding layer 210 to obtain first encoding information and second encoding information; inputting the first encoding information and the second encoding information into the second feature extraction layer 220, performing feature extraction on the first encoding information and the second encoding information respectively through the second feature extraction layer 220 to obtain first features and second features; inputting the first features and the second features into the feature interaction layer 230, and determining the correlation information between the flat entity and the text to be recognized based on the first features and the second features through the feature interaction layer 230.
[0098] In a specific implementation, when the feature interaction layer 230 determines the correlation information between the flat entity and the text to be recognized based on the first feature and the second feature, the first feature is first transposed, and then the first feature and the second feature after the transposition operation are multiplied to obtain the correlation information between the flat entity and the text to be recognized. The calculation formula of the correlation information is: L = (P1) T P2, L represents the correlation information, P1 represents the first feature, and P2 represents the second feature.
[0099] Further, continue to refer to Figure 4As shown, the text relevance calculation module 200 also includes a score mapping layer 240, which is used to determine the label score based on the relevance information. The label score of each second training text pair output during the second network model training process mentioned in the above steps under the preset multiple score labels is output by the score mapping layer 240. When the score mapping layer 240 determines the label score, it specifically sends the relevance information to the fully connected layer and uses the Softmax activation function to output the label score. The calculation formula is: Score = Softmax (FC (L)), Score represents the label score, and L represents the relevance information.
[0100] In a specific implementation, step S22 includes:
[0101] Step S221, obtaining the entity length of the flat entity and the text length of the text to be recognized;
[0102] Step S222, segmenting the relevance information based on the entity length and the text length to obtain a plurality of block information;
[0103] Step S223, performing a circular convolution operation on each of the multiple block information to obtain multiple block information after the convolution operation;
[0104] Step S224, splicing the multiple block information after the convolution operation to obtain splicing information;
[0105] Step S225: Apply the concatenated information to a preset activation function to obtain a text word score of the text to be recognized.
[0106] The multiple block information is information obtained by segmenting the relevance information based on the entity length of the flat entity and the text length of the text to be recognized. When segmenting the relevance information based on the entity length and the text length, the segmentation window size can be first determined based on the entity length, and then the number of block information can be determined based on the segmentation window size and the entity length. At the same time, the size of the block information can be determined based on the segmentation window size and the text length of the text to be recognized. Then, the relevance information is segmented based on the number of block information and the size of the block information, and multiple block information can be obtained. The calculation formula for the number of block information and the size of block information is: S = Md x +1, T = d x ×N, S represents the number of block information, T represents the size of the block information, d x represents the segmentation window size, M represents the entity length of the flat entity, 0<d x <M, N represents the length of the text to be recognized.
[0107] Circular convolution is a convolution operation different from linear convolution, and is a type of periodic convolution. In this embodiment, after the correlation information is divided into multiple block information, the multiple block information is subjected to circular convolution operations respectively to obtain multiple block information after the convolution operation. The circular convolution operation can be expressed as: R i =RNN(L xi ), L xi Indicates the i-th block information L x , R i Represents L after the convolution operation xi , Md x After the +1 block information is subjected to the circular convolution operation, Md can be obtained. x +1 R i .
[0108] The spliced information is the information obtained by splicing multiple block information after the convolution operation, wherein the process of splicing multiple block information can be expressed as: The text word score of the text to be recognized can be obtained by sending the splicing information into a preset activation function. Among them, the preset activation function can use a normalized exponential (soffmax) function, and the text word score can be expressed as: S x Represents the text word score.
[0109] Step S30: Determine non-continuous entities of the text to be recognized based on the flat entities and the candidate segments.
[0110] Specifically, after obtaining the candidate segments of the flat entity, the flat entity and the candidate segments can be used to form a candidate data set, wherein the candidate data set includes multiple segments, and then the segment combination that can form the entity is determined from the multiple segments, and the non-continuous entity of the text to be recognized is determined based on the segment combination. For example, the candidate data set can be represented as C = {c1, c2, ..., c k}, the candidate data set includes c1, c2, ..., c k These k fragments, if we determine c2 and c k can form an entity, then c2 and c k The composed fragments are combined as non-contiguous entities.
[0111] In a specific implementation, continue to refer to Figure 2As shown, the text recognition model also includes a non-continuous entity recognition module 400, which is used to determine the non-continuous entities of the text to be recognized based on the flat entity and the candidate segment. Accordingly, the step of determining the non-continuous entities of the text to be recognized based on the flat entity and the candidate segment specifically includes: inputting the flat entity and the candidate segment into the non-continuous entity recognition module 400, and outputting the non-continuous entities of the text to be recognized through the non-continuous entity recognition module 400.
[0112] Furthermore, the non-continuous entity recognition module 400 can be obtained by training a preset third network model through a third training data set, and the third training data set includes multiple third training text pairs and the true combination probability of each third training text pair. The training process of the third network model is: multiple third training text pairs in the third training data set are input into the third network model, the predicted combination probability of each third training text pair is output through the third network model, and the third loss value is determined based on the true combination probability, the predicted combination probability and the loss function of the third network model. When the third loss value does not meet the preset conditions, the model parameters of the third network model are corrected, and the step of inputting multiple third training text pairs in the third training data set into the third network model is continued until the third loss value meets the preset conditions. Among them, the calculation formula of the third loss value is: Loss2 represents the third loss value, R represents the third training data set, r represents the i-th third training text pair in the third training data set, p(r i ) represents the predicted combined probability of the i-th third training text pair, represents the true combination probability of the i-th third training text pair. When the i-th third training text pair can be combined, is equal to 1, when the i-th third training text pair cannot be combined, is equal to 0.
[0113] In a specific implementation, step S30 includes:
[0114] Step S31: construct a candidate data set based on the flat entity and the candidate segments, where the candidate data set includes multiple segments, and the multiple segments form multiple segment combinations;
[0115] Step S32, determining a combination feature of each of the plurality of segment combinations;
[0116] Step S33: determining the combination probability of each segment combination based on the combination feature, where the combination probability is used to characterize the probability that each segment combination constitutes an entity;
[0117] Step S34: Determine the non-continuous entities of the text to be recognized based on the combination probability.
[0118] Multiple segments in the candidate data set can be combined into multiple segment combinations. For example, the candidate data set is represented by C = {c1, c2, ..., c k}, among which, between c1 and c2, between c2 and c3, between c1 and c3, between c1 and c k In between, etc. can form a fragment combination.
[0119] The step of determining the combined features of each of the multiple segment combinations in step S32 may specifically include: obtaining a vectorized representation of each word in each segment, determining feature information of each segment based on the vectorized representation; and determining the combined features of each of the multiple segment combinations based on the feature information. The vectorized representation of each word in each segment may be directly obtained based on the second encoding information determined in step S21.
[0120] Specifically, when the correlation between the flat entity and the text to be recognized is calculated in step S21, the text to be recognized is encoded to obtain second encoding information, which contains a vectorized representation of each word in the text to be recognized, and the multiple fragments contained in the candidate data set are composed of words in the text to be recognized. Therefore, based on the second encoding information determined in step S21, the vectorized representation of each word in each fragment can be directly obtained.
[0121] like Figure 5 As shown, the non-continuous entity recognition module 400 includes a segment feature extraction layer 410, a combination feature extraction layer 420 and a combination discrimination layer 430. The segment feature extraction layer 410 is used to determine the feature information of each segment in a plurality of segments based on the vectorized representation of each character in each segment. The combination feature extraction layer 420 is used to determine the combination feature of each segment combination in a plurality of segment combinations based on the feature information. The combination discrimination layer 430 is used to determine the combination probability of each segment combination based on the combination feature. Accordingly, the step of determining the non-continuous entities of the text to be recognized based on the flat entities and the candidate segments specifically includes: constructing a candidate data set based on the flat entities and the candidate segments; inputting the vectorized representation of each character in each segment and the candidate data set into the segment feature extraction layer 410, and determining the feature information of each segment based on the vectorized representation through the segment feature extraction layer 410; inputting the feature information of each segment in the multiple segments into the combined feature extraction layer 420, and determining the combined features of each segment combination in the multiple segment combinations based on the feature information through the combined feature extraction layer 420; inputting the combined features of each segment combination into the combined discrimination layer 430, and determining the combined probability of each segment combination based on the combined features through the combined discrimination layer 430; and finally, determining the non-continuous entities of the text to be recognized based on the combined probability.
[0122] In a specific implementation, the segment feature extraction layer 410 may adopt a BiLSTM model. Then, based on the vectorized representation of each word in each segment, the process of determining the feature information of each segment in the multiple segments may be expressed as follows: a:b =BiLSTM(v' 2a ,…,v' 2b ), P a:b Indicates the feature information of the fragment, v' 2a represents the vectorized representation of the word at position a in the fragment, v' 2b Represents the vectorized representation of the word at segment position b.
[0123] In a specific implementation, the combined feature extraction layer 420 may use a dilated convolution kernel. When determining the combined features of each segment combination, the combined feature extraction layer 420 may perform a dilated convolution operation on the feature information of the segments in each segment combination, and learn the local combined feature information of the segment combination through the dilated convolution kernel, thereby obtaining the combined features of the segment combination. The combined features may be expressed as: c∈C =IDCNN(P a1:b1 ,…,P al:bl ), P c∈c represents the combined features of the fragment combination, P a:b Indicates the feature information of the first fragment in the fragment combination, P al:bl Represents the feature information of the lth fragment in the fragment combination. For example, a dilated convolution kernel with a dilation width of 2 can be used to perform a dilated convolution operation on the feature information of the fragments in each fragment combination, and zero padding is used to keep the dimensions before and after the convolution consistent. The size of the convolution kernel window can be set according to the dimension of the candidate data set.
[0124] In a specific implementation, when the combination discriminant layer 430 determines the combination probability of each fragment combination based on the combination feature, the combination feature can first be applied to a preset first activation function to obtain the combination feature after the first activation function is applied, and then the combination feature after the first activation function is applied to a preset second activation function to obtain the combination probability of each fragment combination. For example, the first activation function can use a linear rectification function (Linear rectification function, ReLU function), and the second activation function can use a sigmoid function, then the calculation formula for the combination probability is: p(e) = sigmoid(W·ReLu(P e )+b), where p(e) represents the combined probability, P e represents the combined features of the fragment combination, W represents the weight, and b represents the offset.
[0125] In a specific implementation, step S34 includes:
[0126] Step S341: determining a target segment combination based on the combination probability and a preset probability threshold, where the target segment combination is a segment combination whose combination probability is greater than the probability threshold among multiple segment combinations;
[0127] Step S342, updating the candidate data set based on the target segment combination, and continuing to perform the step of determining the combination feature of each segment combination in the plurality of segment combinations until the target segment combination no longer changes or the candidate data set is updated a preset number of times;
[0128] Step S343: Determine non-continuous entities of the text to be recognized based on the target segment combination.
[0129] The target segment combination is a segment combination whose combination probability is greater than a probability threshold among multiple segment combinations. The probability threshold is a preset threshold used to measure whether the target segment combination can form an entity. Figure 5 As shown, when determining the non-continuous entity of the text to be recognized based on the combination probability, first compare the combination probability with the preset probability threshold, determine the target segment combination from multiple segment combinations based on the comparison result, then add the target segment combination to the candidate data set to update the candidate data set, and continue to perform the steps of determining the feature information of each segment based on the vectorized representation, and determining the combined features of each segment combination in multiple segment combinations based on the feature information of each segment, until the target segment combination no longer changes or the number of updates of the candidate data set reaches the preset number, and finally determine the non-continuous entity of the text to be recognized based on the target segment combination, and non-continuous entities composed of more than two segments can be recognized from the text to be recognized. For example, when the text to be recognized is "Zhang San takes the subway from Bao'an District, Shenzhen to Nanshan District to work every day", it is determined based on the combination probability that the flat entity "Shenzhen" can constitute an entity with "Bao'an District" and "Nanshan District", then "Shenzhen Bao'an District" and "Shenzhen Nanshan District" are used as the target segment combination to update the candidate data set, and continue to judge whether there is a new target segment combination in the candidate data set. If not, "Shenzhen Nanshan District" is determined as the non-continuous entity of the text to be recognized.
[0130] It should be noted that the target segment combination no longer changes means that the target segment combinations determined twice are the same. For example, after the candidate data set is updated with "Bao'an District, Shenzhen" and "Nanshan District, Shenzhen" as the target segment combination, the target segment combination in the candidate data set is determined again based on the combination probability and the preset probability threshold. When the determined target segment combination is still "Bao'an District, Shenzhen" and "Nanshan District, Shenzhen", it means that the target segment combination no longer changes.
[0131] The update in the number of updates of the candidate data set refers to the updating of the candidate data set by adding the target segment combination to the candidate data set, and the number of updates refers to the number of times the candidate data set is updated by adding the target segment combination to the candidate data set. From the foregoing discussion, it can be seen that when determining the non-continuous entities of the text to be recognized, this embodiment will repeatedly perform the steps of determining the target segment combination from the candidate data set and adding the target segment combination to the candidate data set to update the candidate data set. The number of updates of the candidate data set also refers to the number of times this step is repeated.
[0132] In order to better implement the text recognition method in the embodiment of the present application, based on the text recognition method, the embodiment of the present application also provides a text recognition device, such as Figure 6 As shown, the text recognition device includes:
[0133] A first recognition unit 610 is used to perform entity recognition on the acquired text to be recognized, and obtain a flat entity of the text to be recognized;
[0134] A segment determination unit 620 is used to calculate the relevance between the flat entity and the text to be recognized to obtain candidate segments of the flat entity;
[0135] The second recognition unit 630 is used to determine non-continuous entities of the text to be recognized based on the flat entities and the candidate segments.
[0136] In an embodiment of the present application, a correlation is calculated between a flat entity and a text to be identified, so that hidden segments that are highly correlated with the flat entity but are not identified due to omission or redundancy in spoken language can be mined from the text to be identified. Non-continuous entity recognition is performed based on the flat entity and the candidate segments, so that all non-continuous entities can be extracted from the text to be identified, and there is no need to enumerate all continuous segments for judgment, which can improve the recognition efficiency of non-continuous entities.
[0137] In some embodiments of the present application, the first identification unit 610 is specifically used for:
[0138] Extracting features of the acquired text to be recognized to obtain a third feature of the text to be recognized;
[0139] Performing label mapping processing on the third feature to obtain a target label sequence of the text to be recognized;
[0140] Based on the target label sequence, the flat entities of the text to be recognized are determined.
[0141] In some embodiments of the present application, the segment determination unit 620 is specifically used to:
[0142] Calculating the correlation between the flat entity and the text to be recognized, and obtaining the correlation information between the flat entity and the text to be recognized;
[0143] Based on the relevance information, determining a text word score of the text to be recognized, where the text word score is used to characterize the relevance between each word in the text to be recognized and the flat entity;
[0144] Based on the text word scores, candidate segments for flat entities are determined.
[0145] In some embodiments of the present application, the segment determination unit 620 is further configured to:
[0146] Encoding the flat entity to obtain first encoding information, and encoding the text to be recognized to obtain second encoding information;
[0147] Extracting features from the first coded information to obtain a first feature, and extracting features from the second coded information to obtain a second feature;
[0148] Based on the first feature and the second feature, correlation information between the flat entity and the text to be recognized is determined.
[0149] In some embodiments of the present application, the segment determination unit 620 is further configured to:
[0150] Get the entity length of the flat entity and the text length of the text to be recognized;
[0151] The relevance information is segmented based on the entity length and the text length to obtain multiple blocks of information;
[0152] Performing a circular convolution operation on each of the multiple block information to obtain multiple block information after the convolution operation;
[0153] Splicing multiple block information after the convolution operation to obtain splicing information;
[0154] The concatenated information is applied to a preset activation function to obtain the text word score of the text to be recognized.
[0155] In some embodiments of the present application, the second identification unit 630 is specifically used for:
[0156] Building a candidate data set based on the flat entity and the candidate segments, the candidate data set includes multiple segments, and the multiple segments form multiple segment combinations;
[0157] determining a combination feature of each of the plurality of segment combinations;
[0158] Based on the combination features, the combination probability of each fragment combination is determined, and the combination probability is used to characterize the probability that each fragment combination constitutes an entity;
[0159] Based on the combined probability, non-continuous entities of the text to be recognized are determined.
[0160] In some embodiments of the present application, the second identification unit 630 is further used to:
[0161] Based on the combination probability and a preset probability threshold, determine a target segment combination, where the target segment combination is a segment combination whose combination probability is greater than the probability threshold among the multiple segment combinations;
[0162] The candidate data set is updated based on the target segment combination, and the step of determining the combination feature of each segment combination in the plurality of segment combinations is continued until the target segment combination no longer changes or the candidate data set is updated a preset number of times;
[0163] Based on the target segment combination, the non-continuous entities of the text to be recognized are determined.
[0164] The embodiment of the present application further provides a computer device, which integrates any one of the text recognition devices provided in the embodiment of the present application, and the computer device includes:
[0165] one or more processors;
[0166] Memory; and
[0167] One or more applications, wherein the one or more applications are stored in the memory and are configured to execute, by the processor, the steps of the text recognition method in any of the above text recognition method embodiments.
[0168] The present application also provides a computer device that integrates any of the text recognition devices provided in the present application. Figure 7 As shown, it shows a schematic diagram of the structure of the computer device involved in the embodiment of the present application, specifically:
[0169] The computer device may include one or more processing core processors 801, one or more computer-readable storage media memories 802, a power supply 803, an input unit 804 and other components. Those skilled in the art will appreciate that Figure 7 The computer device structure shown in the figure does not constitute a limitation on the computer device, and may include more or fewer components than shown in the figure, or combine certain components, or arrange the components differently. Among them:
[0170] The processor 801 is the control center of the computer device. It uses various interfaces and lines to connect various parts of the entire computer device. By running or executing software programs and / or modules stored in the memory 802 and calling data stored in the memory 802, it executes various functions of the computer device and processes data, thereby monitoring the computer device as a whole. Optionally, the processor 801 may include one or more processing cores; preferably, the processor 801 may integrate an application processor and a modem processor, wherein the application processor mainly processes the operating system, user interface, and application programs, and the modem processor mainly processes wireless communications. It is understandable that the above-mentioned modem processor may not be integrated into the processor 801.
[0171] The memory 802 can be used to store software programs and modules. The processor 801 executes various functional applications and data processing by running the software programs and modules stored in the memory 802. The memory 802 may mainly include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application required for at least one function (such as a sound playback function, an image playback function, etc.), etc.; the data storage area may store data created according to the use of the computer device, etc. In addition, the memory 802 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, or other volatile solid-state storage devices. Accordingly, the memory 802 may also include a memory controller to provide the processor 801 with access to the memory 802.
[0172] The computer device also includes a power supply 803 for supplying power to each component. Preferably, the power supply 803 can be logically connected to the processor 801 through a power management system, so that the power management system can manage charging, discharging, power consumption and other functions. The power supply 803 can also include one or more DC or AC power supplies, recharging systems, power failure detection circuits, power converters or inverters, power status indicators and other arbitrary components.
[0173] The computer device may further include an input unit 804, which may be used to receive input digital or character information and generate keyboard, mouse, joystick, optical or trackball signal input related to user settings and function control.
[0174] Although not shown, the computer device may further include a display unit, etc., which will not be described in detail herein. Specifically in this embodiment, the processor 801 in the computer device will load the executable files corresponding to the processes of one or more application programs into the memory 802 according to the following instructions, and the processor 801 will run the application programs stored in the memory 802, thereby realizing various functions, as follows:
[0175] Performing entity recognition on the acquired text to be recognized to obtain a flat entity of the text to be recognized;
[0176] Calculate the relevance between the flat entity and the text to be recognized to obtain candidate segments of the flat entity;
[0177] Based on the flat entities and candidate segments, non-continuous entities of the text to be recognized are determined.
[0178] A person of ordinary skill in the art will appreciate that all or part of the steps in the various methods of the above embodiments may be completed by instructions, or by controlling related hardware through instructions. The instructions may be stored in a computer-readable storage medium and loaded and executed by a processor.
[0179] To this end, the embodiment of the present application provides a computer-readable storage medium, which may include: a read-only memory (ROM), a random access memory (RAM), a disk or an optical disk, etc. A computer program is stored thereon, and the computer program is loaded by a processor to execute the steps in any text recognition method provided in the embodiment of the present application. For example, the computer program loaded by the processor can execute the following steps:
[0180] Performing entity recognition on the acquired text to be recognized to obtain a flat entity of the text to be recognized;
[0181] Calculate the relevance between the flat entity and the text to be recognized to obtain candidate segments of the flat entity;
[0182] Based on the flat entities and candidate segments, non-continuous entities of the text to be recognized are determined.
[0183] In the above embodiments, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, please refer to the detailed description of other embodiments above, and will not be repeated here.
[0184] In specific implementation, the above units or structures can be implemented as independent entities, or can be arbitrarily combined to be implemented as the same or several entities. The specific implementation of the above units or structures can refer to the previous method embodiments, which will not be repeated here.
[0185] The specific implementation of the above operations can be found in the previous embodiments, which will not be described in detail here.
[0186] The above is a detailed introduction to a text recognition method, device, computer equipment and computer-readable storage medium provided in the embodiments of the present application. Specific examples are used in this article to illustrate the principles and implementation methods of the present application. The description of the above embodiments is only used to help understand the method of the present application and its core idea; at the same time, for technical personnel in this field, according to the ideas of the present application, there will be changes in the specific implementation methods and application scopes. In summary, the content of this specification should not be understood as a limitation on the present application.
Claims
1. A text recognition method, characterized in that: include: Performing entity recognition on the acquired text to be recognized to obtain a flat entity of the text to be recognized; Calculating the relevance between the flat entity and the text to be recognized to obtain candidate segments of the flat entity; Based on the flat entity and the candidate segment, a non-continuous entity of the text to be recognized is determined.
2. The method according to claim 1, characterized in that The calculating the relevance between the flat entity and the text to be recognized to obtain candidate segments of the flat entity includes: Calculating the correlation between the flat entity and the text to be recognized to obtain correlation information between the flat entity and the text to be recognized; Determine a text word score of the text to be recognized based on the relevance information, wherein the text word score is used to represent the relevance degree between each word in the text to be recognized and the flat entity; Based on the text word scores, candidate segments of the flat entity are determined.
3. The method according to claim 2, characterized in that The calculating the correlation between the flat entity and the text to be recognized to obtain the correlation information between the flat entity and the text to be recognized includes: Encoding the flat entity to obtain first encoding information, and encoding the text to be recognized to obtain second encoding information; Extracting features from the first coded information to obtain a first feature, and extracting features from the second coded information to obtain a second feature; Based on the first feature and the second feature, correlation information between the flat entity and the text to be recognized is determined.
4. The method according to claim 2, characterized in that: The step of determining the text word score of the to-be-recognized text based on the relevance information comprises: Obtaining the entity length of the flat entity and the text length of the text to be recognized; Segmenting the relevance information based on the entity length and the text length to obtain a plurality of block information; Performing a circular convolution operation on each of the plurality of block information to obtain a plurality of block information after the convolution operation; Splicing the plurality of block information after the convolution operation to obtain spliced information; The splicing information is applied to a preset activation function to obtain a text word score of the text to be recognized.
5. The method according to claim 1, characterized in that The step of determining the non-continuous entity of the text to be recognized based on the flat entity and the candidate segment includes: Building a candidate data set based on the flat entity and the candidate segments, wherein the candidate data set includes a plurality of segments, and a plurality of the segments form a plurality of segment combinations; Determining a combination feature of each of the plurality of said fragment combinations; Based on the combination feature, determining a combination probability of each of the fragment combinations, wherein the combination probability is used to characterize a probability that each of the fragment combinations constitutes an entity; Based on the combination probability, non-continuous entities of the text to be recognized are determined.
6. The method according to claim 5, characterized in that The determining the non-continuous entities of the to-be-recognized text based on the combined probability includes: Based on the combination probability and a preset probability threshold, determining a target segment combination, the target segment combination being a segment combination whose combination probability is greater than the probability threshold among the plurality of segment combinations; The candidate data set is updated based on the target segment combination, and the step of determining the combination feature of each segment combination in the plurality of segment combinations is continued until the target segment combination no longer changes or the candidate data set is updated a preset number of times; Based on the target segment combination, non-continuous entities of the text to be recognized are determined.
7. The method according to any one of claims 1 to 6, characterized in that: The step of performing entity recognition on the acquired text to be recognized to obtain a flat entity of the text to be recognized includes: Extracting features of the acquired text to be recognized to obtain a third feature of the text to be recognized; Performing label mapping processing on the third feature to obtain a target label sequence of the text to be recognized; Based on the target tag sequence, a flat entity of the to-be-recognized text is determined.
8. A text recognition device, characterized in that: include: A first recognition unit is used to perform entity recognition on the acquired text to be recognized to obtain a flat entity of the text to be recognized; A segment determination unit, configured to calculate the relevance between the flat entity and the text to be recognized, and obtain candidate segments of the flat entity; The second recognition unit is used to determine the non-continuous entities of the text to be recognized based on the flat entities and the candidate segments.
9. A computer device, characterized in that: The computer device comprises: one or more processors; Memory; and One or more application programs, wherein the one or more application programs are stored in the memory and are configured to be executed by the processor to implement the text recognition method according to any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that: A computer program is stored thereon, and the computer program is loaded by a processor to execute the steps in the text recognition method according to any one of claims 1 to 7.
