Text segmentation method and device and terminal equipment
By obtaining the text and its generation time, determining the slicing strategy and dividing the first sentence text, the problem of low efficiency in slicing the first sentence of the streaming output text is solved, and more efficient and flexible text slicing is achieved.
Patent Information
- Application Number
- CN202311426394.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-10-30
- Publication Date
- 2025-05-02
AI Technical Summary
When text-to-speech processing is performed on the streamed text, the segmentation efficiency of the first sentence text is low, especially when the period does not include a period within the preset period, which results in a long time.
By obtaining the text and its generation time, the corresponding text segmentation strategy is determined, and the text is segmented based on the strategy to obtain the first sentence text, and then the text to speech processing is performed.
It improves the flexibility and efficiency of text segmentation in the first sentence, reduces waiting time, and enhances the accuracy and reliability of text segmentation.
Smart Images

Figure CN119920233A_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present disclosure relate to the field of speech synthesis technology, and in particular to a text segmentation method, apparatus, and terminal device. Background Art
[0002] When performing text-to-speech processing on streaming output text (eg, text output continuously character by character), speech synthesis of the first sentence of the text is particularly important.
[0003] At present, the terminal device can determine whether the text output in streaming mode includes a period. If the text output in streaming mode includes a period, the terminal device can determine the text before the period as the first sentence of the text. However, in the above method, some texts do not have a period within a preset time period (for example, the text within 2 seconds does not include a period), which makes the first sentence segmentation time-consuming and results in low efficiency of the first sentence segmentation of the text. Summary of the invention
[0004] The present disclosure provides a text segmentation method, apparatus and terminal device, which are used to solve one or more technical problems in the prior art.
[0005] In a first aspect, the present disclosure provides a text segmentation method, the method comprising:
[0006] Obtaining text and the duration of generating the text;
[0007] Based on the duration, determining a text segmentation strategy associated with the text;
[0008] Based on the text segmentation strategy, segment the text to obtain the first sentence of the text;
[0009] The first sentence text is subjected to text-to-speech processing to obtain the speech corresponding to the first sentence text.
[0010] In a second aspect, the present disclosure provides a text segmentation device, which includes an acquisition module, a determination module, a segmentation module and a processing module, wherein:
[0011] The acquisition module is used to acquire text and the time length of generating the text;
[0012] The determination module is used to determine a text segmentation strategy associated with the text based on the duration;
[0013] The segmentation module is used to segment the text based on the text segmentation strategy to obtain the first sentence text of the text;
[0014] The processing module is used to perform text-to-speech processing on the first sentence text to obtain the speech corresponding to the first sentence text.
[0015] In a third aspect, an embodiment of the present disclosure provides an electronic device including: a processor and a memory;
[0016] The memory stores computer-executable instructions;
[0017] The processor executes the computer-executable instructions stored in the memory, so that the at least one processor executes the text segmentation method as described in the first aspect and various possible aspects of the first aspect.
[0018] In a fourth aspect, an embodiment of the present disclosure provides a computer-readable storage medium, in which computer execution instructions are stored. When a processor executes the computer execution instructions, the text segmentation method as described in the first aspect and various possible aspects involved in the first aspect are implemented.
[0019] The present disclosure provides a text segmentation method, apparatus and terminal device, wherein the terminal device can obtain a text and the time length of generating the text, determine a text segmentation strategy associated with the text based on the time length, segment the text based on the text segmentation strategy, obtain the first sentence of the text, perform text-to-speech processing on the first sentence of the text, and obtain the speech corresponding to the first sentence of the text. In the above method, since the terminal device can flexibly determine the text segmentation strategy associated with the text based on the time length of generating the text, the segmentation flexibility of the first sentence of the text is relatively high, and since the terminal device can select different text segmentation strategies based on different time lengths without having to wait for a long time, the efficiency of text segmentation can be improved. BRIEF DESCRIPTION OF THE DRAWINGS
[0020] In order to more clearly illustrate the embodiments of the present disclosure or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present disclosure. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative labor.
[0021] Figure 1 A schematic diagram of an application scenario provided by an embodiment of the present disclosure;
[0022] Figure 2 A flowchart of a text segmentation method provided by an embodiment of the present disclosure;
[0023] Figure 3 A text schematic diagram of a streaming output provided by an embodiment of the present disclosure;
[0024] Figure 4 A schematic diagram of determining a target time period provided by an embodiment of the present disclosure;
[0025] Figure 5 A schematic diagram of a process for determining a text segmentation strategy provided by an embodiment of the present disclosure;
[0026] Figure 6 A schematic diagram of a method for segmenting text provided in an embodiment of the present disclosure;
[0027] Fig. 7A A schematic diagram of a text segmentation process provided by an embodiment of the present disclosure;
[0028] Figure 7B Another schematic diagram of a text segmentation process provided by an embodiment of the present disclosure;
[0029] Figure 8 A schematic diagram of another method for segmenting text provided in an embodiment of the present disclosure;
[0030] Fig. 9 Another schematic diagram of a text segmentation process provided by an embodiment of the present disclosure;
[0031] Fig.10 A schematic diagram of another method for segmenting text provided in an embodiment of the present disclosure;
[0032] Fig.11 Another schematic diagram of a text segmentation process provided by an embodiment of the present disclosure;
[0033] Fig.12 A schematic diagram of another method for segmenting text provided in an embodiment of the present disclosure;
[0034] Fig.13 A schematic diagram of a text segmentation method provided in an embodiment of the present disclosure;
[0035] Fig.14 A structural schematic diagram of a text segmentation device provided by an embodiment of the present disclosure; and
[0036] Fig.15 A schematic diagram of the structure of a terminal device provided in an embodiment of the present disclosure. DETAILED DESCRIPTION
[0037] Exemplary embodiments will be described in detail herein, examples of which are shown in the accompanying drawings. When the following description refers to the drawings, the same numbers in different drawings represent the same or similar elements unless otherwise indicated. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present disclosure. Instead, they are merely examples of devices and methods consistent with some aspects of the present disclosure as detailed in the appended claims.
[0038] To facilitate understanding, the concepts involved in the embodiments of the present disclosure are explained below.
[0039] Terminal device: a device with wireless transceiver function. The terminal device can be deployed on land, including indoors or outdoors, handheld, wearable or vehicle-mounted. The terminal device can be a mobile phone, a tablet computer, a computer with wireless transceiver function, a virtual reality (VR) terminal device, an augmented reality (AR) terminal device, a wireless terminal in industrial control, a vehicle-mounted terminal device, a wireless terminal in self-driving, a wireless terminal device in remote medical, a wireless terminal device in smart grid, a wireless terminal device in transportation safety, a wireless terminal device in smart city, a wireless terminal device in smart home, a wearable terminal device, etc. The terminal device involved in the embodiments of the present disclosure can also be called a terminal, a user equipment (UE), an access terminal device, a vehicle-mounted terminal, an industrial control terminal, a UE unit, a UE station, a mobile station, a mobile station, a remote station, a remote terminal device, a mobile device, a UE terminal device, a wireless communication device, a UE agent or a UE device, etc. Terminal devices can also be fixed or mobile.
[0040] Next, combine Figure 1 , the application scenarios of the embodiments of the present disclosure are described.
[0041] Figure 1 A schematic diagram of an application scenario provided by an embodiment of the present disclosure. Figure 1 , including: a language model, a text segmentation device and a text-to-speech device, wherein the language model, the text segmentation device and the text-to-speech device can be set in a terminal device. The language model can send streaming text to the text segmentation device. After receiving the streaming text, the text segmentation device can segment the streaming text to obtain the first sentence text corresponding to the streaming text, and input the first sentence text to the text-to-speech device. The text-to-speech device can perform speech synthesis based on the first sentence text to obtain the speech of the first sentence text. In this way, the terminal device can play the text output by the language model in a voice-based manner, improve the diversity of interaction, and improve the user experience.
[0042] It should be noted that Figure 1 The application scenarios of the embodiments of the present disclosure are merely illustrative and are not intended to limit the application scenarios of the embodiments of the present disclosure.
[0043] In the related art, the way that a large language model outputs text is usually streaming output. For example, a large language model can output text character by character. If the text-to-speech processing is performed on the streaming output text, it is necessary to perform appropriate sentence segmentation on the streaming output text to synthesize speech sentence by sentence to ensure the effect of speech synthesis. At present, the segmentation of the first sentence of the streaming output text is particularly important. For example, the text of other parts can be segmented based on context information, but the first sentence text cannot obtain enough context information, so the first sentence segmentation is difficult. At present, the terminal device can perform the first sentence segmentation based on the period in the text. For example, if the streaming output text includes a period, the terminal device can determine the text before the period as the first sentence text. However, the above method can only segment the text based on a fixed method, resulting in a low flexibility in the segmentation of the first sentence of the text, and if the streaming output text does not include a period for a long period of time (such as a long text does not include a period within 3 seconds of output), the first sentence segmentation takes a long time, resulting in a low efficiency in the segmentation of the first sentence of the text.
[0044] In order to solve the technical problems in the related art, the embodiments of the present disclosure provide a text segmentation method, in which a terminal device can obtain a text and the duration of generating the text, determine the target time period where the duration is located in a plurality of preset time periods, and determine the text segmentation strategy corresponding to the target time period, and the terminal device can determine the text segmentation strategy corresponding to the target time period as the text segmentation strategy associated with the text, and segment the text based on the text segmentation strategy to obtain the first sentence text of the text, and the terminal device can perform text-to-speech processing on the first sentence text to obtain the speech corresponding to the first sentence text. In the above method, since the terminal device can flexibly determine the text segmentation strategy associated with the text based on the duration of generating the streaming text, the flexibility of the text segmentation of the first sentence of the text is relatively high, and the terminal device can obtain the text segmentation strategy corresponding to the text without waiting for a long time, thereby reducing the time consumption of the first sentence segmentation and improving the flexibility of the text segmentation of the first sentence of the text.
[0045] The technical solution of the present invention and how the technical solution of the present invention solves the above-mentioned technical problems are described in detail below with specific embodiments. The following specific embodiments can be combined with each other, and the same or similar concepts or processes may not be repeated in some embodiments. The embodiments of the present invention will be described below in conjunction with the accompanying drawings.
[0046] Figure 2 A flowchart of a text segmentation method provided by an embodiment of the present disclosure. Figure 2 , the method may include:
[0047] S201, obtaining text and the time taken to generate the text.
[0048] The execution subject of the embodiment of the present disclosure may be a terminal device, or a text segmentation device arranged in the terminal device. The text segmentation device may be implemented based on software, or may be implemented based on a combination of software and hardware, which is not limited in the embodiment of the present disclosure.
[0049] Optionally, the text may be a text to be subjected to speech synthesis. For example, if the terminal device performs text-to-speech processing on text 1, the text may be text 1, and if the terminal device performs text-to-speech processing on text 2, the text may be text 2. The text may be a text output in a streaming manner. For example, streaming output refers to outputting text character by character. For example, when a user inputs a question to a large language model, the answer given by the large language model may be displayed based on the text output in a streaming manner.
[0050] Next, combine Figure 3 , describes the text of streaming output.
[0051] Figure 3 A text diagram of a streaming output provided by an embodiment of the present disclosure. Figure 3 , including language models. Among them, the terminal device ( Figure 3 (not shown) A text may be input into the language model: How is the weather today? After 0.1 seconds, the language model may output the text: Today. After 0.2 seconds, the text output by the language model is: Today's weather. After 0.3 seconds, the text output by the language model is: Today's weather is very good. In this way, the language model outputs streaming text, which can reduce the time users wait for answers and improve the user experience.
[0052] The duration may be the duration used to generate the text. For example, if the terminal device uses 1 second to generate the text, the duration may be 1 second; if the terminal device uses 2 seconds to generate the text, the duration may be 2 seconds. Figure 3 In the illustrated embodiment, the language model takes 0.1 seconds to generate the text "today", takes 0.2 seconds to generate the text "today's weather", and takes 0.3 seconds to generate the text "today's weather is very good".
[0053] Optionally, the terminal device can obtain text based on the large language model. For example, in an actual application scenario, a user can input a question to the large language model, and the large language model can output the answer to the question based on the text. The terminal device can obtain the text output by the large language model and use the text as the text to be synthesized.
[0054] It should be noted that the terminal device can obtain text based on any feasible implementation method, and the embodiments of the present disclosure are not limited to this.
[0055] It should be noted that after the terminal device obtains the text, it can obtain the time used to generate the text based on any feasible implementation method, and the embodiments of the present disclosure are not limited to this.
[0056] S202: Determine a text segmentation strategy associated with the text based on the duration.
[0057] The text segmentation strategy can be used to segment the first sentence of the text. For example, the terminal device can segment the text based on the text segmentation strategy to obtain the first sentence of the text, where the first sentence of the text can be the text of the first sentence of the text.
[0058] Among them, the terminal device can determine the text segmentation strategy associated with the text based on the following feasible implementation method: among multiple preset time periods, determine the target time period where the duration is located, determine the text segmentation strategy corresponding to the target time period, and determine the text segmentation strategy corresponding to the target time period as the text segmentation strategy associated with the text.
[0059] Optionally, the plurality of preset time periods may include a first time period, a second time period, a third time period and a fourth time period. The first time period is smaller than the second time period, the second time period is smaller than the third time period, and the third time period is smaller than the fourth time period. For example, the first time period may be 0 seconds to 1 second, the second time period may be 1 second to 2.5 seconds, the third time period may be 2.5 seconds to 3.5 seconds, and the fourth time period may be greater than 3.5 seconds.
[0060] The target time period may be the time period in which the duration of the generated text is located. For example, the plurality of preset time periods may include a first time period, a second time period, a third time period, and a fourth time period, the first time period may be 0 seconds to 1 second, the second time period may be 1 second to 2.5 seconds, the third time period may be 2.5 seconds to 3.5 seconds, and the fourth time period may be more than 3.5 seconds. If the duration of the generated text is 0.5 seconds, the target time period may be the first time period, if the duration of the generated text is 1.5 seconds, the target time period may be the second time period, if the duration of the generated text is 3 seconds, the target time period may be the third time period, and if the duration of the generated text is 4 seconds, the target time period may be the fourth time period.
[0061] Next, combine Figure 4 , explaining the process of determining the target period.
[0062] Figure 4 A schematic diagram of determining a target time period provided by an embodiment of the present disclosure. Figure 4, including: language model and preset time period. Among them, the language model outputs text 1 within 1 second: Today's weather is very good. The language model outputs text 2 within 2 seconds: Today's weather is very good, suitable for camping. The language model outputs text 3 within 3 seconds: Today's weather is very good, suitable for camping, and the park is also a good choice.
[0063] See also Figure 4 The preset time periods include time period A, time period B, time period C and time period D. Among them, time period A is 0 seconds to 1.5 seconds, time period B is 1.5 seconds to 2.5 seconds, time period C is 2.5 seconds to 3.5 seconds, and time period D is more than 3.5 seconds. Terminal equipment ( Figure 4 (not shown) can determine the target time period corresponding to each text based on the time required to generate text 1, text 2 and text 3. Among them, the target time period of text 1 is time period A, the target time period of text 2 is time period B, and the target time period of text 3 is time period C. In this way, the terminal device can obtain the time used to generate the text in real time, and then can flexibly determine the text segmentation strategy associated with the text.
[0064] Optionally, the preset time period may correspond to the text segmentation strategy one by one. For example, each preset time period may correspond to a text segmentation strategy, so that the time length used to generate the text is different, and the text segmentation strategy for the text is also different, thereby improving the flexibility of text segmentation.
[0065] Optionally, the terminal device may determine the text segmentation strategy corresponding to the target time period based on the correspondence between multiple preset time periods and multiple text segmentation strategies. For example, the correspondence between multiple preset time periods and multiple text segmentation strategies may be as shown in Table 1:
[0066] Table 1
[0067] Preset time period Text segmentation strategy First period First division strategy Second period Second segmentation strategy The third period The third segmentation strategy Fourth period Fourth segmentation strategy
[0068] It should be noted that Table 1 is only an example to illustrate the correspondence between multiple preset time periods and multiple text segmentation strategies, and is not a limitation on the correspondence between multiple preset time periods and multiple text segmentation strategies.
[0069] Optionally, the terminal device determines the text segmentation strategy corresponding to the target time period, which may be: if the target time period is the first time period, the text segmentation strategy is determined to be the first segmentation strategy; if the target time period is the second time period, the text segmentation strategy is determined to be the second segmentation strategy; if the target time period is the third time period, the text segmentation strategy is determined to be the third segmentation strategy; if the target time period is the fourth time period, the text segmentation strategy is determined to be the fourth segmentation strategy, wherein the first time period is smaller than the second time period, the second time period is smaller than the third time period, and the third time period is smaller than the fourth time period.
[0070] The first segmentation strategy may be a sentence-level segmentation strategy. For example, the first segmentation strategy may be used to segment complete sentences from a text. For example, if the terminal device executes the first segmentation strategy, the terminal device may segment the text into two paragraphs, wherein the first paragraph may be the first complete sentence of the text, wherein the complete sentence may be a sentence including a period, exclamation mark, or other termination symbol at the end of the sentence.
[0071] The second segmentation strategy may be a segmentation strategy for the last clause. For example, the second segmentation strategy may be used to segment a complete sub-sentence from the text. For example, if the terminal device executes the second segmentation strategy, the terminal device may segment the text into two paragraphs, wherein the first paragraph may not be a complete sentence, but the first paragraph may be a complete sub-sentence, wherein the complete sub-sentence may be a sentence including a comma or a colon at the end of the sentence.
[0072] The third segmentation strategy may be a segmentation strategy for the last phrase. For example, the third segmentation strategy may segment at the phrase position in the text. For example, if the terminal device executes the third segmentation strategy, the terminal device may segment the text into two paragraphs, wherein the first paragraph is not a complete sentence and the end of the first paragraph is a phrase.
[0073] The fourth segmentation strategy may be a segmentation strategy for outputting the entire sentence. For example, if the terminal device executes the fourth segmentation strategy, the terminal device may segment at the end of the text, that is, output all the text.
[0074] Next, combine Figure 5 , and explain the text segmentation strategy corresponding to the target time period.
[0075] Figure 5 A schematic diagram of a process for determining a text segmentation strategy provided by an embodiment of the present disclosure. Figure 5 , including a preset time period and a language model. The preset time period includes time period A, time period B, time period C and time period D. Time period A is 0 seconds to 1.5 seconds, time period B is 1.5 seconds to 2.5 seconds, time period C is 2.5 seconds to 3.5 seconds, and time period D is more than 3.5 seconds. Time period A corresponds to the first segmentation strategy, time period B corresponds to the second segmentation strategy, time period C corresponds to the third segmentation strategy, and time period D corresponds to the fourth segmentation strategy.
[0076] See also Figure 5 , the language model outputs text 1 in 1 second: Today's weather is very good, the terminal device ( Figure 5(not shown) The target time period of text 1 can be determined to be time period A, and the segmentation strategy of text 1 is the first segmentation strategy. The language model outputs text 2 within 2 seconds: Today's weather is very good, suitable for going out camping. The terminal device can determine that the target time period of text 2 is time period B, and the segmentation strategy of text 2 is the second segmentation strategy. The language model outputs text 3 within 3 seconds: Today's weather is very good, suitable for going out camping, and the park is also a good choice. The terminal device can determine that the target time period associated with text 3 is time period C, and the segmentation strategy of text 3 is the third segmentation strategy. In this way, the terminal device can flexibly determine the text segmentation strategy corresponding to the text based on the duration used by the streaming output text, thereby improving the accuracy and flexibility of text segmentation.
[0077] Optionally, before determining the target time period, the terminal device may also determine the start time and end time corresponding to multiple preset time periods. For example, the terminal device may obtain multiple sample texts accumulated over multiple time periods, and for any text segmentation strategy, the terminal device may determine the proportion of the text that can be segmented normally by the text segmentation strategy. If the proportion is greater than a preset threshold, the terminal device may determine the start time and end time based on the duration of the successfully segmented text. For example, for the first segmentation strategy, the terminal device has a segmentation success rate of 98% for text within 1.5 seconds based on the first segmentation strategy, then the terminal device can determine that the start time of the first time period is 0 seconds and the end time is 1.5 seconds. For the second segmentation strategy, the terminal device has a segmentation success rate of 98% for text within 2.5 seconds based on the second segmentation strategy, then the terminal device can determine that the start time of the second time period is 1.5 seconds and the end time is 2.5 seconds (it can also be determined based on comparison, such as the terminal device has a segmentation success rate of 90% for text within 2.4 seconds, and the success rate difference between it and 2.5 seconds is large, so the end time can be determined as 2.5 seconds). Similarly, the method for determining the start time and end time of time periods associated with other text segmentation strategies will not be repeated in the embodiments of the present disclosure.
[0078] It should be noted that the first time period, the second time period, the third time period and the fourth time period may be continuous time periods or discontinuous time periods. If they are discontinuous time periods, when the terminal device cannot determine the text segmentation strategy corresponding to the text, the text may not be segmented. The embodiments of the present disclosure do not limit this.
[0079] It should be noted that the terminal device can also determine the preset time period based on any feasible implementation method (for example, the terminal device can arbitrarily set the start time and end time of each preset time period, but it is necessary to satisfy that the first time period is less than the second time period, the second time period is less than the third time period, and the third time period is less than the fourth time period), and the embodiments of the present disclosure are not limited to this.
[0080] S203: Segment the text based on the text segmentation strategy to obtain the first sentence of the text.
[0081] Optionally, after the terminal device determines the text segmentation strategy, it can segment the text to obtain the first sentence of the text. For example, if the terminal device determines that the text segmentation strategy corresponding to the text is the first segmentation strategy, the terminal device can segment the text based on the first segmentation strategy; if the terminal device determines that the text segmentation strategy corresponding to the text is the second segmentation strategy, the terminal device can segment the text based on the second segmentation strategy.
[0082] Optionally, the terminal device can obtain the first sentence of the text based on the following feasible implementation method: determine whether the text segmentation strategy associated with the text can successfully segment the text, if so, segment the text based on the text segmentation strategy, if not, wait for the text to accumulate until other text segmentation strategies associated with the text are determined based on the time length, and then segment the text based on the other text segmentation strategies. In this way, as the time length used to generate the text increases, the terminal device can use multiple text segmentation strategies to segment the text, thereby improving the reliability, flexibility and accuracy of text segmentation.
[0083] Optionally, after the terminal device determines the text segmentation strategy associated with the text, the text segmentation strategy may not be able to segment the text. Therefore, in the scenario where the text cannot be segmented, the terminal device can stop executing the text segmentation strategy and wait for the text to accumulate. Since the text is a stream-output text, the time used to generate the text will also increase during the text accumulation process. After the time increases, the current text segmentation strategy will become other text segmentation strategies, and the terminal device can segment the accumulated text based on other text segmentation strategies. For example, the text segmentation strategy corresponding to the text is the first segmentation strategy. If there is no period in the text, the first segmentation strategy cannot segment the text. The terminal device can wait for a period of time until the first segmentation strategy becomes the second segmentation strategy, and then segment the currently output text based on the second segmentation strategy (since the text is a stream-output text, the text will increase during the waiting process).
[0084] For example, in Figure 5 In the illustrated embodiment, if the first segmentation strategy cannot segment text 1, then wait for text 1 to accumulate. After 1 second, text 1 becomes text 2, and the first segmentation strategy also becomes the second segmentation strategy. The terminal device can segment text 2 based on the second segmentation strategy. If the second segmentation strategy cannot segment text 2, then wait for text 2 to accumulate. After 1 second, text 2 becomes text 3, and the second segmentation strategy also becomes the third segmentation strategy. The terminal device can segment text 3 based on the third segmentation strategy.
[0085] Optionally, within the target time period, the terminal device may execute the text segmentation strategy multiple times to determine whether the text can be segmented. For example, since the text is a streamed output text, the text can continue to increase. Therefore, within the target time period, the terminal device may execute the text segmentation strategy multiple times to ensure the accuracy of text segmentation. Figure 5 In the illustrated embodiment, the terminal device executes the first segmentation strategy multiple times within 0 seconds to 1.5 seconds.
[0086] Optionally, after the terminal device segments the text, the first sentence text can be obtained. For example, after the terminal device segments the text based on the text segmentation strategy, two paragraphs of text can be obtained, and the terminal device can determine the first paragraph of text as the first sentence text. For example, the text is: Today's weather is really good, we can go out camping. If the terminal device segments the text at the position of the first comma, the text becomes text 1: Today's weather is really good, and text 2: We can go out camping. The terminal device can determine text 1 as the first sentence text of the text.
[0087] S204: Perform text-to-speech processing on the first sentence text to obtain the speech corresponding to the first sentence text.
[0088] Optionally, after the terminal device determines the first sentence of the text, it can process the first sentence of the text based on the text-to-speech technology to obtain the speech corresponding to the first sentence of the text. For example, if the first sentence of the text is "Today's weather is really good", the terminal device can obtain the speech "Today's weather is really good".
[0089] It should be noted that the terminal device can perform text-to-speech processing on the first sentence based on any feasible implementation method, and the embodiments of the present disclosure are not limited to this.
[0090] It should be noted that when the terminal device converts text to speech, it can add relevant timbre to the speech, thereby improving the effect of the speech.
[0091] The disclosed embodiment provides a text segmentation method, wherein a terminal device can obtain a text and the duration of generating the text, determine a target time period where the duration is located in a plurality of preset time periods, and determine a text segmentation strategy corresponding to the target time period, wherein the terminal device can determine the text segmentation strategy corresponding to the target time period as the text segmentation strategy associated with the text, and judge whether the text segmentation strategy can successfully segment the text, if so, segment the text based on the text segmentation strategy to obtain the first sentence text, if not, wait for the text to accumulate until other text segmentation strategies associated with the text are determined based on the duration, segment the text based on other text segmentation strategies to obtain the first sentence text, and the terminal device can perform text-to-speech processing on the first sentence text to obtain the speech corresponding to the first sentence text. In the above method, since the terminal device can flexibly determine the text segmentation strategy associated with the text based on the duration of generating the streaming text, the flexibility of the first sentence text segmentation is relatively high, and when the duration becomes active, the terminal device can obtain more text segmentation strategies, thereby improving the accuracy and reliability of the first sentence segmentation.
[0092] exist Figure 2 Based on the embodiment shown in the figure, the above text segmentation method also includes 4 text segmentation strategies, which are methods for segmenting text. Figure 6-Figure 13 , the above four text segmentation strategies and methods of text segmentation processing are explained.
[0093] Figure 6 A schematic diagram of a method for segmenting text provided in an embodiment of the present disclosure. Figure 6 In the illustrated embodiment, the text segmentation strategy is a first segmentation strategy, and the method flow includes:
[0094] S601: Determine a termination symbol or a separator symbol in the text.
[0095] Optionally, the termination symbol may include at least one of the following: a period, a question mark, and an exclamation mark. For example, if the text includes a period, the terminal device may determine that the text includes a termination symbol, and the termination symbol is a period; if the text includes a question mark, the terminal device may determine that the text includes a termination symbol, and the termination symbol is a question mark. Optionally, the separator may include a comma. For example, if the text includes a comma, the terminal device may determine that the text includes a separator.
[0096] It should be noted that the termination symbol and the separation symbol in the embodiment of the present disclosure may also be other punctuation marks, and the embodiment of the present disclosure is not limited to this.
[0097] It should be noted that the terminal device can determine the termination symbol and the separation symbol in the text based on any feasible implementation method, and the embodiments of the present disclosure are not limited to this.
[0098] S602: Segment the text based on the termination symbol or the separation symbol.
[0099] Optionally, the terminal device segments the text based on the termination symbol, which may be: determining the termination symbol in the text and segmenting the text at the position of the termination symbol. For example, if the text includes a period, the terminal device may segment the text at the position of the period; if the text includes a question mark, the terminal device may segment the text at the position of the question mark.
[0100] Next, combine Fig. 7A , the process of segmenting the text in this way is explained.
[0101] Fig. 7A A schematic diagram of a text segmentation process provided by an embodiment of the present disclosure. Fig. 7A , including text. The text content is: Today's weather is really good! We can go camping. Terminal device ( Fig. 7A (not shown) it can be determined that the text includes the exclamation mark, which is the terminating symbol. Therefore, when the terminal device executes the first segmentation strategy, the text can be segmented at the exclamation mark position to obtain text 1 and text 2, wherein text 1 is: Today's weather is so nice! Text 2 is: We can go camping, and text 1 is the first sentence text.
[0102] Optionally, the terminal device segments the text based on the separator, which may be specifically: determining the separator in the text, obtaining the number of text characters before the separator, and if the number of text characters before the separator is greater than or equal to a preset threshold, segmenting the text at the position of the separator. For example, if the text includes a comma, and the number of text characters before the comma is large, it means that the sentence before the comma is a complete sub-sentence, and the terminal device may segment the text at the position of the comma when executing the first segmentation strategy.
[0103] Next, combine Figure 7B , the process of text segmentation is explained.
[0104] Figure 7B Another text segmentation process diagram provided by the present disclosure embodiment. Figure 7B , including text. The text content is: Oh, today's weather is really good, we can go out camping. Terminal device ( Figure 7B(not shown) It can be determined that the text includes two commas. Therefore, when the terminal device executes the first segmentation strategy, the text can be segmented at the comma position. However, since the text before the first comma is "Oops", the text characters are shorter. Therefore, the terminal device will not segment the text at the first comma position. Since the number of text characters before the second comma is larger, the terminal device can segment the text at the second comma position to obtain text 1 and text 2, wherein text 1 is: Oh, the weather is so nice today, text 2 is: We can go camping, and text 1 is the first sentence text.
[0105] The disclosed embodiment provides a method for segmenting a text, which determines a termination symbol in the text and segments the text at the position of the termination symbol, or determines a separator symbol in the text, obtains the number of text characters before the separator symbol, and if the number of text characters before the separator symbol is greater than or equal to a preset threshold, segments the text at the position of the separator symbol. In this way, when the terminal device can execute the first segmentation strategy, the terminal device can segment a complete sentence or a complete sub-sentence in the text, thereby improving the accuracy of the first sentence segmentation.
[0106] Figure 8 A schematic diagram of another method for segmenting text provided in an embodiment of the present disclosure. Figure 8 In the illustrated embodiment, the text segmentation strategy is the second segmentation strategy, and the method flow includes:
[0107] S801: Determine whether the text includes a termination symbol or a target sentence, and obtain a determination result.
[0108] Optionally, when executing the second segmentation strategy, the terminal device can execute the first segmentation strategy in parallel, so that the terminal device can determine whether the text includes a termination symbol and a target sentence, wherein the target sentence can be a sentence in which the number of text characters before the separator is greater than or equal to a preset threshold.
[0109] It should be noted that the terminal device can determine whether the text includes a termination symbol or a target sentence based on any feasible implementation method, and the embodiments of the present disclosure are not limited to this.
[0110] S802: Segment the text based on the judgment result.
[0111] The terminal device segments the text in the following two situations:
[0112] Case 1: There is a terminal symbol in the text, or there is a target sentence in the text.
[0113] If there is a termination symbol in the text, or there is a sentence in which the number of text characters before the separation symbol is greater than or equal to a preset threshold, the terminal device can segment the text at the position of the termination symbol or the position of the separation symbol.
[0114] It should be noted that the method of segmenting text in case 1 can refer to Figure 6 The embodiments shown are described in detail, and the embodiments of the present disclosure will not be described in detail here.
[0115] Case 2: There is no terminal symbol in the text, and there is no target sentence in the text.
[0116] If there is no termination symbol in the text, and there is no sentence in the text in which the number of text characters before the separator is greater than or equal to a preset threshold, the terminal device can segment the text at the end of the last clause in the text. For example, if there is no termination symbol in the text, and there is no target sentence, it means that the terminal device cannot segment the text based on the termination symbol or the end of the target sentence, and the terminal device can execute in parallel a solution to segment the text at the end of the last clause in the text. For example, the end of the last clause in the text can be a comma, a colon, etc., which is not limited in the embodiments of the present disclosure.
[0117] It should be noted that the terminal device can process the text based on a preset clause determination model to obtain the end of the last clause. For example, the clause determination model can be a model trained on multiple groups of samples, where the multiple groups of samples can include multiple sample texts and clause segmentation points in each sample text, so that the clause determination model can accurately determine the position of the end of the last clause of the text.
[0118] It should be noted that the terminal device may also determine the position of the end of the last clause in the text based on any feasible implementation method, and the embodiments of the present disclosure are not limited to this.
[0119] Next, combine Fig. 9 , in this case, the process of segmenting the text is explained.
[0120] Fig. 9 Another text segmentation process diagram provided by the present disclosure embodiment. Fig. 9 , including text. The text content is: I like sports, such as running and. If the preset threshold is 10, the terminal device ( Fig. 9 (Not shown) it is determined that there is no termination symbol and no target sentence in the text, and the terminal device can segment the text at the position of the last comma to obtain text 1 and text 2, where text 1 is: I like sports, and text 2 is: such as running and.
[0121] The disclosed embodiment provides a method for segmenting a text, which determines whether the text includes a termination symbol or a target sentence, and obtains a determination result. If the text includes a termination symbol, or if the text includes a sentence in which the number of text characters before the separator symbol is greater than or equal to a preset threshold, the terminal device can segment the text at the position of the termination symbol or the position of the separator symbol. If the text does not include a termination symbol, and if the text does not include a sentence in which the number of text characters before the separator symbol is greater than or equal to the preset threshold, the terminal device can segment the text at the position of the last separator symbol in the text. In this way, when the target time period is the second time period, the terminal device can segment the text not only based on the termination symbol and the end of the target sentence, but also based on the last separator symbol, thereby improving the success rate of text segmentation, avoiding users from waiting for a long time, improving user experience, and improving the accuracy of text segmentation.
[0122] Fig.10 A schematic diagram of another method for segmenting text provided in an embodiment of the present disclosure. Fig.10 In the embodiment shown, the text segmentation strategy is the third segmentation strategy, and the method flow includes:
[0123] S1001. If there is a termination symbol in the text, or if there is a sentence in the text in which the number of text characters before the separation symbol is greater than or equal to a preset threshold, the text is segmented at the position of the termination symbol or the position of the separation symbol.
[0124] It should be noted that step S1001 may refer to the method in the above embodiment, and will not be described in detail in the embodiment of the present disclosure.
[0125] S1002: If there is no termination symbol in the text, and there is no sentence in the text in which the number of text characters before the separation symbol is greater than or equal to a preset threshold, the text is segmented at the end of the last phrase in the text.
[0126] Optionally, the last phrase can be the last phrase in the text. For example, if the text is: Today's weather is good, then the last phrase in the text is weather; if the text is: I like sports, such as running and, then the last phrase in the text is running.
[0127] It should be noted that the terminal device can process the text based on the pre-trained phrase segmentation model to obtain the end of the last phrase. For example, the phrase segmentation model can be a model trained on multiple groups of samples, where the multiple groups of samples can include multiple sample texts and sample phrase segmentation points in each sample text. In this way, after the phrase segmentation model is trained, the position of the end of the last phrase of the text can be accurately determined.
[0128] It should be noted that the terminal device can determine the last phrase in the text based on any feasible implementation method, and the embodiments of the present disclosure are not limited to this.
[0129] After the terminal device determines the last phrase in the text, it can segment the text at the end of the last phrase in the text. For example, if the text is: Today's weather is true, the terminal device can segment the text at the position of weather to obtain text: Today's weather and text: true.
[0130] Next, combine Fig.11 , in this case, the process of segmenting the text is explained.
[0131] Fig.11 Another text segmentation process diagram provided by the present disclosure embodiment. Fig.11 , including text. The text content is: I like sports, such as running, climbing and swimming. If the preset threshold is 10, the terminal device ( Fig.11 (not shown) It can be determined that there is no termination symbol in the text, nor a sentence in which the number of text characters before the separator is greater than or equal to 10. Therefore, the terminal device can determine the last phrase in the text, where the last phrase is: mountain climbing. The terminal device can segment the text at the position of the last phrase to obtain text 1 and text 2, where text 1 is: I like sports, such as running and mountain climbing, and text 2 is: and swimming.
[0132] The disclosed embodiment provides a method for segmenting a text, when the target time period is the third time period, the text segmentation strategy is the third segmentation strategy, if there is no termination symbol in the text, and there is no sentence in the text in which the number of text characters before the separation symbol is greater than or equal to a preset threshold, then the text is segmented at the end of the last phrase in the text, if there is no termination symbol in the text, and there is no sentence in the text in which the number of text characters before the separation symbol is greater than or equal to a preset threshold, then the text is segmented at the end of the last phrase in the text. In this way, when the target time period is the third time period, the terminal device can not only segment the text based on the termination symbol and the end of the target sentence, but also segment the text based on the last phrase, and the flexibility of text segmentation is high, which avoids users from waiting for a long time, improves the user experience, and can also improve the accuracy of text segmentation.
[0133] Fig.12 A schematic diagram of another method for segmenting text provided in an embodiment of the present disclosure. Fig.12 In the illustrated embodiment, the text segmentation strategy is the fourth segmentation strategy, and the method flow may include:
[0134] S1201: Execute the third segmentation strategy.
[0135] It should be noted that the execution process of step S1201 may refer to the method in the above embodiment, and will not be described in detail in the embodiment of the present disclosure.
[0136] S1202: If the third segmentation strategy cannot segment the text, segment the text at the end of the text.
[0137] Optionally, if the third segmentation strategy cannot segment the text, it means that no reasonable sentence can be segmented in the text within the fourth time period, so the terminal device can segment the text at the end of the text, that is, determine all the text as the first sentence text. For example, if the time used to generate the text is within the fourth time period, it means that the terminal device cannot segment the text based on the first segmentation strategy, the second segmentation strategy, and the third segmentation strategy, so the terminal device can determine all the text as the first sentence text.
[0138] Next, combine Fig.13 , the process of text segmentation in this scenario is explained.
[0139] Fig.13 A schematic diagram of a text segmentation method provided by an embodiment of the present disclosure. Fig.13 , including text. The text content is: Hello. If the preset threshold is 10, the terminal device ( Fig.13(not shown) It can be determined that there is no termination symbol, no target sentence, and no phrase in the text. Therefore, in the fourth time period, the terminal device can directly output the text to obtain the first sentence text: Hello.
[0140] The embodiment of the present disclosure provides a method for segmenting text. In the fourth time period, the terminal device can execute the third segmentation strategy. If the third segmentation strategy cannot segment the text, the text is segmented at the end of the text. In this way, the terminal device can ensure the output of the first sentence text based on the fourth segmentation strategy, thereby improving the stability and reliability of text-to-speech processing.
[0141] Fig.14 This is a structural diagram of a text segmentation device provided by an embodiment of the present disclosure. Fig.14 The text segmentation device 140 includes an acquisition module 141, a determination module 142, a segmentation module 143 and a processing module 144, wherein:
[0142] The acquisition module 141 is used to acquire text and the time duration of generating the text;
[0143] The determination module 142 is used to determine a text segmentation strategy associated with the text based on the duration;
[0144] The segmentation module 143 is used to segment the text based on the text segmentation strategy to obtain the first sentence text of the text;
[0145] The processing module 144 is used to perform text-to-speech processing on the first sentence text to obtain the speech corresponding to the first sentence text.
[0146] According to one or more embodiments of the present disclosure, the determination module 142 is specifically configured to:
[0147] Determine a target time period in which the duration lies among a plurality of preset time periods;
[0148] Determine a text segmentation strategy corresponding to the target time period;
[0149] The text segmentation strategy corresponding to the target time period is determined as the text segmentation strategy associated with the text.
[0150] According to one or more embodiments of the present disclosure, the determination module 142 is specifically configured to:
[0151] If the target time period is the first time period, determining the text segmentation strategy to be the first segmentation strategy;
[0152] If the target time period is the second time period, determining the text segmentation strategy to be the second segmentation strategy;
[0153] If the target time period is the third time period, determining the text segmentation strategy to be the third segmentation strategy;
[0154] If the target time period is the fourth time period, determining the text segmentation strategy to be the fourth segmentation strategy;
[0155] The first time period is smaller than the second time period, the second time period is smaller than the third time period, and the third time period is smaller than the fourth time period.
[0156] According to one or more embodiments of the present disclosure, the segmentation module 143 is specifically used to:
[0157] Determining whether the text segmentation strategy associated with the text can successfully segment the text;
[0158] If yes, segment the text based on the text segmentation strategy;
[0159] If not, wait for the text to be accumulated until other text segmentation strategies associated with the text are determined based on the duration, and then segment the text based on the other text segmentation strategies.
[0160] According to one or more embodiments of the present disclosure, the segmentation module 143 is specifically used to:
[0161] Determine a termination symbol in the text, wherein the termination symbol includes at least one of the following: a period, a question mark, and an exclamation mark;
[0162] The text is segmented at the position of the termination symbol.
[0163] According to one or more embodiments of the present disclosure, the segmentation module 143 is specifically used to:
[0164] determining a delimiter symbol in the text;
[0165] Get the number of text characters before the separator;
[0166] If the number of text characters before the separator is greater than or equal to a preset threshold, the text is segmented at the position of the separator.
[0167] According to one or more embodiments of the present disclosure, the segmentation module 143 is specifically used to:
[0168] If the termination symbol exists in the text, or if there is a sentence in the text in which the number of text characters before the separation symbol is greater than or equal to the preset threshold, segmenting the text at the position of the termination symbol or the position of the separation symbol;
[0169] If the termination symbol does not exist in the text, and there is no sentence in the text in which the number of text characters before the separation symbol is greater than or equal to the preset threshold, the text is segmented at the end of the last clause in the text.
[0170] According to one or more embodiments of the present disclosure, the segmentation module 143 is specifically used to:
[0171] If the termination symbol exists in the text, or if there is a sentence in the text in which the number of text characters before the separation symbol is greater than or equal to the preset threshold, segmenting the text at the position of the termination symbol or the position of the separation symbol;
[0172] If the termination symbol does not exist in the text, and there is no sentence in the text in which the number of text characters before the separation symbol is greater than or equal to the preset threshold, the text is segmented at the end of the last phrase in the text.
[0173] According to one or more embodiments of the present disclosure, the segmentation module 143 is specifically used to:
[0174] Execute the third segmentation strategy;
[0175] If the third segmentation strategy cannot segment the text, the text is segmented at the end of the text.
[0176] The text segmentation device provided in this embodiment can be used to execute the technical solution of the above-mentioned method embodiment. Its implementation principle and technical effect are similar, and this embodiment will not be repeated here.
[0177] Fig.15 This is a schematic diagram of the structure of a terminal device provided by an embodiment of the present disclosure. Fig.15 , which shows a schematic diagram of the structure of a terminal device 1500 suitable for implementing the embodiments of the present disclosure. The terminal device may include but is not limited to mobile terminals such as mobile phones, laptop computers, digital broadcast receivers, personal digital assistants (PDAs), tablet computers (Portable Android Devices, PADs), portable multimedia players (Portable Media Players, PMPs), vehicle terminals (such as vehicle navigation terminals), etc., and fixed terminals such as digital TVs, desktop computers, etc. Fig.15 The terminal device shown is merely an example and should not bring any limitation to the functions and scope of use of the embodiments of the present disclosure.
[0178] like Fig.15As shown, the terminal device 1500 may include a processing device (e.g., a central processing unit, a graphics processing unit, etc.) 1501, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 1502 or a program loaded from a storage device 1508 to a random access memory (RAM) 1503. Various programs and data required for the operation of the terminal device 1500 are also stored in the RAM 1503. The processing device 1501, the ROM 1502, and the RAM 1503 are connected to each other via a bus 1504. An input / output (I / O) interface 1505 is also connected to the bus 1504.
[0179] Typically, the following devices may be connected to the I / O interface 1505: input devices 1506 including, for example, a touch screen, a touch pad, a keyboard, a mouse, a camera, a microphone, an accelerometer, a gyroscope, etc.; output devices 1507 including, for example, a liquid crystal display (LCD), a speaker, a vibrator, etc.; storage devices 1508 including, for example, a magnetic tape, a hard disk, etc.; and communication devices 1509. The communication devices 1509 may allow the terminal device 1500 to communicate with other devices wirelessly or by wire to exchange data. Although Fig.15 The terminal device 1500 is shown as having various devices, but it should be understood that it is not required to implement or possess all the devices shown. More or fewer devices may be implemented or possessed instead.
[0180] In particular, according to an embodiment of the present disclosure, the process described above with reference to the flowchart can be implemented as a computer software program. For example, an embodiment of the present disclosure includes a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program contains program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from a network through a communication device 1509, or installed from a storage device 1508, or installed from a ROM 1502. When the computer program is executed by the processing device 1501, the above-mentioned functions defined in the method of the embodiment of the present disclosure are executed.
[0181] It should be noted that the computer-readable medium disclosed above may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present disclosure, a computer-readable storage medium may be any tangible medium containing or storing a program that may be used by or in combination with an instruction execution system, device or device. In the present disclosure, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, in which a computer-readable program code is carried. This propagated data signal may take a variety of forms, including but not limited to an electromagnetic signal, an optical signal, or any suitable combination of the above. The computer readable signal medium may also be any computer readable medium other than a computer readable storage medium, which may send, propagate or transmit a program for use by or in conjunction with an instruction execution system, apparatus or device. The program code contained on the computer readable medium may be transmitted using any suitable medium, including but not limited to: wires, optical cables, RF (radio frequency), etc., or any suitable combination of the above.
[0182] The computer-readable medium may be included in the terminal device, or may exist independently without being installed in the terminal device.
[0183] The computer-readable medium carries one or more programs. When the one or more programs are executed by the terminal device, the terminal device executes the method shown in the above embodiment.
[0184] An embodiment of the present disclosure provides a computer-readable storage medium, in which computer-executable instructions are stored. When a processor executes the computer-executable instructions, various methods that may be involved in the above embodiments are implemented.
[0185] An embodiment of the present disclosure provides a computer program product, including a computer program, which implements various methods that may be involved in the above embodiments when executed by a processor.
[0186] Computer program code for performing the operations of the present disclosure may be written in one or more programming languages or a combination thereof, including object-oriented programming languages, such as Java, Smalltalk, C++, and conventional procedural programming languages, such as "C" or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, as an independent software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer via any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., via the Internet using an Internet service provider).
[0187] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present disclosure. In this regard, each square box in the flow chart or block diagram can represent a module, a program segment or a part of a code, and the module, the program segment or a part of the code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some implementations as replacements, the functions marked in the square box can also occur in a sequence different from that marked in the accompanying drawings. For example, two square boxes represented in succession 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 a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0188] The units involved in the embodiments described in the present disclosure may be implemented by software or hardware. The name of a unit does not limit the unit itself in some cases. For example, the first acquisition unit may also be described as a "unit for acquiring at least two Internet Protocol addresses".
[0189] The functions described above herein may be performed at least in part by one or more hardware logic components. For example, without limitation, exemplary types of hardware logic components that may be used include: field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), complex programmable logic devices (CPLDs), and the like.
[0190] In the context of the present disclosure, a machine-readable medium may be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, device, or equipment. A machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or equipment, or any suitable combination of the foregoing. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
[0191] It should be noted that the modifications of "one" and "plurality" mentioned in the present disclosure are illustrative rather than restrictive, and those skilled in the art should understand that unless otherwise clearly indicated in the context, it should be understood as "one or more".
[0192] The names of the messages or information exchanged between multiple devices in the embodiments of the present disclosure are only used for illustrative purposes and are not used to limit the scope of these messages or information.
[0193] It is understandable that before using the technical solutions disclosed in the embodiments of the present disclosure, the types, scope of use, usage scenarios, etc. of the personal information involved in the present disclosure should be informed to the user and the user's authorization should be obtained in an appropriate manner in accordance with relevant laws and regulations.
[0194] For example, in response to receiving an active request from a user, a prompt message is sent to the user to clearly prompt the user that the operation requested to be performed will require obtaining and using the user's personal information. Thus, the user can independently choose whether to provide personal information to software or hardware such as a terminal device, application, server, or storage medium that performs the operation of the technical solution of the present disclosure based on the prompt message. As an optional but non-limiting implementation method, in response to receiving an active request from a user, the method of sending a prompt message to the user can be, for example, a pop-up window, and the prompt message can be presented in text form in the pop-up window. In addition, the pop-up window can also carry a selection control for the user to choose "agree" or "disagree" to provide personal information to the terminal device.
[0195] It is understandable that the above notification and the process of obtaining user authorization are merely illustrative and do not constitute a limitation on the implementation of the present disclosure. Other methods that meet the relevant laws and regulations may also be applied to the implementation of the present disclosure.
[0196] It is understood that the data involved in this technical solution (including but not limited to the data itself, the acquisition or use of the data) shall comply with the requirements of the relevant laws and regulations. The data may include information, parameters and messages, such as flow switching indication information.
[0197] The above description is only a preferred embodiment of the present disclosure and an explanation of the technical principles used. Those skilled in the art should understand that the scope of disclosure involved in the present disclosure is not limited to the technical solutions formed by a specific combination of the above technical features, but should also cover other technical solutions formed by any combination of the above technical features or their equivalent features without departing from the above disclosed concept. For example, the above features are replaced with the technical features with similar functions disclosed in the present disclosure (but not limited to) by each other to form a technical solution.
[0198] In addition, although each operation is described in a specific order, this should not be understood as requiring these operations to be performed in the specific order shown or in a sequential order. Under certain circumstances, multitasking and parallel processing may be advantageous. Similarly, although some specific implementation details are included in the above discussion, these should not be interpreted as limiting the scope of the present disclosure. Some features described in the context of a separate embodiment can also be implemented in a single embodiment in combination. On the contrary, the various features described in the context of a single embodiment can also be implemented in multiple embodiments individually or in any suitable sub-combination mode.
[0199] Although the subject matter has been described in language specific to structural features and / or methodological logical actions, it should be understood that the subject matter defined in the appended claims is not necessarily limited to the specific features or actions described above. On the contrary, the specific features and actions described above are merely example forms of implementing the claims.
Claims
1. A text segmentation method, characterized in that: include: Obtaining text and the duration of generating the text; Based on the duration, determining a text segmentation strategy associated with the text; Based on the text segmentation strategy, segment the text to obtain the first sentence of the text; The first sentence text is subjected to text-to-speech processing to obtain the speech corresponding to the first sentence text.
2. The method according to claim 1, characterized in that: The determining, based on the duration, a text segmentation strategy associated with the text includes: Determine a target time period in which the duration lies among a plurality of preset time periods; Determine a text segmentation strategy corresponding to the target time period; The text segmentation strategy corresponding to the target time period is determined as the text segmentation strategy associated with the text.
3. The method according to claim 2, characterized in that The determining of the text segmentation strategy corresponding to the target time period includes: If the target time period is the first time period, determining the text segmentation strategy to be the first segmentation strategy; If the target time period is the second time period, determining the text segmentation strategy to be the second segmentation strategy; If the target time period is the third time period, determining the text segmentation strategy to be the third segmentation strategy; If the target time period is the fourth time period, determining the text segmentation strategy to be the fourth segmentation strategy; The first time period is smaller than the second time period, the second time period is smaller than the third time period, and the third time period is smaller than the fourth time period.
4. The method according to any one of claims 1 to 3, characterized in that: The text segmentation based on the text segmentation strategy includes: Determining whether the text segmentation strategy associated with the text can successfully segment the text; If yes, segment the text based on the text segmentation strategy; If not, wait for the text to be accumulated until other text segmentation strategies associated with the text are determined based on the duration, and then segment the text based on the other text segmentation strategies.
5. The method according to any one of claims 1 to 3, characterized in that: The text segmentation strategy is a first segmentation strategy; segmenting the text includes: Determine a termination symbol in the text, wherein the termination symbol includes at least one of the following: a period, a question mark, and an exclamation mark; The text is segmented at the position of the termination symbol.
6. The method according to any one of claims 1 to 3, characterized in that: The text segmentation strategy is a first segmentation strategy; segmenting the text includes: determining a delimiter symbol in the text; Get the number of text characters before the separator; If the number of text characters before the separator is greater than or equal to a preset threshold, the text is segmented at the position of the separator.
7. The method according to any one of claims 1 to 3, characterized in that: The text segmentation strategy is a second segmentation strategy; segmenting the text includes: If there is a termination symbol in the text, or there is a sentence in the text in which the number of text characters before the separation symbol is greater than or equal to the preset threshold, the text is segmented at the position of the termination symbol or the position of the separation symbol; If the termination symbol does not exist in the text, and there is no sentence in the text in which the number of text characters before the separation symbol is greater than or equal to the preset threshold, the text is segmented at the end of the last clause in the text.
8. The method according to any one of claims 1 to 3, characterized in that: The text segmentation strategy is a third segmentation strategy, and segmenting the text includes: If there is a termination symbol in the text, or there is a sentence in the text in which the number of text characters before the separation symbol is greater than or equal to the preset threshold, the text is segmented at the position of the termination symbol or the position of the separation symbol; If the termination symbol does not exist in the text, and there is no sentence in the text in which the number of text characters before the separation symbol is greater than or equal to the preset threshold, the text is segmented at the end of the last phrase in the text.
9. The method according to claim 3, characterized in that: The text segmentation strategy is a fourth segmentation strategy, and segmenting the text includes: Execute the third segmentation strategy; If the third segmentation strategy cannot segment the text, the text is segmented at the end of the text.
10. A text segmentation device, characterized in that: It includes an acquisition module, a determination module, a segmentation module and a processing module, among which: The acquisition module is used to acquire text and the time length of generating the text; The determination module is used to determine a text segmentation strategy associated with the text based on the duration; The segmentation module is used to segment the text based on the text segmentation strategy to obtain the first sentence text of the text; The processing module is used to perform text-to-speech processing on the first sentence text to obtain the speech corresponding to the first sentence text.
11. A terminal device, characterized in that: include: Processor and memory; The memory stores computer-executable instructions; The processor executes the computer-executable instructions stored in the memory, so that the processor executes the text segmentation method according to any one of claims 1 to 9.
12. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer-executable instructions. When the processor executes the computer-executable instructions, the text segmentation method according to any one of claims 1 to 9 is implemented.
Citation Information
Cited By
Text processing method and device
CN120913538A
Navigation voice online generation method and device, electronic equipment and storage medium
CN121506086A