Lyrics display method, device, electronic device and storage medium

By dynamically adjusting the font size and number of lines of lyrics display based on the lyrics segmentation results, the maximum number of lines of the display level, and the maximum number of words in a single line, the problem of incomplete or wasteful display caused by lyrics that are too long or too short is solved, thereby improving the user experience.

CN119440706BActive Publication Date: 2025-09-26SHANGHAI JIDOU TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411589062.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-11-08
Publication Date
2025-09-26
Estimated Expiration
2044-11-08

AI Technical Summary

Technical Problem

In the prior art, due to the different lengths of lyrics, when the same display mode is used in the target display area, lyrics that are too long will result in partial incomplete display, while lyrics that are too short will result in a waste of display area, affecting the user experience.

Method used

According to the word segmentation results of the lyrics and the maximum number of lines and the maximum number of words in a single line of the display gear, the display font size and number of lines of the lyrics are dynamically adjusted to fully display them in the target display area and avoid waste.

Benefits of technology

By adjusting the display font size and number of lines, reasonable display of lyrics of different lengths is achieved, which improves the user experience and avoids waste of display area.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119440706B_ABST
    Figure CN119440706B_ABST
Patent Text Reader

Abstract

The present application discloses a method, device, electronic device, and storage medium for displaying lyrics. The method includes: obtaining lyrics data of target lyrics and multiple display gears; determining the target display gear corresponding to the target lyrics based on the word segmentation results and the maximum number of lines and the maximum number of words per line corresponding to each display gear; determining the target number of display lines for the target lyrics and the display content of each target display line based on the word segmentation results of the target lyrics and the maximum number of words per line of the target display gear; and displaying the target lyrics in a target display area according to the target number of display lines for the target lyrics and the display content of each target display line, in accordance with the font size corresponding to the target display gear. That is, the solution of the present application enables the display font size to be changed according to the length of the lyrics when the lyrics are of different lengths, thereby fully displaying the lyrics and avoiding waste of display area, thereby improving the user experience.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the technical field of lyrics display, and in particular to a lyrics display method, device, electronic device and storage medium. Background Art

[0002] With the rapid development of the Internet, media software has gradually entered various scenes in people's daily lives. In the increasingly diverse music playback scenarios, the display of lyrics is becoming increasingly important. Displaying song lyrics can make it easier for users to immerse themselves in the atmosphere of music.

[0003] Currently, any lyrics of any song are displayed in the target display area in the same display manner.

[0004] However, due to the different lengths of lyrics, when any lyrics of any song are displayed in the target display area using the same display method, if the lyrics are too long, some lyrics will not be displayed completely, and if the lyrics are too short, the display area will be wasted due to the small area for displaying the lyrics, thereby affecting the user experience. Summary of the Invention

[0005] The present application provides a lyrics display method, device, electronic device and storage medium to solve the problem in the prior art that due to the different lengths of lyrics, when any lyrics of any song are displayed in the same display method in a target display area, if the lyrics are too long, part of the lyrics will be incompletely displayed, and if the lyrics are too short, the display area will be wasted due to the small lyrics display area, thereby affecting the user experience.

[0006] In a first aspect, the present application provides a method for displaying lyrics, the method comprising:

[0007] Obtaining lyrics data and multiple display gears of target lyrics; wherein the lyrics data includes the word segmentation results of the target lyrics, and the display font sizes of the multiple display gears are different;

[0008] Determine the target display level corresponding to the target lyrics according to the word segmentation result and the maximum number of lines and the maximum number of words in a single line corresponding to each display level;

[0009] Determining the target number of display lines of the target lyrics and the display content of each target display line according to the word segmentation result of the target lyrics and the maximum number of words in a single line of the target display level;

[0010] According to the target number of display lines of the target lyrics and the display content of each target display line, the target lyrics are displayed in the target display area according to the font size corresponding to the target display gear.

[0011] In a second aspect, the present application provides a lyrics display device, the device comprising:

[0012] An acquisition module, configured to acquire lyrics data of a target lyric and a plurality of display gears; wherein the lyrics data includes a word segmentation result of the target lyric, and the display font sizes of the plurality of display gears are different;

[0013] a gear determination module, configured to determine a target display gear corresponding to the target lyrics according to the word segmentation result and the maximum number of lines and the maximum number of words in a single line corresponding to each display gear;

[0014] a content determination module, configured to determine the target number of display lines of the target lyrics and the display content of each target display line according to the word segmentation result of the target lyrics and the maximum number of words in a single line of the target display level;

[0015] The display module is used to display the target lyrics in the target display area according to the target display number of the target lyrics and the display content of each target display line and the font size corresponding to the target display gear.

[0016] In a third aspect, the present application provides an electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, the method for displaying lyrics as described in any embodiment of the present application is implemented.

[0017] In a fourth aspect, the present application provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the lyrics display method as described in any embodiment of the present application.

[0018] In a fifth aspect, the present application provides a computer program product, including a computer program, which, when executed by a processor, implements the lyrics display method as described in any embodiment of the present application.

[0019] The solution of the present application obtains lyrics data of target lyrics and multiple display gears; wherein the lyrics data includes the word segmentation results of the target lyrics, and the display font sizes of the multiple display gears are different; according to the word segmentation results and the maximum number of lines and the maximum number of words in a single line corresponding to each display gear, the target display gear corresponding to the target lyrics is determined; according to the word segmentation results of the target lyrics and the maximum number of words in a single line of the target display gear, the target number of display lines of the target lyrics and the display content of each target display line are determined; according to the target number of display lines of the target lyrics and the display content of each target display line, the target lyrics are displayed in the target display area according to the font size corresponding to the target display gear. That is, the solution of the present application displays the lyrics after word segmentation in the target display area according to the font size corresponding to the target display gear, so that the display font size can be changed according to the length of the lyrics when the lyrics are different, so that the lyrics can be fully displayed when the lyrics are too long, and the display area can be avoided from being wasted when the lyrics are too short, thereby improving the user experience. BRIEF DESCRIPTION OF THE DRAWINGS

[0020] In order to more clearly illustrate the technical solution of the present application, the following is a brief introduction to the drawings required for use in the embodiments. It should be understood that the following drawings only show certain embodiments of the present application and therefore should not be regarded as limiting the scope. For ordinary technicians in this field, other relevant drawings can be obtained based on these drawings without paying any creative work.

[0021] Figure 1 This is a flowchart of the method for displaying lyrics provided by this application;

[0022] Figure 2a This is another flowchart of the method for displaying lyrics provided by this application;

[0023] Figure 2b This is an exemplary lyrics display result diagram of the lyrics display method provided by this application;

[0024] Figure 3 This is a structural diagram of the lyrics display device provided by this application;

[0025] Figure 4 It is a structural diagram of the electronic device provided by this application. DETAILED DESCRIPTION

[0026] In order to enable those skilled in the art to better understand the present invention, the following will clearly and completely describe the technical solutions in the embodiments of the present invention in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments in the present invention, all other embodiments obtained by ordinary technicians in this field without making creative efforts should fall within the scope of protection of this application.

[0027] Figure 1 This is a flow chart of the method for displaying lyrics provided by the present application. The method can be executed by a lyric display device, which can be implemented in software and / or hardware. In a specific embodiment, the device can be applied to an electronic device, which can be a computer. The following embodiments will be described using the device applied to an electronic device as an example. Figure 1 , the method may specifically include the following steps:

[0028] Step 101: Acquire lyrics data of target lyrics and multiple display levels.

[0029] The lyrics data includes the word segmentation results of the target lyrics, and the display font sizes of the multiple display positions are different.

[0030] Specifically, the target lyrics are the next line of lyrics to be played during music playback. The lyrics data includes the lyrics content and the lyrics duration. The display duration of the lyrics in this embodiment is consistent with the lyrics duration. The lyrics content is segmented, for example, the lyrics are processed by a natural language processing library (NLP Library), and the lyrics can be segmented and displayed. For example, for the lyrics "I like to read her eyes when she is slightly drunk", the segmentation results obtained after the segmentation processing are "I, like, read, her, slightly drunk, when, of, eyes". The multiple display gears are pre-set font display gears with multiple different font sizes. For example, the multiple display gears include A gear, B gear, C gear and D gear. The font size of gear A is 180 characters, the font size of gear B is 120 characters, the font size of gear C is 80 characters, and the font size of gear D is 40 characters. When the lyrics are displayed in English, the corresponding font sizes of each gear are preset English font sizes. When the lyrics are displayed in Japanese or Korean, the multiple display gears are consistent with the Chinese display gears, and when the lyrics are displayed in other languages, the multiple display gears are consistent with the English display gears.

[0031] Step 102: Determine the target display level corresponding to the target lyrics based on the word segmentation results, the maximum number of lines corresponding to each display level, and the maximum number of words in a single line.

[0032] Specifically, each display level corresponds to a maximum number of rows and a maximum number of characters per line in the target display area. This means that at that level, each display level can fully display the maximum number of rows in the target display area, as well as the maximum number of characters per line that can be displayed in each row. Based on the maximum number of rows and the maximum number of characters per line corresponding to each display level, the total number of characters that can be displayed in the display area corresponding to that level is determined. The target display level corresponding to the target lyrics is then determined based on the number of lyrics in the word segmentation results and the total number of characters that can be displayed in the display area corresponding to each level.

[0033] For example, the maximum number of characters per line in position A is 5, and the maximum number of lines in position A is 2. The maximum number of characters per line in position B is 10, and the maximum number of lines in position B is 3. Therefore, the total number of characters that can be displayed in the display area corresponding to position A is 10, and the total number of characters that can be displayed in the display area corresponding to position B is 30. Based on the word count of 15 characters in the lyrics in the word segmentation result, position B is determined to be the target display position corresponding to the target lyrics.

[0034] Optionally, before executing step 102, steps 21 and 22 may also be executed.

[0035] Step 21: Obtain the display width and display height of the target display area.

[0036] Specifically, the target display area is an area for displaying lyrics. For example, in the target display area, the display width is 10 cm and the display height is 8 cm.

[0037] Step 22, based on the font width corresponding to each display gear, the font height corresponding to each display gear, the display width of the target display area, and the display height of the target display area, determine the maximum number of lines and the maximum number of characters in a single line corresponding to each display gear in the target display area.

[0038] Specifically, the maximum number of characters in a single line corresponding to each display level in the target display area can be determined based on the font width corresponding to each display level and the display width of the target display area. The maximum number of lines corresponding to each display level in the target display area can be determined based on the font height corresponding to each display level and the display height of the target display area.

[0039] Step 103 , determining the target number of display lines of the target lyrics and the display content of each target display line according to the word segmentation result of the target lyrics and the maximum number of words in a single line of the target display level.

[0040] Specifically, according to the word segmentation results of the target lyrics and the maximum number of words in a single line of the target display gear, the word segmentation results of the target lyrics are arranged according to the arrangement order of the words in the lyrics until the maximum number of words in a single line of the target display gear is reached. At this time, the remaining words are arranged in another line until the maximum number of words in a single line of the target display gear is reached again. After the word segmentation results of the target lyrics are arranged, the generated number of display rows is the target number of display rows of the target lyrics, and the word segmentation results completed in each row are the display content of each target display row.

[0041] Optionally, the word segmentation result includes multiple lyrics word segments and word segmentation orders, and step 103 can be implemented through steps 1031 to 1033.

[0042] Step 1031, based on the word segmentation results of the target lyrics and the maximum number of words in a single line of the target display level, fill the lyrics segments of the target lyrics into the first line of the target display line in the word segmentation order to obtain a word segmentation result combination.

[0043] Specifically, according to the word segmentation results of the target lyrics and the maximum number of words in a single line of the target display level, the lyrics segmentation of the target lyrics are filled into the first line of the target display line in the word segmentation order. At this time, the content in the first line is the word segmentation result combination.

[0044] Optionally, the lyrics segmentation of the target lyrics is filled into the first row of the target display row according to the segmentation order, and the segmentation result combination is obtained through steps 311 to 314.

[0045] Step 311: put the first lyric segmentation in the lyric segmentation into the first row.

[0046] Specifically, the first lyric segmentation is the first segmentation in the segmentation results for that line. For example, in "I like to read her eyes when she's tipsy," the first lyric segmentation is "I." The first line is the pre-generated row for placing lyric segmentations. The maximum number of characters per line is the maximum number of characters per line for the target display level. For example, "I" is placed in the first line.

[0047] Step 312: Place the second lyric segmentation among the multiple lyric segmentations after the first lyric segmentation in the first line.

[0048] The second lyrics segmentation is the adjacent segmentation after the first lyrics segmentation.

[0049] For example, in "I like to read her eyes when she is slightly drunk", the first lyric segmentation is "I", and the second lyric segmentation is "like". After the second lyric segmentation in the multiple lyric segmentations is placed in the first lyric segmentation in the first line, the content of the first line is "I like".

[0050] Step 313: If the number of words in the first line is less than the maximum number of words in a single line of the target display gear, the second lyrics segmentation is used as the new first lyrics segmentation, and the adjacent segmentation after the second lyrics segmentation is used as the new second lyrics segmentation, and the process returns to step 312 until the number of words in the first line is greater than or equal to the maximum number of words in a single line of the target display gear.

[0051] Specifically, if the number of words in the first line is less than the maximum number of words in a single line of the target display gear, which means that the target display gear cannot display all the information in a single line, the second lyrics segmentation will be used as the new first lyrics segmentation, and the adjacent segmentation after the second lyrics segmentation will be used as the new second lyrics segmentation, and the process returns to step 312 until the number of words in the first line is greater than or equal to the maximum number of words in a single line of the target display gear.

[0052] For example, if the maximum number of characters per line for the target display level is 5, and the number of characters in the first line is 3, which is less than the maximum number of characters per line for the target display level, the second lyrics segment is used as the new first lyrics segment, and the adjacent segment after the second lyrics segment, i.e., "reading", is used as the new second lyrics segment. The process returns to step 312, where "reading" is added after "like". At this point, the number of characters in the first line equals the maximum number of characters per line for the target display level, and the loop ends.

[0053] Step 314: If the number of words in the first line is greater than or equal to the maximum number of words in a single line of the target display level, the lyrics word combination in the first line is used as the word segmentation result combination.

[0054] Specifically, if the number of words in the first line is greater than or equal to the maximum number of words in a single line of the target display level, the lyrics word combination in the first line is used as the word segmentation result combination.

[0055] Step 1032: If the length of the word segmentation result combination is greater than the length of the first line of the target display row, the second line of the target display row is used as the first line of the new target display row, the last lyrics word segmentation in the word segmentation result combination is deleted, and the last lyrics word segmentation in the word segmentation result combination to the target lyrics is used as the new target lyrics word segmentation result, and the process returns to step 1031 until the multiple lyrics word segmentations in the word segmentation result are filled in the multiple target display rows.

[0056] Specifically, if the length of the word segmentation result combination is greater than the length of the first line of the target display row, it means that the target display area cannot fully display the content of the first line. In this case, the second line of the target display row is used as the first line of the new target display row, and the last lyrics word segmentation in the word segmentation result combination is deleted. Then, the last lyrics word segmentation in the word segmentation result combination to the last lyrics word segmentation in the word segmentation result of the target lyrics is used as the new target lyrics word segmentation result, and the process returns to step 1031 until the multiple lyrics word segmentations in the word segmentation result are filled in the multiple target display rows.

[0057] For example, the word segmentation result combination is "I like reading", which is 5 characters long, while the length of the first line of the target display line is 4 characters. At this time, the length of the word segmentation result combination is greater than the length of the first line of the target display line. Therefore, the second line of the target display line is used as the first line of the new target display line, and the last lyric segmentation in the word segmentation result combination, that is, "reading", is deleted. Then, the last lyric segmentation in the word segmentation result combination to the last lyric segmentation in the segmentation result of the target lyrics is used as the new target lyrics segmentation result, that is, the new target lyrics segmentation result is "Reading her eyes when she is slightly drunk", and the process returns to step 1031 until the multiple lyric segmentations in the word segmentation result are filled in the multiple target display lines.

[0058] Step 1033: Determine the target number of display lines of the target lyrics and the display content of each target display line according to the filling results of the multiple lyrics segmentation results in the segmentation results.

[0059] Specifically, after the multiple lyrics segmentation results are filled into the multiple target display lines, multiple target display lines are obtained, each of which has the display content of the target display line. Therefore, based on the filling results of the multiple lyrics segmentation results, the target number of display lines for the target lyrics and the display content of each target display line are determined.

[0060] Optionally, after executing step 103 , step 31 may also be executed.

[0061] Step 31: If the target display row number is greater than the maximum row number of the target display gear, the next gear of the target display gear is determined as the new target display gear, and the process returns to step 103 until the target display row number is less than or equal to the maximum row number of the target display gear.

[0062] The font size corresponding to the next gear of the target display gear is smaller than the font size corresponding to the target display gear.

[0063] Specifically, if the target number of display lines is greater than the maximum number of lines for the target display level, it means that the font corresponding to the target display level cannot fully display the lyrics. This may be because some words cannot be displayed on new lines in the word segmentation results for easier reading. In this case, the next level after the target display level is determined as the new target display level. Even if the display font size is reduced, the process returns to step 103, i.e., re-determining the display content of each line and the target number of display lines, until the target number of display lines is less than or equal to the maximum number of lines for the target display level.

[0064] Step 104 , displaying the target lyrics in the target display area according to the target display row number of the target lyrics and the display content of each target display row and in the font size corresponding to the target display level.

[0065] Specifically, the display content of each target display line is displayed in the target display area according to the font size corresponding to the target display level. The display process of the target lyrics can be implemented by JavaScript.

[0066] For example, Figure 2b This is an exemplary lyrics display result diagram of the lyrics display method provided by this application. The target display line number is 3 lines. The display content of the first line is "I like reading", the display content of the second line is "When she is slightly drunk", and the display content of the third line is "Eyes". The effect of displaying the target lyrics in the target display area according to the font size corresponding to the target display gear is as follows Figure 2b shown.

[0067] The solution of the present application obtains lyrics data of target lyrics and multiple display gears; wherein the lyrics data includes the word segmentation results of the target lyrics, and the display font sizes of the multiple display gears are different; according to the word segmentation results and the maximum number of lines and the maximum number of words in a single line corresponding to each display gear, the target display gear corresponding to the target lyrics is determined; according to the word segmentation results of the target lyrics and the maximum number of words in a single line of the target display gear, the target number of display lines of the target lyrics and the display content of each target display line are determined; according to the target number of display lines of the target lyrics and the display content of each target display line, the target lyrics are displayed in the target display area according to the font size corresponding to the target display gear. That is, the solution of the present application displays the lyrics after word segmentation in the target display area according to the font size corresponding to the target display gear, so that the display font size can be changed according to the length of the lyrics when the lyrics are different, so that the lyrics can be fully displayed when the lyrics are too long, and the display area can be avoided from being wasted when the lyrics are too short, thereby improving the user experience.

[0068] Figure 2a This is another flowchart of the lyrics display method provided by this application. Figure 1Based on the embodiment shown and various optional implementation schemes, the process of displaying the target lyrics in the target display area is described in detail. Figure 2a As shown, the method may include the following steps:

[0069] Step 201: Acquire lyrics data of target lyrics and multiple display levels.

[0070] Step 202: Determine the target display level corresponding to the target lyrics based on the word segmentation results, the maximum number of lines corresponding to each display level, and the maximum number of words in a single line.

[0071] Step 203 : Determine the target number of display lines of the target lyrics and the display content of each target display line according to the word segmentation result of the target lyrics and the maximum number of words in a single line of the target display level.

[0072] Step 204 , determining the target display width of each line of the target lyrics and the target display height of the target lyrics according to the target display line number of the target lyrics and the display content of each target display line.

[0073] For example, the target display line number of the target lyrics is 3 lines, and the height of each line is 3 cm, so the target display height of the target lyrics is 9 cm. The target display widths of each line of the target lyrics are 5 cm, 7 cm, and 2 cm respectively.

[0074] Step 205 : determining a target zoom ratio according to the display width, the display height, the target display width, and the target display height.

[0075] Specifically, because the font sizes corresponding to the various display positions may differ significantly, for example, the difference between 180-point font and 120-point font is significant, the display area of ​​the lyrics after display will differ significantly from the target display area. Therefore, a target zoom ratio can be determined based on the display width, display height, target display width, and target display height, thereby reducing or enlarging the actual lyrics overall to fully utilize the target display area.

[0076] Optionally, step 205 can be implemented through steps 2051 to 2052.

[0077] Step 2051 : Determine the width ratio of the display width to the target display width, and the height ratio of the display height to the target display height.

[0078] For example, if the display width is 10 cm and the target display width is 9 cm, the ratio of the determined display width to the target display width is 10:9; if the display height is 10 cm and the target display width is 8 cm, the ratio of the determined display height to the target display height is 10:8.

[0079] Step 2052: Determine the minimum value of the width ratio and the height ratio as the target scaling ratio.

[0080] Specifically, the minimum value of the width ratio and the height ratio is determined as the target scaling ratio to prevent scaling one aspect from exceeding the target display area when scaling the other aspect.

[0081] Step 206 : Adjust the font size corresponding to the target display level according to the target zoom ratio to obtain an adjusted font size.

[0082] Specifically, the font size corresponding to the target display gear is adjusted according to the target zoom ratio, that is, the font size is reduced or enlarged according to the target zoom ratio to obtain the adjusted font size.

[0083] Step 207 : Display the target lyrics in the target display area according to the target display line number of the target lyrics and the display content of each target display line and in the adjusted font size.

[0084] Specifically, the display content of each target display line is displayed in the target display area according to the adjusted font size.

[0085] The solution of the present application determines the target scaling ratio for scaling the lyrics font size based on the display width and display height of the target display area, as well as the target display width and target display height of the lyrics, and then scales and adjusts the lyrics font size, thereby further ensuring the appropriateness of the lyrics font size and further avoiding waste of display area when the lyrics are too short, thereby improving the user experience.

[0086] Figure 3 This is a structural diagram of a lyrics display device provided by this application, which is suitable for executing the lyrics display method provided by this application. Figure 3 As shown, the device may specifically include:

[0087] The acquisition module 301 is used to acquire lyrics data of target lyrics and multiple display gears; wherein the lyrics data includes the word segmentation results of the target lyrics, and the display font sizes of the multiple display gears are different.

[0088] The gear determination module 302 is used to determine the target display gear corresponding to the target lyrics according to the word segmentation result and the maximum number of lines and the maximum number of words in a single line corresponding to each display gear.

[0089] The content determination module 303 is used to determine the target display lines of the target lyrics and the display content of each target display line according to the word segmentation result of the target lyrics and the maximum number of words in a single line of the target display level.

[0090] The display module 304 is configured to display the target lyrics in a target display area according to the target display number of the target lyrics and the display content of each target display line and in a font size corresponding to the target display level.

[0091] In one embodiment, after determining the target number of display rows of the target lyrics and the display content of each target display row based on the word segmentation result of the target lyrics and the maximum number of words in a single row of the target display gear, the content determination module 303 is further used to: if the target number of display rows is greater than the maximum number of rows of the target display gear, determine the next gear of the target display gear as the new target display gear, and return to execute the step of "determining the target number of display rows of the target lyrics and the display content of each target display row based on the word segmentation result of the target lyrics and the maximum number of words in a single row of the target display gear" until the target number of display rows is less than or equal to the maximum number of rows of the target display gear; wherein, the font size corresponding to the next gear of the target display gear is smaller than the font size corresponding to the target display gear.

[0092] In one embodiment, the word segmentation result includes multiple lyrics word segments and word segmentation orders. The content determination module 303 is specifically used to: fill the lyrics word segments of the target lyrics into the first line of the target display line according to the word segmentation result of the target lyrics and the maximum number of words in a single line of the target display position according to the word segmentation order to obtain a word segmentation result combination; if the length of the word segmentation result combination is greater than the length of the first line of the target display line, the second line of the target display line is used as the first line of the new target display line, the last lyrics word in the word segmentation result combination is deleted, and the last word in the word segmentation result combination is replaced with the first line of the target display line. A lyric segmentation to the last lyric segmentation in the segmentation result of the target lyric is used as the new target lyric segmentation result, and the step of "filling the lyric segmentation of the target lyric into the first row of the target display row according to the segmentation result of the target lyric and the maximum number of words in a single row of the target display gear in the segmentation order to obtain a segmentation result combination" is returned until multiple lyric segmentations in the segmentation result are filled into multiple target display rows; according to the filling results of multiple lyric segmentations in the segmentation result, the target display number of the target lyric and the display content of each target display row are determined.

[0093] In one embodiment, the content determination module 303 is specifically used to fill the lyrics segmentation of the target lyrics into the first row of the target display row according to the segmentation order to obtain the segmentation result combination, which is specifically used to: put the first lyrics segmentation in the lyrics segmentation into the first row; put the second lyrics segmentation in the multiple lyrics segmentations after the first lyrics segmentation in the first row; wherein the second lyrics segmentation is the adjacent segmentation after the first lyrics segmentation; if the number of words in the first row is less than the maximum number of words in a single row of the target display gear, then use the second lyrics segmentation as the new first lyrics segmentation, and the adjacent segmentation after the second lyrics segmentation as the new second lyrics segmentation, and return to execute the step of "putting the second lyrics segmentation in the multiple lyrics segmentations after the first lyrics segmentation in the first row" until the number of words in the first row is greater than or equal to the maximum number of words in a single row of the target display gear; if the number of words in the first row is greater than or equal to the maximum number of words in a single row of the target display gear, then use the lyrics segmentation combination in the first row as the segmentation result combination.

[0094] In one embodiment, before determining the target display gear corresponding to the target lyrics based on the word segmentation results and the maximum number of rows and the maximum number of words in a single line corresponding to each display gear, the gear determination module 302 is also used to: obtain the display width and display height of the target display area; determine the maximum number of rows and the maximum number of words in a single line corresponding to each display gear in the target display area based on the font width corresponding to each display gear, the font height corresponding to each display gear, the display width of the target display area, and the display height of the target display area.

[0095] In one embodiment, the display module 304 is further used to: determine the target display width of each line of the target lyrics and the target display height of the target lyrics according to the target number of display lines of the target lyrics and the display content of each target display line, before displaying the target lyrics in the target display area according to the font size corresponding to the target display gear; determine the target zoom ratio according to the display width, the display height, the target display width and the target display height; the display module 304 is specifically used to: adjust the font size corresponding to the target display gear according to the target zoom ratio to obtain the adjusted font size; display the target lyrics in the target display area according to the target number of display lines of the target lyrics and the display content of each target display line according to the adjusted font size.

[0096] In one embodiment, the display module 304, in determining the target zoom ratio based on the display width, the display height, the target display width, and the target display height, is specifically used to: determine the width ratio of the display width to the target display width, and the height ratio of the display height to the target display height; and determine the minimum value of the width ratio and the height ratio as the target zoom ratio.

[0097] The device of the present application obtains lyrics data of target lyrics and multiple display gears; wherein the lyrics data includes the word segmentation results of the target lyrics, and the display font sizes of the multiple display gears are different; according to the word segmentation results and the maximum number of lines and the maximum number of words in a single line corresponding to each display gear, the target display gear corresponding to the target lyrics is determined; according to the word segmentation results of the target lyrics and the maximum number of words in a single line of the target display gear, the target number of display lines of the target lyrics and the display content of each target display line are determined; according to the target number of display lines of the target lyrics and the display content of each target display line, the target lyrics are displayed in the target display area according to the font size corresponding to the target display gear. That is, the scheme of the present application displays the lyrics after word segmentation in the target display area according to the font size corresponding to the target display gear, so that the display font size can be changed according to the length of the lyrics when the lyrics are different, so that the lyrics can be fully displayed when the lyrics are too long, and the display area can be avoided from being wasted when the lyrics are too short, thereby improving the user experience.

[0098] The present application also provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the program, the lyric display method provided in any of the above embodiments is implemented.

[0099] The present application also provides a computer-readable medium having a computer program stored thereon, which, when executed by a processor, implements the lyrics display method provided in any of the above embodiments.

[0100] Reference below Figure 4 , which shows a structural diagram of an electronic device 400 suitable for implementing the present application. Figure 4 The electronic device shown is only an example and should not bring any limitation to the function and scope of use of the present application.

[0101] like Figure 4As shown, electronic device 400 includes a central processing unit (CPU) 401, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 402 or a program loaded from a storage portion 408 into a random access memory (RAM) 403. Various programs and data required for the operation of electronic device 400 are also stored in RAM 403. CPU 401, ROM 402, and RAM 403 are connected to each other via a bus 404. An input / output (I / O) interface 405 is also connected to bus 404.

[0102] The following components are connected to the I / O interface 405: an input section 406 including a keyboard, a mouse, and the like; an output section 407 including devices such as a cathode ray tube (CRT), a liquid crystal display (LCD), and a speaker; a storage section 408 including a hard disk; and a communication section 409 including a network interface card such as a LAN card or a modem. The communication section 409 performs communication processing via a network such as the Internet. A drive 410 is also connected to the I / O interface 405 as needed. Removable media 411, such as a magnetic disk, an optical disk, a magneto-optical disk, or a semiconductor memory, is installed in the drive 410 as needed, so that computer programs read therefrom can be installed into the storage section 408 as needed.

[0103] In particular, according to the embodiments disclosed in the present application, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, the embodiments disclosed in the present application include a computer program product comprising a computer program carried on a computer-readable medium, the computer program comprising program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from a network via the communication section 409, and / or installed from a removable medium 411. When the computer program is executed by the central processing unit (CPU) 401, the above-mentioned functions defined in the system of the present application are executed.

[0104] It should be noted that the computer-readable medium shown in this application can be a computer-readable signal medium or a computer-readable storage medium, or any combination of the two. The computer-readable storage medium can be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or device, or any combination of the above. More specific examples of computer-readable storage media can include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In this application, a computer-readable storage medium can be any tangible medium that contains or stores a program that can be used by or in conjunction with an instruction execution system, device, or device. In this application, a computer-readable signal medium can include a data signal propagated in baseband or as part of a carrier wave, which carries computer-readable program code. This propagated data signal can take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. A computer-readable signal medium may also be any computer-readable medium other than a computer-readable storage medium that can transmit, propagate, or transport a program for use by or in conjunction with an instruction execution system, apparatus, or device. Program code embodied on a computer-readable medium may be transmitted using any suitable medium, including but not limited to wireless, wireline, optical fiber cable, RF, or any suitable combination thereof.

[0105] The flowcharts and block diagrams in the accompanying drawings illustrate the possible implementation architecture, functions and operations of the systems, methods and computer program products according to various embodiments of the present application. In this regard, each box in the flowchart or block diagram can represent a module, program segment, or a part of code, and the above-mentioned module, program segment, or a part of code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in an order different from that marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram or flowchart, and the combination of the boxes in the block diagram or flowchart, can be implemented with a dedicated hardware-based system that performs the specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.

[0106] The modules and / or units described in this application may be implemented in software or hardware. The modules and / or units described may also be provided within a processor. For example, a processor may be described as including an acquisition module, a gear determination module, a content determination module, and a display module. The names of these modules do not, in some cases, limit the modules themselves.

[0107] As another aspect, the present application further provides a computer-readable medium, which may be included in the device described in the above embodiments; or may exist independently without being incorporated into the device. The computer-readable medium carries one or more programs, and when the one or more programs are executed by a device, the device performs the following operations:

[0108] Obtain lyrics data of target lyrics and multiple display gears; wherein the lyrics data includes word segmentation results of the target lyrics, and the display font sizes of the multiple display gears are different; determine the target display gear corresponding to the target lyrics according to the word segmentation results and the maximum number of rows and the maximum number of words in a single row corresponding to each display gear; determine the target number of display rows of the target lyrics and the display content of each target display row according to the word segmentation results of the target lyrics and the maximum number of words in a single row of the target display gear; display the target lyrics in the target display area according to the target number of display rows of the target lyrics and the display content of each target display row according to the target number of display rows of the target lyrics and the display content of each target display row.

[0109] According to the technical solution of the present application, lyrics data of target lyrics and multiple display gears are obtained; wherein the lyrics data includes the word segmentation results of the target lyrics, and the display font sizes of the multiple display gears are different; according to the word segmentation results and the maximum number of lines and the maximum number of words in a single line corresponding to each display gear, the target display gear corresponding to the target lyrics is determined; according to the word segmentation results of the target lyrics and the maximum number of words in a single line of the target display gear, the target number of display lines of the target lyrics and the display content of each target display line are determined; according to the target number of display lines of the target lyrics and the display content of each target display line, the target lyrics are displayed in the target display area according to the font size corresponding to the target display gear. That is, the solution of the present application displays the lyrics after word segmentation in the target display area according to the font size corresponding to the target display gear, so that the display font size can be changed according to the length of the lyrics when the lyrics are different, so that the lyrics can be fully displayed when the lyrics are too long, and the display area can be avoided from being wasted when the lyrics are too short, thereby improving the user experience.

[0110] An embodiment of the present application also provides a computer program product, including a computer program, which, when executed by a processor, implements the lyrics display method provided in any embodiment of the present application.

[0111] The computer program product, during implementation, may be written in one or more programming languages ​​or a combination thereof, for performing the operations of the present application, including object-oriented programming languages ​​such as Java, Smalltalk, C++, and conventional procedural programming languages ​​such as "C" or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, as a separate software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving a remote computer, the remote computer may be connected to the user's computer via any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., via the Internet using an Internet service provider).

[0112] It should be understood that the various forms of the processes shown above can be used to reorder, add, or delete steps. For example, the steps described in this application can be performed in parallel, sequentially, or in a different order, as long as the desired results of the technical solution of this application can be achieved. This is not limited herein.

[0113] The above specific embodiments do not constitute a limitation on the scope of protection of this application. Those skilled in the art will appreciate that various modifications, combinations, sub-combinations, and substitutions may occur depending on design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of this application shall be included within the scope of protection of this application.

Claims

1. A method for displaying lyrics, characterized in that: The method comprises: Obtaining lyrics data and multiple display gears of target lyrics; wherein the lyrics data includes the word segmentation results of the target lyrics, and the display font sizes of the multiple display gears are different; Determine the target display level corresponding to the target lyrics according to the word segmentation result and the maximum number of lines and the maximum number of words in a single line corresponding to each display level; Determining the target number of display lines of the target lyrics and the display content of each target display line according to the word segmentation result of the target lyrics and the maximum number of words in a single line of the target display level; According to the target number of display lines of the target lyrics and the display content of each target display line, the target lyrics are displayed in the target display area according to the font size corresponding to the target display gear.

2. The method according to claim 1, characterized in that After determining the target number of display lines of the target lyrics and the display content of each target display line based on the word segmentation result of the target lyrics and the maximum number of words in a single line of the target display level, the method further includes: If the target number of display rows is greater than the maximum number of rows of the target display gear, the next gear of the target display gear is determined as the new target display gear, and the process returns to the step of "determining the target number of display rows of the target lyrics and the display content of each target display row based on the word segmentation result of the target lyrics and the maximum number of words in a single line of the target display gear" until the target number of display rows is less than or equal to the maximum number of rows of the target display gear; wherein, the font size corresponding to the next gear of the target display gear is smaller than the font size corresponding to the target display gear.

3. The method according to claim 1, characterized in that The word segmentation result includes a plurality of lyrics word segments and a word segmentation order. The target number of display lines of the target lyrics and the display content of each target display line are determined based on the word segmentation result of the target lyrics and the maximum number of words in a single line of the target display level, including: According to the word segmentation result of the target lyrics and the maximum number of words in a single line of the target display level, the lyrics segmentation of the target lyrics is filled into the first line of the target display line according to the word segmentation order to obtain a word segmentation result combination; If the length of the word segmentation result combination is greater than the length of the first line of the target display row, the second line of the target display row is used as the first line of the new target display row, the last lyrics segmentation in the word segmentation result combination is deleted, and the last lyrics segmentation in the word segmentation result combination to the last lyrics segmentation in the word segmentation result of the target lyrics is used as the new target lyrics segmentation result, and the step of "filling the target lyrics segmentation in the first line of the target display row according to the word segmentation result and the maximum number of words in a single line of the target display gear according to the word segmentation order to obtain a word segmentation result combination" is returned to be executed until multiple lyrics segmentations in the word segmentation result are filled in multiple target display rows; According to the filling results of multiple lyrics segmentations in the segmentation results, the target number of display rows of the target lyrics and the display content of each target display row are determined.

4. The method according to claim 3, characterized in that The step of filling the target lyrics into the first row of the target display row according to the segmentation order to obtain a segmentation result combination includes: Putting the first lyric segmentation in the lyric segmentation into the first line; Putting a second lyric segmentation among the multiple lyric segmentations after the first lyric segmentation in the first line; wherein the second lyric segmentation is an adjacent segmentation after the first lyric segmentation; If the number of words in the first line is less than the maximum number of words in a single line of the target display gear, the second lyrics segmentation is used as a new first lyrics segmentation, and the adjacent segmentation after the second lyrics segmentation is used as a new second lyrics segmentation, and the process returns to the step of "putting the second lyrics segmentation in the multiple lyrics segmentations after the first lyrics segmentation in the first line" until the number of words in the first line is greater than or equal to the maximum number of words in a single line of the target display gear; If the number of words in the first line is greater than or equal to the maximum number of words in a single line of the target display position, the lyrics word combination in the first line is used as the word segmentation result combination.

5. The method according to claim 1, wherein Before determining the target display position corresponding to the target lyrics based on the word segmentation result and the maximum number of lines and the maximum number of words in a single line corresponding to each display position, the method further includes: Obtaining the display width and display height of the target display area; According to the font width corresponding to each display gear, the font height corresponding to each display gear, the display width of the target display area and the display height of the target display area, the maximum number of rows and the maximum number of words in a single line corresponding to each display gear in the target display area are determined.

6. The method according to claim 5, characterized in that Before displaying the target lyrics in the target display area according to the target number of display lines of the target lyrics and the display content of each target display line and in the font size corresponding to the target display level, the method further includes: Determining a target display width for each line of the target lyrics and a target display height for the target lyrics according to the target number of display lines of the target lyrics and the display content of each target display line; determining a target zoom ratio according to the display width, the display height, the target display width, and the target display height; The method of displaying the target lyrics in the target display area according to the target number of display lines of the target lyrics and the display content of each target display line and according to the font size corresponding to the target display level includes: Adjusting the font size corresponding to the target display gear according to the target scaling ratio to obtain an adjusted font size; According to the target number of display lines of the target lyrics and the display content of each target display line, the target lyrics are displayed in the target display area according to the adjusted font size.

7. The method according to claim 6, characterized in that The determining the target scaling ratio according to the display width, the display height, the target display width, and the target display height includes: Determining a width ratio of the display width to the target display width, and a height ratio of the display height to the target display height; The minimum value of the width ratio and the height ratio is determined as the target scaling ratio.

8. A lyrics display device, characterized in that: The device comprises: An acquisition module, configured to acquire lyrics data of a target lyric and a plurality of display gears; wherein the lyrics data includes a word segmentation result of the target lyric, and the display font sizes of the plurality of display gears are different; a gear determination module, configured to determine a target display gear corresponding to the target lyrics according to the word segmentation result and the maximum number of lines and the maximum number of words in a single line corresponding to each display gear; a content determination module, configured to determine the target number of display lines of the target lyrics and the display content of each target display line according to the word segmentation result of the target lyrics and the maximum number of words in a single line of the target display level; The display module is used to display the target lyrics in the target display area according to the target display number of the target lyrics and the display content of each target display line and the font size corresponding to the target display gear.

9. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein: When the processor executes the program, the lyrics display method according to any one of claims 1 to 7 is implemented.

10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the lyrics display method according to any one of claims 1 to 7 is implemented.

Citation Information

Patent Citations

  • Screen-off display method and electronic equipment

    CN114003319A

  • Word partitioning method and device and storage medium

    WO2018184510A1