Lyrics matching method and device for song files
By obtaining song information, combined with the first lyrics from song library search and web crawling and the second lyrics from the speech recognition model, joint correction is performed to solve the problem of precise correspondence and accuracy between lyrics and sounds, reducing costs and improving user experience. Lyric matching effect of self-composed songs.
Patent Information
- Application Number
- CN202111287359.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-11-02
- Publication Date
- 2024-09-17
- Estimated Expiration
- 2041-11-02
AI Technical Summary
It is difficult for the existing technology to balance the precise correspondence between lyrics and sounds and the accuracy of the lyrics content, and cannot ensure the accuracy of the lyrics output. Especially when users compose their own songs, the need for professional matching is high and the cost of speech recognition is high, making it impossible to promote its use.
By obtaining the song information of the song file, using song library search and web crawling methods to obtain the first lyrics, and combining the speech recognition model to perform lyrics recognition on the song file, and using the structural information of the second lyrics and the content of the first lyrics to make corrections. Ensure the precise correspondence between lyrics and sounds and the accuracy of lyric content.
It achieves the precise correspondence between lyrics and sounds and the accuracy of lyrics content, reduces the cost of speech recognition, and improves the accuracy of lyrics matching and application experience of user-composed songs.
Smart Images

Figure CN114020959B
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of music processing, and in particular to a method, device, computer equipment and computer-readable storage medium for matching lyrics of a song file. Background Art
[0002] As people's requirements for performance or singing experience continue to increase, users no longer only require auditory performances, but also hope to have a visual experience. Personalized lyrics display has become a new pursuit of users, and the basis for achieving this lyrics display is the accuracy of the lyrics, that is, the lyrics and the sound of the song need to be matched more accurately.
[0003] At present, when making and playing songs, lyrics are matched to songs, usually by adding pre-made lyrics text. In addition, there are also some technologies that are implemented through voice recognition. For the pre-made method, since each song needs to be matched by professionals, the professional requirements are high, and ordinary users cannot use it to compose personalized songs. In the voice recognition method, the voice recognition recognition rate and accuracy are key factors. Since sufficient voice recognition accuracy must be guaranteed, the corresponding technical cost is very high, and it cannot be promoted among ordinary users. Of course, some lyrics are obtained through other network channels.
[0004] However, from the perspective of existing technical solutions, when matching lyrics to song files, it is difficult to balance the precise correspondence between lyrics and sounds and the accuracy of the lyrics content, and the accuracy of the lyrics output cannot be ensured. Summary of the invention
[0005] In response to one of the above-mentioned technical defects, the present application provides a lyrics matching method, device, computer equipment and computer-readable storage medium for a song file, which can achieve precise correspondence between lyrics and sounds and accuracy of lyrics content, and improve the accuracy of lyrics file output.
[0006] A lyrics matching method for a song file, comprising:
[0007] Get song information of song files;
[0008] Acquire the first lyrics of the song file according to the song information, and match the first lyrics with the song file;
[0009] Using a speech recognition model to perform lyrics recognition on the song file to obtain second lyrics, and matching the second lyrics with the song file;
[0010] The lyrics file is obtained by modifying the lyrics file using the structural information of the second lyrics and the lyrics content of the first lyrics.
[0011] In one embodiment, the step of obtaining the first lyrics of the song file according to the song information includes:
[0012] Searching the song data ID corresponding to the song file in the song library according to the song information, and reading the corresponding song data according to the song data ID; wherein the song data includes the song file and its first lyrics;
[0013] When there is no corresponding song data ID in the song library, a web crawling method is enabled to crawl multiple lyrics information of the song file from a public website to obtain the first lyrics.
[0014] In one embodiment, the song library uses an M-order B+ tree structure to store song data; wherein the song data is recorded as a song data ID in the tree structure; and a B+ tree hierarchical search algorithm is used to search the song library for the song data ID corresponding to the song file.
[0015] In one embodiment, the method of enabling a web crawling method to crawl lyrics information of the song file from a public website includes:
[0016] Install the crawler library corresponding to the Python program;
[0017] Find the corresponding URL in the source code of the public website, and parse the source code to obtain the song name and song ID corresponding to the song file;
[0018] According to the song name and song ID, crawl the lyrics data of the corresponding song file through the website interface;
[0019] The non-lyrics information in the lyric data is cleaned and saved as plain text lyric information to obtain the first lyric.
[0020] In one embodiment, the step of using a speech recognition model to perform lyrics recognition on the song file to obtain second lyrics includes:
[0021] Constructing a speech recognition model; wherein the speech recognition model includes a single-word speech network and a phrase speech network;
[0022] The speech recognition model is trained using song files and lyrics texts in a song library.
[0023] In one embodiment, the method of training the speech recognition model using song files and lyrics texts in a song library includes:
[0024] Extract song files and lyrics texts from the song library;
[0025] An endpoint for preprocessing the song file and its lyrics text to identify words;
[0026] Cut each word of the lyrics text to obtain single words or phrases;
[0027] The single word or phrase is respectively input into the single word speech network and the phrase speech network for training.
[0028] In one embodiment, the step of using the structural information of the second lyrics and the lyrics content of the first lyrics to modify and obtain the lyrics file includes:
[0029] respectively matching each word of the lyrics content of the first lyrics with each word of the lyrics content of the second lyrics;
[0030] Obtaining structural information of the second lyrics;
[0031] The position of each word of the lyrics content of the first lyrics is corrected according to the structural information to obtain a lyrics file.
[0032] In one embodiment, the step of using the structural information of the second lyrics and the lyrics content of the first lyrics to modify and obtain the lyrics file includes:
[0033] respectively matching the position of each word of the lyrics content of the first lyrics with the position of each word of the lyrics content of the second lyrics;
[0034] Obtaining the lyrics content of the first lyrics;
[0035] The lyric content is used to correct the typos at the same position of the lyric content of the second lyric to obtain a lyric file.
[0036] In one embodiment, the first lyrics are in multiple copies;
[0037] Before respectively matching the lyrics content of the first lyrics with the position of each word of the second lyrics content, the method further includes:
[0038] Divide each first lyric into a verse part and a chorus part;
[0039] Calculate the deviation rate of the verse part of the lyrics and the chorus deviation rate of the chorus part of the lyrics between each pair of first lyrics respectively;
[0040] The correct verse part and chorus part of the first lyrics are determined according to the deviation rate.
[0041] In one embodiment, the step of using the lyrics content to correct the typos at the same position of the lyrics content of the second lyrics to obtain a lyrics file includes:
[0042] Calculating the deviation rate between each word of the first lyrics and each word at a corresponding position of the second lyrics;
[0043] The wrong words in the second lyrics are determined according to the deviation rate, and are corrected using the words at the corresponding positions of the first lyrics to obtain a lyrics file.
[0044] A lyrics matching device for a song file, comprising:
[0045] A song acquisition module is used to acquire song information of song files;
[0046] A first lyrics matching module, used for acquiring first lyrics of the song file according to the song information, and matching the first lyrics with the song file;
[0047] A second lyrics matching module, used to use a speech recognition model to perform lyrics recognition on the song file to obtain second lyrics, and match the second lyrics with the song file;
[0048] A joint correction module is used to use the structural information of the second lyrics and the lyrics content of the first lyrics to correct and obtain a lyrics file.
[0049] A computer device comprising:
[0050] one or more processors;
[0051] Memory;
[0052] One or more application programs, wherein the one or more application programs are stored in the memory and configured to be executed by the one or more processors, and the one or more programs are configured to: execute the above-mentioned lyrics matching method for song files.
[0053] A computer-readable storage medium stores at least one instruction, at least one program, a code set or an instruction set, wherein the at least one instruction, the at least one program, the code set or the instruction set is loaded by the processor and executes the above-mentioned lyrics matching method for song files.
[0054] The above-mentioned song file lyrics matching method, device, computer equipment and computer-readable storage medium obtain the first lyrics of the song file to match with the song file, and use the speech recognition model to identify the lyrics of the song file to obtain the second lyrics to match with the song file; then use the structural information of the second lyrics and the lyrics content of the first lyrics to correct and obtain the lyrics file; this technical solution uses the lyrics content of the first lyrics combined with the structural information of the second lyrics, and multiple parties jointly correct to ensure the precise correspondence between the lyrics and the sound and the accuracy of the lyrics content, which is particularly suitable for lyrics matching of user-composed songs, thereby improving the user application experience.
[0055] Furthermore, the first lyrics are obtained based on song library search and web crawling, and then the accurate lyrics content is obtained, thereby ensuring the accuracy of the lyrics content. Combined with the accurate structural information recognized by the speech recognition model, the matching lyrics are obtained through joint correction, which greatly reduces the cost of speech recognition and ensures the accuracy of lyrics output.
[0056] Additional aspects and advantages of the present application will be partially given in the following description, which will become apparent from the following description, or will be understood through the practice of the present application. BRIEF DESCRIPTION OF THE DRAWINGS
[0057] The above and / or additional aspects and advantages of the present application will become apparent and easily understood from the following description of the embodiments in conjunction with the accompanying drawings, in which:
[0058] Figure 1 is a flow chart of a method for matching lyrics of a song file according to an embodiment;
[0059] Figure 2 This is a diagram of the structure of an example song data storage.
[0060] Figure 3 This is an example flowchart of web crawling for the first lyrics;
[0061] Figure 4 This is a flowchart of an example speech model training;
[0062] Figure 5 is a joint correction flow chart of an embodiment;
[0063] Figure 6 is a joint correction flow chart of another embodiment;
[0064] Figure 7 is an example correction flow chart;
[0065] Figure 8 The present invention is a schematic diagram of the structure of a device for matching lyrics of a song file according to an embodiment. DETAILED DESCRIPTION
[0066] The embodiments of the present application are described in detail below, and examples of the embodiments are shown in the accompanying drawings, wherein the same or similar reference numerals throughout represent the same or similar elements or elements having the same or similar functions. The embodiments described below with reference to the accompanying drawings are exemplary and are only used to explain the present application, and cannot be interpreted as limiting the present application.
[0067] Those skilled in the art will appreciate that, unless otherwise stated, the singular forms "a", "an", "said" and "the" used herein may also include plural forms. It should be further understood that the term "comprising" used in the specification of the present application refers to the presence of the features, integers, steps, operations, but does not exclude the presence or addition of one or more other features, integers, steps, operations.
[0068] The lyrics matching solution for song files of the present application can be applied to any terminal device, such as smart speakers, smart phones, tablets, personal computers, etc. The terminal device can be connected to the song library on the server side through the network, and can access web pages and perform network crawling through the network. The technical solution of the present application can correctly display the lyrics to the user after the device receives the song file if there are no corresponding lyrics. The following is explained in conjunction with the embodiments.
[0069] refer to Figure 1 As shown, Figure 1 The flowchart of a method for matching lyrics of a song file in an embodiment mainly includes the following steps:
[0070] Step S10: Acquire song information of the song file.
[0071] In this step, users can import song files into the device, and then personalize and compile song files and match lyrics. Before matching lyrics, they can determine which song it belongs to by extracting song information from the song file; song information may include song title, album title, singer information, etc.
[0072] For example, the device uses the received song file to compose a personalized song. If the song file comes with lyrics, the lyrics can be directly selected as the song content when the MV is played and stored in the personalized song library to ensure the accuracy and personalized needs of the lyrics of each user's song file and the integrity of the user's self-created songs. If the received song file does not come with lyrics, the technical solution of this application is used to match the lyrics to improve the accuracy of the lyrics output.
[0073] Step S20: Acquire the first lyrics of the song file according to the song information, and match the first lyrics with the song file.
[0074] In this step, at least one first lyric can be obtained by searching a lyric library or crawling the web, and then the first lyric is matched with the song file for preliminary correspondence.
[0075] In one embodiment, the method for obtaining the first lyrics of a song file may include the following:
[0076] First, the song data ID corresponding to the song file is searched in the song library according to the song information, and the corresponding song data is read according to the song data ID; wherein the song data includes the song file and its first lyrics.
[0077] Then, when there is no corresponding song data ID in the song library, a web crawling method is enabled to crawl multiple lyrics information of the song file from a public website to obtain the first lyrics.
[0078] In the scheme described above, the ID search scheme based on the song name can be searched in the song library of the server. Preferably, the song library adopts an M-order B+ tree structure to store IDs and search for corresponding lyrics IDs and other song data; correspondingly, when searching, a B+ tree hierarchical search algorithm is used to search the song data ID corresponding to the song file in the song library.
[0079] When there are no lyrics corresponding to the song data ID in the song library, a web crawling method can be enabled to crawl the lyrics information on the public website; here, other methods can also be used to obtain the lyrics information.
[0080] Preferably, for an M-order B+ tree structure, all song data relationships constitute a tree-like data structure, referring to Figure 2 , Figure 2 This is a structural diagram of an example song data storage, with the following features: each node has only a limited number of child nodes or no child nodes; a node without a parent node is called a root node; each non-root node has one and only one parent node; except for the root node, each child node can be divided into multiple non-intersecting subtrees; each non-leaf node of the tree is an index, such as gender, region, song language, release year, singer name, song name, etc. The last song data ID is the data storage location, which is a leaf node.
[0081] Correspondingly, when searching using the B+ tree hierarchical search algorithm, it may include the following steps:
[0082] (I) The search path is traversed from top to bottom.
[0083] (II) If the current row has a child row, and the child row is also the ancestor row of the current row, then return 1 and enter the child row; otherwise, return 0 and end the traversal.
[0084] (III) If the current row is a leaf node, it returns 1 and extracts the data information on the song data ID. Otherwise, it returns 0, ends the traversal, and prompts that the search failed, that is, there are no lyrics for the corresponding song file in the song library.
[0085] Preferably, for the web crawling method, you can use Python to write a crawler program to obtain the corresponding lyrics information. For details, refer to Figure 3 As shown, Figure 3 This is an example of a flowchart for crawling the first lyrics of a web page, including the following steps:
[0086] (a) Install the crawler library corresponding to the Python program.
[0087] (b) Find the corresponding URL in the source code of the public website, and parse the source code to obtain the song name and song ID corresponding to the song file.
[0088] (c) crawling the lyrics data of the corresponding song file according to the song name and its song ID through the website interface.
[0089] (d) After cleaning the non-lyrics information in the lyrics data, save the lyrics information as plain text (txt text), obtain the first lyrics and store them in the server database.
[0090] For example: lyrics public website such as https: / / www.geci345.com / hot / 108429.html , crawl the lyrics of the song "The New Drunken Concubine", open the developer community, and find the corresponding URL:
[0091] http: / / www.geci345.com / hot / 108429.html
[0092] http: / / www.geci345.com / hot / 108429.html
[0093] Parse the webpage source code and get the lyrics content:
[0094] <h2> The New Concubine is Drunk< / h2>
[0095] Singer: Li Yugang
[0096] Album: For Love We Said We Would Not Regret
[0097] Release Date: 2009-07-22
[0098] Issuer: disanfang
[0099] The New Concubine is Drunk
[0100] Li Yugang
[0101] The New Concubine is Drunk
[0102] >;>;>;>;>;
[0103] That year, the snow fell and the plum blossoms bloomed
[0104] That year, there were too many sorrows left by the Huaqing Pool
[0105] Don't say who is right or wrong in love.
[0106] I just want to get drunk with you again in my dream
[0107] The golden hairpin and jade hairpin are the gifts you gave me
[0108] The song of colorful clothes and feathered robes has been sung and danced for you for many times
[0109] Jianmen Pass is your deep longing for me
[0110] I am willing to die for my true love at Mawei Slope
[0111] Love and hate in a moment
[0112] Toast to the moon and love is like the sky
[0113] Love and hate
[0114] When did you fall in love?
[0115] The Moon Reflected in the Chrysanthemum Terrace
[0116] Who knows that my heart is cold
[0117] Drunk in the King's Arms
[0118] Dream of Tang Dynasty Love
[0119] >;
[0120] The golden hairpin and jade hairpin are the gifts you gave me
[0121] The song of colorful clothes and feathered robes has been sung and danced for you for many times
[0122] Jianmen Pass is your deep longing for me
[0123] I am willing to die for my true love at Mawei Slope
[0124] Love and hate in a moment
[0125] Toast to the moon and love is like heaven
[0126] Love and hate
[0127] When will you fall in love?
[0128] The Moon Reflected in the Chrysanthemum Terrace
[0129] Who knows that my heart is cold
[0130] Drunk in the King's Arms
[0131] Dream of Tang Dynasty Love
[0132] Love and hate in a moment
[0133] Toast to the moon and love is like heaven
[0134] Love and hate
[0135] When will you fall in love?
[0136] The Moon Reflected in the Chrysanthemum Terrace
[0137] Who knows that my heart is cold
[0138] Drunk in the King's Arms
[0139] Dream of Tang Dynasty Love
[0140] In the above scheme, multiple lyrics files can be obtained by searching the song library and crawling the web. Since the public lyrics are compiled by professionals, the lyrics content is highly accurate.
[0141] Step S30: using a speech recognition model to perform lyrics recognition on the song file to obtain second lyrics, and matching the second lyrics with the song file.
[0142] In this step, for the speech recognition model, the massive corpus in the song library and its corresponding text information can be used for modeling and training, and then the speech recognition model can be trained to perform speech recognition on the song file to obtain the second lyrics, and then the second lyrics are matched with the song file for preliminary correspondence.
[0143] In one embodiment, the technical solution for performing lyrics recognition on a song file to obtain a second set of lyrics mainly includes: firstly constructing a speech recognition model; wherein the speech recognition model includes a single-word speech network and a phrase speech network; and then using the song files in the song library and their lyrics texts to train the speech recognition model.
[0144] For the training process of the speech recognition model, refer to Figure 4 As shown, Figure 4 This is a flowchart of an example speech model training, which may include the following steps:
[0145] (1) Extracting song files and lyrics texts from a song library; specifically, extracting corpus data from the song library.
[0146] (2) Preprocess the song file and its lyrics text to identify the endpoints of the words.
[0147] Specifically, the corpus data is preprocessed by first performing sampling quantization, pre-emphasis, frame-by-frame windowing STFT analysis, and character endpoint detection.
[0148] For endpoint detection, energy envelope and zero-crossing rate can be used for joint detection, and a threshold can be set for judgment. If the threshold is exceeded, it is considered to be the endpoint. The corresponding envelope extraction formula is as follows:
[0149]
[0150] (3) Each single word of the lyrics text is cut into single words or phrases.
[0151] Specifically, each word is cut according to the endpoints, and the number of cuts is consistent with the number of corresponding texts. If they are inconsistent, the words are divided into two parts based on the pronunciation duration and frequency change factors.
[0152] (4) Inputting the single word or phrase into the single word speech network and the phrase speech network for training respectively.
[0153] Specifically, based on the constructed word meaning probability model of the single-word speech network and phrase speech network, each word and phrase is filled with the corresponding probability value 1 in chronological order to construct a one-to-one correspondence table between audio and text; then, according to the correspondence between audio and file, the pattern recognition algorithm of the reverse feedback neural network is used for training.
[0154] The pattern recognition algorithm of the neural network through reverse feedback helps to add penalty values for large deviations and accelerate the convergence of the algorithm. This algorithm is mainly aimed at many-to-one situations.
[0155] For example, the pronunciation of "we" can be male, female, elderly, child, hoarse, steady, sweet, etc., but the corresponding text is still "we". The neural network calculation method is as follows:
[0156] Neural network model: zi = w × x i +b
[0157] The classification calculation method is:
[0158] The loss function is:
[0159] Among them, m is the number of samples and n is the category
[0160] The reverse feedback path function is:
[0161] Through the above technical solution, a speech recognition model is trained to perform speech recognition on the song text. Since the text content of speech recognition is difficult to be completely accurate, this application mainly obtains its structural information through speech recognition.
[0162] Step S40: modifying the lyrics file using the structural information of the second lyrics and the lyrics content of the first lyrics.
[0163] In this step, according to the structural characteristics of the lyrics, that is, the main song part and the chorus part have a clear division, based on this characteristic, we first use the lyrics library to search and the network to crawl the lyrics data to obtain accurate lyrics content, and then use voice recognition text. Since voice recognition is extremely costly and difficult to achieve accurate recognition, accurate structural information is obtained by using voice recognition, and corrections are made by combining the lyrics information and the structural information. The first lyrics obtained by searching the song library or crawling the network are combined with the second lyrics obtained by the speech recognition model to obtain an accurate lyrics file, thereby ensuring the accuracy of the lyrics output.
[0164] In one embodiment, the joint correction process of step S40 refers to Figure 5 As shown, Figure 5 A joint correction flow chart of an embodiment may include the following:
[0165] S411, respectively matching each word of the first lyrics content with each word of the second lyrics content.
[0166] Specifically, after obtaining the first lyric and the second lyric, each word of the lyrics is matched according to the content of the lyrics; since the first lyric is retrieved through a song library or obtained through network crawling, its text content has higher accuracy, while the position of each word may be biased.
[0167] In this process, considering that the verse part and the chorus part of the lyrics obtained through song library retrieval or web crawling are prone to mismatch, in order to improve the accuracy, the first lyrics can be divided into the verse part and the chorus part, and then the verse part and the chorus part are aligned, and then the correction process is carried out.
[0168] S412: Obtain structural information of the second lyrics.
[0169] Since the second lyrics are obtained through voice recognition, the position of each word has higher accuracy, while each word recognized by voice may have typos, and the accuracy of the lyrics content is relatively low.
[0170] S413, correcting the position of each word of the lyrics content of the first lyrics according to the structural information to obtain a lyrics file.
[0171] Specifically, the position of each word in the lyrics of the first lyrics is corrected through the structural information of the second lyrics with higher accuracy, so that the first lyrics content can be accurately aligned with the song file. As mentioned above, the first lyrics content has higher accuracy, thereby solving the mismatch problem of the first lyrics obtained by searching the song library or crawling the network. By aligning first and then correcting, an accurate lyrics file output can be obtained.
[0172] In another embodiment, the joint correction process of step S40 refers to Figure 6 As shown, Figure 6 Another embodiment of the combined correction flow chart may include the following:
[0173] S421, respectively matching the position of each word of the lyrics content of the first lyrics with the position of each word of the lyrics content of the second lyrics.
[0174] Specifically, after obtaining the first lyrics and the second lyrics, each word of the lyrics is matched according to the content of the lyrics. As an embodiment, multiple copies of the first lyrics can be obtained, and each copy of the first lyrics is first divided into a verse part and a chorus part; the deviation rate of the verse part lyrics and the chorus deviation rate of the chorus part lyrics between each copy of the first lyrics are calculated respectively; and the correct verse part and chorus part of the first lyrics are determined according to the deviation rate.
[0175] S422, obtaining the lyrics content of the first lyrics.
[0176] Since the first lyrics are retrieved through a song library or obtained through web crawling, the text content thereof has higher accuracy and can therefore be used to correct the lyrics content of the second lyrics word by word.
[0177] S423, using the lyrics content to correct the typos at the same position of the lyrics content of the second lyrics to obtain a lyrics file.
[0178] Specifically, after converting the speech into the second lyrics of text information using speech recognition, since there may be text recognition errors when recognizing the speech into text, the second lyrics are corrected word by word using the first lyrics searched or crawled from the song library to improve the accuracy of the lyrics.
[0179] The above correction methods may include the following:
[0180] (I) Calculate the deviation rate between each word in the first lyrics and each word in the corresponding position in the second lyrics.
[0181] When calculating the deviation rate, the naive Bayesian probability can be used to determine the accuracy of each lyric phrase and word. The Bayesian probability calculation formula is as follows:
[0182]
[0183] (II) Determining incorrect words in the second lyrics based on the deviation rate.
[0184] By calculating the deviation rate word by word, the deviation of each position of the entire lyrics segment can be obtained, and by judging the deviation rate, the accurate phrase or single word of each position of the second lyrics can be known.
[0185] (III) Using the characters at the corresponding positions of the first lyrics to make corrections, a lyrics file is obtained.
[0186] The second lyrics are corrected word by word based on the lyrics content of the first lyrics, and the corrected second lyrics are output as the required lyrics file.
[0187] The technical solution of the above embodiment first divides the first lyrics into a main song part and a sub-song part, calculates the naive Bayes probability value of each word in the lyrics according to the repeatability of the lyrics of each part and the accuracy of the lyrics phrases, and then uses the naive Bayes probability value to correct each word of the second lyrics, thereby obtaining an accurate lyrics file. In this solution, since the accurate content of the first lyrics is used for correction, the speech recognition requirements of the second lyrics can be reduced. Based on the speech recognition algorithm with lower accuracy, a lyrics file output with highly accurate position and content can be obtained in the end.
[0188] In order to make the above-mentioned correction technical solution clearer, an example is described below using the song "The New Drunken Concubine" as an example.
[0189] According to the lyrics, the correct lyrics of the chorus are as follows:
[0190] "Love and hate happen in a moment, I raise my glass to the moon and my love is as vast as the sky. Love and hate are boundless. I ask you when you will fall in love. The chrysanthemum terrace reflects the bright moon, but who knows that my love is cold in my heart. I am drunk in the king's arms and dream of the love in the Tang Dynasty."
[0191] Assume that multiple first lyrics are obtained through a song library (or lyrics library) and web crawling, and the corresponding chorus lyrics are as follows:
[0192] ①Search the lyrics library to get the lyrics of the chorus:
[0193] Love and hate happen in a moment. I raise my glass to the moon and my love is as vast as the sky. Love and hate are boundless. I ask you when you will fall in love. The chrysanthemum terrace reflects the bright moon, but who knows that my love is cold in my heart? I am drunk in the king's arms and dream of the love in the Tang Dynasty.
[0194] ②Website 1 crawled the Internet to get the lyrics of the chorus:
[0195] The golden hairpin and jade hairpin are the gifts you gave me. I have sung and danced for you in the song "Nichang Yuyi". Jianmen Pass is your deep longing for me. I am willing to die for true love at Mawei Slope.
[0196] ③Website 2 crawled the Internet to obtain the lyrics of the chorus:
[0197] Love and hate happen in a moment. I raise my glass to the moon and my love is as vast as the sky. Love and hate are boundless. I ask you when you will fall in love. The chrysanthemum terrace reflects the bright moon, but who knows that my love is cold in my heart? I am drunk in the king's arms and dream of the love in the Tang Dynasty.
[0198] ④ The second lyrics recognized by the speech recognition model, which corresponds to the chorus lyrics:
[0199] Alas and hate are just in a moment, raising a cup to the moon is sweet, love and hate are vague, I ask you when you will practice, the chrysanthemums reflect the bright moon, who knows that my love is calling out in my heart, I am drunk with the king's evil, dreaming of returning to the Tang Dynasty, alas.
[0200] It can be seen from the above ①-④ copies of the chorus lyrics that the first lyrics obtained by web crawling or searching the song library have a high accuracy, but there is a problem that the chorus lyrics do not correspond. Therefore, by calculating the information deviation rate (naive Bayes value) between the chorus lyrics of each copy of the first lyrics, the verse part and the chorus part can be judged. For example, the chorus lyrics obtained by web crawling of website 1 divide the verse lyrics into the song part. Therefore, after calculating the information deviation rate between the two, it can be obtained that the deviation rate of each word in the chorus lyrics of the sentence "Love and hate are in a moment" crawled from website 1 is 1111111, the deviation rate of website 2 crawled is 0000000, and the deviation rate of the lyrics library is 0000000; the deviation rate through speech recognition is 1000000; similarly, the deviation rate of each lyrics paragraph can be obtained, and the probability of each word is calculated by using the deviation rate, so that the probability of each word can be obtained by using the naive Bayes formula as follows:
[0201] ①The probability of website 1 crawling lyrics is: 0.333, 0.333, 0.333, 0.333, 0.333, 0.333, 0.333.
[0202] ②The probability of website 2 crawling lyrics is: 1, 1, 1, 1, 1, 1, 1, 1.
[0203] ③The probability of retrieving lyrics from the lyrics database: 1, 1, 1, 1, 1, 1, 1.
[0204] ④The probability of speech recognition lyrics is: 0.333, 1, 1, 1, 1, 1, 1, 1.
[0205] It can be seen that the chorus lyrics crawled by website 1 are wrong, and the chorus lyrics retrieved by website 2 and the lyrics library are correct; as for the lyric "Love and hate are just a moment", the word "love" in ② and ③ can be used to correct the word "sigh" in ④, and so on, to correct each word in ④, and then output the accurate lyrics file to achieve the purpose of improving the accuracy of lyrics recognition.
[0206] In the technical solution of the above embodiment, reference is made to Figure 7 As shown, Figure 7 This is an example correction flow chart. You can first search the lyrics data ID of the lyrics library, perform a rough lyrics search to obtain the first lyrics, and reduce the complexity of the algorithm. For the problem that the song structure does not correspond to the lyrics, obtain the corresponding first lyrics from the website through web crawling, and correct the corresponding errors in the repeated positions of the chorus part. Then, perform voice recognition on the song file to obtain the second lyrics with accurate song structure, and use each word of the first lyrics to correct the second lyrics with recognition errors word by word, so as to achieve the purpose of outputting an accurate lyrics file.
[0207] An embodiment of a device for matching lyrics of song files is described below.
[0208] refer to Figure 8 As shown, Figure 8 The structure diagram of a lyrics matching device for a song file is an example, comprising:
[0209] The song acquisition module 10 is used to acquire song information of a song file;
[0210] A first lyrics matching module 20, used for obtaining first lyrics of the song file according to the song information, and matching the first lyrics with the song file;
[0211] A second lyrics matching module 30, configured to use a speech recognition model to perform lyrics recognition on the song file to obtain second lyrics, and match the second lyrics with the song file;
[0212] The joint correction module 40 is used to use the structural information of the second lyrics and the lyrics content of the first lyrics to correct and obtain a lyrics file.
[0213] The lyrics matching device for song files of the present embodiment can execute a lyrics matching method for song files provided by the embodiments of the present disclosure, and the implementation principles are similar. The actions performed by each module in the lyrics matching device for song files in each embodiment of the present disclosure correspond to the steps in the lyrics matching method for song files in each embodiment of the present disclosure. For the detailed functional description of each module in the lyrics matching device for song files, please refer to the description in the corresponding lyrics matching method for song files shown in the previous text, which will not be repeated here.
[0214] An embodiment of a computer device of the present application is described below. The computer device comprises:
[0215] one or more processors;
[0216] Memory;
[0217] One or more applications, wherein the one or more applications are stored in the memory and configured to be executed by the one or more processors, and the one or more programs are configured to: execute the lyrics matching method for song files according to any of the above embodiments.
[0218] An embodiment of a computer-readable storage medium of the present application is described below, wherein the storage medium stores at least one instruction, at least one program, a code set or an instruction set, and the at least one instruction, the at least one program, the code set or the instruction set is loaded by the processor and executes the lyrics matching method of the song file of any of the above embodiments.
[0219] In the technical solutions of the lyrics matching device, computer equipment and computer-readable storage medium of the above-mentioned song files, the lyrics content of the first lyrics is combined with the structural information of the second lyrics, and multiple joint corrections are made to ensure the precise correspondence between the lyrics and the sound and the accuracy of the lyrics content. It is particularly suitable for lyrics matching of user-composed songs, which improves the user application experience.
[0220] The above description is only a partial implementation method of the present application. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principles of the present application. These improvements and modifications should also be regarded as the scope of protection of the present application.
Claims
1. A method for matching lyrics of a song file, characterized in that: include: Get song information of song files; Acquire the first lyrics of the song file according to the song information, and match the first lyrics with the song file; the first lyrics are in multiple copies; Using a speech recognition model to perform lyrics recognition on the song file to obtain second lyrics, and matching the second lyrics with the song file; The lyrics file is obtained by using the structural information of the second lyrics and the lyrics content of the first lyrics to make corrections, including: dividing each first lyric into a verse part and a chorus part; respectively calculating the deviation rate of the verse part lyrics and the chorus deviation rate of the chorus part lyrics between each first lyric; determining the correct verse part and chorus part of the first lyrics according to the deviation rate; respectively matching the lyrics content of the first lyrics with the position of each word of the second lyrics content; obtaining the lyrics content of the first lyrics; calculating the deviation rate between each word of the first lyrics and each word of the corresponding position of the second lyrics; determining the wrong words in the second lyrics according to the deviation rate, and making corrections using the words at the corresponding positions of the first lyrics to obtain the lyrics file.
2. The method for matching lyrics of a song file according to claim 1, characterized in that: The step of obtaining the first lyrics of the song file according to the song information includes: Searching the song data ID corresponding to the song file in the song library according to the song information, and reading the corresponding song data according to the song data ID; wherein the song data includes the song file and its first lyrics; When there is no corresponding song data ID in the song library, a web crawling method is enabled to crawl multiple lyrics information of the song file from a public website to obtain the first lyrics.
3. The lyrics matching method of a song file according to claim 2, characterized in that: The song library uses an M-order B+ tree structure to store song data; wherein the song data is recorded as a song data ID in the tree structure; and a B+ tree hierarchical search algorithm is used to search the song library for the song data ID corresponding to the song file.
4. The method for matching lyrics of a song file according to claim 2, characterized in that: The method of enabling a web crawling method to crawl lyrics information of the song file from a public website includes: Install the crawler library corresponding to the Python program; Find the corresponding URL in the source code of the public website, and parse the source code to obtain the song name and song ID corresponding to the song file; According to the song name and song ID, crawl the lyrics data of the corresponding song file through the website interface; The non-lyrics information in the lyric data is cleaned and saved as plain text lyric information to obtain the first lyric.
5. The method for matching lyrics of a song file according to claim 1, characterized in that: The step of using a speech recognition model to perform lyrics recognition on the song file to obtain second lyrics includes: Constructing a speech recognition model; wherein the speech recognition model includes a single-word speech network and a phrase speech network; The speech recognition model is trained using song files and lyrics texts in a song library.
6. The method for matching lyrics of a song file according to claim 5, characterized in that: The method of training the speech recognition model by using the song files and lyrics texts of the song library includes: Extract song files and lyrics texts from the song library; An endpoint for preprocessing the song file and its lyrics text to identify words; Cut each word of the lyrics text to obtain single words or phrases; The single word or phrase is respectively input into the single word speech network and the phrase speech network for training.
7. The method for matching lyrics of a song file according to any one of claims 1 to 6, characterized in that: The method of using the structural information of the second lyrics and the lyrics content of the first lyrics to amend the lyrics file to obtain the lyrics file also includes: respectively matching each word of the lyrics content of the first lyrics with each word of the lyrics content of the second lyrics; Obtaining structural information of the second lyrics; The position of each word of the lyrics content of the first lyrics is corrected according to the structural information to obtain a lyrics file.
8. A lyrics matching device for a song file, characterized in that: include: A song acquisition module is used to acquire song information of song files; A first lyrics matching module, used for obtaining first lyrics of the song file according to the song information, and matching the first lyrics with the song file; the first lyrics are in multiple copies; A second lyrics matching module, used to use a speech recognition model to perform lyrics recognition on the song file to obtain second lyrics, and match the second lyrics with the song file; A joint correction module is used to use the structural information of the second lyrics and the lyrics content of the first lyrics to correct and obtain a lyrics file, including: dividing each first lyric into a verse part and a chorus part; respectively calculating the deviation rate of the verse part lyrics and the chorus deviation rate of the chorus part lyrics between each first lyric; determining the correct verse part and chorus part of the first lyrics according to the deviation rate; respectively matching the lyrics content of the first lyrics with the position of each word of the second lyrics content; obtaining the lyrics content of the first lyrics; calculating the deviation rate between each word of the first lyrics and each word at the corresponding position of the second lyrics; determining the wrong words in the second lyrics according to the deviation rate, and correcting them using the words at the corresponding position of the first lyrics to obtain a lyrics file.
