Content display method and device of intelligent question system, medium, equipment and product
Patent Information
- Application Number
- CN202610874128.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2026-06-16
- Publication Date
- 2026-09-22
- Estimated Expiration
- 2046-06-16
AI Technical Summary
[0003]相关技术中,通常先将文本内容渲染到指定的DOM(Document Object Model,文档对象模型)元素,然后读取该元素的实际高度或宽度进行布局,容易触发同步重排,并且在滚动、缩放或大量文本同时出现的情况下,容易带来卡顿
[0010]通过上述技术方案,获取智能问数系统中待显示的文本内容,基于第一预设规则对文本内容进行切分,获得至少一个第一文本单元,且每个第一文本单元标记有对应的换行类型,进而基于第一字符显示宽度确定每个第一文本单元在预设字体下的显示宽度,并缓存用于在智能问数系统中对第一内容进行换行显示的第一信息,其中,第一信息包括至少一个第一文本单元、各第一文本单元对应的换行类型和各第一文本单元在预设字体下的显示宽度,第一预设规则和第一字符显示宽度是通过机器学习模型基于在智能问数系统中存在换行异常的历史内容进行优化的。一方面,通过机器学习模型基于换行异常的历史内容驱动换行规则与字符显示宽度的持续迭代,不断优化智能问数系统的换行显示效果,另一方面,通过预先对文本内容进行处理,获得并缓存换行所需的信息,这样后续通过简单的换行计算即可实现文本内容的换行显示,灵活且效率高,特别是在智能问数场景下,能够更方便地做图文绕排、分栏排版或富文本组合等显示效果。
Smart Images

Figure CN122389807B_ABST
Abstract
Description
Technical Field
[0001] This content relates to the fields of data processing and intelligent data query technology, specifically to a content display method, device, medium, equipment, and product of an intelligent data query system. Background Technology
[0002] The Intelligent Questioning System is a natural language interactive data analysis platform based on LLM (Large Language Model) and AI (Artificial Intelligence) technologies.
[0003] In related technologies, the text content is usually rendered onto a specified DOM (Document Object Model) element first, and then the actual height or width of the element is read for layout. This can easily trigger synchronous reflow and cause lag when scrolling, zooming, or when a large amount of text appears at the same time. Summary of the Invention
[0004] This content section is provided to briefly introduce the concepts, which will be described in detail in the examples section later. This content section is not intended to identify key or essential features of the claimed technical solution, nor is it intended to limit the scope of the claimed technical solution.
[0005] Firstly, a method for displaying content in an intelligent question-and-answer system is provided, including: Obtain the first content, which is the text content to be displayed in the intelligent questioning system; The first content is segmented based on the first preset rule to obtain at least one first text unit, and each first text unit is marked with a corresponding line break type; The display width of each first text unit under the preset font is determined based on the first character display width of the preset font, and first information is cached. The first information includes the at least one first text unit, the line break type corresponding to each first text unit, and the display width of each first text unit under the preset font. The first information is used to display the first content with line breaks in the intelligent questioning system. The first preset rule and the first character display width are optimized by a machine learning model based on historical content with line break anomalies in the intelligent questioning system.
[0006] Secondly, a content display device for an intelligent questioning system is provided, comprising: The acquisition module is used to acquire first content, which is the text content to be displayed in the intelligent questioning system; The segmentation module is used to segment the first content based on a first preset rule to obtain at least one first text unit, and each first text unit is marked with a corresponding line break type; The determining module is used to determine the display width of each first text unit under the preset font based on the first character display width of the preset font, and cache the first information, the first information including the at least one first text unit, the line break type corresponding to each first text unit and the display width of each first text unit under the preset font; The first information is used to display the first content with line breaks in the intelligent questioning system. The first preset rule and the first character display width are optimized by a machine learning model based on historical content with line break anomalies in the intelligent questioning system.
[0007] Thirdly, this disclosure provides a computer-readable medium having a computer program stored thereon, which, when executed by a processing device, implements the steps of the method described in the first aspect.
[0008] Fourthly, this disclosure provides an electronic device, comprising: A storage device on which computer programs are stored; A processing device for executing the computer program in the storage device to implement the steps of the method described in the first aspect.
[0009] Fifthly, this disclosure provides a computer program product, including a computer program that, when executed by a processor, implements the steps of the method described in the first aspect.
[0010] The above technical solution obtains the text content to be displayed in the intelligent question-and-answer system, segments the text content based on a first preset rule to obtain at least one first text unit, and each first text unit is marked with a corresponding line break type. Then, based on the first character display width, the display width of each first text unit in a preset font is determined, and first information for displaying line breaks in the first content in the intelligent question-and-answer system is cached. This first information includes at least one first text unit, the corresponding line break type of each first text unit, and the display width of each first text unit in the preset font. The first preset rule and the first character display width are optimized by a machine learning model based on historical content with line break anomalies in the intelligent question-and-answer system. On the one hand, the machine learning model drives continuous iteration of the line break rule and character display width based on historical content with line break anomalies, continuously optimizing the line break display effect of the intelligent question-and-answer system. On the other hand, by pre-processing the text content to obtain and cache the information required for line breaks, subsequent line break display can be achieved through simple line break calculations, which is flexible and efficient. Especially in intelligent question-and-answer scenarios, it is easier to perform display effects such as text wrapping, column layout, or rich text combination.
[0011] Other features and advantages of the technical solution will be described in detail in the following examples section. Attached Figure Description
[0012] The above and other features, advantages, and aspects of the technical solution will become more apparent when considered in conjunction with the accompanying drawings and the following examples. Throughout the drawings, the same or similar reference numerals denote the same or similar elements. It should be understood that the drawings are schematic, and the originals and elements are not necessarily drawn to scale. In the drawings: Figure 1 This is a schematic diagram illustrating an implementation environment according to an example.
[0013] Figure 2 This is a flowchart illustrating a content display method for an intelligent question-and-answer system, based on an example.
[0014] Figure 3 This is a flowchart illustrating content processing and line break calculation according to an example.
[0015] Figure 4 This is a flowchart illustrating a configuration optimization based on an example.
[0016] Figure 5 This is a flowchart illustrating a combination of rapid typesetting and configuration optimization, as shown in an example.
[0017] Figure 6 This is a schematic diagram of the structure of a content display device for an intelligent question-and-answer system, as illustrated by an example.
[0018] Figure 7 This is a schematic diagram of the structure of an electronic device as illustrated by an example. Detailed Implementation
[0019] The technical solution will now be described in more detail with reference to the accompanying drawings. Although certain scenarios are shown in the drawings, it should be understood that the technical solution can be implemented in various forms and should not be construed as limited to the scenarios described herein. Rather, these scenarios are provided to provide a more thorough and complete understanding of the technical solution. It should be understood that the accompanying drawings and the scenarios described are for illustrative purposes only and are not intended to limit the scope of protection of the technical solution.
[0020] It should be understood that the steps described in the method implementation may be performed in different orders and / or in parallel. Furthermore, the method implementation may include additional steps and / or omit the steps shown. The scope of the technical solution is not limited in this respect.
[0021] The term "comprising" and its variations as used herein can be open-ended, meaning "including but not limited to". The term "based on" can mean "at least partially based on". The term "one case" means "at least one case"; the term "another case" means "at least one additional case"; the term "some cases" means "at least some cases". Definitions of other terms will be given in the following description.
[0022] It should be noted that the concepts of "first" and "second" mentioned here are only used to distinguish different devices, modules or units, and are not used to limit the order of the functions performed by these devices, modules or units or their interdependencies.
[0023] It should be noted that the terms "one" and "more" used here are illustrative rather than restrictive, and those skilled in the art should understand that, unless otherwise expressly indicated in the context, they should be understood as "one or more".
[0024] The names of messages or information exchanged between the multiple devices in the implementation are for illustrative purposes only and are not intended to limit the scope of these messages or information.
[0025] It is understandable that before using the technical solutions provided here, users should be informed of the types, scope of use, and usage scenarios of the personal information involved in accordance with relevant laws and regulations, and their authorization should be obtained through appropriate means.
[0026] For example, upon receiving a user's active request, a prompt message is sent to the user to explicitly inform them that the requested operation will require the acquisition and use of the user's personal information. This allows the user to independently choose, based on the prompt message, whether to provide personal information to the software or hardware such as electronic devices, applications, servers, or storage media performing the operations described herein.
[0027] As an optional but non-limiting implementation, in response to a user's active request, sending a prompt message to the user can be done via a pop-up window, where the prompt message can be presented in text format. Furthermore, the pop-up window can also include a selection control allowing the user to choose "agree" or "disagree" to provide personal information to the electronic device.
[0028] It is understood that the above notification and user authorization process are merely illustrative and do not constitute a limitation on the implementation of the technical solution. Other methods that comply with relevant laws and regulations may also be applied to the implementation of the technical solution.
[0029] At the same time, it is understood that the data involved in the technical solution (including but not limited to the data itself, the acquisition or use of the data) should comply with the requirements of relevant laws, regulations and related provisions.
[0030] In the intelligent data analysis system, users can enter questions as if in a casual conversation (such as "What were the top-selling products last month?"). The system will then automatically understand the intent, analyze the data definitions, execute the query, and quickly return the results in the form of charts or text. This significantly reduces the difficulty of data analysis and allows non-technical personnel to efficiently gain data insights.
[0031] In web pages and applications, it's often necessary to automatically wrap text according to its width and pre-calculate its height. Examples include pre-calculating list heights, preventing card layout jumps, real-time editor layout, text wrapping around images, and column layout. Therefore, how to correctly display line breaks in the dialogue content of an intelligent question-and-answer system has become a pressing technical problem to be solved.
[0032] In related technologies, the text content can be rendered onto a specified DOM (Document Object Model) element first, and then the actual height or width of the element can be read for layout. However, this can easily trigger synchronous reflow and cause lag when scrolling, zooming, or when a large amount of text appears at the same time.
[0033] Alternatively, you can use the measurement algorithm provided by Canvas (a canvas element) to measure the actual width of the text, determine when it exceeds the specified line width and perform a line break. Although this can improve efficiency, it usually involves simple segmentation based on spaces or characters. In cases of mixed languages, punctuation and quotation marks, long URLs (Uniform Resource Locators), long strings of numbers, tabs, soft hyphens, etc., the line break result may differ from the expected display.
[0034] Furthermore, to simulate browser line breaks, a large number of manually maintained rules and parameters (such as language boundaries and browser differences) are required to ensure proper line break display. These rules are numerous, difficult to maintain, and lack validation and regression mechanisms.
[0035] In view of this, this content provides a method, apparatus, medium, device and product for displaying content in an intelligent questioning system to solve the above-mentioned technical problems.
[0036] The content display method of the intelligent questioning system provided in this content can be executed by an electronic device, which can be provided as at least one of a terminal and a server. Figure 1 This is an exemplary schematic diagram illustrating an implementation environment; see [link / reference]. Figure 1 The implementation environment includes: terminal 101 and server 102.
[0037] For example, an intelligent question-and-answer system can be installed on terminal 101. The intelligent question-and-answer system's dialog interface receives user-input questions and sends them to server 102. Server 102 receives and displays the answers returned by server 102 on the dialog interface. Server 102 is the intelligent question-and-answer system, used to provide backend services such as interface layout for input questions and output answers, and generating answers based on input questions.
[0038] In one scenario, server 102 can pre-optimize the first character display width of a first preset rule and a preset font based on historical content with line break anomalies in the intelligent question-and-answer system using a machine learning model. This allows it to obtain first content, which is then segmented according to the first preset rule to obtain at least one first text unit. Each first text unit is marked with a corresponding line break type. The display width of each first text unit in a preset font is determined based on the first character display width, and first information is cached. This first information includes at least one first text unit, the corresponding line break type for each first text unit, and the display width of each first text unit in a preset font. Then, terminal 101 displays the first content with line breaks on the dialogue interface based on this first information. The first content can be the text content of a question obtained by terminal 101 on the dialogue interface, or the text content of an answer generated by server 102 in response to a question.
[0039] In other words, terminal 101 can be responsible for the front-end display, while server 102 can be responsible for the back-end data processing. Alternatively, terminal 101 can be responsible for some of the data processing. The specific configuration can be set according to requirements, and there are no restrictions on this.
[0040] Terminal 101 can be at least one of the following devices: smartphone, smartwatch, desktop computer, laptop, virtual reality terminal, augmented reality terminal, wireless terminal, and laptop computer. Terminal 101 has communication capabilities and can access wired or wireless networks. Terminal 101 can refer to one of multiple terminals, and those skilled in the art will understand that the number of such terminals can be more or less. Server 102 can be an independent physical server, a server cluster composed of multiple physical servers, or a distributed file system. It can also be a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, CDN (Content Delivery Network), and big data and artificial intelligence platforms.
[0041] For example, server 102 and terminal 101 are connected directly or indirectly via wired or wireless communication, without limitation.
[0042] Optionally, the number of servers 102 can be more or less, and there is no limitation thereto. Of course, servers 102 may also include other functional servers to provide more comprehensive and diversified services. Server 102 undertakes the main computing work, and terminal 101 undertakes the secondary computing work; or, server 102 undertakes the secondary computing work, and terminal 101 undertakes the main computing work; or, server 102 or terminal 101 can each undertake computing work independently, and there is no limitation thereto.
[0043] Figure 2 This is a flowchart illustrating a content display method for an exemplary intelligent question-and-answer system. For example... Figure 2 As shown, the method may include the following steps: S201: Obtain the first content, which is the text content to be displayed in the intelligent questioning system.
[0044] For example, the intelligent question-and-answer system can be accessed via a webpage or installed as an application on mobile devices, computers, and other terminal devices. The primary content can be the text content of the question entered by the user or the text content of the answer generated by the intelligent question-and-answer system in response to the question; the specific content can be determined according to the business scenario and is not restricted.
[0045] S202: The first content is segmented based on the first preset rule to obtain at least one first text unit, and each first text unit is marked with a corresponding line break type.
[0046] For example, the line break type can be a whitespace character, a soft hyphen, a zero-width break, a tab character, an explicit line break character, etc. The specific type can be set according to the requirements, and there are no restrictions on it.
[0047] S203: Determine the display width of each first text unit under the preset font based on the first character display width of the preset font, and cache the first information. The first information includes at least one first text unit, the line break type corresponding to each first text unit, and the display width of each first text unit under the preset font. The first information is used to display the first content with line breaks in the intelligent questioning system. The first preset rule and the first character display width are optimized by a machine learning model based on historical content with line break anomalies in the intelligent questioning system.
[0048] For example, preset rules and font character display widths can be configured in advance using machine learning models based on historical content with line-wrapping anomalies in the intelligent question-and-answer system. This improves the accuracy of content segmentation and content display width calculation, thereby enhancing the line-wrapping effect of the displayed content in the intelligent question-and-answer system. When displaying the first piece of content with line wrapping, the intelligent question-and-answer system can perform simple line-wrapping calculations based on cached information to achieve flexible line wrapping, adapting to different scenarios. For instance, when the user resizes the intelligent question-and-answer system's interface, the displayed content can be quickly adjusted for line wrapping.
[0049] Using the above method, on the one hand, the line break rules and character display width are continuously iterated based on the historical content of line break anomalies through machine learning models, thereby continuously optimizing the line break display effect of the intelligent questioning system. On the other hand, by pre-processing the text content, the information required for line breaks is obtained and cached. In this way, the line break display of the text content can be achieved through simple line break calculations, which is flexible and efficient. Especially in the intelligent questioning scenario, it is easier to perform display effects such as image and text wrapping, column layout, or rich text combination.
[0050] In one scenario, the intelligent questioning system is associated with preset rules and parameters corresponding to different operating environments. The parameters include the character display width of the preset font in the corresponding operating environment. The method further includes: determining the first operating environment of the intelligent questioning system, and obtaining the first preset rule and first parameter corresponding to the first operating environment. The first parameter includes the first character display width.
[0051] For example, the intelligent questioning system can run in different operating environments, such as different browsers and different operating systems. The same text content will differ in different operating environments. In order to ensure that the intelligent questioning system can correctly display the text content with line breaks in different operating environments, different configuration information can be set for different environments. That is, configurable rules and thresholds that can cause differences in line break results, such as different preset rules and parameters, such as language recognition rules, special character line break rules, string processing rules, character boundary positions that allow or disallow automatic line breaks of multi-line text in different language systems, character display width of the same font in different operating environments, line break character priority parameters, ligature control parameters, etc. The specific settings can be set according to needs and there are no restrictions on them.
[0052] For example, the configuration information of the corresponding operating environment can be loaded when the intelligent questioning system is running, thereby ensuring that the obtained cached information can match the operating environment. Simple numerical calculations can be performed on each line break without the need for line break adjustments, effectively improving the layout efficiency of content line break display.
[0053] In one scenario, the method further includes: normalizing the first content to obtain processed first content, wherein the normalization process includes at least one of retaining whitespace characters, folding whitespace characters, retaining control characters, and deleting control characters. Segmenting the first content based on a first preset rule includes: segmenting the processed first content based on the first preset rule.
[0054] For example, such as Figure 3 As shown, the text content to be displayed can be normalized first to ensure consistency. For example, multiple spaces can be preserved or collapsed into a single space; control characters such as line breaks can be retained or deleted, etc. These settings can be customized according to requirements and are not restricted. This improves the accuracy of line breaks and the measurement of content display width.
[0055] In one scenario, segmenting the first content based on a first preset rule to obtain at least one first text unit includes: segmenting the first content based on a second preset rule to obtain at least one second text unit; and adjusting the boundaries of the at least one second text unit based on a third preset rule to obtain at least one first text unit; wherein the second preset rule includes segmentation rules based on preset characters, and the third preset rule is different from the second preset rule.
[0056] For example, the first preset rule includes the second and third preset rules. See also... Figure 3You can first divide the text content into small segments according to the second preset rule, that is, at least one second text unit. For example, you can divide it into segments according to the display of the first content line break, with one segment of text corresponding to one text unit, or you can divide it into segments according to the period, with one sentence of text corresponding to one text unit. You can set the preset characters for dividing the text units according to your needs, and there are no restrictions on this.
[0057] Furthermore, continue to refer to Figure 3 Building upon simple segmentation, to further improve segmentation accuracy, appropriate boundary adjustments can be made based on the third preset rule, thereby enhancing the accuracy of subsequent text line breaks. For example, in the sentence "He said: 'The weather will be nice tomorrow.'... content omitted," the content to be displayed is within the quotation marks. If segmented according to the sentence, we get two text units: "He said: 'The weather will be nice tomorrow.'" and "... content omitted." After boundary adjustment, we get the more precise text units "He said: 'The weather will be nice tomorrow.'" and "... content omitted," thus avoiding line breaks in the middle of "." that violate line-breaking conventions.
[0058] In one scenario, the third preset rule includes at least one of the following: splitting and / or merging rules based on structured text patterns; splitting and / or merging rules based on number or character grouping; splitting and / or merging rules based on preset punctuation; and splitting and / or merging rules based on line beginning and end prohibitions.
[0059] For example, splitting and / or merging rules based on structured text patterns could be rules for splitting and / or merging URLs, such as disallowing URL splitting or allowing URLs to be broken at certain preset characters; splitting and / or merging rules based on number or character groups, such as disallowing the splitting of strings composed of numbers and characters like "1,000", "0.01", and "10%"; splitting and / or merging rules based on preset punctuation, such as prohibiting the splitting of "." in the middle; and splitting and / or merging rules based on prohibitions on the beginning and end of lines, such as prohibiting "." at the beginning of a line and "《" at the end of a line. Specific boundary adjustment rules can be set according to requirements and are not restricted.
[0060] For example, if the result of simple segmentation does not meet these rules, boundary adjustments are needed. This effectively improves the accuracy of segmentation, making the line breaks in the text content closer to standard line break conventions.
[0061] After obtaining the text units with adjusted boundaries, each text unit can be marked with a line break type, such as whitespace, soft hyphen, zero-width break, tab character, explicit line break character, etc. This allows the breakpoint to be selected based on the type during subsequent line break calculations, making it easier to create display effects such as text wrapping, column layout, or rich text combination.
[0062] In one scenario, determining the display width of each first text unit under the preset font based on the first character display width of the preset font includes: for each first text unit, measuring the initial display width of the first text unit under the preset font based on the first character display width, and determining the display width of the first text unit under the preset font based on the initial display width and a calibration offset; wherein the calibration offset is determined based on the difference between the display width of the historical content cache and the actual display width.
[0063] For example, continue to refer to Figure 3 The system measures the display width of each text unit in a specified font. The font can be determined according to the font settings of the intelligent questioning system. It can also measure the display width of each text unit in different fonts, so that users do not need to remeasure the display width after switching fonts and can simply perform line break calculations.
[0064] For example, the measurement results can also be calibrated based on calibration offsets obtained from historical data. For instance, after displaying historical content, it's possible to check for any anomalies in the line breaks. If an anomaly exists and is caused by a difference between the cached display width and the actual display width of a character, the width offset of that character can be cached for future calibration. Alternatively, if the cached display width and the actual display width are inconsistent multiple times, a calibration offset can be obtained based on these multiple offsets, such as an average value. A low-frequency calibration of the character width can also be performed periodically; there are no restrictions on this. This effectively reduces the difference between the cached content display width and the actual display width, further improving the accuracy of text line breaks and enhancing the line break effect.
[0065] In one scenario, the method further includes: determining at least one third text unit in a first text unit that satisfies a first preset condition, and determining a line break position in the third text unit; logically dividing the third text unit into multiple text intervals based on the line break position, and determining the display width of each text interval in a preset font based on the first character display width, wherein the first information also includes multiple text intervals and the display width of each text interval in the preset font.
[0066] For example, continue to refer to Figure 3 It can further process text units that meet certain conditions, such as determining the line break positions in long texts. In "...communication...", a line break can be made between "com" and "munication". The specific determination is based on the actual situation and there are no restrictions on this.
[0067] Furthermore, since text units may not necessarily wrap within long texts during actual layout, it's sufficient to logically divide the text into multiple text segments and measure the display width of each segment, without the need for physical splitting. This way, during subsequent line break calculations, the decision to add a line break at a suitable location is made based on actual needs. Compared to determining the suitable line break locations within a long text during line break calculations, this not only effectively improves the efficiency of line break display but also reduces the computational burden on the terminal.
[0068] The first preset condition mentioned above can be set according to needs, such as the display width of the text unit being greater than the preset value or the display width of the preset display object, etc., and there are no restrictions on this.
[0069] In one scenario, the method further includes: determining the number of display lines, display height, and text content of each line of the first content according to the display width of the preset display object and the first information, to obtain a layout result, wherein the intelligent questioning system includes the preset display object; and displaying the first content in the preset display object based on the layout result.
[0070] For example, continue to refer to Figure 3 The system caches auxiliary information such as the segmented text units, the width of the text units, and the line break type as reusable results. On the one hand, it can quickly calculate line breaks when the user adjusts the width of the interface display, and on the other hand, it can directly reuse the cached results when the same text unit is obtained again. It can also store the results according to font-text unit for easy reuse later.
[0071] During line break calculation, text units are loaded line by line within the preset display object's given width. If the width exceeds the limit, appropriate breakpoints are selected, and line breaks are initiated at permissible positions if necessary. This process ultimately yields the text range for each line, the total number of lines, and the total height. This ensures rapid recalculation even if the preset display object's width changes, minimizing lag.
[0072] Therefore, by breaking down the typesetting process into two parts, "advance preparation" and "rapid calculation," auxiliary information such as segmentation, width measurement, and line break types are prepared in advance. This allows for numerical calculations only at the time of each line break, avoiding frequent layout jitter. This is suitable for scenarios such as list scrolling and window scaling, reducing the risk of lag and improving system performance. Furthermore, by setting rules and performing width calibration for multilingual and boundary cases, page jumps caused by inaccurate height estimation can be reduced. Additionally, outputting information such as the range of each line makes it easier for the front-end to implement effects such as text wrapping, column layout, or rich text combinations. This is particularly beneficial when displaying multimodal content in intelligent query systems, effectively improving the flexibility of text display.
[0073] In one scenario, the method further includes: detecting the first content displayed with line breaks in the intelligent question-and-answer system to obtain a fourth text unit with a line break anomaly; determining at least one candidate configuration information based on the fourth text unit using a machine learning model, each candidate configuration information including candidate preset rules and candidate parameters, the candidate parameters including the second character display width of a preset font; determining a first candidate configuration information that meets a second preset condition from at least one candidate configuration information, and determining the first candidate configuration information as the new configuration information.
[0074] For example, such as Figure 4 As shown, after the content is displayed on the interface of the intelligent questioning system, the displayed content can be detected to obtain text units with line break anomalies. The fifth text unit that correctly breaks the line can be determined first, and the difference between the two can be input into the machine learning model, or the abnormal text unit can be directly input into the machine learning model. The machine learning model can be a large language model or other models. The model understands the differences and produces candidate configuration information, which can include candidate preset rules and candidate parameters. The candidate configuration information is different from the configuration information currently used.
[0075] Furthermore, it verifies whether the line break effect calculated by different candidate configuration information is better than the line break effect of the current configuration information. For example, different candidate configuration information is applied to the same text content to see which candidate configuration information displays a better line break habit. If no candidate configuration information exists, new candidate configuration information is generated until a better candidate configuration information is selected for publication. Subsequent content is segmented and its width is measured based on the new configuration information, so that the display effect of the intelligent questioning system is continuously optimized.
[0076] It should be understood that the machine learning model does not participate in the calculation of each line break. Instead, it updates the rules and parameter configurations afterward using difference samples and automatic verification, balancing efficiency and accuracy. The configurations produced by automatic optimization will return to the preparation stage in advance, making the line break results of subsequent content closer to the real line break habits.
[0077] Configuration optimization can be performed after each content display or periodically to save computing resources, improve the scalability of rule parameters, and reduce maintenance difficulty.
[0078] This content provides a content display method for an intelligent question-and-answer system, comprising: acquiring first content, wherein the first content is text content to be displayed in the intelligent question-and-answer system; segmenting the first content based on a first preset rule to obtain at least one first text unit, wherein each first text unit is marked with a corresponding line break type, the first preset rule including a second preset rule for preliminary segmentation based on preset characters and a third preset rule for merging or splitting the preliminary segmentation results; determining the display width of each first text unit under a preset font based on the first character display width of a preset font, and caching first information, wherein the first information includes at least one first text unit, the line break type corresponding to each first text unit, and the display width of each first text unit under a preset font; wherein the first information is used to display the first content with line breaks in the intelligent question-and-answer system, and the first preset rule and the first character display width are optimized by a machine learning model based on historical content with line break anomalies in the intelligent question-and-answer system.
[0079] For example, such as Figure 5 As shown, through the daily use of the quick layout process, when laying out the page, a preliminary segmentation and segment adjustment and segment width measurement are performed first. When repeated line breaks occur later, line break calculations can be performed quickly. Combined with the occasional use of the automatic optimization process, the rules and parameters can be iteratively optimized to improve the accuracy of line break calculations, making the final line break effect closer to real line break habits.
[0080] This content provides a content display system for an intelligent questioning system, including an input acquisition module, a text normalization and segmentation module, a semantic boundary adjustment module, a measurement and calibration module, a reusable result construction module, a rapid layout module, a model adaptive calibration module, and an automatic evaluation and regression module.
[0081] The system comprises several modules: Input Acquisition Module, Text Normalization and Segmentation Module, and Text Normalization and Segmentation Module. Input acquisition module obtains the text to be formatted, including font settings, whitespace handling, word segmentation, width limits, and line height parameters. Text Normalization and Segmentation Module first organizes the text into a uniform format (e.g., collapsing or preserving whitespace), identifies spaces, explicit line breaks, tab characters, soft hyphens, zero-width breakpoints, etc., and performs initial segmentation. Semantic Boundary Adjustment Module merges or splits the segmented results according to rules, making the boundaries closer to real line breaks, such as handling URLs, number strings, punctuation and quotation mark concatenation, and line beginning / end rules. Measurement and Calibration Module measures the display width of each text unit under a specified font and performs a low-frequency calibration when systematic deviations are detected in certain environments. It also caches results by font to reduce redundant measurements. Reusable Result Construction Module organizes auxiliary information such as font, text unit, display width, and line break type into a reusable result for easy and rapid subsequent calculations.
[0082] The rapid layout module performs quick line wrapping calculations based on reusable results, given a width and line height, and outputs the number of lines, paragraph height, and the range information for each line. The model adaptive calibration module uses machine learning models to provide rule and parameter adjustment suggestions based on outlier samples and evaluation results, and generates a releasable configuration version after validation. The automatic evaluation and regression module uses a sample set covering multiple languages and edge cases to automatically compare and evaluate whether the new configuration is better; if it doesn't meet the standards, it rolls back or continues to adjust.
[0083] Figure 6 This is a schematic diagram of the structure of a content display device according to an exemplary intelligent question-and-answer system. For example... Figure 6 As shown, the content display device 600 of the intelligent questioning system includes: The acquisition module 601 is used to acquire first content, which is the text content to be displayed in the intelligent questioning system; The segmentation module 602 is used to segment the first content based on a first preset rule to obtain at least one first text unit, and each first text unit is marked with a corresponding line break type; The determining module 603 is used to determine the display width of each first text unit under the preset font based on the first character display width of the preset font, and cache the first information, the first information including the at least one first text unit, the line break type corresponding to each first text unit and the display width of each first text unit under the preset font; The first information is used to display the first content with line breaks in the intelligent questioning system. The first preset rule and the first character display width are optimized by a machine learning model based on historical content with line break anomalies in the intelligent questioning system.
[0084] By adopting the above system, on the one hand, the line break rules and character display width are continuously iterated based on the historical content of line break anomalies through machine learning models, thereby continuously optimizing the line break display effect of the intelligent questioning system. On the other hand, by pre-processing the text content, the information required for line breaks is obtained and cached. In this way, the line break display of the text content can be realized through simple line break calculations, which is flexible and efficient. Especially in the intelligent questioning scenario, it is easier to perform display effects such as image and text wrapping, column layout, or rich text combination.
[0085] Optionally, the segmentation module 602 is used for: The first content is segmented based on the second preset rule to obtain at least one second text unit; Based on the third preset rule, the boundary of the at least one second text unit is adjusted to obtain at least one first text unit; The second preset rule includes a segmentation rule based on preset characters, and the third preset rule is different from the second preset rule.
[0086] Optionally, the third preset rule includes at least one of the following: Splitting and / or merging rules based on structured text patterns; Splitting and / or merging rules based on number or character groups; Based on preset punctuation splitting and / or merging rules; Splitting and / or merging rules based on line beginning and line ending prohibitions.
[0087] Optionally, the content display device 600 of the intelligent questioning system further includes a determining submodule, used for: Identify a third text unit in the at least one first text unit that satisfies a first preset condition, and determine the line breakable position in the third text unit; The third text unit is logically divided into multiple text intervals based on the line break position, and the display width of each text interval under the preset font is determined based on the first character display width. The first information also includes the multiple text intervals and the display width of each text interval under the preset font.
[0088] Optionally, the determining module 603 is used to: For each of the first text units, the initial display width of the first text unit under the preset font is measured based on the first character display width, and the display width of the first text unit under the preset font is determined based on the initial display width and the calibration offset; The calibration offset is determined based on the difference between the display width of the historical content cache and the actual display width.
[0089] Optionally, the content display device 600 of the intelligent question-and-answer system further includes a detection module for: The first content displayed after a line break in the intelligent question-and-answer system is detected to obtain a fourth text unit with a line break anomaly; The machine learning model determines at least one candidate configuration information based on the fourth text unit. Each candidate configuration information includes a candidate preset rule and a candidate parameter. The candidate parameter includes the second character display width of the preset font. From the at least one candidate configuration information, a first candidate configuration information that meets the second preset condition is determined, and the first candidate configuration information is determined as the new configuration information.
[0090] Optionally, the content display device 600 of the intelligent questioning system further includes a layout module for: Based on the display width of the preset display object and the first information, the number of display lines, display height, and text content of each line of the first content are determined to obtain the layout result. The intelligent questioning system includes the preset display object. Based on the layout result, the first content is displayed in the preset display object.
[0091] Optionally, the intelligent questioning system is associated with preset rules and parameters corresponding to different operating environments. The parameters include the character display width of the preset font in the corresponding operating environment. The content display device 600 of the intelligent questioning system further includes an acquisition submodule, used for: The first operating environment of the intelligent questioning system is determined, and the first preset rule and first parameter corresponding to the first operating environment are obtained, wherein the first parameter includes the first character display width.
[0092] Optionally, the content display device 600 of the intelligent question-and-answer system further includes a processing module for: The first content is normalized to obtain the processed first content. The normalization process includes at least one of retaining whitespace characters, folding whitespace characters, retaining control characters, and deleting control characters. The segmentation module 602 is used for: The processed first content is segmented based on the first preset rule.
[0093] Regarding the content display device 600 of the intelligent questioning system mentioned above, the method logic executed by each functional module has been explained in detail in the section on methods, and will not be repeated here.
[0094] Based on the same concept, a computer-readable medium is also provided, on which a computer program is stored, which, when executed by a processing device, implements the steps of the content display method of any of the above-described intelligent question-and-answer systems.
[0095] On the one hand, by using machine learning models to drive continuous iteration of line break rules and character display width based on historical content of line break anomalies, the line break display effect of the intelligent questioning system is continuously optimized. On the other hand, by pre-processing the text content, the information required for line breaks is obtained and cached. In this way, the line break display of the text content can be achieved through simple line break calculations, which is flexible and efficient. Especially in the intelligent questioning scenario, it is easier to perform display effects such as image and text wrapping, column layout, or rich text combination.
[0096] Based on the same concept, an electronic device is also provided, which may include: A storage device on which computer programs are stored; A processing device for executing a computer program stored in a storage device to implement the steps of the content display method of any of the above-described intelligent question-and-answer systems.
[0097] On the one hand, by using machine learning models to drive continuous iteration of line break rules and character display width based on historical content of line break anomalies, the line break display effect of the intelligent questioning system is continuously optimized. On the other hand, by pre-processing the text content, the information required for line breaks is obtained and cached. In this way, the line break display of the text content can be achieved through simple line break calculations, which is flexible and efficient. Especially in the intelligent questioning scenario, it is easier to perform display effects such as image and text wrapping, column layout, or rich text combination.
[0098] Based on the same concept, a computer program product is also provided, including a computer program that, when executed by a processor, implements the steps of the content display method of any of the above-described intelligent question-and-answer systems.
[0099] On the one hand, by using machine learning models to drive continuous iteration of line break rules and character display width based on historical content of line break anomalies, the line break display effect of the intelligent questioning system is continuously optimized. On the other hand, by pre-processing the text content, the information required for line breaks is obtained and cached. In this way, the line break display of the text content can be achieved through simple line break calculations, which is flexible and efficient. Especially in the intelligent questioning scenario, it is easier to perform display effects such as image and text wrapping, column layout, or rich text combination.
[0100] The following is for reference. Figure 7 The diagram illustrates a structural schematic of an electronic device 700 suitable for implementing the above-described technical solution. The terminal device may include, but is not limited to, mobile terminals such as mobile phones, laptops, digital broadcast receivers, PDAs (Personal Digital Assistants), PADs (Tablet Personal Computers), PMPs (Portable Media Players), in-vehicle terminals (e.g., in-vehicle navigation terminals), and fixed terminals such as digital TVs (Televisions), desktop computers, etc. Figure 7 The electronic device shown is merely an example and should not be construed as limiting its functionality or scope of use.
[0101] like Figure 7As shown, the electronic device 700 may include a processing unit (e.g., a central processing unit, a graphics processing unit, etc.) 701, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 702 or a program loaded from a storage device 708 into a random access memory (RAM) 703. The RAM 703 also stores various programs and data required for the operation of the electronic device 700. The processing unit 701, the ROM 702, and the RAM 703 are interconnected via a bus 704. An input / output (I / O) interface 705 is also connected to the bus 704.
[0102] Typically, the following devices can be connected to the input / output interface 705: input devices 706 including, for example, a touchscreen, touchpad, keyboard, mouse, camera, microphone, accelerometer, gyroscope, etc.; output devices 707 including, for example, a liquid crystal display (LCD), speaker, vibrator, etc.; storage devices 708 including, for example, magnetic tape, hard disk, etc.; and communication devices 709. Communication device 709 allows electronic device 700 to communicate wirelessly or wiredly with other devices to exchange data. Although Figure 7 An electronic device 700 with various devices is shown; however, it should be understood that it is not required to implement or possess all of the devices shown. More or fewer devices may be implemented or possessed alternatively.
[0103] In particular, depending on certain circumstances, the processes described in the flowchart above can be implemented as computer software programs. For example, a computer program product is provided, comprising a computer program carried on a non-transitory computer-readable medium, the computer program containing program code for performing the methods shown in the flowchart. This computer program can be downloaded and installed from a network via communication device 709, or installed from storage device 708, or installed from read-only memory 702. When the computer program is executed by processing device 701, it performs the functions defined in the above-described methods.
[0104] It should be noted that the aforementioned computer-readable medium may be a computer-readable signal medium or a computer-readable storage medium, or any combination thereof. A computer-readable storage medium may be, for example,—but not limited to—an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples of a computer-readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer disk, a hard disk, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM, or flash memory), optical fiber, portable compact disc read-only memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination thereof. In one case, a computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system, apparatus, or device. In another case, a computer-readable signal medium may include a data signal propagated in baseband or as part of a carrier wave, carrying computer-readable program code. The transmitted data signal can take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. The computer-readable signal medium can also be any computer-readable medium other than a computer-readable storage medium, which can send, propagate, or transmit a program for use by or in connection with an instruction execution system, apparatus, or device. The program code contained on the computer-readable medium can be transmitted using any suitable medium, including but not limited to: wires, optical fibers, RF (Radio Frequency), etc., or any suitable combination thereof.
[0105] In some implementations, communication can be conducted using any currently known or future-developed network protocol, such as HTTP (Hypertext Transfer Protocol), and can be interconnected with digital data communication (e.g., communication networks) of any form or medium. Examples of communication networks include local area networks (LANs), wide area networks (WANs), the internet (e.g., the Internet), and end-to-end networks (e.g., ad-hoc end-to-end networks), as well as any currently known or future-developed networks.
[0106] The aforementioned computer-readable medium may be included in the aforementioned electronic device; or it may exist independently and not assembled into the electronic device.
[0107] The aforementioned computer-readable medium carries one or more programs. When the electronic device executes the aforementioned one or more programs, the electronic device causes the following actions: to acquire first content, wherein the first content is text content to be displayed in the intelligent question-and-answer system; to segment the first content based on a first preset rule to obtain at least one first text unit, and each first text unit is marked with a corresponding line break type; to determine the display width of each first text unit in the preset font based on a first character display width of the preset font, and to cache first information, wherein the first information includes the at least one first text unit, the line break type corresponding to each first text unit, and the display width of each first text unit in the preset font; wherein the first information is used to display the first content with line breaks in the intelligent question-and-answer system, and the first preset rule and the first character display width are optimized by a machine learning model based on historical content with line break anomalies in the intelligent question-and-answer system.
[0108] Computer program code for performing the above operations can be written in one or more programming languages or a combination thereof. These programming languages include, but are not limited to, object-oriented programming languages, as well as conventional procedural programming languages. The program code can be executed entirely on the user's computer, partially on the user's computer, as a standalone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving remote computers, the remote computer can be connected to the user's computer via any type of network—including a local area network (LAN) or a wide area network (WAN)—or can be connected to an external computer (e.g., via the Internet using an Internet service provider).
[0109] The flowcharts and block diagrams in the accompanying figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products under various scenarios. In this respect, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing the specified logical function. It should also be noted that in some alternative implementations, the functions indicated in the blocks may occur in a different order than those indicated in the figures. For example, two consecutively indicated blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in the block diagrams and / or flowcharts, and combinations of blocks in the block diagrams and / or flowcharts, can be implemented using a dedicated hardware-based system that performs the specified function or operation, or using a combination of dedicated hardware and computer instructions.
[0110] The modules mentioned above can be implemented in software or hardware. In some cases, the name of a module does not necessarily limit the functionality of that module.
[0111] The functions described above can be performed, at least in part, by one or more hardware logic components. For example, exemplary types of hardware logic components that can be used, without limitation, include: Field-Programmable Gate Arrays (FPGAs), Application-Specific Integrated Circuits (ASICs), Application-Specific Standard Parts (ASSPs), Systems on Chips (SoCs), Complex Programmable Logic Devices (CPLDs), and so on.
[0112] In this context, a machine-readable medium can be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, apparatus, or device. A machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium can be, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination of the foregoing. More specific examples of machine-readable storage media include electrical connections based on one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fibers, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing.
[0113] The above description is merely illustrative and explains the technical principles employed. Those skilled in the art should understand that the scope of the technical solution is not limited to specific combinations of the above-described technical features, but also includes other technical solutions formed by arbitrary combinations of the above-described technical features or their equivalents without departing from the above concept. For example, technical solutions formed by substituting the above-described features with (but not limited to) technical features provided herein that have similar functions.
[0114] Furthermore, while the operations are described in a specific order, this should not be construed as requiring these operations to be performed in the specific order shown or in a sequential order. Multitasking and parallel processing may be advantageous in certain environments. Similarly, although some specific implementation details are included in the above discussion, these should not be interpreted as limitations on the scope of the technical solution. Certain features described in the context of a single example can also be implemented in combination in a single example. Conversely, various features described in the context of a single example can also be implemented individually or in any suitable sub-combination in multiple examples.
[0115] Although the technical solution has been described using language specific to structural features and / or methodological logic, it should be understood that the subject matter defined in the appended claims is not necessarily limited to the specific features or actions described above. Rather, the specific features and actions described above are merely illustrative examples of implementing the claims. Regarding the aforementioned apparatus, the specific manner in which each module performs its operation has already been described in detail in the section concerning the method, and will not be elaborated upon here.
Claims
1. A method for displaying content in an intelligent question-and-answer system, comprising: Obtain the first content, which is the text content to be displayed in the intelligent questioning system; The first content is segmented based on the first preset rule to obtain at least one first text unit, and each first text unit is marked with a corresponding line break type; The display width of each first text unit under the preset font is determined based on the first character display width of the preset font, and first information is cached. The first information includes the at least one first text unit, the line break type corresponding to each first text unit, and the display width of each first text unit under the preset font. The first information is used to display the first content with line breaks in the intelligent questioning system. The first preset rule and the first character display width are optimized by a machine learning model based on historical content with line break anomalies in the intelligent questioning system. The first content displayed after a line break in the intelligent question-and-answer system is detected to obtain a fourth text unit with a line break anomaly; The machine learning model determines at least one candidate configuration information based on the fourth text unit. Each candidate configuration information includes a candidate preset rule and a candidate parameter. The candidate parameter includes the second character display width of the preset font. From the at least one candidate configuration information, a first candidate configuration information that meets the second preset condition is determined, and the first candidate configuration information is determined as the new configuration information.
2. The method according to claim 1, wherein segmenting the first content based on a first preset rule to obtain at least one first text unit includes: The first content is segmented based on the second preset rule to obtain at least one second text unit; Based on the third preset rule, the boundary of the at least one second text unit is adjusted to obtain at least one first text unit; The second preset rule includes a segmentation rule based on preset characters, and the third preset rule is different from the second preset rule.
3. The method according to claim 2, wherein the third preset rule includes at least one of the following: Splitting and / or merging rules based on structured text patterns; Splitting and / or merging rules based on number or character groups; Based on preset punctuation splitting and / or merging rules; Splitting and / or merging rules based on line beginning and line ending prohibitions.
4. The method according to any one of claims 1-3, further comprising: Identify a third text unit in the at least one first text unit that satisfies a first preset condition, and determine the line breakable position in the third text unit; The third text unit is logically divided into multiple text intervals based on the line break position, and the display width of each text interval under the preset font is determined based on the first character display width. The first information also includes the multiple text intervals and the display width of each text interval under the preset font.
5. The method according to any one of claims 1-3, wherein determining the display width of each first text unit under the preset font based on the first character display width of the preset font comprises: For each of the first text units, the initial display width of the first text unit under the preset font is measured based on the first character display width, and the display width of the first text unit under the preset font is determined based on the initial display width and the calibration offset; The calibration offset is determined based on the difference between the display width of the historical content cache and the actual display width.
6. The method according to any one of claims 1-3, further comprising: Based on the display width of the preset display object and the first information, the number of display lines, display height, and text content of each line of the first content are determined to obtain the layout result. The intelligent questioning system includes the preset display object. Based on the layout result, the first content is displayed in the preset display object.
7. The method according to any one of claims 1-3, wherein the intelligent query system is associated with preset rules and parameters corresponding to different operating environments, the parameters including the character display width of the preset font in the corresponding operating environment, and the method further includes: The first operating environment of the intelligent questioning system is determined, and the first preset rule and the first parameter corresponding to the first operating environment are obtained. The first parameter includes the first character display width.
8. The method according to any one of claims 1-3, further comprising: The first content is normalized to obtain the processed first content. The normalization process includes at least one of retaining whitespace characters, folding whitespace characters, retaining control characters, and deleting control characters. The segmentation of the first content based on the first preset rule includes: The processed first content is segmented based on the first preset rule.
9. A content display device for an intelligent questioning system, comprising: The acquisition module is used to acquire first content, which is the text content to be displayed in the intelligent questioning system; The segmentation module is used to segment the first content based on a first preset rule to obtain at least one first text unit, and each first text unit is marked with a corresponding line break type; The determining module is used to determine the display width of each first text unit under the preset font based on the first character display width of the preset font, and to cache first information, the first information including the at least one first text unit, the line break type corresponding to each first text unit, and the display width of each first text unit under the preset font; wherein, the first information is used to display the first content with line breaks in the intelligent questioning system, and the first preset rule and the first character display width are optimized by a machine learning model based on historical content with line break anomalies in the intelligent questioning system; The detection module is used to detect the first content after line breaks in the intelligent question-and-answer system to obtain a fourth text unit with a line break anomaly; to determine at least one candidate configuration information based on the fourth text unit using the machine learning model, each candidate configuration information including a candidate preset rule and a candidate parameter, the candidate parameter including the second character display width of the preset font; to determine a first candidate configuration information that meets a second preset condition from the at least one candidate configuration information, and to determine the first candidate configuration information as the new configuration information.
10. A computer-readable medium having a computer program stored thereon, wherein, When executed by a processing device, the computer program performs the steps of the method according to any one of claims 1-8.
11. An electronic device, comprising: A storage device on which computer programs are stored; A processing device for executing the computer program in the storage device to implement the steps of the method according to any one of claims 1-8.
12. A computer program product comprising a computer program, wherein, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1-8.
Citation Information
Patent Citations
Medical record text typesetting method and system, storage medium and electronic equipment
CN117371446A
Text segmentation method and related equipment
CN121328561A
Generative text filling
US20260141167A1