Content mining methods, apparatus, electronic devices and storage media
By using sentence vector sequence fusion and annotation technology, the problem of low accuracy in content mining in existing technologies has been solved, enabling accurate identification of target fragments and objects in commentary texts, thereby improving the accuracy of content mining and user experience.
Patent Information
- Application Number
- CN202210099737.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-01-27
- Publication Date
- 2026-11-17
- Estimated Expiration
- 2042-01-27
AI Technical Summary
Existing content mining methods cannot accurately extract opinions from multiple comments or opinions of subjects not mentioned in commentary texts, resulting in low accuracy in content mining.
By acquiring the specified text and the text to be analyzed, converting them into a sequence of sentence vectors, performing data fusion processing, determining the target vector, identifying the target fragments and objects, using the BERT model and LSTM/BiLSTM to fuse contextual information, and combining CRF for annotation, the target fragments and objects are determined.
It improves the accuracy of content mining, enabling accurate identification of target segments and objects, and enhancing the user's search and reading experience.
Smart Images

Figure CN116562261B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of natural language processing technology, specifically to a content mining method, apparatus, electronic device, and storage medium. Background Technology
[0002] With the development of the internet, ordinary internet users have transformed from information receivers to information producers. The internet is filled with massive amounts of data, much of which consists of commentary texts on specific events, reflecting the authors' attitudes towards those events. Content mining refers to extracting opinions from commentary texts regarding a particular event, the target audience of those opinions, and so on.
[0003] Current content mining methods typically rely on keyword matching, which can uncover content containing the keyword and single-sentence comments on a particular event. However, if multiple comments on the same event appear in the commentary text, or if the target of the commentary text is not present, it is impossible to extract all opinions and targets from the commentary text, resulting in low accuracy of content mining. Summary of the Invention
[0004] This application provides a content mining method, apparatus, electronic device, and storage medium that can improve the accuracy of content mining.
[0005] This application provides a content mining method, including:
[0006] Obtain a specified text and the corresponding text to be analyzed, wherein the text to be analyzed includes multiple statements;
[0007] Based on the specified text, the text to be analyzed is converted into a sentence vector sequence, the sentence vector sequence including the sentence vector corresponding to each statement;
[0008] The sentence vectors are subjected to data fusion processing to obtain the target vector corresponding to each sentence;
[0009] Based on the target vector, the target segment is determined from the text to be analyzed;
[0010] Based on the target fragment and the specified text, determine the target object corresponding to the target fragment from the specified text.
[0011] This application also provides a content mining apparatus, including:
[0012] The acquisition module is used to acquire a specified text and the text to be analyzed corresponding to the specified text, wherein the text to be analyzed includes multiple statements;
[0013] The conversion module is used to convert the text to be analyzed into a sentence vector sequence based on the specified text, wherein the sentence vector sequence includes the sentence vector corresponding to each statement;
[0014] The fusion module is used to perform data fusion processing on the sentence vectors to obtain a target vector corresponding to each sentence.
[0015] The target segment determination module is used to determine the target segment from the text to be analyzed based on the target vector;
[0016] The target object determination module is used to determine the target object corresponding to the target fragment from the specified text based on the target fragment and the specified text.
[0017] In some embodiments, the fusion module further includes a forward encoding unit, a backward encoding unit, and a fusion unit:
[0018] A forward encoding unit is used to perform forward encoding on the sentence vector to obtain the forward latent vector corresponding to the sentence vector;
[0019] A backward encoding unit is used to perform backward encoding on the sentence vector to obtain the backward hidden vector corresponding to the sentence vector;
[0020] The fusion unit is used to concatenate the forward latent vector and the backward latent vector corresponding to the sentence vector to obtain the target vector corresponding to the sentence.
[0021] In some embodiments, the target object determination module further includes a splicing unit, an insertion unit, a vectorization unit, and an object determination unit:
[0022] A splicing unit is used to splice the target fragment and the specified text to obtain the initial text;
[0023] An insertion unit is used to insert a start identifier at the beginning of the initial text and to insert a separator between the target fragment and the specified text to obtain the target text;
[0024] A vectorization unit is used to perform vectorization processing on the target text to obtain a word vector sequence, wherein the word vector sequence includes the word vector corresponding to each word in the specified text.
[0025] An object determination unit is used to determine the target object corresponding to the target segment from the specified text based on the word vector sequence.
[0026] In some embodiments, the object determination unit is further configured to:
[0027] A first word vector and a second word vector are determined from the word vector sequence, wherein the order of the second word vector in the word vector sequence is greater than or equal to the order of the first word vector in the word vector sequence;
[0028] The text corresponding to the first word vector to the second word vector is determined as candidate text;
[0029] The target object is determined from the candidate text using a preset start vector, a preset end vector, the first word vector, and the second word vector.
[0030] In some embodiments, the object determination unit is further configured to:
[0031] Calculate the dot product of the preset start vector and the first word vector to obtain the first probability;
[0032] Calculate the dot product of the preset end vector and the second word vector to obtain the second probability;
[0033] The sum of the first probability and the second probability is calculated to obtain the target probability corresponding to the candidate text, wherein the target probability is used to represent the probability that the candidate text is the target object;
[0034] The candidate text with the highest target probability is identified as the target object.
[0035] In some embodiments, the target fragment determination module further includes a labeling unit and a fragment determination unit:
[0036] The annotation unit is used to annotate each sentence in the text to be analyzed based on the target vector to obtain a tag sequence;
[0037] The segment determination unit is used to determine the target segment from the text to be analyzed based on the tag sequence.
[0038] In some embodiments, the annotation unit is further configured to:
[0039] Candidate labels for the target vector are determined using preset annotation rules;
[0040] Using the feature function and the target vector, the annotation probability of the candidate label is calculated, where the annotation probability is the probability that the candidate label is the target label;
[0041] Based on the labeled probabilities, the target label corresponding to each target vector is determined, and the label sequence is obtained.
[0042] In some embodiments, the target label includes a first label and a second label, the first label indicating the beginning of the target segment and the second label indicating the continuation of the target segment. The segment determination unit is further configured to:
[0043] Obtain the first candidate statement with the first tag from the text to be analyzed;
[0044] Obtain a second candidate statement with a second tag from the text to be analyzed;
[0045] The first candidate statement and the second candidate statement consecutively are identified as the target segment.
[0046] In some embodiments, the conversion module further includes a statement concatenation unit and a sentence vector acquisition unit:
[0047] The statement concatenation unit is used to concatenate the specified text with each statement to obtain the target statement corresponding to each statement;
[0048] The sentence vector acquisition unit is used to perform vectorization processing on each of the target sentences to obtain a sentence vector sequence.
[0049] In some embodiments, the statement concatenation unit is further configured to:
[0050] The specified text is concatenated with each statement to obtain the initial statement corresponding to each statement;
[0051] Insert a start identifier at the beginning of each initial statement to obtain the target statement corresponding to each statement.
[0052] In some embodiments, the sentence vector acquisition unit is further configured to:
[0053] Each target statement is vectorized to obtain the word vector corresponding to each character in each target statement;
[0054] The word vector corresponding to the start identifier is determined as the sentence vector of the statement, thus obtaining the sentence vector sequence.
[0055] This application also provides an electronic device, including a memory storing multiple instructions; the processor loads instructions from the memory to execute steps in any of the content mining methods provided in this application.
[0056] This application also provides a computer-readable storage medium storing a plurality of instructions adapted for loading by a processor to execute steps in any of the content mining methods provided in this application.
[0057] This application embodiment can fuse specified text and text to be analyzed in order to correctly understand the semantics of the text to be analyzed. By fusing contextual information, the boundaries between target segments can be accurately identified, and multiple semantically coherent sentences can be extracted as target segments. After obtaining the target segments, the overall semantics of the specified text can be correctly identified based on the target segments and specified text in order to accurately capture the boundary information of the target object, thereby accurately identifying the target object and improving the accuracy of content mining. Attached Figure Description
[0058] To more clearly illustrate the technical solutions in the embodiments of this application, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0059] Figure 1a This is a schematic diagram of a scenario for the content mining method provided in an embodiment of this application;
[0060] Figure 1b This is a flowchart illustrating the content mining method provided in an embodiment of this application;
[0061] Figure 1c This is a schematic diagram of the internal structure of the LSTM provided in the embodiments of this application;
[0062] Figure 1d This is a flowchart illustrating the process of determining the target segment provided in an embodiment of this application;
[0063] Figure 1e This is a schematic diagram of the process for determining the target object provided in an embodiment of this application;
[0064] Figure 2 This is a schematic diagram illustrating the application of the content mining method provided in this application embodiment in a search scenario;
[0065] Figure 3 This is a schematic diagram of the content mining device provided in the embodiments of this application;
[0066] Figure 4 This is a schematic diagram of the structure of the electronic device provided in the embodiments of this application. Detailed Implementation
[0067] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0068] This application provides a content mining method, apparatus, electronic device, and storage medium.
[0069] Specifically, the content mining device can be integrated into an electronic device, such as a terminal or server. The terminal can be a mobile phone, tablet, smart Bluetooth device, laptop, or personal computer (PC); the server can be a single server or a server cluster consisting of multiple servers.
[0070] In some embodiments, the content mining apparatus may also be integrated into multiple electronic devices, such as multiple servers, with multiple servers implementing the content mining method of this application.
[0071] In some embodiments, the server may also be implemented as a terminal.
[0072] For example, refer to Figure 1a The diagram illustrates an application scenario of the content mining method provided in this embodiment.
[0073] like Figure 1a As shown, user terminal 101 and server 102 are located in a wireless network or a wired network, and user terminal 101 and server 102 interact with each other. Server 102 can be a standalone server or a server cluster, a local server or a cloud server, and integrates the content mining device provided in the embodiments of this application.
[0074] In some implementations, the user terminal 101 may have a corresponding application installed, through which the user can input specified text and send the specified text to the server 102, so that the server 102 can process the specified text.
[0075] In some implementations, after the server 102 obtains the specified text, it can search the database based on the specified text to obtain the text to be analyzed corresponding to the specified text.
[0076] Server 102 can convert the text to be analyzed into a sentence vector sequence based on the specified text, wherein the sentence vector sequence includes the sentence vector corresponding to each sentence; perform data fusion processing on the sentence vectors to obtain the target vector corresponding to each sentence; then determine the target segment from the text to be analyzed based on the target vector; finally determine the target object corresponding to the target segment from the specified text based on the target segment and the specified text.
[0077] After identifying the target fragment and its corresponding target object, server 102 can send both the target fragment and the target object to user terminal 101, allowing user 101 to display the target fragment and its corresponding target object. On user terminal 101, the user first inputs the specified text, then the target fragment and its corresponding target object are displayed, facilitating reading and improving the user's search and reading experience.
[0078] The following sections provide detailed descriptions of each example. It should be noted that the sequence numbers of the following embodiments are not intended to limit the preferred order of the embodiments.
[0079] Artificial intelligence (AI) is a technology that uses digital computers to simulate human perception of the environment, acquisition of knowledge, and use of that knowledge. This technology can enable machines to possess functions similar to human perception, reasoning, and decision-making. Fundamental AI technologies generally include sensors, dedicated AI chips, cloud computing, distributed storage, big data processing, operating / interactive systems, and mechatronics. AI software technologies mainly include computer vision, speech processing, natural language processing, as well as machine learning / deep learning, autonomous driving, and intelligent transportation.
[0080] Natural Language Processing (NLP) is an important area within computer science and artificial intelligence. It studies the theories and methods for enabling effective communication between humans and computers using natural language. NLP is a science that integrates linguistics, computer science, and mathematics. Therefore, research in this field involves natural language—the language people use in daily life—and thus it has a close connection with linguistic research. NLP technologies typically include text processing, semantic understanding, machine translation, question answering, and knowledge graphs.
[0081] With the research and advancement of artificial intelligence (AI) technology, AI is being studied and applied in various fields, such as smart homes, smart wearable devices, virtual assistants, smart speakers, smart marketing, autonomous driving, drones, robots, smart healthcare, smart customer service, vehicle networking, and intelligent transportation. It is believed that with the development of technology, AI will be applied in more fields and play an increasingly important role.
[0082] In this embodiment, a content mining method involving artificial intelligence is provided, such as... Figure 1b As shown, the specific process of this content mining method may include the following steps: S110 to S150.
[0083] S110. Obtain a specified text and a text to be analyzed corresponding to the specified text, wherein the text to be analyzed includes multiple statements.
[0084] The specified text refers to the text entered by the user to query for a certain content. The specified text can reflect the user's intent. For example, if the specified text is "volcanic eruption", then the user may want to know about recent volcanic eruptions, or they may want to know the principles of volcanic eruptions, etc.
[0085] In some implementations, if the user directly inputs text information, the input text can be directly used as the specified text. In other implementations, if the user inputs the specified text via voice, the voice information can be converted into text information to obtain the specified text.
[0086] The text to be analyzed corresponding to the specified text refers to the text content related to the specified text. For example, if the specified text is "volcanic eruption", the text to be analyzed could be an article analyzing the causes of a volcanic eruption, news content related to a volcanic eruption, etc.
[0087] In some implementations, the text to be analyzed can be obtained by querying a preset database using specified text. For example, after obtaining the specified text, a search engine uses that specified text as a keyword to query related content and obtain the text to be analyzed. The text to be analyzed can include multiple statements; for example, the text to be analyzed can be an article, which may include multiple statements.
[0088] S120. Based on the specified text, the text to be analyzed is converted into a sentence vector sequence, the sentence vector sequence including the sentence vector corresponding to each statement.
[0089] After obtaining the specified text and the text to be analyzed, the text to be analyzed can be converted into a sentence vector sequence based on the specified text. In order to better capture the semantics of the text to be analyzed, the specified text can be used to convert the text to be analyzed into a sentence vector sequence. For example, the specified text can be concatenated with each statement to obtain the target statement corresponding to each statement; each target statement can then be vectorized to obtain a sentence vector sequence.
[0090] As one implementation method, when concatenating the specified text and the text to be analyzed, the specified text can be concatenated with each statement to obtain the initial statement corresponding to each statement; a start identifier is inserted at the beginning of each initial statement to obtain the target statement corresponding to each statement.
[0091] When concatenating specified text with each statement, you can either directly concatenate the specified text and the statement to obtain the initial statement for each statement. Specifically, you can either concatenate the statement in the text to be analyzed after the specified text, or concatenate the specified text after the statement in the text to be analyzed. The following explanation uses concatenating statements after specified text as an example.
[0092] For example, if the specified text is 'e', and the text to be analyzed is 'd = {s1, s2, ..., s...} n}, where s1, s2, s n This represents each statement in the text to be analyzed. The initial statements can be represented as {e, s1}, {e, s2}, ..., {e, s...}. n After obtaining the initial statement corresponding to each statement, a start identifier can be inserted at the beginning of the initial statement to obtain the target statement. As mentioned in the previous example, if the initial statements are {e, s1}, {e, s2}, ..., {e, s...}, then... n If the start identifier is [CLS], then the target statements are {[CLS], e, s1}, {[CLS], e, s2}, ..., {[CLS], e, s... n}
[0093] By concatenating each statement in the specified text and the text to be analyzed, the two texts can be merged to accurately extract content from the text to be analyzed. After obtaining the target statements, they can be vectorized to facilitate machine processing. In some implementations, each target statement can be vectorized to obtain a word vector corresponding to each character in each target statement; the word vector corresponding to the start identifier is then determined as the sentence vector of the target statement, resulting in the sentence vector sequence.
[0094] As one implementation method, when vectorizing the target statement, the BERT model can be used to convert the target statement into corresponding sentence vectors. For example, by inputting the target statement into the BERT model, word vectors corresponding to each character in the target statement can be obtained. In some implementations, the word vectors corresponding to each character can be used as the vector representation of the statement.
[0095] Extract the word vector corresponding to the start identifier [CLS] from the word vectors output by BERT, and use this word vector as the sentence vector for the entire statement.
[0096] By vectorizing each target statement, a sentence vector corresponding to each target statement can be obtained, thus yielding a sequence of sentence vectors. Let the target statements be denoted as X = {X1, X2, ..., X...}. n}, then the sentence vector sequence can be represented as H={hs1 ,h s2 …h sn}
[0097] S130. Perform data fusion processing on the sentence vectors to obtain the target vector corresponding to each sentence.
[0098] The sentence vector sequence includes the vector representation of each sentence in the text to be analyzed. In order to further capture the interaction information between sentences and enhance the understanding of the text to be analyzed so as to distinguish the boundaries of the target segment, the sentence vectors can be subjected to data fusion processing to obtain the sentence representation that incorporates the contextual information of the sentences, i.e., the target vector.
[0099] In some implementations, when performing data fusion processing on sentence vectors, the sentence vectors may be forward encoded to obtain forward latent vectors corresponding to the sentence vectors; backward encoded to obtain backward latent vectors corresponding to the sentence vectors; and the forward latent vectors and backward latent vectors corresponding to the sentence vectors may be concatenated to obtain target vectors corresponding to the sentences.
[0100] One implementation method is to use a Long Short-Term Memory (LSTM) neural network to perform data fusion processing on sentence vectors. The LSTM model is a special type of Recurrent Neural Network (RNN). LSTM allows useful information to be passed to subsequent time steps by forgetting existing information and remembering new information, while discarding useless information. It outputs the hidden state at each time step. Forgetting, remembering, and output are controlled by a forget gate, an input gate, and an output gate, calculated using the hidden state from the previous time step and the current input.
[0101] For details, please refer to [link / reference]. Figure 1c The diagram shows the internal structure of an LSTM, where the forget gate is the output h of the previous unit. t-1 and the input x of this unit t The input sigmoid function, i.e. σ1 in the figure, is C. t-1 Each item in the array generates a value in the range [0,1] to control the degree to which the state of the previous unit is forgotten.
[0102] The input gate σ2 and a tanh function (tanh 1 in the diagram) work together to control what new information is added. The tanh function generates a new candidate vector, and the input gate generates a value in [0,1] for each item in the candidate vector, controlling how much new information is added.
[0103] The output gate controls how much of the current cell state is filtered out. First, the cell state is activated, and then the output gate generates a value in the range [0,1] for each item, controlling the degree to which the control state is filtered. Figure 1c Using tanh2 and σ3, the implicit vector h is calculated. t And the current state C t .
[0104] Before using the LSTM model, it can be trained with a large number of training sentences in advance so that the LSTM model can fuse sentence vectors to obtain a target vector containing contextual sentence information.
[0105] In some implementations, forward encoding of sentence vectors can be performed by inputting the sentence vector sequence forward into an LSTM to obtain the forward latent vector corresponding to each sentence vector. Backward encoding of sentence vectors can be performed by inputting the sentence vector sequence backward into an LSTM to obtain the backward latent vector corresponding to each sentence vector.
[0106] In some implementations, the target vector corresponding to a sentence can be directly obtained using a Bidirectional Long Short-Term Memory (BiLSTM) network, where BiLSTM is composed of a forward LSTM and a backward LSTM. The sentence vector sequence is input into the BiLSTM, passed through the forward LSTM for forward encoding to obtain the forward latent vector corresponding to each sentence vector, and then passed through the backward LSTM for backward encoding to obtain the backward latent vector corresponding to each sentence vector.
[0107] After obtaining the forward and backward implicit vectors corresponding to each sentence vector, the forward and backward implicit vectors can be concatenated to obtain the target vector corresponding to the sentence. For example, if the forward implicit vectors are {hL0, hL1, hL2} and the backward implicit vectors are {hR0, hR1, hR2}, concatenating them yields {[hL0, hR2], [hL1, hR1], [hL2, hR0]}, where [hL0, hR2] is the target vector corresponding to the sentence.
[0108] S140. Based on the target vector, determine the target segment from the text to be analyzed.
[0109] A target segment refers to evaluative text within the text to be analyzed. For example, in an article, a certain event is first introduced, and then the author expresses their opinion on that event; this opinion is the target segment. To extract opinions related to a specific text from the text to be analyzed, target segments can be determined using target vectors corresponding to each statement in the text. For instance, each statement in the text to be analyzed can be labeled based on the target vectors to obtain a label sequence; and the target segment can then be determined based on the label sequence.
[0110] One implementation method involves labeling each sentence in the text to be analyzed based on the target vector, resulting in a label sequence. This can be understood as classifying each sentence to determine its corresponding category and obtain the label sequence. For example, the target vector can be directly input into a softmax layer to predict the category corresponding to each target vector. This category can be understood as the label of the sentence; that is, softmax is used to predict the label corresponding to each sentence in the text to be analyzed.
[0111] As one implementation method, each statement in the text to be analyzed is labeled based on the target vector to obtain a label sequence. This can be achieved by using preset labeling rules to determine candidate labels for the target vector; using feature functions and the target vector, the labeling probability of the candidate label is calculated, where the labeling probability is the probability that the candidate label is the target label; and based on the labeling probability, the target label corresponding to each target vector is determined to obtain the label sequence.
[0112] The preset annotation rules specify the annotation method, such as whether to perform part-of-speech tagging or entity tagging, and corresponding annotation rules can be pre-set. For example, the preset annotation rule could be BIO tagging, where B represents the beginning of the target segment, I represents the continuation of the target segment, and O represents a non-target segment. These three tags can be understood as candidate tags.
[0113] In this system, each statement has three candidate labels: B, I, and O. The labeling probability of each candidate label can be calculated using a feature function and a target vector. The feature function is defined in Conditional Random Field (CRF) and can be a set of multiple rules. For example, if the preceding and following statements of a statement satisfy corresponding conditions, it can be labeled as B. This is a labeling rule, and the set of multiple labeling rules constitutes the feature function.
[0114] Therefore, based on the feature function, the probability of each statement being labeled as B, I, and O can be calculated. Finally, based on the labeling probability of each statement being labeled as a candidate label, the probability of the entire candidate label sequence of the text to be analyzed is calculated. The candidate label sequence is the possible label sequence of the entire text to be analyzed, and the probability of the candidate label sequence can be calculated from the labeling probability of the candidate label of each statement. For example, if there are two statements in the text to be analyzed, and each statement could be labeled as B, I, or O, then the corresponding candidate label sequence could be {B,B}, {B,I}, {B,O}, {I,B}, {I,I}, {I,O}, {O,B}, {O,I}, {O,O}. When calculating the probability of the candidate label sequence {B,B}, it can be calculated by multiplying the labeling probability of the first statement being labeled as B by the labeling probability of the second statement being labeled as B.
[0115] Thus, a corresponding probability value can be calculated for each candidate label sequence, and the candidate label sequence with the highest probability value is selected as the label sequence.
[0116] For example, please refer to Figure 1d This illustrates a schematic diagram of the processing flow for determining the target segment. Figure 1d In this process, the specified text and the sentences in the text to be analyzed are concatenated to obtain the target sentence. The target sentence is then input into BERT, and the word vector corresponding to the start identifier [CLS] is selected as the sentence vector of the entire sentence, resulting in a sentence vector sequence. The sentence vector sequence is then input into BiLSTM, where context information is fused to obtain the target vector. Finally, the target vector is input into CRF to obtain the labels corresponding to the target vector, forming a label sequence. Thus, the text to be analyzed is converted into a label sequence.
[0117] After annotating each statement and obtaining the target label for each statement, the target label can include a first label and a second label. The first label is used to indicate the beginning of the target segment, and the second label is used to indicate the continuation of the target segment. For example, using BIO annotation, B is the first label, indicating the beginning of the target segment, I can be the second label, indicating the continuation of the target segment, and O represents a non-target segment.
[0118] When determining a target segment from a text to be analyzed based on a tag sequence, the process may involve obtaining a first candidate statement with a first tag from the text to be analyzed; obtaining a second candidate statement with a second tag from the text to be analyzed; and determining consecutive first candidate statements and second candidate statements as the target segment.
[0119] For example, the text to be analyzed is d = {s1,2,…, nThe corresponding label sequence obtained through the CRF layer is {O, B, I, O}, where the label corresponding to statement s1 is O, the label corresponding to statement s2 is B, the label corresponding to statement s3 is I, and the label corresponding to statement s4 is O. Therefore, the text fragment composed of statements s2 and s3 is the target fragment.
[0120] S150. Based on the target fragment and the specified text, determine the target object corresponding to the target fragment from the specified text.
[0121] After obtaining the target fragment, the target object corresponding to the target fragment can be further determined from the specified text based on the target fragment and the specified text. The target fragment is a commentary statement, and the target object is the object that the commentary statement addresses. For example, if the target fragment is "This apple is delicious and I would buy it again," the target object that the target fragment addresses is "apple."
[0122] Since some target fragments may not contain the target object, such as "It's so delicious," where "it" refers to the target object, it is impossible to understand what "it" specifically refers to. That is, the target object cannot be obtained from the target fragment. However, the target object usually exists in the specified text. Therefore, the target object can be determined from the specified text by combining the target fragment.
[0123] When determining a target object from specified text by combining a target fragment, the target fragment and the specified text can be merged first. In some embodiments, merging the target fragment and the specified text can involve concatenating the target fragment and the specified text to obtain an initial text; inserting a start identifier at the beginning of the initial text and inserting a separator between the target fragment and the specified text to obtain the target text; vectorizing the target text to obtain a word vector sequence, the word vector sequence including the word vector corresponding to each word in the specified text; and determining the target object corresponding to the target fragment from the specified text based on the word vector sequence.
[0124] For example, if the specified text is represented by 'e' and the target fragment is represented by 'o', the target fragment and the specified text can be concatenated together to obtain the initial text {o, e}. Then, a start identifier is inserted at the beginning of the initial text to specify the start of the input. Separators are inserted between the target fragment and the specified text to obtain the target text {[CLS], o, [SEP], e}.
[0125] After obtaining the target text, it can be vectorized to obtain word vectors for each word. BERT can be used to vectorize the target text, obtaining word vectors for each word in the target text. Since the target text contains specified text, word vectors for each word in the specified text can be obtained, forming a word vector sequence.
[0126] In some implementations, determining the target object corresponding to the target segment from a specified text based on a word vector sequence may involve determining a first word vector and a second word vector from the word vector sequence, wherein the order of the second word vector in the word vector sequence is greater than or equal to the order of the first word vector in the word vector sequence; determining the text corresponding to the first word vector to the second word vector as candidate text; and using a preset start vector, a preset end vector, the first word vector, and the second word vector to determine the target object from the candidate text.
[0127] It is understandable that the order of each word vector in the word vector sequence is the same as the order of the words in the specified text. For example, given the text e = {w1, w2, w3, w4}, the corresponding word vector sequence is {h w1 ,h w2 ,h w3 ,h w4}, where the word vector corresponding to word w1 is h. w1 The word vector corresponding to word w2 is h. w2 The word vector corresponding to word w3 is h. w3 The word vector corresponding to word w4 is h. w4 For example, if the word w1 is in the order of 1, its corresponding word vector h w1 The order is also 1.
[0128] When determining the first and second word vectors from a word vector sequence, the order can be used. Specifically, in the word vector sequence, the order of the second word vector is greater than the order of the first word vector. That is, in a given text, if the word corresponding to the second word vector follows the word corresponding to the first word vector, and the order of the second word vector is equal to the order of the first word vector, it indicates that the first and second word vectors point to the same word.
[0129] As in the example above, if the first word vector is determined to be h w1 Therefore, the second word vector could be h. w1 h w2 h w3 , and h w4 For any one of them, if the first word vector is h w2 Then the second word vector could be h w2 hw3 , and h w4 Any one of them; if the first word vector is h w3 The second word vector can be h w3 and h w4 Any one of them; if the first word vector is h w4 The second word vector can be h w4 .
[0130] After determining the first word vector and the second word vector, the text corresponding to the first word vector and the second word vector can be identified as candidate text. For example, if the first word vector is h... w1 The second word vector is h w4 Therefore, w1, w2, w3, and w4 are candidate texts. For example, the first word vector is h. w2 The second word vector is h w4 Therefore, w2, w3, and w4 are also candidate texts. It should be noted that the previously determined first and second word vectors have multiple possibilities, thus resulting in multiple corresponding candidate texts.
[0131] After obtaining candidate text, the candidate text begins with the word corresponding to the first word vector and ends with the word corresponding to the second word vector. Preset start vectors and preset end vectors can be introduced to calculate the probability that the candidate text is the target object. In some implementations, the dot product of the preset start vector and the first word vector can be calculated to obtain a first probability; the dot product of the preset end vector and the second word vector can be calculated to obtain a second probability; the sum of the first probability and the second probability can be calculated to obtain the target probability corresponding to the candidate text, where the target probability represents the probability that the candidate text is the target object; and the candidate text with the highest target probability is determined as the target object.
[0132] For example, the preset start vector is S, the preset end vector is E, and the first word vector is w. h2 The second word vector is w h4 The corresponding candidate texts are w2, w3, and w4. When calculating the target probability of this candidate text, the first probability is Sw2, the second probability is Ew4, and the target probability is Sw2 + Ew4. Here, the first probability can refer to the probability that the word is the beginning of the target object, and the second probability can refer to the probability that the word is the end of the target object.
[0133] The target probability corresponding to all candidate texts can be calculated in the above way. Suppose there are 3 candidate texts, namely candidate text 1, candidate text 2 and candidate text 3. The target probability of candidate text 1 is p1, the target probability of candidate text 2 is p2, and the target probability of candidate text 3 is p3. Since p2>p3>p1, then candidate text 2 with target probability p2 can be identified as the target object.
[0134] In some implementations, the probability of each word being the start word can be calculated using a preset start vector, a preset end vector, and the word vector corresponding to each word in the specified text. This involves calculating the dot product of the preset start vector and the corresponding word vector. The probability of each word being the end word can also be calculated by calculating the dot product of the preset end vector and the corresponding word vector. Finally, following the order of the start words being less than or equal to the order of the end words, the probability of the text being the target object can be calculated, and the text with the highest probability can be selected as the target object.
[0135] For example, you can refer to Figure 1e This illustrates a schematic diagram of the processing flow for determining the target object. Figure 1e In this process, the target fragment is concatenated with the specified text to obtain the target text. The target text is then input into BERT to obtain the word vectors corresponding to each word in the specified text. Here, H1 to H... n H1' to H'' represent the word vectors corresponding to each word in the target segment. m ` represents the word vector corresponding to each word in the specified text. The probability of starting and ending the target object is then calculated using the word vectors. Based on these probabilities, the target object corresponding to the target segment is determined from the specified text.
[0136] If the model used to identify the target object from the text to be analyzed is called the object identification model, then the object identification model needs to be trained in advance when using it to identify the target object from the text to be analyzed.
[0137] When determining the model for training purposes, the target loss function can be the sum of the cross-entropy loss functions of the correct start word and the correct end word, as shown in the following formula:
[0138]
[0139] Where m represents the number of words in the specified text, and y si The distribution represents the label where the i-th word is the starting word, y ei The distribution represents the label of the i-th word as the end word; a label of 1 indicates yes, and a label of 0 indicates no. si p represents the probability that the i-th word is the starting word; eiThis represents the probability that the i-th word is the ending word.
[0140] When training the model, the concatenated target text is input into BERT to obtain the word vector for each word in the specified text. Each word vector is then multiplied by a preset starting vector S and passed through a softmax layer to obtain the probability, p, of the word vector being chosen as the starting word. si .
[0141] Each word as the starting word can be calculated using the following formula:
[0142]
[0143] Where S represents the preset start vector, H i This represents the word vector corresponding to the i-th word.
[0144] Similarly, by multiplying each word vector by the preset end vector E and passing it through a softmax layer, we can obtain the probability p of the word vector being the end word. ei .
[0145] The probability of each word being the ending word can be calculated using the following formula:
[0146]
[0147] Where E represents the preset end vector, H i This represents the word vector corresponding to the i-th word.
[0148] Therefore, by continuously adjusting the parameters of the object-oriented model, specifically the parameters of the softmax layer, and pre-setting the end and start vectors, a well-trained object extraction model can be obtained when the target loss function converges. Using this trained object extraction model, the target probability of candidate texts can be directly calculated using the pre-set start and end vectors, and the target object can be identified as output.
[0149] By using BERT and softmax layers, the overall semantics of a given text can be obtained, providing sufficient contextual information for correctly identifying the target object, thereby improving the accuracy of target object identification.
[0150] In some implementations, when identifying target objects, a sequence labeling model can be used to label each word in the specified text to obtain a corresponding label sequence, and the target object can be determined based on the label sequence. The sequence labeling model can be an LSTM-CRF structure, a BERT-CRF structure, etc.
[0151] The content mining solution provided in this application can be applied to various text analysis scenarios. For example, taking content search as an example, based on the specified text input by the user, related text to be analyzed can be obtained. The text to be analyzed can be analyzed to filter out opinion fragments and determine the opinion objects corresponding to the opinion fragments from the specified text. The opinion fragments and their corresponding opinion objects can then be displayed to the user, helping the user quickly capture the key content in the text to be analyzed and improving reading efficiency.
[0152] As can be seen from the above, the embodiments of this application integrate the specified text and the text to be analyzed in order to correctly understand the semantics of the text to be analyzed. By integrating contextual information, the boundaries between target segments can be accurately identified, and multiple semantically coherent sentences can be extracted as target segments. This avoids the situation where the target segment cannot be captured because it contains multiple sentences, thus improving the accuracy of target segment determination. After obtaining the target segment, based on the target segment and the specified text, the overall semantics of the specified text can be correctly understood in order to accurately capture the boundary information of the target object, thereby accurately identifying the target object. This avoids the situation where the target object cannot be determined because it does not appear in the target segment, thus improving the accuracy of target object identification. Therefore, this application can accurately mine target segments and target objects, improving the accuracy of content mining.
[0153] The method described in the above embodiments will be further described in detail below.
[0154] In this embodiment, the method of this application embodiment will be described in detail using event opinion search as an example, with the target fragment being opinion fragment and the target object being opinion object.
[0155] like Figure 2 As shown, the specific process of a content mining method is as follows:
[0156] S210. Obtain the event phrase input by the user and the search text corresponding to the event phrase, wherein the search text includes multiple statements.
[0157] S220. Based on the event phrase, the search text is converted into a sentence vector sequence, the sentence vector sequence including the sentence vector corresponding to each statement.
[0158] S230. Perform data fusion processing on the sentence vectors to obtain the target vector corresponding to each sentence.
[0159] S240. Based on the target vector, determine the opinion fragments from the search text.
[0160] S250. Based on the opinion fragment and the event phrase, determine the opinion object corresponding to the opinion fragment from the event phrase.
[0161] S260. Output the viewpoint fragment and the viewpoint object corresponding to the viewpoint fragment.
[0162] An opinion on an event mainly includes three elements: the opinion holder, the opinion object, and the opinion itself. The opinion holder refers to the person or organization that expresses the opinion; the opinion object refers to the object of the opinion discussion, the event itself, the participants in the event, or related events; and the opinion refers to the argumentative text.
[0163] When users need to search for opinions on an event, they can enter the corresponding event phrase, such as "Company A releases Product B". For this event, multiple articles related to the event can be found, which are the texts to be analyzed. For any of the searched articles, the article can be analyzed to extract opinion fragments related to the event phrase.
[0164] Understandably, an article contains multiple statements; some may be introductory, while others express opinions. We need to identify the statements that express opinions. Each statement in the article can be tagged to help us pinpoint the opinion-expressing segments.
[0165] Specifically, the event phrase can be concatenated with each sentence, and [CLS] can be inserted at the beginning to obtain the target sentence as the input to the model. The target sentence is then fed into the BERT model, and the word vector corresponding to [CLS] is used as the sentence vector for the entire sentence. This transforms the article into a sequence of sentence vectors {h}. s1 h s2 ….h sn The sentence vector sequence is input into a BiLSTM model. By fusing contextual information, the boundaries of opinion segments are correctly identified. Then, a CRF layer is used to obtain a label sequence. Based on the label sequence, sentences corresponding to consecutive "B" and "I" are identified as opinion segments. Thus, through sentence-level sequence labeling, the boundaries of opinion segments can be correctly identified by fusing contextual information. This not only allows for the identification of multiple semantically coherent sentences as opinion segments but also yields opinions on event participants and related events within event phrases, resulting in rich and accurate content mining.
[0166] After obtaining a viewpoint fragment, it is necessary to further determine the target audience of the viewpoint fragment. In articles, pronouns are often used to refer to events, such as "this" and "that," making it difficult to determine the target audience from the viewpoint fragment. However, the viewpoint fragment will always contain an event phrase. Therefore, the target audience corresponding to the viewpoint fragment can be determined from the event phrase.
[0167] It should be noted that if there are multiple identified opinion fragments, a corresponding opinion object can be determined for each fragment. When determining the opinion object, opinion fragments and event phrases can be concatenated. During concatenation, a separator [SEP] is inserted between the opinion fragments and the event phrase, and [CLS] is inserted at the beginning to obtain the target text. This target text is then input into the BERT model to obtain word vectors corresponding to each word in the event phrase, accurately understanding the semantics of the event phrase. The obtained word vectors are then input into a softmax layer. In this layer, the probability that any two words between any given word vectors are opinion objects is calculated using the word vectors and preset start and end vectors. The word with the highest probability value is identified as the opinion object. Determining the opinion object based on reading comprehension allows for the acquisition of the overall semantics of the given text, providing sufficient contextual information for correctly identifying the opinion object, thereby improving the accuracy of target object determination.
[0168] Finally, the system displays viewpoint fragments and their corresponding viewpoint objects to the user, enabling them to quickly grasp the relevant viewpoints within the article. It should be noted that the BERT, LSTM, BiLSTM, CRF, and softmax methods mentioned in this embodiment can all be pre-trained. For example, if a BERT-LSTM-CRF structure is used to determine viewpoint fragments, it needs to be pre-trained to obtain the corresponding label sequences, allowing the viewpoint fragment to be determined based on the output label sequences. Similarly, if a BERT-softmax structure is used to determine viewpoint objects, it also needs to be pre-trained to obtain the corresponding viewpoint objects.
[0169] As can be seen from the above, this application can fuse the specified text and the text to be analyzed to correctly understand the semantics of the text to be analyzed. By fusing contextual information, the boundaries between target segments can be accurately identified, and multiple semantically coherent sentences can be extracted as target segments. This avoids situations where the target segment cannot be captured due to containing multiple sentences, thus improving the accuracy of target segment identification. After obtaining the target segment, based on the target segment and the specified text, the overall semantics of the specified text can be correctly understood to accurately capture the boundary information of the target object, thereby accurately identifying the target object. This avoids situations where the target object cannot be identified due to its absence in the target segment, thus improving the accuracy of target object identification. Therefore, this application can accurately mine target segments and target objects, improving the accuracy of content mining. Furthermore, displaying the accurately mined target segments and target objects to users can help them quickly understand the event's viewpoint and the viewpoint's subject, improving the reading experience.
[0170] To better implement the above methods, this application also provides a content mining device, which can be integrated into an electronic device, such as a terminal or server. The terminal can be a mobile phone, tablet computer, smart Bluetooth device, laptop computer, or personal computer; the server can be a single server or a server cluster composed of multiple servers.
[0171] For example, in this embodiment, the method of this application embodiment will be described in detail by taking the content mining device specifically integrated into the server as an example.
[0172] For example, such as Figure 3 As shown, the content mining device may include an acquisition module 310, a conversion module 320, a fusion module 330, a target segment determination module 340, and a target object determination module 350.
[0173] The acquisition module 310 is used to acquire a specified text and a text to be analyzed corresponding to the specified text, wherein the text to be analyzed includes multiple statements;
[0174] The conversion module 320 is used to convert the text to be analyzed into a sentence vector sequence according to the specified text, wherein the sentence vector sequence includes the sentence vector corresponding to each statement;
[0175] The fusion module 330 is used to perform data fusion processing on the sentence vectors to obtain a target vector corresponding to each sentence.
[0176] The target segment determination module 340 is used to determine the target segment from the text to be analyzed based on the target vector;
[0177] The target object determination module 350 is used to determine the target object corresponding to the target fragment from the specified text based on the target fragment and the specified text.
[0178] In some embodiments, the fusion module 330 further includes a forward encoding unit, a backward encoding unit, and a fusion unit:
[0179] A forward encoding unit is used to perform forward encoding on the sentence vector to obtain the forward latent vector corresponding to the sentence vector;
[0180] A backward encoding unit is used to perform backward encoding on the sentence vector to obtain the backward hidden vector corresponding to the sentence vector;
[0181] The fusion unit is used to concatenate the forward latent vector and the backward latent vector corresponding to the sentence vector to obtain the target vector corresponding to the sentence.
[0182] In some embodiments, the target object determination module 350 further includes a splicing unit, an insertion unit, a vectorization unit, and an object determination unit:
[0183] A splicing unit is used to splice the target fragment and the specified text to obtain the initial text;
[0184] An insertion unit is used to insert a start identifier at the beginning of the initial text and to insert a separator between the target fragment and the specified text to obtain the target text;
[0185] A vectorization unit is used to perform vectorization processing on the target text to obtain a word vector sequence, wherein the word vector sequence includes the word vector corresponding to each word in the specified text.
[0186] An object determination unit is used to determine the target object corresponding to the target segment from the specified text based on the word vector sequence.
[0187] In some embodiments, the object determination unit is further configured to:
[0188] A first word vector and a second word vector are determined from the word vector sequence, wherein the order of the second word vector in the word vector sequence is greater than or equal to the order of the first word vector in the word vector sequence;
[0189] The text corresponding to the first word vector to the second word vector is determined as candidate text;
[0190] The target object is determined from the candidate text using a preset start vector, a preset end vector, the first word vector, and the second word vector.
[0191] In some embodiments, the object determination unit is further configured to:
[0192] Calculate the dot product of the preset start vector and the first word vector to obtain the first probability;
[0193] Calculate the dot product of the preset end vector and the second word vector to obtain the second probability;
[0194] The sum of the first probability and the second probability is calculated to obtain the target probability corresponding to the candidate text, wherein the target probability is used to represent the probability that the candidate text is the target object;
[0195] The candidate text with the highest target probability is identified as the target object.
[0196] In some embodiments, the target fragment determination module 340 further includes a labeling unit and a fragment determination unit:
[0197] The annotation unit is used to annotate each sentence in the text to be analyzed based on the target vector to obtain a tag sequence;
[0198] The segment determination unit is used to determine the target segment from the text to be analyzed based on the tag sequence.
[0199] In some embodiments, the annotation unit is further configured to:
[0200] Candidate labels for the target vector are determined using preset annotation rules;
[0201] Using the feature function and the target vector, the annotation probability of the candidate label is calculated, where the annotation probability is the probability that the candidate label is the target label;
[0202] Based on the labeled probabilities, the target label corresponding to each target vector is determined, and the label sequence is obtained.
[0203] In some embodiments, the target label includes a first label and a second label, the first label indicating the beginning of the target segment and the second label indicating the continuation of the target segment. The segment determination unit is further configured to:
[0204] Obtain the first candidate statement with the first tag from the text to be analyzed;
[0205] Obtain a second candidate statement with a second tag from the text to be analyzed;
[0206] The first candidate statement and the second candidate statement consecutively are identified as the target segment.
[0207] In some embodiments, the conversion module 320 further includes a statement concatenation unit and a sentence vector acquisition unit:
[0208] The statement concatenation unit is used to concatenate the specified text with each statement to obtain the target statement corresponding to each statement;
[0209] The sentence vector acquisition unit is used to perform vectorization processing on each of the target sentences to obtain a sentence vector sequence.
[0210] In some embodiments, the statement concatenation unit is further configured to:
[0211] The specified text is concatenated with each statement to obtain the initial statement corresponding to each statement;
[0212] Insert a start identifier at the beginning of each initial statement to obtain the target statement corresponding to each statement.
[0213] In some embodiments, the sentence vector acquisition unit is further configured to:
[0214] Each target statement is vectorized to obtain the word vector corresponding to each character in each target statement;
[0215] The word vector corresponding to the start identifier is determined as the sentence vector of the statement, thus obtaining the sentence vector sequence.
[0216] In practice, each of the above modules or units can be implemented as an independent entity or can be arbitrarily combined to be implemented as the same or several entities. For the specific implementation of each of the above modules or units, please refer to the previous method embodiments, which will not be repeated here.
[0217] As can be seen from the above, the content mining device in this embodiment can fuse the specified text and the text to be analyzed in order to correctly understand the semantics of the text to be analyzed. By fusing contextual information, the boundaries between target segments can be accurately identified, and multiple semantically coherent sentences can be extracted as target segments. After obtaining the target segments, the overall semantics of the specified text can be correctly identified based on the target segments and the specified text, so as to accurately capture the boundary information of the target object, thereby accurately identifying the target object and improving the accuracy of content mining.
[0218] This application also provides an electronic device, which can be a terminal, a server, or other similar device. The terminal can be a mobile phone, tablet computer, smart Bluetooth device, laptop computer, personal computer, etc.; the server can be a single server or a server cluster composed of multiple servers, etc.
[0219] In some embodiments, the content mining apparatus may also be integrated into multiple electronic devices, such as multiple servers, with multiple servers implementing the content mining method of this application.
[0220] In this embodiment, a server will be used as an example for detailed description. For example, ... Figure 4 As shown, it illustrates a structural schematic diagram of the electronic device involved in the embodiments of this application, specifically:
[0221] The server may include components such as a processor 401 with one or more processing cores, a memory 402 with one or more computer-readable storage media, a power supply 403, an input module 404, and a communication module 405. Those skilled in the art will understand that... Figure 4 The server structure shown does not constitute a limitation on the server and may include more or fewer components than illustrated, or combine certain components, or have different component arrangements. Wherein:
[0222] The processor 401 is the control center of the server, connecting various parts of the server via various interfaces and lines. It performs various server functions and processes data by running or executing software programs and / or modules stored in the memory 402, and by calling data stored in the memory 402. In some embodiments, the processor 401 may include one or more processing cores; in some embodiments, the processor 401 may integrate an application processor and a modem processor, wherein the application processor mainly handles the operating system, user interface, and applications, and the modem processor mainly handles wireless communication. It is understood that the modem processor may also not be integrated into the processor 401.
[0223] The memory 402 can be used to store software programs and modules. The processor 401 executes various functional applications and data processing by running the software programs and modules stored in the memory 402. The memory 402 may mainly include a program storage area and a data storage area. The program storage area may store the operating system, at least one application program required for a function (such as sound playback function, image playback function, etc.), etc.; the data storage area may store data created according to the use of the server, etc. In addition, the memory 402 may include high-speed random access memory, and may also include non-volatile memory, such as at least one disk storage device, flash memory device, or other volatile solid-state storage device. Accordingly, the memory 402 may also include a memory controller to provide the processor 401 with access to the memory 402.
[0224] The server also includes a power supply 403 that supplies power to the various components. In some embodiments, the power supply 403 can be logically connected to the processor 401 through a power management system, thereby enabling functions such as charging, discharging, and power consumption management through the power management system. The power supply 403 may also include one or more DC or AC power supplies, recharging systems, power fault detection circuits, power converters or inverters, power status indicators, and other arbitrary components.
[0225] The server may also include an input module 404, which can be used to receive input numeric or character information, and generate keyboard, mouse, joystick, optical or trackball signal inputs related to user settings and function control.
[0226] The server may also include a communication module 405. In some embodiments, the communication module 405 may include a wireless module, through which the server can perform short-range wireless transmission, thereby providing users with wireless broadband internet access. For example, the communication module 405 can be used to help users send and receive emails, browse web pages, and access streaming media.
[0227] Although not shown, the server may also include a display unit, etc., which will not be described in detail here. Specifically, in this embodiment, the processor 401 in the server loads the executable files corresponding to the processes of one or more applications into the memory 402 according to the following instructions, and the processor 401 runs the applications stored in the memory 402 to realize various functions, as follows:
[0228] Obtain a specified text and the corresponding text to be analyzed, wherein the text to be analyzed includes multiple statements;
[0229] Based on the specified text, the text to be analyzed is converted into a sentence vector sequence, the sentence vector sequence including the sentence vector corresponding to each statement;
[0230] The sentence vectors are subjected to data fusion processing to obtain the target vector corresponding to each sentence;
[0231] Based on the target vector, the target segment is determined from the text to be analyzed;
[0232] Based on the target fragment and the specified text, determine the target object corresponding to the target fragment from the specified text.
[0233] For details on the implementation of each of the above operations, please refer to the previous examples, which will not be repeated here.
[0234] As can be seen from the above, the embodiments of this application can fuse the specified text and the text to be analyzed in order to correctly understand the semantics of the text to be analyzed. By fusing contextual information, the boundaries between target segments can be accurately identified, and multiple semantically coherent sentences can be extracted as target segments. After obtaining the target segments, based on the target segments and the specified text, the overall semantics of the specified text can be correctly identified in order to accurately capture the boundary information of the target object, thereby accurately identifying the target object and improving the accuracy of content mining. As can be understood by those skilled in the art, all or part of the steps in the various methods of the above embodiments can be completed by instructions or by controlling related hardware through instructions. The instructions can be stored in a computer-readable storage medium and loaded and executed by a processor.
[0235] Therefore, embodiments of this application provide a computer-readable storage medium storing a plurality of instructions that can be loaded by a processor to execute steps in any of the content mining methods provided in embodiments of this application. For example, the instructions can execute the following steps:
[0236] Obtain a specified text and the corresponding text to be analyzed, wherein the text to be analyzed includes multiple statements;
[0237] Based on the specified text, the text to be analyzed is converted into a sentence vector sequence, the sentence vector sequence including the sentence vector corresponding to each statement;
[0238] The sentence vectors are subjected to data fusion processing to obtain the target vector corresponding to each sentence;
[0239] Based on the target vector, the target segment is determined from the text to be analyzed;
[0240] Based on the target fragment and the specified text, determine the target object corresponding to the target fragment from the specified text.
[0241] The storage medium may include: read-only memory (ROM), random access memory (RAM), disk or optical disk, etc.
[0242] According to one aspect of this application, a computer program product or computer program is provided, comprising computer instructions stored in a computer-readable storage medium. A processor of an electronic device reads the computer instructions from the computer-readable storage medium and executes the computer instructions, causing the electronic device to perform the methods provided in various optional implementations of the content mining or model training aspects provided in the above embodiments.
[0243] Since the instructions stored in the storage medium can execute the steps of any of the content mining methods provided in the embodiments of this application, the beneficial effects that any of the content mining methods provided in the embodiments of this application can achieve can be realized. For details, please refer to the previous embodiments, which will not be repeated here.
[0244] The foregoing has provided a detailed description of a content mining method, apparatus, electronic device, and computer-readable storage medium provided in the embodiments of this application. Specific examples have been used to illustrate the principles and implementation methods of this application. The descriptions of the above embodiments are only for the purpose of helping to understand the method and core ideas of this application. At the same time, for those skilled in the art, there will be changes in the specific implementation methods and application scope based on the ideas of this application. Therefore, the content of this specification should not be construed as a limitation of this application.
Claims
1. A content mining method, characterized in that, The method includes: Obtain a specified text and the corresponding text to be analyzed, wherein the text to be analyzed includes multiple statements; Based on the specified text, the text to be analyzed is converted into a sentence vector sequence, the sentence vector sequence including the sentence vector corresponding to each statement; The sentence vectors are subjected to data fusion processing to obtain the target vector corresponding to each sentence; Based on the target vector, the target segment is determined from the text to be analyzed; Determining the target object corresponding to the target segment from the specified text based on the target segment and the specified text includes: concatenating the target segment and the specified text to obtain initial text; inserting a start identifier at the beginning of the initial text and inserting a separator between the target segment and the specified text to obtain target text; vectorizing the target text to obtain a word vector sequence, the word vector sequence including the word vector corresponding to each word in the specified text; and determining the target object corresponding to the target segment from the specified text based on the word vector sequence.
2. The method according to claim 1, characterized in that, The data fusion processing of the sentence vectors to obtain the target vector corresponding to each sentence includes: Perform forward encoding on the sentence vector to obtain the forward latent vector corresponding to the sentence vector; The sentence vector is back-encoded to obtain the back-hidden vector corresponding to the sentence vector; By concatenating the forward latent vector and the backward latent vector corresponding to the sentence vector, the target vector corresponding to the sentence is obtained.
3. The method according to claim 1, characterized in that, The step of determining the target object corresponding to the target segment from the specified text based on the word vector sequence includes: A first word vector and a second word vector are determined from the word vector sequence, wherein the order of the second word vector in the word vector sequence is greater than or equal to the order of the first word vector in the word vector sequence; The text corresponding to the first word vector to the second word vector is determined as candidate text; The target object is determined from the candidate text using a preset start vector, a preset end vector, the first word vector, and the second word vector.
4. The method according to claim 3, characterized in that, Determining the target object from the candidate text using a preset start vector, a preset end vector, the first word vector, and the second word vector includes: Calculate the dot product of the preset start vector and the first word vector to obtain the first probability; Calculate the dot product of the preset end vector and the second word vector to obtain the second probability; The sum of the first probability and the second probability is calculated to obtain the target probability corresponding to the candidate text, wherein the target probability is used to represent the probability that the candidate text is the target object; The candidate text with the highest target probability is identified as the target object.
5. The method according to claim 1, characterized in that, The step of determining the target segment from the text to be analyzed based on the target vector includes: Based on the target vector, each sentence in the text to be analyzed is labeled to obtain a label sequence; Based on the label sequence, the target segment is determined from the text to be analyzed.
6. The method according to claim 5, characterized in that, The step of labeling each statement in the text to be analyzed based on the target vector to obtain a label sequence includes: Candidate labels for the target vector are determined using preset annotation rules; Using the feature function and the target vector, the annotation probability of the candidate label is calculated, where the annotation probability is the probability that the candidate label is the target label; Based on the labeled probabilities, the target label corresponding to each target vector is determined, and the label sequence is obtained.
7. The method according to claim 6, characterized in that, The target tags include a first tag and a second tag, whereby the first tag indicates the beginning of the target segment and the second tag indicates the continuation of the target segment. Determining the target segment from the text to be analyzed based on the tag sequence includes: Obtain the first candidate statement with the first tag from the text to be analyzed; Obtain a second candidate statement with a second tag from the text to be analyzed; The first candidate statement and the second candidate statement consecutively are identified as the target segment.
8. The method according to claim 1, characterized in that, The step of converting the text to be analyzed into a sentence vector sequence based on the specified text includes: The specified text is concatenated with each statement to obtain the target statement corresponding to each statement; Each target statement is vectorized to obtain a sequence of sentence vectors.
9. The method according to claim 8, characterized in that, The step of concatenating the specified text with each statement to obtain the target statement corresponding to each statement includes: The specified text is concatenated with each statement to obtain the initial statement corresponding to each statement; Insert a start identifier at the beginning of each initial statement to obtain the target statement corresponding to each statement.
10. The method according to claim 9, characterized in that, The process of vectorizing each target statement to obtain a sentence vector sequence includes: Each target statement is vectorized to obtain the word vector corresponding to each character in each target statement; The word vector corresponding to the start identifier is determined as the sentence vector of the statement, thus obtaining the sentence vector sequence.
11. A content mining device, characterized in that, The device includes: The acquisition module is used to acquire a specified text and the text to be analyzed corresponding to the specified text, wherein the text to be analyzed includes multiple statements; The conversion module is used to convert the text to be analyzed into a sentence vector sequence based on the specified text, wherein the sentence vector sequence includes the sentence vector corresponding to each statement; The fusion module is used to perform data fusion processing on the sentence vectors to obtain a target vector corresponding to each sentence. The target segment determination module is used to determine the target segment from the text to be analyzed based on the target vector; The target object determination module is used to determine the target object corresponding to the target fragment from the specified text based on the target fragment and the specified text; The target object determination module includes a splicing unit, an insertion unit, a vectorization unit, and an object determination unit. A splicing unit is used to splice the target fragment and the specified text to obtain the initial text; An insertion unit is used to insert a start identifier at the beginning of the initial text and to insert a separator between the target fragment and the specified text to obtain the target text; A vectorization unit is used to perform vectorization processing on the target text to obtain a word vector sequence, wherein the word vector sequence includes the word vector corresponding to each word in the specified text. An object determination unit is used to determine the target object corresponding to the target segment from the specified text based on the word vector sequence.
12. An electronic device, characterized in that, The method includes a processor and a memory, the memory storing multiple instructions; the processor loads instructions from the memory to perform the steps of the content mining method as described in any one of claims 1 to 10.
13. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a plurality of instructions adapted for loading by a processor to perform the steps of the content mining method according to any one of claims 1 to 10.
14. A computer program product, characterized in that, It includes a computer program / instruction that, when executed by a processor, implements the steps of the content mining method according to any one of claims 1 to 10.
Citation Information
Patent Citations
Abstraction statement extraction method and device, server and computer readable storage medium
CN112732899A
