Information display method and device, computer device and storage medium
Patent Information
- Application Number
- CN202611045784.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-07-14
- Publication Date
- 2026-10-27
AI Technical Summary
[0003]本申请提供了一种信息显示方法、装置、计算机设备和存储介质,以解决现有的多语言显示页面在处理翻译后超长文本时,不同字符串截断后展示文字高度雷同,无法直观区分不同字符串的问题
[0014]本申请实施例提供的上述技术方案与现有技术相比具有如下优点:本申请实施例提供的该方法,将显示页面中源语言对应的多个源语言文本翻译至目标语言下,再判断源语言文本在目标语言下的字体尺寸是否超出文本框尺寸,从而判断是否需要对源语言文本进行截断显示处理,若需要进行截断显示处理,则将源语言文本进行词组分割,得到对应的分词序列;根据分词序列中各个词组在显示页面中的出现频次,来区分不同词组的重要程度,即识别出分词序列中的关键词组;按照目标语言对分词序列中的关键词组进行翻译,并用预设截断符号替代分词序列中的非关键词组,从而得到目标语言下的截断显示文本,在显示页面中显示各个源语言文本对应的截断显示文本。由于在截断显示处理过程中,并非按照传统截断显示仅显示字符串的前面或后面部分,而是显示字符串中的关键词组,关键词组可以用于直观区别不同参数截断显示结果,从而解决了现有的多语言显示页面在处理翻译后超长文本时,不同字符串截断后展示文字高度雷同,无法直观区分不同字符串的问题。
Smart Images

Figure CN122985286A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of information display, and more particularly to an information display method, apparatus, computer equipment, and storage medium. Background Technology
[0002] Monitors are widely used and often require multilingual display capabilities. However, the character counts of different languages can vary significantly, causing monitors to fail to display the complete translated text after switching languages. A common solution is to truncate characters exceeding the specified length. However, conventional truncation only shows the beginning or end of the string, resulting in highly similar text after truncation, making it difficult to visually distinguish between different strings. Summary of the Invention
[0003] This application provides an information display method, apparatus, computer device, and storage medium to solve the problem that existing multilingual display pages, when processing translated long texts, display highly similar text after truncation of different strings, making it impossible to intuitively distinguish between different strings.
[0004] In a first aspect, this application provides an information display method, the method comprising: Upon receiving a language switching instruction, retrieve the text in multiple source languages corresponding to the source language displayed on the page; If the font size of the source language text in the target language exceeds the text box size, the source language text is segmented to obtain the word segmentation sequence corresponding to each source language text. Based on the frequency of occurrence of different word groups in each word segmentation sequence on the display page, the keyword groups in each word segmentation sequence are determined; The keyword groups in the word segmentation sequence are translated according to the target language, and the non-keyword groups in the word segmentation sequence are replaced with preset truncation symbols to obtain the truncated display text corresponding to the word segmentation sequence; The corresponding source language text is replaced with each truncated display text on the display page.
[0005] Optionally, when the font size of the source language text in the target language exceeds the text box size, segmenting each source language text to obtain a word segmentation sequence corresponding to each source language text includes: If the font height of the source language text in the target language exceeds the height of the text box, reduce the font size of the source language text in the target language until the font height of the source language text in the target language is lower than the height of the text box. Then, use the target font size when the font height of the source language text in the target language is lower than the height of the text box as the font size of the keyword group in the word segmentation sequence after translation according to the target language. If the font length of the source language text in the target language exceeds the width of the text box, the source language text is segmented to obtain the word segmentation sequence corresponding to each source language text.
[0006] Optionally, when the font length of the source language text in the target language exceeds the width of the text box, segmenting each source language text to obtain a word segmentation sequence corresponding to each source language text includes: If the font length of the source language text in the target language exceeds the width of the text box, identify the abbreviable phrases in the source language text that have corresponding abbreviation characters in the target language. In the source language text translated into the target language text, abbreviation characters are used to replace the translation characters of the corresponding abbreviationable phrases in the target language to obtain the translated abbreviation text; If the font length of the translated abbreviated text exceeds the width of the text box, replace the abbreviated phrases in the source language text with abbreviation characters in the target language to obtain the source language abbreviated text; The source language abbreviation text is segmented to obtain the word segmentation sequence corresponding to the source language abbreviation text.
[0007] Optionally, determining the keyword groups in each word segmentation sequence based on the frequency of occurrence of different word groups in the display page includes: Based on the frequency of occurrence of different word groups in the segmented sequence on the display page, the word groups in the segmented sequence are sorted in descending order to obtain the word group sorting result corresponding to the segmented sequence; The word group that is first in the word group sorting result corresponding to the word segmentation sequence is taken as the keyword group in the word segmentation sequence.
[0008] Optionally, the keyword groups in the word segmentation sequence are translated according to the target language, and the non-keyword groups in the word segmentation sequence are replaced with preset truncation symbols to obtain the truncated display text corresponding to the word segmentation sequence, including: The keyword groups in the word segmentation sequence are translated according to the target language, and the non-keyword groups in the word segmentation sequence are replaced with preset truncation symbols to obtain the candidate display text corresponding to the word segmentation sequence; If there exists a candidate display text that is identical to the candidate display text corresponding to the word segmentation sequence, then the candidate display text corresponding to the word segmentation sequence will be used as the repeated display text. The first untranslated phrase in the word sorting result corresponding to the repeated displayed text is taken as the keyword phrase and translated according to the target language to obtain the intermediate displayed text; If there is no display text identical to the intermediate display text, then the intermediate display text is used as the truncated display text corresponding to the word segmentation sequence.
[0009] Optionally, after taking the first untranslated phrase in the phrase sorting result corresponding to the repeatedly displayed text as the keyword phrase and translating it according to the target language to obtain the intermediate displayed text, the method further includes: If the intermediate displayed text is the same as the target language text or the translated abbreviation text, the intermediate displayed text is truncated according to the width of the text box to obtain the truncated displayed text corresponding to the word segmentation sequence.
[0010] Optionally, after replacing the corresponding source language text with each truncated display text in the display page, the method further includes: Upon receiving the operation instruction corresponding to the truncated display text, the target language text corresponding to the truncated display text is displayed via a pop-up window.
[0011] Secondly, this application provides an information display device, the device comprising: The acquisition module is used to acquire multiple source language texts corresponding to the source language in the display page when a language switching instruction is received; The segmentation module is used to segment each source language text when the font size of the source language text in the target language exceeds the text box size, so as to obtain the word segmentation sequence corresponding to each source language text. The identification module is used to determine the keyword groups in each word segmentation sequence based on the frequency of occurrence of different word groups in each word segmentation sequence on the display page; The translation module is used to translate the keyword groups in the word segmentation sequence according to the target language, and replace the non-keyword groups in the word segmentation sequence with preset truncation symbols to obtain the truncated display text corresponding to the word segmentation sequence; The display module is used to replace the corresponding source language text with each truncated display text on the display page.
[0012] Thirdly, this application provides a computer device, the computer device including a display, the display including the information display device as described above.
[0013] Fourthly, this application also provides a computer storage medium storing computer-executable instructions for executing the above-described information display method.
[0014] Compared with the prior art, the technical solution provided in this application has the following advantages: The method provided in this application translates multiple source language texts corresponding to the source language in the display page into the target language, then determines whether the font size of the source language text in the target language exceeds the text box size, thereby determining whether the source language text needs to be truncated. If truncation is required, the source language text is segmented into phrases to obtain the corresponding word segmentation sequence. The importance of different phrases is distinguished based on the frequency of occurrence of each phrase in the word segmentation sequence on the display page, i.e., the key phrases in the word segmentation sequence are identified. The key phrases in the word segmentation sequence are translated according to the target language, and the non-key phrases in the word segmentation sequence are replaced with preset truncation symbols to obtain the truncated display text in the target language. The truncated display text corresponding to each source language text is then displayed on the display page. Because the truncation display process does not simply display the beginning or end of the string as in traditional truncation display, but instead displays keyword groups within the string, these keyword groups can be used to intuitively distinguish the truncation display results of different parameters. This solves the problem in existing multilingual display pages where, after truncation of very long translated text, the displayed text is highly similar and cannot be intuitively distinguished from different strings. Attached Figure Description
[0015] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with the invention and, together with the description, serve to explain the principles of the invention.
[0016] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, for those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0017] One or more embodiments are illustrated by way of example with reference numerals in the accompanying drawings. These illustrations do not constitute a limitation on the embodiments. Elements with the same reference numerals in the drawings are denoted as similar elements. Unless otherwise stated, the figures in the drawings are not to be limited by scale.
[0018] Figure 1 An application environment diagram of an information display method provided in an embodiment of this application; Figure 2 A flowchart illustrating an information display method provided in an embodiment of this application; Figure 3 A flowchart illustrating an information display method provided in an embodiment of this application; Figure 4 A structural block diagram of an information display device provided in an embodiment of this application; Figure 5 This is a schematic diagram of the internal structure of a computer device provided in an embodiment of this application. Detailed Implementation
[0019] To make the objectives, technical solutions, and advantages of the embodiments of this application clearer, 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.
[0020] The following disclosure provides numerous different embodiments or examples for implementing various structures of the invention. To simplify the disclosure, specific examples of components and arrangements are described below. These are merely examples and are not intended to limit the scope of the invention. Furthermore, reference numerals and / or letters may be repeated in different examples. Such repetition is for simplification and clarity and does not in itself indicate a relationship between the various embodiments and / or arrangements discussed.
[0021] Figure 1 This is a diagram illustrating the application environment of an information display method in one embodiment. (Refer to...) Figure 1 This information display method is applied to computer device 100, which can be any device including a display 110. Specifically, computer device 100 can be a desktop terminal or a mobile terminal, and a mobile terminal can be at least one of a mobile phone, tablet computer, or laptop computer. The display 110 includes an information display device 120, which is used to control the display screen on the display 110.
[0022] In one embodiment, Figure 2 This is a flowchart illustrating an information display method in one embodiment, with reference to... Figure 2 This provides an information display method. This embodiment primarily applies this method to the above-mentioned... Figure 1 Taking the information display device 120 as an example, the information display method specifically includes the following steps: Step S210: Upon receiving a language switching instruction, acquire multiple source language texts from the display page.
[0023] Specifically, the display page refers to the display screen of the monitor 110, the source language refers to the language type used by the monitor 110 before language switching, and the language switching instruction is used to request the source language used by the source language text in the display page to be switched to the target language. The source language and the target language are different language types. The display page contains multiple non-repeating source language texts P(x), and each source language text corresponds to a display parameter or a sentence, that is, P(x) represents the xth display parameter in the display page.
[0024] Step S220: If the font size of the source language text in the target language exceeds the text box size, the source language text is segmented to obtain the word segmentation sequence corresponding to each source language text.
[0025] Specifically, the source language text is translated into the target language to obtain the target language text after language switching. The size of the text box used to display different parameters on the display page is fixed. If the font size of the target language text does not exceed the text box size of the unit text box corresponding to a parameter or sentence, it means that the target language text after language switching can be displayed completely within the unit text box, and there is no need to truncate the target language text.
[0026] If the font size of the target language text exceeds the text box size of a unit text box corresponding to a parameter or a sentence, it means that the target language text after language switching cannot be fully displayed in the unit text box. Therefore, the target language text needs to be truncated. Thus, the source language text is first processed by word segmentation, which divides the source language text into multiple word groups to obtain a word segmentation sequence. The word segmentation sequence contains multiple word groups after the source language text is segmented.
[0027] For example, the source language text is P(1) = "frozen water outlet temperature setting". The segmented word sequence is frozen, water, outlet, water, temperature. Each segmented word is numbered in sequence, such as P1(1,1) = "frozen", P1(1,2) = "water", P1(1,3) = "out", P1(1,4) = "water", P1(1,5) = "temperature", P1(1,6) = "setting". Therefore, the word sequence includes multiple word groups with word segmentation numbers.
[0028] Step S230: Determine the keyword groups in each word segmentation sequence based on the frequency of occurrence of different word groups in the display page.
[0029] Specifically, the frequency of each word group in the segmented word sequence on the display page is counted. Word groups with a frequency higher than a preset frequency are considered high-frequency word groups, while those with a frequency lower than a preset frequency are considered low-frequency word groups. Any high-frequency or low-frequency word group can be used as a keyword group. If a high-frequency word group is used as a keyword group, only the keyword group will be translated and displayed during the truncation translation display. Since the high-frequency word group is randomly selected as the keyword group, it will also increase the difference between the subsequent truncated display text. If a low-frequency word group is used as a keyword group, only the keyword group will be translated and displayed during the truncation translation display. The translation display of the low-frequency word group can be clearly distinguished from different truncated display texts.
[0030] Step S240: Translate the keyword groups in the word segmentation sequence according to the target language, and replace the non-keyword groups in the word segmentation sequence with preset truncation symbols to obtain the truncated display text corresponding to the word segmentation sequence.
[0031] Specifically, after identifying the keyword groups in the word segmentation sequence, the keyword groups are translated according to the target language, and non-keyword groups in the word segmentation sequence are replaced with preset truncation symbols, thus obtaining the truncated and translated text of the source language. The preset truncation symbols can be any symbols, such as (*) or (…).
[0032] For example, if the source language text is P(x) = "chilled water outlet temperature setting", the segmented word sequence is frozen, water, outlet, water, temperature. Since "frozen" appears less frequently on the display page, "frozen" is used as a keyword phrase. If the target language is English and the default truncation symbol is (...), then the truncated text after translation is "Chilled...".
[0033] Step S250: Replace the corresponding source language text with each truncated display text in the display page.
[0034] Specifically, the display page shows the truncated text corresponding to each source language after language switching. Because the truncated display process doesn't simply show the beginning or end of the string as in traditional truncated displays, but instead displays keyword groups within the string, these keyword groups can be used to visually distinguish the truncated display results of different parameters. This solves the problem in existing multilingual display pages where, when processing translated, very long text, the truncated text from different strings is highly similar, making it difficult to visually distinguish between them.
[0035] Based on the above-mentioned word segmentation statistics combined with keyword group translation and retention method, compared with the traditional processing method of truncating fixed parts according to fixed character length, it can improve the recognizability between texts with different parameters, improve the response speed of operators to identify different parameters, and significantly reduce the risk of misoperation caused by parameter confusion in industrial control scenarios and multilingual software interaction scenarios. At the same time, this solution only translates the keyword groups after word segmentation, without the need to translate and transcode the full text and then trim and compress it. Compared with the processing flow of translating the full text first and then truncating it character by character, it can reduce the amount of computation for single-page language switching, shorten the language switching response latency, adapt to the operating requirements of embedded low-computing-power control terminals, and avoid problems such as page lag and rendering delay in multilingual switching scenarios.
[0036] In one embodiment, refer to Figure 3 When the font size of the source language text exceeds the text box size in the target language, the process of segmenting each source language text to obtain a word segmentation sequence corresponding to each source language text includes: If the font height of the source language text in the target language exceeds the height of the text box, reduce the font size of the source language text in the target language until the font height of the source language text in the target language is lower than the height of the text box. Then, use the target font size when the font height of the source language text in the target language is lower than the height of the text box as the font size of the keyword group in the word segmentation sequence after translation according to the target language. If the font length of the source language text in the target language exceeds the width of the text box, the source language text is segmented to obtain the word segmentation sequence corresponding to each source language text.
[0037] Specifically, the font size of the target language text is compared with the text box size of the unit text box. That is, the font height of the target language text is compared with the text box height of the unit text box, and the font length of the target language text is compared with the text box width of the unit text box. If the font height of the target language text exceeds the text box height, the font size of the target language text needs to be shortened until the font height of the target language text is lower than the text box height. The font size of the target language text at this time is recorded and used as the font size of the keyword group in the segmented sequence after translation according to the target language.
[0038] If the font length of the target language text exceeds the width of the text box, then the source language text corresponding to the target language text needs to be truncated and translated to ensure that the truncated text can be displayed completely within the unit text box. The truncation and translation process first involves segmenting the source language text. Specifically, this segmentation can be performed using a word segmentation model or natural language processing algorithm to segment the source language text according to parts of speech such as common nouns and verbs. Each segmented word is then numbered sequentially. The word segmentation model can be the jieba model or the BERT-CRF model, etc., resulting in a sequence of segmented words corresponding to the source language text.
[0039] This segmentation process, based on a part-of-speech tagging model, can accurately identify semantic units of the source language text, avoiding segmentation that could destroy the integrity of the core semantics. Compared to hard segmentation based on a fixed character length, it can improve the accuracy of preserving complete semantic units in the segmented sequence, avoiding problems such as truncating core words and semantic ambiguity. It also increases the success rate of fully adapting the final translated text to the display within a single text box. Furthermore, in scenarios where font adaptation height is constrained, it prioritizes the recognition and display of keyword groups, satisfying the size limitations of the text box while ensuring that the core semantic information does not lose readability due to excessive font reduction. This allows the translated content to achieve a dual improvement in adaptability and recognizability within a limited display area.
[0040] In one embodiment, when the font length of the source language text in the target language exceeds the width of the text box, segmenting each source language text to obtain a word segmentation sequence corresponding to each source language text includes: If the font length of the source language text in the target language exceeds the width of the text box, identify the abbreviable phrases in the source language text that have corresponding abbreviation characters in the target language. In the source language text translated into the target language text, abbreviation characters are used to replace the translation characters of the corresponding abbreviationable phrases in the target language to obtain the translated abbreviation text; If the font length of the translated abbreviated text exceeds the width of the text box, replace the abbreviated phrases in the source language text with abbreviation characters in the target language to obtain the source language abbreviated text; The source language abbreviation text is segmented to obtain the word segmentation sequence corresponding to the source language abbreviation text.
[0041] Specifically, refer to Figure 3If the font length of the target language text exceeds the width of the text box, then filter the source language text for abbreviations that have corresponding abbreviation characters in the target language. For example, if the source language text is P(x) = "chilled water outlet temperature setting", then "temperature" is an abbreviation and the corresponding abbreviation character is T. Alternatively, if "United States" exists in the source language text, then "United States" is an abbreviation and the corresponding abbreviation character is US.
[0042] In the target language text, abbreviations are used to replace the translated characters of abbreviations in the target language text, resulting in a shortened abbreviated text. For example, the translated character for temperature is "temperature," but replacing "temperature" with "T" in the target language text significantly reduces the font length. If the font length of the abbreviated text still exceeds the width of the text box, it means that replacing the translated characters with abbreviations is insufficient to fully display the target language text within the text box. In this case, abbreviations in the source language text are replaced with abbreviations in the target language to obtain abbreviated source language text. This pre-abbreviated translation process further shortens the font length of the source language text. Finally, the abbreviated source language text is truncated, i.e., segmented, to obtain the corresponding word segmentation sequence.
[0043] Based on the aforementioned layered processing mechanism, a progressive processing flow is adopted, first performing abbreviation and compression on the target language translation content, and then performing pre-abbreviation preprocessing on the source language text. This maximizes the compression of the total text length without losing core semantic information, effectively solving the problem that small fixed-size text boxes cannot adapt to the display of long translated text. It avoids the semantic breaks and information loss problems caused by directly segmenting the source language. At the same time, compared with directly performing forced truncation on the source language, this solution can retain more complete semantic units, improving the readability and information integrity of the translation results. In addition, compression is completed by using existing standard abbreviation characters in the target language, without the need for custom abbreviation rules, reducing the computational complexity of word segmentation. This makes it suitable for operating scenarios with limited computing power, such as embedded devices and industrial interactive terminals, improving the processing efficiency and adaptation success rate of multilingual text display adaptation.
[0044] In one embodiment, refer to Figure 3 The step of determining the keyword groups in each word segmentation sequence based on the frequency of occurrence of different word groups in each word segmentation sequence on the display page includes: Based on the frequency of occurrence of different word groups in the segmented sequence on the display page, the word groups in the segmented sequence are sorted in descending order to obtain the word group sorting result corresponding to the segmented sequence; The word group that is first in the word group sorting result corresponding to the word segmentation sequence is taken as the keyword group in the word segmentation sequence.
[0045] Specifically, the frequency of each word group in the segmented sequence on the display page is counted. The word groups in the segmented sequence are then sorted in descending order according to their frequency of occurrence on the display page, thus obtaining the word group ranking result corresponding to the segmented sequence. The word group at the top of the word group ranking result is the word group that appears the least on the display page, and conversely, the word group at the bottom of the word group ranking result is the word group that appears the most on the display page.
[0046] The word group that appears first in the word group ranking result corresponding to the word segmentation sequence is taken as the keyword group in the word segmentation sequence. That is, the word group that appears the least in the displayed page is selected as the keyword group. This can effectively filter out high-frequency and redundant word groups such as general navigation words, site copyright logos, and general decorative copy. These high-frequency contents often do not have the relevance to the core content of the currently displayed page. If they are misjudged as keyword groups, it will reduce the accuracy of core content recognition. On the other hand, low-frequency word groups usually correspond to specific content unique to the source language text. Using these word groups as keyword groups can maximize the difference between different source language texts.
[0047] In one embodiment, refer to Figure 3 The keyword groups in the word segmentation sequence are translated according to the target language, and the non-keyword groups in the word segmentation sequence are replaced with preset truncation symbols to obtain the truncated display text corresponding to the word segmentation sequence, including: The keyword groups in the word segmentation sequence are translated according to the target language, and the non-keyword groups in the word segmentation sequence are replaced with preset truncation symbols to obtain the candidate display text corresponding to the word segmentation sequence; If there exists a candidate display text that is identical to the candidate display text corresponding to the word segmentation sequence, then the candidate display text corresponding to the word segmentation sequence will be used as the repeated display text. The first untranslated phrase in the word sorting result corresponding to the repeated displayed text is taken as the keyword phrase and translated according to the target language to obtain the intermediate displayed text; If there is no display text identical to the intermediate display text, then the intermediate display text is used as the truncated display text corresponding to the word segmentation sequence.
[0048] Specifically, the keyword groups in the segmented sequence are translated according to the target language, and the non-keyword groups in the segmented sequence are replaced with preset truncation symbols to obtain the candidate display text corresponding to the segmented sequence. The candidate display texts corresponding to different source language texts are compared to determine whether there are two identical candidate display texts. If there are two identical candidate display texts, then these two candidate display texts or one of them is regarded as repeated display text. The word group in the second position of the word group ranking result corresponding to the repeated display text is translated and displayed to obtain the intermediate display text.
[0049] For example, the source language text is P(x) = "chilled water outlet temperature setting", the segmented word sequence is frozen, water, outlet, water, temperature, and the word group sorting result is "frozen, outlet, temperature, water". The repeated display text is "Chilled...". At this time, the first untranslated word group in the word group sorting result is "water" in the second position. Translating "water" in the second position in the source language text, the intermediate display text is "Chilled...outlet...". That is, based on the repeated display text, a translation display word group is added, and then it is continued to check whether there is candidate display text, repeated display text, or intermediate display text that is the same as the intermediate display text. That is, deduplication is checked in the truncated translation text (including candidate display text, repeated display text, and intermediate display text). If there is still a display text that is the same, the translation display word group is added again until there is no display text that is completely identical to the intermediate display text. Then the intermediate display text is used as the truncated display text corresponding to the word segmentation sequence.
[0050] The above method effectively avoids the ambiguity of the same truncated display text corresponding to different source language texts, and can intuitively convey different display parameters. At the same time, the incremental translation strategy of keyword groups only expands the translation content when there is a duplicate conflict, without having to translate all word segments. This controls the length of the truncated display text, reduces the redundancy of information displayed on the front end, reduces unnecessary translation computation overhead, and improves the overall efficiency of text processing. In multi-source, large-scale cross-language text processing scenarios, it can stably maintain a high processing throughput speed and reduce the computing power consumption of the server.
[0051] In one embodiment, after taking the first untranslated phrase in the phrase sorting result corresponding to the repeatedly displayed text as the keyword phrase and translating it according to the target language to obtain the intermediate displayed text, the method further includes: If the intermediate displayed text is the same as the target language text or the translated abbreviation text, the intermediate displayed text is truncated according to the width of the text box to obtain the truncated displayed text corresponding to the word segmentation sequence.
[0052] Specifically, if the intermediate displayed text has been completely translated to be the same as the target language text or the translated abbreviation text, and there is still displayed text that is the same as the intermediate displayed text, then the intermediate displayed text needs to be truncated according to the width of the text box. That is, according to the traditional truncation processing method, only a fixed part of the content is retained, such as only the beginning or end of the intermediate displayed text, so as to obtain the truncated displayed text corresponding to the word segmentation sequence.
[0053] In one embodiment, after replacing the corresponding source language text with each truncated display text in the display page, the method further includes: Upon receiving the operation instruction corresponding to the truncated display text, the target language text corresponding to the truncated display text is displayed via a pop-up window.
[0054] Specifically, the operation instructions for truncated text can be click operations, swipe operations, etc. Upon receiving the operation instruction for truncated text, a pop-up window displays the complete target language text. For all truncated parameters, the function of clicking to display the full text of the parameter in a pop-up window is retained, ensuring that truncated display shows as much key information as possible while allowing users to access all parameter content information by clicking. Figure 2 and Figure 3 This is a flowchart illustrating an information display method in one embodiment. It should be understood that, although... Figure 2 and Figure 3 The steps in the flowchart are shown sequentially as indicated by the arrows, but these steps are not necessarily executed in the order indicated by the arrows. Unless otherwise specified herein, there is no strict order in which these steps are executed, and they can be performed in other orders. Figure 2 and Figure 3 At least some of the steps in the process may include multiple sub-steps or multiple stages. These sub-steps or stages are not necessarily completed at the same time, but can be executed at different times. The execution order of these sub-steps or stages is not necessarily sequential, but can be executed in turn or alternately with other steps or at least some of the sub-steps or stages of other steps.
[0055] In one embodiment, such as Figure 4 As shown, an information display device 120 is provided, comprising: The acquisition module 310 is used to acquire multiple source language texts corresponding to the source language in the display page when a language switching instruction is received; The segmentation module 320 is used to segment each source language text when the font size of the source language text in the target language exceeds the text box size, so as to obtain a word segmentation sequence corresponding to each source language text. The identification module 330 is used to determine the keyword groups in each word segmentation sequence based on the frequency of occurrence of different word groups in each word segmentation sequence on the display page; Translation module 340 is used to translate the keyword groups in the word segmentation sequence according to the target language, and replace the non-keyword groups in the word segmentation sequence with preset truncation symbols to obtain the truncated display text corresponding to the word segmentation sequence; Display module 350 is used to replace the corresponding source language text with each truncated display text in the display page.
[0056] In one embodiment, the segmentation module 320 is further configured to: If the font height of the source language text in the target language exceeds the height of the text box, reduce the font size of the source language text in the target language until the font height of the source language text in the target language is lower than the height of the text box. Then, use the target font size when the font height of the source language text in the target language is lower than the height of the text box as the font size of the keyword group in the word segmentation sequence after translation according to the target language. If the font length of the source language text in the target language exceeds the width of the text box, the source language text is segmented to obtain the word segmentation sequence corresponding to each source language text.
[0057] In one embodiment, the segmentation module 320 is further configured to: If the font length of the source language text in the target language exceeds the width of the text box, identify the abbreviable phrases in the source language text that have corresponding abbreviation characters in the target language. In the source language text translated into the target language text, abbreviation characters are used to replace the translation characters of the corresponding abbreviationable phrases in the target language to obtain the translated abbreviation text; If the font length of the translated abbreviated text exceeds the width of the text box, replace the abbreviated phrases in the source language text with abbreviation characters in the target language to obtain the source language abbreviated text; The source language abbreviation text is segmented to obtain the word segmentation sequence corresponding to the source language abbreviation text.
[0058] In one embodiment, the identification module 330 is further configured to: Based on the frequency of occurrence of different word groups in the segmented sequence on the display page, the word groups in the segmented sequence are sorted in descending order to obtain the word group sorting result corresponding to the segmented sequence; The word group that is first in the word group sorting result corresponding to the word segmentation sequence is taken as the keyword group in the word segmentation sequence.
[0059] In one embodiment, the translation module 340 is further configured to: The keyword groups in the word segmentation sequence are translated according to the target language, and the non-keyword groups in the word segmentation sequence are replaced with preset truncation symbols to obtain the candidate display text corresponding to the word segmentation sequence; If there exists a candidate display text that is identical to the candidate display text corresponding to the word segmentation sequence, then the candidate display text corresponding to the word segmentation sequence will be used as the repeated display text. The first untranslated phrase in the word sorting result corresponding to the repeated displayed text is taken as the keyword phrase and translated according to the target language to obtain the intermediate displayed text; If there is no display text identical to the intermediate display text, then the intermediate display text is used as the truncated display text corresponding to the word segmentation sequence.
[0060] In one embodiment, the translation module 340 is further configured to: If the intermediate displayed text is the same as the target language text or the translated abbreviation text, the intermediate displayed text is truncated according to the width of the text box to obtain the truncated displayed text corresponding to the word segmentation sequence.
[0061] In one embodiment, the display module 350 is further configured to: Upon receiving the operation instruction corresponding to the truncated display text, the target language text corresponding to the truncated display text is displayed via a pop-up window.
[0062] It should be noted that the examples and application scenarios implemented by the above modules and corresponding steps are the same, but are not limited to the content disclosed in the above embodiments. It should also be noted that the above modules, as part of a device, can operate in environments such as... Figure 1 The hardware environment shown can be implemented either through software or through hardware.
[0063] like Figure 5 As shown, this application embodiment provides a computer device 100, including a processor 711, a communication interface 712, a memory 713, and a communication bus 714. The processor 711, the communication interface 712, and the memory 713 communicate with each other through the communication bus 714. The memory 713 is used to store computer programs. When the processor 711 executes the program stored in the memory 713, it implements the information display method provided in any of the aforementioned method embodiments.
[0064] The memory and processor in the aforementioned electronic devices communicate with each other via a communication bus and a communication interface. The communication bus can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. This communication bus can be divided into an address bus, a data bus, a control bus, etc.
[0065] The memory may include random access memory (RAM) or non-volatile memory, such as at least one disk storage device. Optionally, the memory may also be at least one storage device located remotely from the aforementioned processor.
[0066] The processors mentioned above can be general-purpose processors, including central processing units (CPUs), network processors (NPs), etc.; they can also be digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components.
[0067] Those skilled in the art will understand that Figure 5 The structure shown is merely a block diagram of a portion of the structure related to the present application and does not constitute a limitation on the computer device 100 to which the present application is applied. The specific computer device 100 may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.
[0068] According to another aspect of the embodiments of this application, a computer program product or computer program is also provided, which includes computer instructions stored in a computer-readable storage medium. A processor of computer device 100 reads the computer instructions from the computer-readable storage medium and executes the computer instructions, causing the computer device 100 to perform the steps of any of the above embodiments.
[0069] In one embodiment, the information display device 120 provided in this application can be implemented as a computer program, and the computer program can be implemented as follows: Figure 5 The computer device 100 shown is running the computer. The memory of the computer device 100 can store various program modules that make up the information display device 120, for example, Figure 4 The diagram shows an acquisition module 310, a segmentation module 320, a recognition module 330, a translation module 340, and a display module 350. The computer program comprised of these modules causes the processor to execute the information display methods of the various embodiments of this application described in this specification.
[0070] Figure 5 The computer device 100 shown can be accessed via, for example... Figure 4 The acquisition module 310 in the information display device 120, upon receiving a language switching instruction, acquires multiple source language texts corresponding to the source language on the display page. The computer device 100, through the segmentation module 320, segments each source language text when the font size of the source language text in the target language exceeds the text box size, obtaining a word segmentation sequence corresponding to each source language text. The computer device 100, through the recognition module 330, determines the keyword groups in each word segmentation sequence based on the frequency of occurrence of different word groups in the display page. The computer device 100, through the translation module 340, translates the keyword groups in the word segmentation sequence according to the target language and replaces the non-keyword groups in the word segmentation sequence with preset truncation symbols, obtaining truncated display text corresponding to the word segmentation sequence. The computer device 100, through the display module 350, replaces the corresponding source language text on the display page with each truncated display text.
[0071] This application also provides a computer-readable storage medium storing a computer program thereon, which, when executed by a processor, implements the information display method provided in any of the foregoing method embodiments.
[0072] Optionally, in embodiments of this application, the computer-readable medium is configured to store program code for the processor to perform the following steps: Upon receiving a language switching instruction, retrieve the text in multiple source languages corresponding to the source language displayed on the page; If the font size of the source language text in the target language exceeds the text box size, the source language text is segmented to obtain the word segmentation sequence corresponding to each source language text. Based on the frequency of occurrence of different word groups in each word segmentation sequence on the display page, the keyword groups in each word segmentation sequence are determined; The keyword groups in the word segmentation sequence are translated according to the target language, and the non-keyword groups in the word segmentation sequence are replaced with preset truncation symbols to obtain the truncated display text corresponding to the word segmentation sequence; The corresponding source language text is replaced with each truncated display text on the display page.
[0073] Optionally, specific examples in this embodiment can refer to the examples described in the above embodiments, and will not be repeated here.
[0074] It is understood that the embodiments described herein can be implemented in hardware, software, firmware, middleware, microcode, or a combination thereof. For hardware implementation, the processing unit can be implemented in one or more application-specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DSPDs), programmable logic devices (PLDs), field-programmable gate arrays (FPGAs), general-purpose processors, controllers, microcontrollers, microprocessors, other electronic units for performing the functions described herein, or combinations thereof.
[0075] For software implementation, the techniques described herein can be implemented by units that perform the functions described herein. The software code can be stored in memory and executed by a processor. The memory can be implemented in the processor or external to the processor.
[0076] Those skilled in the art will recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.
[0077] Those skilled in the art will understand that, for the sake of convenience and brevity, the specific working processes of the systems, devices, and units described above can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here.
[0078] In the embodiments provided in this application, it should be understood that the disclosed apparatus and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative. For instance, the division of modules is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple modules or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be an indirect coupling or communication connection through some interfaces, devices, or units, and may be electrical, mechanical, or other forms.
[0079] The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs.
[0080] In addition, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit.
[0081] Through the above description of the embodiments, those skilled in the art can clearly understand that each embodiment can be implemented by means of software plus a general-purpose hardware platform, or of course, by hardware. Based on this understanding, the above technical solutions, in essence or the part that contributes to the related technology, can be embodied in the form of a software product. This computer software product can be stored in a computer-readable storage medium, such as a USB flash drive, a portable hard drive, ROM, RAM, a magnetic disk, or an optical disk, or other media that can store program code, including several instructions to cause a computer device 100 (which may be a personal computer, a server, or a network device, etc.) to execute the methods described in the various embodiments or some parts of the embodiments.
[0082] It should be understood that the terminology used herein is for the purpose of describing particular exemplary embodiments only and is not intended to be limiting. Unless the context clearly indicates otherwise, the singular forms “a,” “an,” and “described” as used herein may also mean including the plural forms. The terms “comprising,” “including,” “containing,” and “having” are inclusive and therefore indicate the presence of the stated features, steps, operations, elements, and / or components, but do not exclude the presence or addition of one or more other features, steps, operations, elements, components, and / or combinations thereof. The method steps, processes, and operations described herein are not construed as requiring them to be performed in a particular order described or illustrated unless the order of performance is explicitly indicated. It should also be understood that alternatives or substitutions may be used.
[0083] The above description is merely a specific embodiment of the present invention, enabling those skilled in the art to understand or implement the invention. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the invention. Therefore, the present invention is not to be limited to the embodiments shown herein, but is to be accorded the widest scope consistent with the principles and novel features claimed herein.
Claims
1. An information display method, characterized in that, The method includes: Upon receiving a language switching instruction, retrieve the text in multiple source languages corresponding to the source language displayed on the page; If the font size of the source language text in the target language exceeds the text box size, the source language text is segmented to obtain the word segmentation sequence corresponding to each source language text. Based on the frequency of occurrence of different word groups in each word segmentation sequence on the display page, the keyword groups in each word segmentation sequence are determined; The keyword groups in the word segmentation sequence are translated according to the target language, and the non-keyword groups in the word segmentation sequence are replaced with preset truncation symbols to obtain the truncated display text corresponding to the word segmentation sequence; The corresponding source language text is replaced with each truncated display text on the display page.
2. The method according to claim 1, characterized in that, When the font size of the source language text exceeds the text box size in the target language, the process involves segmenting each source language text to obtain a word segmentation sequence corresponding to each source language text, including: If the font height of the source language text in the target language exceeds the height of the text box, reduce the font size of the source language text in the target language until the font height of the source language text in the target language is lower than the height of the text box. Then, use the target font size when the font height of the source language text in the target language is lower than the height of the text box as the font size of the keyword group in the word segmentation sequence after translation according to the target language. If the font length of the source language text in the target language exceeds the width of the text box, the source language text is segmented to obtain a word segmentation sequence corresponding to each source language text.
3. The method according to claim 2, characterized in that, When the font length of the source language text in the target language exceeds the width of the text box, the source language text is segmented to obtain a word segmentation sequence corresponding to each source language text, including: If the font length of the source language text in the target language exceeds the width of the text box, identify the abbreviable phrases in the source language text that have corresponding abbreviation characters in the target language. In the source language text translated into the target language text, abbreviation characters are used to replace the translation characters of the corresponding abbreviationable phrases in the target language to obtain the translated abbreviation text; If the font length of the translated abbreviated text exceeds the width of the text box, replace the abbreviated phrases in the source language text with abbreviation characters in the target language to obtain the source language abbreviated text; The source language abbreviation text is segmented to obtain the word segmentation sequence corresponding to the source language abbreviation text.
4. The method according to claim 1, characterized in that, The step of determining the keyword groups in each word segmentation sequence based on the frequency of occurrence of different word groups in each word segmentation sequence on the display page includes: Based on the frequency of occurrence of different word groups in the segmented sequence on the display page, the word groups in the segmented sequence are sorted in descending order to obtain the word group sorting result corresponding to the segmented sequence; The word group that is first in the word group sorting result corresponding to the word segmentation sequence is taken as the keyword group in the word segmentation sequence.
5. The method according to claim 4, characterized in that, The keyword groups in the word segmentation sequence are translated according to the target language, and the non-keyword groups in the word segmentation sequence are replaced with preset truncation symbols to obtain the truncated display text corresponding to the word segmentation sequence, including: The keyword groups in the word segmentation sequence are translated according to the target language, and the non-keyword groups in the word segmentation sequence are replaced with preset truncation symbols to obtain the candidate display text corresponding to the word segmentation sequence; If there exists a candidate display text that is identical to the candidate display text corresponding to the word segmentation sequence, then the candidate display text corresponding to the word segmentation sequence will be used as the repeated display text. The first untranslated phrase in the word sorting result corresponding to the repeated displayed text is taken as the keyword phrase and translated according to the target language to obtain the intermediate displayed text; If there is no display text identical to the intermediate display text, then the intermediate display text is used as the truncated display text corresponding to the word segmentation sequence.
6. The method according to claim 5, characterized in that, The method further includes taking the first untranslated phrase in the phrase sorting result corresponding to the repeated displayed text as the keyword phrase, translating it according to the target language, and obtaining the intermediate displayed text. If the intermediate displayed text is the same as the target language text or the translated abbreviation text, the intermediate displayed text is truncated according to the width of the text box to obtain the truncated displayed text corresponding to the word segmentation sequence.
7. The method according to claim 1, characterized in that, After replacing the corresponding source language text with each truncated display text on the display page, the method further includes: Upon receiving the operation instruction corresponding to the truncated display text, the target language text corresponding to the truncated display text is displayed via a pop-up window.
8. An information display device, characterized in that, The device includes: The acquisition module is used to acquire multiple source language texts corresponding to the source language in the display page when a language switching instruction is received; The segmentation module is used to segment each source language text when the font size of the source language text in the target language exceeds the text box size, so as to obtain the word segmentation sequence corresponding to each source language text. The identification module is used to determine the keyword groups in each word segmentation sequence based on the frequency of occurrence of different word groups in each word segmentation sequence on the display page; The translation module is used to translate the keyword groups in the word segmentation sequence according to the target language, and replace the non-keyword groups in the word segmentation sequence with preset truncation symbols to obtain the truncated display text corresponding to the word segmentation sequence; The display module is used to replace the corresponding source language text with each truncated display text on the display page.
9. A computer device, characterized in that, The computer device includes a display, which includes the information display device as described in claim 8.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the method of any one of claims 1 to 7.