Method for text processing, computer device, and storage medium
Abstract
A method for text processing, a computer device, and a storage medium are provided. The method includes: acquiring a first text and a second text which are to be compared, the first text being a text obtained after text conversion processing is carried out on a dubbed audio corresponding to the second text by an artificial intelligence model; segmenting the first text to obtain a plurality of first text segments; segmenting the second text to obtain a plurality of initial second text segments; for each first text segment in the first text, sequentially determining a target second text segment that is subjected to an enhancement processing and matched with the first text segment; and based on a plurality of target second text segments respectively matched with the plurality of first text segments in the first text, determining a text matching result of the first text and the second text.
Claims
exact text as granted — not AI-modified1 . A method for text processing, comprising:
acquiring a first text and a second text which are to be compared, wherein the first text is a text obtained after text conversion processing is carried out on a dubbed audio corresponding to the second text by an artificial intelligence model; segmenting the first text to obtain a plurality of first text segments; segmenting the second text to obtain a plurality of initial second text segments, wherein a content length of a first text segment is greater than a content length of an initial second text segment; sequentially determining, for each first text segment in the first text, a target second text segment that is subjected to an enhancement processing and matched with the first text segment, wherein the enhancement processing refers to movement processing carried out on an endpoint position of an initial second text segment as a processing target in the second text; and determining, based on a plurality of target second text segments respectively matched with the plurality of first text segments in the first text, a text matching result of the first text and the second text, wherein the text matching result is used for positioning to a corresponding first text segment, based on a second text segment corresponding to a current dubbed content, in a process of playing the dubbed audio and synchronously displaying the first text.
2 . The method according to claim 1 , wherein the sequentially determining, for each first text segment in the first text, a target second text segment that is subjected to an enhancement processing and matched with the first text segment comprises:
sequentially determining, according to a logical sequence of each first text segment in the first text, the target second text segment that is subjected to the enhancement processing and matched with the first text segment according to steps as follows:
determining an initial second text segment to be matched with the first text segment;
carrying out the enhancement processing on the initial second text segment to obtain an enhanced second text segment corresponding to the initial second text segment; and
using, in response to a similarity between the enhanced second text segment and the first text segment being greater than a first set threshold, the enhanced second text segment as the target second text segment matched with the first text segment, and repeatedly executing, in response to the similarity between the enhanced second text segment and the first text segment being smaller than or equal to the first set threshold, a step of determining the initial second text segment to be matched with the first text segment, until the target second text segment that is subjected to an enhancement processing and matched with the first text segment is determined.
3 . The method according to claim 2 , wherein the carrying out the enhancement processing on the initial second text segment to obtain an enhanced second text segment corresponding to the initial second text segment comprises:
carrying out a plurality of first movement processing on a first endpoint position of the initial second text segment in the second text to obtain a first enhanced text segment, wherein the first enhanced text segment is an enhanced text segment with a highest similarity with the first text segment, which is obtained after the plurality of first movement processing is carried out on the first endpoint position; carrying out a plurality of second movement processing on a second endpoint position of the first enhanced text segment in the second text to obtain a second enhanced text segment, wherein the second enhanced text segment is an enhanced text segment with a highest similarity with the first text segment, which is obtained after the plurality of second movement processing is carried out on the second enhanced text segment; and using, in response to the similarity between the second enhanced text segment and the first text segment being greater than or equal to a second set threshold, the second enhanced text segment as the enhanced second text segment.
4 . The method according to claim 3 , wherein the first endpoint position is a right endpoint position of the initial second text segment, and compared to a left endpoint position, the right endpoint position is farther away from an initial position of the second text; and
the carrying out a plurality of first movement processing on a first endpoint position of the initial second text segment in the second text to obtain a first enhanced text segment comprises:
moving, according to a preset movement length added value, the right endpoint position of the initial second text segment to be matched rightwards by N times to obtain N first candidate text segments corresponding to the initial second text segment to be matched, wherein a difference between a content length of an N th first candidate text segment and a content length of an N-1 th first candidate text segment is equal to the preset movement length added value, and N is a positive integer greater than or equal to 2;
determining a second candidate text segment with a highest similarity with the first text segment in the N first candidate text segments;
moving, according to a target movement length, a right endpoint position of the second candidate text segment respectively leftwards and rightwards to obtain a third candidate text segment and a fourth candidate text segment; determining a target candidate text segment with a highest similarity with the first text segment among the second candidate text segment, the third candidate text segment, and the fourth candidate text segment;
determining, according to a movement length reduction coefficient and the target movement length, an updated target movement length when a right endpoint position of the target candidate text segment is respectively moved leftwards and rightwards; and
moving, in response to the target movement length being a positive integer, the right endpoint position of the target candidate text segment respectively leftwards and rightwards to obtain a new target candidate text segment according to the target movement length, repeatedly executing a step of according to the movement length reduction coefficient and the target movement length, determining the target movement length used when a right endpoint position of the target candidate text segment is respectively moved leftwards and rightwards, until the target movement length determined is a non-positive integer, and using the target candidate text segment obtained after last respective leftward and rightward movements as the first enhanced text segment.
5 . The method according to claim 3 , after the determining the target second text segment that is subjected to an enhancement processing and matched with the first text segment, further comprising:
determining a third text segment failed in matching in the first text; executing, for each third text segment, a step of determining an initial second text segment to be matched; using, in response to a similarity between the obtained enhanced second text segment and the third text segment being greater than a third set threshold, the enhanced second text segment as a target second text segment matched with the third text segment; and repeatedly executing, in response to the similarity between the enhanced second text segment and the third text segment being smaller than or equal to the third set threshold, a step of determining the initial second text segment to be matched, until the target second text segment that is subjected to the enhancement processing and matched with the third text segment is determined, wherein the third set threshold is smaller than the second set threshold.
6 . The method according to claim 2 , wherein the determining an initial second text segment to be matched comprises:
determining a matched text in the second text; and using a text segment positioned behind an end of the matched text as the initial second text segment to be matched.
7 . The method according to claim 2 , wherein whether the similarity between the enhanced second text segment and the first text segment is greater than the first set threshold is determined by:
determining a first pinyin unit corresponding to each word in the enhanced second text segment and a second pinyin unit corresponding to each word in the first text segment; and determining, according to a similarity between each first pinyin unit and each second pinyin unit, whether the similarity between the enhanced second text segment and the first text segment is greater than the first set threshold.
8 . The method according to claim 1 , after the determining a text matching result of the first text and the second text, further comprising:
playing, in response to a playing triggering operation for the second text, the dubbed audio corresponding to the second text; determining, according to the second text segment corresponding to the current dubbed content and the text matching result, a first text segment corresponding to the second text segment; and synchronously displaying positioning to the determined first text segment of the first text in the process of playing the dubbed audio.
9 . A computer device, comprising: at least one processor and at least one storage, wherein the at least one storage stores machine-readable instructions executable by the at least one processor; the at least one processor communicates with the at least one storage upon running of the computer device, and the machine-readable instructions, upon being executed by the at least one processor implements a method for text processing, and the method comprises:
acquiring a first text and a second text which are to be compared, wherein the first text is a text obtained after text conversion processing is carried out on a dubbed audio corresponding to the second text by an artificial intelligence model; segmenting the first text to obtain a plurality of first text segments; segmenting the second text to obtain a plurality of initial second text segments, wherein a content length of a first text segment is greater than a content length of an initial second text segment; sequentially determining, for each first text segment in the first text, a target second text segment that is subjected to an enhancement processing and matched with the first text segment, wherein the enhancement processing refers to movement processing carried out on an endpoint position of an initial second text segment as a processing target in the second text; and determining, based on a plurality of target second text segments respectively matched with the plurality of first text segments in the first text, a text matching result of the first text and the second text, wherein the text matching result is used for positioning to a corresponding first text segment, based on a second text segment corresponding to a current dubbed content, in a process of playing the dubbed audio and synchronously displaying the first text
10 . The computer device according to claim 9 , wherein the sequentially determining, for each first text segment in the first text, a target second text segment that is subjected to an enhancement processing and matched with the first text segment comprises:
sequentially determining, according to a logical sequence of each first text segment in the first text, the target second text segment that is subjected to the enhancement processing and matched with the first text segment according to steps as follows:
determining an initial second text segment to be matched with the first text segment;
carrying out the enhancement processing on the initial second text segment to obtain an enhanced second text segment corresponding to the initial second text segment; and
using, in response to a similarity between the enhanced second text segment and the first text segment being greater than a first set threshold, the enhanced second text segment as the target second text segment matched with the first text segment, and repeatedly executing, in response to the similarity between the enhanced second text segment and the first text segment being smaller than or equal to the first set threshold, a step of determining the initial second text segment to be matched with the first text segment, until the target second text segment that is subjected to the enhancement processing and matched with the first text segment is determined.
11 . The computer device according to claim 10 , wherein the carrying out the enhancement processing on the initial second text segment to obtain an enhanced second text segment corresponding to the initial second text segment comprises:
carrying out a plurality of first movement processing on a first endpoint position of the initial second text segment in the second text to obtain a first enhanced text segment, wherein the first enhanced text segment is an enhanced text segment with a highest similarity with the first text segment, which is obtained after the plurality of first movement processing is carried out on the first endpoint position; carrying out a plurality of second movement processing on a second endpoint position of the first enhanced text segment in the second text to obtain a second enhanced text segment, wherein the second enhanced text segment is an enhanced text segment with a highest similarity with the first text segment, which is obtained after the plurality of second movement processing is carried out on the second enhanced text segment; and using, in response to the similarity between the second enhanced text segment and the first text segment being greater than or equal to a second set threshold, the second enhanced text segment as the enhanced second text segment.
12 . The computer device according to claim 11 , wherein the first endpoint position is a right endpoint position of the initial second text segment, and compared to a left endpoint position, the right endpoint position is farther away from an initial position of the second text; and
the carrying out a plurality of first movement processing on a first endpoint position of the initial second text segment in the second text to obtain a first enhanced text segment comprises:
moving, according to a preset movement length added value, the right endpoint position of the initial second text segment to be matched rightwards by N times to obtain N first candidate text segments corresponding to the initial second text segment to be matched, wherein a difference between a content length of an N th first candidate text segment and a content length of an N-1 th first candidate text segment is equal to the preset movement length added value, and N is a positive integer greater than or equal to 2;
determining a second candidate text segment with a highest similarity with the first text segment in the N first candidate text segments;
moving, according to a target movement length, a right endpoint position of the second candidate text segment respectively leftwards and rightwards to obtain a third candidate text segment and a fourth candidate text segment; determining a target candidate text segment with a highest similarity with the first text segment among the second candidate text segment, the third candidate text segment, and the fourth candidate text segment;
determining, according to a movement length reduction coefficient and the target movement length, an updated target movement length when a right endpoint position of the target candidate text segment is respectively moved leftwards and rightwards; and
moving, in response to the target movement length being a positive integer, the right endpoint position of the target candidate text segment respectively leftwards and rightwards to obtain a new target candidate text segment according to the target movement length, repeatedly executing a step of according to the movement length reduction coefficient and the target movement length, determining the target movement length used when a right endpoint position of the target candidate text segment is respectively moved leftwards and rightwards, until the target movement length determined is a non-positive integer, and using the target candidate text segment obtained after last respective leftward and rightward movements as the first enhanced text segment.
13 . The computer device according to claim 11 , after the determining the target second text segment that is subjected to an enhancement processing and matched with the first text segment, further comprising:
determining a third text segment failed in matching in the first text; executing, for each third text segment, a step of determining an initial second text segment to be matched; using, in response to a similarity between the obtained enhanced second text segment and the third text segment being greater than a third set threshold, the enhanced second text segment as a target second text segment matched with the third text segment; and repeatedly executing, in response to the similarity between the enhanced second text segment and the third text segment being smaller than or equal to the third set threshold, a step of determining the initial second text segment to be matched, until the target second text segment that is subjected to the enhancement processing and matched with the third text segment is determined, wherein the third set threshold is smaller than the second set threshold.
14 . The computer device according to claim 10 , wherein the determining an initial second text segment to be matched comprises:
determining a matched text in the second text; and using a text segment positioned behind an end of the matched text as the initial second text segment to be matched.
15 . The computer device according to claim 10 , wherein whether the similarity between the enhanced second text segment and the first text segment is greater than the first set threshold is determined by:
determining a first pinyin unit corresponding to each word in the enhanced second text segment and a second pinyin unit corresponding to each word in the first text segment; and determining, according to a similarity between each first pinyin unit and each second pinyin unit, whether the similarity between the enhanced second text segment and the first text segment is greater than the first set threshold.
16 . The computer device according to claim 9 , after the determining a text matching result of the first text and the second text, further comprising:
playing, in response to a playing triggering operation for the second text, the dubbed audio corresponding to the second text; determining, according to the second text segment corresponding to the current dubbed content and the text matching result, a first text segment corresponding to the second text segment; and synchronously displaying positioning to the determined first text segment of the first text in the process of playing the dubbed audio.
17 . A non-transient computer-readable storage medium storing computer programs, wherein the computer programs, upon being run by at least one processor, implement a method for text processing, and the method comprises:
acquiring a first text and a second text which are to be compared, wherein the first text is a text obtained after text conversion processing is carried out on a dubbed audio corresponding to the second text by an artificial intelligence model; segmenting the first text to obtain a plurality of first text segments; segmenting the second text to obtain a plurality of initial second text segments, wherein a content length of a first text segment is greater than a content length of an initial second text segment; sequentially determining, for each first text segment in the first text, a target second text segment that is subjected to an enhancement processing and matched with the first text segment, wherein the enhancement processing refers to movement processing carried out on an endpoint position of an initial second text segment as a processing target in the second text; and determining, based on a plurality of target second text segments respectively matched with the plurality of first text segments in the first text, a text matching result of the first text and the second text, wherein the text matching result is used for positioning to a corresponding first text segment, based on a second text segment corresponding to a current dubbed content, in a process of playing the dubbed audio and synchronously displaying the first text.
18 . The storage medium according to claim 17 , wherein the sequentially determining for each first text segment in the first text, a target second text segment that is subjected to an enhancement processing and matched with the first text segment comprises:
sequentially determining, according to a logical sequence of each first text segment in the first text, the target second text segment that is subjected to the enhancement processing and matched with the first text segment according to steps as follows:
determining an initial second text segment to be matched with the first text segment;
carrying out the enhancement processing on the initial second text segment to obtain an enhanced second text segment corresponding to the initial second text segment; and
using, in response to a similarity between the enhanced second text segment and the first text segment being greater than a first set threshold, the enhanced second text segment as the target second text segment matched with the first text segment, and repeatedly executing, in response to the similarity between the enhanced second text segment and the first text segment being smaller than or equal to the first set threshold, a step of determining the initial second text segment to be matched with the first text segment, until the target second text segment that is subjected to the enhancement processing and matched with the first text segment is determined.
19 . The storage medium according to claim 18 , wherein the carrying out the enhancement processing on the initial second text segment to obtain an enhanced second text segment corresponding to the initial second text segment comprises:
carrying out a plurality of first movement processing on a first endpoint position of the initial second text segment in the second text to obtain a first enhanced text segment, wherein the first enhanced text segment is an enhanced text segment with a highest similarity with the first text segment, which is obtained after the plurality of first movement processing is carried out on the first endpoint position; carrying out a plurality of second movement processing on a second endpoint position of the first enhanced text segment in the second text to obtain a second enhanced text segment, wherein the second enhanced text segment is an enhanced text segment with a highest similarity with the first text segment, which is obtained after the plurality of second movement processing is carried out on the second enhanced text segment; and using, in response to the similarity between the second enhanced text segment and the first text segment being greater than or equal to a second set threshold, the second enhanced text segment as the enhanced second text segment.
20 . The storage medium according to claim 19 , wherein the first endpoint position is a right endpoint position of the initial second text segment, and compared to a left endpoint position, the right endpoint position is farther away from an initial position of the second text; and
the carrying out a plurality of first movement processing on a first endpoint position of the initial second text segment in the second text to obtain a first enhanced text segment comprises:
moving, according to a preset movement length added value, the right endpoint position of the initial second text segment to be matched rightwards by N times to obtain N first candidate text segments corresponding to the initial second text segment to be matched, wherein a difference between a content length of an N th first candidate text segment and a content length of an N-1 th first candidate text segment is equal to the preset movement length added value, and N is a positive integer greater than or equal to 2;
determining a second candidate text segment with a highest similarity with the first text segment in the N first candidate text segments;
moving, according to a target movement length, a right endpoint position of the second candidate text segment respectively leftwards and rightwards to obtain a third candidate text segment and a fourth candidate text segment; determining a target candidate text segment with a highest similarity with the first text segment among the second candidate text segment, the third candidate text segment, and the fourth candidate text segment;
determining, according to a movement length reduction coefficient and the target movement length, an updated target movement length when a right endpoint position of the target candidate text segment is respectively moved leftwards and rightwards; and
moving, in response to the target movement length being a positive integer, the right endpoint position of the target candidate text segment respectively leftwards and rightwards to obtain a new target candidate text segment according to the target movement length, repeatedly executing a step of according to the movement length reduction coefficient and the target movement length, determining the target movement length used when a right endpoint position of the target candidate text segment is respectively moved leftwards and rightwards, until the target movement length determined is a non-positive integer, and using the target candidate text segment obtained after last respective leftward and rightward movements as the first enhanced text segment.Join the waitlist — get patent alerts
Track US2025142176A1 — get alerts on status changes and closely related new filings.
We store only your email — no account needed. See our privacy policy.