Text display method and device, electronic equipment and medium

CN115204108BActive Publication Date: 2026-10-27VIVO MOBILE COMM CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202210837656.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-07-15
Publication Date
2026-10-27
Estimated Expiration
2042-07-15

AI Technical Summary

Technical Problem

[0005]本申请实施例的目的是提供一种文本显示方法、装置、电子设备及介质,能够解决导致使用电子设备查找用户需求的文本的效率较低的问题

Benefits of technology

[0013]在本申请实施例中,在目标文本的字符长度大于目标显示区域的可显示长度的情况下,电子设备可以根据目标文本,确定M个第一文本片段,并从该M个第一文本片段中,确定连续的N个目标文本片段,该N个目标文本片段包含目标文本的至少一个关键词,从而电子设备可以在目标显示区域显示该N个目标文本片段的至少部分文本片段,该至少部分文本片段的字符长度小于或等于可显示长度、且至少部分文本片段包含至少一个关键词。由于在目标文本的字符长度大于目标显示区域的可显示长度的情况下,电子设备可以先将目标文本划分为M个第一文本片段,然后再从该M个第一文本片段中,确定出字符长度较小的部分第一文本片段(即N个目标文本片段),该部分第一文本片段连续、且包含目标文本的至少一个关键词,这样电子设备可以在目标显示区域中显示该部分第一文本片段的至少部分文本片段,即电子设备显示的至少部分文本片段包含关键词,因此,用户可以直接根据该至少部分文本片段,确定目标文本是否为用户需求的文本,而无需进行多次操作,从而可以简化在用户查找用户需求的目标文本的过程中的操作、且减少耗时,如此,可以提高使用电子设备查找用户需求的文本的效率。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115204108B_ABST
    Figure CN115204108B_ABST
Patent Text Reader

Abstract

The application discloses a text display method and device, electronic equipment and medium, and belongs to the technical field of communication. The method comprises the following steps: in the case that the character length of a target text is greater than the displayable length of a target display area, determining M first text segments from the target text, wherein M is a positive integer; determining N continuous target text segments from the M first text segments, wherein the N target text segments contain at least one search word of the target text, and N is a positive integer greater than 1; displaying at least part of the N target text segments in the target display area; wherein the character length of the at least part of the text segments is less than or equal to the displayable length, and the at least part of the text segments contains the at least one search word.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application belongs to the field of communication technology, specifically relating to a text display method, device, electronic device, and medium. Background Technology

[0002] Typically, in scenarios where users use electronic devices to search for text they need, the electronic device can display partial content of each text in a folder based on the user's input by clicking on the folder icon. This allows the user to determine whether each text is the text they need based on the context of the keywords in each partial text, thus enabling them to find the text they need from among the multiple texts.

[0003] However, since some text displayed on electronic devices may not contain keywords, users need to perform multiple operations to allow the electronic device to display the full content of those texts one by one to determine if they are the text the user needs. Therefore, the process of users searching for the text they need is cumbersome and time-consuming.

[0004] This results in low efficiency in using electronic devices to find the text that users need. Summary of the Invention

[0005] The purpose of this application is to provide a text display method, apparatus, electronic device, and medium that can solve the problem of low efficiency in finding text that users need when using electronic devices.

[0006] To solve the above-mentioned technical problems, this application is implemented as follows:

[0007] In a first aspect, embodiments of this application provide a text display method, which includes: when the character length of the target text is greater than the displayable length of the target display area, determining M first text segments based on the target text, where M is a positive integer; determining N consecutive target text segments from the M first text segments, where the N target text segments contain at least one keyword of the target text, where N is a positive integer greater than 1; and displaying at least a portion of the text segments of the N target text segments in the target display area; wherein the character length of the at least a portion of the text segments is less than or equal to the displayable length, and the at least a portion of the text segments contains the at least one keyword.

[0008] Secondly, embodiments of this application provide a text display device, which includes: a determining module and a display module; the determining module is configured to, when the character length of the target text is greater than the displayable length of the target display area, determine M first text segments based on the target text, where M is a positive integer; and determine N consecutive target text segments from the M first text segments, wherein the N target text segments contain at least one keyword of the target text, where N is a positive integer greater than 1; the display module is configured to, in the target display area, display at least a portion of the text segments of the N target text segments; wherein the character length of the at least a portion of the text segments is less than or equal to the displayable length, and the at least a portion of the text segments contains the at least one keyword.

[0009] Thirdly, embodiments of this application provide an electronic device including a processor and a memory, wherein the memory stores programs or instructions executable on the processor, and the programs or instructions, when executed by the processor, implement the steps of the method described in the first aspect.

[0010] Fourthly, embodiments of this application provide a readable storage medium on which a program or instructions are stored, which, when executed by a processor, implement the steps of the method described in the first aspect.

[0011] Fifthly, embodiments of this application provide a chip, the chip including a processor and a communication interface, the communication interface being coupled to the processor, the processor being used to run programs or instructions to implement the method as described in the first aspect.

[0012] In a sixth aspect, embodiments of this application provide a computer program product stored in a storage medium, which is executed by at least one processor to implement the method described in the first aspect.

[0013] In this embodiment of the application, when the character length of the target text is greater than the displayable length of the target display area, the electronic device can determine M first text segments based on the target text, and determine N consecutive target text segments from the M first text segments. The N target text segments contain at least one keyword of the target text, so that the electronic device can display at least a portion of the text segments of the N target text segments in the target display area. The character length of the at least a portion of the text segments is less than or equal to the displayable length, and the at least a portion of the text segments contains at least one keyword. When the character length of the target text exceeds the displayable length of the target display area, the electronic device can first divide the target text into M first text segments. Then, from these M first text segments, it can identify the smaller first text segments (i.e., N target text segments). These smaller first text segments are continuous and contain at least one keyword of the target text. Thus, the electronic device can display at least a portion of these smaller first text segments in the target display area. In other words, the at least a portion of the text segments displayed by the electronic device contains the keyword. Therefore, the user can directly determine whether the target text is the text they need based on these at least a portion of the text segments without having to perform multiple operations. This simplifies the process of finding the target text the user needs and reduces time consumption, thereby improving the efficiency of using the electronic device to find the text the user needs. Attached Figure Description

[0014] Figure 1 This is one of the schematic diagrams of a text display method provided in an embodiment of this application;

[0015] Figure 2 This is a second schematic diagram of a text display method provided in an embodiment of this application;

[0016] Figure 3 This is a third schematic diagram of a text display method provided in an embodiment of this application;

[0017] Figure 4 This is a fourth schematic diagram of a text display method provided in an embodiment of this application;

[0018] Figure 5 This is a schematic diagram of the structure of a text display device provided in an embodiment of this application;

[0019] Figure 6 This is one of the hardware structure diagrams of an electronic device provided in the embodiments of this application;

[0020] Figure 7 This is a second schematic diagram of the hardware structure of an electronic device provided in an embodiment of this application. Detailed Implementation

[0021] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.

[0022] The terms "first," "second," etc., used in the specification and claims of this application are used to distinguish similar objects and not to describe a specific order or sequence. It should be understood that such use of data can be interchanged where appropriate so that embodiments of this application can be implemented in orders other than those illustrated or described herein, and the objects distinguished by "first," "second," etc., are generally of the same class and the number of objects is not limited; for example, a first object can be one or more. Furthermore, in the specification and claims, "and / or" indicates at least one of the connected objects, and the character " / " generally indicates that the preceding and following objects are in an "or" relationship.

[0023] The text display method, apparatus, electronic device, and medium provided in this application will be described in detail below with reference to the accompanying drawings and through specific embodiments and application scenarios.

[0024] In related technologies, when a user uses an electronic device to search for text they need, the device can display partial content of each text within a folder based on the user's input by clicking on the folder icon. This allows the user to determine whether each text matches their desired text based on the context of keywords within its partial content. However, since some text displayed on the electronic device may not contain keywords, the user needs to perform multiple operations to allow the device to display the full content of those texts one by one to determine if they match the user's desired text. This makes the process cumbersome and time-consuming, resulting in low efficiency when using electronic devices to find desired text.

[0025] To address the technical problems existing in the aforementioned related technologies, embodiments of this application provide a text display method. Figure 1 A flowchart illustrating a text method provided in an embodiment of this application is shown, which can be applied to electronic devices. For example... Figure 1 As shown, the text display method provided in this application embodiment may include the following steps 201 to 203.

[0026] Step 201: If the character length of the target text is greater than the displayable length of the target display area, the electronic device determines M first text segments based on the target text.

[0027] Where M is a positive integer.

[0028] Optionally, in this embodiment of the application, when a user needs to search for text in their desired format using an electronic device, the electronic device can display the search page of the target application based on the user's click input of the application identifier (e.g., application icon). This search page includes a text input box. The electronic device can then send the keyword entered by the user in the text input box to the server corresponding to the target application, so that the server can perform a search based on the keyword to obtain the target text and send the target text back to the electronic device. Thus, the electronic device can update the search page to a search results page, determine the character length of the target text, and, if the character length of the target text is greater than the displayable length of the target display area, determine M first text segments based on the target text.

[0029] The target application mentioned above can be any of the following: search applications, social applications, short video interactive applications, etc. The character length mentioned above can be the number of characters contained in the text.

[0030] The target text may include one or more texts, and the target text includes at least one keyword.

[0031] In this embodiment of the application, the target display area can specifically be: the display area in the search results page of the target application; the target display area is used to display the target text.

[0032] It should be noted that the "displayable length of the target display area" mentioned above can be understood as the maximum length of characters that the target display area can display.

[0033] Optionally, in this embodiment, the target display area may include one display area or multiple display areas. Specifically, when the target text includes multiple texts, the target display area may include multiple display areas, each used to display one text.

[0034] Optionally, in this embodiment of the application, the electronic device may divide the target text into M first text segments according to a predetermined character length; or, the electronic device may divide the target text into M first text segments according to the keywords contained in the target text.

[0035] For the case where an electronic device divides the target text into M first text segments based on the keywords contained in the target text:

[0036] In one example, for each of the M first text fragments, the electronic device can determine a first text fragment as a text content (i.e., the text content in the target text excluding the keywords contained in the target text) to a text fragment of the target text containing a keyword, thereby determining the M first text fragments.

[0037] It is understood that, in this example, each of the M first text fragments may contain at least one keyword of the target text.

[0038] In another example, the electronic device can identify each keyword in the target text as a first text fragment, and identify the text content other than the keywords in the target text as at least one first text fragment, thereby identifying M first text fragments.

[0039] It is understood that, in this example, some of the M first text fragments may contain at least one keyword of the target text.

[0040] The following example illustrates this point, using the case where some of the M first text fragments contain at least one keyword of the target text.

[0041] Optionally, in this embodiment of the application, the target text may contain Q keywords, where Q is a positive integer. Specifically, in conjunction with Figure 1 ,like Figure 2 As shown, step 201 above can be specifically implemented through step 201a below.

[0042] Step 201a: If the character length of the target text is greater than the displayable length of the target display area, the electronic device divides the target text into M first text segments based on Q keywords.

[0043] In this embodiment of the application, each of the Q first text segments contains one keyword from the Q keywords; the Q first text segments are non-contiguous text segments among the M first text segments.

[0044] Further optionally, in this embodiment of the application, the electronic device can determine Q keywords as Q first text fragments; then determine the text content before the first keyword among the Q keywords as a first text fragment, and determine the text content between the first keyword and the second keyword as another first text fragment, and determine the text content between the second keyword and the third keyword as yet another first text fragment, and so on, until the text content after the last keyword is determined as yet another first text fragment, so as to determine MQ first text fragments, thereby the electronic device can obtain Q first text fragments and MQ first text fragments, that is, M first text fragments.

[0045] For example, suppose the target text is: "SQLite is the world's most used database engine. SQLite databases are built into all mobile phones and most computers. SQLite is a C language library database engine.", the target text has a character length of 50, the keyword is "database", and the target display area has a display length of 20. Therefore, the target text's character length is greater than the target display area's display length. Thus, the electronic device can identify Q keywords (i.e., 3 "database" keywords) as Q first text fragments (i.e., 3 first text fragments); then it will take the text content before the first "database" keyword from the 3 "database" keywords (i.e., "SQLite is the world's most used database engine")... The text content is identified as a first text fragment. The text content between the first and second "database" keywords (i.e., "engine.SQLite") is identified as another first text fragment. The text content between the second and third "database" keywords (i.e., "built into all mobile phones and most computers. SQLite is a C language library") is identified as yet another first text fragment. The text content after the third "database" keyword (i.e., "engine." text content) is identified as yet another first text fragment. Thus, MQ first text fragments are identified (i.e., 4 first text fragments), so that the electronic device can obtain 7 first text fragments.

[0046] It is understandable that electronic devices can use keywords as delimiters to split the target text into M first text fragments.

[0047] Thus, since the electronic device can divide the target text into M first text segments based on Q keywords, and these M first text segments include Q discontinuous first text segments containing Q keywords, it is possible to ensure that the N target text segments determined based on these M first text segments contain at least one keyword of the target text. This allows at least some text segments displayed by the electronic device to contain keywords, thereby simplifying the operation and reducing time consumption in the process of users searching for the target text they need.

[0048] Step 202: The electronic device determines N consecutive target text segments from M first text segments.

[0049] In this embodiment of the application, the above-mentioned N target text fragments contain at least one keyword of the target text, where N is a positive integer greater than 1.

[0050] Optionally, in this embodiment of the application, the electronic device may first determine a first text segment (e.g., the second text segment in the following embodiment) from the M first text segments, and then determine the N-1 consecutive first text segments (e.g., the N-1 third text segments in the following embodiment) after the first text segment, so that the electronic device can determine the first text segment and the N-1 first text segments as N target text segments.

[0051] In this embodiment of the application, since the user needs to determine whether the target text is the text the user needs based on the keywords contained in the target text and the context content corresponding to the keywords, the electronic device can determine N consecutive target text segments from M first text segments, so that the user can determine whether the target text is the text the user needs based on the N consecutive target text segments.

[0052] Step 203: The electronic device displays at least a portion of the text fragments of N target text fragments in the target display area.

[0053] It can be understood that at least some of the above N target text fragments can specifically be: all or part of the text fragments of the N target text fragments.

[0054] Optionally, in this embodiment of the application, if the character length of the N target text segments is less than or equal to the displayable length of the target display area, the electronic device can display all the text segments of the N target text segments in the target display area.

[0055] If the character length of N target text fragments is greater than the displayable length of the target display area, the electronic device can display a portion of the text fragments of the N target text fragments in the target display area.

[0056] In this embodiment of the application, the character length of at least some of the text fragments is less than or equal to the displayable length, and at least some of the text fragments contain at least one keyword.

[0057] Optionally, in this embodiment of the application, the electronic device may first determine at least a portion of the text segments from N target text segments based on the displayable length of the target display area, and then display the at least a portion of the text segments in the target display area.

[0058] In one example, the electronic device can determine the first character based on the first character of N target text fragments and the displayable length of the target display area, so that the electronic device can determine the text content from the first character to the first character as at least a partial text fragment, and display the at least partial text fragment in the target display area.

[0059] In another example, the electronic device can determine the second character based on the first keyword contained in N target text fragments and the displayable length of the target display area. Thus, the electronic device can determine the text content from the first keyword to the second character as at least a partial text fragment, and display the at least partial text fragment in the target display area.

[0060] Optionally, in embodiments of this application, when at least some of the text fragments of N target text fragments are partial text fragments, the electronic device may display the partial text fragments and target symbols (e.g., ellipses) in the target display area to prompt the user through the target symbols that the displayed text fragments are partial text fragments among the N target text fragments.

[0061] In this embodiment of the application, if the character length of the target text is greater than the displayable length of the target display area, it can be assumed that the target display area may display part of the text content of the target text, and the part of the text content may not contain keywords. Therefore, when the character length of the target text is greater than the displayable length of the target display area, the electronic device can determine M first text segments based on the target text, and determine N consecutive target text segments from the M first text segments that contain at least one keyword of the target text. Thus, the electronic device can display at least a portion of the text segments of the N target text segments in the target display area.

[0062] The text display method provided in this application embodiment allows an electronic device to determine M first text segments based on the target text when the character length of the target text is greater than the displayable length of the target display area. From these M first text segments, an electronic device can determine N consecutive target text segments, each containing at least one keyword of the target text. The electronic device can then display at least a portion of these N target text segments in the target display area. The character length of each of these at least a portion of the text segments is less than or equal to the displayable length, and each at least a portion of the text segments contains at least one keyword. When the character length of the target text exceeds the displayable length of the target display area, the electronic device can first divide the target text into M first text segments. Then, from these M first text segments, it can identify the smaller first text segments (i.e., N target text segments). These smaller first text segments are continuous and contain at least one keyword of the target text. Thus, the electronic device can display at least a portion of these smaller first text segments in the target display area. In other words, the at least a portion of the text segments displayed by the electronic device contains the keyword. Therefore, the user can directly determine whether the target text is the text they need based on these at least a portion of the text segments without having to perform multiple operations. This simplifies the process of searching for the target text the user needs and reduces time consumption, thereby improving the efficiency of using the electronic device to search for the text the user needs.

[0063] Optionally, in the embodiments of this application, combined with Figure 1 ,like Figure 3 As shown, step 202 above can be specifically implemented through steps 202a and 202b below.

[0064] Step 202a: The electronic device determines the second text segment from the M first text segments.

[0065] Alternatively, in this embodiment of the application, the electronic device can determine a first text segment that meets a first preset condition from M first text segments, and determine the first text segment as a second text segment.

[0066] The first preset condition can be any of the following: the text fragment with the shortest character length, the text fragment containing at least one keyword of the target text, or the text fragment with the largest corresponding numerical value (e.g., the first numerical value in the following embodiment).

[0067] The following example, using the text segment with the largest corresponding value as the first preset condition, illustrates how an electronic device determines the second text segment.

[0068] Optionally, in the embodiments of this application, combined with Figure 3 ,like Figure 4As shown, step 202a can be implemented through steps 202a1 to 202a3.

[0069] Step 202a1: The electronic device determines the M first values ​​corresponding to the M first text fragments.

[0070] In this embodiment of the application, each of the above M first values ​​is used to indicate the minimum number of times a first text segment is concatenated with a first text segment that follows the first text segment to obtain a fourth text segment; the character length of the fourth text segment is greater than or equal to the displayable length.

[0071] It can be understood that for each of the M first values, a first value can be: starting with the corresponding first text fragment, concatenating the text fragments, and then concatenating them sequentially with the i-th first text fragment located after the corresponding first text fragment, to obtain the minimum number of concatenations for the fourth text fragment.

[0072] For example, assuming the target display area has a displayable length of 20, the M first text fragments include 7 text fragments, such as: "SQLite is the most used in the world" text fragment 1, which has a character length of 16; "database" text fragment 2, which has a character length of 3; "engine.SQLite" text fragment 3, which has a character length of 9; "database" text fragment 4, which has a character length of 3; "built into all mobile phones and most computers. SQLite is a C language library" text fragment 5, which has a character length of 31; "database" text fragment 6, which has a character length of 3; and "engine." text fragment 7, which has a character length of 3.

[0073] Then, text fragment 1 is concatenated with the next consecutive text fragment (i.e., text fragment 2), resulting in a concatenated text fragment 1 with a character length of 18. Text fragment 1 is then concatenated with the next two consecutive text fragments (i.e., text fragment 2 and text fragment 3), resulting in a concatenated text fragment 2 with a character length of 28. The character length of concatenated text fragment 2, 28, is greater than the displayable length of the target display area, 20. Therefore, concatenated text fragment 2 is the fourth text fragment. In other words, the minimum number of concatenations required to obtain the fourth text fragment by concatenating text fragment 1 with the next consecutive text fragment is 2, which is also the first value corresponding to text fragment 1, 2.

[0074] Text fragment 2 is concatenated with a subsequent text fragment (text fragment 3), resulting in a concatenated text fragment 3 with a character length of 12. Text fragment 2 is then concatenated with two subsequent text fragments (text fragment 3 and text fragment 4), resulting in a concatenated text fragment 4 with a character length of 15. Text fragment 2 is then concatenated with three subsequent text fragments (text fragment 3, text fragment 4, and text fragment 5), resulting in a concatenated text fragment 5 with a character length of 46. Since the character length of concatenated text fragment 5 is greater than the displayable length of the target display area (20), this concatenated text fragment 5 is the fourth text fragment. Therefore, the minimum number of concatenations required to obtain the fourth text fragment from text fragment 2 is 3, which corresponds to the first value of text fragment 2 being 3.

[0075] Text fragment 3 is concatenated with a subsequent text fragment (text fragment 4), resulting in a concatenated text fragment 6 with a character length of 12. Text fragment 3 is then concatenated with two subsequent text fragments (text fragment 4 and text fragment 5), resulting in a concatenated text fragment 7 with a character length of 43. Since the character length of concatenated text fragment 7 is greater than the displayable length of the target display area (20), this concatenated text fragment 7 is the fourth text fragment. In other words, the minimum number of concatenations required to obtain the fourth text fragment from text fragment 3 is 2, which corresponds to the first value of text fragment 3 being 2.

[0076] Text fragment 4 is concatenated with a subsequent text fragment (i.e., text fragment 5) to obtain concatenated text fragment 8. The character length of the concatenated text fragment 8 is 34. The character length 34 of the concatenated text fragment 8 is greater than the displayable length 20 of the target display area. That is, the concatenated text fragment 8 is the fourth text fragment. In other words, the minimum number of concatenations required to obtain the fourth text fragment is 1, which means that the first value corresponding to the text fragment 4 is 1.

[0077] The character length of text fragment 5 is greater than the displayable length of the target display area of ​​20. That is, the minimum number of concatenations required to obtain the fourth text fragment is 0 when text fragment 5 is concatenated with the consecutive text fragments following it. In other words, the first value corresponding to text fragment 5 is 0.

[0078] Text fragment 6 is concatenated with the next consecutive text fragment (i.e., text fragment 7) to obtain concatenated text fragment 9, which has a character length of 6. Since the only consecutive text fragment following text fragment 6 is text fragment 7, the minimum number of concatenations required to obtain the fourth text fragment is 1, which means the first value corresponding to text fragment 6 is 1.

[0079] Text fragment 7 is the last of the 7 text fragments. Therefore, the minimum number of concatenations required to obtain the fourth text fragment is 0, which means that the first value corresponding to text fragment 7 is 0.

[0080] Further optionally, in this embodiment of the application, the electronic device may employ a target algorithm to determine the first numerical value corresponding to each first text segment; the target algorithm may specifically be:

[0081]

[0082] Where limitLen is the displayable length of the target display area, i is the first value, cLen is the character length of the concatenated text fragment obtained each time (the initial value is the character length of the first text fragment), and nLen is the character length of the next text fragment to be concatenated.

[0083] Step 202a2: The electronic device determines the T target values ​​with the largest values ​​from the M first values.

[0084] In the embodiments of this application, T is a positive integer.

[0085] For example, suppose the M first values ​​include 7 first values, such as the first value 2 corresponding to text fragment 1, the first value 3 corresponding to text fragment 2, the first value 2 corresponding to text fragment 3, the first value 1 corresponding to text fragment 4, the first value 0 corresponding to text fragment 5, the first value 1 corresponding to text fragment 6, and the first value 0 corresponding to text fragment 7. Then the electronic device can determine the T target values ​​with the largest value from these 7 first values, namely the first value 3.

[0086] Step 202a3: The electronic device determines the second text segment based on the T first text segments that correspond one-to-one with the T target values.

[0087] Further optionally, in this embodiment of the application, when the T target values ​​are a single target value, the electronic device can determine the first text segment corresponding to that single target value as the second text segment. When the T target values ​​are multiple target values, the electronic device can determine the first text segment corresponding to any one of the multiple target values ​​as the second text segment; or, it can determine a value again from the multiple target values ​​and determine the first text segment corresponding to that value as the second text segment.

[0088] In this embodiment of the application, if the first value corresponding to a certain first text segment is larger, it can be considered that the minimum number of splicing steps required to obtain the fourth text segment by concatenating the certain first text segment with the consecutive first text segments following the certain first text segment is larger. That is, the number of keywords contained in the certain first text segment and the consecutive first text segments following the certain first text segment is larger. In other words, the number of keywords contained in the determined N target text segments is larger. Therefore, the electronic device can determine the T target values ​​with the largest values ​​from the M first values, and determine the second text segment according to the T first text segments corresponding to the T target values ​​one by one.

[0089] Thus, since the electronic device can determine the T largest target values ​​from the M first values, and determine the second text fragments based on the T first text fragments corresponding to the T target values, the N target text fragments determined based on the second text fragments contain a large number of keywords. Therefore, the user can directly determine whether the target text is the text they need based on at least some of the text fragments of the N target text fragments without having to perform multiple operations. This simplifies the operation in the process of the user searching for the target text they need and reduces the time consumption.

[0090] For the case where T target values ​​are combined into one target value:

[0091] Optionally, in one possible implementation of this application embodiment, when T is 1, the above step 202a3 can be specifically implemented by the following step 202a31.

[0092] Step 202a31: The electronic device identifies T first text fragments as second text fragments.

[0093] It should be noted that when T=1, only one of the M first values ​​is the largest target value. Therefore, the first text segment corresponding to this target value is determined as the second text segment.

[0094] Thus, it can be seen that when there are T target values ​​as one target value, the electronic device can directly identify that one target value as the second text segment, thereby reducing the time spent identifying the second text segment.

[0095] For the case where T target values ​​are multiple target values:

[0096] Optionally, in another possible implementation of the embodiments of this application, when T is greater than 1, the above step 202a3 can be specifically implemented by steps 202a32 to 202a34.

[0097] Step 202a32: The electronic device determines the T second values ​​corresponding to the T first text fragments.

[0098] In this embodiment of the application, each of the T second values ​​is used to indicate the number of keywords of the target text contained in the fourth text segment corresponding to a first text segment.

[0099] It should be noted that the above "a fourth text fragment corresponding to a first text fragment" can be understood as: the fourth text fragment obtained by splicing the first text fragment with the first text fragment that follows the first text fragment.

[0100] Further optionally, in this embodiment of the application, after the electronic device determines T target values, the electronic device can detect the T spliced ​​text segments corresponding to the T first text segments respectively to obtain T second values.

[0101] Step 202a33: The electronic device determines the third value with the largest value from the T second values.

[0102] In this embodiment of the application, if the second value is larger, it can be considered that the corresponding first text segment and the consecutive first text segments following the corresponding first text segment contain a larger number of keywords, that is, the N target text segments contain a larger number of keywords. Therefore, the electronic device can determine the third value with the largest value from the T second values.

[0103] Step 202a34: The electronic device determines the first text fragment corresponding to the third value as the second text fragment.

[0104] Further optionally, in the embodiments of this application, when the third value includes multiple values, the electronic device can determine the text fragment corresponding to any one of the multiple values ​​as the second text fragment.

[0105] Thus, when there are multiple target values ​​among T target values, the electronic device can first determine the number of keywords contained in the fourth text segment corresponding to each of the multiple first text segments (i.e., the first text segments corresponding to each of the multiple target values), and then determine the first text segment with the largest number of keywords as the second text segment. Therefore, the number of keywords contained in the N target text segments determined based on the second text segment is relatively large, which can simplify the operation in the process of the user searching for the target text they need and reduce the time consumption.

[0106] Step 202b: The electronic device determines the second text fragment and N-1 third text fragments as N target text fragments.

[0107] In this embodiment of the application, the above-mentioned N-1 third text segments are: the first text segments that are consecutive after the second text segments among the M first text segments.

[0108] Further optionally, in this embodiment of the application, the electronic device may first determine N-1 third text segments based on the second text segment and the first value corresponding to the second text segment, and then determine the second text segment and the N-1 third text segments as N target text segments.

[0109] Specifically, the electronic device identifies the first text segment, which is the first value following the second text segment, as N-1 third text segments.

[0110] For example, assuming the second text fragment is text fragment 2 in the above example, and the first value corresponding to text fragment 2 is 3, the electronic device can determine the three consecutive first text fragments (i.e., text fragment 3, text fragment 4, and text fragment 5) located after text fragment 2 as N-1 third text fragments.

[0111] Thus, since the electronic device can first determine the second text fragment, and then determine the second text fragment and the N-1 consecutive third text fragments following the second text fragment as N consecutive target text fragments, the user can directly determine whether the target text is the text the user needs based on the context content corresponding to the keywords in the N target text fragments, without having to perform multiple operations. In this way, the operation in the process of the user searching for the target text they need can be simplified and the time consumption can be reduced.

[0112] It should be noted that the text display method provided in this application embodiment can be executed by a text display device. This application embodiment uses a text display device to execute the text display method as an example to illustrate the text display device provided in this application embodiment.

[0113] Figure 5A schematic diagram of a possible structure of the text display device involved in an embodiment of this application is shown. For example... Figure 5 As shown, the text display device 70 may include: a determining module 71 and a display module 72.

[0114] The determining module 71 is configured to, when the character length of the target text is greater than the displayable length of the target display area, determine M first text segments, where M is a positive integer; and from the M first text segments, determine N consecutive target text segments, where the N target text segments contain at least one keyword of the target text, and N is a positive integer. The display module 72 is configured to display at least a portion of the N target text segments determined by the determining module 71 in the target display area. The character length of the at least a portion of the text segments is less than or equal to the displayable length, and the at least a portion of the text segments contains at least one keyword.

[0115] Optionally, in this embodiment of the application, the target text contains Q keywords, where Q is a positive integer; the determining module 71 is specifically used to divide the target text into M first text segments based on the Q keywords. Each of the Q first text segments contains one keyword from the Q keywords; the Q first text segments are non-contiguous text segments among the M first text segments.

[0116] Optionally, in this embodiment of the application, the determining module 71 further includes: a first determining module 711 and a second determining module 712; the first determining module 711 is used to determine a second text segment from M first text segments. The second determining module 712 is used to determine the second text segment determined by the first determining module 711 and N-1 third text segments as N target text segments. The N-1 third text segments are: consecutive first text segments following the second text segment from the M first text segments.

[0117] Optionally, in this embodiment, the first determining module 711 includes a third determining module 713, a fourth determining module 714, and a fifth determining module 715. The third determining module 713 is used to determine M first numerical values ​​corresponding to M first text segments, each first numerical value indicating the minimum number of concatenations required to obtain a fourth text segment by concatenating a first text segment with a consecutive first text segment following it. The fourth determining module 714 is used to determine T target numerical values ​​with the largest values ​​from the M first numerical values ​​determined by the third determining module 713, where T is a positive integer. The fifth determining module 715 is used to determine a second text segment based on the T first text segments corresponding to the T target numerical values ​​determined by the fourth determining module 714. The character length of the fourth text segment is greater than or equal to the displayable length.

[0118] Optionally, in this embodiment of the application, when T is 1, the fifth determining module 715 is specifically used to determine T first text fragments as second text fragments.

[0119] Optionally, in this embodiment of the application, when T is greater than 1, the fifth determining module 715 is specifically used to determine T second values ​​corresponding to T first text segments, each second value indicating the number of keywords of the target text contained in a first text segment to a fourth text segment; and determine the third value with the largest value from the T second values; and determine the text segment corresponding to the third value as the second text segment.

[0120] This application provides a text display device. When the character length of the target text is greater than the displayable length of the target display area, the text display device can first divide the target text into M first text segments, and then determine the smaller first text segments (i.e., N target text segments) from the M first text segments. These smaller first text segments are continuous and contain at least one keyword of the target text. Thus, the text display device can display at least a portion of these first text segments in the target display area. That is, the at least a portion of the text segments displayed by the text display device contains the keyword. Therefore, the user can directly determine whether the target text is the text they need based on these at least a portion of the text segments without having to perform multiple operations. This simplifies the operation in the process of the user searching for the target text they need and reduces the time consumption, thereby improving the efficiency of using the text display device to search for the text they need.

[0121] The text display device in this application embodiment can be a device, or a component, integrated circuit, or chip in an electronic device. The device can be a mobile electronic device or a non-mobile electronic device. For example, a mobile electronic device can be a mobile phone, tablet computer, laptop computer, PDA, in-vehicle electronic device, mobile internet device (MID), augmented reality (AR) / virtual reality (VR) device, robot, wearable device, ultra-mobile personal computer (UMPC), netbook, or personal digital assistant (PDA), etc. It can also be a server, network attached storage (NAS), personal computer (PC), television (TV), ATM, or self-service machine, etc. This application embodiment does not specifically limit the device.

[0122] The text display device in this application embodiment can be a device with an operating system. This operating system can be Android, iOS, or other possible operating systems; this application embodiment does not specifically limit the specific operating system used.

[0123] The text display device provided in this application embodiment can implement the various processes implemented in the method embodiments of Figures N to N+x. To avoid repetition, these processes will not be described again here.

[0124] Optionally, such as Figure 6 As shown, this application embodiment also provides an electronic device 80, including a processor 81 and a memory 82. The memory 82 stores a program or instructions that can run on the processor 81. When the program or instructions are executed by the processor 81, they implement the various steps of the above-described text display method embodiment and can achieve the same technical effect. To avoid repetition, they will not be described again here.

[0125] It should be noted that the electronic devices in the embodiments of this application include the mobile electronic devices and non-mobile electronic devices described above.

[0126] Figure 7 A schematic diagram of the hardware structure of an electronic device to implement an embodiment of this application.

[0127] The electronic device 100 includes, but is not limited to, components such as: radio frequency unit 101, network module 102, audio output unit 103, input unit 104, sensor 105, display unit 106, user input unit 107, interface unit 108, memory 109, and processor 110.

[0128] Those skilled in the art will understand that the electronic device 100 may also include a power supply (such as a battery) for supplying power to various components. The power supply may be logically connected to the processor 110 through a power management system, thereby enabling functions such as managing charging, discharging, and power consumption through the power management system. Figure 7 The electronic device structure shown does not constitute a limitation on the electronic device. The electronic device may include more or fewer components than shown, or combine certain components, or have different component arrangements, which will not be elaborated here.

[0129] The processor 110 is configured to, when the character length of the target text is greater than the displayable length of the target display area, determine M first text segments, where M is a positive integer; determine N consecutive target text segments from the M first text segments, where the N target text segments contain at least one keyword of the target text, where N is a positive integer greater than 1; and display at least a portion of the N target text segments in the target display area. The character length of at least a portion of the text segments is less than or equal to the displayable length, and at least a portion of the text segments contains at least one keyword.

[0130] The electronic device provided in this application embodiment, when the character length of the target text is greater than the displayable length of the target display area, can first divide the target text into M first text segments, and then determine the smaller first text segments (i.e., N target text segments) from the M first text segments. These smaller first text segments are continuous and contain at least one keyword of the target text. Thus, the text display device can display at least a portion of these first text segments in the target display area. That is, the at least a portion of the text segments displayed by the text display device contains the keyword. Therefore, the user can directly determine whether the target text is the text they need based on these at least a portion of the text segments without having to perform multiple operations. This simplifies the operation in the process of the user searching for the target text they need and reduces the time consumption, thereby improving the efficiency of using the text display device to search for the text they need.

[0131] Optionally, in this embodiment of the application, the target text contains Q keywords, where Q is a positive integer.

[0132] The processor 110 is specifically used to divide the target text into M first text segments based on Q keywords. Each of the Q first text segments contains one keyword from the Q keywords; the Q first text segments are non-contiguous text segments among the M first text segments.

[0133] Thus, since the electronic device can divide the target text into M first text segments based on Q keywords, and these M first text segments include Q discontinuous first text segments containing Q keywords, it is possible to ensure that the N target text segments determined based on these M first text segments contain at least one keyword of the target text. This allows at least some text segments displayed by the electronic device to contain keywords, thereby simplifying the operation and reducing time consumption in the process of users searching for the target text they need.

[0134] Optionally, in this embodiment of the application, the processor 110 is specifically configured to determine a second text segment from M first text segments; and to determine the second text segment and N-1 third text segments as N target text segments. The N-1 third text segments are: consecutive first text segments following the second text segment among the M first text segments.

[0135] Thus, since the electronic device can first determine the second text fragment, and then determine the second text fragment and the N-1 consecutive third text fragments following the second text fragment as N consecutive target text fragments, the user can directly determine whether the target text is the text the user needs based on the context content corresponding to the keywords in the N target text fragments, without having to perform multiple operations. In this way, the operation in the process of the user searching for the target text they need can be simplified and the time consumption can be reduced.

[0136] Optionally, in this embodiment of the application, the processor 110 is specifically configured to determine M first values ​​corresponding to M first text segments, each first value indicating the minimum number of splicing steps required to concatenate a first text segment with a consecutive first text segment following a first text segment to obtain a fourth text segment; and determine T target values ​​with the largest values ​​from the M first values, where T is a positive integer; and determine a second text segment based on the T first text segments corresponding to the T target values.

[0137] Thus, since the electronic device can determine the T largest target values ​​from the M first values, and determine the second text fragments based on the T first text fragments corresponding to the T target values, the N target text fragments determined based on the second text fragments contain a large number of keywords. Therefore, the user can directly determine whether the target text is the text they need based on at least some of the text fragments of the N target text fragments without having to perform multiple operations. This simplifies the operation in the process of the user searching for the target text they need and reduces the time consumption.

[0138] Optionally, in this embodiment of the application, the processor 110 is specifically used to determine T first text fragments as second text fragments when T is 1.

[0139] Thus, it can be seen that when there are T target values ​​as one target value, the electronic device can directly identify that one target value as the second text segment, thereby reducing the time spent identifying the second text segment.

[0140] Optionally, in this embodiment of the application, the processor 110 is specifically configured to determine T second values ​​corresponding to T first text segments when T is greater than 1, each second value being used to indicate the number of keywords of the target text contained in a first text segment to a fourth text segment; and determine the third value with the largest value from the T second values; and determine the text segment corresponding to the third value as the second text segment.

[0141] Thus, when there are multiple target values ​​among T target values, the electronic device can first determine the number of keywords contained in the fourth text segment corresponding to each of the multiple first text segments (i.e., the first text segments corresponding to each of the multiple target values), and then determine the first text segment with the largest number of keywords as the second text segment. Therefore, the number of keywords contained in the N target text segments determined based on the second text segment is relatively large, which can simplify the operation in the process of the user searching for the target text they need and reduce the time consumption.

[0142] The electronic device provided in this application embodiment can implement the various processes implemented in the above method embodiments and achieve the same technical effect. To avoid repetition, it will not be described again here.

[0143] For details on the beneficial effects of the various implementation methods in this embodiment, please refer to the beneficial effects of the corresponding implementation methods in the above method embodiments. To avoid repetition, these will not be repeated here.

[0144] It should be understood that, in this embodiment, the input unit 104 may include a graphics processing unit (GPU) 1041 and a microphone 1042. The GPU 1041 processes image data of still images or videos obtained by an image capture device (such as a camera) in video capture mode or image capture mode. The display unit 106 may include a display panel 1061, which may be configured in the form of a liquid crystal display, an organic light-emitting diode, or the like. The user input unit 107 includes at least one of a touch panel 1071 and other input devices 1072. The touch panel 1071 is also called a touch screen. The touch panel 1071 may include a touch detection device and a touch controller. Other input devices 1072 may include, but are not limited to, a physical keyboard, function keys (such as volume control buttons, power buttons, etc.), a trackball, a mouse, and a joystick, which will not be described in detail here.

[0145] The memory 109 can be used to store software programs and various data. The memory 109 may primarily include a first storage area for storing programs or instructions and a second storage area for storing data. The first storage area may store the operating system, application programs or instructions required for at least one function (such as sound playback, image playback, etc.). Furthermore, the memory 109 may include volatile memory or non-volatile memory, or both. The non-volatile memory may be read-only memory (ROM), programmable read-only memory (PROM), erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), or flash memory. Volatile memory can be random access memory (RAM), static random access memory (SRAM), dynamic random access memory (DRAM), synchronous dynamic random access memory (SDRAM), double data rate synchronous dynamic random access memory (DDRSDRAM), enhanced synchronous dynamic random access memory (ESDRAM), synchronous link dynamic random access memory (SLDRAM), and direct memory bus RAM (DRRAM). The memory 109 in the embodiments of this application includes, but is not limited to, these and any other suitable types of memory.

[0146] Processor 110 may include one or more processing units; optionally, processor 110 integrates an application processor and a modem processor, wherein the application processor mainly handles operations involving the operating system, user interface, and applications, and the modem processor mainly handles wireless communication signals, such as a baseband processor. It is understood that the aforementioned modem processor may also not be integrated into processor 110.

[0147] This application also provides a readable storage medium storing a program or instructions. When the program or instructions are executed by a processor, they implement the various processes of the above method embodiments and achieve the same technical effect. To avoid repetition, they will not be described again here.

[0148] The processor is the processor in the electronic device described in the above embodiments. The readable storage medium includes computer-readable storage media, such as computer read-only memory (ROM), random access memory (RAM), magnetic disk, or optical disk.

[0149] This application embodiment also provides a chip, which includes a processor and a communication interface. The communication interface is coupled to the processor. The processor is used to run programs or instructions to implement the various processes of the above method embodiments and achieve the same technical effect. To avoid repetition, it will not be described again here.

[0150] It should be understood that the chip mentioned in the embodiments of this application may also be referred to as a system-on-a-chip, system chip, chip system, or system-on-a-chip, etc.

[0151] This application provides a computer program product, which is stored in a storage medium and executed by at least one processor to implement the various processes of the above-described text display method embodiments, and can achieve the same technical effect. To avoid repetition, it will not be described again here.

[0152] It should be noted that, in this document, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes that element. Furthermore, it should be noted that the scope of the methods and apparatuses in the embodiments of this application is not limited to performing functions in the order shown or discussed, but may also include performing functions substantially simultaneously or in the reverse order, depending on the functions involved. For example, the described methods may be performed in a different order than described, and various steps may be added, omitted, or combined. Additionally, features described with reference to certain examples may be combined in other examples.

[0153] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods of the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, can be embodied in the form of a computer software product. This computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) and includes several instructions to cause a terminal (which may be a mobile phone, computer, server, or network device, etc.) to execute the methods described in the various embodiments of this application.

[0154] The embodiments of this application have been described above with reference to the accompanying drawings. However, this application is not limited to the specific embodiments described above. The specific embodiments described above are merely illustrative and not restrictive. Those skilled in the art can make many other forms under the guidance of this application without departing from the spirit and scope of the claims, and all of these forms are within the protection scope of this application.

Claims

1. A text display method, characterized in that, The method includes: If the character length of the target text is greater than the displayable length of the target display area, the target text is divided into M first text segments based on the Q keywords contained in the target text; wherein, each of the Q first text segments contains one keyword from the Q keywords; the Q first text segments are non-contiguous text segments among the M first text segments, and Q and M are both positive integers; M first values ​​are determined one-to-one with the M first text segments. Each first value is used to indicate the minimum number of concatenations required to obtain a fourth text segment by concatenating a first text segment with a consecutive first text segment following the first text segment. The character length of the fourth text segment is greater than or equal to the displayable length. From the M first values, determine the T target values ​​with the largest values, where T is a positive integer; The second text segment is determined based on the T first text segments corresponding to the T target values; The second text fragment and N-1 third text fragments are determined as N target text fragments; wherein, the N-1 third text fragments are: the first text fragments that are consecutively located after the second text fragment among the M first text fragments, and the N target text fragments contain at least one keyword of the target text, and N is a positive integer greater than 1; In the target display area, at least a portion of the text fragments of the N target text fragments are displayed; Wherein, the character length of at least a portion of the text fragment is less than or equal to the displayable length, and the at least a portion of the text fragment contains the at least one keyword.

2. The method according to claim 1, characterized in that, When T is 1, determining the second text segment based on the T first text segments corresponding to the T target values ​​includes: The T first text fragments are identified as the second text fragments; When T is greater than 1, determining the second text segment based on the T first text segments corresponding to the T target values ​​includes: T second values ​​are determined to correspond one-to-one with the T first text segments, and each second value is used to indicate the number of keywords of the target text contained in the fourth text segment corresponding to a first text segment; From the T second values, determine the third value that has the largest value; The first text segment corresponding to the third value is determined as the second text segment.

3. A text display device, characterized in that, The text display device includes: a determining module and a display module; The determining module is used to divide the target text into M first text segments based on the Q keywords contained in the target text when the character length of the target text is greater than the displayable length of the target display area; wherein each of the Q first text segments contains one keyword from the Q keywords; the Q first text segments are non-contiguous text segments among the M first text segments, and Q and M are both positive integers; The determining module is further configured to determine M first values ​​corresponding to the M first text segments, each first value being used to indicate the minimum number of concatenations required to obtain a fourth text segment by concatenating a first text segment with a consecutive first text segment following the first text segment, wherein the character length of the fourth text segment is greater than or equal to the displayable length. The determining module is further configured to determine the T target values ​​with the largest values ​​from the M first values, where T is a positive integer; The determining module is further configured to determine the second text segment based on the T first text segments corresponding one-to-one with the T target values; The determining module is further configured to determine the second text fragment and N-1 third text fragments as N target text fragments; wherein, the N-1 third text fragments are: the first text fragments that are consecutively located after the second text fragment among the M first text fragments, and the N target text fragments contain at least one keyword of the target text, and N is a positive integer greater than 1; The display module is used to display at least a portion of the text fragments of the N target text fragments determined by the determining module in the target display area; Wherein, the character length of at least a portion of the text fragment is less than or equal to the displayable length, and the at least a portion of the text fragment contains the at least one keyword.

4. The apparatus according to claim 3, characterized in that, When T is 1, the determining module is specifically used to determine the T first text fragments as the second text fragments; When T is greater than 1, the determining module is specifically used to determine T second values ​​corresponding to the T first text segments, each second value indicating the number of keywords of the target text contained in the fourth text segment corresponding to a first text segment; and determine the third value with the largest value from the T second values; and determine the first text segment corresponding to the third value as the second text segment.

5. An electronic device, characterized in that, It includes a processor, a memory, and a computer-executable program stored in the memory and executable on the processor, wherein the computer-executable program, when executed by the processor, implements the steps of the text display method as described in any one of claims 1 to 2.

6. A readable storage medium, characterized in that, The readable storage medium stores a computer-executable program, which, when executed by a processor, implements the steps of the text display method as described in any one of claims 1 to 2.

Citation Information

Patent Citations

  • Method and device for displaying results of keyword search

    CN102902688A