A text segmentation method, device and computing device for dialogue paragraphs
By constructing a dialogue link jump matrix and using a text classification model, dialogue paragraphs are automatically segmented, which solves the problem of low dialogue segment segmentation efficiency in the existing technology and achieves efficient dialogue content analysis.
Patent Information
- Application Number
- CN202111111230.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-09-23
- Publication Date
- 2024-09-13
- Estimated Expiration
- 2041-09-23
AI Technical Summary
In the existing technology, the segmentation efficiency of manual judgment of dialogue paragraphs is low, and it is difficult to effectively separate the independent dialogue content between the salesperson and the customer from the large dialogue content.
By constructing an adjacency matrix based on the number of jumps in the dialogue link, the probability of the dialogue link is calculated, and combined with the preset threshold and the pre-trained text classification model, the dialogue paragraphs are automatically segmented and the start and end of the dialogue are identified.
It greatly improves the efficiency of dialogue paragraph segmentation, realizes automatic segmentation, reduces manual intervention, and improves analysis efficiency.
Smart Images

Figure CN113919324B
Abstract
Description
Technical Field
[0001] The invention belongs to the field of text processing, and in particular relates to a method, a device and a computing device for segmenting text of a dialogue paragraph. Background Art
[0002] In many sales business scenarios, there is a large amount of conversation content information, but many of these conversation contents are continuous conversation segments, including conversations between sales staff and multiple customers. Therefore, how to effectively separate each person's conversation segment from the large conversation content and independently analyze the conversation content between the salesperson and each customer has become an urgent problem to be solved. At present, the manual judgment method is usually used to segment the conversation segments, which is inefficient. Summary of the invention
[0003] In order to overcome the problems existing in the related technology, the present invention proposes an algorithm for segmenting the content of multi-person conversations, which can effectively segment the conversation paragraphs of different people automatically through the algorithm model, greatly improving the efficiency of manual judgment of text paragraphs.
[0004] According to a first aspect of an embodiment of the present invention, a method for segmenting a text of a dialogue paragraph is provided, comprising:
[0005] Construct an adjacency matrix based on the number of jumps between each dialogue link in the historical dialogue data;
[0006] Calculating the probability that each dialogue link in the dialogue segment to be segmented belongs to the target link in sequence according to the adjacency matrix;
[0007] If the probability exceeds a preset threshold, the dialogue segment to be segmented is segmented according to the current dialogue link.
[0008] Further, the target link includes a conversation start link and a conversation end link;
[0009] The step of sequentially calculating the probability that each dialogue link in the dialogue segment to be segmented belongs to the target link according to the adjacency matrix specifically includes:
[0010] A first probability that the current dialogue link belongs to the dialogue start link and / or a second probability that the current dialogue link belongs to the dialogue end link is calculated according to the adjacency matrix.
[0011] Further, if the probability exceeds a preset threshold, segmenting the dialogue segment to be segmented according to the current dialogue link specifically includes:
[0012] If the first probability exceeds a preset threshold, the current dialogue session is determined to be a dialogue start session, and the current dialogue session is separated from the previous dialogue session;
[0013] If the second probability exceeds a preset threshold, the current dialogue session is determined to be a dialogue ending session, and the current dialogue session is separated from the next dialogue session.
[0014] Furthermore, the method further comprises:
[0015] If the probability does not exceed a preset threshold, the current dialogue session is input into a pre-trained text classification model to identify whether the current dialogue session belongs to a dialogue start session or a dialogue end session;
[0016] The dialogue segments to be segmented are segmented according to the recognition results.
[0017] Furthermore, the training method of the text classification model includes:
[0018] Pre-label the conversation start and end in the training data.
[0019] Define a sliding window across sentences, count the TF-IDF values of the words in each window of the training data, and construct the feature vector corresponding to each window;
[0020] The text classification model is trained according to the feature vector and the marks of the conversation start and conversation end in the training data.
[0021] According to a second aspect of an embodiment of the present invention, a text segmentation device for a dialogue paragraph is provided, comprising:
[0022] A matrix construction module is used to construct an adjacency matrix based on the number of jumps between each dialogue link in the historical dialogue data;
[0023] A probability calculation module, used to calculate the probability that each dialogue link in the dialogue segment to be segmented belongs to the target link in sequence according to the adjacency matrix;
[0024] The dialogue segmentation module is used to segment the dialogue segment to be segmented according to the current dialogue link if the probability exceeds a preset threshold.
[0025] Further, the target link includes a conversation start link and a conversation end link;
[0026] The probability calculation module is specifically used for:
[0027] A first probability that the current dialogue link belongs to the dialogue start link and / or a second probability that the current dialogue link belongs to the dialogue end link is calculated according to the adjacency matrix.
[0028] Furthermore, the conversation segmentation module is specifically used for:
[0029] If the first probability exceeds a preset threshold, the current dialogue session is determined to be a dialogue start session, and the current dialogue session is separated from the previous dialogue session;
[0030] If the second probability exceeds a preset threshold, the current dialogue session is determined to be a dialogue ending session, and the current dialogue session is separated from the next dialogue session.
[0031] Furthermore, the device also includes:
[0032] A dialogue recognition module, for inputting the current dialogue link into a pre-trained text classification model to identify whether the current dialogue link belongs to a dialogue start link or a dialogue end link if the probability does not exceed a preset threshold;
[0033] The dialogue segmentation module is further used to segment the dialogue segments to be segmented according to the recognition results.
[0034] According to a third aspect of an embodiment of the present invention, there is provided a computing device, including:
[0035] Processor; and
[0036] The memory stores executable codes thereon, and when the executable codes are executed by the processor, the processor is caused to execute the method as described above.
[0037] The technical solution provided by the embodiments of the present invention may have the following beneficial effects:
[0038] The text paragraphs of conversations between different people can be automatically segmented, greatly improving the efficiency of manual judgment of text paragraphs.
[0039] It is to be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the invention. BRIEF DESCRIPTION OF THE DRAWINGS
[0040] The above and other objects, features and advantages of the present invention will become more apparent through a more detailed description of exemplary embodiments of the present invention in conjunction with the accompanying drawings, wherein like reference numerals generally represent like components throughout the exemplary embodiments of the present invention.
[0041] Figure 1 The figure is a flowchart of a method for segmenting text of a dialogue paragraph according to an exemplary embodiment of the present invention. DETAILED DESCRIPTION
[0042] The preferred embodiments of the present invention will be described in more detail below with reference to the accompanying drawings. Although the preferred embodiments of the present invention are shown in the accompanying drawings, it should be understood that the present invention can be implemented in various forms and should not be limited by the embodiments described herein. On the contrary, these embodiments are provided to make the present invention more thorough and complete, and to fully convey the scope of the present invention to those skilled in the art.
[0043] The terms used in the present invention are only for the purpose of describing specific embodiments and are not intended to limit the present invention. The singular forms "a", "the" and "the" used in the present invention and the appended claims are also intended to include plural forms unless the context clearly indicates other meanings. It should also be understood that the term "and / or" used herein refers to and includes any or all possible combinations of one or more associated listed items.
[0044] It should be understood that although the terms "first", "second", "third", etc. may be used to describe various information in the present invention, such information should not be limited to these terms. These terms are only used to distinguish the same type of information from each other. For example, without departing from the scope of the present invention, the first information may also be referred to as the second information, and similarly, the second information may also be referred to as the first information. Thus, the features defined as "first" and "second" may explicitly or implicitly include one or more of the features. In the description of the present invention, the meaning of "multiple" is two or more, unless otherwise clearly and specifically defined.
[0045] The technical solutions of the embodiments of the present invention are described in detail below with reference to the accompanying drawings.
[0046] Embodiment 1:
[0047] Figure 1 The figure is a flowchart of a method for segmenting text of a dialogue paragraph according to an exemplary embodiment of the present invention.
[0048] See also Figure 1 , the method comprising:
[0049] 110. Construct an adjacency matrix based on the number of jumps between each dialogue link in the historical dialogue data;
[0050] Specifically, in this step, it is necessary to first define each dialogue link in the historical dialogue data in a certain way. For example, taking the scenario of selling cars in a 4S car store as an example, according to the content of the dialogue, the sales link can be divided into customer reception, inquiry about the purpose of visiting the store, communication about user needs, inquiry about usage needs, inquiry about user information, inquiry about license plate status, inquiry about social security status, inquiry about purchase methods, product introduction, inventory status, brand introduction, comparison of competing products, detailed explanation of costs, explanation of discounts, experience test drive, car pick-up and ordering, and guest delivery. Among them, customer reception can be defined as the beginning link of the dialogue, and customer guest delivery belongs to the end link of the dialogue. Of course, users can also define it according to specific needs.
[0051] Then, an adjacency matrix of the jump times between dialogue links is constructed based on the link flow in the historical dialogue data. The so-called jump is the change from the previous dialogue link to the next link. Take the three dialogue links of customer reception, store purpose inquiry, and user demand communication as examples. The number of times the customer reception link jumps to the customer reception link is 1, the number of times the customer reception link jumps to the store purpose inquiry link is 2, the number of times the customer reception link jumps to the user demand communication link is 3, and so on. Based on the statistics of the number of jumps between each link, the adjacency matrix of the three links can be constructed as follows: 1 2 3 3 2 1 3 4 5
[0055] 120. Calculate the probability that each dialogue link in the dialogue segment to be segmented belongs to the target link in sequence according to the adjacency matrix;
[0056] Generally, the first dialogue link in the dialogue segment to be segmented belongs to the dialogue start link. Taking this as the starting point, the target link to which each dialogue link belongs is determined in sequence. Specifically, the probability of the first dialogue link jumping to each dialogue link is calculated according to the adjacency matrix, and the dialogue link corresponding to the maximum probability is taken as the second dialogue link. And so on, the type of each dialogue link in the dialogue segment to be segmented can be determined.
[0057] For example, taking the adjacency matrix of the three dialogue links of customer reception, inquiry about the purpose of visiting the store, and communication about user needs as an example, according to the adjacency matrix, it can be obtained that the probabilities that the previous link is customer reception, and the current link is customer reception, inquiry about the purpose of visiting the store, and communication about user needs are 1 / 6, 1 / 3, and 1 / 2 respectively. Therefore, the current dialogue link is the user needs communication link.
[0058] 130. If the probability exceeds a preset threshold, segment the dialogue segments to be segmented according to the current dialogue link.
[0059] In this step, if the probability that the current dialogue link belongs to the dialogue start link or the dialogue end link exceeds a preset threshold, the dialogue paragraphs can be segmented. Specifically, if the current dialogue link belongs to the dialogue start link, the current dialogue link will be segmented from the previous dialogue link; if the current dialogue link belongs to the dialogue end link, the current dialogue link will be segmented from the next dialogue link, thereby achieving the segmentation of the dialogue paragraphs.
[0060] A method for segmenting a text of a conversation paragraph provided by an embodiment of the present invention can automatically segment the text paragraph content of a conversation between different persons, thereby greatly improving the efficiency of manually determining the text paragraph.
[0061] By using the method provided by the embodiment of the present invention, the conversation content in the sales business scenario can be effectively segmented, and the information of the business link map can effectively enhance the segmentation result of the link. Moreover, by constructing link maps in different fields, the construction of other fields can be quickly realized.
[0062] Optionally, in this embodiment, the target link includes a conversation start link and a conversation end link;
[0063] Step 120 specifically includes:
[0064] A first probability that the current dialogue link belongs to the dialogue start link and / or a second probability that the current dialogue link belongs to the dialogue end link is calculated according to the adjacency matrix.
[0065] Step 130 specifically includes:
[0066] 1301. If the first probability exceeds a preset threshold, it is determined that the current dialogue session belongs to the dialogue start session, and the current dialogue session is separated from the previous dialogue session;
[0067] 1302. If the second probability exceeds a preset threshold, the current dialogue session is determined to be a dialogue end session, and the current dialogue session is separated from the next dialogue session.
[0068] Optionally, in this embodiment, if Figure 1 As shown, the method also includes:
[0069] 140. If the probability does not exceed a preset threshold, input the current dialogue link into a pre-trained text classification model to identify whether the current dialogue link belongs to a dialogue start link or a dialogue end link;
[0070] 150. Segment the dialogue segments to be segmented according to the recognition results.
[0071] Among them, the training method of the text classification model includes:
[0072] Pre-label the conversation start and end in the training data.
[0073] Define a sliding window across sentences, count the TF-IDF values of the words in each window of the training data, and construct the feature vector corresponding to each window;
[0074] The text classification model is trained according to the feature vector and the marks of the conversation start and conversation end in the training data.
[0075] In the above training method, the length of the sliding window is a fixed number of sentences. For example, three sentences are used as a window, and then the TF-IDF value of the words in the window is calculated. The specific calculation process belongs to the prior art and is not specifically described in this embodiment. After that, one sentence is slid each time and the calculation is performed until all sentences in the training data are calculated. The feature vector of each window can be constructed based on the TF-IDF calculation result of each window. Combined with the marking results of the conversation start link and the conversation end link, the text classification model can be trained. According to the trained model, it can be identified that the current conversation link belongs to the conversation start link or the conversation end link.
[0076] During the training process of the above text classification model, the context information of each sentence can be included through the sliding window across sentences, which can improve the accuracy of model recognition compared to the training method of training individual sentences separately.
[0077] Embodiment 2:
[0078] Corresponding to the above method embodiment, this embodiment provides a text segmentation device for a dialogue paragraph, comprising:
[0079] A matrix construction module is used to construct an adjacency matrix based on the number of jumps between each dialogue link in the historical dialogue data;
[0080] A probability calculation module, used to calculate the probability that the current dialogue link belongs to the target link according to the adjacency matrix;
[0081] The dialogue segmentation module is used to segment the dialogue segments to be segmented according to the current dialogue link if the probability exceeds a preset threshold.
[0082] Optionally, in this embodiment, the target link includes a conversation start link and a conversation end link;
[0083] The probability calculation module is specifically used for:
[0084] A first probability that the current dialogue link belongs to the dialogue start link and / or a second probability that the current dialogue link belongs to the dialogue end link is calculated according to the adjacency matrix.
[0085] Optionally, in this embodiment, the conversation segmentation module is specifically used to:
[0086] If the first probability exceeds a preset threshold, the current dialogue session is determined to be a dialogue start session, and the current dialogue session is separated from the previous dialogue session;
[0087] If the second probability exceeds a preset threshold, the current dialogue session is determined to be a dialogue ending session, and the current dialogue session is separated from the next dialogue session.
[0088] Optionally, in this embodiment, the device further includes:
[0089] A dialogue recognition module, for inputting the current dialogue link into a pre-trained text classification model to identify whether the current dialogue link belongs to a dialogue start link or a dialogue end link if the probability does not exceed a preset threshold;
[0090] The dialogue segmentation module is further used to segment the dialogue segments to be segmented according to the recognition results.
[0091] Regarding the device in the above embodiment, the specific manner in which each module performs operations has been described in detail in the embodiment of the method, and will not be elaborated again here.
[0092] The embodiment of the present invention provides a text segmentation device for conversation paragraphs, which can automatically segment the text paragraph contents of conversations between different persons, thereby greatly improving the efficiency of manual determination of text paragraphs.
[0093] By using the device provided by the embodiment of the present invention, the conversation content in the sales business scenario can be effectively segmented, and the information of the business link map can effectively enhance the segmentation result of the link. Moreover, by constructing link maps of different fields, the construction of other fields can be quickly realized.
[0094] Embodiment 3:
[0095] The method according to the present invention may be implemented as a computing device including a memory and a processor.
[0096] The processor may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or any conventional processor, etc.
[0097] The memory may include various types of storage units, such as system memory, read-only memory (ROM), and permanent storage. Among them, ROM may store static data or instructions required by the processor or other modules of the computer. The permanent storage may be a readable and writable storage device. The permanent storage may be a non-volatile storage device that does not lose the stored instructions and data even after the computer is powered off. In some embodiments, the permanent storage device uses a large-capacity storage device (such as a magnetic or optical disk, flash memory) as a permanent storage device. In other embodiments, the permanent storage device may be a removable storage device (such as a floppy disk, optical drive). The system memory may be a readable and writable storage device or a volatile readable and writable storage device, such as a dynamic random access memory. The system memory may store some or all instructions and data required by the processor at run time. In addition, the memory may include any combination of computer-readable storage media, including various types of semiconductor memory chips (DRAM, SRAM, SDRAM, flash memory, programmable read-only memory), and disks and / or optical disks may also be used. In some embodiments, the memory may include a readable and / or writable removable storage device, such as a laser disc (CD), a read-only digital versatile disc (e.g., DVD-ROM, double-layer DVD-ROM), a read-only Blu-ray disc, an ultra-density optical disc, a flash memory card (e.g., SD card, mini SD card, Micro-SD card, etc.), a magnetic floppy disk, etc. The computer-readable storage medium does not include carrier waves and transient electronic signals transmitted wirelessly or wired.
[0098] The memory stores executable codes, and when the executable codes are processed by the processor, the processor can execute part or all of the methods described above.
[0099] Embodiment 4:
[0100] In addition, the method according to the present invention may also be implemented as a computer program or a computer program product, which includes computer program code instructions for executing part or all of the steps in the above method of the present invention.
[0101] Alternatively, the present invention may also be implemented as a non-temporary machine-readable storage medium (or computer-readable storage medium, or machine-readable storage medium) on which executable code (or computer program, or computer instruction code) is stored. When the executable code (or computer program, or computer instruction code) is executed by a processor of an electronic device (or computing device, server, etc.), the processor executes part or all of the steps of the above-mentioned method according to the present invention.
[0102] The scheme of the present invention has been described in detail above with reference to the accompanying drawings. In the above embodiments, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments. Those skilled in the art should also be aware that the actions and modules involved in the specification are not necessarily required by the present invention. In addition, it can be understood that the steps in the method of the embodiment of the present invention can be adjusted in order, merged and deleted according to actual needs, and the modules in the device of the embodiment of the present invention can be merged, divided and deleted according to actual needs.
[0103] Those skilled in the art will further appreciate that the various illustrative logical blocks, modules, circuits, and algorithm steps described in connection with the disclosure herein may be implemented as electronic hardware, computer software, or a combination of both.
[0104] The flow chart and block diagram in the accompanying drawings show the possible architecture, function and operation of the system and method according to multiple embodiments of the present invention. In this regard, each square box in the flow chart or block diagram can represent a part of a module, program segment or code, and the part of the module, program segment or code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the square box can also occur in a sequence different from that marked in the accompanying drawings. For example, two continuous square 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 square box in the block diagram and / or flow chart, and the combination of the square boxes in the block diagram and / or flow chart can be implemented with a dedicated hardware-based system that performs the specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0105] The embodiments of the present invention have been described above, and the above description is exemplary, not exhaustive, and is not limited to the disclosed embodiments. Many modifications and variations will be apparent to those of ordinary skill in the art without departing from the scope and spirit of the described embodiments. The terms used herein are selected to best explain the principles of the embodiments, practical applications, or improvements to the technology in the market, or to enable other persons of ordinary skill in the art to understand the embodiments disclosed herein.
Claims
1. A text segmentation method for dialogue paragraphs, It is characterized in that include: Construct an adjacency matrix based on the number of jumps between each dialogue link in the historical dialogue data; Calculating the probability of each dialogue link in the dialogue paragraph to be segmented belonging to the target link in sequence according to the adjacency matrix, specifically including: calculating the first probability that the current dialogue link belongs to the dialogue start link and / or the second probability that it belongs to the dialogue end link according to the adjacency matrix, specifically calculating the probability of the first dialogue link in the dialogue paragraph to be segmented jumping to each dialogue link according to the adjacency matrix, taking the dialogue link corresponding to the maximum probability among all probabilities as the second dialogue link, and so on, determining the type according to the probability of each dialogue link in the dialogue paragraph to be segmented, wherein the target link includes two types, the dialogue start link and the dialogue end link; If the first probability or the second probability exceeds a preset threshold, segmenting the dialogue segment to be segmented according to the current dialogue link; If the first probability or the second probability does not exceed a preset threshold, the current dialogue link is input into a pre-trained text classification model to identify whether the current dialogue link belongs to the dialogue start link or the dialogue end link, and the dialogue paragraphs to be segmented are segmented according to the recognition result.
2. The method according to claim 1, It is characterized in that If the first probability or the second probability exceeds a preset threshold, segmenting the dialogue segment to be segmented according to the current dialogue link specifically includes: If the first probability exceeds a preset threshold, the current dialogue session is determined to be a dialogue start session, and the current dialogue session is separated from the previous dialogue session; If the second probability exceeds a preset threshold, the current dialogue session is determined to be a dialogue ending session, and the current dialogue session is separated from the next dialogue session.
3. The method according to claim 1, It is characterized in that The training method of the text classification model includes: Pre-label the conversation start and end in the training data. Define a sliding window across sentences, count the TF-IDF values of the words in each window of the training data, and construct the feature vector corresponding to each window; The text classification model is trained according to the feature vector and the marks of the conversation start and conversation end in the training data.
4. A text segmentation device for dialogue paragraphs, It is characterized in that include: A matrix construction module is used to construct an adjacency matrix based on the number of jumps between each dialogue link in the historical dialogue data; A probability calculation module is used to calculate the probability that each dialogue link in the dialogue paragraph to be segmented belongs to the target link in sequence according to the adjacency matrix, specifically including: calculating the first probability that the current dialogue link belongs to the dialogue start link and / or the second probability that it belongs to the dialogue end link according to the adjacency matrix, specifically calculating the probability of the first dialogue link in the dialogue paragraph to be segmented jumping to each dialogue link according to the adjacency matrix, taking the dialogue link corresponding to the maximum probability among all probabilities as the second dialogue link, and so on, determining the type according to the probability of each dialogue link in the dialogue paragraph to be segmented, and the target link includes two types of the dialogue start link and the dialogue end link; A dialogue segmentation module, configured to segment the dialogue segment to be segmented according to the current dialogue link if the first probability or the second probability exceeds a preset threshold; a dialogue recognition module, configured to input the current dialogue link into a pre-trained text classification model to recognize that the current dialogue link belongs to a dialogue start link or a dialogue end link if the first probability or the second probability does not exceed a preset threshold; The dialogue segmentation module is further used to segment the dialogue segments to be segmented according to the recognition results.
5. The device according to claim 4, It is characterized in that The dialogue segmentation module is specifically used for: If the first probability exceeds a preset threshold, the current dialogue session is determined to be a dialogue start session, and the current dialogue session is separated from the previous dialogue session; If the second probability exceeds a preset threshold, the current dialogue session is determined to be a dialogue ending session, and the current dialogue session is separated from the next dialogue session.
6. A computing device, It is characterized in that include: processor; as well as A memory having executable codes stored thereon, which, when executed by the processor, causes the processor to execute the method according to any one of claims 1 to 3.
