Text topic segmentation method and device, equipment and storage medium
Through the deep learning model, the sentence vectors of text topics are processed, features are generated and sample settings are generated, which solves the problems of cumbersome and inefficient segmentation of existing text topics, and realizes the effect of automated segmentation and improving efficiency.
Patent Information
- Application Number
- CN202411148632.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-20
- Publication Date
- 2025-02-11
AI Technical Summary
The existing text theme segmentation process is complicated, resulting in inefficient segmentation and susceptible to human factors.
The word embedding model and encoder of the deep learning model are used to train the deep learning model by obtaining the sentence vector of the preset text topic, converting it into feature vectors, generating topic features, and setting positive and negative samples through similarity scores. Automatically split the subject content of the text topic.
The manual segmentation time is reduced, the segmentation efficiency is improved, and the reliability of segmentation results is improved, avoiding the influence of human factors.
Smart Images

Figure CN119415681A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the fields of artificial intelligence and financial technology, and in particular to a text topic segmentation method, device, equipment and storage medium. Background Art
[0002] The benefit of text topic segmentation is that it can divide complex or large topic content into multiple clear, independent and interrelated parts. Users can read only the parts they are interested in, which greatly improves the user's reading experience.
[0003] However, the existing segmentation process of the subject content of the current text theme is cumbersome and not conducive to improving the segmentation efficiency. The reason is that the existing technology mainly uses manual segmentation to segment the subject content of the current text theme, and the manual segmentation method increases the segmentation time of the subject content of the current text theme and is easily affected by human factors. Therefore, it is not conducive to improving the segmentation efficiency of the subject content. Summary of the invention
[0004] The present invention provides a text topic segmentation method, device, computer equipment and storage medium to solve the technical problem that the existing current text topic content segmentation process is cumbersome and is not conducive to improving the segmentation efficiency.
[0005] In a first aspect, a text topic segmentation method is provided, comprising:
[0006] Acquire a preset text theme of preset text data and a preset text segmentation point corresponding to the preset text theme;
[0007] Obtaining a first vector corresponding to the sentence of the preset text topic through a word embedding model of a deep learning model;
[0008] Converting the first vector into a first feature vector corresponding to the sentence and a second feature vector corresponding to the sentence respectively through an encoder of the deep learning model;
[0009] Generate a preset topic feature corresponding to the preset text topic according to the first feature vector corresponding to the sentence, the second feature vector corresponding to the sentence, and a predefined generation method;
[0010] Obtaining a similarity score between the preset topic feature and the feature of the preset text segmentation point, and setting a positive sample pair and a negative sample pair according to the similarity score and a predefined setting method;
[0011] The deep learning model is trained according to the positive samples and the negative samples, a current text segmentation point output by the trained deep learning model is obtained, and the subject content of the current text subject is segmented out through the current text segmentation point.
[0012] Furthermore, obtaining the first vector corresponding to the sentence of the preset text topic through the word embedding model of the deep learning model includes:
[0013] Obtaining multiple sentences corresponding to the preset text theme;
[0014] The word embedding model of the deep learning model is used to extract features of the semantic units of the sentence to generate a first vector corresponding to the sentence.
[0015] Further, the converting the first vector into a first feature vector corresponding to the sentence and a second feature vector corresponding to the sentence respectively through the encoder of the deep learning model includes:
[0016] Inputting the first vector into an encoder of the deep learning model to obtain a Dropout layer built into the encoder;
[0017] By using the encoder of the Dropout layer, the first vector is converted into a first feature vector corresponding to the sentence and a second feature vector corresponding to the sentence.
[0018] Furthermore, generating a preset topic feature corresponding to the preset text topic according to the first feature vector corresponding to the sentence and the second feature vector corresponding to the sentence and a predefined generation method includes:
[0019] Combining the first feature vector corresponding to the sentence and the second feature vector corresponding to the sentence to obtain a third feature vector corresponding to the sentence;
[0020] The third feature vectors corresponding to the multiple sentences are input into the average pooling layer of the deep learning model, and the average pooling layer is used to average pool the third feature vectors corresponding to the multiple sentences to generate preset topic features corresponding to the preset text topic.
[0021] Furthermore, the obtaining of the similarity score between the preset topic feature and the feature of the preset text segmentation point, and setting the positive sample pair and the negative sample pair according to the similarity score and a predefined setting method, includes:
[0022] Calculating a similarity score between the preset topic feature and the feature of the preset text segmentation point;
[0023] The preset topic feature and the feature of the preset text segmentation point whose similarity score is greater than the preset score are set as a positive sample pair, and the preset topic feature and the feature of the preset text segmentation point whose similarity score is not greater than the preset score are set as a negative sample pair.
[0024] Furthermore, the deep learning model is trained according to the positive sample and the negative sample, a current text segmentation point output by the trained deep learning model is obtained, and the subject content of the current text subject is segmented out according to the current text segmentation point, including:
[0025] Using a contrast loss function, training the deep learning model with minimizing the distance between the positive sample pairs and maximizing the distance between the negative sample pairs as training objectives, and obtaining a reduction in the loss value of the contrast loss function during the training of the deep learning model;
[0026] When the reduction is less than a preset threshold, stop training the deep learning model, save the trained deep learning model, obtain the current text topic of the current text data, obtain the current topic features of the current text topic, input the current topic features into the trained deep learning model, obtain the current text segmentation point output by the trained deep learning model based on the current topic features, and segment the topic content of the current text topic in the current text data through the current text segmentation point.
[0027] Furthermore, after training the deep learning model according to the positive samples and the negative samples, obtaining the current text segmentation points output by the trained deep learning model, and segmenting the subject content of the current text subject through the current text segmentation points, the text subject segmentation method includes:
[0028] Connect to a preset server and upload the current text topic and the segmented topic content to the server.
[0029] In a second aspect, a text topic segmentation device is provided, comprising:
[0030] A first acquisition module, used to acquire a preset text theme of preset text data and a preset text segmentation point corresponding to the preset text theme;
[0031] A second acquisition module is used to acquire a first vector corresponding to the sentence of the preset text topic through a word embedding model of a deep learning model;
[0032] A conversion module, used to convert the first vector into a first feature vector corresponding to the sentence and a second feature vector corresponding to the sentence respectively through an encoder of the deep learning model;
[0033] A generating module, used for generating a preset topic feature corresponding to the preset text topic according to the first feature vector corresponding to the sentence, the second feature vector corresponding to the sentence and a predefined generating method;
[0034] A setting module, used to obtain a similarity score between the preset topic feature and the feature of the preset text segmentation point, and set a positive sample pair and a negative sample pair according to the similarity score and a predefined setting method;
[0035] The segmentation module is used to train the deep learning model according to the positive samples and the negative samples, obtain the current text segmentation points output by the trained deep learning model, and segment the subject content of the current text subject through the current text segmentation points.
[0036] In a third aspect, a computer device is provided, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of the above-mentioned text topic segmentation method when executing the computer program.
[0037] In a fourth aspect, a computer-readable storage medium is provided, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the above-mentioned text topic segmentation method are implemented.
[0038] The present application provides a text topic segmentation method, apparatus, computer equipment and storage medium, which obtain a preset text topic of preset text data and a preset text segmentation point corresponding to the preset text topic; obtain a first vector corresponding to a sentence of the preset text topic through a word embedding model of a deep learning model; convert the first vector into a first feature vector corresponding to the sentence and a second feature vector corresponding to the sentence through an encoder of the deep learning model; generate a preset topic feature corresponding to the preset text topic according to the first feature vector corresponding to the sentence and the second feature vector corresponding to the sentence and a predefined generation method; obtain the preset topic feature and the feature of the preset text segmentation point A similarity score is determined between the two samples, and a positive sample pair and a negative sample pair are set according to the similarity score and a predefined setting method; the deep learning model is trained according to the positive samples and the negative samples, and the current text segmentation point output by the trained deep learning model is obtained. The subject content of the current text subject is segmented out through the current text segmentation point. The beneficial effects are in two aspects. On the one hand, since no manual segmentation is required, the segmentation time of the subject content of the current text subject is reduced, which is conducive to improving the segmentation efficiency of the subject content of the current text subject; on the other hand, since the deep learning model will not be affected by human factors, it is conducive to improving the reliability of the segmented subject content of the current text subject. BRIEF DESCRIPTION OF THE DRAWINGS
[0039] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the accompanying drawings required for use in the description of the embodiments of the present invention will be briefly introduced below. Obviously, the accompanying drawings in the following description are only some embodiments of the present invention. For ordinary technicians in this field, other accompanying drawings can be obtained based on these accompanying drawings without paying creative labor.
[0040] Figure 1 is a schematic diagram of an application environment of a text topic segmentation method in one embodiment of the present invention;
[0041] Figure 2 A flowchart of a text topic segmentation method provided by an embodiment of the present invention;
[0042] Figure 3 yes Figure 2 A schematic flow chart of a specific implementation of step S23;
[0043] Figure 4 yes Figure 2 A schematic flow chart of a specific implementation of step S25;
[0044] Figure 5 yes Figure 2 A schematic flow chart of a specific implementation of step S26;
[0045] Figure 6 is a structural schematic diagram of a text topic segmentation device in one embodiment of the present invention;
[0046] Figure 7 is a schematic diagram of a structure of a computer device in one embodiment of the present invention;
[0047] Figure 8 It is another structural schematic diagram of a computer device in one embodiment of the present invention. DETAILED DESCRIPTION
[0048] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0049] See also Figure 1 , Figure 1 is a schematic diagram of an application environment of a text topic segmentation method according to an embodiment of the present invention. The text topic segmentation method provided by the embodiment of the present invention can be applied in the following embodiments: Figure 1 In an application environment, a client communicates with a server through a network.
[0050] The server obtains a preset text theme of the preset text data and a preset text segmentation point corresponding to the preset text theme through the client;
[0051] Obtaining a first vector corresponding to the sentence of the preset text topic through a word embedding model of a deep learning model;
[0052] Converting the first vector into a first feature vector corresponding to the sentence and a second feature vector corresponding to the sentence respectively through an encoder of the deep learning model;
[0053] Generate a preset topic feature corresponding to the preset text topic according to the first feature vector corresponding to the sentence, the second feature vector corresponding to the sentence, and a predefined generation method;
[0054] Obtaining a similarity score between the preset topic feature and the feature of the preset text segmentation point, and setting a positive sample pair and a negative sample pair according to the similarity score and a predefined setting method;
[0055] The deep learning model is trained according to the positive samples and the negative samples, a current text segmentation point output by the trained deep learning model is obtained, and the subject content of the current text subject is segmented out through the current text segmentation point.
[0056] In the scheme implemented by the above-mentioned text topic segmentation method, device, equipment and medium, the beneficial effects of the scheme lie in two aspects. On the one hand, since there is no need for manual segmentation, the segmentation time of the topic content of the current text topic is reduced, which is conducive to improving the segmentation efficiency of the topic content of the current text topic; on the other hand, since the deep learning model will not be affected by human factors, it is conducive to improving the reliability of the segmented topic content of the current text topic.
[0057] The client may include but is not limited to various personal computers, laptops, smart phones, tablet computers, and portable wearable devices.
[0058] The server can be implemented with an independent task database or a task database cluster composed of multiple task databases. The present invention is described in detail below through specific embodiments.
[0059] See also Figure 2 , Figure 2 A flowchart of a text topic segmentation method provided by an embodiment of the present invention includes the following steps:
[0060] S21, obtaining a preset text theme of preset text data and a preset text segmentation point corresponding to the preset text theme;
[0061] The preset text data of the target system is obtained, and the preset text theme of the preset text data and the preset text segmentation points corresponding to the preset text theme are obtained.
[0062] The target system includes one or a combination of an insurance system, a banking system, and a financial system.
[0063] S22, obtaining a first vector corresponding to the sentence of the preset text topic through a word embedding model of a deep learning model;
[0064] The step of obtaining a first vector corresponding to a sentence of the preset text topic through a word embedding model of a deep learning model includes:
[0065] Obtaining multiple sentences corresponding to the preset text theme;
[0066] The word embedding model of the deep learning model is used to extract features of the semantic units of the sentence to generate a first vector corresponding to the sentence.
[0067] Among them, the deep learning model is a pre-trained model, which is helpful to reduce the time required for deep learning model training and improve the training efficiency of the deep learning model.
[0068] S23, converting the first vector into a first feature vector corresponding to the sentence and a second feature vector corresponding to the sentence respectively through the encoder of the deep learning model;
[0069] S24, generating a preset topic feature corresponding to the preset text topic according to the first feature vector corresponding to the sentence and the second feature vector corresponding to the sentence and a predefined generation method;
[0070] The step of generating the preset topic feature corresponding to the preset text topic according to the first feature vector corresponding to the sentence and the second feature vector corresponding to the sentence and a predefined generation method includes:
[0071] Combining the first feature vector corresponding to the sentence and the second feature vector corresponding to the sentence to obtain a third feature vector corresponding to the sentence;
[0072] The third feature vectors corresponding to the multiple sentences are input into the average pooling layer of the deep learning model, and the average pooling layer is used to average pool the third feature vectors corresponding to the multiple sentences to generate preset topic features corresponding to the preset text topic.
[0073] For the sake of illustration, an example is given below:
[0074] For example, the preset text topics are sentence 1, sentence 2, and sentence 3. The third eigenvector corresponding to sentence 1 is eigenvector A, the third eigenvector corresponding to sentence 2 is eigenvector B, and the third eigenvector corresponding to sentence 3 is eigenvector C.
[0075] The feature vector A, the feature vector B, and the feature vector C are input into the average pooling layer of the deep learning model, and the feature vector A, the feature vector B, and the feature vector C are average pooled using the average pooling layer to generate preset topic features corresponding to the preset text topic.
[0076] S25, obtaining a similarity score between the preset topic feature and the feature of the preset text segmentation point, and setting a positive sample pair and a negative sample pair according to the similarity score and a predefined setting method;
[0077] Exemplarily, obtaining a similarity score between the preset topic feature and the feature of the preset text segmentation point includes:
[0078] Calculate the first similarity between the preset topic feature and the preset text segmentation point by using cosine similarity, and calculate the second similarity between the preset topic feature and the preset text segmentation point by using Pearson correlation coefficient;
[0079] The first similarity and the second similarity are added to generate a similarity score between the preset topic feature and the preset text segmentation point.
[0080] S26, training the deep learning model according to the positive samples and the negative samples, obtaining the current text segmentation points output by the trained deep learning model, and segmenting the subject content of the current text subject through the current text segmentation points.
[0081] Exemplarily, training the deep learning model according to the positive sample and the negative sample, obtaining the current text segmentation point output by the trained deep learning model, and segmenting the subject content of the current text subject according to the current text segmentation point, including:
[0082] The deep learning model is trained according to the positive samples and the negative samples, the trained deep learning model is saved, the current text topic of the current text data is obtained, the current topic features of the current text topic are obtained, the current topic features are input into the trained deep learning model, the current text segmentation points output by the trained deep learning model based on the current topic features are obtained, and the topic content of the current text topic is segmented out in the current text data through the current text segmentation points.
[0083] Exemplarily, obtaining the current text subject of the current text data includes:
[0084] The current text data of the target system is obtained, and the current text subject of the current text data is obtained. The target system includes one of an insurance system, a banking system, and a financial system, or a combination thereof.
[0085] The subject content of the current text theme is segmented out from the current text data, and the current text theme can be any theme.
[0086] For the sake of illustration, an example is given below:
[0087] For example, when the current text topic is compulsory traffic insurance, the subject content of the compulsory traffic insurance is segmented from the current text data as follows: the full name of compulsory traffic insurance is compulsory motor vehicle traffic accident liability insurance, which is insurance that car owners must purchase. It mainly protects against the death, injury, medical expenses and property losses of the other party caused by the accident, but does not compensate for the repair costs of the own vehicle, injuries to the people in the car, etc.
[0088] For example, when the current text topic is commercial auto insurance, the subject content of the commercial auto insurance segmented from the current text data is: the car owner can freely choose whether to purchase insurance, and the specific insurance amount can also be determined by himself. Common commercial auto insurance includes:
[0089] For example, when the current text subject is third party liability insurance, the subject content of the third party liability insurance segmented from the current text data is: compensation for personal injury or property loss suffered by a third party due to an accident involving the insured vehicle.
[0090] Wherein, after the deep learning model is trained according to the positive sample and the negative sample, the current text segmentation point output by the trained deep learning model is obtained, and the topic content of the current text topic is segmented out by the current text segmentation point, the text topic segmentation method includes:
[0091] Connect to a preset server and upload the current text topic and the segmented topic content to the server.
[0092] In the embodiment of the present invention, the beneficial effects of the scheme lie in two aspects. On the one hand, since there is no need for manual segmentation, the segmentation time of the subject content of the current text topic is reduced, which is conducive to improving the segmentation efficiency of the subject content of the current text topic; on the other hand, since the deep learning model will not be affected by human factors, it is conducive to improving the reliability of the segmented subject content of the current text topic.
[0093] See also Figure 3 , Figure 3 yes Figure 2 A specific implementation flow diagram of step S23 is described in detail as follows:
[0094] S31, inputting the first vector into the encoder of the deep learning model to obtain a Dropout layer built into the encoder;
[0095] S32, by using the encoder of the Dropout layer, converting the first vector into a first feature vector corresponding to the sentence and a second feature vector corresponding to the sentence.
[0096] Exemplarily, by using the encoder of the Dropout layer, converting the first vector into a first feature vector corresponding to the sentence and a second feature vector corresponding to the sentence, respectively, comprises:
[0097] Inputting the first vector into an encoder of the deep learning model, enabling a Dropout layer of the encoder, and setting a ratio of neurons in the Dropout layer that do not participate in forward propagation and backward propagation to a first ratio;
[0098] By using the encoder of the first ratio, converting the first vector to generate a first feature vector corresponding to the sentence;
[0099] The proportion of neurons in the Dropout layer that do not participate in forward propagation and backward propagation is set to a second proportion, and the first vector is converted by using the encoder of the second proportion to generate a second feature vector corresponding to the sentence.
[0100] The first ratio and the second ratio are set by the user or by the system by default, and are not limited here.
[0101] Here, the first ratio and the second ratio are different ratios.
[0102] The first ratio and the second ratio are set between 0.2 and 0.5.
[0103] For example, the first ratio is 0.2 and the second ratio is 0.3.
[0104] For example, the first ratio is 0.3 and the second ratio is 0.4.
[0105] Among them, the Chinese name of the Dropout layer is discard layer or random inactivation.
[0106] Among them, Dropout is a regularization technique used in neural networks to reduce overfitting.
[0107] Among them, the first feature vector corresponding to the sentence is the first representation of the sentence, and the second feature vector corresponding to the sentence is the second representation of the sentence. Therefore, the first feature vector corresponding to the sentence and the second feature vector corresponding to the sentence are different representations of a sentence, and the deep learning model can learn different representations of a sentence.
[0108] In the embodiment of the present invention, the Dropout layer increases the randomness of the deep learning model, and the deep learning model can learn different representations of a sentence, which is conducive to improving the generalization ability of the deep learning model.
[0109] See also Figure 4 , Figure 4 yes Figure 2 A specific implementation flow diagram of step S25 is described in detail as follows:
[0110] S41, calculating a similarity score between the preset topic feature and the feature of the preset text segmentation point;
[0111] Exemplarily, obtaining a similarity score between the preset topic feature and the feature of the preset text segmentation point includes:
[0112] Calculate the first similarity between the preset topic feature and the preset text segmentation point by using cosine similarity, and calculate the second similarity between the preset topic feature and the preset text segmentation point by using Pearson correlation coefficient;
[0113] The first similarity and the second similarity are added to generate a similarity score between the preset topic feature and the preset text segmentation point.
[0114] S42, setting the preset topic feature and the feature of the preset text segmentation point whose similarity score is greater than the preset score as a positive sample pair, and setting the preset topic feature and the feature of the preset text segmentation point whose similarity score is not greater than the preset score as a negative sample pair.
[0115] In an embodiment of the present invention, the preset topic features and the features of the preset text segmentation points whose similarity scores are greater than the preset scores are set as positive sample pairs, and the preset topic features and the features of the preset text segmentation points whose similarity scores are not greater than the preset scores are set as negative sample pairs, so that positive sample pairs and negative sample pairs can be quickly distinguished.
[0116] See also Figure 5 , Figure 5 yes Figure 2 A specific implementation flow diagram of step S26 is described in detail as follows:
[0117] S51, using a contrast loss function to minimize the distance between the positive sample pairs and maximize the distance between the negative sample pairs as training objectives, training the deep learning model, and obtaining a reduction in the loss value of the contrast loss function during the training of the deep learning model;
[0118] S52, when the reduction is less than a preset threshold, stop training the deep learning model, save the trained deep learning model, obtain the current text topic of the current text data, obtain the current topic feature of the current text topic, input the current topic feature into the trained deep learning model, obtain the current text segmentation point output by the trained deep learning model based on the current topic feature, and segment the topic content of the current text topic in the current text data through the current text segmentation point.
[0119] In an embodiment of the present invention, the current text segmentation point output by the trained deep learning model based on the current topic feature is obtained, and the topic content of the current text topic is segmented out in the current text data through the current text segmentation point. Since manual segmentation is not required, the segmentation time of the topic content of the current text topic is reduced, which is beneficial to improving the segmentation efficiency of the topic content of the current text topic.
[0120] See also Figure 6 , Figure 6 is a structural diagram of a text topic segmentation device in one embodiment of the present invention. Figure 6 As shown, the text topic segmentation device based on text topic segmentation includes a first acquisition module 101, a second acquisition module 102, a conversion module 103, a generation module 104, a setting module 105, and a segmentation module 106. The detailed description of each functional module is as follows:
[0121] A first acquisition module 101 is used to acquire a preset text theme of preset text data and a preset text segmentation point corresponding to the preset text theme;
[0122] A second acquisition module 102 is used to acquire a first vector corresponding to the sentence of the preset text topic through a word embedding model of a deep learning model;
[0123] A conversion module 103, configured to convert the first vector into a first feature vector corresponding to the sentence and a second feature vector corresponding to the sentence respectively through an encoder of the deep learning model;
[0124] A generating module 104, configured to generate a preset topic feature corresponding to the preset text topic according to the first feature vector corresponding to the sentence and the second feature vector corresponding to the sentence and a predefined generating method;
[0125] A setting module 105, used to obtain a similarity score between the preset topic feature and the feature of the preset text segmentation point, and set a positive sample pair and a negative sample pair according to the similarity score and a predefined setting method;
[0126] The segmentation module 106 is used to train the deep learning model according to the positive samples and the negative samples, obtain the current text segmentation points output by the trained deep learning model, and segment the subject content of the current text subject through the current text segmentation points.
[0127] In one embodiment, the first acquisition module 102 includes:
[0128] An acquisition subunit, used to acquire a plurality of sentences corresponding to the preset text theme;
[0129] The extraction subunit is used to extract features of the semantic units of the sentence through a word embedding model of a deep learning model to generate a first vector corresponding to the sentence.
[0130] In one embodiment, the conversion module 103 includes:
[0131] Using a subunit, configured to input the first vector into an encoder of the deep learning model, and obtain a Dropout layer built into the encoder;
[0132] A conversion subunit is used to convert the first vector into a first feature vector corresponding to the sentence and a second feature vector corresponding to the sentence by using the encoder of the Dropout layer.
[0133] In one embodiment, the generating module 104 includes:
[0134] A combining subunit, used for combining the first feature vector corresponding to the sentence and the second feature vector corresponding to the sentence to obtain a third feature vector corresponding to the sentence;
[0135] A generating subunit is used to input the third feature vectors corresponding to the multiple sentences into the average pooling layer of the deep learning model, and use the average pooling layer to average pool the third feature vectors corresponding to the multiple sentences to generate a preset topic feature corresponding to the preset text topic.
[0136] In one embodiment, the setting module 105 includes:
[0137] A calculation subunit, used to calculate a similarity score between the preset topic feature and the feature of the preset text segmentation point;
[0138] A subunit is set, which is used to set the preset topic feature and the feature of the preset text segmentation point whose similarity score is greater than the preset score as a positive sample pair, and set the preset topic feature and the feature of the preset text segmentation point whose similarity score is not greater than the preset score as a negative sample pair.
[0139] In one embodiment, the segmentation module 106 includes:
[0140] A training subunit is used to train the deep learning model using a contrast loss function with the training objectives of minimizing the distance between the positive sample pairs and maximizing the distance between the negative sample pairs, and during the training process of the deep learning model, obtain a reduction in the loss value of the contrast loss function;
[0141] A segmentation subunit is used to stop training the deep learning model when the reduction is less than a preset threshold, save the trained deep learning model, obtain the current text topic of the current text data, obtain the current topic feature of the current text topic, input the current topic feature into the trained deep learning model, obtain the current text segmentation point output by the trained deep learning model based on the current topic feature, and segment the topic content of the current text topic in the current text data through the current text segmentation point.
[0142] In one embodiment, the text topic segmentation device further includes:
[0143] The upload module is used to connect to a preset server and upload the current text theme and the segmented theme content to the server.
[0144] In the embodiment of the present invention, the beneficial effects of the scheme lie in two aspects. On the one hand, since there is no need for manual segmentation, the segmentation time of the subject content of the current text topic is reduced, which is conducive to improving the segmentation efficiency of the subject content of the current text topic; on the other hand, since the deep learning model will not be affected by human factors, it is conducive to improving the reliability of the segmented subject content of the current text topic.
[0145] The specific limitations on the text topic segmentation device can be found in the above limitations on the text topic segmentation method, which will not be repeated here.
[0146] Each module in the above-mentioned text topic segmentation device can be implemented in whole or in part by software, hardware or a combination thereof. Each module can be embedded in or independent of a processor in a computer device in the form of hardware, or can be stored in a memory in a computer device in the form of software, so that the processor can call and execute the operations corresponding to each module above.
[0147] See also Figure 7 , Figure 7 is a schematic diagram of a computer device in one embodiment of the present invention. In one embodiment, a computer device is provided. The computer device may be a server. The internal structure diagram thereof may be as shown in FIG. Figure 7 The computer device includes a processor, a memory, a network interface and a database connected through a system bus.
[0148] The processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes non-volatile and / or volatile storage media and internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The network interface of the computer device is used to communicate with an external client through a network connection. When the computer program is executed by the processor, the functions or steps of a text topic segmentation method server side are implemented.
[0149] See also Figure 8 , Figure 8 is another structural diagram of a computer device in one embodiment of the present invention. In one embodiment, a computer device is provided. The computer device may be a client, and its internal structure diagram may be as shown in FIG. Figure 8 As shown. The computer device includes a processor, a memory, a network interface, a display screen and an input device connected through a system bus. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The network interface of the computer device is used to communicate with an external task database through a network connection. When the computer program is executed by the processor, the functions or steps of a text topic segmentation method are implemented.
[0150] In one embodiment, a computer device is provided, comprising a memory, a processor, and a computer program stored on the memory and executable on the processor.
[0151] It should be noted that the above functions or steps that can be implemented by the computer-readable storage medium or computer device can refer to the relevant descriptions on the server side and the client side in the aforementioned method embodiment. To avoid repetition, they will not be described one by one here.
[0152] The above-mentioned processor can be a general-purpose processor, including a central processing unit (CPU), a graphics processing unit (GPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components.
[0153] The above description and the accompanying drawings fully illustrate the embodiments of the present disclosure so that those skilled in the art can practice them. Other embodiments may include structural, logical, electrical, process and other changes. The embodiments represent possible changes only. Unless explicitly required, separate components and functions are optional, and the order of operation may vary. Parts and subsamples of some embodiments may be included in or replace parts and subsamples of other embodiments. Moreover, the words used in this application are only used to describe the embodiments and are not used to limit the claims. As used in the description of the embodiments and the claims, unless the subject matter clearly indicates, the singular forms of "a", "an" and "the" are intended to include plural forms as well. Similarly, the term "and / or" as used in this application refers to any and all possible combinations of one or more associated listings. In addition, when used in the present application, the term "comprise" and its variants "comprises" and / or comprising refer to the presence of a stated sub-sample, whole, step, operation, element, and / or component, but do not exclude the presence or addition of one or more other sub-samples, wholes, steps, operations, elements, components and / or groups of these. In the absence of further restrictions, the elements defined by the sentence "comprising a ..." do not exclude the presence of other identical elements in the process, method or device comprising the elements. In this article, each embodiment may focus on the differences from other embodiments, and the same and similar parts between the various embodiments may refer to each other. For the methods, products, etc. disclosed in the embodiments, if they correspond to the method part disclosed in the embodiments, then the relevant parts can refer to the description of the method part.
[0154] Those skilled in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software may depend on the specific application and design constraints of the technical solution. Technicians can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of the embodiments of the present disclosure. Technicians can clearly understand that for the convenience and simplicity of description, the specific working process of the above-described system, device and unit can refer to the corresponding process in the aforementioned method embodiment, and will not be repeated here.
[0155] In the embodiments disclosed herein, the disclosed methods and products (including but not limited to devices, equipment, etc.) can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of units can be only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some sub-samples can be ignored or not executed. In addition, the coupling or direct coupling or communication connection between each other shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms. The units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the units may be selected according to actual needs to implement this embodiment. In addition, each functional unit in the embodiment of the present disclosure may be integrated in a processing unit, or each unit may exist physically alone, or two or more units may be integrated in one unit.
[0156] The flowchart and block diagram in the accompanying drawings show the possible architecture, function and operation of the system, method and computer program product according to the embodiment of the present disclosure. In this regard, each box in the flowchart or block diagram can represent a module, a program segment or a part of the code, and the module, the program segment or a part of the code contains one or more executable instructions for realizing the specified logical function. In some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two consecutive boxes can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, which can depend on the functions involved. In the description corresponding to the flowchart and the block diagram in the accompanying drawings, the operations or steps corresponding to different boxes can also occur in a different order from the order disclosed in the description, and sometimes there is no specific order between different operations or steps. For example, two consecutive operations or steps can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, which can depend on the functions involved. Each block in the block diagrams and / or flowcharts, and combinations of blocks in the block diagrams and / or flowcharts, may be implemented by a dedicated hardware-based system that performs the specified functions or actions, or may be implemented by a combination of dedicated hardware and computer instructions.
Claims
1. A text topic segmentation method, characterized in that: include: Acquire a preset text theme of preset text data and a preset text segmentation point corresponding to the preset text theme; Obtaining a first vector corresponding to the sentence of the preset text topic through a word embedding model of a deep learning model; Converting the first vector into a first feature vector corresponding to the sentence and a second feature vector corresponding to the sentence respectively through an encoder of the deep learning model; Generate a preset topic feature corresponding to the preset text topic according to the first feature vector corresponding to the sentence, the second feature vector corresponding to the sentence, and a predefined generation method; Obtaining a similarity score between the preset topic feature and the feature of the preset text segmentation point, and setting a positive sample pair and a negative sample pair according to the similarity score and a predefined setting method; The deep learning model is trained according to the positive samples and the negative samples, a current text segmentation point output by the trained deep learning model is obtained, and the subject content of the current text subject is segmented out through the current text segmentation point.
2. The text topic segmentation method according to claim 1, characterized in that: The step of obtaining a first vector corresponding to a sentence of the preset text topic through a word embedding model of a deep learning model includes: Obtaining multiple sentences corresponding to the preset text theme; The word embedding model of the deep learning model is used to extract features of the semantic units of the sentence to generate a first vector corresponding to the sentence.
3. The text topic segmentation method according to claim 1, characterized in that: The step of converting the first vector into a first feature vector corresponding to the sentence and a second feature vector corresponding to the sentence respectively through the encoder of the deep learning model includes: Inputting the first vector into an encoder of the deep learning model to obtain a Dropout layer built into the encoder; By using the encoder of the Dropout layer, the first vector is converted into a first feature vector corresponding to the sentence and a second feature vector corresponding to the sentence.
4. The text topic segmentation method according to claim 1, characterized in that: The generating a preset topic feature corresponding to the preset text topic according to the first feature vector corresponding to the sentence and the second feature vector corresponding to the sentence and a predefined generating method includes: Combining the first feature vector corresponding to the sentence and the second feature vector corresponding to the sentence to obtain a third feature vector corresponding to the sentence; The third feature vectors corresponding to the multiple sentences are input into the average pooling layer of the deep learning model, and the average pooling layer is used to average pool the third feature vectors corresponding to the multiple sentences to generate preset topic features corresponding to the preset text topic.
5. The text topic segmentation method according to claim 1, characterized in that: The obtaining of the similarity score between the preset topic feature and the feature of the preset text segmentation point, and setting the positive sample pair and the negative sample pair according to the similarity score and a predefined setting method, includes: Calculating a similarity score between the preset topic feature and the feature of the preset text segmentation point; The preset topic feature and the feature of the preset text segmentation point whose similarity score is greater than the preset score are set as a positive sample pair, and the preset topic feature and the feature of the preset text segmentation point whose similarity score is not greater than the preset score are set as a negative sample pair.
6. The text topic segmentation method according to claim 1, characterized in that: The step of training the deep learning model according to the positive sample and the negative sample, obtaining the current text segmentation point output by the trained deep learning model, and segmenting the subject content of the current text subject according to the current text segmentation point includes: Using a contrast loss function, training the deep learning model with minimizing the distance between the positive sample pairs and maximizing the distance between the negative sample pairs as training objectives, and obtaining a reduction in the loss value of the contrast loss function during the training of the deep learning model; When the reduction is less than a preset threshold, stop training the deep learning model, save the trained deep learning model, obtain the current text topic of the current text data, obtain the current topic features of the current text topic, input the current topic features into the trained deep learning model, obtain the current text segmentation point output by the trained deep learning model based on the current topic features, and segment the topic content of the current text topic in the current text data through the current text segmentation point.
7. The text topic segmentation method according to any one of claims 1 to 6, characterized in that: After training the deep learning model according to the positive samples and the negative samples, obtaining the current text segmentation points output by the trained deep learning model, and segmenting the subject content of the current text subject through the current text segmentation points, the text subject segmentation method includes: Connect to a preset server and upload the current text topic and the segmented topic content to the server.
8. A text topic segmentation device, characterized in that: include: A first acquisition module, used to acquire a preset text theme of preset text data and a preset text segmentation point corresponding to the preset text theme; A second acquisition module is used to acquire a first vector corresponding to the sentence of the preset text topic through a word embedding model of a deep learning model; A conversion module, used to convert the first vector into a first feature vector corresponding to the sentence and a second feature vector corresponding to the sentence respectively through an encoder of the deep learning model; A generating module, used for generating a preset topic feature corresponding to the preset text topic according to the first feature vector corresponding to the sentence, the second feature vector corresponding to the sentence and a predefined generating method; A setting module, used to obtain a similarity score between the preset topic feature and the feature of the preset text segmentation point, and set a positive sample pair and a negative sample pair according to the similarity score and a predefined setting method; The segmentation module is used to train the deep learning model according to the positive samples and the negative samples, obtain the current text segmentation points output by the trained deep learning model, and segment the subject content of the current text subject through the current text segmentation points.
9. A computer device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the steps of the text topic segmentation method according to any one of claims 1 to 7 are implemented.
10. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the steps of the text topic segmentation method as described in any one of claims 1 to 7 are implemented.