Data processing methods, apparatus and electronic equipment

By converting sentences in the text into sentence vectors and calculating the depth score, the segmentation points are automatically determined, which solves the problem of low automatic segmentation efficiency in the existing technology, and efficient automatic paragraph segmentation is achieved, saving human resources.

CN114492325BActive Publication Date: 2025-04-04SHANGHAI ZHENGDA XIMALAYA NETWORK TECH CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202210129384.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-02-11
Publication Date
2025-04-04
Estimated Expiration
2042-02-11

AI Technical Summary

Technical Problem

In scenarios where text is automatically segmented, it is difficult for the prior art to efficiently realize automatic paragraph segmentation, resulting in a large amount of manpower manual segmentation.

Method used

By converting each sentence in the target text into a sentence vector, and calculating the depth score of each segmentation point based on the sentence vector, determining the target segmentation point, and finally achieving automatic paragraph segmentation of the text.

Benefits of technology

It realizes automatic text segmentation without manual intervention, saves a lot of human resources and improves segmentation efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114492325B_ABST
    Figure CN114492325B_ABST
Patent Text Reader

Abstract

The present application provides a data processing method, device and electronic device, which relate to the field of data processing technology. The method includes: obtaining a target text; converting each sentence in the target text into a vector to obtain a sentence vector of each sentence; calculating the depth score of each first segmentation point in the target text according to the sentence vector of each sentence, wherein the depth score is used to represent the semantic difference before and after the first segmentation point, and the depth score is calculated according to two sentence sets before and after the first segmentation point, and the two sentence sets respectively include multiple sentences; determining the target segmentation point according to the depth score of each first segmentation point; and segmenting the target text into paragraphs according to the target segmentation point. In this way, the text can be segmented automatically without consuming a lot of manpower for manual segmentation.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of data processing technology, and in particular to a data processing method, device and electronic device. Background Art

[0002] In many scenarios, text needs to be segmented. For example, when extracting clips from a podcast, it is necessary to segment the text into paragraphs first. If the paragraph segmentation is done manually, the time cost is high. Therefore, how to automatically segment the text has become a technical problem that technicians in this field need to solve urgently. Summary of the invention

[0003] The embodiments of the present application provide a data processing method, device, electronic device and readable storage medium, which can automatically segment text without consuming a lot of manpower for manual segmentation.

[0004] The embodiments of the present application can be implemented as follows:

[0005] In a first aspect, an embodiment of the present application provides a data processing method, the method comprising:

[0006] Get the target text;

[0007] Convert each sentence in the target text into a vector to obtain a sentence vector for each sentence;

[0008] According to the sentence vector of each sentence, a depth score of each first segmentation point in the target text is calculated, wherein the depth score is used to represent the semantic difference before and after the first segmentation point, and the depth score is calculated according to two sentence sets before and after the first segmentation point, and the two sentence sets respectively include multiple sentences;

[0009] Determine the target segmentation point according to the depth score of each first segmentation point;

[0010] The target text is segmented into paragraphs according to the target segmentation points.

[0011] In a second aspect, an embodiment of the present application provides a data processing device, the device comprising:

[0012] A text acquisition module is used to obtain the target text;

[0013] A vector representation module, used for converting each sentence in the target text into a vector to obtain a sentence vector of each sentence;

[0014] A calculation module, used to calculate the depth score of each first segmentation point in the target text according to the sentence vector of each sentence, wherein the depth score is used to represent the semantic difference before and after the first segmentation point, and the depth score is calculated according to two sentence sets before and after the first segmentation point, and the two sentence sets respectively include multiple sentences;

[0015] A determination module, used to determine a target segmentation point according to the depth score of each first segmentation point;

[0016] The segmentation module is used to segment the target text into paragraphs according to the target segmentation points.

[0017] In a third aspect, an embodiment of the present application provides an electronic device, including a processor and a memory, wherein the memory stores machine executable instructions that can be executed by the processor, and the processor can execute the machine executable instructions to implement the data processing method described in the aforementioned embodiment.

[0018] In a fourth aspect, an embodiment of the present application provides a readable storage medium on which a computer program is stored. When the computer program is executed by a processor, the data processing method described in the aforementioned embodiment is implemented.

[0019] The data processing method, device, electronic device and readable storage medium provided by the embodiments of the present application obtain the sentence vector of each sentence in the target text when the target text is obtained, and then the depth score of each first segmentation point in the target text is calculated based on the sentence vector of each sentence, and then the target segmentation point is determined based on the depth score of each first segmentation point, and finally the target text is segmented into paragraphs based on the determined target segmentation point. Among them, the depth score is used to represent the semantic difference before and after the first segmentation point, and the depth score is calculated based on two sentence sets before and after the first segmentation point, and the two sentence sets each include multiple sentences. In this way, similar sentences can be automatically divided into one paragraph, without the need to manually segment paragraphs, which can save a lot of manpower. BRIEF DESCRIPTION OF THE DRAWINGS

[0020] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the embodiments will be briefly introduced below. It should be understood that the following drawings only show certain embodiments of the present application and therefore should not be regarded as limiting the scope. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without paying creative work.

[0021] Figure 1 A block diagram of an electronic device provided in an embodiment of the present application;

[0022] Figure 2One of the flow charts of the data processing method provided in the embodiment of the present application;

[0023] Figure 3 for Figure 2 A schematic flow chart of the sub-steps included in step S110;

[0024] Figure 4 for Figure 3 A schematic flow chart of the sub-steps included in sub-step S111;

[0025] Figure 5 for Figure 2 A schematic flow chart of the sub-steps included in step S130;

[0026] Figure 6 for Figure 5 A schematic flow chart of the sub-steps included in sub-step S133;

[0027] Figure 7 for Figure 2 A schematic flow chart of the sub-steps included in step S140;

[0028] Figure 8 The second flowchart of the data processing method provided in the embodiment of the present application;

[0029] Fig. 9 The third flowchart of the data processing method provided in the embodiment of the present application;

[0030] Fig.10 One of the block diagrams of the data processing device provided in the embodiment of the present application;

[0031] Fig.11 The second block diagram of the data processing device provided in the embodiment of the present application.

[0032] Icon: 100 - electronic device; 110 - memory; 120 - processor; 130 - communication unit; 200 - data processing device; 210 - text acquisition module; 220 - vector representation module; 230 - calculation module; 240 - determination module; 250 - segmentation module; 260 - extraction module. DETAILED DESCRIPTION

[0033] In order to make the purpose, technical solution and advantages of the embodiments of the present application clearer, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, rather than all the embodiments. The components of the embodiments of the present application described and shown in the drawings here can be arranged and designed in various different configurations.

[0034] Therefore, the following detailed description of the embodiments of the present application provided in the accompanying drawings is not intended to limit the scope of the present application for which protection is sought, but merely represents selected embodiments of the present application. Based on the embodiments of the present application, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of the present application.

[0035] It should be noted that relational terms such as "first" and "second" are used only to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the existence of other identical elements in the process, method, article or device including the elements.

[0036] In conjunction with the accompanying drawings, some embodiments of the present application are described in detail below. In the absence of conflict, the following embodiments and features in the embodiments can be combined with each other.

[0037] Please refer to Figure 1 , Figure 1 A block diagram of an electronic device 100 provided in an embodiment of the present application. The electronic device 100 may be, but is not limited to, a smart phone, a computer, a server, etc. The electronic device 100 includes a memory 110, a processor 120, and a communication unit 130. The memory 110, the processor 120, and the communication unit 130 are electrically connected to each other directly or indirectly to achieve data transmission or interaction. For example, these components can be electrically connected to each other via one or more communication buses or signal lines.

[0038] The memory 110 is used to store programs or data. The memory 110 may be, but is not limited to, a random access memory (RAM), a read only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), etc.

[0039] The processor 120 is used to read / write data or programs stored in the memory 110 and execute corresponding functions. For example, the memory 110 stores a data processing device 200, and the data processing device 200 includes at least one software function module that can be stored in the memory 110 in the form of software or firmware. The processor 120 executes various functional applications and data processing by running software programs and modules stored in the memory 110, such as the data processing device 200 in the embodiment of the present application, that is, implementing the data processing method in the embodiment of the present application.

[0040] The communication unit 130 is used to establish a communication connection between the electronic device 100 and other communication terminals through a network, and to send and receive data through the network.

[0041] It should be understood that Figure 1 The structure shown is only a schematic diagram of the structure of the electronic device 100. The electronic device 100 may also include Figure 1 More or fewer components as shown, or with Figure 1 Different configurations are shown. Figure 1 Each component shown in the figure can be implemented by hardware, software or a combination thereof.

[0042] Please refer to Figure 2 , Figure 2 This is one of the flow diagrams of the data processing method provided in the embodiment of the present application. The method can be applied to the above-mentioned electronic device 100. The specific flow of the data processing method is described in detail below. In this embodiment, the method may include steps S110 to S150.

[0043] Step S110, obtaining the target text.

[0044] In this embodiment, the target text is the text that needs to be segmented into paragraphs, and the target text includes punctuation and characters. The target text can be a specific text selected by the user from the stored text, or a text sent by other devices, or a text determined by other methods. The specific method for determining the target text can be determined in combination with the actual situation, and is not specifically limited here.

[0045] Step S120, converting each sentence in the target text into a vector to obtain a sentence vector for each sentence.

[0046] In this embodiment, each sentence in the target text can be determined based on the sentence-end punctuation in the target text. Then, each sentence can be converted into a vector to obtain a sentence vector of each sentence. Optionally, as a possible implementation method, a sentence vector of each sentence can be generated based on each sentence using BERT.

[0047] Step S130, calculating the depth score of each first segmentation point in the target text according to the sentence vector of each sentence.

[0048] In this embodiment, each sentence-ending punctuation mark in the target text may be used as the first segmentation point, and the sentence-ending punctuation mark may include a period, a question mark, an exclamation mark, and other punctuation marks at the end of a sentence. Two sets of sentences before and after each first segmentation point may be determined based on the sentence vectors of each sentence and the position of each sentence in the target text, and then the depth score of each first segmentation point may be calculated based on the two sets of sentences before and after each first segmentation point. The two sentence sets each include a plurality of sentences. The depth score is used to represent the difference before and after the first segmentation point, and the difference includes the difference in style and / or content.

[0049] Step S140: determining a target segmentation point according to the depth score of each first segmentation point.

[0050] Step S150: segment the target text into paragraphs according to the target segmentation points.

[0051] In this embodiment, since the depth score of each first segmentation point is used to represent the difference before and after the first segmentation point, the target segmentation point for paragraph segmentation can be determined from the first segmentation points of the target text according to the depth score of each first segmentation point, and then the target text is segmented using the determined target segmentation point. In this way, similar sentences can be automatically divided into one paragraph, without the need to manually segment paragraphs, which can save a lot of manpower.

[0052] Please refer to Figure 3 , Figure 3 for Figure 2Schematic diagram of the flow of sub-steps included in step S110. In this embodiment, step S110 may include sub-steps S111 to S113.

[0053] Sub-step S111, obtaining the initial text.

[0054] Optionally, the initial text may be specified by the user or determined in other ways, for example, by Figure 4 The initial text is obtained as shown. Figure 4 , Figure 4 for Figure 3 Schematic diagram of the flow of sub-steps included in sub-step S111. In this embodiment, sub-step S111 may include sub-step S1111 and sub-step S1112.

[0055] Sub-step S1111, converting the target audio into audio text.

[0056] The target audio is the audio that is desired to be processed. The target audio may be a podcast audio or other audio, which is not specifically limited herein. The target audio may be recognized to obtain the audio text. For example, the text of the target audio may be recognized by ASR (Automatic Speech Recognition), and the recognition result may be used as the audio text.

[0057] Sub-step S1111, using a punctuation prediction model to correct incorrect punctuation in the audio text, and using a preset language model to correct incorrect text in the audio text to obtain the initial text.

[0058] Since the punctuation recognized during audio conversion may be determined based on the length of silence, there is no semantic punctuation prediction, and the end-of-sentence punctuation affects the accuracy of segmentation, a punctuation prediction model can be used for re-prediction to correct the incorrect punctuation in the audio text. The punctuation prediction model can be trained by other devices, or it can be obtained by the electronic device 100 training the bilstm-crf sequence labeling model based on the constructed punctuation training data.

[0059] In addition, since some fields involve professional vocabulary, the language model used in audio conversion (for example, the language model of ASR) may not be covered. Therefore, the preset language model can be used again to correct the erroneous text in the audio text. In this way, the audio text can be corrected (i.e., post-processed) by the punctuation prediction model and the large language model to obtain an initial text with high accuracy. Among them, the preset language model can be a large language model, which requires a large amount of training corpus and a large number of model parameters. The large language model can be a GPT (Generative Pre-Training) language model.

[0060] Sub-step S112, filtering the initial text according to preset rules to obtain a text to be processed.

[0061] The initial text may include fragments containing knowledge or not. In order to segment out the knowledgeable paragraphs and speed up the segmentation, the initial text may be filtered according to the preset rules, and the text obtained after filtering is used as the text to be processed.

[0062] The preset rules may be set in combination with actual conditions. For example, when the initial text is the text corresponding to the podcast audio, the preset rules may include: filtering the narration and / or advertisements at the beginning and end of the podcast audio; the preset rules may also include a judgment rule for determining whether it is a narration or an advertisement; the narration and / or advertisement may be determined from the initial text according to the judgment rule, and then the narration and / or advertisement may be deleted.

[0063] Sub-step S113, using a preset custom extraction template, extracting paragraphs from the text to be processed to obtain a first paragraph, and using the remaining text as the target text.

[0064] Since the text to be processed may include colloquial content, and training data including colloquial content is difficult to obtain, it is not convenient to use the training data including colloquial content to train the model and then use the model to perform paragraph segmentation. In view of this situation, in this embodiment, the main rules are combined with the model for processing. In this processing process, the text is first filtered according to the preset rules, and then the content that meets the custom extraction model is directly extracted, and the extracted content is used as the first paragraph, and then the remaining content is used as the target text. Steps S120 to S150 can be performed on the target text later. Among them, there can be multiple pre-set custom extraction templates, and a paragraph of content extracted based on a custom extraction template is regarded as a paragraph, that is, if the custom template is hit, a first paragraph can be extracted.

[0065] Please refer to Figure 5 , Figure 5 for Figure 2 Schematic diagram of the flow of sub-steps included in step S130. In this embodiment, step S130 may include sub-steps S131 to S133.

[0066] Sub-step S131 , for each first segmentation point, according to the sentence vector of each sentence and the first preset number, determining the first sentence set and the second sentence set corresponding to the first segmentation point.

[0067] For each first segmentation point, two sentence sets corresponding to the first segmentation point can be determined according to the position of the first segmentation point in the target text and the position of each sentence in the target text. The two sentence sets include a first sentence set and a second sentence set, the number of sentences in the first sentence set and the second sentence set are both the first preset number, and the first sentence set and the second sentence set include sentence vectors.

[0068] For example, for the i-th first segmentation point in the target text, it can be determined that the first sentence set corresponding to the i-th first segmentation point includes sentence vectors from the i-w+1th sentence to the i-th sentence in the target text, and the second sentence set corresponding to the i-th first segmentation point includes sentence vectors from the i+1th sentence to the i+wth sentence in the target text. Wherein, w represents the first preset number, which is equivalent to the sliding window w.

[0069] Sub-step S132, based on the first sentence set and the second sentence set corresponding to the first segmentation point, calculate the similarity between the first sentence set and the second sentence set at each first segmentation point.

[0070] Among them, the similarity between the first sentence set and the second sentence set at the i-th first segmentation point is:

[0071]

[0072] in,

[0073] or,

[0074] Among them, score(i) represents the similarity between the first sentence set and the second sentence set at the i-th first segmentation point, e n Represents the sentence vector of the nth sentence in the target text.

[0075] Sub-step S133: calculating a depth score of the first segmentation point according to the similarity corresponding to the first segmentation point.

[0076] Optionally, the difference between the similarity of the first segmentation point and 1 may be directly used as the depth score of the first segmentation point. In this way, the depth score of each first segmentation point may be quickly obtained.

[0077] You can also Figure 6 The depth score of the first segmentation point is obtained in the manner shown. Figure 6 , Figure 6 for Figure 5 Schematic diagram of the flow of sub-steps included in sub-step S133. In this embodiment, sub-step S133 may include sub-step S1331 and sub-step S1332.

[0078] Sub-step S1331 : determining, from the similarities corresponding to the first segmentation points, to find the first maximum similarity located on both sides of the first segmentation point.

[0079] In this embodiment, the similarities corresponding to the first segmentation points can be sorted according to the order in which the first segmentation points appear in the target text. Then, the first maximum similarity on both sides of the first segmentation point is found from the sorting result, that is, the similarity peak on both sides of the first segmentation point is found.

[0080] Sub-step S1332: calculating the depth score of the first segmentation point according to the first maximum similarity on both sides of the first segmentation point and the similarity of the first segmentation point.

[0081] Optionally, the depth score of the i-th first segmentation point may be calculated according to a preset depth score calculation formula. The preset depth score calculation formula is:

[0082]

[0083] socre(l) is the point to the left of socre(i), satisfying: score(l-1)<score(l)<score(l+1);

[0084] socre(r) is the point to the right of socre(i), a peak point that satisfies the same condition: score(r-1)<score(r)<score(r+1);

[0085] Among them, ds(i) represents the depth score of the i-th first segmentation point, socre(l) and socre(r) represent the first maximum similarity on both sides of the i-th first segmentation point, and socre(i) represents the similarity of the i-th first segmentation point.

[0086] When the depth score of each first segmentation point is obtained, as a possible implementation method, the depth score of each first segmentation point can be compared with a first preset value. If the depth score of a first segmentation point is greater than the first preset value, it means that the style or content of the article before and after the first segmentation point has changed significantly, and the first segmentation point can be used as a target segmentation point, and segmentation can be performed at the target segmentation point later. In this way, the target segmentation point can be determined according to the first preset value and the depth score of each first segmentation point.

[0087] As another possible implementation, a supervised model can be combined to assist the unsupervised model in determining whether the start and end positions of the paragraphs extracted are reasonable, thereby improving the accuracy of paragraph segmentation. The unsupervised model refers to a method of determining the segmentation point based on the depth score and the first preset value.

[0088] Please refer to Figure 7 , Figure 7 for Figure 2 Schematic diagram of the flow of sub-steps included in step S140. In this embodiment, step S140 may include sub-steps S141 to S144.

[0089] Sub-step S141 : selecting a first segmentation point whose depth score is greater than a first preset value as an initial target segmentation point.

[0090] Sub-step S142: for each initial target segmentation point, obtain the confidence of each second segmentation point corresponding to the initial target segmentation point.

[0091] In this embodiment, the classification model can be used to obtain the confidence of each second segmentation point corresponding to each initial target segmentation point. Among them, the second segmentation point corresponding to an initial target segmentation point includes the first segmentation point located before the initial target segmentation point and / or the first segmentation point located after the initial segmentation point in the target text. The second segmentation points corresponding to an initial target segmentation point may include a second preset number of first segmentation points located before the initial target segmentation point, and may also include a third preset number of first segmentation points located after the initial target segmentation point. The second preset number and the third preset number may be the same or different, and the specific value may be set in combination with actual needs.

[0092] The confidence of a second segmentation point is used to indicate the probability of segmentation at the second segmentation point. The confidence is obtained based on the target text by a classification model, and the classification model is trained based on the segmented text. The classification model can be pre-trained by the electronic device 100, or obtained from other devices.

[0093] Since supervised data is difficult to obtain, as a possible implementation method, public news data with paragraph divisions can be obtained as segmented text, and then the BERT classification model can be trained based on the segmented text. Since the news data and the target text have different styles, the BERT classification model can be used to predict relatively clear segmentation points to assist in determining whether the start and end positions of the paragraphs extracted by the unsupervised model are reasonable.

[0094] The supervised model is trained based on public training corpus. The training corpus contains relatively short segments with small granularity, and learns more about whether the sentences are complete, such as paragraphs cannot start with "then" or "but". Therefore, the supervised model can be used to determine whether the start and end positions of the unsupervised extraction results are suitable as the start and end positions, and can also be used to assist in determining whether the start and end positions of the paragraphs extracted by the unsupervised model are reasonable.

[0095] For each possible segmentation point, a certain number of sentences can be taken forward and backward in the target text, and then the classification model is used to predict whether the segmentation is necessary, that is, to obtain the confidence of the possible segmentation point.

[0096] Optionally, the possible segmentation points are the first segmentation points in the target text, and the confidence of each first segmentation point in the target text can be directly obtained based on the target text using the trained classification model. Then, for each initial target segmentation point, the confidence of each second segmentation point corresponding to the initial target segmentation point is obtained from the confidence of each first segmentation point.

[0097] Optionally, for each initial target segmentation point, each second segmentation point corresponding to the initial target segmentation point can be determined, and each second segmentation point corresponding to the initial target segmentation point can be used as the possible segmentation point. Then, for each second segmentation point, the confidence of each second segmentation point is obtained based on the target text using the trained classification model.

[0098] Sub-step S143, when there is a confidence value greater than a second preset value among the confidence values ​​of the second segmentation points corresponding to the initial target segmentation point, the second segmentation point with a confidence value greater than the second preset value is used as the target segmentation point corresponding to the initial target segmentation point.

[0099] Sub-step S144, when there is no confidence level greater than the second preset value among the confidence levels of the second segmentation points corresponding to the initial target segmentation point, use the initial target segmentation point as the target segmentation point corresponding to the initial target segmentation point.

[0100] Among them, the second preset value is a high confidence threshold score, which can be set in combination with actual needs. If there is a confidence greater than the second preset value among the confidences of the second segmentation points corresponding to an initial target segmentation point, the second segmentation point corresponding to the maximum confidence among the confidences of the second segmentation points can be used as the target segmentation point corresponding to the initial target segmentation point, that is, segmentation can be performed at the second segmentation point corresponding to the maximum confidence. If there is no confidence greater than the second preset value among the confidences of the second segmentation points corresponding to an initial target segmentation point, the initial target segmentation point can be directly used as the target segmentation point corresponding to the initial target segmentation point, that is, segmentation can be performed at the initial target segmentation point.

[0101] When the target segmentation point in the target text is determined, the target text can be segmented based on the target segmentation point to obtain the second paragraph. In this way, by combining the above rules with the model, the initial text as a long text can be segmented to obtain the first paragraph and the second paragraph without consuming a lot of manpower for manual segmentation.

[0102] At present, important segments need to be extracted in many scenarios. For example, in podcasts, important segments can be extracted from podcast audio, which has great value both from the perspective of creators' preview editing and from the perspective of podcast content distribution. For example, important segments can be recommended to users so that users can determine whether they are interested in the complete podcast audio corresponding to a certain important segment. If they are interested, users can listen to the long audio from the beginning, achieving the purpose of using the short to promote the long.

[0103] In this embodiment, after completing the paragraph division, important target paragraphs can also be extracted from the obtained paragraphs, so as to obtain important knowledgeable paragraphs. Figure 8 , Figure 8 The second flowchart of the data processing method provided in the embodiment of the present application is as follows: After step S150, the method may further include step S160 and step S170.

[0104] Step S160, calculating the importance of each sentence in the text to be processed.

[0105] Optionally, the importance of each sentence in the text to be processed can be calculated based on the Lexrank algorithm. In the calculation process, the sentence vector of each sentence in the text to be processed can be calculated first; then the similarity between sentences is calculated to construct a relationship network between sentences; each sentence corresponds to a node in the network, the node weight is iteratively calculated, and the node weight is sorted in reverse order as the sentence importance sorting result. In this way, the importance of each sentence in the text to be processed can be obtained.

[0106] Step S170, according to the importance of each sentence, select the target paragraph from the obtained paragraphs in descending order of importance.

[0107] The obtained paragraphs include the first paragraph and the second paragraph obtained by segmenting the target text.

[0108] Optionally, the paragraph containing the third preset number of sentences may be used as the target paragraph in descending order of importance, that is, the paragraph containing the top k key sentences of importance may be used as the target paragraph.

[0109] Optionally, for ease of understanding, target paragraphs can also be selected from the obtained paragraphs according to the importance of each sentence and the preset word count range, in order of importance from high to low. Among them, the number of target paragraphs can be multiple or one, which can be set in combination with actual needs. The preset word count range can be 200-1000. In this way, the paragraphs containing several key sentences can be selected as target paragraphs in order of importance from high to low, and the total number of words in the selected target paragraphs is within the preset word count range.

[0110] Optionally, only the importance of each sentence in the target text may be calculated, and then the target paragraph may be selected from the first paragraphs obtained by segmenting the target text according to the importance of each sentence in the target text in the above manner.

[0111] Please refer to Fig. 9 , Fig. 9 The third flowchart of the data processing method provided by the embodiment of the present application is as follows. In this embodiment, the initial text is the text corresponding to the target audio, and the method may further include step S180.

[0112] Step S180: extracting a target audio segment corresponding to the target paragraph from the target audio.

[0113] According to the correspondence between the initial text and the time in the target audio, the target audio segments corresponding to the target paragraphs can be extracted from the target audio. In this way, relatively complete and informative sound segments can be extracted from the long audio, which is convenient for assisting user creation and distribution based on sound content.

[0114] The data processing method provided in the embodiment of the present application is described below in conjunction with an application scenario.

[0115] Currently, podcasts are booming and have become an important medium for information output. There is a lot of valuable content in podcasts. For example, there are a large number of podcasts on Himalaya. Extracting important content clips from podcasts is of great value, both from the perspective of creators' preview editing and from the perspective of podcast content distribution. However, podcast audio is often long, and manual extraction is time-consuming, so algorithm-based automatic extraction is very important.

[0116] The audio of a podcast is often long, corresponding to a text length of several thousand to tens of thousands of characters. If it is extracted manually, it will be time-consuming. At the same time, podcast texts are not as written as news texts, and contain certain spoken expressions. Moreover, there are certain errors after ASR recognition, which poses a challenge to the algorithm's automatic extraction of relatively complete and informative sound clips.

[0117] Currently, the industry's text segmentation and extraction is basically based on the more written text of news, and the text after ASR recognition itself has accumulated errors. There is no mature solution to extract relatively complete and informative fragments from long podcast audio.

[0118] In view of this situation, the data processing method provided in the embodiment of the present application can be used to extract relatively complete and informative sound clips from the podcast, and used to assist users in creating and distributing podcast sound content, etc. The following describes how to extract sound clips using the data processing method.

[0119] When using the data processing method provided in the embodiment of the present application to extract sound clips, the target podcast audio is first obtained, and then the target podcast audio can be subjected to ASR recognition and post-processing, long text segmentation, and key paragraph extraction in sequence.

[0120] ASR recognition can be performed on the target podcast audio to obtain an audio text. Since the punctuation recognized by ASR may be determined based on the length of silence, there is no punctuation prediction from a semantic point of view, and the punctuation at the end of the sentence affects the accuracy of segmentation, a special punctuation prediction model can be used for re-prediction to correct the incorrect punctuation in the audio text. Since some fields involve professional vocabulary that is not covered by the ASR language model, the large language model can be used again to correct the incorrect text. In this way, the audio text can be corrected to obtain the initial text.

[0121] Since the podcast text is a long text at the chapter level, and there are some colloquial contents, and chapter-level training data is difficult to obtain, the method of combining rules with models can be adopted in the long text segmentation part. The narration or advertisement at the beginning and end of the initial text can be judged and filtered according to the preset rules to obtain the text to be processed. Then, the content in the text to be processed that meets the custom extraction template is directly extracted to obtain the first paragraph, and the remaining text is used as the target text. Among them, the custom extraction template can be pre-set, and the specific number and template content can be determined according to the actual situation. For example, "What should I do with XXX?... First... Secondly..." is a typical knowledge fragment extraction template. Afterwards, the target text can be segmented according to the model. Among them, the model is mainly divided into two parts: supervised and unsupervised.

[0122] In the unsupervised model text tiling, the BERT sentence vector E of each sentence in the target text can be calculated first. i Then, according to the set sliding window w (i.e., the first preset number) and the sentence vector of each sentence in the target text, the similarity corresponding to each first segmentation point in the target text is calculated. Among them, the similarity corresponding to the i-th first segmentation point is:

[0123]

[0124] in,

[0125] or,

[0126] Among them, score(i) represents the similarity between the first sentence set and the second sentence set at the i-th first segmentation point, e n Represents the sentence vector of the nth sentence in the target text.

[0127] When the similarity corresponding to each first segmentation point is obtained, the depth score of each first segmentation point can be calculated. The calculation formula of the depth score is:

[0128]

[0129] socre(l) is the point to the left of socre(i), satisfying: score(l-1)<score(l)<score(l+1);

[0130] socre(r) is the point to the right of socre(i), a peak point that satisfies the same condition: score(r-1)<score(r)<score(r+1);

[0131] Among them, ds(i) represents the depth score of the i-th first segmentation point, socre(l) and socre(r) represent the first maximum similarity on both sides of the i-th first segmentation point, and socre(i) represents the similarity of the i-th first segmentation point.

[0132] When the depth score of each first segmentation point is obtained, the first segmentation point having a depth score greater than a first preset value is used as an initial target segmentation point.

[0133] The supervised model cross segment can be a BERT classification model. For each first segmentation point in the target text, a certain number of sentences can be taken forward and backward, and then the BERT classification model can be used to predict whether segmentation is required at the first segmentation point, wherein whether segmentation is required is represented by confidence.

[0134] Since supervised data is difficult to obtain, we can obtain public news data with paragraph divisions to train the BERT classification model. Because the styles of news data and podcast data are different, the BERT classification model can be used to predict very clear segmentation points to assist in determining whether the start and end positions of the paragraphs extracted by the unsupervised model are reasonable.

[0135] For each initial target segmentation point, the confidence of each second segmentation point corresponding to the initial target segmentation point can be obtained. The second segmentation point corresponding to an initial target segmentation point includes the first segmentation point before the initial target segmentation point and / or the first segmentation point after the initial segmentation point in the target text.

[0136] In the case that there is a confidence value greater than a second preset value among the confidence values ​​of the second segmentation points corresponding to the initial target segmentation point, the second segmentation point corresponding to the maximum confidence value among the confidence values ​​of the second segmentation points corresponding to the initial target segmentation point is used as the target segmentation point corresponding to the initial target segmentation point. Otherwise, the initial target segmentation point is directly used as the target segmentation point corresponding to the initial target segmentation point. The second preset value is a relatively high confidence threshold score.

[0137] The target text can be segmented using the determined target segmentation point to obtain the second paragraph. In this way, the long text corresponding to the target podcast audio can be segmented to obtain the first paragraph and the second paragraph.

[0138] The importance of each sentence in the text to be processed can also be calculated based on the sentence vector of each sentence in the text to be processed, and the sentences are sorted. Then, the paragraphs covered by the top k key sentences are extracted as target paragraphs. Finally, the target audio segment corresponding to the target paragraph is extracted from the target podcast audio.

[0139] In this way, we can extract knowledgeable snippets from podcasts through a multi-method fusion approach, and even in the absence of podcast text annotation data, we can still achieve the corresponding effect. This approach can save a lot of manual resources and create value, both from the perspective of assisting creation and based on the distribution of podcast content.

[0140] In order to execute the corresponding steps in the above embodiments and various possible methods, an implementation method of a data processing device 200 is given below. Optionally, the data processing device 200 can adopt the above Figure 1 The device structure of the electronic device 100 is shown. Fig.10 , Fig.10 This is one of the block diagrams of the data processing device 200 provided in the embodiment of the present application. It should be noted that the basic principle and technical effects of the data processing device 200 provided in this embodiment are the same as those of the above embodiment. For the sake of brief description, for parts not mentioned in this embodiment, reference can be made to the corresponding contents in the above embodiment. The data processing device 200 may include: a text acquisition module 210, a vector representation module 220, a calculation module 230, a determination module 240 and a segmentation module 250.

[0141] The text obtaining module 210 is used to obtain the target text.

[0142] The vector representation module 220 is used to convert each sentence in the target text into a vector to obtain a sentence vector of each sentence.

[0143] The calculation module 230 is used to calculate the depth score of each first segmentation point in the target text according to the sentence vector of each sentence. The depth score is used to represent the semantic difference before and after the first segmentation point, and the depth score is calculated according to two sentence sets before and after the first segmentation point, and the two sentence sets respectively include multiple sentences.

[0144] The determination module 240 is used to determine the target segmentation point according to the depth score of each first segmentation point.

[0145] The segmentation module 250 is used to segment the target text into paragraphs according to the target segmentation points.

[0146] Please refer to Fig.11 , Fig.11 The second block diagram of the data processing device 200 provided in the embodiment of the present application. The data processing device 200 may further include an extraction module 260 .

[0147] The extraction module 260 is used to calculate the importance of each sentence in the text to be processed, wherein the text to be processed is the text obtained by filtering the initial text according to a preset rule.

[0148] The extraction module 260 is further used to select a target paragraph from the obtained paragraphs according to the importance of each sentence in descending order of importance. The obtained paragraphs include a first paragraph and a second paragraph obtained by segmenting the target text, wherein the first paragraph is a paragraph extracted from the text to be processed according to a preset custom extraction template.

[0149] Optionally, in this embodiment, the initial text is a text corresponding to the target audio, and the extraction module 260 is further configured to extract a target audio segment corresponding to the target paragraph from the target audio.

[0150] Optionally, the above modules can be stored in the form of software or firmware. Figure 1 The memory 110 shown in the figure may be fixed in the operating system (OS) of the electronic device 100 and may be Figure 1 Meanwhile, the data and program codes required for executing the above modules may be stored in the memory 110.

[0151] An embodiment of the present application also provides a readable storage medium on which a computer program is stored. When the computer program is executed by a processor, the data processing method is implemented.

[0152] In summary, the embodiments of the present application provide a data processing method, device, electronic device and readable storage medium. When a target text is obtained, a sentence vector of each sentence in the target text is obtained, and then the depth score of each first segmentation point in the target text is calculated based on the sentence vector of each sentence, and then the target segmentation point is determined based on the depth score of each first segmentation point, and finally the target text is segmented into paragraphs based on the determined target segmentation point. Among them, the depth score is used to represent the semantic difference before and after the first segmentation point, and the depth score is calculated based on two sentence sets before and after the first segmentation point, and the two sentence sets each include multiple sentences. In this way, similar sentences can be automatically divided into one paragraph, without the need to use manual methods to segment paragraphs, which can save a lot of manpower.

[0153] In several embodiments provided in the present application, it should be understood that the disclosed devices and methods can also be implemented in other ways. The device embodiments described above are merely schematic. For example, the flowcharts and block diagrams in the accompanying drawings show the possible architecture, functions and operations of the devices, methods and computer program products according to multiple embodiments of the present application. In this regard, each box in the flowchart or block diagram can represent a module, a program segment or a part of a code, and the module, a program segment or a part of a code contains one or more executable instructions for implementing the specified logical function. It should also be noted that 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, depending on the functions involved. It should also be noted that each box in the block diagram and / or flowchart, and the combination of boxes in the block diagram and / or flowchart can be implemented with a dedicated hardware-based system that performs a specified function or action, or can be implemented with a combination of dedicated hardware and computer instructions.

[0154] In addition, the functional modules in the various embodiments of the present application may be integrated together to form an independent part, or each module may exist separately, or two or more modules may be integrated to form an independent part.

[0155] If the functions are implemented in the form of software function modules and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application can be essentially or partly embodied in the form of a software product that contributes to the prior art. The computer software product is stored in a storage medium, including several instructions to enable a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the methods described in each embodiment of the present application. The aforementioned storage medium includes: various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.

[0156] The above description is only an optional embodiment of the present application and is not intended to limit the present application. For those skilled in the art, the present application may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application shall be included in the protection scope of the present application.

Claims

1. A data processing method, characterized in that: The method comprises: Get the target text; Convert each sentence in the target text into a vector to obtain a sentence vector for each sentence; According to the sentence vector of each sentence, a depth score of each first segmentation point in the target text is calculated, wherein the depth score is used to represent the semantic difference before and after the first segmentation point, and the depth score is calculated according to two sentence sets before and after the first segmentation point, and the two sentence sets respectively include multiple sentences; Determine the target segmentation point according to the depth score of each first segmentation point; Performing paragraph segmentation on the target text according to the target segmentation points; The step of calculating the depth score of each first segmentation point in the target text according to the sentence vector of each sentence includes: For each first segmentation point, according to the sentence vector of each sentence and the first preset number, determine a first sentence set and a second sentence set corresponding to the first segmentation point, wherein the number of sentences in the first sentence set and the second sentence set is the first preset number; According to the first sentence set and the second sentence set corresponding to each first segmentation point, the similarity between the first sentence set and the second sentence set at each first segmentation point is calculated; For each first segmentation point, determine the first maximum similarity located on both sides of the first segmentation point from the similarities corresponding to the first segmentation points; A depth score of the first segmentation point is calculated based on the first maximum similarity on both sides of the first segmentation point and the similarity of the first segmentation point, wherein the depth score of the first segmentation point is determined based on a difference between a sum and a product, the sum is the sum of the first maximum similarities on both sides of the first segmentation point, the product is the multiplication result of the similarity of the first segmentation point and 2, and the depth score of the first segmentation point increases as the difference increases.

2. The method according to claim 1, characterized in that The step of determining the target segmentation point according to the depth score of each first segmentation point includes: Select a first segmentation point whose depth score is greater than a first preset value as an initial target segmentation point; For each initial target segmentation point, the confidence of each second segmentation point corresponding to the initial target segmentation point is obtained, wherein the second segmentation point corresponding to an initial target segmentation point includes a first segmentation point located before the initial target segmentation point and / or a first segmentation point located after the initial target segmentation point in the target text, and the confidence is obtained based on the target text by a classification model, and the classification model is obtained by training according to segmented text; When there is a confidence value greater than a second preset value among the confidence values ​​of the second segmentation points corresponding to the initial target segmentation point, taking the second segmentation point whose confidence value is greater than the second preset value as the target segmentation point corresponding to the initial target segmentation point; When there is no confidence level greater than the second preset value among the confidence levels of the second segmentation points corresponding to the initial target segmentation point, the initial target segmentation point is used as the target segmentation point corresponding to the initial target segmentation point.

3. The method according to any one of claims 1 to 2, characterized in that: The obtaining of the target text comprises: Get the initial text; Filtering the initial text according to preset rules to obtain a text to be processed; The pre-set custom extraction template is used to extract paragraphs from the text to be processed to obtain the first paragraph, and the remaining text is used as the target text.

4. The method according to claim 3, characterized in that The obtaining of the initial text comprises: Converting target audio into audio text, wherein the target audio includes podcast audio; The punctuation prediction model is used to correct incorrect punctuation in the audio text, and the preset language model is used to correct incorrect text in the audio text to obtain the initial text.

5. The method according to claim 3, characterized in that: The method further comprises: Calculate the importance of each sentence in the text to be processed; According to the importance of each sentence, a target paragraph is selected from the obtained paragraphs in descending order of importance, wherein the obtained paragraphs include the first paragraph and a second paragraph obtained by segmenting the target text.

6. The method according to claim 5, characterized in that The initial text is a text corresponding to the target audio, and the method further includes: A target audio segment corresponding to the target segment is extracted from the target audio.

7. A data processing device, characterized in that: The device comprises: A text acquisition module is used to obtain the target text; A vector representation module, used for converting each sentence in the target text into a vector to obtain a sentence vector of each sentence; A calculation module, used to calculate the depth score of each first segmentation point in the target text according to the sentence vector of each sentence, wherein the depth score is used to represent the semantic difference before and after the first segmentation point, and the depth score is calculated according to two sentence sets before and after the first segmentation point, and the two sentence sets respectively include multiple sentences; A determination module, used to determine a target segmentation point according to the depth score of each first segmentation point; A segmentation module, used for segmenting the target text into paragraphs according to the target segmentation points; The calculation module is specifically used to: for each first segmentation point, determine the first sentence set and the second sentence set corresponding to the first segmentation point according to the sentence vector of each sentence and the first preset number, wherein the number of sentences in the first sentence set and the second sentence set is the first preset number; calculate the similarity between the first sentence set and the second sentence set of each first segmentation point according to the first sentence set and the second sentence set corresponding to each first segmentation point; for each first segmentation point, determine from the similarities corresponding to each first segmentation point to find the first maximum similarity located on both sides of the first segmentation point; calculate the depth score of the first segmentation point according to the first maximum similarity on both sides of the first segmentation point and the similarity of the first segmentation point, wherein the depth score of the first segmentation point is determined based on the difference between a sum and a product, the sum is the sum of the first maximum similarities on both sides of the first segmentation point, the product is the multiplication result of the similarity of the first segmentation point and 2, and the depth score of the first segmentation point increases as the difference increases.

8. An electronic device, characterized in that: It comprises a processor and a memory, wherein the memory stores machine executable instructions that can be executed by the processor, and the processor can execute the machine executable instructions to implement the data processing method according to any one of claims 1 to 6.

Citation Information

Patent Citations

  • Article truncation point setting method and device and computer equipment

    CN112016292A