Song segmentation method, device and storage medium
By combining the time difference and similarity matrix of the song, the RQA algorithm is used to optimize the song segmentation, which solves the problem of inaccurate segmentation in the existing technology and improves the user experience.
Patent Information
- Application Number
- CN202110688029.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-06-21
- Publication Date
- 2024-09-06
- Estimated Expiration
- 2041-06-21
AI Technical Summary
There are inaccuracies in song segmentation methods in the prior art, resulting in reduced user experience.
By determining the starting time point of the lyrics in the target song, combining the time difference and similarity matrix, using the recursive quantitative analysis RQA algorithm to determine similar fragments, the song is segmented, taking into account the time difference and lyrics similarity, and optimizing the segmentation results.
Improved the accuracy and user experience of song segmentation, ensuring that segmentation results are more in line with actual needs.
Smart Images

Figure CN113377992B
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer processing technology, and in particular to a song segmentation method, device and storage medium. Background Art
[0002] In today's society, songs have become an important part of people's leisure and entertainment, and karaoke applications provide people with a more fun way of entertainment. In karaoke applications, there are usually segment modes and chorus modes, etc. The segment mode is to sing only a segment of a song, and the chorus mode is for each person to sing a segment, and then these segments are spliced together to get the complete audio of the chorus. In order to achieve the above modes, the segment positions in the song need to be set in advance for the convenience of subsequent use by users.
[0003] The traditional song segmentation method is to calculate the start time difference between every two lyrics according to the start time of each lyric sentence in the song, and then set the time difference threshold according to the multiple start time differences calculated in the song, and set the position where the start time difference is greater than the time difference threshold as the segmentation position. This segmentation method only segments according to time, and the factors considered are relatively simple, so there may be inaccurate segmentation problems, which reduces the user experience. Summary of the invention
[0004] The embodiment of the present application provides a method for song segmentation, which can solve the problem of inaccurate song segmentation in the prior art, thereby reducing the user experience.
[0005] In a first aspect, a song segmentation method is provided, the method comprising:
[0006] Determine multiple target lyrics in the lyrics of the target song, and obtain the starting time point corresponding to each target lyrics;
[0007] Segmenting the target song according to the time difference between the start time points of every two adjacent target lyrics sentences to obtain a first segmentation result;
[0008] Determine at least one similar segment pair in the lyrics according to the similarity between every two target lyrics in the target song, wherein the number of target lyrics included in a single segment in the similar segment pair is greater than a first number threshold;
[0009] Segmenting the target song according to the at least one similar segment pair to obtain a second segmentation result;
[0010] A comprehensive segmentation result of the target song is determined according to the first segmentation result and the second segmentation result.
[0011] In a possible implementation, determining at least one similar segment pair in the lyrics according to the similarity between every two lyrics in the target song includes:
[0012] Determine an initial similarity matrix of the target song according to the similarity between every two target lyrics in the target song, wherein the element in the Nth row and the Mth column of the initial similarity matrix represents the similarity between the Nth target lyrics and the Mth target lyrics in the target song;
[0013] The elements in the initial similarity matrix that are smaller than the first similarity threshold and the elements on the main diagonal are set to zero to obtain a similarity matrix to be processed;
[0014] At least one similar segment pair in the lyrics is determined according to the similarity matrix to be processed and a recursive quantitative analysis (RQA) algorithm.
[0015] In a possible implementation, determining at least one similar segment pair in the lyrics according to the similarity matrix to be processed and the RQA algorithm includes:
[0016] Inputting the similarity matrix to be processed into the RQA algorithm to obtain initial similar segment pairs;
[0017] Setting the corresponding elements of the target lyrics corresponding to the initial similar segment pair in the similarity matrix to be processed to zero to update the similarity matrix to be processed;
[0018] Determine whether a preset loop end condition is met. If the loop end condition is not met, jump to the step of inputting the updated similarity matrix to be processed into the RQA algorithm to obtain an initial similar segment pair. If the loop end condition is met, the initial similar segment pair in which the number of target lyrics sentences in the included segment is greater than a first number threshold is determined as the similar segment pair in the lyrics.
[0019] In one possible implementation,
[0020] The step of determining whether a preset loop end condition is satisfied, if the loop end condition is not satisfied, then switching to the step of inputting the updated similarity matrix to be processed into the RQA algorithm to obtain an initial similar segment pair, and if the loop end condition is satisfied, then determining the initial similar segment pair in which the number of target lyrics sentences in the included segment is greater than a first number threshold as the similar segment pair in the lyrics, including:
[0021] Determine whether the current number of cycles reaches a preset number threshold, or whether the number of target lyrics sentences contained in a single segment of the initial similar segment pair obtained last time is less than the first number threshold;
[0022] If the current number of loops does not reach the preset number threshold, and the number of target lyrics sentences contained in a single segment of the last obtained initial similar segment pair is not less than the first number threshold, then the process proceeds to the step of inputting the updated similarity matrix to be processed into the RQA algorithm to obtain the initial similar segment pair;
[0023] If the current number of loops reaches a preset number threshold, or the number of target lyrics sentences contained in a single segment of the last obtained initial similar segment pair is less than the first number threshold, then the initial similar segment pair containing the number of target lyrics sentences greater than the first number threshold will be determined as the similar segment pair in the lyrics.
[0024] In a possible implementation, the method further includes:
[0025] If the current number of loops reaches a preset number threshold, and the number of target lyrics sentences contained in a single segment of the last obtained initial similar segment pair is greater than or equal to the first number threshold, the number of target lyrics sentences contained in a single segment of each initial similar segment pair is sorted according to the output order of the initial similar segment pairs to obtain a target lyrics sentence number sequence;
[0026] In the target lyric sentence number sequence, calculating the difference between every two adjacent target lyric sentence numbers;
[0027] Determine the target initial similar segment pair corresponding to the larger target lyric sentence number among the two adjacent target lyric sentence numbers corresponding to the maximum difference;
[0028] The target initial similar segment pair and the initial similar segment pair output before the target initial similar segment pair are determined as the similar segment pair in the lyrics.
[0029] In a possible implementation, the step of setting the elements in the initial similarity matrix that are smaller than the first similarity threshold and the elements on the main diagonal to zero to obtain the similarity matrix to be processed includes:
[0030] Setting the elements in the initial similarity matrix that are smaller than a first similarity threshold and the elements on the main diagonal to zero;
[0031] The initial similarity matrix after the zeroing process is determined as the similarity matrix to be processed; or, according to the first segmentation result, the initial similarity matrix after the zeroing process is divided into a plurality of sub-matrices, which are respectively used as the similarity matrices to be processed.
[0032] In a possible implementation, determining a plurality of target lyrics in the lyrics of the target song includes:
[0033] determining a plurality of initial lyric sentences in the lyrics of a target song;
[0034] For each two initial lyrics sentences with different word counts, determining the similarity between a first initial lyrics sentence with more words and a second initial lyrics sentence with fewer words in the two initial lyrics sentences;
[0035] If the similarity between the first initial lyrics sentence and the second initial lyrics sentence is less than or equal to a second similarity threshold, and the similarity between the part of the first initial lyrics sentence with the same number of words as the second initial lyrics sentence and the second initial lyrics sentence is greater than the second similarity threshold, then the second initial lyrics sentence is merged with the previous initial lyrics sentence and the next initial lyrics sentence respectively to obtain a first merged lyrics sentence and a second merged lyrics sentence; determine a first similarity between the first initial lyrics sentence and the first merged lyrics sentence, and a second similarity between the first initial lyrics sentence and the second merged lyrics sentence; if the first similarity is greater than the second similarity threshold, determine the first merged lyrics sentence as a target lyrics sentence in the lyrics, and if the second similarity is greater than the second similarity threshold, determine the second merged lyrics sentence as a target lyrics sentence in the lyrics;
[0036] All initial lyrics sentences other than the target lyrics sentence in the multiple initial lyrics sentences are determined as the target lyrics sentences in the lyrics.
[0037] In a possible implementation, segmenting the target song according to the at least one similar segment pair to obtain a second segmentation result includes:
[0038] Determine the start time point corresponding to the first sentence of each segment in the at least one similar segment pair, and the start time point corresponding to the next sentence of the last sentence of each segment in the at least one similar segment pair, and use the determined start time points as segment start time points to form the second segmentation result.
[0039] In a possible implementation, segmenting the target song according to the at least one similar segment pair to obtain a second segmentation result includes:
[0040] For each similar segment pair, determining a target number of lyrics sentences between the first sentences of two segments in the similar segment pair, and if the target number of lyrics sentences between the first sentences is less than the second number threshold, merging the two segments in the similar segment pair to obtain a merged segment;
[0041] The target song is segmented according to the merged segment and the segments included in the similar segment pairs other than the similar segment pairs corresponding to the merged segment to obtain a second segmentation result.
[0042] In a possible implementation, the first segmentation result includes a plurality of start time points of the first segments, the second segmentation result includes a plurality of start time points of the second segments, and determining the comprehensive segmentation result of the target song according to the first segmentation result and the second segmentation result includes:
[0043] According to the start time points of the multiple first segments and the start time points of the multiple second segments, the first segmentation results and the second segmentation results are combined and deduplicated to obtain a third segmentation result;
[0044] According to the third segmentation result, a comprehensive segmentation result of the target song is determined.
[0045] In a possible implementation, determining the comprehensive segmentation result of the target song according to the third segmentation result obtained by merging and deduplication processing includes:
[0046] In the third segmentation result obtained by merging and deduplication processing, determine the first sentence of the segmentation corresponding to each start time point, if the number of target lyrics sentences between the first sentence of the first segmentation and the first sentence of the second segmentation in the determined first sentences of each segmentation is less than or equal to the third number threshold, and the first start time point corresponding to the first sentence of the first segmentation belongs to the first segmentation result, and the second start time point corresponding to the first sentence of the second segmentation belongs to the second segmentation result, then delete the second start time point in the third segmentation result to obtain a fourth segmentation result;
[0047] According to the fourth segmentation result, the comprehensive segmentation result of the target song is determined.
[0048] In a possible implementation, determining the comprehensive segmentation result of the target song according to the fourth segmentation result includes:
[0049] Determine the number m of target lyrics sentences contained in the last segment corresponding to the fourth segmentation result;
[0050] If m is equal to 1, then determine the similarity between the target lyric sentence included in the last segment and the previous target lyric sentence to obtain a third similarity; if m is greater than 1 and less than the fourth number threshold, then merge all the target lyric sentences in the last segment to obtain a third merged lyric sentence, merge the m target lyric sentences before the last segment to obtain a fourth merged lyric sentence, and determine the third similarity between the third merged lyric sentence and the fourth merged lyric sentence;
[0051] If the third similarity is greater than the third similarity threshold, the start time point of the last segment is deleted from the fourth segmentation result to obtain a comprehensive segmentation result of the target song.
[0052] In a possible implementation, segmenting the target song according to the time difference between the start time points corresponding to each two adjacent target lyrics sentences to obtain a first segmentation result includes:
[0053] According to a preset time difference threshold and the time difference between the start time points corresponding to each two adjacent target lyrics sentences, a segmentation point is set between two adjacent target lyrics sentences where the time difference is greater than or equal to the time difference threshold to obtain the first segmentation result.
[0054] In a second aspect, a song segmentation device is provided, the device comprising:
[0055] The first determination module is used to determine multiple target lyrics in the lyrics of the target song and obtain the starting time point corresponding to each target lyrics;
[0056] A first segmentation module, configured to segment the target song according to the time difference between the start time points of each two adjacent target lyrics sentences, to obtain a first segmentation result;
[0057] A second determination module is used to determine at least one similar segment pair in the lyrics according to the similarity between every two target lyrics in the target song, wherein the number of target lyrics sentences contained in a single segment in the similar segment pair is greater than a first number threshold;
[0058] A second segmentation module, configured to segment the target song according to the at least one similar segment pair to obtain a second segmentation result;
[0059] The comprehensive segmentation module is used to determine the comprehensive segmentation result of the target song according to the first segmentation result and the second segmentation result.
[0060] In a possible implementation manner, the second determining module is used to:
[0061] Determine an initial similarity matrix of the target song according to the similarity between every two target lyrics in the target song, wherein the element in the Nth row and the Mth column of the initial similarity matrix represents the similarity between the Nth target lyrics and the Mth target lyrics in the target song;
[0062] The elements in the initial similarity matrix that are smaller than the first similarity threshold and the elements on the main diagonal are set to zero to obtain a similarity matrix to be processed;
[0063] At least one similar segment pair in the lyrics is determined according to the similarity matrix to be processed and a recursive quantitative analysis (RQA) algorithm.
[0064] In a possible implementation manner, the second determining module is configured to:
[0065] Inputting the similarity matrix to be processed into the RQA algorithm to obtain initial similar segment pairs;
[0066] Setting the corresponding elements of the target lyrics corresponding to the initial similar segment pair in the similarity matrix to be processed to zero to update the similarity matrix to be processed;
[0067] Determine whether a preset loop end condition is met. If the loop end condition is not met, jump to the step of inputting the updated similarity matrix to be processed into the RQA algorithm to obtain an initial similar segment pair. If the loop end condition is met, the initial similar segment pair in which the number of target lyrics sentences in the included segment is greater than a first number threshold is determined as the similar segment pair in the lyrics.
[0068] In a possible implementation manner, the second determining module is configured to:
[0069] Determine whether the current number of cycles reaches a preset number threshold, or whether the number of target lyrics sentences contained in a single segment of the initial similar segment pair obtained last time is less than the first number threshold;
[0070] If the current number of loops does not reach the preset number threshold, and the number of target lyrics sentences contained in a single segment of the last obtained initial similar segment pair is not less than the first number threshold, then the process proceeds to the step of inputting the updated similarity matrix to be processed into the RQA algorithm to obtain the initial similar segment pair;
[0071] If the current number of loops reaches a preset number threshold, or the number of target lyrics sentences contained in a single segment of the last obtained initial similar segment pair is less than the first number threshold, then the initial similar segment pair containing the number of target lyrics sentences greater than the first number threshold will be determined as the similar segment pair in the lyrics.
[0072] In a possible implementation manner, the second determining module is further configured to:
[0073] If the current number of loops reaches a preset number threshold, and the number of target lyrics sentences contained in a single segment of the last obtained initial similar segment pair is greater than or equal to the first number threshold, the number of target lyrics sentences contained in a single segment of each initial similar segment pair is sorted according to the output order of the initial similar segment pairs to obtain a target lyrics sentence number sequence;
[0074] In the target lyric sentence number sequence, calculating the difference between every two adjacent target lyric sentence numbers;
[0075] Determine the target initial similar segment pair corresponding to the larger target lyric sentence number among the two adjacent target lyric sentence numbers corresponding to the maximum difference;
[0076] The target initial similar segment pair and the initial similar segment pair output before the target initial similar segment pair are determined as the similar segment pair in the lyrics.
[0077] In a possible implementation manner, the second determining module is configured to:
[0078] Setting the elements in the initial similarity matrix that are smaller than a first similarity threshold and the elements on the main diagonal to zero;
[0079] The initial similarity matrix after the zeroing process is determined as the similarity matrix to be processed; or, according to the first segmentation result, the initial similarity matrix after the zeroing process is divided into a plurality of sub-matrices, which are respectively used as the similarity matrices to be processed.
[0080] In a possible implementation manner, the first determining module is configured to:
[0081] determining a plurality of initial lyric sentences in the lyrics of a target song;
[0082] For each two initial lyrics sentences with different word counts, determining the similarity between a first initial lyrics sentence with more words and a second initial lyrics sentence with fewer words in the two initial lyrics sentences;
[0083] If the similarity between the first initial lyrics sentence and the second initial lyrics sentence is less than or equal to a second similarity threshold, and the similarity between the part of the first initial lyrics sentence with the same number of words as the second initial lyrics sentence and the second initial lyrics sentence is greater than the second similarity threshold, then the second initial lyrics sentence is merged with the previous initial lyrics sentence and the next initial lyrics sentence respectively to obtain a first merged lyrics sentence and a second merged lyrics sentence; determine a first similarity between the first initial lyrics sentence and the first merged lyrics sentence, and a second similarity between the first initial lyrics sentence and the second merged lyrics sentence; if the first similarity is greater than the second similarity threshold, determine the first merged lyrics sentence as a target lyrics sentence in the lyrics, and if the second similarity is greater than the second similarity threshold, determine the second merged lyrics sentence as a target lyrics sentence in the lyrics;
[0084] All initial lyrics sentences other than the target lyrics sentence in the multiple initial lyrics sentences are determined as the target lyrics sentences in the lyrics.
[0085] In a possible implementation, the second segmentation module is used to:
[0086] Determine the start time point corresponding to the first sentence of each segment in the at least one similar segment pair, and the start time point corresponding to the next sentence of the last sentence of each segment in the at least one similar segment pair, and use the determined start time points as segment start time points to form the second segmentation result.
[0087] In a possible implementation, the second segmentation module is used to:
[0088] For each similar segment pair, determining a target number of lyrics sentences between the first sentences of two segments in the similar segment pair, and if the target number of lyrics sentences between the first sentences is less than the second number threshold, merging the two segments in the similar segment pair to obtain a merged segment;
[0089] The target song is segmented according to the merged segment and the segments included in the similar segment pairs other than the similar segment pairs corresponding to the merged segment to obtain a second segmentation result.
[0090] In a possible implementation, the first segmentation result includes a plurality of start time points of the first segments, the second segmentation result includes a plurality of start time points of the second segments, and the comprehensive segmentation module is used to:
[0091] According to the start time points of the multiple first segments and the start time points of the multiple second segments, the first segmentation results and the second segmentation results are combined and deduplicated to obtain a third segmentation result;
[0092] According to the third segmentation result, a comprehensive segmentation result of the target song is determined.
[0093] In a possible implementation, the integrated segmentation module is used to:
[0094] In the third segmentation result obtained by merging and deduplication processing, determine the first sentence of the segmentation corresponding to each start time point, if the number of target lyrics sentences between the first sentence of the first segmentation and the first sentence of the second segmentation in the determined first sentences of each segmentation is less than or equal to the third number threshold, and the first start time point corresponding to the first sentence of the first segmentation belongs to the first segmentation result, and the second start time point corresponding to the first sentence of the second segmentation belongs to the second segmentation result, then delete the second start time point in the third segmentation result to obtain a fourth segmentation result;
[0095] According to the fourth segmentation result, the comprehensive segmentation result of the target song is determined.
[0096] In a possible implementation, the integrated segmentation module is used to:
[0097] Determine the number m of target lyrics sentences contained in the last segment corresponding to the fourth segmentation result;
[0098] If m is equal to 1, then determine the similarity between the target lyric sentence included in the last segment and the previous target lyric sentence to obtain a third similarity; if m is greater than 1 and less than the fourth number threshold, then merge all the target lyric sentences in the last segment to obtain a third merged lyric sentence, merge the m target lyric sentences before the last segment to obtain a fourth merged lyric sentence, and determine the third similarity between the third merged lyric sentence and the fourth merged lyric sentence;
[0099] If the third similarity is greater than the third similarity threshold, the start time point of the last segment is deleted from the fourth segmentation result to obtain a comprehensive segmentation result of the target song.
[0100] In a possible implementation, the first segmentation module is used to:
[0101] According to a preset time difference threshold and the time difference between the start time points corresponding to each two adjacent target lyrics sentences, a segmentation point is set between two adjacent target lyrics sentences where the time difference is greater than or equal to the time difference threshold to obtain the first segmentation result.
[0102] In a third aspect, a computer device is provided, comprising a processor and a memory, wherein the memory stores at least one instruction, and the instruction is loaded and executed by the processor to implement the operations performed by the song segmentation method.
[0103] In a fourth aspect, a computer-readable storage medium is provided, wherein at least one instruction is stored in the storage medium, and the instruction is loaded and executed by a processor to implement the operations performed by the song segmentation method.
[0104] The beneficial effect brought about by the technical solution provided in the embodiment of the present application is: the solution mentioned in the embodiment of the present application can determine the first segmentation result of the target song according to the time difference between the start time points corresponding to each two adjacent target lyrics sentences, and determine the second segmentation result of the target song according to the similarity between each two target lyrics sentences, and then combine the first segmentation result and the second segmentation result to obtain a comprehensive segmentation result. Therefore, the comprehensive segmentation result is not only a simple segmentation based on the time difference, but also further divides the target song according to the lyrics, so as to obtain a more accurate song segmentation and improve the user experience. BRIEF DESCRIPTION OF THE DRAWINGS
[0105] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0106] Figure 1 is a flow chart of a song segmentation method provided in an embodiment of the present application;
[0107] Figure 2 This is a schematic diagram of lyrics with sentence segmentation errors provided in an embodiment of the present application;
[0108] Figure 3 It is a schematic diagram of lyrics after the sentence is corrected provided in an embodiment of the present application;
[0109] Figure 4 is a schematic diagram of an initial similarity matrix provided in an embodiment of the present application;
[0110] Figure 5 It is a schematic diagram of an initial similarity matrix after setting elements with similarity less than a first similarity threshold to zero, provided by an embodiment of the present application;
[0111] Figure 6 is a schematic diagram of a similarity matrix to be processed provided in an embodiment of the present application;
[0112] Figure 7 It is a segmented schematic diagram of a target song provided in an embodiment of the present application;
[0113] Figure 8 It is a schematic diagram of dividing an initial similarity matrix into multiple sub-matrices provided by an embodiment of the present application;
[0114] Fig. 9 is a schematic diagram of an updated processing similarity matrix provided in an embodiment of the present application;
[0115] Fig.10 is a schematic diagram of an updated processing similarity matrix provided in an embodiment of the present application;
[0116] Fig.11 is a schematic diagram of a similarity matrix to be processed provided in an embodiment of the present application;
[0117] Fig.12 It is a segmented schematic diagram of a target song provided in an embodiment of the present application;
[0118] Fig.13 It is a segmented schematic diagram of a target song provided in an embodiment of the present application;
[0119] Fig.14 It is a structural schematic diagram of a song segmentation device provided in an embodiment of the present application;
[0120] Fig.15 It is a structural block diagram of a server provided in an embodiment of the present application. DETAILED DESCRIPTION
[0121] In order to make the objectives, technical solutions and advantages of the present application clearer, the implementation methods of the present application will be further described in detail below with reference to the accompanying drawings.
[0122] The embodiment of the present application provides a song segmentation method, which can be implemented by a server. The server can be a single server or a server cluster composed of multiple servers.
[0123] The server may be a background server of an application, for example, a website or application related to karaoke, music, etc. The server may include a processor, a memory, a communication component, etc., and the processor is connected to the memory and the communication component respectively.
[0124] The processor may be a CPU (Central Processing Unit). The processor may be used to read instructions and process data, for example, to obtain the start time point corresponding to each target lyric sentence, to obtain the similarity between every two target lyric sentences, to determine the first segmentation result and the second segmentation result, to determine the comprehensive segmentation result, and so on.
[0125] The memory may include ROM (Read-Only Memory), RAM (Random Access Memory), CD-ROM (Compact Disc Read-Only Memory), magnetic disk, optical data storage device, etc. The memory may be used for data storage, for example, data corresponding to the lyrics of the target song, data corresponding to the start time point of each target lyric sentence, data generated in the process of determining the first segmentation result, the second segmentation result and the comprehensive segmentation result, etc.
[0126] The communication component may be a wired network connector, a WiFi (Wireless Fidelity) module, a Bluetooth module, a cellular network communication module, etc. The communication component may be used to receive and send signals.
[0127] In some karaoke applications, users can usually choose to sing or listen to only a part of a song, or sing a song with others. In this case, it is necessary to set the segment positions of the song in the background of the karaoke application first, so that the singing method that meets the user's needs can be provided when the user uses the song.
[0128] It should be noted that A, B, C, D, E and F appearing in the specification and the drawings are merely illustrations of initial lyrics or target lyrics, and do not represent any specific text content or number of words.
[0129] Figure 1 is a flow chart of a song segmentation method provided in an embodiment of the present application. Figure 1 , the embodiment comprises:
[0130] 101. Determine multiple target lyrics in the lyrics of a target song, and obtain a start time point corresponding to each target lyrics sentence.
[0131] In practice, to segment the target song, it is necessary to first obtain each target lyric sentence in the lyrics of the target song and the starting time point of each target lyric sentence in the target song. The technician can obtain the QRC lyrics file of the target song, which includes the starting time point corresponding to each target lyric sentence in the target song, or the starting time point corresponding to the target lyric sentence may be obtained by other means, which is not limited in this embodiment.
[0132] Optionally, the lyrics in the QRC files corresponding to some songs often have some unreasonable or wrong places. For example, a target lyric sentence in the lyrics appears once as a complete sentence in the first half and once again in the second half, but in the second half, a target lyric sentence is divided into two sentences, for example, Figure 2 As shown, the second target lyric sentence of the lyrics is "ABCDEFCADB", while the seventh target lyric sentence of the lyrics is "ABCDEF", and the eighth target lyric sentence is "CADB". It can be seen that the lyrics of the seventh and eighth target lyric sentences are combined to form the second target lyric sentence, indicating that there are errors in the lyrics of the seventh and eighth target lyric sentences. In order to avoid such errors caused by lyrics, before segmenting the song, this embodiment can first obtain multiple initial lyric sentences in the lyrics, and detect and correct the initial lyric sentences in the lyrics for the above problems. The corresponding processing process can refer to steps ac:
[0133] a. Determine multiple initial lyrics sentences in the lyrics of the target song. In implementation, corresponding lyrics sentences in the QRC lyrics file of the target song can be obtained as the initial lyrics sentences.
[0134] b. For every two initial lyrics sentences with different numbers of words, determine the similarity between the first initial lyrics sentence with more words and the second initial lyrics sentence with fewer words in the two initial lyrics sentences; if the similarity between the first initial lyrics sentence and the second initial lyrics sentence is less than or equal to the second similarity threshold, and the similarity between the part of the first initial lyrics sentence with the same number of words as the second initial lyrics sentence and the second initial lyrics sentence is greater than the second similarity threshold, then merge the second initial lyrics sentence with the previous initial lyrics sentence and the next initial lyrics sentence respectively to obtain a first merged lyrics sentence and a second merged lyrics sentence; determine a first similarity between the first initial lyrics sentence and the first merged lyrics sentence, and a second similarity between the first initial lyrics sentence and the second merged lyrics sentence; if the first similarity is greater than the second similarity threshold, then determine the first merged lyrics sentence as the target lyrics sentence in the lyrics, and if the second similarity is greater than the second similarity threshold, then determine the second merged lyrics sentence as the target lyrics sentence in the lyrics.
[0135] In implementation, in order to avoid the situation where a complete initial lyrics sentence in the lyrics of the target song is divided into two sentences in the other parts of the lyrics, since an initial lyrics sentence is divided into two sentences, there must be a difference in the number of words between each sentence and the complete sentence. Therefore, the number of words in each two initial lyrics sentences in the lyrics can be compared first, and when two initial lyrics sentences with different word counts are detected, they can be tested. The two initial lyrics sentences can be divided into a first initial lyrics sentence with more words and a second initial lyrics sentence with fewer words. Then, the similarity between the first initial lyrics sentence and the second initial lyrics sentence can be calculated. If the similarity is greater than a second similarity threshold preset by the technician, it means that the two initial lyrics sentences do not have the above-mentioned problem. If the similarity is less than or equal to the second similarity threshold, it means that the two initial lyrics sentences may have the above-mentioned problem, and the two initial lyrics sentences can continue to be tested.
[0136] After determining that the similarity between the first initial lyrics sentence and the second initial lyrics sentence is less than or equal to the second similarity threshold, this situation can be further tested. The content with the same number of words in the first initial lyrics sentence as the second initial lyrics sentence can be obtained in sequence (for the convenience of description, the obtained identical content can be referred to as partial content), and then the similarity between the obtained partial content and the second initial lyrics sentence is calculated. When the number of words in the second initial lyrics sentence is n, the first n words can be obtained from the first word in the first initial lyrics sentence as the first partial content of the first initial lyrics sentence, and the first n words can be obtained from the second word of the first initial lyrics sentence as the second partial content of the first initial lyrics sentence, and so on, until the last word of the last partial content obtained is the last word of the first initial lyrics sentence, at which point multiple partial contents with the same number of words in the first initial lyrics sentence and the second initial lyrics sentence are obtained. The similarities between these multiple partial contents and the second initial lyrics sentence are calculated respectively. When there is a similarity among these similarities that is greater than the second similarity threshold, it means that a part of the content in the first initial lyrics sentence is extremely similar to or even identical to the second initial lyrics sentence, thereby further determining that the first initial lyrics sentence and the second initial lyrics sentence meet the condition that the lyrics are wrong, and then the next step of detection and determination can be carried out.
[0137] After determining that the similarity between the content of the first initial lyrics sentence with the same number of words as the second initial lyrics sentence and the second initial lyrics sentence is greater than the second similarity threshold, the second initial lyrics sentence with fewer words can be merged with its previous initial lyrics sentence, that is, the second initial lyrics sentence is connected to the back of the previous initial lyrics sentence to form a sentence, and the first merged lyrics sentence can be obtained, and then the similarity between the first merged lyrics sentence and the first initial lyrics sentence is calculated. If the similarity is greater than the second similarity threshold, it means that the first merged lyrics sentence and the first initial lyrics sentence have the above-mentioned problem, and the second initial lyrics sentence and the previous initial lyrics sentence are two divided sentences corresponding to the first initial lyrics sentence, which should be combined and displayed in the lyrics. At this time, the first merged lyrics sentence can be used as the target lyrics sentence in the lyrics of the target song, and the sequence number of the first merged lyrics sentence in the lyrics is modified accordingly (the sequence number here is the sequence number of the initial lyrics sentence or the target lyrics sentence in the lyrics), and then the sequence number of the subsequent initial lyrics sentences is adaptively modified. If the similarity between the first merged lyric sentence and the first initial lyric sentence is less than or equal to the second similarity threshold, it means that the first merged lyric sentence and the first initial lyric sentence do not have the above problem, then the second initial lyric sentence can also be merged with the next initial lyric sentence, that is, the second initial lyric sentence is placed before the next initial lyric sentence to form a sentence, and the second merged lyric sentence is obtained. Then the similarity between the second merged lyric sentence and the first initial lyric sentence is calculated. If the similarity is less than or equal to the second similarity threshold, it means that the second initial lyric sentence and the first initial lyric sentence do not have the above problem. If the similarity is greater than the second similarity threshold, it means that the second merged lyric sentence and the first initial lyric sentence have the above problem. The second merged lyric sentence can be used as the target lyric sentence in the modified lyrics, and its serial number is modified accordingly. By detecting and correcting every two initial lyric sentences in the lyrics in the above method, updated lyrics without the above problem can be obtained.
[0138] For example, Figure 2The lyrics shown are multiple initial lyrics sentences in the lyrics of the target song. When the second initial lyrics sentence and the seventh initial lyrics sentence are detected, it is determined that the number of words in the two initial lyrics sentences is different, and the second initial lyrics sentence with more words is determined as the first initial lyrics sentence, and the seventh initial lyrics sentence with fewer words is determined as the second initial lyrics sentence. At this time, the similarity between the second initial lyrics sentence and the seventh initial lyrics sentence is calculated to be 0.4, and the preset second similarity threshold is 0.9, which is less than the second similarity threshold. At this time, multiple partial contents with the same number of words as the seventh initial lyrics sentence can be obtained. The number of words in the seventh initial lyrics sentence is 6, and the multiple partial contents of the second initial lyrics sentence obtained are "ABCDEF", "BCDEFC", "CDEFCA", "DEFCAD" and "EFCADB". Then, the similarities between these five partial contents and the seventh initial lyrics sentence are calculated respectively, and the similarity between the partial content "ABCDEF" and the seventh initial lyrics sentence can be obtained to be 1, which is greater than the second similarity threshold. Then the seventh initial lyrics sentence can be merged with the sixth initial lyrics sentence to obtain a first merged lyrics sentence (EEEEEEEEEEEABCDEF), and the seventh initial lyrics sentence can be merged with the eighth initial lyrics sentence to obtain a second merged lyrics sentence (ABCDEFCADB), and then the first similarity and the second similarity are calculated, and it is found that the first similarity is less than the second similarity threshold, and the second similarity is equal to 1 and greater than the second similarity threshold. At this time, the seventh initial lyrics sentence and the eighth initial lyrics sentence can be merged in the lyrics and determined as the target lyrics sentence in the lyrics. The target lyrics sentence in the final lyrics can be as follows Figure 3 shown.
[0139] For the second similarity threshold preset by the technician, since it is for detecting whether an initial lyric sentence is mistakenly divided into two in the lyrics, the value of the second similarity threshold can be set higher, such as 0.9. Of course, it can also be other values, and this embodiment does not limit this.
[0140] c. All initial lyrics sentences other than the target lyrics sentence in the multiple initial lyrics sentences are determined as the target lyrics sentences in the lyrics.
[0141] In implementation, after the first merged lyrics sentence or the second merged lyrics sentence is determined as the target lyrics sentence, all the initial lyrics sentences other than the initial lyrics sentences corresponding to the determined target lyrics sentences can be kept unchanged and directly determined as the target lyrics sentences in the lyrics. Then, according to the sequence numbers of the first merged lyrics sentence and the second merged lyrics sentence determined as the target lyrics sentence in the lyrics, the sequence numbers of all the target lyrics sentences in the lyrics are adjusted, so as to obtain the target lyrics sentences in the revised lyrics.
[0142] Then, adjust the starting time points of the first merged lyrics sentence and the second merged lyrics sentence in the lyrics. If the first merged lyrics sentence is used as the target lyrics sentence in the lyrics, you only need to delete the starting time point corresponding to the second initial lyrics sentence, and the starting time point corresponding to the previous initial lyrics sentence of the second initial lyrics sentence is still used as the starting time point of the first merged lyrics sentence. If the second merged lyrics sentence is used as the target lyrics sentence in the lyrics, you only need to delete the starting time point corresponding to the next initial lyrics sentence of the second initial lyrics sentence, and use the starting time point corresponding to the second initial lyrics sentence as the starting time point of the second merged lyrics sentence.
[0143] 102. Segment the target song according to the time difference between the start time points of every two adjacent target lyrics sentences to obtain a first segmentation result.
[0144] Generally, in a song, the time interval between the start of two adjacent target lyrics is relatively large, and there may be a long period of accompaniment or silence between the two target lyrics, that is, it is very likely that the two adjacent target lyrics belong to different segments. Therefore, after obtaining the start time point corresponding to each target lyrics sentence in the target song, the target song can be preliminarily segmented by the start time interval between two adjacent target lyrics sentences, and the corresponding processing can be as follows:
[0145] According to a preset time difference threshold and the time difference between the start time points corresponding to each two adjacent target lyrics sentences, a segmentation point is set between two adjacent target lyrics sentences whose time difference is greater than or equal to the time difference threshold to obtain a first segmentation result.
[0146] In implementation, a time difference threshold can be preset according to the start time point of each target lyric sentence in the target song, and then the difference between the start time points corresponding to each two adjacent target lyric sentences is calculated, and the two target lyric sentences whose difference between the start time points is greater than the preset time difference threshold are determined as the segmentation points for the preliminary segmentation of the target song. According to this method, the target song can be divided into multiple segments, that is, multiple first segments, and the start time point corresponding to the first sentence of each first segment can be recorded, and the sequence composed of these start time points can be used as the first segmentation result.
[0147] Optionally, there are multiple methods for determining the preset time difference threshold. The start time difference between each two adjacent target lyrics sentences can be calculated, and then N times the median of these start time differences can be taken as the preset time difference threshold, and 3 times the median can be used as the time difference threshold. Alternatively, the average of the start time difference between each two adjacent target lyrics sentences can be calculated, and then N times the average value can be taken as the time difference threshold, and so on. The method for determining the time difference threshold can be selected according to the specific situation, and this embodiment does not limit this.
[0148] 103. Determine at least one similar segment pair in the lyrics according to the similarity between every two target lyrics sentences in the target song, wherein the number of target lyrics sentences contained in a single segment in the similar segment pair is greater than a first number threshold.
[0149] Among them, the similar segment pair consists of two segments with high similarity, and the two segments have the same number of target lyrics sentences.
[0150] In implementation, after obtaining all the target lyrics in the lyrics corresponding to the target song, the similarity between every two target lyrics can be calculated to determine the segments consisting of several adjacent target lyrics with high similarity and the corresponding segments, which are similar segment pairs. If there is no limit on the number of target lyrics contained in a single segment in a similar segment pair, it may result in a large number of similar segment pairs in the target song, so that the target song is finally segmented into too many segments, which reduces the user experience. Therefore, a first number threshold can be set for the number of target lyrics contained in a single segment in a similar segment pair, that is, the number of target lyrics in a single segment in a similar segment pair must be greater than the first number threshold. In this embodiment, the first number threshold can be set to 3, or other values, which are not limited in this embodiment.
[0151] Optionally, to achieve segmentation, firstly, similar segments of the target song need to be determined, and the corresponding processing process can be shown as 1031-1033:
[0152] 1031. Determine an initial similarity matrix of the target song based on the similarity between every two target lyrics sentences in the target song, wherein the element in the Nth row and the Mth column of the initial similarity matrix represents the similarity between the Nth target lyrics sentence and the Mth target lyrics sentence in the target song.
[0153] In implementation, after calculating the similarity between each two target lyrics in the target song, an initial similarity matrix can be determined based on these similarities and the sequence number of each target lyrics in the lyrics, that is, the elements in the Nth row and Mth column of the initial similarity matrix represent the similarity between the Nth target lyrics and the Mth target lyrics in the target song. In particular, in the initial similarity matrix, since the elements on the main diagonal represent the similarity between a target lyrics sentence and itself, the elements on the main diagonal are all 1, such as Figure 4 shown.
[0154] There are many methods for calculating the similarity between each two target lyrics in the target song. The method can be directly counting the proportion of characters with the same relative position in the target lyrics, or a more complex and sophisticated method for calculating the similarity. In this embodiment, the method of calculating the minimum edit distance between two target lyrics can be used to calculate the similarity, or other methods can be used, which are not limited in this embodiment.
[0155] 1032. Set the elements in the initial similarity matrix that are smaller than the first similarity threshold and the elements on the main diagonal to zero to obtain a similarity matrix to be processed.
[0156] In implementation, when determining similar segment pairs, elements in the initial similarity matrix that are smaller than the preset first similarity threshold are likely to interfere with the calculation or even interfere with the calculation result, so the elements smaller than the first similarity threshold can be set to zero first, such as Figure 5 At the same time, the elements on the main diagonal in the initial similarity matrix are the similarities between the target lyrics themselves, which are useless for the result, so they can also be directly set to zero. After setting the elements less than the first similarity threshold and the elements on the main diagonal to zero, the similarity matrix to be processed after zeroing can be obtained, as shown in Figure 6 shown.
[0157] Optionally, since the target song has been preliminarily segmented by using the time difference threshold and the time difference between the start time points corresponding to each two adjacent target lyrics sentences, a first segmentation result has been obtained, so that the target song can be divided into multiple first segments. This first segmentation result obtained based on the time difference is more reliable. If the starting target lyrics sentences of the obtained similar segment pairs are located in two different first segments, then the segmentation of the target song after combining the first segmentation result with the second segmentation result may result in one of the segments containing less than the first number threshold, such as Figure 7 As shown, the double-strike line indicates the segmentation position corresponding to the first segmentation result, and the single-strike line indicates the segmentation position corresponding to the second segmentation result. The first segmentation result is segmented between the 5th target lyrics sentence and the 6th target lyrics sentence, and the target song is divided into two first segments [1, 5] (i.e., the first target lyrics sentence to the fifth target lyrics sentence in the lyrics) and [6, 15] (i.e., the sixth target lyrics sentence to the fifteenth target lyrics sentence in the lyrics). If the second segmentation result is obtained directly according to the initial similarity matrix, and then segmented according to the second segmentation result, [2, 6] will be divided into one segment. It can be seen that after combining the first segmentation result and the second segmentation result, the 6th target lyrics sentence is divided into a separate segment. Since the first segmentation result is extremely reliable, there is no need to divide the 6th target lyrics sentence into a separate segment. The segmentation in this case is not reasonable, and the corresponding processing method can be as follows:
[0158] The elements in the initial similarity matrix that are less than the first similarity threshold and the elements on the main diagonal are set to zero. The initial similarity matrix after the zeroing process is determined as the similarity matrix to be processed, or, according to the first segmentation result, the initial similarity matrix after the zeroing process is divided into a plurality of sub-matrices, which are respectively used as the similarity matrices to be processed.
[0159] In implementation, after the elements less than the first similarity threshold and the elements on the main diagonal in the initial similarity matrix are set to zero, the initial similarity matrix after the zeroing process can be directly determined as the similarity matrix to be processed as described above. However, in order to avoid the situation where the starting target lyrics of the above similar segment pairs are located in two different first segments, the initial similarity matrix after the zeroing process can be divided into multiple sub-matrices according to the first segmentation results. Figure 8 As shown in the figure, the bold line in the figure indicates that the initial similarity matrix after zeroing is divided into four sub-matrices according to the first segmentation result. Each sub-matrix is used as a similarity matrix to be processed, and the following steps are performed to obtain the similar segment pairs corresponding to each sub-matrix, and finally the similar segment pairs obtained from each sub-matrix are used as the similar segment pairs of the target song.
[0160] 1033. Determine at least one similar segment pair in the lyrics according to the similarity matrix to be processed and the RQA algorithm.
[0161] In implementation, after obtaining the similarity matrix to be processed, it can be input into the Recurrence Quantification Analysis (RQA) algorithm. The RQA algorithm will add up the values of the elements on this path in the upper left corner of the similarity matrix to be processed along the main diagonal until it is added to the last element in the lower right corner to obtain a total score. The RQA algorithm will output the range of horizontal and vertical coordinates corresponding to the segment corresponding to the non-zero element in the path with the largest total score, which is the optimal path obtained by the RQA algorithm this time, as an initial similar segment pair. The above is only the case of one input to the RQA algorithm. For this embodiment, at least one similar segment pair in the lyrics can be obtained, and the corresponding processing process can be as follows:
[0162] The similarity matrix to be processed is input into the RQA algorithm to obtain initial similar segment pairs, and the corresponding elements of the target lyrics sentences corresponding to the initial similar segment pairs in the similarity matrix to be processed are set to zero to update the similarity matrix to be processed, and determine whether the preset loop end condition is met. If the loop end condition is not met, then jump to the step of inputting the updated similarity matrix to be processed into the RQA algorithm to obtain initial similar segment pairs. If the loop end condition is met, the initial similar segment pairs whose number of target lyrics sentences in the included segments is greater than the first number threshold are determined as similar segment pairs in the lyrics.
[0163] After obtaining the similarity matrix to be processed through step 1032, the similarity matrix to be processed is input into the RQA algorithm, and the optimal path for the output of the similarity matrix to be processed can be obtained, that is, an initial similar segment pair, and then the elements of the initial similar segment pair in the similarity matrix to be processed are set to zero to obtain an updated similarity matrix to be processed, so as to prevent the initial similar segment pair from affecting the output of the next initial similarity matrix. It can be understood that the initial similarity matrix corresponding to a song can be one or more, so after obtaining an initial similarity matrix, it is necessary to perform the above-mentioned zeroing update operation on the similarity matrix to be processed, and then input it into the RQA algorithm, so as to output the initial similar segment pairs corresponding to the updated similarity matrix to be processed, and repeat the operations of zeroing and inputting the RQA algorithm to obtain one or more initial similar segment pairs. For example, Figure 6 After the similarity matrix to be processed shown is input into the RQA algorithm, since the sum of the elements on the paths corresponding to [1, 8] and [9, 16] (i.e., the paths corresponding to the horizontal coordinate range 1-8 and the vertical coordinate range 9-16, and the paths corresponding to the horizontal coordinate range 9-16 and the vertical coordinate range 1-8) is the largest, the initial similar fragment pair [1, 8] and [9, 16] will be output, and then the elements corresponding to [1, 8] and [9, 16] (i.e., the elements corresponding to the horizontal coordinate range 1-8 and the vertical coordinate range 9-16, and the elements corresponding to the horizontal coordinate range 9-16 and the vertical coordinate range 1-8) are set to zero in the similarity matrix to be processed, and the updated similarity matrix to be processed is obtained, as shown in FIG. Fig. 9 As shown. Fig. 9 The matrix shown is input to the RQA algorithm again. Since the sum of the elements on the paths corresponding to [5, 8] and [17, 20] (i.e., the paths corresponding to the horizontal coordinate range 5-8 and the vertical coordinate range 17-20, and the paths corresponding to the horizontal coordinate range 17-20 and the vertical coordinate range 5-8) is the largest, the second initial similarity matrix [5, 8] and [17, 20] are obtained. Fig. 9In the similarity matrix to be processed shown in FIG, the elements corresponding to each other between [5, 8] and [17, 20] (i.e., the elements corresponding to the horizontal coordinate range 5-8 and the vertical coordinate range 17-20, and the elements corresponding to the horizontal coordinate range 17-20 and the vertical coordinate range 5-8) are set to zero, and the similarity matrix to be processed after being updated again is obtained, as shown in FIG. Fig.10 As shown. Fig.10 The matrix shown is input to the RQA algorithm. Since the sum of the elements on the paths corresponding to [13, 16] and [17, 20] (i.e., the paths corresponding to the horizontal coordinate range 13-16 and the vertical coordinate range 17-20, and the paths corresponding to the horizontal coordinate range 17-20 and the vertical coordinate range 13-16) is the largest, the third initial similarity matrix [13, 16] and [17, 20] are obtained. This process is repeated until the loop end condition is met.
[0164] For the above situation where the similarity matrix to be processed needs to be input into the RQA algorithm for multiple cycles, the technician needs to pre-set the cycle end condition to ensure that a valid initial similarity matrix is obtained.
[0165] The preset loop end condition may be one or more. The loop end condition and the processing process in this embodiment may be as follows:
[0166] Determine whether the current number of loops reaches the preset number threshold, or whether the number of target lyrics sentences contained in a single segment of the last obtained initial similar segment pair is less than the first number threshold. If the current number of loops does not reach the preset number threshold, and the number of target lyrics sentences contained in a single segment of the last obtained initial similar segment pair is not less than the first number threshold, then proceed to the step of inputting the updated similarity matrix to be processed into the RQA algorithm to obtain the initial similar segment pair; if the current number of loops reaches the preset number threshold, or the number of target lyrics sentences contained in a single segment of the last obtained initial similar segment pair is less than the first number threshold, then the initial similar segment pair containing the number of target lyrics sentences greater than the first number threshold is determined as the similar segment pair in the lyrics.
[0167] In implementation, the technician can pre-set a preset number of loop thresholds. If the current number of loops reaches the preset number of thresholds, the updated similarity matrix to be processed will no longer be input into the RQA algorithm, and the loop will end. At the same time, since there are certain requirements for the number of target lyrics contained in the segments of the similar segment pairs, certain settings can also be made. The specific processing can be as follows:
[0168] First, the current number of loops can be determined. If the preset number threshold is not reached, the number of target lyrics contained in a single segment of the last output initial similar segment pair can be determined. If the number is greater than or equal to the first number threshold preset by the technician, it means that the loop can continue. At this time, the corresponding elements in the similarity matrix to be processed of the target lyrics contained in a single segment of the last obtained initial similar segment pair are set to zero to obtain an updated similarity matrix to be processed. The updated similarity matrix to be processed is then input into the RQA algorithm to output the next initial similarity matrix.
[0169] Then the current number of loops is determined. If it still does not reach the preset number threshold, the number of target lyrics sentences contained in a single segment of the currently output initial similar segment pair is determined. If the number is less than the preset first number threshold, if the updated similarity matrix to be processed is continuously input into the RQA algorithm, the number of target lyrics sentences contained in a single segment of the output initial similar segment pair will still be less than the first number threshold, so the loop can be ended at this time, and the similarity matrix to be processed will no longer be input into the RQA algorithm. If the current number of loops reaches the preset number threshold when determining the current number of loops, the loop can be ended directly.
[0170] When the loop ends, the initial similar segment pairs whose segments contain target lyrics sentences greater than the first number threshold can be confirmed as similar segment pairs of the lyrics of the final target song.
[0171] In the case where the initial similarity matrix after zeroing is divided into multiple similarity matrices to be processed according to the first segmentation result, the above-mentioned loop operation can be performed on each similarity matrix to be processed to obtain the similar segment pairs corresponding to each similarity matrix to be processed, thereby obtaining the similar segment pairs of the entire target song.
[0172] Optionally, the preset number threshold of the cycle can be set according to the specific situation. In this embodiment, the preset number threshold is set to 5. Of course, it can also be other values, which is not limited in this embodiment.
[0173] Optionally, since this scheme can segment songs of various lengths, the preset number of loop thresholds cannot be set too small. However, if the number of target lyrics sentences contained in a single segment of the initial similar segment pair output by the RQA algorithm each time is greater than or equal to the first number threshold, the loop will end only when the current number of loops reaches the preset number threshold. At this time, multiple initial similar segment pairs will be output. In particular, after the initial similarity matrix is divided according to the first segmentation result, each submatrix will obtain multiple initial similar segment pairs. Finally, there are more initial similar segment pairs in the target song, resulting in more similar segment pairs in the target song. The target song may be segmented too much. In this case, the following processing can be performed:
[0174] If the current number of loops reaches a preset number threshold, and the number of target lyrics sentences contained in a single segment of the last obtained initial similar segment pair is greater than or equal to the first number threshold, the number of target lyrics sentences contained in a single segment of each initial similar segment pair is sorted according to the output order of the initial similar segment pairs to obtain a target lyrics sentence number sequence. In the target lyrics sentence number sequence, the difference between every two adjacent target lyrics sentence numbers is calculated to determine the target initial similar segment pair corresponding to the larger target lyrics sentence number of the two adjacent target lyrics sentence numbers corresponding to the maximum difference. The target initial similar segment pair and the initial similar segment pair output before the target initial similar segment pair are determined as similar segment pairs in the lyrics.
[0175] After obtaining all the initial similar segment pairs corresponding to the similarity matrix to be processed, the number of target lyrics sentences contained in a single segment of each initial similar segment pair can be determined, and then the number of target lyrics sentences is combined into a sequence according to the order of the initial similar segment pairs output by the RQA algorithm, that is, the target lyrics sentence number sequence, and then the difference between each two adjacent elements in the target lyrics sentence number sequence is calculated, and then these differences are arranged in order to obtain a first-order difference sequence. Determine the element with the largest value in the first-order difference sequence, that is, the element with the largest difference between the number of target lyrics sentences contained in a single segment of two adjacent similar segment pairs, and then determine the two initial similar segment pairs corresponding to the element, and determine the initial similar segment pairs with a larger number of target lyrics sentences contained in a single segment of the two initial similar segment pairs as the target initial similar segment pairs, and then, the target initial similar segment pair and the initial similar segment pair output before the target initial similar segment pair can be determined as similar segment pairs in the lyrics. For example, through the similarity matrix to be processed and the RQA algorithm, 10 initial similar segment pairs are obtained. The target lyric sentence number sequence corresponding to these 10 initial similar segment pairs is [17, 14, 7, 7, 7, 7, 4, 4, 4, 3], and the corresponding first-order difference sequence is [3, 7, 0, 0, 0, 3, 0, 0, 1]. It can be determined that the maximum difference is 7. The two initial similar segment pairs corresponding to the maximum difference are the second and third output initial similar segment pairs. The second output initial similar segment pair is determined as the target initial similar segment pair, and the first initial similar segment pair can be further determined as the similar segment pair in the lyrics.
[0176] In particular, when the values of the elements in the first-order difference sequence are all the same, only the first output initial similar segment pair can be determined as the similar segment pair in the lyrics. However, if in this case, if the number of target lyrics sentences contained in a single segment in the first output initial similar segment pair is equal to the first number threshold, then the first output initial similar segment pair is deleted, indicating that the target song has not determined a similar segment pair. Of course, other determination methods may also be used, and this embodiment does not limit this.
[0177] 104. Segment the target song according to at least one similar segment pair to obtain a second segmentation result.
[0178] In implementation, after obtaining the similar segment pairs of the target song, the target song can be segmented according to the starting target lyrics corresponding to each segment in the similar segment pairs to obtain a second segmentation result.
[0179] Optionally, the corresponding processing process of obtaining the second segmentation result according to the obtained at least one similar segment pair may be as follows:
[0180] Determine the start time point corresponding to the first sentence of each segment in at least one similar segment pair, and the start time point corresponding to the next sentence of the last sentence of each segment in at least one similar segment pair, and use the determined start time points as segment start time points to form a second segmentation result.
[0181] In the implementation, each similar segment pair obtained contains two segments, and the start time point corresponding to the first sentence of each segment in these similar segment pairs and the start time point corresponding to the next sentence of the last sentence of the segment are obtained. These start time points are the start time points of the first sentence of each segment after the target song is segmented, that is, the segment start time points mentioned above. The sequence composed of these start time points can constitute the second segmentation result of the target song.
[0182] Optionally, for some songs, a line of lyrics may be repeated multiple times, that is, in the lyrics, there may be multiple adjacent target lyrics with the same text. In the similarity matrix to be processed, the similarity between every two target lyrics in these target lyrics is 1. For example, the similarity between every two target lyrics from the 11th target lyrics to the 15th target lyrics is 1. After setting the elements of the main diagonal to zero, we can get Fig.11 In this case, if the number of target lyrics sentences with the same text and adjacent to each other is greater than the first number threshold, then after the similarity matrix to be processed is input into the RQA algorithm, an initial similar segment pair consisting of two segments corresponding to these target lyrics sentences with the same text and adjacent to each other will be obtained. This similar segment pair will divide these target lyrics sentences with the same text and adjacent to each other into at least two second segments. For example, if the first number threshold is 3, Fig.11 The similarity matrix to be processed is input into the RQA algorithm, and the output initial similarity segment pairs are [11, 14] and [12, 15]. However, the actual segmentation should be to divide all the target lyrics sentences with the same text and adjacent to each other into a second segment. The corresponding processing process can be as follows:
[0183] For each similar segment pair, determine the target number of lyrics sentences between the first sentences of the two segments in the similar segment pair; if the target number of lyrics sentences is less than a second number threshold, merge the two segments in the similar segment pair to obtain a merged segment; segment the target song based on the merged segment and the segments included in the similar segment pair other than the similar segment pair corresponding to the merged segment to obtain a second segmentation result.
[0184] In implementation, the following processing is performed for each similar segment pair obtained. First, the first target lyric sentence in the two segments in the similar segment pair is determined as the first sentence of the segment. Then the number of target lyric sentences between the first sentences of the two segments is calculated, that is, the serial numbers of the first sentences of the two segments in the lyrics are first determined, and then the serial number with a larger value is subtracted from the serial number with a smaller value to obtain the number of target lyric sentences between the first sentences of the two segments. The technician can pre-set a second number threshold. If the calculated number of target lyric sentences between the two segments is less than the second number threshold, it indicates that both segments in this similar segment pair are repetitions of one or more consecutive target lyric sentences whose number is less than the second number threshold. In fact, for the case where one or more consecutive target lyric sentences are repeated continuously in the lyrics, these consecutively repeated target lyric sentences should be divided into one segment, but in the determined similar segment pair, there is a situation where this segment is divided into at least two segments. Therefore, after determining that the number of target lyric sentences between the two segments is less than the second number threshold, the two segments in this similar segment pair can be merged into one segment, that is, the merged segment. For example, Fig.11 The initial segment pairs in are [11, 14] and [12, 15], the target number of lyrics sentences between the first sentences of the two segments is 1, and the first number threshold is 3. Then the two segments can be merged, and the resulting merged segment is [11, 15].
[0185] Optionally, the specific value of the second number threshold may be set according to specific circumstances, for example, it may be set to 3. The specific value of the set second number threshold may be the same as or different from the first number threshold, which is not limited in the embodiment of the present application.
[0186] The above-mentioned judgment and processing are performed on each similar segment pair of the target song, and finally a merged segment after the above-mentioned merging process and a similar segment pair that has not been merging process can be obtained. The target song is segmented according to these merged segments and similar segment pairs, and multiple second segments can be obtained. The starting time points corresponding to the first sentence of each second segment are arranged in chronological order of these starting time points to obtain the second segmentation results.
[0187] 105. Determine a comprehensive segmentation result of the target song according to the first segmentation result and the second segmentation result.
[0188] Through the above steps, the first segmentation result obtained includes the start time points corresponding to the first sentences of the multiple first segments, and the second segmentation result obtained includes the start time points corresponding to the first sentences of the multiple second segments. After obtaining the first segmentation result and the second segmentation result, the two can be combined to segment the target song to obtain a final comprehensive segmentation result. Some processing of combining the first segmentation result and the second segmentation result can be as follows:
[0189] The first segmentation results and the second segmentation results are combined and deduplicated according to the start time points of the plurality of first segments and the start time points of the plurality of second segments to obtain a third segmentation result. According to the third segmentation result, a comprehensive segmentation result of the target song is determined.
[0190] In implementation, the first segmentation result and the second segmentation result are combined into a sequence, and the repeated elements in the sequence are deleted until only one repeated element remains, thereby obtaining a new sequence, which is the third segmentation result. If there is no other subsequent processing, the third segmentation result can be directly used as the comprehensive segmentation result of the target song.
[0191] Optionally, after obtaining the third segmentation result, the target song can be divided into multiple third segments according to the third segmentation result. In the third segment, there may be a situation where the distance between two adjacent segment first sentences is too close, and the start time point corresponding to the first sentence of the first segment of the two segment first sentences belongs to the first segmentation result, and the start time point corresponding to the first sentence of the second segment belongs to the second segmentation result. In this case, the start time point corresponding to the first sentence of the second segment can be directly removed from the third segmentation result, so that the segmentation of the target song is more reasonable. The corresponding processing process can be as follows:
[0192] In the third segmentation result obtained by the combined deduplication process, the first sentence of each segmentation corresponding to the start time point is determined. If the number of target lyrics sentences between the first sentence of the first segmentation and the first sentence of the second segmentation in the determined first sentences of each segmentation is less than or equal to the third number threshold, and the first start time point corresponding to the first sentence of the first segmentation belongs to the first segmentation result, and the second start time point corresponding to the first sentence of the second segmentation belongs to the second segmentation result, then the second start time point is deleted from the third segmentation result to obtain the fourth segmentation result. According to the fourth segmentation result, the comprehensive segmentation result of the target song is determined.
[0193] In implementation, the technician can pre-set the third number threshold. For the third segmentation result obtained, the first sentence of each segmentation corresponding to the starting time point can be determined, and then the target number of lyrics sentences between each two adjacent first sentences of the segmentation can be calculated, that is, the sequence number of the first sentence of the latter segmentation in the lyrics is subtracted from the sequence number of the first sentence of the previous segmentation in the lyrics to obtain the target number of lyrics sentences of the interval. If the target number of lyrics sentences of the interval is less than or equal to the preset third number threshold, and the first starting time point corresponding to one of the two first sentences of the segmentation (defined as the first sentence of the first segmentation) belongs to the first segmentation result, and the second starting time point corresponding to the second sentence of the segmentation belongs to the second segmentation result, then the second starting time point can be deleted from the third segmentation result to obtain the fourth segmentation result.
[0194] For example, Fig.12As shown, the target song has 9 target lyrics, the double-strike line indicates the segment position corresponding to the first segment result, and the single-strike line indicates the segment position corresponding to the second segment result. According to the first segmentation result, the target song is divided into two first segments, [1, 5] and [6, 9]. According to the second segmentation result, the target song is divided into two second segments, [1, 4] and [5, 9]. After merging and removing duplicates of the first segmentation result and the second segmentation result, the third segmentation result is obtained. According to the third segmentation result, the target song can be divided into three third segments, [1, 4], [5, 5] and [6, 9]. It can be seen that in the third segmentation result, the fifth target lyrics sentence is divided into a segment separately. Since the first segmentation result is extremely reliable, it means that there is a long period of accompaniment or silence between the fifth target lyrics sentence and the sixth target lyrics sentence. For the rationality of segmentation and user experience, the start time point corresponding to the fifth target lyrics sentence can be deleted in the third segmentation result, so that the fifth target lyrics sentence is incorporated into other segments, that is, the fourth segmentation result divides the target song into two segments, [1, 5] and [6, 9].
[0195] In particular, if the second start time point belongs to both the first segment result and the second segment result, the second start time point will not be deleted in the third segment result.
[0196] Optionally, the third number threshold in this embodiment can be directly set to 1, that is, the above operation is performed when the target number of lyrics sentences between the first sentence of the first segment and the first sentence of the second segment is less than or equal to 1. Of course, the third number threshold can also be adjusted according to the situation, and this embodiment does not limit this.
[0197] Optionally, other adjustments can be made to the third segmentation result obtained by the deduplication process. If multiple third segments are obtained after the target song is segmented according to the third segmentation result, and if the number of target lyrics sentences contained in the first third segment is 1, the start time point corresponding to the first sentence of the second third segment can be deleted in the third segmentation result; if the number of target lyrics sentences contained in the last third segment is 1, the start time point corresponding to the first sentence of the last third segment can be deleted in the third segmentation result. Determine the comprehensive segmentation result of the target song based on the fourth segmentation result obtained after the deletion process.
[0198] In implementation, if the number of target lyrics sentences included in the first third segment is 1, it indicates that the first target lyrics sentence in the target song is divided into a segment separately. If the number of target lyrics sentences included in the last third segment is 1, it indicates that the last target lyrics sentence in the target song is divided into a segment separately. However, most songs will not divide the first target lyrics sentence or the last target lyrics sentence in the target song into a segment separately, so the start time point corresponding to the first sentence of the second third segment or the start time point corresponding to the first sentence of the last third segment in this case can be directly deleted from the third segmentation result to obtain the fourth segmentation result.
[0199] For the third segmentation result, one of the two deletion processes mentioned above can be selected according to the situation, or both can be used at the same time, which is not limited in this embodiment.
[0200] If there is no other subsequent processing, the fourth segmentation result can be directly used as the comprehensive segmentation result of the target song.
[0201] Optionally, a large number of songs will repeat a lyric sentence several times at the end of the song, so that the text of the last few target lyric sentences of the lyrics are the same. However, when the number of repetitions of the target lyric sentence is less than the first number threshold, these repeated parts will not be output as the initial similar segment pair by the RQA algorithm, and may be divided into a segment as the remaining part at the end, for example, Fig.13 As shown, the double strokes indicate the segmentation position corresponding to the first segmentation result, and the single stroke indicates the segmentation position corresponding to the second segmentation result. The 10th target lyrics sentence and the 11th target lyrics sentence are divided into one segment, but in fact the 10th target lyrics sentence and the 11th target lyrics sentence are repetitions of the 8th target lyrics sentence and the 9th target lyrics sentence, respectively, so the 10th target lyrics sentence and the 11th target lyrics sentence can be merged into the previous segment. Therefore, it is not a reasonable segmentation method to separate these repeated parts into a segment separately. For this case, the corresponding processing can be as follows:
[0202] Determine the number m of target lyrics sentences contained in the last segment corresponding to the fourth segmentation result. If m is equal to 1, determine the similarity between the target lyrics sentence contained in the last segment and the previous target lyrics sentence to obtain a third similarity; if m is greater than 1 and less than the fourth number threshold, merge all target lyrics sentences in the last segment to obtain a third merged lyrics sentence, merge the m target lyrics sentences before the last segment to obtain a fourth merged lyrics sentence, and determine the third similarity between the third merged lyrics sentence and the fourth merged lyrics sentence. If the third similarity is greater than the third similarity threshold, delete the start time point of the last segment in the fourth segmentation result to obtain a comprehensive segmentation result of the target song.
[0203] In implementation, the number m of target lyrics sentences contained in the segment corresponding to the last element (i.e., the start time point) in the fourth segmentation result can be determined first, and the following two cases can be divided based on the value of m:
[0204] First, when m is equal to 1, that is, the number of target lyrics sentences contained in the last segment corresponding to the fourth segmentation result is 1, at this time, the similarity between the last target lyrics sentence and its previous target lyrics sentence can be calculated to obtain the third similarity.
[0205] Second, when m is greater than 1 and less than a preset fourth number threshold, all target lyrics sentences included in the last segment can be merged into one target lyrics sentence to obtain a third merged lyrics sentence, and then the m target lyrics sentences before the last segment are merged to obtain a fourth merged lyrics sentence. The similarity between the third merged lyrics sentence and the fourth merged lyrics sentence is calculated to obtain a third similarity.
[0206] For the above two situations, when the third similarity obtained is greater than the preset third similarity threshold, it means that the target lyrics sentence contained in the last segment is indeed a repetition of the previous target lyrics sentence. At this time, the last segment can be removed, that is, in the fourth segmentation result, delete the starting time point of the last segment to obtain the final comprehensive segmentation result.
[0207] Optionally, the specific value of the fourth number threshold may be set according to specific circumstances, for example, it may be set to 3. The specific value of the fourth number threshold may be the same as or different from the first number threshold, which is not limited in the embodiment of the present application.
[0208] Similarly, the specific value of the third similarity threshold can be set according to specific circumstances, for example, it can be set to 0.9. The specific value of the set third similarity threshold can be the same as the second similarity threshold, or it can be different, and this embodiment of the application does not limit this.
[0209] All the above optional technical solutions can be arbitrarily combined to form optional embodiments of the present application, which will not be described one by one here.
[0210] The scheme mentioned in the embodiment of the present application can determine the first segmentation result of the target song according to the time difference between the start time points corresponding to each two adjacent target lyrics sentences, and determine the second segmentation result of the target song according to the similarity between each two target lyrics sentences, and then combine the first segmentation result and the second segmentation result to obtain a comprehensive segmentation result. Therefore, the comprehensive segmentation result is not only a simple segmentation based on the time difference, but also further divides the target song according to the lyrics, so as to obtain a more accurate song segmentation and improve the user experience.
[0211] The present application embodiment provides a song segmentation device, which may be the computer device in the above embodiment, such as Fig.14 As shown, the device comprises:
[0212] The first determination module 1401 is used to determine multiple target lyrics in the lyrics of the target song and obtain the starting time point corresponding to each target lyrics;
[0213] A first segmentation module 1402, configured to segment the target song according to the time difference between the start time points of each two adjacent target lyrics sentences, to obtain a first segmentation result;
[0214] A second determination module 1403 is used to determine at least one similar segment pair in the lyrics according to the similarity between every two target lyrics in the target song, wherein the number of target lyrics sentences contained in a single segment in the similar segment pair is greater than a first number threshold;
[0215] A second segmentation module 1404 is used to segment the target song according to the at least one similar segment pair to obtain a second segmentation result;
[0216] The comprehensive segmentation module 1405 is used to determine the comprehensive segmentation result of the target song according to the first segmentation result and the second segmentation result.
[0217] In a possible implementation, the second determining module 1403 is used to:
[0218] Determine an initial similarity matrix of the target song according to the similarity between every two target lyrics in the target song, wherein the element in the Nth row and the Mth column of the initial similarity matrix represents the similarity between the Nth target lyrics and the Mth target lyrics in the target song;
[0219] The elements in the initial similarity matrix that are smaller than the first similarity threshold and the elements on the main diagonal are set to zero to obtain a similarity matrix to be processed;
[0220] At least one similar segment pair in the lyrics is determined according to the similarity matrix to be processed and a recursive quantitative analysis (RQA) algorithm.
[0221] In a possible implementation, the second determining module 1403 is configured to:
[0222] Inputting the similarity matrix to be processed into the RQA algorithm to obtain initial similar segment pairs;
[0223] Setting the corresponding elements of the target lyrics corresponding to the initial similar segment pair in the similarity matrix to be processed to zero to update the similarity matrix to be processed;
[0224] Determine whether a preset loop end condition is met. If the loop end condition is not met, jump to the step of inputting the updated similarity matrix to be processed into the RQA algorithm to obtain an initial similar segment pair. If the loop end condition is met, the initial similar segment pair in which the number of target lyrics sentences in the included segment is greater than a first number threshold is determined as the similar segment pair in the lyrics.
[0225] In a possible implementation, the second determining module 1403 is configured to:
[0226] Determine whether the current number of cycles reaches a preset number threshold, or whether the number of target lyrics sentences contained in a single segment of the initial similar segment pair obtained last time is less than the first number threshold;
[0227] If the current number of loops does not reach the preset number threshold, and the number of target lyrics sentences contained in a single segment of the last obtained initial similar segment pair is not less than the first number threshold, then the process proceeds to the step of inputting the updated similarity matrix to be processed into the RQA algorithm to obtain the initial similar segment pair;
[0228] If the current number of loops reaches a preset number threshold, or the number of target lyrics sentences contained in a single segment of the last obtained initial similar segment pair is less than the first number threshold, then the initial similar segment pair containing the number of target lyrics sentences greater than the first number threshold will be determined as the similar segment pair in the lyrics.
[0229] In a possible implementation, the second determining module 1403 is further configured to:
[0230] If the current number of loops reaches a preset number threshold, and the number of target lyrics sentences contained in a single segment of the last obtained initial similar segment pair is greater than or equal to the first number threshold, the number of target lyrics sentences contained in a single segment of each initial similar segment pair is sorted according to the output order of the initial similar segment pairs to obtain a target lyrics sentence number sequence;
[0231] In the target lyric sentence number sequence, calculating the difference between every two adjacent target lyric sentence numbers;
[0232] Determine the target initial similar segment pair corresponding to the larger target lyric sentence number among the two adjacent target lyric sentence numbers corresponding to the maximum difference;
[0233] The target initial similar segment pair and the initial similar segment pair output before the target initial similar segment pair are determined as the similar segment pair in the lyrics.
[0234] In a possible implementation, the second determining module 1403 is configured to:
[0235] Setting the elements in the initial similarity matrix that are smaller than a first similarity threshold and the elements on the main diagonal to zero;
[0236] The initial similarity matrix after the zeroing process is determined as the similarity matrix to be processed; or, according to the first segmentation result, the initial similarity matrix after the zeroing process is divided into a plurality of sub-matrices, which are respectively used as the similarity matrices to be processed.
[0237] In a possible implementation, the first determining module 1401 is configured to:
[0238] determining a plurality of initial lyric sentences in the lyrics of a target song;
[0239] For each two initial lyrics sentences with different word counts, determining the similarity between a first initial lyrics sentence with more words and a second initial lyrics sentence with fewer words in the two initial lyrics sentences;
[0240] If the similarity between the first initial lyrics sentence and the second initial lyrics sentence is less than or equal to a second similarity threshold, and the similarity between the part of the first initial lyrics sentence with the same number of words as the second initial lyrics sentence and the second initial lyrics sentence is greater than the second similarity threshold, then the second initial lyrics sentence is merged with the previous initial lyrics sentence and the next initial lyrics sentence respectively to obtain a first merged lyrics sentence and a second merged lyrics sentence; determine a first similarity between the first initial lyrics sentence and the first merged lyrics sentence, and a second similarity between the first initial lyrics sentence and the second merged lyrics sentence; if the first similarity is greater than the second similarity threshold, determine the first merged lyrics sentence as a target lyrics sentence in the lyrics, and if the second similarity is greater than the second similarity threshold, determine the second merged lyrics sentence as a target lyrics sentence in the lyrics;
[0241] All initial lyrics sentences other than the target lyrics sentence in the multiple initial lyrics sentences are determined as the target lyrics sentences in the lyrics.
[0242] In a possible implementation, the second segmentation module 1404 is configured to:
[0243] Determine the start time point corresponding to the first sentence of each segment in the at least one similar segment pair, and the start time point corresponding to the next sentence of the last sentence of each segment in the at least one similar segment pair, and use the determined start time points as segment start time points to form the second segmentation result.
[0244] In a possible implementation, the second segmentation module 1404 is configured to:
[0245] For each similar segment pair, determining a target number of lyrics sentences between the first sentences of two segments in the similar segment pair, and if the target number of lyrics sentences between the first sentences is less than the second number threshold, merging the two segments in the similar segment pair to obtain a merged segment;
[0246] The target song is segmented according to the merged segment and the segments included in the similar segment pairs other than the similar segment pairs corresponding to the merged segment to obtain a second segmentation result.
[0247] In a possible implementation, the first segmentation result includes a plurality of start time points of the first segments, the second segmentation result includes a plurality of start time points of the second segments, and the comprehensive segmentation module 1405 is used to:
[0248] According to the start time points of the multiple first segments and the start time points of the multiple second segments, the first segmentation results and the second segmentation results are combined and deduplicated to obtain a third segmentation result;
[0249] According to the third segmentation result, a comprehensive segmentation result of the target song is determined.
[0250] In a possible implementation, the comprehensive segmentation module 1405 is used to:
[0251] In the third segmentation result obtained by merging and deduplication processing, determine the first sentence of the segmentation corresponding to each start time point, if the number of target lyrics sentences between the first sentence of the first segmentation and the first sentence of the second segmentation in the determined first sentences of each segmentation is less than or equal to the third number threshold, and the first start time point corresponding to the first sentence of the first segmentation belongs to the first segmentation result, and the second start time point corresponding to the first sentence of the second segmentation belongs to the second segmentation result, then delete the second start time point in the third segmentation result to obtain a fourth segmentation result;
[0252] According to the fourth segmentation result, the comprehensive segmentation result of the target song is determined.
[0253] In a possible implementation, the comprehensive segmentation module 1405 is used to:
[0254] Determine the number m of target lyrics sentences contained in the last segment corresponding to the fourth segmentation result;
[0255] If m is equal to 1, then determine the similarity between the target lyric sentence included in the last segment and the previous target lyric sentence to obtain a third similarity; if m is greater than 1 and less than the fourth number threshold, then merge all the target lyric sentences in the last segment to obtain a third merged lyric sentence, merge the m target lyric sentences before the last segment to obtain a fourth merged lyric sentence, and determine the third similarity between the third merged lyric sentence and the fourth merged lyric sentence;
[0256] If the third similarity is greater than the third similarity threshold, the start time point of the last segment is deleted from the fourth segmentation result to obtain a comprehensive segmentation result of the target song.
[0257] In a possible implementation, the first segmentation module 1402 is configured to:
[0258] According to a preset time difference threshold and the time difference between the start time points corresponding to each two adjacent target lyrics sentences, a segmentation point is set between two adjacent target lyrics sentences where the time difference is greater than or equal to the time difference threshold to obtain the first segmentation result.
[0259] It should be noted that: the song segmentation device provided in the above embodiment only uses the division of the above functional modules as an example to illustrate the song segmentation. In actual applications, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above. In addition, the song segmentation device provided in the above embodiment and the song segmentation method embodiment belong to the same concept. The specific implementation process is detailed in the method embodiment and will not be repeated here.
[0260] Fig.15 1 is a schematic diagram of the structure of a server provided in an embodiment of the present application. The server 1500 may have relatively large differences due to different configurations or performances, and may include one or more processors 1501 and one or more memories 1502, wherein the memory 1502 stores at least one instruction, and the at least one instruction is loaded and executed by the processor 1501 to implement the methods provided in the above-mentioned various method embodiments. Of course, the server may also have components such as a wired or wireless network interface, a keyboard, and an input and output interface for input and output, and the server may also include other components for implementing device functions, which will not be described in detail here.
[0261] In an exemplary embodiment, a computer-readable storage medium is also provided, such as a memory including instructions, and the instructions can be executed by a processor in a terminal to complete the song segmentation method in the above embodiment. The computer-readable storage medium can be non-transitory. For example, the computer-readable storage medium can be a ROM, RAM, CD-ROM, magnetic tape, floppy disk, optical data storage device, etc.
[0262] A person skilled in the art will understand that all or part of the steps to implement the above embodiments may be accomplished by hardware or by instructing related hardware through a program, and the program may be stored in a computer-readable storage medium, and the above-mentioned storage medium may be a read-only memory, a disk or an optical disk, etc.
[0263] The above description is only an optional embodiment of the present application and is not intended to limit the present application. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present application shall be included in the protection scope of the present application.
Claims
1. A song segmentation method, characterized in that: The method comprises: Determine multiple target lyrics in the lyrics of the target song, and obtain the starting time point corresponding to each target lyrics; Segmenting the target song according to the time difference between the start time points of every two adjacent target lyrics sentences to obtain a first segmentation result; Determine an initial similarity matrix of the target song according to the similarity between every two target lyrics in the target song, wherein the element in the Nth row and the Mth column of the initial similarity matrix represents the similarity between the Nth target lyrics and the Mth target lyrics in the target song; The elements in the initial similarity matrix that are smaller than the first similarity threshold and the elements on the main diagonal are set to zero to obtain a similarity matrix to be processed; Determine at least one similar segment pair in the lyrics according to the similarity matrix to be processed and the recursive quantitative analysis (RQA) algorithm, wherein the number of target lyrics sentences contained in a single segment in the similar segment pair is greater than a first number threshold; Segmenting the target song according to the at least one similar segment pair to obtain a second segmentation result; A comprehensive segmentation result of the target song is determined according to the first segmentation result and the second segmentation result.
2. The method according to claim 1, characterized in that: The step of determining at least one similar segment pair in the lyrics according to the similarity matrix to be processed and the recursive quantitative analysis (RQA) algorithm comprises: Inputting the similarity matrix to be processed into the RQA algorithm to obtain initial similar segment pairs; Setting the corresponding elements of the target lyrics corresponding to the initial similar segment pair in the similarity matrix to be processed to zero to update the similarity matrix to be processed; Determine whether a preset loop end condition is met. If the loop end condition is not met, jump to the step of inputting the updated similarity matrix to be processed into the RQA algorithm to obtain an initial similar segment pair. If the loop end condition is met, the initial similar segment pair in which the number of target lyrics sentences in the included segment is greater than a first number threshold is determined as the similar segment pair in the lyrics.
3. The method according to claim 2, characterized in that The step of determining whether a preset loop end condition is satisfied, if the loop end condition is not satisfied, then switching to the step of inputting the updated similarity matrix to be processed into the RQA algorithm to obtain an initial similar segment pair, and if the loop end condition is satisfied, then determining the initial similar segment pair in which the number of target lyrics sentences in the included segment is greater than a first number threshold as the similar segment pair in the lyrics, including: Determine whether the current number of cycles reaches a preset number threshold, or whether the number of target lyrics sentences contained in a single segment of the initial similar segment pair obtained last time is less than the first number threshold; If the current number of loops does not reach the preset number threshold, and the number of target lyrics sentences contained in a single segment of the last obtained initial similar segment pair is not less than the first number threshold, then the process proceeds to the step of inputting the updated similarity matrix to be processed into the RQA algorithm to obtain the initial similar segment pair; If the current number of loops reaches a preset number threshold, or the number of target lyrics sentences contained in a single segment of the last obtained initial similar segment pair is less than the first number threshold, then the initial similar segment pair containing the number of target lyrics sentences greater than the first number threshold will be determined as the similar segment pair in the lyrics.
4. The method according to claim 3, characterized in that The method further comprises: If the current number of loops reaches a preset number threshold, and the number of target lyrics sentences contained in a single segment of the last obtained initial similar segment pair is greater than or equal to the first number threshold, the number of target lyrics sentences contained in a single segment of each initial similar segment pair is sorted according to the output order of the initial similar segment pairs to obtain a target lyrics sentence number sequence; In the target lyric sentence number sequence, calculating the difference between every two adjacent target lyric sentence numbers; Determine the target initial similar segment pair corresponding to the larger target lyric sentence number among the two adjacent target lyric sentence numbers corresponding to the maximum difference; The target initial similar segment pair and the initial similar segment pair output before the target initial similar segment pair are determined as the similar segment pair in the lyrics.
5. The method according to claim 1, characterized in that The step of setting the elements in the initial similarity matrix that are smaller than the first similarity threshold and the elements on the main diagonal to zero to obtain the similarity matrix to be processed comprises: Setting the elements in the initial similarity matrix that are smaller than a first similarity threshold and the elements on the main diagonal to zero; The initial similarity matrix after the zeroing process is determined as the similarity matrix to be processed; or, according to the first segmentation result, the initial similarity matrix after the zeroing process is divided into a plurality of sub-matrices, which are respectively used as the similarity matrices to be processed.
6. The method according to any one of claims 1 to 5, characterized in that: The step of determining a plurality of target lyrics in the lyrics of the target song comprises: determining a plurality of initial lyric sentences in the lyrics of a target song; For each two initial lyrics sentences with different word counts, determining the similarity between a first initial lyrics sentence with more words and a second initial lyrics sentence with fewer words in the two initial lyrics sentences; If the similarity between the first initial lyrics sentence and the second initial lyrics sentence is less than or equal to a second similarity threshold, and the similarity between the part of the first initial lyrics sentence that has the same number of words as the second initial lyrics sentence and the second initial lyrics sentence is greater than the second similarity threshold, then the second initial lyrics sentence is merged with the previous initial lyrics sentence and the next initial lyrics sentence respectively to obtain a first merged lyrics sentence and a second merged lyrics sentence; determine a first similarity between the first initial lyrics sentence and the first merged lyrics sentence, and a second similarity between the first initial lyrics sentence and the second merged lyrics sentence; if the first similarity is greater than the second similarity threshold, determine the first merged lyrics sentence as a target lyrics sentence in the lyrics, and if the second similarity is greater than the second similarity threshold, determine the second merged lyrics sentence as a target lyrics sentence in the lyrics; All initial lyrics sentences other than the target lyrics sentence in the multiple initial lyrics sentences are determined as the target lyrics sentences in the lyrics.
7. The method according to any one of claims 1 to 5, characterized in that: The step of segmenting the target song according to the at least one similar segment pair to obtain a second segmentation result includes: Determine the start time point corresponding to the first sentence of each segment in the at least one similar segment pair, and the start time point corresponding to the next sentence of the last sentence of each segment in the at least one similar segment pair, and use the determined start time points as segment start time points to form the second segmentation result.
8. The method according to any one of claims 1 to 5, characterized in that: The step of segmenting the target song according to the at least one similar segment pair to obtain a second segmentation result includes: For each similar segment pair, determining a target number of lyrics sentences between the first sentences of two segments in the similar segment pair, and if the target number of lyrics sentences between the first sentences is less than a second number threshold, merging the two segments in the similar segment pair to obtain a merged segment; The target song is segmented according to the merged segment and the segments included in the similar segment pairs other than the similar segment pairs corresponding to the merged segment to obtain a second segmentation result.
9. The method according to claim 1, characterized in that: The first segmentation result includes a plurality of start time points of the first segments, the second segmentation result includes a plurality of start time points of the second segments, and determining the comprehensive segmentation result of the target song according to the first segmentation result and the second segmentation result includes: According to the start time points of the multiple first segments and the start time points of the multiple second segments, the first segmentation results and the second segmentation results are combined and deduplicated to obtain a third segmentation result; According to the third segmentation result, a comprehensive segmentation result of the target song is determined.
10. The method according to claim 9, characterized in that Determining the comprehensive segmentation result of the target song according to the third segmentation result includes: In the third segmentation result obtained by merging and deduplication processing, determine the first sentence of the segmentation corresponding to each start time point, if the number of target lyrics sentences between the first sentence of the first segmentation and the first sentence of the second segmentation in the determined first sentences of each segmentation is less than or equal to the third number threshold, and the first start time point corresponding to the first sentence of the first segmentation belongs to the first segmentation result, and the second start time point corresponding to the first sentence of the second segmentation belongs to the second segmentation result, then delete the second start time point in the third segmentation result to obtain a fourth segmentation result; According to the fourth segmentation result, the comprehensive segmentation result of the target song is determined.
11. The method according to claim 10, characterized in that Determining the comprehensive segmentation result of the target song according to the fourth segmentation result includes: Determine the number m of target lyrics sentences contained in the last segment corresponding to the fourth segmentation result; If m is equal to 1, then determine the similarity between the target lyric sentence included in the last segment and the previous target lyric sentence to obtain a third similarity; if m is greater than 1 and less than a fourth number threshold, then merge all the target lyric sentences in the last segment to obtain a third merged lyric sentence, merge the m target lyric sentences before the last segment to obtain a fourth merged lyric sentence, and determine the third similarity between the third merged lyric sentence and the fourth merged lyric sentence; If the third similarity is greater than the third similarity threshold, the start time point of the last segment is deleted from the fourth segmentation result to obtain a comprehensive segmentation result of the target song.
12. The method according to claim 1, characterized in that The target song is segmented according to the time difference between the start time points corresponding to each two adjacent target lyrics sentences to obtain a first segmentation result, including: According to a preset time difference threshold and the time difference between the start time points corresponding to each two adjacent target lyrics sentences, a segmentation point is set between two adjacent target lyrics sentences where the time difference is greater than or equal to the time difference threshold to obtain the first segmentation result.
13. A computer device, characterized in that: The computer device includes a processor and a memory, wherein the memory stores at least one instruction, and the at least one instruction is loaded and executed by the processor to implement the operations performed by the song segmentation method according to any one of claims 1 to 12.
14. A computer-readable storage medium, characterized in that: At least one instruction is stored in the storage medium, and the at least one instruction is loaded and executed by the processor to implement the operation performed by the song segmentation method as described in any one of claims 1 to claim 12.
