An entity opinion extraction method based on dependency analysis and reference resolution
By employing dependency analysis and referential resolution methods, the problems of inaccuracy and redundancy in speech extraction in existing technologies are solved, enabling fast and accurate entity speech extraction, thereby improving reading efficiency and the clarity of information retrieval.
Patent Information
- Application Number
- CN202310320934.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-03-29
- Publication Date
- 2026-01-23
- Estimated Expiration
- 2043-03-29
AI Technical Summary
Existing entity speech extraction methods cannot accurately extract the actual speech in the test text and fail to effectively handle the referentiality of the speech subject, resulting in information redundancy and low reading efficiency.
We employ a method based on dependency parsing and dereference resolution. By parsing the text structure through dependency parsing rules, we identify the subject and predicate. We then combine the dereference resolution model to process pronouns and extract entity statements containing the subject, trigger words, and statements.
It improves the accuracy and efficiency of speech extraction, simplifies the text content, and enables users to quickly and accurately obtain opinions, viewpoints and positions from all parties.
Smart Images

Figure CN116341551B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the field of text information extraction, in particular to an entity opinion extraction method based on dependency analysis and anaphora resolution. BACKGROUND
[0002] With the rapid development of Internet technology, obtaining social, economic, political, and life information through the network has become an indispensable part of people's daily life. At the same time, the development of network technology has also caused an explosive growth of network information, which has affected the reading efficiency of people on information. From the mass of information and the long news reports, quickly and effectively obtaining the opinions, views, and positions of important entities (such as persons or institutions) has become an important method to improve the information reading efficiency. Therefore, the research on entity opinion extraction has very important significance.
[0003] At present, the methods for entity opinion extraction mainly include rule-based methods and machine learning-based methods, but the overall effect is not ideal. The main problems are as follows:
[0004] On the one hand, the existing methods identify whether there is an opinion in a to-be-tested text, and if there is, the entire to-be-tested text is regarded as an entity opinion, without extracting the real opinion part in the to-be-tested text, which leads to text data redundancy and a large amount of non-opinion information in the obtained opinion data. On the other hand, the existing methods do not consider the existence of anaphora of the opinion subject, and the opinion subject may be a pronoun or a noun, such as "he", "she", "the speaker", "the reporter", "the organization", "the institution", etc., which makes it difficult for users to see who actually made the opinion, and makes it difficult for users to better, faster, and more comprehensively understand and master the opinions, views, and positions of all parties in news information.
[0005] Therefore, there is an urgent need for an entity opinion extraction method that can accurately extract the real opinion in the to-be-tested text and the real entity corresponding to the opinion, so as to clearly and quickly master the opinions, views, and positions of all parties. SUMMARY
[0006] Therefore, the purpose of the present application is to overcome the defects of the prior art and provide an entity opinion extraction method based on dependency analysis and anaphora resolution.
[0007] The purpose of the present application is achieved by the following technical solutions:
[0008] According to a first aspect of the present application, there is provided an entity opinion extraction method based on dependency analysis and anaphora resolution, comprising: step S1, parsing a text to be tested based on a dependency analysis rule to obtain a dependency analysis result, and obtaining a subject and a predicate in the text to be tested from the dependency analysis result; step S2, identifying whether the subject in the text to be tested is an entity, and identifying whether the predicate in the text to be tested is a trigger word; step S3, when the subject in the text to be tested is an entity and the corresponding predicate is a trigger word, extracting an opinion after the trigger word in the text to be tested to obtain an entity opinion containing the subject, the trigger word and the opinion, wherein when the subject is a pronoun, a real entity name pointed to by the pronoun is extracted from a previous text of the pronoun as the subject in the entity opinion by using an anaphora resolution manner.
[0009] In some embodiments of the present application, the anaphora resolution manner in step S3 comprises: splicing the text to be tested and one or more previous texts adjacent to the text to be tested to obtain a spliced text, processing a text before a pronoun in the spliced text by using a predetermined entity recognition manner to obtain all candidate entities in the spliced text, wherein the pronoun is not included in all the candidate entities; analyzing a real entity name pointed to by the pronoun based on all the candidate entities, the spliced text and the pronoun by using a trained anaphora resolution model to obtain the real entity name as the subject in the entity opinion.
[0010] In some embodiments of the present application, the anaphora resolution model comprises: a feature extraction module configured to extract a candidate entity feature and a pronoun feature according to each time input of a candidate entity selected from all the candidate entities, the pronoun and the spliced text, to obtain a feature vector of the candidate entity and a feature vector of the pronoun feature, to splice the feature vector of the candidate entity and the feature vector of the pronoun to obtain a spliced feature vector, and to process the spliced feature vector to obtain a comprehensive feature vector; and an activation function module configured to obtain a probability value of an anaphora relationship between the candidate entity and the pronoun according to the comprehensive feature vector; wherein the anaphora resolution model outputs a candidate entity corresponding to a maximum probability value according to all the probability values between the candidate entities and the pronoun, and takes the corresponding candidate entity as the real entity name when the maximum probability value is greater than a predetermined threshold.
[0011] In some embodiments of the present application, the feature extraction module comprises: a preprocessing layer configured to extract position information of the input candidate entity and position information of the pronoun; an embedding layer configured to encode the concatenated text to obtain a word granularity feature vector; a first Bi-LSTM neural network configured to extract context semantic features of each word of the concatenated text according to the word granularity feature vector; a concatenation layer configured to extract a feature vector of the candidate entity and a feature vector of the pronoun according to the context semantic features of each word, the position information of the candidate entity and the position information of the pronoun, and concatenate the feature vector of the candidate entity and the feature vector of the pronoun respectively to obtain a concatenated feature vector; a CNN layer configured to perform convolution processing on the concatenated feature vector to obtain a convolution feature vector; a pooling layer configured to perform max-pooling processing on the convolution feature vector to obtain a pooled feature vector; and a fully connected neural network configured to process the pooled feature vector to obtain a comprehensive feature vector.
[0012] In some embodiments of the present application, the anaphora resolution model is trained in the following manner: a first training set is obtained, each first sample in the first training set comprising input data and a label, the input data comprising a concatenated text, a candidate entity in the concatenated text and a pronoun, and the label indicating whether the candidate entity and the pronoun are in a correct anaphora relationship; the anaphora resolution model is trained using the first training set to predict a probability value of the candidate entity and the pronoun being in a correct anaphora relationship, to obtain a prediction result, a first loss is calculated according to the prediction result and the label, and the parameters of the anaphora resolution model are updated according to the first loss.
[0013] In some embodiments of the present application, the entity recognition manner for identifying whether the subject in the text to be tested is an entity in the step S2 comprises: based on a pre-constructed entity noun library, performing rule matching between words in the text to be tested and words in the entity noun library to extract entities in the text to be tested to obtain a first entity set, wherein the entity noun library contains names of persons and names of institutions in multiple countries and multiple fields; based on a trained named entity recognition model, extracting entities in the text to be tested to obtain a second entity set; merging the entities of the first entity set and the second entity set to obtain all extracted entities, and identifying whether the subject is an entity according to the all extracted entities.
[0014] In some embodiments of the present application, the named entity recognition model comprises: a BERT neural network configured to extract features of the text to be tested to obtain a word granularity feature vector; a second Bi-LSTM neural network configured to extract context semantic features of each word according to the word granularity feature vector to obtain a prediction label score of each word; and a CRF neural network configured to obtain an entity recognition result according to the prediction label score of each word.
[0015] In some embodiments of the present invention, the named entity recognition model is trained in the following manner: a second training set is obtained, wherein each second sample in the second training set is a test text, and each test text corresponds to a label sequence, the label sequence including the labels of all words in the test text; the named entity recognition model is trained using the training set to recognize entities in the test text, the entity recognition result is obtained, and a second loss is calculated based on the entity recognition result and the label sequence of the sample, and the parameters of the named entity recognition model are updated based on the second loss.
[0016] In some embodiments of the present invention, the method of identifying whether the predicate in the text to be tested is a trigger word in step S2 includes: matching the predicate with the trigger words in the predicate based on a pre-built speech trigger word library to identify whether the predicate is a trigger word.
[0017] In some embodiments of the present invention, the trigger words in the speech trigger word library include: indicate, point out, frankly, say, think, tell, it seems, reveal, said, introduce, call, in general, explicitly, emphasize, mention, speak frankly, say, in writing, mention, appeal, write, suggest, say, generally believe, sometimes, in general, especially emphasize, raise, words, claim, reiterate, declare, condemn, accuse, speak out, allude, imply, call upon, complain, tell, mutter, murmur, confide, confess, discuss, talk, instruct, speak, swear, announce, explain, advise, advise, talk. Conversation, speech, narration, statement, exchange, conversation, admonition, debate, argument, question, answer, chat, lobbying, speech, explanation, description, blame, enumeration, evaluation, discussion, talk, talk, persuade, urge, rhetorical question, ask, make a false statement, make a false claim, lie, sophistry, defense, explanation, explanation, description, narration, argument, debate, protest, retell, discuss, refute, criticize, insult, curse, narrate, appeal, state, explain, defend, clarify, admonish, joke, ridicule, mock, insult, curse, prophecy, promise, commitment and commitment or a combination thereof.
[0018] In some embodiments of the present invention, the dependency analysis results obtained in step S1 are obtained by: parsing the syntactic structure of the text under test according to the part of speech of each word in the text under test using dependency analysis rules, obtaining dependency analysis results including dependency relationships between words, determining whether a subject-predicate relationship exists in the text under test based on the dependency analysis results, and extracting two words belonging to the subject-predicate relationship in the corresponding text under test based on the dependency analysis results of the existence of a subject-predicate relationship, thereby obtaining the subject and predicate in the text under test.
[0019] In some embodiments of the present invention, the method of extracting the speech after the trigger word in the test text in step S3 to obtain the entity speech includes: extracting a segment of text from the trigger word to the end of the sentence in the test text as the speech, retaining the punctuation marks in the sentence and the terminating punctuation marks at the end of the sentence in the speech, and extracting the subject and trigger word in the test text to obtain the entity speech containing the subject, trigger word and speech.
[0020] In some embodiments of the present invention, before parsing the test text based on predetermined dependency parsing rules in step S1, the method further includes: segmenting the text data into sentences based on a pre-constructed dictionary of sentence-ending punctuation marks to obtain multiple test texts, wherein the text data is news text or website / forum text; performing word segmentation processing on the test text based on a pre-constructed entity noun database and word segmentation tool, wherein the entity noun database contains names of people and organizations from multiple countries and fields; and labeling each word in the segmented test text with its corresponding part of speech for parsing the test text.
[0021] According to a second aspect of the present invention, an electronic device is provided, comprising: one or more processors; and a memory for storing executable instructions; wherein the one or more processors are configured to implement the steps of the method according to any one of the first aspects of the present invention by executing the executable instructions.
[0022] Compared with the prior art, the advantages of the present invention are as follows:
[0023] This invention determines whether an entity has made a statement by performing dependency analysis on the test text and confirming whether the subject and predicate are entities and trigger words, respectively. It can quickly detect the presence of statements in the test text. If no statements are found, subsequent statement extraction is not performed, greatly improving the efficiency of statement extraction. When statements are confirmed to have been made, they are extracted, and the extracted "subject," "trigger word (predicate)," and "statement" are used as the three elements of the entity statement, simplifying the text content and significantly improving reading efficiency. Furthermore, when the subject of an entity statement is a pronoun, a referential resolution method is used to replace the pronoun with the actual entity name of the statement, enabling users to obtain timely and accurate statements, opinions, and positions from various parties online. Attached Figure Description
[0024] The embodiments of the present invention will be further described below with reference to the accompanying drawings, wherein:
[0025] Figure 1 This is a schematic diagram of an entity speech extraction method based on dependency analysis and dereference resolution according to an embodiment of the present invention.
[0026] Figure 2A schematic diagram of the overall implementation process of entity speech extraction from a piece of text data according to an embodiment of the present invention;
[0027] Figure 3 This is a schematic diagram illustrating the transformation of dependency analysis results corresponding to a text under test into a dependency tree according to an embodiment of the present invention;
[0028] Figure 4 This is a schematic diagram illustrating the principle of a referential resolution process based on a trained referential resolution model according to an embodiment of the present invention. Detailed Implementation
[0029] To make the objectives, technical solutions, and advantages of this invention clearer, the invention will be further described in detail below with reference to the accompanying drawings and specific embodiments. It should be understood that the specific embodiments described herein are merely illustrative and are not intended to limit the invention.
[0030] As mentioned in the background section, on the one hand, existing methods extract redundant text data of speech; on the other hand, existing methods do not consider the situation where the subject of the speech has a referent when extracting speech, making it impossible for users to better, faster and more comprehensively understand and grasp the opinions, views and positions of all parties in news information.
[0031] Because existing technologies, when extracting speech, directly treat the entire text as an entity speech when speech is detected, resulting in a large amount of non-speech information and a large volume of speech text data, the inventors addressed this issue by extracting only the "subject," "trigger word (predicate)," and "speech" from the detected speech as entity speech, which greatly simplifies the speech text. Furthermore, news texts, forum texts, or website posts typically contain numerous pronouns. Existing methods extract the entire text containing speech without considering the real name of the subject, resulting in insufficiently concise speech, difficulty in quickly and clearly identifying the source of the speech, and increased text processing costs, even if it doesn't significantly reduce reading efficiency. Therefore, after initially extracting concise entity speech, the inventors further considered whether the subject in the entity speech was a pronoun, replacing it with the real entity name when the subject was a pronoun. This method yields entity speech that clearly and concisely reflects the opinions, viewpoints, and positions of all parties, greatly improving reading efficiency.
[0032] Based on the above analysis, this invention provides an entity speech extraction method based on dependency analysis and referential resolution. (See [link to relevant documentation]). Figure 1The method includes: Step S1, parsing the text to be tested based on dependency parsing rules to obtain dependency parsing results, and obtaining the subject and predicate in the text to be tested from the dependency parsing results; Step S2, identifying whether the subject in the text to be tested is an entity, and identifying whether the predicate in the text to be tested is a trigger word; This invention uses steps S1 and S2 to perform dependency parsing on the text to be tested and to confirm whether the subject and predicate are entities and trigger words respectively, to confirm whether there is an entity making a statement. This method can quickly detect whether there is a statement in the text to be tested. If there is no statement, the subsequent statement extraction of the text to be tested will not be performed, which greatly improves the statement extraction efficiency; Step S3, when the subject in the text to be tested is an entity and the corresponding predicate is a trigger word, extracting the statement after the trigger word in the text to obtain an entity statement containing the subject, trigger word and statement. Wherein, when the subject is a pronoun, the real entity name referred to by the pronoun is extracted from the preceding text of the pronoun as the subject in the entity statement by using the pronoun resolution method. This invention extracts comments upon confirmation of their publication and uses the extracted "subject," "trigger word (predicate)," and "comment" as the three essential elements of an entity comment, simplifying the text and significantly improving reading efficiency. Furthermore, when the subject of an entity comment is a pronoun, it replaces the pronoun with the actual entity name of the comment, enabling users to promptly and accurately obtain comments, viewpoints, and positions from various parties online.
[0033] Before describing the embodiments of the present invention in detail, some of the terms used therein are explained as follows:
[0034] Entity: refers to an objectively existing object or thing in the real world that can be distinguished from one another. In this invention, it refers to the name of a person or organization (i.e., entity name).
[0035] Trigger words: These are words that connect the subject to the subject's statement, such as "express", "point out", "frankly", "say", "believe", "tell", "reveal", "claim", etc.
[0036] According to one embodiment of the present invention, entity speech extraction from a piece of text data mainly includes two parts:
[0037] I. The text preprocessing process involves preprocessing a piece of text data to obtain multiple test texts;
[0038] II. Entity speech extraction process, which involves extracting entity speech from each text to be tested.
[0039] illustrative, see Figure 2 , Figure 2To illustrate the overall process of entity speech extraction from a text dataset, the process begins by first segmenting the text into multiple test texts. Each test text is then segmented into words and labeled with its corresponding part-of-speech tagging, thus preprocessing the text. Next, based on the tagged test texts, dependency analysis is performed using part-of-speech analysis to determine if a subject and trigger words are included. Simultaneously, entity recognition is performed on the test texts to determine if the subject is an entity. If the test text includes a subject and trigger words, and the subject is an entity, entity speech is identified and extracted. This process includes determining if the subject in the extracted entity speech is a pronoun. When the extracted subject is a pronoun, a pronoun resolution method is used to obtain the real entity name referred to by the pronoun from the text dataset as the subject of the entity speech. Finally, the extracted entity speech is output, thus achieving entity speech extraction.
[0040] To better understand this application, the two parts of entity speech extraction in the above embodiments will be described in detail below.
[0041] I. Text Preprocessing
[0042] According to an embodiment of the present invention, the method of preprocessing a piece of text data to obtain multiple texts to be tested includes the following steps a1, a2, and a3:
[0043] In step a1, the text data is segmented into sentences based on a pre-constructed dictionary of sentence-ending punctuation marks, resulting in multiple test texts.
[0044] According to one embodiment of the present invention, a dictionary of sentence-ending punctuation marks is pre-constructed. This includes Chinese periods, question marks, exclamation marks, and two types of ellipses, as detailed below: .
[0045] Since this invention requires extracting entity statements, and considering that statements may be enclosed in a pair of double quotes, and that the text within the double quotes may contain sentence-ending punctuation, to avoid splitting a statement into different sentences, it is necessary to identify the distribution of double quote pairs in the text data. According to one embodiment of this invention, the strategy for segmenting text data includes: detecting from left to right whether a piece of text contains a pair of double quotes; if it does, skipping the text between the double quotes and extracting the text from the beginning of the sentence to the first sentence-ending punctuation mark after the double quote pair as a test text; if it does not contain the pair, extracting the text from the beginning of the sentence to the first sentence-ending punctuation mark. Finally, after segmenting a piece of text according to the sentence-segmentation strategy of this invention, a list of sentences is obtained. ,Right now: , This represents the first text to be tested. This represents the second text to be tested. Indicates the first The sentence segmentation strategy of this invention can separate different statements and assign them to different test texts, while also avoiding the splitting of a single statement into different test texts. Based on the test texts segmented in this way, statement recognition and extraction are performed, greatly improving the accuracy of statement recognition and extraction, and reducing the difficulty of recognition and extraction. Below is an example of sentence segmentation for a text:
[0046] Example 1: A passage reads: "Today is the weekend, and the weather is very nice. Mr. Li said, 'Many scholars came today. I am very happy to attend the meeting today.'" According to the sentence segmentation strategy of this invention, this passage can be divided into two test texts: Test Text ① Today is the weekend, and the weather is very nice. Test Text ② Mr. Li said, "Many scholars came today. I am very happy to attend the meeting today." That is, the text within a pair of quotation marks does not need to be segmented.
[0047] In step a2, the test text is segmented based on a pre-built entity noun database and a word segmentation tool. The entity noun database contains names of people and organizations from multiple countries and fields. This invention has collected names of people and organizations from multiple countries and fields worldwide to construct the entity noun database. The entity noun database contains approximately 100,000 names of people and organizations. This database is added to the dictionary of a word segmentation tool. Specifically, this invention uses jieba's word segmentation tool, enabling the tool to effectively identify people and organizations, thus achieving accurate word segmentation of the test text.
[0048] In step a3, each word in the segmented text is labeled with its corresponding part-of-speech tagging for parsing. According to an embodiment of the present invention, jieba is used for word segmentation and part-of-speech tagging. The meanings of common parts of speech are shown in Table 1 below:
[0049] Table 1: Common Parts of Speech and Meaning
[0050]
[0051] Table 1 above includes common parts of speech and their corresponding English symbols. When performing word segmentation and part-of-speech tagging using jieba, the English symbols corresponding to the parts of speech are used for tagging. For example, the text to be tested is: "Attending the meeting on the day, Li said that he was very happy to attend the meeting organized by the Science and Technology Association today." After word segmentation using the jieba tool, the text to be tested after word segmentation is: ['at', 'attending', 'that day', 'of', 'meeting', 'on', ',', 'Li', 'say', ',', 'he', 'very', 'happy', 'able', 'with', 'everyone', 'senior', 'together', 'cooperate','. Based on word segmentation, part-of-speech tagging is performed to obtain the preprocessed test text t1, namely: t1 = ['at\p', 'attend\v', 'that day\t', 'of\uj', 'meeting\n', 'on\f', ',\x', 'Li Mou\nr', 'represent\v', ',\x', 'today\t', 'very\d', 'happy\v', 'able\v', 'participate\v', 'talk\v', '。\x']. Each word in the preprocessed test text t1 is tagged with its part of speech in English symbols.
[0052] II. Entity Speech Extraction Process
[0053] According to an embodiment of the present invention, an entity speech extraction method based on dependency analysis and referential resolution is provided. This method identifies and extracts speech from each test text obtained according to the preprocessing method described above, specifically including steps S1, S2, and S3. To better understand the entity speech extraction process of the present invention, each step of the entity speech extraction method is explained in detail below.
[0054] In step S1, the text to be tested is parsed based on dependency parsing rules to obtain dependency parsing results, and the subject and predicate in the text to be tested are obtained from the dependency parsing results.
[0055] According to an embodiment of the present invention, the dependency analysis results obtained in step S1 include: parsing the syntactic structure of the test text according to the part of speech of each word in the test text using dependency analysis rules to obtain dependency analysis results including dependency relationships between words; determining whether a subject-predicate relationship exists in the test text based on the dependency analysis results; and extracting two words belonging to the subject-predicate relationship in the corresponding test text based on the dependency analysis results of the existence of a subject-predicate relationship to obtain the subject and predicate in the test text.
[0056] According to one embodiment of the present invention, the syntactic structure of the test text is parsed using the dependency analysis tool of pyltp to obtain dependency analysis results including the dependency relationships between each word and its corresponding words. Common dependency relationship types in pyltp are shown in Table 2 below:
[0057] Table 2: Common Dependency Types in pyltp
[0058]
[0059] Table 2 above includes common dependency relation types in PyLTP and their corresponding symbols, along with an example for each dependency relation. Based on these common dependency relation types, the following example demonstrates how PyLTP's dependency parsing tools can be used to analyze the syntactic structure of the test text:
[0060] For example, the test text is: "Attending the meeting that day, Mr. Li said that he was very happy to be able to work with all the seniors." After word segmentation and part-of-speech tagging, the test text is: ['at\p', 'attend\v', 'that day\t', 'of\u', 'meeting\n', 'on\f', ',\w', 'Mr\nr', 'say\v', ',\x', 'he\r', 'very\d', 'happy\v', 'able\v', 'with\p', 'all\r', 'seniors\n', 'together\m', 'work\v', '。\w']. After performing dependency analysis on this segmented and tagged test text using pyltp's dependency analysis tool, the dependency analysis results are: = [(9, 'ADV'), (6, 'ATT'), (5, 'ATT'), (3, 'RAD'), (2, 'VOB'), (1, 'POB'), (1, 'WP'), (9, 'SBV'), (0, 'HED'), (9, 'WP'), (19, 'SBV'), (19, 'ADV'), (19, 'ADV'), (19, 'ADV'), (19, 'ADV'), (17, 'ATT'), (15,'POB'), (19, 'ADV'), (9, 'VOB'), (9, 'WP')], where each tuple in this dependency analysis result represents the dependency relationship between the original word and the corresponding word at the corresponding position, such as The corresponding position serial number of the first tuple (9, 'ADV') in is 1. The position serial number 1 corresponds to the first word "在" (which means "at" in Chinese) in the text to be tested. The number "9" in the first tuple corresponds to the 9th word "表示" (which means "express" in Chinese) in the text to be tested. The dependency relationship between "在" and "表示" is "ADV", that is, "adverbial - head structure". The second tuple (6, 'ATT') indicates that the dependency relationship between the 2nd word "出席" (which means "attend" in Chinese) and the 6th word "上" in the text to be tested is "ATT", that is, "modifier - head relationship". The third tuple to the twentieth tuple all represent the dependency relationships between corresponding position words and other position words in the same way, which will not be elaborated here. The dependency analysis result is converted into a more intuitive dependency tree, as Figure 3 shown, Figure 3 which is a schematic diagram of the dependency analysis result corresponding to a text to be tested being converted into a dependency tree. According to Figure 3 it can be directly seen that: the dependency relationship between the word "的" (which means "of" in Chinese) and the word "当天" (which means "that day" in Chinese) is RAD, the dependency relationship between the word "当天" and the word "会议" (which means "meeting" in Chinese) is ATT, the dependency relationship between the word "会议" and the word "出席" is VOB, the dependency relationship between the word "上" and the word "在" is POB, the dependency relationship between the word "在" and the word "表示" is ADV, the dependency relationship between the word "李某" (which means "Li Mou" in Chinese) and the word "表示" is SBV, the dependency relationship between the word "他" (which means "he" in Chinese) and the word "合作" (which means "cooperate" in Chinese) is SBV, the dependency relationship between the word "非常" (which means "very" in Chinese) and the word "合作" is ADV, the dependency relationship between the word "开心" (which means "happy" in Chinese) and the word "合作" is ADV, the dependency relationship between the word "能够" (which means "able to" in Chinese) and the word "合作" is ADV, the dependency relationship between the word "与" (which means "and" in Chinese) and the word "合作" is ADV, the dependency relationship between the word "一起" (which means "together" in Chinese) and the word "合作" is ADV, the dependency relationship between the word "各位" (which means "everybody" in Chinese) and the word "前辈" (which means "senior" in Chinese) is ATT, the dependency relationship between the word "前辈" and the word "与" is POB, the dependency relationship between the word "合作" and the word "表示" is VOB, and the word "表示" is HED. WP refers to the punctuation mark after the corresponding word.
[0061] Since the entity and the trigger word belong to the subject - predicate relationship, all subject - predicate relationships in the text to be tested are traversed to complete the identification and extraction of the speech. According to an embodiment of the present invention, after the text to be tested undergoes dependency analysis to obtain the dependency analysis result, the dependency relationships in the dependency analysis result are traversed to find the subject - predicate relationships therein. If there is a subject - predicate relationship, it is necessary to further determine whether the subject - predicate relationship conforms to the structure of "entity -> trigger word". If no subject - predicate relationship is retrieved, the subject - predicate relationship in the next text to be tested is searched. If there is a pair of subject - predicate relationships, the subject and predicate of the subject - predicate relationship are extracted, and the next step of analyzing the subject - predicate relationship is executed. After detecting that there is no subject - predicate relationship in the text to be tested, the present invention stops the speech analysis and identification of the text to be tested and directly detects the subject - predicate relationship in the next text to be tested, greatly improving the efficiency of speech extraction for the entire text.
[0062] Step S2: Identify whether the subject in the test text is an entity and whether the predicate in the test text is a trigger word. Identify whether the subject of the subject-predicate relationship in the test text is a person or organization name, and simultaneously identify whether the predicate of the subject-predicate relationship in the test text is a trigger word. If neither condition is met, or if one condition is not met, continue traversing the next set of subject-predicate relationships in the dependency analysis results, analyzing whether the subject and predicate in this subject-predicate relationship simultaneously satisfy the conditions. If both conditions are met, continue to the next step. This invention performs dependency analysis on the test text and confirms whether the subject and predicate are entities and trigger words respectively, quickly confirming whether there is any speech in the test text. If no speech is found, subsequent speech extraction is not performed on the test text, further improving the efficiency of speech extraction. Simultaneously, this invention traverses all subject-predicate relationships in the test text to avoid some speech going undetected, ensuring the accuracy of speech extraction.
[0063] Current entity recognition methods often only extract statements from individuals, neglecting the statements of organizations. News reports frequently contain numerous statements from organizations, leading to information gaps. Furthermore, methods using existing entity lexicons and rule matching to detect entity names in text fail to identify entities not in the lexicon, again resulting in information loss. Therefore, this invention employs a pre-constructed entity lexicon for entity recognition, as described in the previous embodiments. According to one embodiment, identifying whether the subject in the test text is an entity includes: matching words in the test text with words in the lexicon using rules based on the pre-constructed entity lexicon to extract entities, obtaining a first entity set. The entity lexicon contains names of individuals and organizations from multiple countries and fields. Entities in the test text are extracted using a trained named entity recognition model, obtaining a second entity set. The entities in the first and second entity sets are merged to obtain all extracted entities. The subject is then identified as an entity based on all extracted entities. All extracted entities are recorded as the entity recognition result of the test text. , This represents the information of the first entity. This represents the information of the second entity. This represents the information of the nth entity, and each dictionary has the following format: ,in, For serial number, For entity name, It is an entity type (including either a person or an organization). This provides the location information of entities within the text to be tested. The entity name lexicon of this invention can quickly identify and extract entity names from the text to be tested. At the same time, this invention expands the range of subject names, recognizing not only people but also organizations. Furthermore, the named entity recognition model expands the scope of entity name recognition, enabling the identification of entity names not found in the lexicon. The combination of these two methods effectively improves the accuracy and generalization of entity recognition.
[0064] According to an embodiment of the present invention, the named entity recognition model includes: a BERT neural network for extracting features of the text to be tested to obtain a character-level feature vector; a second Bi-LSTM neural network for extracting contextual semantic features of each character based on the character-level feature vector to obtain a predicted label score for each character; and a CRF neural network for obtaining entity recognition results based on the predicted label score for each character.
[0065] According to an embodiment of the present invention, for a piece of text to be tested, t2: "At the meeting on the same day, Li said that he was very happy to participate in the meeting organized by the Science and Technology Association today." The text to be tested, t2, uses the sequence labeling method through the named entity recognition model trained in the above embodiment to obtain the predicted label scores for each character in the text to be tested, t2. Classify each character according to the predicted label scores of each character to obtain a set s2 of each character and its corresponding label, that is: s2 = ['在\O', '出\O', '席\O', '当\O', '天\O', '的\O', '会\O', '议\O', '上\O', ',\O', '李\B-PER', '某\I-PER', '表\O', '示\O', ',\O', '今\O', '天\O', '非\O', '常\O','开\O', '心\O', '能\O', '够\O', '参\O', '加\O', '科\B-ORG', '技\I-ORG', '协\I-ORG', '会\I-ORG', '组\O', '织\O', '的\O', '会\O', '议\O', '。\O']. Traverse and identify the characters with labels "B-PER", "I-PER", "B-ORG", and "I-ORG" in s2. At the same time, merge adjacent characters in s2 with labels that conform to the specification into words to obtain the entity recognition result. The entity recognition result includes a set of words, label information, and position information: ['李某\PER\10', '科技协会\ORG\25']. Among them, the specification stipulates that if the longest consecutive adjacent labels conform to 1 "B-PER" + m "I-PER" (m is an integer greater than or equal to 0), they are merged into the person label PER; if the longest consecutive adjacent labels conform to 1 "B-ORG" + m "I-ORG" (m is an integer greater than or equal to 0), they are merged into the organization label ORG. In this example, "李\B-PER" and "某\I-PER" are adjacent and the longest consecutive, and they conform to the specification, so they are merged into "李某\PER". Similarly, "科\B-ORG", "技\I-ORG", "协\I-ORG", "会\I-ORG" are adjacent and the longest consecutive, and they conform to the specification, so they are merged into "科技协会\ORG".
[0066] According to an embodiment of the present invention, the named entity recognition model is trained through the following steps b1 and b2:
[0067] In step b1, a second training set is obtained. Each second sample in the second training set is a text to be tested, and each text to be tested corresponds to a label sequence. The label sequence includes the labels of all characters in the text to be tested.
[0068] According to one embodiment of the present invention, the label sequence generation method for each second sample in the second training set is as follows: A text segment is divided into sentences using the same method as in the above embodiment to obtain multiple test texts. Each text segment in this invention is a news text obtained from the internet reporting on the economy, society, and daily life. After segmenting the news text into sentences, multiple test news texts are obtained. It should be understood that this is only for illustration; texts from different fields can be collected to construct the second training set according to specific needs, such as texts from websites or online forums. Each character in each test text is labeled using the BIO annotation method. The annotation labels include five types: B-PER, I-PER, B-ORG, I-ORG, and O. "B-PER" represents the starting position of a person, and "I-PER" represents the middle or ending position of a person. "B-ORG" represents the starting position of an organization, and "I-ORG" represents the middle or ending position of an organization. Entity types are PER (person) and ORG (organization). The characters corresponding to person entities are labeled with PER, the characters corresponding to organization entities are labeled with ORG, and other characters are labeled with O. For example, the text to be tested is: "Xu, the head of the detection room of the institute, believes that Li is an outstanding scientific researcher." After manual annotation, the resulting label sequence is: "O, O, B-ORG, I-ORG, I-ORG, O, O, O, B-PER, I-PER, O, O, B-PER,I-PER,I-PER,O,O,O,O,O,O,O,O,O,O,O,O,O". The second sample and the label sequence together are represented as: "The institute's detection room is headed by Xu, who believes that Li is an outstanding scientific researcher."
[0069] In step b2, a named entity recognition model is trained using the training set to identify entities in the test text, obtaining entity recognition results. A second loss is calculated based on the entity recognition results and the label sequence of the samples, and the parameters of the named entity recognition model are updated according to the second loss. This process continues until the named entity recognition model converges or reaches a preset number of iterations, at which point parameter updates cease, resulting in a trained named entity recognition model. The second loss is calculated using existing named entity recognition loss calculation methods.
[0070] According to an embodiment of the present invention, the method for identifying whether the predicate in the text to be tested is a trigger word in step S2 includes: matching the predicate with the trigger words in the pre-built speech trigger word library to identify whether the predicate is a trigger word.
[0071] According to an embodiment of the present invention, a speech trigger word library is constructed in the present invention The trigger words include: express, point out, frankly state, say, think, tell, seemingly, reveal, said, introduce, claim, state in the text, clearly state, emphasize, mention, speak bluntly, say, state in the article, mention, appeal, write, suggest, say in a certain way, generally considered, say at a certain time, state in the middle, especially emphasize, put forward, words, claim, reiterate, declare, condemn, accuse, voice, imply, hint, call, complain, tell, murmur,念叨, pour out, confess, discuss, talk about, exhort, speak, swear, announce, explain, advise, admonish, talk, conversation, speech, narration, statement, communication, conversation, exhort, debate, argue, question, answer, chat, lobby, speech, explanation, statement, blame, scold, comment, discuss, talk and discuss, persuade, persuade, rhetorical question, ask, talk nonsense, falsely claim, lie, sophistry, excuse, quibble, state again, definite statement, illustrate with pictures, narrate, plagiarize, argue, protest, repeat, discuss, refute, rebut, abuse, curse, tell, appeal, state, explain, defend, clarify, admonish, joking, sarcasm, ridicule, mockery, abuse, curse, prophecy, promise, commitment and promise or combinations thereof. The speech trigger word library constructed in the present invention has about 100 or more trigger words. Through this trigger word library, it is possible to accurately identify whether the text to be tested contains trigger words, improving the efficiency and accuracy of entity speech extraction.
[0072] According to an embodiment of the present invention, taking the above-mentioned dependency analysis result as an example, traverse the dependency relationships in, and identify two sets of subject-predicate relationships: The first set is at the 8th position in : (9, 'SBV'), indicating that the 8th word and the 9th word in the text to be tested are in a subject-predicate relationship. It is retrieved that the 8th word and the 9th word in the text to be tested are "Li Mou" and "express" respectively; it is identified that "Li Mou" is the subject and "Li Mou" is in , it is determined that "Li Mou" is a person or organization name, it is identified that "express" is the predicate and is in the speech trigger word library , then it is determined that "express" is a trigger word. The first set of subject-predicate relationships conforms to the structure of "entity -> trigger word", and continue to execute the next step. The second set is at the 11th position in : (19, 'SBV'), indicating that the 11th word and the 19th word in the text to be tested are in a subject-predicate relationship. It is retrieved that the 11th word and the 19th word in the text to be tested are "he" and "cooperate" respectively. "He" is the subject and is a pronoun, and is in , then it is determined that "he" is a person or organization name, "cooperate" is the predicate, and it is not in the speech trigger word library , then it is determined that "cooperate" is not a trigger word. The second set of subject-predicate relationships does not conform to the structure of "entity -> trigger word" and no further analysis is done.
[0073] Step S3: When the subject in the text to be tested is an entity and the corresponding predicate is a trigger word, extract the speech following the trigger word in the text to be tested to obtain entity speech containing the subject, trigger word and speech. When the subject is a pronoun, the real entity name referred to by the pronoun is extracted from the preceding text of the pronoun as the subject in the entity speech using the pronoun resolution method.
[0074] According to an embodiment of the present invention, step S3, which extracts the speech following the trigger word in the test text to obtain entity speech, includes: extracting a segment of text from the trigger word to the end of the sentence in the test text as speech, retaining the punctuation marks in the sentence and the terminating punctuation mark at the end of the sentence, and extracting the subject and trigger word from the test text to obtain entity speech containing subject, trigger word, and speech. When extracting the text from the trigger word to the end of the sentence in the test text as actual speech, if there are punctuation marks such as colons, commas, or left double quotation marks at the beginning of the speech sentence, they need to be removed; similarly, if there are right double quotation marks at the end of the speech sentence, they also need to be removed. After traversing all subject-predicate relationships in each test text and extracting the subject-predicate relationships and speech that meet the conditions through the above embodiment, a list of speech is obtained. The list of comments includes multiple elements, each of which is... ,in These are the statement numbers. It is the subject. It is a trigger word. It is a statement.
[0075] According to an embodiment of the present invention, the dependency analysis results in the above embodiments are used. For example, traversal It identifies two sets of subject-verb relations, and the first set: The 8th position is (9, 'SBV'), indicating that the 8th word "Li Mou" and the 9th word "Shuoyi" in the test text have a subject-verb relationship and conform to the structure of "entity -> trigger word". Therefore, the text from the trigger word "Shuoyi" to the end of the sentence, "He was very happy to cooperate with all the seniors.", is extracted, and the comma at the beginning of the sentence is removed to obtain the actual statement: "He was very happy to cooperate with all the seniors." Finally, the three elements of the entity statement are obtained: {'Subject': 'Li Mou', 'Trigger word': 'Shuoyi', 'Statement': 'He was very happy to cooperate with all the seniors.'}.
[0076] According to an embodiment of the present invention, the referential resolution method in step S3 includes: concatenating the text to be tested with one or more of its nearest neighbors to obtain a concatenated text; processing the text preceding the referential word in the concatenated text using a predetermined entity recognition method to obtain all candidate entities in the concatenated text, wherein the referential word is not included among all candidate entities; using a trained referential resolution model to analyze all candidate entities, the concatenated text, and the referential word to obtain the real entity name referred to by the referential word, and using the real entity name as the subject of the entity's statement. The present invention extracts the true subject of the statement from the preceding text of the referential word and replaces it with the subject of the referential word, accurately and clearly grasping the statements of various real people or organizations.
[0077] According to one embodiment of the present invention, the one or more preceding texts adjacent to the text to be tested can be one or more texts preceding the text to be tested. The process of referential resolution is illustrated using a concatenated text obtained by concatenating the text to be tested with one or more texts preceding the text to be tested as an example. See [link to documentation]. Figure 4 , Figure 4 This is a schematic diagram illustrating the principle of the process of using a trained substitution resolution model. (The diagram shows the process of using the training model for the first substitution resolution.) One text to be tested When extracting entity statements, if the subject of the three elements of the statement is a pronoun, then the third element is extracted. One text to be tested ,as well as The previous adjacent number The and the first Two test texts , (There may be zero, one, or more), spliced together as ; Using the aforementioned entity noun database and the trained named entity recognition model, entity recognition is performed on the text preceding pronouns in the concatenated text. This extracts all candidate entity names from the concatenated text, including people and organizations. Pronouns are then removed, retaining only the actual entity names, thus obtaining all candidate entities. Extract from the first Subject extracted from the text to be tested (Referential pronoun); will , and The input is analyzed by a trained referential resolution model to obtain the real entity name referred to by the pronoun (i.e., the antecedent of the subject of the statement). ,Will Replace the corresponding The final three elements of the statement are: subject (real entity name), trigger word, and statement.
[0078] According to an embodiment of the present invention, the pronoun resolution model includes: a feature extraction module, configured to extract candidate entity features and pronoun features based on a candidate entity selected from all candidate entities, a pronoun, and concatenated text input each time, to obtain feature vectors of the candidate entity and pronouns, concatenate the feature vectors of the candidate entity and pronouns to obtain a concatenated feature vector, and process the concatenated feature vector to obtain a comprehensive feature vector. The feature extraction module includes: a preprocessing layer for extracting the positional information of the input candidate entities and the positional information of the pronouns; an embedding layer for encoding the concatenated text to obtain character-level feature vectors; a first Bi-LSTM neural network for extracting the contextual semantic features of each character in the concatenated text based on the character-level feature vectors; a concatenation layer for extracting the feature vectors of the candidate entities and the pronouns based on the contextual semantic features of each character, the positional information of the candidate entities, and the positional information of the pronouns, and concatenating the feature vectors of the candidate entities and the pronouns respectively to obtain a concatenated feature vector; a CNN layer for performing convolution processing on the concatenated feature vectors to obtain a convolutional feature vector, wherein the CNN layer is a TextCNN neural network; a pooling layer for performing max pooling processing on the convolutional feature vectors to obtain a pooled feature vector; and a fully connected neural network for processing the pooled feature vectors to obtain a comprehensive feature vector. An activation function module is used to obtain the probability value of a referential relationship between the candidate entity and the pronoun based on the comprehensive feature vector, wherein the activation function is a softmax activation function. The substitution resolution model outputs the candidate entity corresponding to the highest probability value among all candidate entities and pronouns, and uses the candidate entity as the real entity name when the highest probability value is greater than a predetermined threshold. Below is a specific example of substitution resolution based on the trained substitution resolution model:
[0079] For example, consider the text: "On April 20th, Li attended a meeting with Han and expressed his feelings. He said he was very happy to cooperate with your company." After sentence segmentation, two test texts are obtained. The first test text is "On April 20th, Li attended a meeting with Han and expressed his feelings." The second test text is "He said he was very happy to cooperate with your company." When extracting the speech from the second test text, a set of three elements of the speech is obtained: {'Subject': 'he', 'Trigger word': 'expressed', 'Speech': 'He was very happy to cooperate with your company.'}. Since the subject "he" is a personal pronoun, it is necessary to further obtain the true subject corresponding to "he" using the pronoun resolution method. The process of obtaining the true subject is: concatenating the first and second test texts to obtain the concatenated text. "On April 20th, Li participated in a meeting with Han and expressed his feelings. He stated that he was very happy to cooperate with your company." First, following the method described in the above example... Entity recognition is performed to obtain all person or organization entities in the concatenated text preceding the pronoun "he". = ['Li Mou', 'Han Moumou']; Secondly, the concatenated text All candidate entities The pronoun "he" is fed into the pronoun resolution module, and the pronoun resolution model then... Semantic analysis is performed to determine the probability values of "Li Mou" and "Han Moumou" as the real entity names referred to by the pronouns. The "Li Mou" corresponding to the larger probability value (which is greater than a certain threshold, which can be set according to specific circumstances) is taken as the true subject of the speech. Finally, replacing "Li Mou" with "he" yields the final three elements of the statement: {'Subject': 'Li Mou', 'Trigger word': 'Indication', 'Statement': 'I am very happy to be able to cooperate with your company.'}
[0080] According to an embodiment of the present invention, the referential resolution model is trained through the following steps c1 and c2:
[0081] In step c1, a first training set is obtained. Each first sample in the first training set includes input data and a label. The input data includes concatenated text, a candidate entity in the concatenated text, and a pronoun. The label indicates whether there is a correct referential relationship between the candidate entity and the pronoun.
[0082] According to one embodiment of the present invention, each first sample in the first training set is generated as follows: a pronoun and all candidate entities preceding the pronoun are extracted from a concatenated text. Each concatenated text is obtained by concatenating multiple news articles about the economy, society, and daily life obtained from the internet. The concatenated text, one candidate entity from the concatenated text, and the pronoun are used as input data, and manually labeled. The labels indicate whether the referential relationship between the candidate entity and the pronoun is correct, resulting in a first sample that is a positive example and multiple first samples that are negative examples. A positive example indicates that the candidate entity and the pronoun have a correct referential relationship, marked as "1", while a negative example indicates that the candidate entity and the pronoun have an incorrect referential relationship, marked as "0". Generally, no more than three negative samples are constructed based on a single concatenated text, and multiple first samples can ultimately be constructed from a single concatenated text.
[0083] In step c2, the pronoun-referencing model is trained using the first training set to predict the probability that the candidate entity and the pronoun have a correct pronoun-referencing relationship. The prediction result is obtained, and a first loss is calculated based on the prediction result and the label. The parameters of the pronoun-referencing model are then updated based on the first loss to improve its accuracy. This process continues until the pronoun-referencing model converges or reaches a preset number of iterations, at which point parameter updates are stopped, resulting in a trained pronoun-referencing model. The first loss is calculated using the cross-entropy loss function.
[0084] It should be noted that although the steps are described in a specific order above, it does not mean that the steps must be executed in the above specific order. In fact, some of these steps can be executed concurrently, or even in a different order, as long as the required function can be achieved.
[0085] This invention can be a system, method, and / or computer program product. A computer program product may include a computer-readable storage medium having computer-readable program instructions loaded thereon for causing a processor to implement various aspects of the invention.
[0086] Computer-readable storage media can be tangible devices that hold and store instructions for use by an instruction execution device. Computer-readable storage media can include, for example, but not limited to, electrical storage devices, magnetic storage devices, optical storage devices, electromagnetic storage devices, semiconductor storage devices, or any suitable combination thereof. More specific examples (a non-exhaustive list) of computer-readable storage media include: portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), static random access memory (SRAM), portable compact disc read-only memory (CD-ROM), digital multifunction disc (DVD), memory sticks, floppy disks, mechanical encoding devices, such as punch cards or recessed protrusions storing instructions thereon, and any suitable combination thereof.
[0087] The various embodiments of the present invention have been described above. These descriptions are exemplary and not exhaustive, nor are they limited to the disclosed embodiments. Many modifications and variations will be apparent to those skilled in the art without departing from the scope and spirit of the described embodiments. The terminology used herein is chosen to best explain the principles, practical application, or technical improvements to the embodiments in the market, or to enable others skilled in the art to understand the embodiments disclosed herein.
Claims
1. A method for entity speech extraction based on dependency analysis and referential resolution, characterized in that, include: Step S1: Parse the text to be tested based on dependency parsing rules to obtain dependency parsing results, and obtain the subject and predicate in the text to be tested from the dependency parsing results; Step S2: Identify whether the subject in the text to be tested is an entity, and identify whether the predicate in the text to be tested is a trigger word; Step S3: When the subject in the text to be tested is an entity and the corresponding predicate is a trigger word, extract the speech after the trigger word in the text to be tested to obtain entity speech containing subject, trigger word and speech. When the subject is a pronoun, the pronoun resolution method is used to extract the real entity name referred to by the pronoun from the preceding text as the subject in the entity speech. The method of resolving the referential substitution includes: The test text and one or more of its nearest neighbors are concatenated to obtain the concatenated text. The text before the pronouns in the concatenated text is processed by a predetermined entity recognition method to obtain all candidate entities in the concatenated text. Among all candidate entities, pronouns are not included. The trained referential resolution model is used to analyze all candidate entities, concatenated text, and referential words to obtain the real entity name referred to by the referential word, and the real entity name is used as the subject in the entity statement. The referential resolution model includes a feature extraction module and an activation function module; The feature extraction module includes: The preprocessing layer is used to extract the positional information of the input candidate entities and the positional information of the pronouns; The embedding layer is used to encode the concatenated text to obtain character-level feature vectors. The first Bi-LSTM neural network is used to extract the contextual semantic features of each character in the concatenated text based on the character-level feature vector; The concatenation layer is used to extract the feature vectors of candidate entities and pronouns based on the contextual semantic features of each character, the positional information of candidate entities, and the positional information of pronouns. The feature vectors of candidate entities are concatenated with the feature vectors of pronouns to obtain the concatenated feature vector. The CNN layer is used to perform convolution processing on the concatenated feature vectors to obtain the convolutional feature vectors. Pooling layers are used to perform max pooling on the convolutional feature vectors to obtain pooled feature vectors. A fully connected neural network is used to process the pooled feature vectors to obtain a comprehensive feature vector; The activation function module is used to obtain the probability value of the existence of a referential relationship between the candidate entity and the pronoun based on the comprehensive feature vector.
2. The method according to claim 1, characterized in that, The feature extraction module of the pronoun resolution model is used to extract the features of the candidate entity and the pronoun based on the candidate entity selected from all the candidate entities, the pronoun, and the concatenated text in each input, to obtain the feature vector of the candidate entity and the feature vector of the pronoun, to concatenate the feature vector of the candidate entity and the feature vector of the pronoun to obtain the concatenated feature vector, and to process the concatenated feature vector to obtain the comprehensive feature vector. The pronoun resolution model outputs the candidate entity corresponding to the highest probability value based on the probability values between all candidate entities and pronouns, and uses the corresponding candidate entity as the real entity name when the highest probability value is greater than a predetermined threshold.
3. The method according to claim 2, characterized in that, The substitution resolution model was trained using the following method: Obtain the first training set. Each first sample in the first training set includes input data and a label. The input data includes concatenated text, a candidate entity in the concatenated text, and a pronoun. The label indicates whether there is a correct referential relationship between the candidate entity and the pronoun. The pronoun-resolving model is trained using the first training set to predict the probability that the relationship between the candidate entity and the pronoun is correct. The prediction results are obtained, the first loss is calculated based on the prediction results and the label, and the parameters of the pronoun-resolving model are updated based on the first loss.
4. The method according to claim 1, characterized in that, The entity recognition methods for identifying whether the subject in the text to be tested is an entity in step S2 include: Based on a pre-built entity noun database, the words in the text to be tested are matched with the words in the entity noun database according to rules, and the entities in the text to be tested are extracted to obtain the first entity set; The trained named entity recognition model is used to extract entities from the text to be tested, resulting in a second entity set. The entities in the first entity set and the second entity set are merged to obtain all extracted entities. The subject is then identified as an entity based on all extracted entities.
5. The method according to claim 4, characterized in that, The named entity recognition model includes: The BERT neural network is used to extract features from the text under test and obtain character-level feature vectors. The second Bi-LSTM neural network is used to extract the contextual semantic features of each character based on the character-granular feature vector to obtain the predicted label score of each character. A CRF neural network is used to obtain entity recognition results based on the predicted label score of each character.
6. The method according to claim 5, characterized in that, The named entity recognition model is trained using the following method: Obtain the second training set. Each second sample in the second training set is a test text. Each test text corresponds to a label sequence, which includes the labels of all words in the test text. The named entity recognition model is trained using the training set to identify entities in the test text, and the entity recognition results are obtained. The second loss is calculated based on the entity recognition results and the label sequence of the samples, and the parameters of the named entity recognition model are updated based on the second loss.
7. The method according to claim 4, characterized in that, The methods for identifying whether the predicate in the text to be tested is a trigger word in step S2 include: Based on a pre-built speech trigger word library, the predicate is matched with the trigger words in the speech trigger word library to identify whether the predicate is a trigger word.
8. The method according to claim 1, characterized in that, The dependency analysis results obtained in step S1 can be obtained in the following ways: The syntactic structure of the test text is analyzed based on the part of speech of each word in the test text according to the dependency parsing rules, and the dependency parsing results, including the dependency relations between words, are obtained. Based on the dependency parsing results, it is determined whether there is a subject-predicate relationship in the test text. Based on the dependency analysis results of the subject-predicate relationship, two words belonging to the subject-predicate relationship in the corresponding test text are extracted to obtain the subject and predicate in the test text.
9. The method according to claim 1, characterized in that, The method for extracting the remarks following the trigger words in the text to be tested in step S3 to obtain the entity remarks includes: The text between the trigger word and the end of the sentence in the test text is extracted as the speech. The punctuation marks in the sentence and the terminating punctuation mark at the end of the sentence are retained. The subject and trigger word in the test text are extracted to obtain the entity speech containing the subject, trigger word and speech.
10. The method according to any one of claims 1-9, characterized in that, Before parsing the test text based on predetermined dependency parsing rules in step S1, the following steps are also included: The text data is segmented into sentences based on a pre-constructed dictionary of sentence-ending punctuation marks, resulting in multiple test texts. The test text is segmented based on a pre-built entity noun database and word segmentation tools; Each word in the segmented text is labeled with its corresponding part of speech in order to parse the text.
11. A computer-readable storage medium, characterized in that, It stores a computer program that can be executed by a processor to implement the steps of the method according to any one of claims 1 to 10.
12. An electronic device, characterized in that, include: One or more processors; as well as Memory, wherein the memory is used to store executable instructions; The one or more processors are configured to implement the steps of the method according to any one of claims 1 to 10 by executing the executable instructions.
Citation Information
Patent Citations
A news data processing method and device
CN109902230A
Method for extracting political outbound news events of Internet
CN110941692A
Name entity recognition with deep learning
CN113853606A
Method and apparatus for anaphora resolution, and electronic device
WO2021169351A1