Information processing method and device, electronic equipment and storage medium
By performing syntax analysis and hierarchical depth determination of large-scale reply information, the problem of format errors caused by corruption of the syntax structure of the reply information is solved, and correct content rendering and user experience improvement are achieved.
Patent Information
- Application Number
- CN202510251642.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-03-04
- Publication Date
- 2025-06-13
AI Technical Summary
In the prior art, when processing large-scale reply content, if the syntax structure of the reply content is destroyed, the rendered reply content format may be incorrect, affecting the user's reading experience.
By obtaining user input information, obtaining reply information in the specified syntax form, analyzing the reply information based on the corresponding syntax rules, obtaining multiple content blocks, and determining the hierarchical depth of each node, and finally rendering the reply information based on the hierarchical depth.
Even if the syntax structure of the reply information is destroyed, this method can correctly parse and render the content, ensure that the reply information presents the correct hierarchy and format, and improve the user's reading experience.
Smart Images

Figure CN120146192A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of computer technologies, and in particular, to an information processing method, apparatus, electronic device, and storage medium. Background Art
[0002] With the rise of a series of conversational large model products, it has become increasingly common to use large models to answer user questions. Since users have the need to read the content of the large model's responses, it is the basis for improving the user reading experience that the content of the large model's responses can be correctly rendered to present the correct levels and formats. Summary of the Invention
[0003] According to some embodiments of the present disclosure, there is provided an information processing method, including: in response to input information of a user, obtaining response information corresponding to the input information, where the response information is information in a specified grammatical form; based on grammatical rules corresponding to the specified grammatical form, parsing the content in the response information to obtain a plurality of content blocks, and determining the hierarchical depth of each node in each content block among the plurality of content blocks; and based on the hierarchical depth of each node, rendering the response information.
[0004] According to some other embodiments of the present disclosure, there is provided an information processing apparatus, including: an obtaining module configured to, in response to input information of a user, obtain response information corresponding to the input information, where the response information is information in a specified grammatical form; a parsing module configured to, based on grammatical rules corresponding to the specified grammatical form, parse the content in the response information to obtain a plurality of content blocks, and determine the hierarchical depth of each node in each content block among the plurality of content blocks; and a rendering module configured to, based on the hierarchical depth of each node, render the response information.
[0005] According to still some other embodiments of the present disclosure, there is provided an electronic device, including: a processor; and a memory coupled to the processor for storing instructions, which when executed by the processor, cause the processor to execute the information processing method of any embodiment of the present disclosure.
[0006] According to still some other embodiments of the present disclosure, there is provided a computer-readable storage medium having a computer program stored thereon, where when the program is executed by a processor, the processor is caused to implement the information processing method of any embodiment of the present disclosure.
[0007] According to still some other embodiments of the present disclosure, there is provided a computer program product including instructions, which when executed by a processor, cause the processor to execute the information processing method as in any embodiment of the present disclosure.
[0008] Other features, aspects, and advantages of the present disclosure will become apparent from the following detailed description of exemplary embodiments of the present disclosure with reference to the accompanying drawings. Description of the Drawings
[0009] Embodiments of the present disclosure will be described below with reference to the accompanying drawings. It should be understood that the drawings in the following description only relate to some embodiments of the present disclosure and do not constitute a limitation on the present disclosure. In the drawings:
[0010] Figure 1 A flowchart showing an information processing method according to some embodiments of the present disclosure;
[0011] Figure 2 A flowchart showing a process of obtaining multiple content blocks according to some embodiments of the present disclosure;
[0012] Figure 3 A flowchart showing a process of determining the hierarchical depth of each node according to some embodiments of the present disclosure;
[0013] Figure 4 A schematic diagram showing the indentation logic of the parent - child list according to some embodiments of the present disclosure;
[0014] Figure 5A A schematic diagram showing a normal list according to some embodiments of the present disclosure;
[0015] Figure 5B A schematic diagram showing an abstract syntax tree corresponding to the normal list according to some embodiments of the present disclosure;
[0016] Figure 6A A schematic diagram showing the insertion of an HTML data block into the normal list according to some embodiments of the present disclosure;
[0017] Figure 6B A schematic diagram showing an abstract syntax tree corresponding to the insertion of an HTML data block into the normal list according to some embodiments of the present disclosure;
[0018] Figure 7 A schematic diagram showing an abstract syntax tree corresponding to the repaired insertion of an HTML data block into the normal list according to some embodiments of the present disclosure;
[0019] Figure 8A A schematic diagram showing the rendering after inserting an HTML data block into the normal list according to some embodiments of the present disclosure;
[0020] Figure 8B A schematic diagram showing the rendering after syntax repair of the inserted HTML data block into the normal list according to some embodiments of the present disclosure;
[0021] Figure 9 A block diagram showing an information processing apparatus according to some embodiments of the present disclosure;
[0022] Figure 10 A block diagram showing an information processing apparatus according to other embodiments of the present disclosure;
[0023] Figure 11 A block diagram showing an electronic device according to some embodiments of the present disclosure.
[0024] It should be understood that, for the sake of convenience of description, the dimensions of the respective parts shown in the drawings are not necessarily drawn according to the actual proportional relationship. The same or similar reference numerals are used in the respective drawings to represent the same or similar components. Therefore, once an item is defined in one drawing, it may not be further discussed in the subsequent drawings. Detailed Embodiments
[0025] The technical solutions in the embodiments of the present disclosure will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present disclosure. It should be understood that the present disclosure can be implemented in various forms and should not be construed as limited to the embodiments set forth herein.
[0026] It should be understood that the steps recited in the method embodiments of the present disclosure can be executed in different orders and / or executed in parallel. In addition, the method embodiments may include additional steps and / or omit the steps shown. The scope of the present disclosure is not limited in this regard. Unless otherwise specifically stated, the relative arrangements, numerical expressions, and numerical values of the components and steps set forth in these embodiments should be construed as merely exemplary and not limiting the scope of the present disclosure.
[0027] The term "comprising" and its variants used in the present disclosure mean an open term that includes at least the subsequent elements / features but does not exclude other elements / features, that is, "including but not limited to". The term "based on" means "at least partially based on".
[0028] It should be noted that the concepts such as "first" and "second" mentioned in the present disclosure are only used to distinguish different devices, modules, or units, and are not used to limit the order of the functions executed by these devices, modules, or units or their interdependent relationships. Unless otherwise specified, the concepts such as "first" and "second" are not intended to imply that the objects so described must be in a given order in terms of time, space, ranking, or any other way.
[0029] It should be noted that the modifications of "one" and "multiple" mentioned in the present disclosure are illustrative rather than restrictive. Those skilled in the art should understand that unless otherwise clearly stated in the context, it should be understood as "one or more".
[0030] The names of the messages or information exchanged between multiple devices in the embodiments of the present disclosure are for illustrative purposes only and are not used to limit the scope of these messages or information.
[0031] The user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data for analysis, stored data, displayed data, etc.) involved in the present disclosure are all information and data authorized by the user or fully authorized by all parties. Moreover, the collection, use, and processing of relevant data need to comply with the relevant laws, regulations, and standards of the relevant countries and regions, and corresponding operation entrances are provided for users to choose to authorize or reject.
[0032] The embodiments of the present disclosure will be described in detail below with reference to the accompanying drawings, but the present disclosure is not limited to these specific embodiments. These specific embodiments can be combined with each other, and the same or similar concepts or processes may not be described again in some embodiments. In addition, in one or more embodiments, specific features, structures, or characteristics can be combined in any suitable manner that will be clear to those of ordinary skill in the art from the present disclosure.
[0033] Large models usually reply in a specified syntax form, and the reply content is convenient for users to read after being rendered. However, the rendering solutions in related technologies are usually implemented based on some open-source specifications, and only the content that strictly conforms to the specified syntax specifications can be normally rendered. If the syntax structure of the reply content is damaged, the format of the rendered reply content may be incorrect, which is not conducive to users' reading. The present disclosure provides an information processing solution that can render the content with the correct hierarchy and format even when the syntax structure is incorrect.
[0034] Figure 1 A flowchart showing an information processing method according to some embodiments of the present disclosure.
[0035] As Figure 1 shown, the information processing method includes: Step S1, in response to the input information of the user, obtaining the reply information corresponding to the input information, where the reply information includes information in a specified syntax form; Step S2, based on the syntax rules corresponding to the specified syntax form, parsing the content in the reply information to obtain multiple content blocks, and determining the hierarchical depth of each node in each content block of the multiple content blocks; and Step S3, rendering the reply information based on the hierarchical depth of each node.
[0036] The information processing method of this embodiment can be executed on the client side or partially on the server side.
[0037] A syntax parser can be used to parse the syntax structure of the content in the reply message, and a renderer can be used to render the parsed content.
[0038] For example, the large model analyzes the input information from the user to obtain a reply message, and feeds back the reply message to the client in a specified syntax form. The client calls the syntax parser to parse the content in the reply message to obtain multiple content blocks. Each content block includes one or more nodes, and one node corresponds to one list item. The renderer is called to render the reply message according to the hierarchical depth of each node, and present the rendered reply message. Even if the syntax structure corresponding to the reply message is damaged, this embodiment can repair the syntax structure through syntax parsing and rendering, enabling the reply message to be normally rendered and improving the user's reading experience.
[0039] The following will further describe the information processing method according to the embodiments of the present disclosure in conjunction with Figures 2 - 8B , further describe the information processing method according to the embodiments of the present disclosure.
[0040] Figure 2 FIG. shows a flowchart of obtaining multiple content blocks according to some embodiments of the present disclosure. This embodiment includes step S21 and step S22. In this embodiment, the content of the reply message is taken as an example of list content, and the multiple content blocks are multiple list blocks. The parsing of the content in the reply message to obtain multiple content blocks includes: step S21, identifying multiple root nodes in the list content; and step S22, obtaining the multiple list blocks based on the multiple root nodes.
[0041] The list includes, for example, ordered lists, unordered lists, nested lists, and task lists. First, identify multiple root nodes in the list content. A root node is a node without a parent node. A root node may have nodes cascaded with it or may not have nodes cascaded with it. Each root node is located in a list block. In this way, a list is divided into multiple list blocks, which facilitates determining the hierarchical depth of each node in each list block.
[0042] In some embodiments, for any one of the multiple root nodes, the root node and the nodes having a cascading relationship with the root node are taken as a list block.
[0043] For example, if a certain root node has two child nodes, and each child node has a child node respectively, then these 5 nodes are taken as a list block.
[0044] In other embodiments, for any one of the multiple root nodes, in response to the root node not having a node having a cascading relationship with the root node, the root node is taken as one of the list blocks.
[0045] For example, if a root node has no children, the root node is directly used as a list block.
[0046] After dividing the list content into multiple list blocks, it is also necessary to determine the hierarchical depth of each node within each list block. For example, as Figure 3 shown, Figure 3 FIG. shows a flowchart for determining the hierarchical depth of each node according to some embodiments of the present disclosure. This embodiment includes step S23 and step S24.
[0047] Step S23 is to mark the hierarchical depth for the root node in each of the multiple list blocks; and step S24 is to determine the hierarchical depth of each node according to the cascading relationship between each node and the corresponding root node within each list block.
[0048] For example, according to the grammar rules, if the hierarchical depth of the root node in a certain list block is identified as the second level, then the hierarchical depth of the child nodes of the root node is the third level, and so on, to determine the hierarchical depth of each node in each list block.
[0049] In this way, each node has a corresponding true hierarchical depth, so that when rendering subsequently, the format accuracy of the rendered reply content can be improved.
[0050] In the above embodiment, the hierarchical depth can be marked only for the root node, and the client determines the hierarchical depth of each node according to the cascading relationship between each node and the corresponding root node. Additionally, the corresponding hierarchical depth can also be marked for the nodes in each list block that have a cascading relationship with the root node. In this way, when the renderer renders, it directly identifies the hierarchical depth of each node to render the reply information, improving the rendering efficiency.
[0051] In the related art, rendering is directly performed according to the depth of each node in the abstract syntax tree corresponding to the list content. If the syntax structure of the list content is damaged, the abstract syntax tree is also incorrect, so there are problems with the rendered format. In this embodiment, the list is divided according to the root node in the list content to obtain multiple list blocks, and the hierarchical depth is re-assigned to each node within each list block, facilitating the display of the list spacing according to the original indentation rules during subsequent rendering.
[0052] Markdown is a lightweight markup language with concise typesetting syntax, allowing people to focus more on the content itself rather than the typesetting. Large model replies in Markdown syntax form are becoming increasingly common. Below, the specified syntax form takes the Markdown syntax form as an example, and the syntax rules corresponding to the Markdown syntax form are indentation rules, such as the 4-space indentation rule, in order to clearly display the hierarchical relationship between list items.
[0053] Parse the content in the reply information to obtain multiple content blocks, including: parse the list content based on the indentation rule to obtain multiple list blocks.
[0054] For example, the indentation rule in Markdown syntax is the four-space indentation rule. Use an indentation of four spaces to represent the nesting relationship of the list to show the hierarchical structure of the content.
[0055] Node 1 and Node 2 are two adjacent nodes. Node 1 is in the previous column of Node 2. The position of Node 2 is indented four spaces compared to the position of Node 1, and there is no parent node before Node 1 and no child node for Node 2. Then, Node 1 and Node 2 are divided into one list block. Another example, Node 3 and Node 4 are two adjacent nodes. Node 3 is in the previous column of Node 4. The position of Node 3 is indented four spaces or eight spaces compared to the position of Node 4, which indicates that Node 3 is neither the parent node nor the child node of Node 4, and Node 3 and Node 4 are located in different list blocks respectively.
[0056] After dividing the list into multiple lists, mark the hierarchical depth for the root node in each list block of the multiple list blocks, including: based on the indentation rule, identify the number of spaces before the root node; based on the range of the number of spaces corresponding to each hierarchical depth, determine the hierarchical depth corresponding to the number of spaces; and mark the corresponding hierarchical depth for the root node.
[0057] For example, for the root node in each list block, identify the number of spaces before the root node. If this list block conforms to the four-space indentation rule, the number of spaces before this root node should be a multiple of 4 or 0. However, when the reply information from the large model, this reply information does not strictly conform to the Markdown syntax specification. Then, according to the related technology, the specific hierarchical depth of this root node cannot be determined.
[0058] In this embodiment, each hierarchical depth corresponds to a range of the number of spaces. For example, the range of the number of spaces before the root node with the first hierarchical depth is from 0 to 3, the range of the number of spaces before the root node with the second hierarchical depth is from 4 to 7, the range of the number of spaces before the root node with the third hierarchical depth is from 8 to 11, and so on. Those skilled in the art should understand that the numerical values of the range of the number of spaces here are only for illustration and can also be set to other values according to the actual situation. Based on the range of the number of spaces corresponding to each hierarchical depth, the hierarchical depth of each root node can be determined, and then the corresponding hierarchical depth can be marked for this root node for subsequent syntax rendering.
[0059] In some embodiments, determining the hierarchical depth corresponding to the number of spaces includes: determining the hierarchical depth corresponding to the number of spaces according to the quotient of the number of spaces and the space indentation value corresponding to the indentation rule.
[0060] For example, the space indentation value corresponding to the four-space indentation rule is 4. If the number of spaces before a certain node is 2, the calculated quotient is 0, and the hierarchical depth of this node is 1; if the number of spaces before a certain node is 7, the calculated quotient is 1, and the hierarchical depth of this node is 2.
[0061] Next, Figure 4 a further introduction to the hierarchical depth will be given. Figure 4 FIG. shows a schematic diagram of the parent-child list indentation logic according to some embodiments of the present disclosure. Assume that the hierarchical depth corresponding to the list item numbered 41 is T-1. If this list item is indented to the right by one space, two spaces, and up to three spaces, its hierarchical depth is T-1; when this list item is indented to the right by four spaces, as shown by the label 42, its hierarchical depth is T. When this list item continues to be indented to the right, as shown by the label 43, its indentation is seven spaces, and its hierarchical depth is still T until its continuous indentation space number reaches eight, and its hierarchical depth is T+1, and so on. The rendered result is as Figure 4 shown on the right.
[0062] Based on the four-space indentation rule, the list content is divided into multiple list blocks, and each node in each list block is marked. Each node will record its true abstract syntax tree depth, that is, the hierarchical depth, for subsequent syntax rendering. Those skilled in the art should understand that the abstract syntax tree is only used for illustration here, and other methods such as tables and matrices can also be used to record the syntax structure.
[0063] In some embodiments, by modifying the ListBlockParser of commonmark-java, the purpose of accurately parsing and cutting the list based on the four-space indentation rule of Markdown syntax can be achieved. Those skilled in the art should understand that this is only for illustration here, and syntax parsing can be implemented based on different programming languages.
[0064] In the rendering stage, based on the hierarchical depth of each node, the indentation format of each node is determined; and based on the indentation format of each node, the reply information is rendered to obtain the rich text. Compared with plain text, rich text can contain more format information and interactive elements, making the text content more rich, diverse, vivid and intuitive, with better display effects and user experiences.
[0065] In the rendering stage, the list is still processed according to the four-space indentation rule. Based on the hierarchical depth markers saved in the syntax parsing stage, the format during rendering is determined. For example, the spacing of the list can be displayed according to the original indentation rule. Since the rendering is no longer affected by the depth of the abstract syntax tree, the rendering result is more accurate, which can improve the user's reading experience.
[0066] In some embodiments, by modifying the ListItemVisitor in the markwon-android renderer, list rendering based on the four-space indentation rule is achieved. Those skilled in the art should understand that this is only for example here. For different grammars and different operating systems, different list item access interfaces can be adopted. Therefore, the corresponding renderer can be improved according to the actual situation to implement list rendering.
[0067] In some embodiments, obtaining the reply information corresponding to the input information includes: obtaining multiple response information corresponding to the input information from multiple information sources; splicing the multiple response information to obtain the reply information.
[0068] The multiple response information and the multiple information sources can correspond one by one, and each response information can come from the search and confirmation of an agent. For example, the reply of the large model can be spliced by the replies of multiple agents. In this way, the content of the reply of the large model can be enriched, and valuable information can be better provided for users.
[0069] In some embodiments, rendering the reply information includes: rendering the reply information to obtain rich text, where the rich text includes multiple text blocks, and the text format of each text block in the multiple text blocks corresponds to the syntax structure of the corresponding response information.
[0070] For example, the multiple text blocks and the multiple response information correspond one by one. The rich text includes multiple text blocks. Through syntax parsing and syntax rendering, the text format of each text block is consistent with the syntax structure of the response information, that is, the original syntax structure of each response information is retained during rendering. Even if there are syntax errors in the spliced reply information, the content can still present the correct level and format, improving the display effect of the model reply.
[0071] The information processing method of the present disclosure will be introduced below in conjunction with specific embodiments. Taking a certain conversational large model product as an example, due to the operating mechanism of the large model, its responses are like being encapsulated in an opaque black box, so it is impossible to ensure that all response information strictly conforms to the Markdown syntax specification. In addition, since the responses of the large model are sometimes spliced from the responses of multiple agents, even if each response segment conforms to the syntax specification, the syntax structure of the response content obtained after splicing may be damaged. The following takes the syntax error of the list in the large model response as an example for introduction. In this embodiment, an HTML (HyperText Markup Language) data block is inserted into the Markdown information, resulting in the destruction of the original ordered list structure. This embodiment can effectively solve the syntax destruction problem in the splicing process.
[0072] Figure 5A Shows a schematic diagram of a normal list according to some embodiments of the present disclosure, Figure 5B Shows a schematic diagram of the abstract syntax tree corresponding to the normal list according to some embodiments of the present disclosure.
[0073] Figure 5A In it, the first-level heading 1, the second-level heading 1, the second-level heading 2, the third-level heading 1, the first-level heading 2, the second-level heading 3, the second-level heading 4, and the third-level heading 2 form a normal list. The second-level heading 1 and the second-level heading 2 are sub-items of the first-level heading 1, and the third-level heading 1 is a sub-item of the second-level heading 2. The second-level heading 3 and the second-level heading 4 are sub-items of the first-level heading 2, and the third-level heading 2 is a sub-item of the second-level heading 4.
[0074] The abstract syntax tree corresponding to this normal list is as Figure 5B shown. This abstract syntax tree shows the hierarchical relationship between the ordered list (Orderedlist) and the paragraph (Paragraph) in the document. Each list item contains a paragraph. The ordered list corresponding to the document contains two list items, namely, the first-level heading 1 and the first-level heading 2. That is, the first-level heading 1 and the first-level heading 2 are the root nodes of the abstract syntax tree. The ordered list under the first-level heading 1 contains two list items, namely, the second-level heading 1 and the second-level heading 2. That is, the second-level heading 1 and the second-level heading 2 are the sub-nodes of the first-level heading 1. The ordered list under the first-level heading 2 contains two list items, namely, the second-level heading 3 and the second-level heading 4. That is, the second-level heading 3 and the second-level heading 4 are the sub-nodes of the first-level heading 2. The ordered list under the second-level heading 2 contains one list item, namely, the third-level heading 1. That is, the third-level heading 1 is the sub-node of the second-level heading 2. The ordered list under the second-level heading 4 contains one list item, namely, the third-level heading 2. That is, the third-level heading 2 is the sub-node of the second-level heading 4.
[0075] Figure 6A Shows a schematic diagram of inserting an HTML data block into the normal list according to some embodiments of the present disclosure,Figure 6B Shows a schematic diagram of an abstract syntax tree corresponding to inserting an HTML data block into a normal list according to some embodiments of the present disclosure.
[0076] Figure 6A Among them, on the basis of Figure 5A , between the second-level heading 1 and the second-level heading 2, an HTML data block " <data-block>< / data-block> " is inserted. The abstract syntax tree corresponding to the list shown in Figure 6A is as shown in Figure 6B . Compared with Figure 5B , this abstract syntax tree contains HTML tags. Moreover, the second-level heading 2 and the first-level heading 2 correspond to an ordered list. The second-level heading 2 serves as the root node, and its depth is the same as that of the first-level heading 2. Obviously, Figure 6B the abstract syntax tree shown destroys the original ordered list structure.
[0077] To solve the problem that the ordered list structure is destroyed, this embodiment parses and cuts the syntax tree based on the four-space indentation rule of the list.
[0078] Figure 7 Shows a schematic diagram of an abstract syntax tree corresponding to the repaired insertion of an HTML data block into a normal list according to some embodiments of the present disclosure.
[0079] As shown in Figure 7 , the list is divided into list blocks. The first-level heading 1 and the second-level heading 1 belong to one list block, the second-level heading 2 and the third-level heading 1 belong to one list block, and the first-level heading 2, the second-level heading 3, the second-level heading 4, and the third-level heading 2 belong to one list block. Then, based on the four-space indentation rule, the hierarchical depth is assigned to the root node. For example, the hierarchical depth of the second-level heading 2 is level 2.
[0080] Through the above operations, each node will record its true syntax tree depth for subsequent syntax rendering.
[0081] For example, if what the user asks about are scenic spots in the Tibet Autonomous Region, then "Snow Mountains", "Lakes", "Potala Palace", and "Yanghu Lake" etc. are sub-items of "Tibet Autonomous Region". Since local life is inserted between "Snow Mountains" and "Lakes", for example, a table including scenic spot names and feature descriptions, during the rendering stage, the formats of "Lakes", "Potala Palace", and "Yanghu Lake" are incorrect. As shown in Figure 8A , Figure 8A Shows a rendering schematic diagram after inserting an HTML data block into a normal list according to some embodiments of the present disclosure. "Snow Mountains" is indented four spaces compared to "Tibet Autonomous Region", but "Lakes", "Potala Palace", and "Yanghu Lake" are not indented, which affects the user reading experience.
[0082] Through the solution of the present disclosure, the indentation during rendering is determined according to the depth information marked by each node in the parsing stage, so that the original syntax structure can be retained during rendering. As shown in FIG. 8, Figure 8B FIG. Figure 8B shows a rendering schematic diagram after syntax repair after inserting an HTML data block into a normal list according to some embodiments of the present disclosure. "Snow mountains", "lakes", "Potala Palace" and "Yanghu Lake" are indented by four spaces compared to "Tibet Autonomous Region". That is to say, for the Markdown reply generated by the large model, especially the reply content spliced by multiple agents, even if the syntax structure of the splicing is incorrect, this embodiment can correctly parse and render the list content. For example, the spacing of the list can be displayed according to the original indentation rule, and the list content presents the correct hierarchy and format, improving the display effect of the large model reply.
[0083] The above is the information processing method provided by the embodiments of the present disclosure. The following refers to Figures 9 - 11 Describe an information processing device according to an embodiment of the present disclosure, which is used to execute any one of the above information processing methods.
[0084] Figure 9 FIG. Figure 9 shows a block diagram of an information processing device according to some embodiments of the present disclosure.
[0085] As Figure 9 shown, the information processing device 9 includes an acquisition module 91, a parsing module 92, and a rendering module 93.
[0086] The acquisition module 91 is configured to acquire reply information corresponding to the input information in response to the input information of the user, and the reply information includes information in a specified syntax form; the parsing module 92 is configured to parse the content in the reply information based on the syntax rules corresponding to the specified syntax form to obtain a plurality of content blocks, and determine the hierarchical depth of each node in each content block of the plurality of content blocks; and the rendering module 93 is configured to render the reply information based on the hierarchical depth of each node.
[0087] In some embodiments, the content of the reply information includes list content, the plurality of content blocks include a plurality of list blocks, and the parsing module 92 is configured to identify a plurality of root nodes in the list content; and obtain the plurality of list blocks based on the plurality of root nodes.
[0088] In some embodiments, the parsing module 92 is further configured to mark the hierarchical depth for the root nodes in each of the plurality of list blocks; and determine the hierarchical depth of each node according to the cascading relationship between each node in each list block and the corresponding root node.
[0089] In some embodiments, the parsing module 92 is further configured to use, for any one of the plurality of root nodes, the root node and the nodes having a cascading relationship with the root node as a list block.
[0090] In some embodiments, the parsing module 92 is further configured to use, for any one of the plurality of root nodes, the root node as one of the list blocks in response to the root node having no nodes having a cascading relationship with the root node.
[0091] In some embodiments, the specified syntax form includes the Markdown syntax form, and the syntax rules include indentation rules. The parsing module 92 is further configured to parse the list content based on the indentation rules to obtain a plurality of list blocks.
[0092] In some embodiments, the specified syntax form includes the Markdown syntax form, and the syntax rules include indentation rules. The parsing module 92 is further configured to identify the number of spaces before the root node based on the indentation rules; determine the hierarchical depth corresponding to the number of spaces based on the range of the number of spaces corresponding to each hierarchical depth; and mark the corresponding hierarchical depth for the root node.
[0093] In some embodiments, the parsing module 92 is further configured to determine the hierarchical depth corresponding to the number of spaces based on the quotient of the number of spaces and the space indentation value corresponding to the indentation rules.
[0094] In some embodiments, the obtaining module 910 is further configured to obtain a plurality of response messages corresponding to the input message from a plurality of information sources; splice the plurality of response messages to obtain the reply message.
[0095] In some embodiments, the rendering module 93 is further configured to render the reply message to obtain rich text, where the rich text includes a plurality of text blocks, and the text format of each text block in the plurality of text blocks corresponds to the syntax structure of the corresponding response message.
[0096] In some embodiments, the rendering module 93 is further configured to determine the indentation format of each node based on the hierarchical depth of each node; and render the reply message based on the indentation format of each node to obtain the rich text.
[0097] In some embodiments, the parsing module 92 is further configured to mark the corresponding hierarchical depth for the nodes having a cascading relationship with the root node in each list block.
[0098] In the above embodiments, even when the grammar is damaged, the list content can still be correctly parsed and rendered, thereby improving the display effect of the large model's response and enhancing the user's reading experience.
[0099] It should be noted that the above-mentioned individual units are only logical modules divided according to their specific functions implemented, rather than used to limit the specific implementation methods. For example, they can be implemented in software, hardware, or a combination of software and hardware. In actual implementation, the above-mentioned individual units can be implemented as independent physical entities, or can also be implemented by a single entity (for example, a processor (CPU or DSP, etc.), an integrated circuit, etc.). In addition, the above-mentioned individual units are shown by dashed lines in the drawings to indicate that these units may not actually exist, and the operations / functions they implement can be realized by the processing circuit itself.
[0100] Figure 10 A block diagram of an information processing apparatus according to some other embodiments of the present disclosure is shown.
[0101] As Figure 10 shown, the information processing apparatus 10 includes a processor 101; and a memory 102 coupled to the processor 101 for storing instructions, which when executed by the processor 101, cause the processor 101 to execute the information processing method of any of the above embodiments.
[0102] The memory 101 is used to store one or more computer-readable instructions. The memory 101 can include any combination of various forms of computer-readable storage media, such as volatile memory and / or non-volatile memory, including but not limited to random access memory (RAM), dynamic random access memory (DRAM), static random access memory (SRAM), read-only memory (ROM), flash memory. The memory 101 can store, for example, an operating system, application programs, a boot loader (BootLoader), a database, and other programs, and can also store various application programs and various data, etc.
[0103] The processor 102 is used to run computer-readable instructions to implement the information processing method described in any of the foregoing embodiments or the method described in any of the foregoing embodiments. The specific implementation of each step of the method can be referred to the above embodiments, and the repeated parts will not be elaborated here.
[0104] The processor 102 may be configured to execute the steps of the above embodiments. The processor 102 may be embodied as various processing devices, such as a central processing unit (CPU), a network processor (NP), etc.; it may also be a digital signal processor (DSP), an application specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components. The central processing unit (CPU) may be of the X86 or ARM architecture, etc.
[0105] The processor 102 and the memory 101 may communicate with each other directly or indirectly. For example, the processor 102 and the memory 101 may communicate through a network. The network may include a wireless network, a wired network, and / or any combination of a wireless network and a wired network. The processor 102 and the memory 101 may also communicate with each other through a system bus, and the present disclosure does not limit this.
[0106] It should be noted that Figure 10 The components of the information processing device 10 shown are exemplary and not restrictive. According to actual application needs, the information processing device 10 may also have other components. The processor 102 may control other components in the information processing device to perform desired functions.
[0107] In the above embodiments, by storing data instructions in the memory and then processing the above instructions by the processor, the accuracy of parsing and rendering can be improved. Even when there are grammar errors in the reply content of the large model, the reply content can still present the correct hierarchy and format.
[0108] The information processing device 10 may be implemented in software, firmware, and / or hardware, and may be integrated in an electronic device installed with relevant application programs.
[0109] Figure 11 A block diagram of an electronic device according to some other embodiments of the present disclosure is shown.
[0110] Figure 11 The shown electronic device 11 may be a computer system with a dedicated hardware structure, and when installed with relevant application programs, it can perform corresponding functions.
[0111] The electronic device includes, but is not limited to, mobile terminals such as smart phones, laptop computers, personal digital assistants (PDAs), tablet personal computers (Tablet PCs), portable multimedia players (PMPs), vehicle terminals (such as vehicle navigation terminals), wearable devices, etc., and fixed terminals such as digital TVs, desktop computers, etc.
[0112] As Figure 11 shown, the central processing unit (CPU) 111 executes various processes according to a program stored in the read-only memory (ROM) 112 or a program loaded from the storage section 118 into the random access memory (RAM) 113. In the RAM 113, data required when the CPU 111 executes various processes and the like is stored as needed. The central processing unit is merely exemplary and may also be other types of processors, such as the various processors described above. The ROM 112, RAM 113, and storage section 118 may be various forms of computer-readable storage media. It should be noted that although Figure 11 the ROM 112, RAM 113, and storage section 118 are shown separately, one or more of them may be combined or located in the same or different memories or storage modules.
[0113] The CPU 111, ROM 112, and RAM 113 are connected to each other via a bus 114. The input / output interface 115 is also connected to the bus 114.
[0114] The following components are connected to the input / output interface 115: an input section 116, such as a touch screen, touch pad, keyboard, mouse, image sensor, microphone, accelerometer, gyroscope, etc.; an output section 117, including a display, such as a cathode ray tube (CRT), liquid crystal display (LCD), speaker, vibrator, etc.; a storage section 118, including a hard disk, magnetic tape, etc.; and a communication section 119, including a network interface card such as a LAN card, modem, etc. The communication section 119 allows communication processing to be performed via a network such as the Internet. It is easily understood that although Figure 11 the parts in the electronic device 11 are shown to communicate via the bus 114, they may also communicate via a network or other means, where the network may include a wireless network, a wired network, and / or any combination of a wireless network and a wired network.
[0115] As needed, a drive 1110 is also connected to the input / output interface 115. A removable medium 1111, such as a magnetic disk, optical disk, magneto-optical disk, semiconductor memory, etc., is mounted on the drive 1110 as needed, so that a computer program read therefrom is installed in the storage section 118 as needed.
[0116] In the case where the above series of processes are implemented by software, a program constituting the software can be installed from a network such as the Internet or a storage medium such as the removable medium 1111.
[0117] According to an aspect of the present disclosure, there is provided a computer-readable storage medium having a computer program stored thereon, wherein the program, when executed by a processor, implements the above-described information processing method.
[0118] The computer-readable storage medium can enhance the display effect of model responses.
[0119] According to one aspect of the present disclosure, there is provided a computer program product, including: a computer program or instructions, which when executed by a processor, implement the above information processing method.
[0120] The computer program product can improve the accuracy of parsing and rendering. Even when there are grammar errors in the response content of the large model, the response content can still present the correct hierarchy and format.
[0121] According to an embodiment of the present disclosure, the process described above with reference to the flowchart can be implemented as a computer software program. For example, some embodiments of the present disclosure include a computer program product, which when running on a computer, causes the computer to implement the method described in any of the foregoing embodiments. The computer program product includes computer instructions carried on a computer-readable medium, including program codes for executing the method shown in the flowchart. In such an embodiment, the computer instructions can be downloaded and installed from the network through the communication part 119, or installed from the storage part 118, or installed from the ROM 112. When the computer program is executed by the CPU 111, the method of the embodiment of the present disclosure is executed.
[0122] It should be noted that in the context of the present disclosure, a computer-readable medium can be a tangible medium that can contain or store a program for use by or in connection with an instruction execution system, apparatus, or device.
[0123] A computer-readable medium can be a computer-readable storage medium, or a computer-readable signal medium, or any combination of the two.
[0124] Computer-readable storage media include, but are not limited to: electrical, magnetic, optical, electromagnetic, infrared, or semiconductor systems, devices, or components, or any combination of the above. More specific examples of computer-readable storage media can include, but are not limited to: electrical connections with 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 above. In the present disclosure, a computer-readable storage medium can be any tangible medium that contains or stores a program that can be used by or in connection with an instruction execution system, apparatus, or device. Computer instructions are stored on the computer-readable storage medium, and when executed by a processor, implement the method described in any of the foregoing embodiments.
[0125] A computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, carrying computer-readable program code. Such a propagated data signal may take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the foregoing. The computer-readable signal medium may 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 may be transmitted using any appropriate medium, including but not limited to wires, optical cables, RF (radio frequency), etc., or any suitable combination of the foregoing.
[0126] The foregoing computer-readable medium may be included in the above-mentioned electronic device; or may exist separately without being assembled into the electronic device.
[0127] In some embodiments, a computer program is also provided, including: instructions that, when executed by a processor, cause the processor to execute the method described in any of the foregoing embodiments. For example, the instructions may be embodied as computer program code.
[0128] In the embodiments of the present disclosure, computer program code for performing the operations of the present disclosure may be written in one or more programming languages or combinations thereof. The foregoing programming languages include but are not limited to object-oriented programming languages such as Java, Smalltalk, C++, and also include conventional procedural programming languages such as the "C" language or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, executed as a stand-alone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., by using an Internet service provider to connect through the Internet).
[0129] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of the present disclosure. In this regard, each block in the flowchart or block diagram may represent a module, a segment of a program, or a portion of code that contains one or more executable instructions for implementing a specified logical function. It should also be noted that, in some alternative implementations, the functions noted in the blocks may occur in an order different from that noted in the accompanying drawings. For example, two consecutive blocks shown may actually be executed substantially in parallel, or they may sometimes be executed in the 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 by a dedicated hardware-based system that performs the specified functions or operations, or by a combination of dedicated hardware and computer instructions.
[0130] The functions described above can be performed, at least in part, by one or more hardware logic components. By way of example, and without limitation, exemplary hardware logic components that may be used include: field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on a chip (SOCs), complex programmable logic devices (CPLDs), and the like.
[0131] Although some specific embodiments of the present disclosure have been described in detail by way of example, those skilled in the art should understand that the above examples are for illustrative purposes only and are not intended to limit the scope of the present disclosure. Those skilled in the art should understand that the above embodiments may be modified without departing from the scope and spirit of the present disclosure. The scope of the present disclosure is defined by the appended claims.
Claims
1. An information processing method, comprising: In response to user input information, obtaining reply information corresponding to the input information, the reply information including information in a specified grammatical form; Parsing the content in the reply information based on the grammatical rules corresponding to the specified grammatical form to obtain multiple content blocks, and determining the hierarchical depth of each node in each content block in the multiple content blocks; as well as The reply information is rendered based on the hierarchical depth of each node.
2. The information processing method according to claim 1, wherein: The content of the reply information includes list content, the multiple content blocks include multiple list blocks, and the multiple content blocks obtained by parsing the content in the reply information include: identifying a plurality of root nodes in the list content; and Based on the multiple root nodes, the multiple list blocks are obtained.
3. The information processing method according to claim 2, wherein: Determining the hierarchical depth of each node in each content block of the plurality of content blocks comprises: marking a hierarchical depth for a root node in each list block of the plurality of list blocks; and The hierarchical depth of each node is determined according to the cascade relationship between each node in each list block and the corresponding root node.
4. The information processing method according to claim 2, wherein: The obtaining the plurality of list blocks based on the plurality of root nodes comprises: For any one of the multiple root nodes, the root node and nodes in cascade relationship with the root node are taken as a list block; For any one of the multiple root nodes, in response to the fact that the root node has no node having a cascade relationship with the root node, the root node is used as a list block.
5. The information processing method according to claim 2, wherein: The specified grammatical form includes a Markdown grammatical form, the grammatical rule includes an indentation rule, and the content in the reply information is parsed to obtain multiple content blocks including: Based on the indentation rule, the list content is parsed to obtain multiple list blocks.
6. The information processing method according to claim 3, wherein: The specified grammatical form includes a Markdown grammatical form, the grammatical rule includes an indentation rule, the root node in each list block of the plurality of list blocks, and the markup level depth includes: Based on the indentation rule, identifying the number of spaces before the root node; Based on the range of the number of spaces corresponding to each level depth, determining the level depth corresponding to the number of spaces; and The root node is marked with a corresponding level depth.
7. The information processing method according to claim 6, wherein: The determining, based on the range of the number of spaces corresponding to each level depth, of the level depth corresponding to the number of spaces comprises: The level depth corresponding to the number of spaces is determined according to a quotient of the number of spaces and the space indentation value corresponding to the indentation rule.
8. The information processing method according to any one of claims 1 to 7, wherein: Acquiring reply information corresponding to the input information includes: Acquire a plurality of response information corresponding to the input information from a plurality of information sources; and The multiple response messages are concatenated to obtain the reply message.
9. The information processing method according to claim 8, wherein: Rendering the reply information includes: The reply information is rendered to obtain rich text, where the rich text includes a plurality of text blocks, and a text format of each text block in the plurality of text blocks corresponds to a grammatical structure of the corresponding response information.
10. The information processing method according to claim 9, wherein: The rendering of the reply information to obtain rich text includes: Determining an indentation format of each node based on the hierarchical depth of each node; and Based on the indentation format of each node, the reply information is rendered to obtain the rich text.
11. The information processing method according to any one of claims 3, 6 and 7, further comprising: For the nodes in each list block that have a cascade relationship with the root node, the corresponding level depth is marked.
12. An information processing device, comprising: an acquisition module, configured to acquire reply information corresponding to the input information in response to the user's input information, wherein the reply information includes information in a specified grammatical form; A parsing module configured to parse the content in the reply information based on a grammatical rule corresponding to the specified grammatical form to obtain a plurality of content blocks, and determine a hierarchical depth of each node in each of the plurality of content blocks; as well as The rendering module is configured to render the reply information based on the hierarchical depth of each node.
13. An information processing device, comprising: processor; as well as A memory coupled to the processor, for storing instructions, wherein when the instructions are executed by the processor, the processor executes the information processing method according to any one of claims 1 to 11.
14. A computer-readable storage medium having a computer program stored thereon, wherein: When the program is executed by a processor, the information processing method according to any one of claims 1 to 11 is implemented.
15. A computer program product comprising: The method comprises a computer program or an instruction, which, when executed by a processor, implements the information processing method according to any one of claims 1 to 11.