Lyric display method and device, electronic equipment and storage medium
By dynamically adjusting the lyric display font size, determining the target display gear according to the lyric length, and displaying it in the target display area, it solves the problems of incomplete display and waste of display areas caused by different lyrics, and improves the user experience.
Patent Information
- Application Number
- CN202411589062.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-08
- Publication Date
- 2025-02-14
- Estimated Expiration
- 2044-11-08
AI Technical Summary
In the prior art, due to different lengths of lyrics, when any lyrics of any song are used in the same display mode, if the lyrics are too long, some lyrics will be incompletely displayed, and if the lyrics are too short, the display area will be wasted, affecting the user's User experience.
By obtaining the lyrics data of the target lyrics and multiple display gears, the target display gear of the target lyrics is determined according to the word segmentation results, the maximum number of lines and the maximum number of words per display gear, and the font number of the target display gear is determined according to the font size of the target display gear. Displays the lyrics in the target display area.
It realizes dynamic adjustment of the display font size according to the length of the lyrics, ensuring that the lyrics are fully displayed in the target display area, and avoiding waste in the display area, improving the user experience.
Smart Images

Figure CN119440706A_ABST
Abstract
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 life. In the increasingly rich music playing scenes, the display of lyrics is becoming increasingly important. Displaying the lyrics of songs 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 in the same manner, if the lyrics are too long, some of the lyrics will not be fully 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. 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 manner 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] Acquire lyrics data and multiple display positions of target lyrics; wherein the lyrics data includes the word segmentation result of the target lyrics, and the display font sizes of the multiple display positions 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] 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, determine the target number of display lines of the target lyrics and the display content of each target display line;
[0010] According to the target display line number 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, 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;
[0013] A gear determination module, 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;
[0014] A content determination module, used 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 a 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 lyrics display method 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 scheme of the present application obtains 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 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 waste of the display area can be avoided 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 drawings required for use in the embodiments will be briefly introduced below. 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 related drawings can be obtained based on these drawings without paying creative work.
[0021] Figure 1 It is a flowchart of the lyrics display method provided by this application;
[0022] Figure 2a is another flowchart of the lyrics display method provided by the present application;
[0023] Figure 2b is an exemplary lyrics display result diagram of the lyrics display method provided by the present application;
[0024] Figure 3 It is a structural schematic diagram of a lyrics display device provided by the present application;
[0025] Figure 4 It is a structural schematic 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 solution of the present application, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present application.
[0027] Figure 1 The present invention provides a flowchart of a method for displaying lyrics. The method can be performed 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 by taking the device applied to an electronic device as an example. Figure 1 , the method may specifically include the following steps:
[0028] Step 101, obtaining 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 lyrics to be played during the music playback process. 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 processed by word segmentation, for example, the lyrics are processed by the natural language processing library (natural language processing Library, NLPLibrary), and the lyrics can be processed and displayed after word segmentation. For example, for the lyrics I like to read her eyes when she is slightly drunk, the word segmentation results obtained after word segmentation are me, like, read, she, slightly drunk, when, of, eyes. Multiple display gears are pre-set font display gears of multiple different font sizes, for example, multiple display gears include A gear, B gear, C gear and D gear, A gear font size is 180 characters, B gear font size is 120 characters, C gear font size is 80 characters, and D gear font size is 40 characters. When displaying lyrics 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, determining the target display level corresponding to the target lyrics according to the word segmentation result and the maximum number of lines corresponding to each display level and the maximum number of words in a single line.
[0032] Specifically, each display gear corresponds to a maximum number of rows and a maximum number of words in a single row in the target display area, that is, at this gear, each display gear can fully display the maximum number of rows in the target display area, and the maximum number of words in each row. According to the maximum number of rows and the maximum number of words in a single row corresponding to each display gear, the total number of words that can be displayed in the display area corresponding to the gear is determined. Then, according to the number of lyrics words in the word segmentation result and the total number of words that can be displayed in the display area corresponding to each gear, the target display gear corresponding to the target lyrics is determined.
[0033] For example, the maximum number of characters in a single line of A gear is 5 characters, the maximum number of lines in A gear is 2 lines, the maximum number of characters in a single line of B gear is 10 characters, and the maximum number of lines in B gear is 3 lines. Therefore, the total number of characters that can be displayed in the display area corresponding to A gear is 10 characters, and the total number of characters that can be displayed in the display area corresponding to B gear is 30 characters. According to the number of characters in the lyrics in the word segmentation result is 15 characters, B gear is determined as the target display gear corresponding to the target lyrics.
[0034] Optionally, before executing step 102, steps 21 and 22 may also be executed.
[0035] Step 21, obtaining 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, determining 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 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.
[0038] Specifically, the maximum number of characters in a single line corresponding to each display gear in the target display area can be determined based on the font width corresponding to each display gear and the display width of the target display area. The maximum number of lines corresponding to each display gear in the target display area can be determined based on the font height corresponding to each display gear and the display height of the target display area.
[0039] Step 103, 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, determine the target display line number of the target lyrics and the display content of each target display line.
[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 in the order of the word segmentations 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 word segmentations 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 that have been arranged 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, 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, fill the word 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 word segments 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 can be 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 in the lyric segmentation is the first segmentation in the segmentation result of the lyric. For example, in "I like to read her eyes when she is tipsy", the first lyric segmentation is "I". The first line is a pre-generated line for placing lyric segmentations, and the maximum number of words in a line is the maximum number of words in a single line corresponding to the target display gear. 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 tipsy", the first lyric segmentation is "I", and the second lyric segmentation is "like". After the second lyric segmentation in the plurality of lyric segmentations is placed in the first lyric segmentation in the first line, the first line content 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 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.
[0052] For example, if the maximum number of words in a single line of the target display gear is 5 words, and the number of words in the first line is 3 words, which 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, that is, "reading", is used as the new second lyrics segmentation. Return to step 312, that is, put "reading" after "like", and the number of words in the first line is equal to the maximum number of words in a single line of the target display gear, 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 position, 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 word segmentation combination of the lyrics 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 segments 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. At this time, the second line of the target display row is used as the first line of the new target display row, and the last lyrics segmentation in the word segmentation result combination is deleted. Then, 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 execution returns to step 1031 until the multiple lyrics segmentations in the word segmentation result are filled in the multiple target display rows.
[0057] Exemplarily, the word segmentation result combination is "I like reading", which is 5 characters long, and 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, so the second line of the target display line is used as the first line of the new target display line, and the last lyrics segmentation in the word segmentation result combination, that is, "reading", is deleted. Then, the last lyrics segmentation in the word segmentation result combination to the last lyrics segmentation in the segmentation result of the target lyrics is used as the segmentation result of the new target lyrics, that is, the segmentation result of the new target lyrics is "reading her eyes when she is slightly drunk", and the execution returns to step 1031 until the multiple lyrics segmentations in the segmentation result are filled in the multiple target display lines.
[0058] Step 1033, according to the filling results of multiple lyrics segmentation in the segmentation result, determine the target display line number of the target lyrics and the display content of each target display line.
[0059] Specifically, after multiple lyrics segmentation words in the segmentation result are filled into multiple target display lines, multiple target display lines are obtained, and each target display line has the display content of the target display line. Therefore, according to the filling results of multiple lyrics segmentation words in the segmentation result, the target display line number of 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 display line number is greater than the maximum line number of the target display gear, it means that the font corresponding to the target display gear cannot fully display the lyrics. This may be due to the fact that some segmented words cannot be displayed in a new line in order to facilitate reading. At this time, the next gear of the target display gear is determined as the new target display gear. Even if the display font becomes smaller, the process returns to step 103, that is, re-determine each line of display content and the target display line number until the target display line number is less than or equal to the maximum line number of the target display gear.
[0064] Step 104 , based on the target display line number 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 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 gear. 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 the present 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 "She is tipsy", 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 scheme of the present application obtains 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 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 waste of the display area can be avoided when the lyrics are too short, thereby improving the user experience.
[0068] Figure 2a is another flowchart of the lyrics display method provided by the present application. Figure 1Based on the illustrated embodiment 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, obtaining lyrics data of target lyrics and multiple display levels.
[0070] Step 202, determining the target display level corresponding to the target lyrics according to the word segmentation result and the maximum number of lines corresponding to each display level and the maximum number of words in a single line.
[0071] Step 203, 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, determine the target display line number of the target lyrics and the display content of each target display line.
[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 multiple display positions may be quite different, for example, the font size of 180 is too different from the font size of 120, the display area of the lyrics after display is quite different from the area of the target display area. Therefore, the target zoom ratio can be determined according to the display width, display height, target display width and target display height, so as to reduce or enlarge the actual lyrics as a whole, so that the target display area is fully utilized.
[0076] Optionally, step 205 can be implemented through steps 2051 to 2052.
[0077] Step 2051, determining 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] Exemplarily, the display width is 10 cm, the target display width is 9 cm, the width ratio of the determined display width to the target display width is 10:9, the display height is 10 cm, the target display width is 8 cm, the height 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 avoid scaling one side so that the other side exceeds the target display area.
[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, and the adjusted font size can be obtained.
[0083] Step 207, displaying 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 accordance with 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 is a structural schematic diagram of a lyrics display device provided by the present application, and the device is suitable for executing the lyrics display method provided by the present 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 positions; wherein the lyrics data includes the word segmentation results of the target lyrics, and the display font sizes of the multiple display positions 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 line number 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 used to 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 font size corresponding to the target display level.
[0091] In one embodiment, after 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 gear, the content determination module 303 is also used to: if the target number of display lines is greater than the maximum number of lines 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 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 gear" until the target number of display lines is less than or equal to the maximum number of lines 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 a plurality of lyrics word segments and a word segmentation order, and 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, then use the second line of the target display line as the first line of the new target display line, delete the last lyrics word segment in the word segmentation result combination, and replace the last word segment in the word segmentation result combination 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 taken 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 according to 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 row 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 fills 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 for: placing the first lyrics segmentation in the lyrics segmentation into the first row; placing 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 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 step of "placing the second lyrics segmentation in the multiple lyrics segmentations after the first lyrics segmentation in the first row" is returned to execute 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 the lyrics segmentation combination in the first row is used 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 lines 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 lines 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, 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 the font size corresponding to the target display gear, the display module 304 is also 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; 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 and 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 waste of the display area can be avoided 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, wherein when the processor executes the program, the lyrics 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, and when the program is executed by a processor, the lyrics display method provided in any of the above embodiments is implemented.
[0100] Reference below Figure 4 , which shows a structural schematic 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, the 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 part 408 into a random access memory (RAM) 403. In the RAM 403, various programs and data required for the operation of the electronic device 400 are also stored. The CPU 401, the ROM 402, and the RAM 403 are connected to each other via a bus 404. An input / output (I / O) interface 405 is also connected to the bus 404.
[0102] The following components are connected to the I / O interface 405: an input section 406 including a keyboard, a mouse, etc.; an output section 407 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker, etc.; a storage section 408 including a hard disk, etc.; and a communication section 409 including a network interface card such as a LAN card, a modem, etc. 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. A removable medium 411, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 410 as needed, so that a computer program read therefrom is installed into the storage section 408 as needed.
[0103] In particular, according to the embodiments disclosed in the present application, the process described above with reference to the flowchart can be implemented as a computer software program. For example, the embodiments disclosed in the present application include a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program includes a program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from the network through the communication part 409, and / or installed from the 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 the present application may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present application, a computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in combination with an instruction execution system, device or device. In the present application, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, which carries a computer-readable program code. This propagated data signal may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. Computer-readable signal media may also be any computer-readable medium other than computer-readable storage media, which may send, propagate or transmit a program for use by or in conjunction with an instruction execution system, apparatus or device. The program code contained on the computer-readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wire, optical cable, RF, etc., or any suitable combination of the above.
[0105] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present application. In this regard, each box in the flow chart or block diagram can represent a module, a program segment or a part of a code, and the above-mentioned module, program segment or a part of a 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 a different order from the order 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 flow chart, and the combination of the boxes in the block diagram or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[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 set in a processor, for example, it may be described as: a processor includes 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, constitute limitations on the modules themselves.
[0107] As another aspect, the present application also provides a computer-readable medium, which may be included in the device described in the above embodiment; or may exist independently without being assembled into the device. The above computer-readable medium carries one or more programs, and when the above 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 levels; wherein the lyrics data includes word segmentation results of the target lyrics, and the display font sizes of the multiple display levels are different; determine the target display level corresponding to the target lyrics 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 level; 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 results of the target lyrics and the maximum number of words in a single line of the target display level; 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 target number of display lines of the target lyrics and the display content of each target display line.
[0109] According to the technical solution of the present application, the lyrics data of the 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 display line number of the target lyrics and the display content of each target display line are determined; according to the target display line number 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 waste of the display area can be avoided 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 a lyrics display method as provided in any embodiment of the present application.
[0111] In the process of implementation, the computer program product can be written in one or more programming languages or a combination thereof to perform the computer program code of the present application, and the programming language includes an object-oriented programming language, such as Java, Smalltalk, C++, and also includes a conventional procedural programming language, such as "C" language or similar programming language. The program code can be executed entirely on the user's computer, partially on the user's computer, as an independent software package, partially on the user's computer and partially on the remote computer, or completely on the remote computer or server. In the case of a remote computer, the remote computer can be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or can be connected to an external computer (for example, using an Internet service provider to connect through the Internet).
[0112] It should be understood that the various forms of processes shown above can be used to reorder, add or delete steps. For example, the steps recorded in this application can be executed in parallel, sequentially or in different orders, as long as the expected results of the technical solution of this application can be achieved, and this document is not limited here.
[0113] The above specific implementations do not constitute a limitation on the protection scope of this application. It should be understood by those skilled in the art 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 should be included in the protection scope of this application.
Claims
1. A lyrics display method, characterized in that: The method comprises: Acquire lyrics data and multiple display positions of target lyrics; wherein the lyrics data includes the word segmentation result of the target lyrics, and the display font sizes of the multiple display positions 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; 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, determine the target number of display lines of the target lyrics and the display content of each target display line; According to the target display line number 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 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 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 step of "determining the target number of display rows of the target lyrics and the display content of each target display row according to the word segmentation result of the target lyrics and the maximum number of words in a single line of the target display gear" is returned 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 word segmentation orders, and the target number of display lines of the target lyrics and the display content of each target display line are determined according to the word segmentation result of the target lyrics and the maximum number of words in a single line of the target display gear, 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 word segmentation in the word segmentation result combination is deleted, and 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 step of "filling the lyrics word segmentation of the target lyrics into 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 execute until multiple lyrics word segments in the word segmentation result are filled into multiple target display rows; According to the filling results of multiple lyrics segmentation in the segmentation result, the target number of display lines of the target lyrics and the display content of each target display line are determined.
4. The method according to claim 3, characterized in that The step of filling the lyrics segmentation of 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 gear, the lyrics word combination in the first line is used as the word segmentation result combination.
5. The method according to claim 1, characterized in that Before determining the target display position 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 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 characters 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 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, the method further includes: 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 display line number of the target lyrics and the display content of each target display line; Determine 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 display line number 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, 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; A gear determination module, 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; A content determination module, used 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 a 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 as described in 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 as described in any one of claims 1 to 7 is implemented.
Citation Information
Patent Citations
Method and system for adjusting subtitle according to picture
CN106331828A
Lyric display method and device, equipment and storage medium
CN108563484A
Screen-off display method and electronic equipment
CN114003319A
Word partitioning method and device and storage medium
WO2018184510A1