A method for extracting character speech based on text syntactic analysis
By constructing an expanded trigger word dictionary and performing syntactic analysis based on text syntax analysis, the problems of low precision and high resource consumption in character speech extraction in the existing technology are solved, and efficient and accurate character speech extraction is achieved.
Patent Information
- Application Number
- CN202111651242.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-12-30
- Publication Date
- 2024-09-17
- Estimated Expiration
- 2041-12-30
AI Technical Summary
In the existing technology, in character speech extraction, the trigger word dictionary construction based on the rule method is not deep enough, resulting in low accuracy; the machine learning and deep learning based methods require a lot of human resources and hardware support, and the algorithm complexity is high, making it difficult to achieve efficient extraction.
Using a method based on text syntax analysis, we build an expanded trigger word dictionary, combine synonyms and word vector technology to expand the initial trigger words, perform text segmentation and sentence filtering, and use syntactic analysis to determine the subject-predicate relationship between characters and trigger words. Achieve accurate speech extraction.
It provides an accurate and efficient method for extracting people's speech, which can automatically expand trigger words, reduce human resource requirements, improve extraction accuracy, and is suitable for massive information processing.
Smart Images

Figure CN114330294B
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of text information extraction, and in particular to a method for extracting character speech based on text syntactic analysis. Background Art
[0002] With the evolution of the times, the economy, society, production, and life are increasingly dependent on the Internet, and obtaining information through the Internet has become an indispensable part of people's daily life and work. Faced with massive amounts of information and lengthy reports, how to quickly and effectively obtain the speeches of the main characters involved has become an indispensable requirement for improving reading efficiency. Therefore, research on character speech extraction is of great significance.
[0003] At present, there are mainly rule-based methods and machine learning and deep learning methods for character speech extraction. Among them, rule-based methods mostly use trigger words, but there are few in-depth studies on the construction of trigger word dictionaries. At the same time, most of these methods do not pay attention to the relationship between trigger words and character words in sentences, resulting in reduced extraction accuracy. For machine learning and deep learning methods, although they are not constrained by trigger dictionaries, the early training and annotation require a lot of human resources, and when the target text and training samples deviate greatly, the effect is often average. At the same time, deep learning methods often have higher algorithm complexity, and in actual operation, they rely on better hardware resources as a basis. Summary of the invention
[0004] Purpose of the invention: The main purpose of the present invention is to solve the defects of the prior art and to invent a rule-based method that can automatically expand trigger words and introduce syntactic analysis to judge the relationship between trigger words and characters as a supplement, ultimately providing an accurate and efficient method for extracting character speech.
[0005] The present invention provides a method for extracting character speech based on text syntactic analysis, comprising the following steps:
[0006] Step S1, constructing a speech trigger word dictionary: for the initial speech trigger words, using synonym technology, expand the trigger words and construct a trigger word dictionary;
[0007] Step S2, text sentence segmentation: segment the entire text into complete sentences;
[0008] Step S3, sentence filtering;
[0009] Step S4, speech determination.
[0010] In step S1, the trigger word dictionary is constructed by using the initial trigger word list L: [W1, W2, ..., W n-1 ,W n], where W1, W2, …, W n-1 ,W n The first, second, third, ..., nth initial trigger words are the speech trigger words obtained from the initial screening of news public opinion data. The number of initial trigger words is within 20, including: "say", "express", "tell", "point out", "reveal", "frankly", "statement" and other organized words. The initial speech trigger words are expanded through a variety of synonyms.
[0011] In step S1, the expansion through multiple synonym expansion methods includes an expansion method based on the synonym dictionary search for synonyms and an expansion method based on the word vector word2vec search for synonyms. The training corpus used by word2vec is the self-annotated news business data in the field of public opinion. Therefore, it is more suitable for the expansion of synonyms corresponding to the trigger words of character speech.
[0012] For the first initial trigger word W1, the specific steps include:
[0013] Step a1, taking W1 as input, searching for synonyms of W1 through the synonym dictionary, and returning the synonym set L1 of W1, where the calculation formula of L1 is:
[0014] L1={W1 i |sim(W1,W1 i )>0.6}
[0015] To unify the expression, a list is used instead of a set, and L1 is recorded as: [W1 1 , W1 2 , W1 3 , W1 4 , …, W1 k ], W1 i Indicates the i-th synonym of W1 searched through the synonym dictionary, where: The minimum value of k is set to 20, and the maximum value corresponds to the number of synonyms of W1 with a similarity greater than 60% to W1. In particular, when the number of synonyms of W1 with a similarity threshold greater than 60% to W1 is less than 20, the synonyms of W1 are selected from the highest to the lowest similarity to make up 20.
[0016] Step a2, taking W1 as input, searching for synonyms of W1 through word2vec, and returning the synonym set L'1 of W1: where the calculation formula of L'1 is:
[0017] L'1={W1 i |sim word2vec (W1,W1 i )>0.6}
[0018] To unify the expression, a list is used instead of a set, and L'1 is denoted as: [W'1 1 , W'1 2 , W'1 3 , W'1 4 , …, W'1 k ],W'1 i Indicates the i-th synonym of W1 searched by word2vec, where: The minimum value of k is set to 20, and the maximum value corresponds to the number of synonyms of W1 searched by word2vec that have a similarity greater than 60% with W1. In particular, when the number of synonyms of W1 searched by word2vec that have a similarity threshold greater than 60% with W1 is less than 20, the synonyms of W1 are selected from the highest to the lowest similarity to make up 20.
[0019] Step a3, perform the operation of step a2 on each word in the L1 list obtained in step a1, and obtain a synonym list L corresponding to all words in the L1 list. 1_total ;
[0020] Step a4, perform the operation of step a1 on the words in the list L'1 obtained in step a2, and obtain the synonym list L' corresponding to all the words in the list L'1 1_total ;
[0021] Step a5: for L1, L'1, L 1_total and L' 1_total Merge and remove duplicates to obtain the candidate word library of W1, and further filter to finally obtain all the synonymous trigger words corresponding to the trigger word W1;
[0022] For the trigger words in the initial trigger word list L, perform the operations of step a1 to step a5 to obtain W1, W2, ..., W n-1 ,W n All the corresponding synonymous trigger words will eventually be W1, W2, ..., W n-1 ,W n All corresponding trigger words are merged and deduplicated to build a trigger word dictionary.
[0023] In step S2, the text is segmented by first locating the position of the sentence separator to obtain ordered separator position list information, and then performing preliminary sentence segmentation according to the position list information; wherein the sentence separators are located by punctuation marks, line breaks, and spaces.
[0024] In step S2, a double quotation mark recognition method is used to determine whether the delimiter can be used as an actual delimiter.
[0025] In step S2, a double quote recognition method is used to determine whether the delimiter can be used as an actual delimiter, specifically comprising: preliminarily separating the text according to the delimiter to obtain an ordered list of delimiter positions, denoted as P: [x1, x2, x3, ..., x m-1 ,x m ], where x1,x2,x3,…,x m-1 ,x m They represent the positions of the delimiters in the sentence. [1,x1] corresponds to the start and end positions of the first sentence. The delimiter position list is traversed from left to right. For the first traversal, the position where the start L of the sentence is fixed at 1, and the position corresponding to the end R of the sentence is x1. The start position L and the end position R constitute the pre-sentence S. Determine whether the double quotes in the pre-sentence S meet the following conditions:
[0026] 1) Whether the number of double quotes is even;
[0027] 2) Whether the first one is a left quotation mark and the last one is a right quotation mark;
[0028] If both of the above conditions are met, S is output as a complete sentence. In the next traversal, the end x1+1 of this sentence is taken as the beginning L of the sentence, and the next element x2 of x1 is taken as the end R of the sentence, forming a pre-sentence S, and then the same judgment operation is performed.
[0029] Step S3 includes: segmenting each sentence, determining whether the segmented sentence contains known character information and trigger word information, and if so, taking the sentence as a candidate speech statement.
[0030] In step S3, the word segmentation of each sentence specifically includes: analyzing and extracting the part of speech and the number of occurrences of each term through a large-scale corpus to construct a word segmentation dictionary for scanning the word graph of sentence segmentation, and generating a directed acyclic graph consisting of possible word formation situations of all Chinese characters in the sentence; for the directed acyclic graph, the initial word segmentation probability of each word segmentation situation is obtained according to the probability of occurrence of each term, and then the word segmentation penalty factor C is introduced to obtain the final word segmentation probability, and the maximum value of the final word segmentation probability is selected as the word segmentation result.
[0031] In step S3, the initial word segmentation probability P is calculated using the following formula: ini :
[0032] P ini_i =P(w i_1 )×P(w i_2 )×…×P(w i_n )
[0033] Among them, w i_nrepresents the nth word in the i-th possible word segmentation case, P(w i_n ) represents the nth word w i_n The probability of word segmentation;
[0034] For example, the sentence to be segmented is "Playing at Nanjing University", which has multiple paths, that is, multiple segmentation results, as follows:
[0035] Path 1: Playing at Nanjing University
[0036] Path 2: Studying and playing at Nanjing University
[0037] Path 3: Play at Nanjing University
[0038] Path 4: Play at / Nanjing University /
[0039] The initial word segmentation probabilities corresponding to paths 1-4 are:
[0040] P ini_1 =P(in)×P(Nanjing)×P(Beijing)×P(university)×P(school)×P(play)
[0041] P ini_2 =P(in)×P(Nanjing)×P(university)×P(school)×P(play)
[0042] P ini_3 =P(in)×P(Nanjing)×P(university)×P(play)
[0043] P ini_4 =P(at)×P(Nanjing University)×P(playing)
[0044] The word segmentation dictionary includes a public word segmentation dictionary and a domain word segmentation dictionary; the public word segmentation dictionary meets the word segmentation requirements in most situations. The public word segmentation dictionary contains the word frequency and part of speech of nearly 400,000 words. This part of the words is mainly obtained after public prediction training composed of news corpus, WeChat corpus, forum corpus, etc., and then manually reviewed. The domain word segmentation dictionary focuses more on the relevant vocabulary of specific people, places, institutions and proprietary fields.
[0045] The final word segmentation probability P final The calculation formula is:
[0046] P final_i =C n ×P ini_i
[0047] Where P final _ iis the final segmentation probability under the i-th possible segmentation situation; C takes a value between [0.5, 0.9], and is generally selected as 0.8; n is the number of domain words that have not been successfully segmented in the sentence; for example, for the sentence to be segmented "playing at Nanjing University", if "Nanjing University" is a domain word, the penalty factor C is selected as 0.5, then for the above four segmentation paths, the final segmentation probabilities are:
[0048] P final_1 =0.5 1 ×P ini_1
[0049] P final_2 =0.5 1 ×P ini_2
[0050] P final_3 =0.5 1 ×P ini_3
[0051] P final_4 =0.5 0 ×P ini_4
[0052] Finally, the largest P is selected final_i The corresponding word segmentation path is the final word segmentation result.
[0053] Step S4 includes: performing syntactic analysis on the candidate speech sentence to determine whether there is a subject-predicate relationship between the character and the trigger word; if so, determining that the sentence is the character's speech.
[0054] Beneficial effect: The character speech extraction method of the present invention can extract character speech from multiple steps such as comprehensive trigger word construction, accurate sentence segmentation, fast sentence filtering and reasonable speech judgment, thereby providing an accurate and efficient character speech extraction method. BRIEF DESCRIPTION OF THE DRAWINGS
[0055] The present invention will be further described in detail below in conjunction with the accompanying drawings and specific embodiments, and the above and / or other advantages of the present invention will become more clear.
[0056] Figure 1 It is a flowchart of the overall process of character speech extraction of the present invention.
[0057] Figure 2 Construct a flow chart for the invented trigger word dictionary.
[0058] Figure 3 It is a flow chart of text sentence segmentation of the present invention.
[0059] Figure 4 It is a sentence filtering flow chart of the present invention.
[0060] Figure 5 It is a flow chart of speech determination of the present invention. DETAILED DESCRIPTION
[0061] like Figure 1 The figure shows an overall flow chart of a method for extracting character speech based on text syntactic analysis according to an embodiment of the present invention, including building a trigger word dictionary, text sentence segmentation, sentence filtering, and speech judgment.
[0062] like Figure 2 The figure shows the steps of constructing a trigger word dictionary in an embodiment of the present invention, wherein two expansion methods, namely, synonym forest search and word2vec search, are used to expand the trigger words. The specific steps are: using the initial trigger words as input data for the synonym forest search and word2vec search, respectively, to obtain two sets of candidate word sets, and then using the obtained candidate word sets as input for another expansion method, ultimately obtaining more candidate word sets, and finally constructing a trigger word dictionary through manual analysis.
[0063] like Figure 3 The text sentence segmentation step of the embodiment of the present invention uses punctuation marks, spaces, line breaks and other information as sentence separators, and matches to obtain separator position list information, which is recorded as:
[0064] P=[x1,x2,x3,…,x m-1 ,x m ]
[0065] Traverse the separator position list P from left to right. For the first traversal, the position where the sentence starts L is fixed to 1, and the position corresponding to the sentence ends R is x1. The starting position L and the ending position R constitute the pre-sentence S.
[0066] Determine whether the double quotes in the pre-clause S satisfy:
[0067] 1) Check whether the number of double quotes is even, ensuring that double quotes appear in pairs;
[0068] 2) Whether the first one is a left quotation mark and the last one is a right quotation mark;
[0069] If all conditions are met, S is output as a complete sentence. In the next traversal, the next position x1+1 of the end position x1 of this sentence is used as the start position L of the sentence, and the next element x2 of x1 in the separator list P is used as the end position R of the sentence. The start position L and the end position R constitute a pre-sentence S, and then the same judgment operation is performed.
[0070] If any one of them is not satisfied, S cannot be output as a complete sentence. The next element x2 of x1 in the separator list P is selected as the end R of the sentence to form a pre-sentence S, and then the same judgment operation is performed.
[0071] Repeat the process until the traversal is completed.
[0072] like Figure 4 The figure shows the sentence filtering flow chart of the present invention, which traverses the sentence list obtained by text segmentation, segments each sentence, and determines whether it contains known character information and trigger word information after segmentation. If both are contained, it is used as a candidate speech sentence.
[0073] like Figure 5 The figure shows the speech judgment flow chart of the present invention, in which the sentence list obtained after filtering the text sentences is traversed, each sentence is segmented and the segmentation results are subjected to syntactic analysis to determine whether there is a subject-predicate relationship between the characters and the trigger words that appear. If so, the sentence is determined to be a speech sentence.
[0074] Example
[0075] This embodiment provides a method for extracting character speech based on text syntactic analysis, comprising the following steps:
[0076] Step S1, constructing a speech trigger word dictionary: for the initial speech trigger words, using synonym technology, expand the trigger words and construct a trigger word dictionary;
[0077] Step S2, text sentence segmentation: segment the entire text into complete sentences;
[0078] Step S3, sentence filtering;
[0079] Step S4, speech determination.
[0080] In step S1, the trigger word dictionary is constructed by using the initial trigger word list L: [W1, W2, ..., W n-1 ,W n ], expanded through a variety of synonyms, among which W1, W2, …, W n-1 ,W n These are initial speech trigger words obtained through manual screening of news-related public opinion data, such as “say,” “express,” “tell,” “point out,” “reveal,” “frankly,” and “statement.”
[0081] In step S1, the expansion by multiple synonym expansion methods includes an expansion method based on the synonym dictionary search for synonyms and an expansion method based on the word vector word2vec search for synonyms. For the initial trigger word W1, specifically includes the following steps:
[0082] Step a1, take W1 as input, search for synonyms of W1 through the synonym dictionary, and return the synonym list L1 of W1: [W1 1 , W12 , W1 3 , W1 4 , …, W1 k ];
[0083] Step a2, take W1 as input, search for synonyms of W1 through word2vec, and return the synonym list L'1 of W1: [W'1 1 , W'1 2 , W'1 3 , W'1 4 , …, W'1 k ], wherein the training corpus used by word2vec is the self-annotated news business data in the field of public opinion, and therefore, it is more suitable for the expansion of synonyms corresponding to trigger words of character speech;
[0084] Step a3, perform the operation of step a2 on each word in the L1 list obtained in step a1, and obtain a synonym list L corresponding to all words in the L1 list. 1_total ;
[0085] Step a4, perform the operation of step a1 on the words in the list L'1 obtained in step a2, and obtain the synonym list L' corresponding to all the words in the list L'1 1_total ;
[0086] Step a5: for L1, L'1, L 1_total and L' 1_total Merge and remove duplicates to obtain the candidate word library of W1, and further perform manual screening to finally obtain all the synonymous trigger words corresponding to the trigger word W1;
[0087] For the trigger words in the initial trigger word list L, perform the operations of step a1 to step a5 to obtain W1, W2, ..., W n-1 ,W n All the corresponding synonymous trigger words will eventually be W1, W2, ..., W n-1 ,W n All corresponding trigger words are merged and deduplicated to build a trigger word dictionary.
[0088] In step S2, the text sentence segmentation adopts the method of first locating the position of the sentence separator, obtaining the ordered separator position list information, and then performing preliminary sentence segmentation according to the position list information; wherein the sentence separator is located by punctuation, line break, and space, and its set is as follows: {. ? ; ! ! .? \n\r\r\n......space~}. As shown in the following paragraph.
[0089] "As far as I know, the national coverage rate should reach 40% by the beginning of July and 80% by the end of this year. Based on the 70% vaccine protection rate, China's COVID-19 vaccine coverage rate needs to reach nearly 80% to form herd immunity," Zhong Nanshan told China News Service. Based on the principle of voluntariness, all Chinese citizens aged 18 to 60 who meet the physical conditions can receive the COVID-19 vaccine free of charge. Residents A and B are preparing to receive the vaccine. There are two large hospitals and two community health service centers near their residence and workplace where they can receive the vaccine free of charge.
[0090] After the above paragraph is separated into sentences by delimiters, the resulting sentence list is:
[0091] (1) “As far as I know, by early July, the national coverage rate should reach 40%, and by the end of this year it should reach 80%.
[0092] (2) Based on the calculation that the vaccine protection rate reaches 70%, China’s new crown vaccine coverage rate needs to reach nearly 80% before herd immunity can be achieved.
[0093] (3)” Zhong Nanshan told China News Service.
[0094] (4) Based on the principle of voluntariness, all Chinese citizens aged 18 to 60 who meet the physical conditions can receive the COVID-19 vaccine free of charge. Residents A and B are preparing to receive the vaccine. There are two large hospitals and two community health service centers near their residence and workplace where they can receive the vaccine free of charge.
[0095] Double quotes are used to represent the speech of a person, but the delimiter in the double quotes cannot represent the end of the sentence. Therefore, a double quote recognition method is used to determine whether it is a delimiter in the double quotes. If it is, the sentence is not separated at the delimiter. For example, in the above example sentence, the first period and the second period both appear inside the double quotes, so they are not used as delimiters. The third period appears outside the double quotes, so it can be used as a delimiter.
[0096] In step S2, a double quote recognition method is used to determine whether the delimiter can be used as an actual delimiter. The specific implementation is: the text is initially separated according to the delimiter to obtain an ordered list of delimiter positions, denoted as P: [x1, x2, x3, ..., x m-1 ,x m ], where x1,x2,x3,…,x m-1 ,x mThey represent the positions where the delimiters appear in the sentence. Therefore, [1,x1] corresponds to the start and end positions of the first candidate sentence, and [x1+1,x2] corresponds to the start and end positions of the second candidate sentence. Traverse the delimiter position list from left to right. For the first traversal, select 1 as the start position L of the sentence, and select x1 in the delimiter position list information as the end position R of the sentence to form a pre-sentence S. Determine whether the double quotes in the pre-sentence S meet the following conditions:
[0097] 1) Whether the number of double quotes is even;
[0098] 2) Whether the first one is a left quotation mark and the last one is a right quotation mark;
[0099] If both of the above conditions are met, S is output as a complete sentence. In the next traversal, the next position x1+1 of the end position x1 of this sentence is used as the start position L of the sentence, and the next element x2 of x1 in the separator list P is used as the end position R of the sentence to form the next pre-sentence S, and then the same judgment operation is performed;
[0100] Take the following paragraph as an example.
[0101] "As far as I know, the national coverage rate should reach 40% by the beginning of July and 80% by the end of this year. Based on the 70% vaccine protection rate, China's COVID-19 vaccine coverage rate needs to reach nearly 80% to form herd immunity," Zhong Nanshan told China News Service. Based on the principle of voluntariness, all Chinese citizens aged 18 to 60 who meet the physical conditions can receive the COVID-19 vaccine free of charge. Residents A and B are preparing to receive the vaccine. There are two large hospitals and two community health service centers near their residence and workplace where they can receive the vaccine free of charge.
[0102] If the method of the present invention is not adopted, the sentence results are:
[0103] (1) “As far as I know, by early July, the national coverage rate should reach 40%, and by the end of this year it should reach 80%.
[0104] (2) Based on the calculation that the vaccine protection rate reaches 70%, China’s new crown vaccine coverage rate needs to reach nearly 80% before herd immunity can be achieved.
[0105] (3)” Zhong Nanshan told China News Service.
[0106] (4) Based on the principle of voluntariness, all Chinese citizens aged 18 to 60 who meet the physical conditions can receive the COVID-19 vaccine free of charge. Residents A and B are preparing to receive the vaccine. There are two large hospitals and two community health service centers near their residence and workplace where they can receive the vaccine free of charge.
[0107] If the method of the present invention is adopted, the sentence results are:
[0108] (1) "As far as I know, the national coverage rate should reach 40% by the beginning of July and 80% by the end of this year. Based on the 70% vaccine protection rate, China's COVID-19 vaccine coverage rate needs to reach nearly 80% to form herd immunity," Zhong Nanshan told China News Service.
[0109] (2) On a voluntary basis, all Chinese citizens aged 18 to 60 who meet the physical requirements can receive the COVID-19 vaccine free of charge. Residents A and B are preparing to receive the vaccine. There are two large hospitals and two community health service centers near their residence and workplace where they can receive the vaccine free of charge.
[0110] Step S3 includes: segmenting each sentence, determining whether the segmented sentence contains known character information and trigger word information, and if both are contained, taking the sentence as a candidate speech statement. The segmentation adopts Jieba segmentation, and on the basis of Jieba segmentation technology, introduces custom vocabulary information to improve the accuracy of segmentation in business scenarios. Custom vocabulary information includes trigger words, key figures in the public opinion field, keywords in the public opinion field and other vocabulary information.
[0111] Step S4 includes: using syntactic analysis on the candidate speech sentence to determine whether there is a subject-predicate relationship between the character and the trigger word. If there is a subject-predicate relationship, the sentence is determined to be a character speech. In the following sentence (1), "Zhong Nanshan" is a character word, and "Say" is a trigger word. The relationship between the two is a subject-predicate relationship in syntactic analysis, so the sentence is determined to be a speech sentence. In sentence (2), although the character "Zhong Nanshan" and the trigger word "Say" are also hit, the two are not in a subject-predicate relationship, so the sentence is determined to be a non-speech sentence.
[0112] (1) "As far as I know, by the beginning of July, the national coverage should reach 40%, and by the end of this year it should reach 80%. Based on the 70% vaccine protection rate, China's COVID-19 vaccine coverage needs to reach nearly 80% to achieve herd immunity," Zhong Nanshan told China News Service. (2) Recently, Academician Zhong Nanshan said something very lovely in an interview, which was also talked about by many people. This 84-year-old man also has a very lovely side.
[0113] The present invention provides a method for extracting character speech based on text syntactic analysis. There are many methods and ways to implement the technical solution. The above is only a preferred embodiment of the present invention. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principle of the present invention. These improvements and modifications should also be regarded as the protection scope of the present invention. All components not specified in this embodiment can be implemented by existing technologies.
Claims
1. A method for extracting character speech based on text syntactic analysis, characterized in that: The steps include: Step S1, constructing a speech trigger word dictionary: for the initial speech trigger words, using synonym technology, expand the trigger words and construct a trigger word dictionary; Step S2, text sentence segmentation: segment the entire text into complete sentences; Step S3, sentence filtering; Step S4, speech determination; In step S1, the trigger word dictionary is constructed by using the initial trigger word list L: [W1, W2, ..., W n-1 ,W n ], where W1, W2, …, W n-1 ,W n They correspond to the first, second, third, ..., nth initial trigger words in sequence; the initial trigger words are speech trigger words obtained by preliminary screening in the news public opinion data; In step S1, the synonyms are expanded by a variety of expansion methods, including an expansion method based on the synonym dictionary search for synonyms and an expansion method based on word vector word2vec search for synonyms; For the first initial trigger word W1, the specific steps include: Step a1, taking W1 as input, searching for synonyms of W1 through the synonym dictionary, and returning the synonym set L1 of W1, where the calculation formula of L1 is: L1={W1 i |sim(W1,W1 i )>0.6} To unify the expression, a list is used instead of a set, and L1 is recorded as: [W1 1 , W1 2 , W1 3 , W1 4 , …, W1 k ], W1 i It indicates the i-th synonym of W1 searched through the synonym dictionary; Step a2, taking W1 as input, searching for synonyms of W1 through word2vec, and returning the synonym set L'1 of W1: where the calculation formula of L'1 is: L’1={W1 i |sim word2vec (W1,W1 i )>0.6} To unify the expression, a list is used instead of a set, and L'1 is denoted as: [W'1 1 , W'1 2 , W'1 3 , W'1 4 , …, W'1 k ],W'1 i represents the i-th synonym of W1 searched by word2vec; Step a3, perform the operation of step a2 on each word in the L1 list obtained in step a1, and obtain a synonym list L corresponding to all words in the L1 list. 1_total ; Step a4: perform the operation of step a1 on the words in the list L'1 obtained in step a2, and obtain the synonym list L' corresponding to all the words in the list L'1. 1_total ; Step a5: for L1, L'1, L 1_total and L' 1_total Merge and remove duplicates to obtain the candidate word library of W1, and further filter to finally obtain all the synonymous trigger words corresponding to the trigger word W1; For the trigger words in the initial trigger word list L, perform the operations of step a1 to step a5 to obtain W1, W2, ..., W n-1 ,W n All the corresponding synonymous trigger words will eventually be W1, W2, ..., W n-1 ,W n All corresponding trigger words are merged and deduplicated to build a trigger word dictionary; Step S4 includes: performing syntactic analysis on the candidate speech sentence to determine whether there is a subject-predicate relationship between the character and the trigger word; if so, determining that the sentence is the character's speech.
2. The method according to claim 1, characterized in that In step S2, the text is segmented by first locating the position of the sentence separator to obtain ordered separator position list information, and then performing preliminary sentence segmentation according to the position list information; wherein the sentence separators are located by punctuation marks, line breaks, and spaces.
3. The method according to claim 2, characterized in that In step S2, a double quotation mark recognition method is used to determine whether the delimiter can be used as an actual delimiter.
4. The method according to claim 3, characterized in that In step S2, a double quote recognition method is used to determine whether the delimiter can be used as an actual delimiter, specifically comprising: preliminarily separating the text according to the delimiter to obtain an ordered list of delimiter positions, denoted as P: [x1, x2, x3, ..., x m-1 ,x m ], where x1,x2,x3,…,x m-1 ,x m They represent the positions of the delimiters in the sentence. [1,x1] corresponds to the start and end positions of the first sentence. The delimiter position list is traversed from left to right. For the first traversal, the position where the start L of the sentence is fixed at 1, and the position corresponding to the end R of the sentence is x1. The start position L and the end position R constitute the pre-sentence S. Determine whether the double quotes in the pre-sentence S meet the following conditions: Whether the number of double quotes is even; Whether the first one is a left quotation mark and the last one is a right quotation mark; If both of the above conditions are met, S is output as a complete sentence. In the next traversal, the end x1 of this sentence is taken as the beginning L of the sentence, and the next element x2 of x1 is taken as the end R of the sentence, forming a pre-sentence S, and then the same judgment operation is performed.
5. The method according to claim 4, characterized in that Step S3 includes: segmenting each sentence, determining whether the segmented sentence contains known character information and trigger word information, and if so, taking the sentence as a candidate speech statement.
6. The method according to claim 5, characterized in that In step S3, the word segmentation of each sentence specifically includes: analyzing and extracting the part of speech and the number of occurrences of each term through a large-scale corpus to construct a word segmentation dictionary for scanning the word graph of sentence segmentation, and generating a directed acyclic graph consisting of possible word formation situations of all Chinese characters in the sentence; for the directed acyclic graph, the initial word segmentation probability of each word segmentation situation is obtained according to the probability of occurrence of each term, and then the word segmentation penalty factor C is introduced to obtain the final word segmentation probability, and the maximum value of the final word segmentation probability is selected as the word segmentation result.
7. According to the method of claim 6, in step S3, the initial word segmentation probability P is calculated using the following formula: ini : P ini_i =P(w i_1 )×P(w i_2 )×…×P(w i_n ), in, w i_n represents the nth word in the i-th possible word segmentation case, P(w i_n ) represents the nth word w i_n The probability of word segmentation; The final word segmentation probability P final The calculation formula is: P final_i =C v ×P ini_i Where P final_i is the final segmentation probability under the i-th possible segmentation case; v is the number of domain words that have not been successfully segmented in the sentence.
