Document generation method and apparatus, device, and storage medium
By generating and extracting key elements from speech data and using a large language model to automatically generate manuscripts, the problem of low manuscript writing efficiency in the past has been solved, and efficient manuscript generation has been achieved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- IFLYTEK CO LTD
- Filing Date
- 2023-04-28
- Publication Date
- 2026-08-04
AI Technical Summary
The current method of writing documents is inefficient and consumes a lot of the writer's energy, especially in important occasions.
The system generates recognized text based on user voice data, extracts key elements through a neural network model, and uses a large language model to generate the target text.
It shortens the time to obtain documents, improves users' work efficiency, and realizes automated document generation.
Smart Images

Figure CN116741178B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of computer data processing technology, and in particular to a document generation method, apparatus, device, and storage medium. Background Technology
[0002] Written documents are one of the main ways people obtain and convey information today. For example, in daily work, presenters often need to prepare written reports to deliver to their recipients so that the recipients can understand the content of the report or the presenter's work. Similarly, new media workers need to write press releases or marketing copy for publication on websites.
[0003] However, drafting documents typically requires a significant amount of effort from the writer, especially for important occasions such as reports and speeches. For example, the writer first creates an outline, then continuously enriches the content based on the outline, and finally edits it into a complete document. Therefore, the current method is inefficient. Summary of the Invention
[0004] The main technical problem addressed by this application is to provide a document generation method, apparatus, device, and storage medium that can shorten the time for users to obtain documents and improve user work efficiency.
[0005] To address the aforementioned technical problems, the first aspect of this application provides a document generation method, comprising: obtaining corresponding recognized text based on user speech data regarding a desired output document; analyzing the recognized text to obtain key elements of the desired output document; wherein the key elements include at least one semantic-level sub-element; and generating a first target document based on the key elements.
[0006] To address the aforementioned technical problems, a second aspect of this application provides a document generation apparatus, comprising: a recognition module for obtaining corresponding recognized text based on user speech data regarding a desired output document; an analysis module for analyzing the recognized text to obtain key elements of the desired output document; wherein the key elements include at least one semantic-level sub-element; and a generation module for generating a first target document based on the key elements.
[0007] To address the aforementioned technical problems, a third aspect of this application provides an electronic device including a memory and a processor coupled to each other, wherein the memory stores program instructions and the processor executes the program instructions to implement the document generation method of the first aspect described above.
[0008] To address the aforementioned technical problems, a fourth aspect of this application provides a computer-readable storage medium storing program instructions executable by a processor, the program instructions being used to implement the document generation method of the first aspect described above.
[0009] The above solution, based on the user's voice data regarding the desired output text, obtains the corresponding recognized text; analyzes the recognized text to identify the key elements of the desired output text; and generates a first target text based on these key elements. This method requires only the user's voice data regarding the desired output text to automatically analyze and generate the first target text. Compared to user editing, this reduces the time users spend obtaining text and improves their work efficiency.
[0010] It should be understood that the above general description and the following detailed description are exemplary and explanatory only, and are not intended to limit this application. Attached Figure Description
[0011] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with this application and, together with the specification, serve to explain the technical solutions of this application.
[0012] Figure 1 This is a flowchart illustrating an embodiment of the document generation method provided in this application;
[0013] Figure 2 This is a flowchart illustrating another embodiment of the document generation method provided in this application;
[0014] Figure 3 This is a schematic diagram of the interactive interface provided in this application for document generation;
[0015] Figure 4 This is a flowchart illustrating an embodiment of the sorting method for key elements provided in this application;
[0016] Figure 5 This is a schematic flowchart of an embodiment of the document generation apparatus provided in this application;
[0017] Figure 6 This is a schematic diagram of the framework of an embodiment of the electronic device provided in this application;
[0018] Figure 7 This is a schematic diagram of a framework of an embodiment of the computer-readable storage medium provided in this application. Detailed Implementation
[0019] The embodiments of this application will now be described in detail with reference to the accompanying drawings.
[0020] In the following description, specific details such as particular system architectures, interfaces, and technologies are presented for illustrative purposes rather than for limiting purposes, in order to provide a thorough understanding of this application.
[0021] In this document, the term "and / or" is merely a description of the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A alone, A and B simultaneously, or B alone. Additionally, the term "more" in this document means two or more. Furthermore, the term "at least one" in this document means any combination of at least two of any one or more of a plurality of objects. For example, including at least one of A, B, and C can mean including any one or more elements selected from the set consisting of A, B, and C. "Several" means at least one. The terms "first," "second," etc., in the specification, claims, and accompanying drawings are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence.
[0022] Please see Figure 1 , Figure 1 This is a flowchart illustrating an embodiment of the document generation method provided in this application. This method can be executed by a terminal device; exemplarily, the terminal device can be a computer, mobile phone, tablet, etc., and this embodiment does not specifically limit it. It should be noted that if substantially the same result is achieved, the method of this invention is not necessarily identical. Figure 1 The illustrated process sequence is limited. For example... Figure 1 As shown, the method includes the following steps:
[0023] S11: Based on the user's voice data regarding the desired output text, obtain the corresponding recognized text.
[0024] In this embodiment, the user's desired output document type can be work report, business document, new media document, personal speech, or hosting script, etc. Work reports can include personal or organizational work reports, primarily used to summarize relevant matters in the user's or organization's work. Business documents can include business letters, business contracts, business plans, market research reports, sales proposals, business briefings, business speeches, business articles, and business blogs, etc. For example, business letters can include business invitations, business promotion letters, business thank-you letters, and business apology letters, etc. Business contracts are used to clarify the rights and obligations between the two parties in a business partnership. Business plans are used to explain the project's business model, market prospects, funding requirements, etc., to introduce new business ideas or projects to investors or financial institutions. Market research reports are used to explain the market situation and competitive environment, providing a basis for corporate decision-making. Sales proposals are used to introduce products or services to potential customers, explaining their advantages and features to promote sales. Business briefings are used to report work progress, results, problems, and plans to superiors or subordinates. Business presentations are used for speeches at business meetings, business launches, and business events. Business articles are mainly published in business media or platforms to build a brand image or establish a professional image for a company. Business blogs mainly contain information or insights related to business management and are usually published by individuals or companies on social media or websites. New media articles can be press releases, WeChat official account promotional materials, etc. It should be noted that the types of expected output documents mentioned above are only illustrative examples. In other embodiments, the expected output documents may include other document types, which are not specifically limited in this embodiment.
[0025] The user's voice data regarding the desired output document can be a voice description file recorded during the user's brief description of the desired output document. In one example, the terminal device pre-stores the user's voice data regarding the desired output document, and the terminal device can directly retrieve the user's voice data regarding the desired output document from the storage unit. In another example, the terminal device is equipped with recording software, and the user's voice data regarding the desired output document can be directly recorded through the recording software.
[0026] In this embodiment, the user's voice data regarding the desired output text can be recognized and converted into text to obtain the recognized text corresponding to the voice data.
[0027] S12: Analyze the identified text to obtain the key elements of the desired output document.
[0028] In this embodiment, a neural network model can be used to extract keywords or semantics from the recognized text corresponding to the user's voice data to obtain the key elements of the user's desired output text. The key elements include at least one semantic-level sub-element. Each semantic level corresponds to at least one sub-element.
[0029] In one implementation scenario, key elements include the user's target intent regarding the desired output document, several target topics related to the target intent, and several target focuses contained within each target topic. The semantic level of the target intent is higher than that of the target topics, and the semantic level of the target topics is higher than that of the target focuses. Generally, during user interaction with the terminal device, one desired output document is obtained at a time. Therefore, there is usually only one target intent; that is, the key elements at the intent level only include the target intent... Figure 1 Each target intent may involve at least one target topic; that is, key elements at the topic level may include at least one sub-element. Each target topic may involve at least one target focus; that is, key elements at the focus level may include at least one sub-element.
[0030] For example, if a user's desired output document is a work report about Department A, then the target intent is to report on the work content of Department A. Several target themes could include the composition of Department A's personnel, the department's work summary for this year, and the department's work outlook for next year. Furthermore, the composition of Department A's personnel could include current staff distribution, new hires this year, and departing employees this year, among other key objectives. In this example, the intent-level sub-elements include reporting on the work content of Department A, while the theme-level sub-elements include the composition of Department A's personnel, the department's work summary for this year, and the department's work outlook for next year. When the target theme is the composition of Department A's personnel, it includes several key-level sub-elements such as current staff distribution, new hires this year, and departing employees this year.
[0031] For example, if a user expects a meeting chairperson's script, then the target intent is to chair the meeting. Several target themes could include announcing the start of the meeting, introducing participants, introducing the meeting background, introducing the meeting content, and summarizing the meeting. Further, introducing participants could include the composition of the attendees and the number of attendees, among other key points. Introducing the meeting content could include the meeting background, meeting tasks, and meeting arrangements, among other key points. In this example, the intent-level sub-elements include chairing the meeting content, while the theme-level sub-elements include announcing the start of the meeting, introducing participants, introducing the meeting background, introducing the meeting content, and summarizing the meeting. When the target theme is introducing participants, it includes several key-level sub-elements such as the composition of the attendees and the number of attendees; when the target theme is introducing the meeting content, it includes several key-level sub-elements such as the meeting background, meeting tasks, and meeting arrangements, among other key-level sub-elements.
[0032] It should be noted that this embodiment only uses three key elements at different semantic levels—target intent, several target topics involved in the target intent, and several target focuses contained in the target topics—as examples for illustration. In other embodiments, the key elements can be divided according to actual needs.
[0033] S13: Generate the first target document based on key elements.
[0034] In one implementation, a large language model (LLM) can be used to generate the first target text. A large language model refers to a computer model capable of processing and generating natural language. Exemplarily, a large language model may include, but is not limited to, pre-trained language models such as the GPT (Generative Pre-trained Transformer) series (e.g., ChatGPT) and MOSS (Multilingual Open-Source Synthesizer). A large language model can trigger language dialogue capabilities by inputting relevant instructions or prompts.
[0035] Specifically, in this embodiment, instruction text can be generated based on the key elements obtained from the analysis and input into the large language model. The instruction text is used to instruct the large language model to generate the first target document.
[0036] In another implementation, sub-texts corresponding to each key element of the output document that the user expects can be generated first. For example, sub-texts corresponding to each key element can be generated through the aforementioned large language model or other semantic model. Then, the sub-texts corresponding to each key element can be merged to obtain the first target document.
[0037] Furthermore, in this embodiment, after generating the first target document, the first target document is output as the user's desired output document.
[0038] In this embodiment, based on the user's voice data regarding the desired output text, the corresponding recognized text is obtained; based on the recognized text, the key elements of the desired output text are obtained; based on the key elements, a first target text is generated. This method automatically analyzes and generates a first target text by only providing the user's voice data regarding the desired output text. Compared to user editing, this shortens the time users spend obtaining text and improves user work efficiency.
[0039] Please see Figure 2 , Figure 2 This is a flowchart illustrating another embodiment of the document generation method provided in this application, which can be executed by the aforementioned terminal device. Figure 2As shown, the method includes the following steps:
[0040] S21: Based on the user's voice data regarding the desired output text, obtain the corresponding recognized text.
[0041] S22: Analyze the identified text to obtain the key elements of the desired output document.
[0042] Key elements include at least one semantic-level sub-elements. Specifically, in this embodiment, key elements may include the target intent of the desired output document, several target topics involved in the target intent, and several target focuses contained in the target topics.
[0043] The relevant content of steps S21 and S22 can be referred to the aforementioned steps S11 and S12 respectively, and detailed descriptions are omitted here.
[0044] S23: Based on key elements, generate initial prompt text to instruct the large language model to generate the text.
[0045] The following example illustrates how a user's desired output document can be a work report. Based on the key elements obtained from the identified text analysis, the target intent is to report on the work content of Department A, involving target themes including the composition of Department A's personnel, the annual work summary of Department A, and the work outlook for Department A in the next year. Specifically, the target themes related to the composition of Department A's personnel include the current personnel distribution, new employees hired this year, and employees who left this year. The target focus of the annual work summary of Department A includes the specific work content of Department A this year, and the target focus of the work outlook for Department A in the next year includes the specific work plan for Department A in the next year. Therefore, the generated first prompt text may include: Generate a work report document for Department A; the document includes the following themes: the composition of Department A's personnel, the annual work summary of Department A, and the work outlook for Department A in the next year; the theme of the composition of Department A's personnel includes the following key points: the current personnel distribution, new employees hired this year, and employees who left this year; the theme of the annual work summary of Department A includes the following key points: the specific work content of Department A this year; and the theme of the work outlook for Department A in the next year includes the following key points: the specific work plan for Department A in the next year.
[0046] S24: Input the first prompt text into the large language model to obtain the first target text output by the large language model.
[0047] Specifically, after the first prompt text is input into the large language model, the large language model can automatically generate a first target document corresponding to the first prompt text. The relevant content of the large language model can be found in step S13 above, and will not be repeated here.
[0048] In this embodiment, since the large language model has powerful knowledge capabilities, learning capabilities, and logical reasoning capabilities, the generation of the first target document using the large language model in steps S23 and S24 can quickly and accurately generate the first target document expected by the user.
[0049] Optionally, in this embodiment, steps S23 and S24 can be replaced by: generating sub-texts corresponding to each key element, and concatenating the sub-texts corresponding to each key element to obtain the first target document. For example, generating sub-texts corresponding to each target topic, and concatenating the sub-texts corresponding to each target topic to obtain the first target document. The sub-texts corresponding to each target topic may include specific content related to several key points of each target topic.
[0050] Optionally, in this embodiment, the user can interact with the large language model through an interactive interface. For example, the user can perform editing operations such as selecting key elements, deleting key elements, modifying key elements, and reordering key elements through the interactive interface to obtain the edited target elements. Then, based on the user's edited target elements, prompt text is generated and input into the large language model, which can make the first target document generated by the large language model more in line with the user's needs and expectations.
[0051] To achieve the above objectives, after executing step S22, the key elements of the desired output document can be displayed. Specifically, the key elements of the user's desired output document obtained from the analysis can be displayed on the interactive interface. To facilitate editing of the displayed key elements, each key element is in an editable state. In one example, the key elements of the user's desired output document are displayed in the form of a tree diagram. Specifically, the target intent can be used as the root node, the several target topics involved in the target intent can be used as the child nodes corresponding to the target intent, and for each target topic, the several target focuses involved in each target topic can be used as the child nodes corresponding to each target topic.
[0052] In one example, a user can select key elements on the interactive interface according to their actual needs. Specifically, in response to the selection of a key element, the selected key element is set as the target element.
[0053] In one example, users can delete unnecessary or unimportant key elements on the interactive interface according to their actual needs. Specifically, in response to the deletion operation of key elements, the remaining key elements after deletion are used as target elements.
[0054] In another example, users can modify incorrect or inappropriate key elements on the interactive interface according to their actual needs. Specifically, in response to the modification operation of the key element, the modified key element is used as the target element.
[0055] In another example, users can adjust the order of key elements on the interface according to their actual needs. For instance, in a work report scenario, users can drag and slide to adjust the order of the two target topics: Department A's annual work summary and Department A's next year's work plan. This ensures that in the final generated first target document, Department A's annual work summary appears before Department A's next year's work plan. Specifically, in response to the sorting operation of key elements, the sorted key elements are used as the target elements.
[0056] Furthermore, once the target elements edited by the user are determined, steps S23 and S24 can be replaced with: generating a first target document based on the target elements. Specifically, based on the target elements, a third prompt text is generated to instruct the large language model to generate the document; the third prompt text is input into the large language model to obtain the first target document output by the large language model. The third prompt text and the related content of obtaining the first target document based on the third prompt text can refer to the aforementioned steps S23 and S24, and will not be repeated here.
[0057] Furthermore, the interactive interface can also display a confirmation prompt button and a send button. After the user finishes editing the key elements on the interactive interface, they can click the confirmation prompt button to confirm the editing is complete, and click the send button to send the generated third-party prompt text to the large language model. Correspondingly, clicking the confirmation prompt button and the send button triggers a prompt text generation instruction. Upon receiving the prompt text generation instruction, a third-party prompt text is generated based on the target elements and input into the large language model.
[0058] Furthermore, a third prompt text can be displayed on the interactive interface. After the user finishes editing the key elements displayed on the interface, the specific content of the displayed third prompt text will change accordingly. Based on the displayed third prompt text, the user can determine whether the edited target key elements are appropriate and decide whether further editing is needed, thereby ensuring that the generated initial target document better meets the user's expectations or needs.
[0059] Please see Figure 3 , Figure 3 This is a schematic diagram of the interactive interface provided in this application for document generation. Figure 3 The following example uses the interactive interface corresponding to ChatGPT. It should be noted that in practical applications, it is not limited to ChatGPT as a single large language model; therefore, no specific limitation is made here. Figure 3As shown, the interactive interface displays input box 1 and a send button 2 inside input box 1. Input box 1 displays a third prompt text generated based on the user-edited target elements. Text box I can be used to display the first target text generated by the large language model. Text box II can be used to display the key elements of the expected output text obtained from the analysis, such as displaying a tree diagram corresponding to the key elements. Text box III allows the user to manually drag and drop or insert reference materials (e.g., images, PDFs, plain text, etc.). After the user drags or inserts reference materials into text box IV, the corresponding text can be extracted from the reference materials and displayed in text box IV. Text box IV can also be used to display the recognized text corresponding to the user's speech data regarding the expected output text.
[0060] Optionally, in this embodiment, considering situations where the acquired user's voice data regarding the desired output text has low voice quality (e.g., unclear speech, low volume, etc.), or the user's description of the desired output text is incomplete or unclear, the identified text obtained based on the voice data may fail to analyze the key elements of the desired output text, or the analyzed key elements of the desired output text may be incomplete, for example, the analyzed key elements may only include the target topic and a few target points. In this case, the large language model may have difficulty accurately generating the first target text that meets the user's expectations. Therefore, to improve the accuracy of the large language model in generating the first target text, when the identified text fails to analyze key elements or identifies missing key elements, a key information missing prompt can be displayed on the interactive interface to remind the user to pay attention to the completeness and clarity of the voice description when recording voice data; or, when the identified text fails to analyze key elements or identifies missing key elements, an information input box can be added to the interactive interface so that the user can input the missing key elements in the information input box.
[0061] Furthermore, a multi-round interactive approach can be adopted, prompting users to input the key elements of the desired output document in sequence. For example, if the target intent, the target topics involved in the target intent, and the target focus of each target topic cannot be found based on the user's identified text analysis, the user can be prompted to input the target intent first, then the target topics in sequence, and finally the target focus of each target topic in sequence.
[0062] Optionally, in addition to the aforementioned method of manually adjusting the order of key elements, this embodiment can also automatically adjust the order of key elements based on several dimensions, and generate a first target document that better meets the user's expectations based on the ordered key elements. These dimensions may include at least one of semantics, context, and keywords.
[0063] Please see Figure 4 , Figure 4 This is a flowchart illustrating an embodiment of the sorting method for key elements provided in this application. Figure 4 As shown, the method includes the following steps:
[0064] S401: Select the child element with the highest semantic level as the current element.
[0065] For details regarding the semantic level of sub-elements, please refer to step S12 above; a detailed description is omitted here.
[0066] S402, Detect whether there are multiple current elements.
[0067] It should be noted that in this embodiment, the sub-elements belonging to the same semantic level are sorted. The sorting of sub-elements belonging to the same semantic level can be used to represent the relative positional relationship between sub-elements belonging to the same semantic level. Therefore, when only one current element is detected, sorting is not required, i.e., step S403 and its subsequent steps are not executed. When multiple current elements are detected, step S403 is executed.
[0068] For example, during the initial detection, the highest semantic level sub-element is the target intent, such as reporting the work content of Department A. In this case, only one sub-element is included, and there is no need to sort the target intent. As another example, if the current highest semantic level is the topic, and the corresponding sub-elements include the personnel composition of Department A, the work outlook for Department A next year, and the work summary of Department A this year, then these three sub-elements need to be sorted.
[0069] S403, in response to the existence of multiple current elements, sort the current elements based on several dimensions.
[0070] In this embodiment, sorting the current elements based on several dimensions may include the following sub-steps:
[0071] Sub-step one: Determine the first confidence score of the current element in different positions based on each dimension.
[0072] For example, a pre-trained network model can be used to determine the first confidence score of the current element at different positions based on each dimension.
[0073] Sub-step two involves fusing the first confidence scores of the same current element across different dimensions to obtain the second confidence score for that current element.
[0074] In one example, the first confidence scores of the same current feature across different dimensions can be directly added together to obtain the second confidence score for that current feature. In another example, the first confidence scores of the same current feature across different dimensions can be weighted, and the weighted confidence score can be used as the second confidence branch for the current feature. For example, the weighting coefficients for the confidence scores across different dimensions can be set according to actual needs.
[0075] Sub-step three: Sort each current element based on the second confidence score.
[0076] Specifically, each current element can be ranked according to its second confidence score. For example, the higher the second confidence score, the higher the ranking; the lower the second confidence score, the lower the ranking.
[0077] S404: Select the next semantic level child element belonging to the same current element as the new current element, and re-execute the step of detecting whether there are multiple current elements for the new current element until all semantic level child elements have been detected.
[0078] For example, when the current element is a theme-level sub-element, the next semantic-level sub-element of the current element is a focus-level sub-element. For instance, if the current element is the composition of personnel in Department A, then the next semantic-level sub-element of the current element may include the current personnel distribution, new employees hired this year, and employees who left this year.
[0079] Optionally, in this embodiment, after sorting the key elements using the methods described in steps S401 to S404, the method further includes: displaying the sorted key elements. Specifically, the sorted key elements can be displayed on the aforementioned interactive interface to allow the user to determine whether the sorted key elements meet expectations and whether the sorting of the key elements needs to be edited.
[0080] Further, steps S23 and S24 can be replaced by: in response to the confirmation operation of the sorted key elements, generating a first target document based on the sorted key elements. Specifically, a confirmation prompt button can be displayed on the interactive interface, and the user can confirm the sorted key elements by clicking the confirmation prompt button. When the user needs to edit the sorted key elements, they do not need to click the confirmation prompt button. Specifically, generating the first target document based on the sorted key elements may include: generating a fourth prompt text to instruct the large language model to generate the document based on the sorted key elements; inputting the fourth prompt text into the large language model to obtain the first target document output by the large language model. The fourth prompt text and the related content of obtaining the first target document based on the fourth prompt text can be referred to the aforementioned steps S23 and S24, and will not be repeated here.
[0081] Optionally, in this embodiment, after executing step S22, the method may further include: obtaining a second target document that satisfies a preset association relationship with the desired output document. The preset association relationship includes at least one of the following: having the same output object as the desired output document, or having the same document type as the desired output document. For example, the preset association relationship may only include having the same output object as the desired output document, or only include having the same document type as the desired output document, or the preset association relationship may simultaneously include having the same output object as the desired output document and having the same document type as the desired output document.
[0082] The target audience for the desired output document can be the user's superiors or subordinates, etc., and this embodiment does not specifically limit this. In one example, the user's output object can be directly extracted from the recognized text corresponding to the user's voice data regarding the desired output document. In another example, the user can be prompted to confirm the output object to obtain the user's confirmed output object. For example, input output object prompts can be displayed on the interactive interface, and the output object entered by the user in the corresponding input box can be obtained, or the output object input by the user via voice can be obtained directly. Another example is that several preset output object options can be displayed on the interactive interface, and the preset output object selected by the user can be obtained as the output object of the desired output document. The relevant content regarding the document type of the desired output document can be referred to in the aforementioned step S11. Obtaining the document type of the desired output document is similar to obtaining the output object of the desired output document, and will not be repeated here.
[0083] Specifically, in this embodiment, the terminal device stores at least one of several historical documents of the current user and several historical documents of other users, and can select a second target document that satisfies a preset association relationship from the stored several historical documents.
[0084] Furthermore, in this embodiment, steps S23 and S24 can be replaced by: generating a first target document based on key elements and a second target document. Specifically, based on key elements and a second target document, a fifth prompt text is generated to instruct the large language model to generate the document; the fifth prompt text is input into the large language model to obtain the first target document output by the large language model. The fifth prompt text and the related content of obtaining the first target document based on the fifth prompt text can be referred to the aforementioned steps S23 and S24, and will not be repeated here.
[0085] In this embodiment, by obtaining a second target document that satisfies a preset association with the desired output document, and generating a first target document based on key elements and the second target document, first target documents with different language styles can be generated according to the user's actual output object and the document type actually needed, further improving the document generation effect.
[0086] Optionally, in this embodiment, the terminal device pre-stores several preset document templates. After executing step S22, the method may further include: selecting a target document template from the several preset document templates. Steps S23 and S24 may also be replaced by: generating a first target document based on key elements and the target document template.
[0087] In this embodiment, the selection of a target document template from several preset document templates can be achieved using any of the following methods:
[0088] Method 1: Based on the matching degree between the key elements of the desired output document and each preset document template, select one preset document template from several preset document templates as the target document template for the desired output document.
[0089] In one embodiment, selecting a preset document template from a plurality of preset document templates as the target document template for the desired output document includes: directly selecting the preset document template with the highest matching degree from a plurality of preset document templates as the target document template for the desired output document.
[0090] In another embodiment, selecting a preset document template as the target document template for the desired output document from a plurality of preset document templates includes: determining the matching degree between the key elements of the desired output document and each preset document template; and selecting at least one preset document template that meets preset conditions from the plurality of preset document templates based on the matching degree between the key elements of the desired output document and each preset document template, and then selecting one preset document template selected by the user from the at least one preset document template that meets the preset conditions as the target document template. For example, the preset conditions may include a matching degree greater than a preset matching degree threshold, which can be set according to actual needs. Exemplarily, after selecting at least one preset document template that meets the preset conditions from the plurality of preset document templates, the at least one preset document template can be displayed to the user on an interactive interface so that the user can select the target document template from the at least one preset document template.
[0091] Specifically, in this embodiment, determining the matching degree between the key elements of the desired output document and each preset document template may include: performing feature extraction on the key elements of the desired output document and the preset document templates, such as keyword extraction, to obtain the feature sequences corresponding to the key elements and the feature sequences corresponding to the preset document templates; then, using a feature matching algorithm to calculate the matching degree between the feature sequences corresponding to the key elements and the feature sequences corresponding to the preset document templates, to obtain the matching degree between the key elements of the desired output document and the preset document templates. For example, the feature matching algorithm may be a cosine similarity algorithm, the longest common subsequence algorithm, etc., and this embodiment does not specifically limit it.
[0092] Method Two: Utilize a large language model to determine the target document template. Specifically, obtain second prompt text generated from key elements and various preset document templates. This second prompt text instructs the large language model to select a preset document template that matches the desired output document. The preset document template indicated by the large language model is then selected as the target document template for the desired output document. For example, the large language model can predict the fit between key elements and various preset document templates, then select the preset document template with the highest fit from several preset document templates, and indicate the selection of the preset document template with the highest fit.
[0093] Method 3: Utilize a neural network model to predict the target document template. Specifically, based on the neural network model, key elements are predicted to obtain the fit degree between each preset document template and the desired output document. Then, based on the fit degree of each preset template, one preset document template is selected as the target document template for the desired output document. The neural network model is trained based on the key elements selected by the user in their historical preset document template selections. For example, the preset document template with the highest fit degree is selected as the predicted target document template from among several preset templates.
[0094] Method 4: Obtain the user-defined preset document template by receiving any one of the following: a preset document template input by the user, identification information representing the preset document template, or a preset document template selection instruction, and use the user-defined preset document template as the target document template.
[0095] For example, a template input box can be displayed on the interactive interface to receive the name or identifier of a preset document template entered by the user. The identifier can be numbers or letters. Furthermore, the name of each preset document template and its corresponding identifier can be displayed next to the template input box, allowing the user to easily identify and quickly input the identifier. Another example is the display of selection buttons or options for each preset document template on the interactive interface. Users can select a desired preset document template by clicking these buttons or options. When a user clicks a selection button or option, the system can retrieve and parse the user's selection command to obtain the chosen preset document template.
[0096] Furthermore, in this embodiment, after selecting a target document template from several preset document templates, a first target document is generated based on the key elements and the target document template. This includes: generating a sixth prompt text based on the key elements and the target document template, and inputting the sixth prompt text into a large language model to obtain a third target document output by the large language model. Then, each text paragraph of the third target document is filled into the corresponding position in the target document template to generate the final first target document. For example, based on each title of the target document template, the text paragraphs in the third target document corresponding to each key element can be filled into the corresponding title positions in the target document template.
[0097] In this embodiment, a target document template can be determined from several preset document templates through various methods such as feature matching, large language model prediction, neural network model prediction, and manual selection by the user. A first target document in the style of the target document template can be generated, which further improves the generation effect of the report document.
[0098] Optionally, in this embodiment, after performing step S24, the method may further include: in response to the marking operation on the sub-text in the first target document, marking the speech segment corresponding to the marked sub-text in the speech data. Alternatively, after performing step S24, the method may further include: in response to the marking operation on the sub-text in the first target document, marking the text segment corresponding to the marked sub-text in the recognized text corresponding to the speech data. The marking operation can be implemented by the user editing the first target document.
[0099] In one example, when a user marks a subtext of the first target document, the corresponding audio segment of the marked subtext can be marked in the audio data. For example, the time period or start and end time of the audio segment corresponding to the user-marked subtext can be marked in the audio data to determine the position of the audio segment corresponding to the user-marked subtext in the overall audio data.
[0100] In another example, when a user marks a subtext of the first target document, the text segment corresponding to the marked subtext can be marked in the recognized text. For example, the start and end positions of the text segment corresponding to the user-marked subtext can be marked in the recognized text to determine the position of the text segment corresponding to the marked subtext in the overall recognized text.
[0101] Optionally, in this embodiment, after performing step S24, a voice transcript or text transcript of the first target document can also be generated.
[0102] In one embodiment, generating a speech summary of a first target document includes: acquiring several speech segments from speech data corresponding to the first target document; and combining the several speech segments to obtain a speech summary of the first target document. Specifically, the acquired several speech segments can be concatenated to obtain a speech summary of the first target document, or speech segments other than the several speech segments can be deleted from the user's speech data regarding the desired output document to obtain a speech summary of the first target document.
[0103] In one example, the first target text corresponds to several speech segments in the speech data, which can be speech segments corresponding to each of the sub-elements in the first target text. Further, the speech segments corresponding to each sub-element can be combined sequentially according to the order of the aforementioned sub-elements to obtain a speech summary that matches the content of the first target text. In another example, the first target text corresponds to several speech segments in the speech data, which can be speech segments corresponding to several marked texts made by the user in the first target text. Combining these speech segments yields the speech summary required by the user.
[0104] In one embodiment, generating a text summary of the first target document includes: acquiring several text segments corresponding to the recognized text in the first target document; and combining the several text segments to obtain a text summary of the first target document. Specifically, the acquired several text segments can be concatenated to obtain a speech summary of the first target document, or, the recognized text segments other than the several text segments in the recognized text of the user's desired output document can be deleted to obtain a text summary of the first target document.
[0105] In one example, the first target document corresponds to several text fragments in the identified text, which can be text fragments corresponding to all sub-elements in the first target document. Further, the text fragments corresponding to each sub-element can be combined sequentially according to the order of the aforementioned sub-elements to obtain a text summary that matches the content of the first target document. In another example, the first target document corresponds to several text fragments in the identified text, which can be several text fragments corresponding to several marked texts in the first target document that the user has marked. Combining these text fragments yields the text summary required by the user.
[0106] Furthermore, in this embodiment, after obtaining the audio or text summary of the first target document, a download button or an online display button can be displayed on the interactive interface. When the user clicks the download button, the audio or text summary can be downloaded for saving or sharing. When the user clicks the online display button, the audio summary can be played online or the text summary can be viewed online.
[0107] Please see Figure 5 , Figure 5 This is a schematic diagram of a framework of an embodiment of the document generation apparatus provided in this application. Figure 5 As shown, the document generation device 500 includes a recognition module 501, an analysis module 502, and a generation module 503. The recognition module 501 is used to obtain corresponding recognized text based on the user's speech data regarding the desired output document. The analysis module 502 is used to analyze the recognized text to obtain key elements of the desired output document, whereby the key elements include at least one semantic-level sub-element. The generation module 503 is used to generate a first target document based on the key elements.
[0108] Optionally, key elements include: the intended purpose of the output document, several target themes involved in the intended purpose, and several key points included in the target themes.
[0109] Optionally, the generation module 503 is used to generate a first prompt text based on key elements to instruct the large language model to generate a manuscript; the first prompt text is input into the large language model to obtain the first target manuscript output by the large language model.
[0110] Optionally, the document generation apparatus 500 further includes a first display module 504 and a determination module 505. After the analysis module 502 analyzes the recognized text to obtain the key elements of the desired output document, and before the generation module 503 generates the first target document based on the key elements, the first display module 504 displays the key elements of the desired output document, and the determination module 505, in response to a selection operation on the key elements, designates the selected key elements as target elements. The generation module 503 is also used to generate the first target document based on the target elements.
[0111] Optionally, the document generation device 500 also includes a sorting module 506. After the analysis module 502 analyzes the recognized text to obtain the key elements of the desired output document, and before the generation module 503 generates the first target document based on the key elements, the sorting module 506 is used to select the highest semantic level sub-element as the current element; detect whether there are multiple current elements; in response to the existence of multiple current elements, sort the current elements based on several dimensions; wherein, the several dimensions include at least one of semantics, context, and keywords; select the next semantic level sub-element belonging to the same current element as the new current element, and for the new current element, re-execute the step of detecting whether there are multiple current elements, until all semantic level sub-elements have been detected.
[0112] Optionally, the document generation device 500 further includes a second display module 507. The second display module 507 is used to display the sorted key elements. The generation module 503 is also used to generate a first target document based on the sorted key elements in response to a confirmation operation of the sorted key elements.
[0113] Optionally, the sorting module 506 is used to determine the first confidence score of the current element at different positions based on each dimension; to fuse the first confidence scores of the same current element in different dimensions to obtain the second confidence score of the corresponding current element; and to sort each current element based on the second confidence score.
[0114] Optionally, the generation module 503 is further configured to, after generating the first target text based on key elements, obtain several speech segments in the speech data corresponding to the first target text; and combine the several speech segments to obtain a speech summary of the first target text. And / or, the generation module 503 is further configured to, after generating the first target text based on key elements, obtain several text segments in the recognized text corresponding to the first target text; and combine the several text segments to obtain a text summary of the first target text.
[0115] Optionally, the document generation apparatus 500 further includes a tagging module 508. After the generation module 503 generates the first target document based on key elements, the tagging module 508, in response to the tagging operation on sub-texts in the first target document, tags the speech segments corresponding to the tagged sub-texts in the speech data. And / or, after the generation module 503 generates the first target document based on key elements, the tagging module 508, in response to the tagging operation on sub-texts in the first target document, tags the text segments corresponding to the tagged sub-texts in the recognized text.
[0116] Optionally, the document generation device 500 further includes an acquisition module 509. After the analysis module 502 analyzes the recognized text to obtain the key elements of the desired output document, and before the generation module 503 generates the first target document based on the key elements, the acquisition module 509 acquires a second target document that satisfies a preset association relationship with the desired output document. The generation module 503 generates the first target document based on the key elements and the second target document.
[0117] Optionally, the preset association relationship includes at least one of the following: the same output object as the expected output document, and the same document type as the expected output document.
[0118] Optionally, the document generation device 500 further includes a selection module 510. After the analysis module 502 analyzes the recognized text to obtain the key elements of the desired output document, and before the generation module 503 generates the first target document based on the key elements, the selection module 510 is used to select a target document template from several preset document templates. The generation module 503 is also used to generate the first target document based on the key elements and the target document template.
[0119] Optionally, the selection module 510 is used to select a target document template from several preset document templates using any of the following methods: selecting a preset document template as the target document template for the desired output document based on the matching degree between key elements and each preset document template; obtaining a second prompt text generated by the key elements and each preset document template, wherein the second prompt text is used to instruct the large language model to select a preset document template that matches the desired output document, and selecting the preset document template indicated by the large language model as the target document template for the desired output document; predicting key elements based on a neural network model to obtain the fit degree between each preset document template and the desired output document, wherein the neural network model is trained based on key elements when the user historically selected preset document templates, and selecting a preset document template as the target document template for the desired output document based on the fit degree.
[0120] It should be noted that the apparatus of this embodiment can perform the steps in the above method. For detailed descriptions of the relevant content, please refer to the method section above, which will not be repeated here.
[0121] Please see Figure 6 , Figure 6 This is a schematic diagram of an embodiment of the electronic device provided in this application. In this embodiment, the electronic device 60 includes a memory 61 and a processor 62.
[0122] Processor 62 can also be referred to as a CPU (Central Processing Unit). Processor 62 may be an integrated circuit chip with signal processing capabilities. Processor 62 can also be a general-purpose processor, digital signal processor (DSP), application-specific integrated circuit (ASIC), field-programmable gate array (FPGA), or other programmable logic device, discrete gate or transistor logic device, or discrete hardware component. A general-purpose processor can be a microprocessor, or processor 62 can be any conventional processor 62, etc.
[0123] The memory 61 in the electronic device 60 is used to store the program instructions required for the processor 62 to run.
[0124] The processor 62 is used to execute program instructions to implement the document generation method in this application.
[0125] Please see Figure 7 , Figure 7 This is a schematic diagram of a framework of an embodiment of the computer-readable storage medium provided in this application. The computer-readable storage medium 70 of this embodiment stores program instructions 71, which, when executed, implement the document generation method provided in this application. The program instructions 71 can form a program file and be stored in the aforementioned computer-readable storage medium 70 in the form of a software product, so that a computer device (which may be a personal computer, server, or network device, etc.) can execute all or part of the steps of the methods of various embodiments of this application. The aforementioned computer-readable storage medium 70 includes various media capable of storing program code, such as a USB flash drive, portable hard drive, read-only memory (ROM), random access memory (RAM), magnetic disk, or optical disk, or terminal devices such as computers, servers, mobile phones, and tablets.
[0126] The above solution, based on the user's voice data regarding the desired output text, obtains the corresponding recognized text; analyzes the recognized text to identify the key elements of the desired output text; and generates the first target text based on these key elements. This method requires only the user's voice data regarding the desired output text to automatically analyze and generate the first target text. Compared to user editing, this reduces the time users spend obtaining text and improves their work efficiency.
[0127] In some embodiments, the functions or modules of the apparatus provided in this disclosure can be used to perform the methods described in the above method embodiments. The specific implementation can be referred to the description of the above method embodiments, and for the sake of brevity, it will not be repeated here.
[0128] The description of the various embodiments above tends to emphasize the differences between the various embodiments. The similarities or similarities between them can be referred to, and for the sake of brevity, they will not be repeated here.
[0129] In the several embodiments provided in this application, it should be understood that the disclosed methods, apparatuses, and systems can be implemented in other ways. For example, the apparatus implementations described above are merely illustrative. For instance, the division of modules or units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces; the indirect coupling or communication connection of apparatuses or units may be electrical, mechanical, or other forms.
[0130] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment, depending on actual needs.
[0131] Furthermore, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.
[0132] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) or processor to execute all or part of the steps of the methods of various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0133] The above description is merely an embodiment of this application and does not limit the patent scope of this application. Any equivalent structural or procedural transformations made using the content of this application's specification and drawings, or direct or indirect applications in other related technical fields, are similarly included within the patent protection scope of this application.
Claims
1. A method for generating a document, characterized in that, include: Based on the user's voice data regarding the desired output text, the corresponding recognized text is obtained, wherein the voice data is a voice description file recorded during the user's brief description of the desired output text; Based on the identified text, the key elements of the desired output document are obtained; wherein, the key elements include at least one semantic-level sub-elements, and the key elements include the target intent of the desired output document, several target topics involved in the target intent, and several target focuses contained in the target topics; Based on the aforementioned key elements, a first target document is generated.
2. The method according to claim 1, characterized in that, The process of generating the first target document based on the key elements includes: Based on the aforementioned key elements, generate a first prompt text to instruct the large language model to generate the text. The first prompt text is input into the large language model to obtain the first target text output by the large language model.
3. The method according to claim 1, characterized in that, After analyzing the identified text to obtain the key elements of the desired output document, and before generating the first target document based on the key elements, the method further includes: Show the key elements of the desired output document; In response to the selection operation of the key element, the selected key element is taken as the target element; The process of generating the first target document based on the key elements includes: Based on the target elements, the first target document is generated.
4. The method according to claim 1, characterized in that, After analyzing the identified text to obtain the key elements of the desired output document, and before generating the first target document based on the key elements, the method further includes: Select the highest semantic level sub-element as the current element; Detect whether there are multiple of the current element; In response to the existence of multiple current elements, the current elements are sorted based on several dimensions; wherein, the several dimensions include at least one of semantics, context, and keywords; Select the next semantic level sub-element belonging to the same current element as the new current element, and re-execute the step of detecting whether there are multiple current elements for the current element until all semantic level sub-elements have been detected.
5. The method according to claim 4, characterized in that, The method further includes: Display the key elements after sorting; The process of generating the first target document based on the key elements includes: In response to the confirmation operation of the sorted key elements, the first target document is generated based on the sorted key elements.
6. The method according to claim 4, characterized in that, The sorting of the current elements based on several dimensions includes: Based on each of the aforementioned dimensions, determine the first confidence score for the current element at its different positions; Based on the first confidence scores of the same current element under different dimensions, a second confidence score corresponding to the current element is obtained by fusion; Based on the second confidence score, each of the current elements is sorted.
7. The method according to claim 1, characterized in that, After generating the first target document based on the key elements, the method further includes: Obtain several speech segments from the speech data corresponding to the first target text; Based on the aforementioned audio segments, a simplified audio transcript of the first target text is obtained by combining them. And / or, after generating the first target document based on the key elements, the method further includes: Obtain several text segments from the identified text corresponding to the first target document; Based on the aforementioned text fragments, a simplified text of the first target document is obtained by combining them.
8. The method according to claim 1, characterized in that, After generating the first target document based on the key elements, the method further includes: In response to the marking operation on the subtext in the first target document, the speech segments corresponding to the marked subtext are marked in the speech data; And / or, in response to a tagging operation on subtext in the first target document, a text segment corresponding to the tagged subtext is tagged in the identified text.
9. The method according to claim 1, characterized in that, After analyzing the identified text to obtain the key elements of the desired output document, and before generating the first target document based on the key elements, the method further includes: Obtain a second target document that satisfies a preset association relationship with the desired output document; The process of generating the first target document based on the key elements includes: Based on the key elements and the second target document, the first target document is generated.
10. The method according to claim 9, characterized in that, The preset association relationship includes at least one of the following: the same output object as the expected output document, and the same document type as the expected output document.
11. The method according to claim 1, characterized in that, After analyzing the identified text to obtain the key elements of the desired output document, and before generating the first target document based on the key elements, the method further includes: Select the target document template from several preset document templates; The process of generating the first target document based on the key elements includes: Based on the key elements and the target document template, the first target document is generated.
12. The method according to claim 11, characterized in that, The step of selecting the target document template from a number of preset document templates includes any one of the following: Based on the matching degree between the key elements and each preset document template, the preset document template is selected as the target document template for the desired output document; Obtain a second prompt text generated from the key elements and each of the preset document templates, and the second prompt text is used to instruct the large language model to select a preset document template that matches the desired output document, and select the preset document template indicated by the large language model as the target document template of the desired output document; The key elements are predicted based on a neural network model to obtain the fit degree between each preset document template and the expected output document. The neural network model is trained based on the key elements when the user historically selected the preset document template. Based on the fit degree, the preset document template is selected as the target document template for the expected output document.
13. A document generation device, characterized in that, include: The recognition module is used to obtain the corresponding recognized text based on the user's voice data about the expected output text, wherein the voice data is a voice description file recorded by the user during the process of summarizing the expected output text; An analysis module is used to analyze the identified text to obtain the key elements of the desired output document; wherein, the key elements include at least one semantic-level sub-elements, and the key elements include the target intent of the desired output document, several target topics involved in the target intent, and several target focuses contained in the target topics; The generation module is used to generate a first target document based on the key elements.
14. An electronic device comprising a memory and a processor coupled to each other, the memory storing program instructions, the processor being configured to execute the program instructions to implement the document generation method according to any one of claims 1 to 12.
15. A computer-readable storage medium, characterized in that, The document contains program instructions that can be executed by a processor, the program instructions being used to implement the document generation method according to any one of claims 1 to 12.