Text editing method and device
By determining the statement theme object and associated events during the text editing process, generating query statements and obtaining data indicators, the problem of time-consuming data integration is solved by manually querying and integrating data, and the efficiency of text editing is improved.
Patent Information
- Application Number
- CN202411640260.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-15
- Publication Date
- 2025-03-11
AI Technical Summary
During the text editing process, manual query and integration of metric data is time-consuming, which seriously slows down the efficiency of text editing.
When the user enters text, determines the topic object of the current statement, generates query statements based on the topic object and associated events, obtains relevant data indicators, and expands the current statement based on these indicators.
Without the need for users to manually query and integrate indicator data, the relevant data is directly integrated into the text, which significantly improves the efficiency of text editing.
Smart Images

Figure CN119598983A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of text editing technology, and in particular to a text editing method and device. Background Art
[0002] Text editing refers to the process of writing text content to achieve specific purposes in the fields of education, publicity, marketing, media, etc. With the diversification of information dissemination methods, copywriting has become increasingly critical and has become an indispensable core link in the field of information dissemination.
[0003] In the process of text editing, in order to effectively enhance the persuasiveness of the text content and ensure the accuracy of information transmission, it is often necessary to widely quote a large amount of indicator data to provide strong support for the views or judgments in the text content. However, the manual query and integration of these indicator data is extremely time-consuming, which seriously slows down the efficiency of the entire text editing. Summary of the invention
[0004] In view of this, an embodiment of the present application provides a text editing method and device for improving the efficiency of text editing.
[0005] In order to achieve the above purpose, the embodiments of the present application provide the following technical solutions:
[0006] In a first aspect, an embodiment of the present application provides a text editing method, comprising:
[0007] During the text input process by the user, determining the subject object of the current sentence;
[0008] Determining an associated event associated with the subject object according to the text content input by the user;
[0009] Generate a query statement based on the subject object and the associated event;
[0010] Execute the query statement to obtain at least one data indicator associated with the subject object and the associated event;
[0011] The current statement is expanded according to the at least one data indicator.
[0012] As an optional implementation of the embodiment of the present application, determining the subject object of the current sentence includes:
[0013] Extracting a first number of objects according to the importance of each object in the current sentence to obtain a first object sequence;
[0014] Acquire a second object sequence according to the semantic information of the current sentence;
[0015] Extracting a second number of objects according to the heat of each object in the current statement to obtain a third object sequence;
[0016] A subject object of a current sentence is determined based on the first object sequence, the second object sequence, and the third object sequence.
[0017] As an optional implementation of the embodiment of the present application, extracting a first number of objects according to the importance of each object in the current sentence to obtain a first object sequence includes:
[0018] Get the word frequency and inverse document frequency of each object in the current sentence;
[0019] Calculate the importance of each object in the current sentence based on the word frequency and inverse document frequency of each object in the current sentence;
[0020] A first number of objects with the highest importance are combined into the first object sequence.
[0021] As an optional implementation of the embodiment of the present application, the acquiring of the second object sequence according to the semantic information of the current sentence includes:
[0022] Perform sentence embedding operation on the current sentence to obtain the sentence embedding vector of the current sentence;
[0023] Obtain a target sentence vector having the greatest similarity to the sentence embedding vector in a preset sentence vector set;
[0024] Based on a preset corresponding relationship, an object sequence corresponding to the target sentence vector is obtained as the second object sequence.
[0025] As an optional implementation of the embodiment of the present application, extracting a second number of objects according to the heat of each object in the current statement to obtain a third object sequence includes:
[0026] Get the query count of each object in the current statement within the preset time length;
[0027] Get the popularity of each object in the current statement based on the query count of each object in the current statement;
[0028] The second number of objects with the highest heat levels are combined into the third object sequence.
[0029] As an optional implementation of the embodiment of the present application, determining the subject object of the current sentence based on the first object sequence, the second object sequence, and the third object sequence includes:
[0030] Calculating a weight value of each object according to a weight coefficient of each position in the first object sequence, a weight coefficient of each position in the second object sequence, and a weight coefficient of each position in the third object sequence;
[0031] The object with the largest weight value is selected as the subject object of the current sentence.
[0032] As an optional implementation of the embodiment of the present application, the determining of the associated event associated with the subject object according to the text content input by the user includes:
[0033] Acquire all events corresponding to the subject object based on a preset mapping relationship;
[0034] Acquiring context information of the subject object according to the text content input by the user;
[0035] An event associated with the subject object is selected from all events corresponding to the subject object according to the context information to obtain the associated event.
[0036] As an optional implementation of the embodiment of the present application, the generating of a query statement based on the subject object and the associated event includes:
[0037] determining at least one data indicator based on the subject object and the associated event;
[0038] A query statement is generated based on each indicator of the at least one data indicator.
[0039] As an optional implementation of the embodiment of the present application, after the current statement is expanded according to the at least one data indicator, the method further includes:
[0040] Displaying the extended content corresponding to the current sentence after the current sentence in a first text format, wherein the first text format is different from a second text format, and the second text format is a format of the text content input by the user;
[0041] In response to a user confirmation operation on the extended content, converting the extended content from the first text format to the second text format;
[0042] In response to a text input operation by the user, the expanded content is deleted.
[0043] In a second aspect, the present application provides a text editing device, comprising
[0044] A subject determination unit, used to determine the subject object of the current sentence during the text input process of the user;
[0045] An event determination unit, configured to determine an associated event associated with the subject object according to the text content input by the user;
[0046] A generating unit, configured to generate a query statement based on the subject object and the associated event;
[0047] An execution unit, configured to execute the query statement to obtain at least one data indicator associated with the subject object and the associated event;
[0048] An expansion unit is used to expand the current statement according to the at least one data indicator.
[0049] As an optional implementation of an embodiment of the present application, the topic determination unit is specifically used to extract a first number of objects according to the importance of each object in the current sentence to obtain a first object sequence; obtain a second object sequence according to the semantic information of the current sentence; extract a second number of objects according to the popularity of each object in the current sentence to obtain a third object sequence; determine the topic object of the current sentence based on the first object sequence, the second object sequence and the third object sequence.
[0050] As an optional implementation of the embodiment of the present application, the topic determination unit is specifically used to obtain the word frequency and inverse document frequency of each object in the current sentence; calculate the importance of each object in the current sentence based on the word frequency and inverse document frequency of each object in the current sentence; and combine a first number of objects with the highest importance into the first object sequence.
[0051] As an optional implementation of an embodiment of the present application, the topic determination unit is specifically used to perform a sentence embedding operation on the current sentence to obtain a sentence embedding vector of the current sentence; obtain a target sentence vector with the greatest similarity to the sentence embedding vector in a preset sentence vector set; and obtain an object sequence corresponding to the target sentence vector as the second object sequence based on a preset correspondence relationship.
[0052] As an optional implementation of the embodiment of the present application, the topic determination unit is specifically used to obtain the number of queries for each object in the current statement within a preset time length; obtain the popularity of each object in the current statement based on the number of queries for each object in the current statement; and combine the second number of objects with the highest popularity into the third object sequence.
[0053] As an optional implementation of an embodiment of the present application, the topic determination unit is specifically used to calculate the weight value of each object based on the weight coefficient of each position in the first object sequence, the weight coefficient of each position in the second object sequence, and the weight coefficient of each position in the third object sequence; and select the object with the largest weight value as the topic object of the current sentence.
[0054] As an optional implementation of the embodiment of the present application, the event determination unit is specifically used to obtain all events corresponding to the subject object based on a preset mapping relationship; obtain context information of the subject object according to the text content input by the user; and select an event associated with the subject object from all events corresponding to the subject object according to the context information to obtain the associated event.
[0055] As an optional implementation of the embodiment of the present application, the generation unit is specifically used to determine at least one data indicator based on the subject object and the associated event; and generate a query statement based on each indicator of the at least one data indicator.
[0056] As an optional implementation of the embodiment of the present application, the expansion unit is also used to display the expanded content corresponding to the current sentence in a first text format after the current sentence is expanded according to the at least one data indicator, and the first text format is different from the second text format, and the second text format is the format of the text content input by the user; in response to the user's confirmation operation on the expanded content, the expanded content is converted from the first text format to the second text format; in response to the user's text input operation, the expanded content is deleted.
[0057] In a third aspect, an embodiment of the present application provides an electronic device, comprising: a memory and a processor, wherein the memory is used to store a computer program and the processor is used to enable the electronic device to implement the text editing method described in any of the above-mentioned embodiments when executing the computer program.
[0058] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, which, when the computer program is executed by a computing device, enables the computing device to implement the text editing method described in any of the above-mentioned embodiments.
[0059] In a fifth aspect, an embodiment of the present application provides a computer program product, which, when executed on a computer, enables the computer to implement the text editing method described in any of the above-mentioned embodiments.
[0060] The text editing method provided in the embodiment of the present application first determines the subject object of the current sentence during the text input process by the user, then determines the associated event associated with the subject object according to the text content input by the user, then generates a query statement based on the subject object and the associated event, and executes the query statement to obtain at least one data indicator associated with the subject object and the associated event, and finally expands the current sentence according to the at least one data indicator. Since the text editing method provided in the embodiment of the present application can obtain at least one data indicator associated with the subject object and the associated event according to the subject object of the current sentence and the associated event associated with the subject object during the text input process by the user, and expand the current sentence according to the at least one data indicator, the text editing method provided in the embodiment of the present application can expand the current sentence based on the indicator data associated with the subject object and the associated event without the user having to manually query and integrate the indicator data associated with the subject object and the associated event, so the embodiment of the present application can improve the efficiency of text editing. BRIEF DESCRIPTION OF THE DRAWINGS
[0061] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.
[0062] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the prior art, the drawings required in the embodiments or the description of the prior art will be briefly introduced below. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.
[0063] Figure 1 One of the step flow charts of the text editing method provided in the embodiment of the present application;
[0064] Figure 2 The second step flow chart of the text editing method provided in the embodiment of the present application;
[0065] Figure 3 One of the schematic diagrams of the text editing interface provided in the embodiment of the present application;
[0066] Figure 4 A second schematic diagram of a text editing interface provided in an embodiment of the present application;
[0067] Figure 5 The third schematic diagram of the text editing interface provided in the embodiment of the present application;
[0068] Figure 6 A schematic diagram of the structure of a text editing device provided in an embodiment of the present application;
[0069] Figure 7 A schematic diagram of the hardware structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0070] In order to more clearly understand the above-mentioned purposes, features and advantages of the present application, the scheme of the present application will be further described below. It should be noted that the embodiments of the present application and the features in the embodiments can be combined with each other without conflict.
[0071] In the following description, many specific details are set forth to facilitate a full understanding of the present application, but the present application may also be implemented in other ways different from those described herein. Obviously, the embodiments in the specification are only part of the embodiments of the present application, rather than all of the embodiments.
[0072] In the embodiments of the present application, words such as "exemplary" or "for example" are used to indicate examples, illustrations or descriptions. Any embodiment or design described as "exemplary" or "for example" in the embodiments of the present application should not be interpreted as being more preferred or more advantageous than other embodiments or designs. Specifically, the use of words such as "exemplary" or "for example" is intended to present related concepts in a concrete way. In addition, in the description of the embodiments of the present application, unless otherwise specified, the meaning of "multiple" refers to two or more.
[0073] The embodiment of the present application provides a text editing method, and the execution subject of the text editing method can be a terminal device such as a mobile phone, a personal computer, a handheld computer, a vehicle-mounted device, or a text editing device integrated in the terminal device. Figure 1 As shown, the text editing method includes the following steps S11 to S15:
[0074] S11. During the text input process by the user, determine the subject object of the current sentence.
[0075] The current sentence in the embodiment of the present application refers to the sentence that the user is currently editing, wherein the editing operation may be an operation of inputting a sentence or an operation of modifying an already input sentence.
[0076] The subject object of the current sentence refers to the person, thing, concept, group, etc. that is at the core of the current sentence, is mainly described, explained, discussed, or is closely related to the relevant actions, states, etc. For example, if the current sentence is "the content of this book is very exciting", then the subject object of the current sentence can be "book".
[0077] It should be noted that as the user edits the current sentence, the subject object of the current sentence may change. For example, if the user wants to enter the sentence "The sun is high in the sky, and the earth is warm", when the user enters "The sun is high in the sky", the subject object of the current sentence may be determined as "the sun", and when the user further enters the subsequent content "The earth is warm", the subject object of the current sentence may be updated from "the sun" to "the earth".
[0078] In some embodiments, when the user is editing the current sentence, all objects in the current sentence can be obtained and the main object of the current sentence can be selected from them.
[0079] S12: Determine an associated event associated with the subject object according to the text content input by the user.
[0080] In the embodiment of the present application, the associated event associated with the subject object refers to the action, behavior, state change, development process or interaction directly related to the subject object of the sentence. For example, if the current sentence is "scientists attended an academic seminar", and the subject object of the current sentence is "scientists", then the associated event associated with the subject object determined according to the text content input by the user can be "academic seminar".
[0081] In the embodiment of the present application, the text content input by the user may include not only the current sentence, but also the text content input before the current sentence.
[0082] S13: Generate a query statement based on the subject object and the associated event.
[0083] A query statement is an instruction used to retrieve specific information from a database.
[0084] In some embodiments, generating a query statement based on the subject object and the associated event includes: determining possible data indicators based on the subject object and the associated event, and generating query statements based on each data indicator. For example, if the current statement is "store has joined the local promotion project", the subject object of the current statement is "store", and the associated event of the subject object "store" is "local promotion project", then the possible data indicators can be determined to be "order quantity", "cost", "number of followers", "total transaction amount", etc., so a query statement can be generated for querying data indicators such as store order quantity, store cost, number of store followers, and store total transaction amount.
[0085] S14. Execute the query statement to obtain at least one data indicator associated with the subject object and the associated event.
[0086] In some embodiments, executing the query statement to obtain at least one data indicator associated with the subject object and the associated event includes: performing search and extraction operations in the business database according to the requirements of the query statement to obtain at least one data indicator associated with the subject object and the associated event.
[0087] S15. Expand the current statement according to the at least one data indicator.
[0088] Continuing with the above embodiment, the current sentence is "the store has joined the local promotion project", the subject object of the current sentence is "store", and the associated event is "local promotion project". The data indicators associated with the subject object and the associated event include: "the number of orders increased by 25%", "the cost decreased by 15%", and the expanded content can be "according to data analysis, during this period, the number of orders in the store increased by 25% and the cost decreased by 15%."
[0089] The text editing method provided in the embodiment of the present application first determines the subject object of the current sentence during the text input process by the user, then determines the associated event associated with the subject object according to the text content input by the user, then generates a query statement based on the subject object and the associated event, and executes the query statement to obtain at least one data indicator associated with the subject object and the associated event, and finally expands the current sentence according to the at least one data indicator. Since the text editing method provided in the embodiment of the present application can obtain at least one data indicator associated with the subject object and the associated event according to the subject object of the current sentence and the associated event associated with the subject object during the text input process by the user, and expand the current sentence according to the at least one data indicator, the text editing method provided in the embodiment of the present application can expand the current sentence based on the indicator data associated with the subject object and the associated event without the user having to manually query and integrate the indicator data associated with the subject object and the associated event, so the embodiment of the present application can improve the efficiency of text editing.
[0090] As an extension and refinement of the above embodiment, the present application embodiment provides another text editing method, referring to Figure 2 As shown, the text editing method includes the following steps:
[0091] S201. During a text input process by a user, extract a first number of objects according to the importance of each object in a current sentence to obtain a first object sequence.
[0092] In some embodiments, extracting a first number of objects according to the importance of each object in the current sentence to obtain a first object sequence includes the following steps a to c:
[0093] Step a: Get the term frequency (TF) and inverse document frequency (IDF) of each object in the current sentence.
[0094] Word frequency refers to the frequency with which a word appears in a text. Word frequency is a basic concept in fields such as text mining, information retrieval, and natural language processing. The purpose of calculating word frequency is to measure the importance of a word in a text. The higher the word frequency, the more important the word is to the text.
[0095] The calculation formula for the word frequency of each object in the current sentence can be:
[0096]
[0097] Among them, TF i is the word frequency of the i-th object in the current sentence, n i is the number of occurrences of the i-th object in the current statement, ∑ k n ik The total number of occurrences of all objects.
[0098] Inverse document frequency is a metric used to measure the rarity of a word in the entire document collection. Unlike word frequency, which focuses on the frequency of a word in the current text content, inverse document frequency considers the distribution of words in all documents. If a word appears frequently in many documents, its inverse document frequency is low; conversely, if a word appears only in a few documents, its inverse document frequency is high.
[0099] The calculation formula for the inverse document frequency of each object in the current sentence can be:
[0100]
[0101] Among them, IDF i is the inverse document frequency of the i-th object in the current statement, N is the total number of documents, df i is the number of documents containing the i-th object.
[0102] Step b: Calculate the importance of each object in the current sentence based on the TF and IDF of each object in the current sentence.
[0103] In some embodiments, the importance of each object in the current sentence is calculated based on the TF and IDF of each object in the current sentence, including: calculating the TF-IDF of each object in the current sentence based on the TF and IDF of each object in the current sentence, and determining the TF-IDF of each object in the current sentence as the importance of each object in the current sentence.
[0104] TF-IDF is a concept in weighted technology used in information retrieval and text mining. It combines the concepts of term frequency and inverse document frequency to measure the importance of a word to a document in a document collection.
[0105] In some embodiments, the TF-IDF of each object in the current sentence is calculated based on the TF and IDF of each object in the current sentence, including: calculating the product of TF and IDF of each object in the current sentence to obtain the term frequency-inverse document frequency of each object in the current sentence.
[0106] In some embodiments, the importance of each object in the current sentence is calculated based on the TF and IDF of each object in the current sentence, including: calculating the relevance score of each object in the current sentence based on the Best Matching 25 (BM25) algorithm, the TF of each object in the current sentence, and the IDF of each object in the current sentence, and determining the score of each object in the current sentence as the importance of each object in the current sentence.
[0107] BM25 is a ranking function for information retrieval, which is developed based on TF-IDF. Its main purpose is to rank the relevance of documents based on the keywords of the user's query. Compared with TF-IDF, BM25 considers more factors, such as document length, and can more accurately measure the relevance between documents and words.
[0108] Step c: combining a first number of objects with the highest importance into the first object sequence.
[0109] Exemplarily, the first number is 3, and the sorting result of sorting the objects in the current statement in descending order according to importance is: object A->object B->object C->object D->object E->object F, then the first 3 objects of the sorting result can be taken to form the first object sequence, and the obtained first object sequence is: object A->object B->object C.
[0110] S202: During the text input process by the user, a second object sequence is acquired according to semantic information of the current sentence.
[0111] In some embodiments, obtaining the second object sequence according to the semantic information of the current sentence includes the following steps 1 to 3:
[0112] Step 1: Perform sentence embedding operation on the current sentence to obtain the sentence embedding vector of the current sentence.
[0113] Sentence embedding is a technique for representing sentences in natural language as space vectors. The implementation process of obtaining the sentence embedding vector of the current sentence may include: mapping each word in the sentence into a vector space of fixed dimension to obtain the word embedding vector of each word in the sentence, and then combining the word embedding vectors of the words in the sentence (such as average pooling, weighted summation, etc.) to obtain the sentence embedding vector of the current sentence.
[0114] Step 2: Obtain a target sentence vector from a preset sentence vector set that has the greatest similarity to the sentence embedding vector.
[0115] That is, a sentence vector set including multiple sentence vectors can be pre-constructed. After obtaining the sentence embedding vector of the current sentence, the similarity between the sentence embedding vector and each sentence vector in the sentence vector set is calculated, and the vector in the sentence vector set with the greatest similarity to the sentence embedding vector is determined as the target sentence vector.
[0116] Among them, calculating the similarity between the sentence embedding vector and each sentence vector in the sentence vector set can be: calculating the cosine similarity or Euclidean distance or Manhattan distance or Pearson correlation coefficient or Manhattan distance between the sentence embedding vector and each sentence vector in the sentence vector set to obtain the similarity between the sentence embedding vector and each sentence vector in the sentence vector set.
[0117] Step 3: Based on a preset corresponding relationship, obtain an object sequence corresponding to the target sentence vector as the second object sequence.
[0118] In some embodiments, the preset correspondence relationship includes the correspondence between each statement vector in a preset statement vector set and the object sequence. After determining the second set statement vector set, the object sequence corresponding to the target statement vector can be obtained based on the target statement vector and the preset correspondence relationship, and the object sequence corresponding to the target statement vector can be used as the second object sequence.
[0119] S203: During the text input process by the user, extract a second number of objects according to the popularity of each object in the current sentence to obtain a third object sequence.
[0120] In some embodiments, extracting a second number of objects according to the heat of each object in the current sentence to obtain a third object sequence includes the following steps I to III:
[0121] Step I: Get the query count of each object in the current statement within a preset time length.
[0122] Step II: Get the popularity of each object in the current statement according to the query count of each object in the current statement.
[0123] In some embodiments, the popularity of each object in the current statement is obtained according to the query count of each object in the current statement, including: calculating the ratio of the query count of each object in the current statement to the total query count of all objects to obtain the popularity of each object in the current statement.
[0124] Step III: Combining the second number of objects with the highest heat into the third object sequence.
[0125] Exemplarily, the second number is 3, and the sorting result of sorting the objects in the current statement in descending order according to popularity is: object B->object A->object D->object C->object F->object E, then the first 3 objects of the sorting result can be taken to form a third object sequence, and the obtained third object sequence is: object B->object A->object D.
[0126] S204: Determine a subject object of the current sentence based on the first object sequence, the second object sequence, and the third object sequence.
[0127] In some embodiments, determining the subject object of the current sentence based on the first object sequence, the second object sequence, and the third object sequence includes: calculating the weight value of each object according to the weight coefficient of each position in the first object sequence, the weight coefficient of each position in the second object sequence, and the weight coefficient of each position in the third object sequence; and selecting the object with the largest weight value as the subject object of the current sentence.
[0128] Exemplarily, the first object sequence is: object A->object B->object C, the second object sequence is: object B->object A->object D, and the third object sequence is: object B->object A->object D, and the weight coefficients of each position in the first object sequence are w 11 、w 12 、w 13 ; The weight coefficients of each position in the second object sequence are w 21 、w 22 、w 23 ; The weight coefficients of each position in the third object sequence are w 31 、w 32 、w 33 ,but
[0129] The calculation formula of the weight value of object A can be shown as follows:
[0130] V A =w 11 +w 22 +w 32
[0131] The calculation formula of the weight value of object B can be shown as follows:
[0132] V B =w 12 +w 21 +w 31
[0133] The calculation formula of the weight value of object C can be shown as follows:
[0134] V C =w 13 +0+0
[0135] The calculation formula of the weight value of object D can be shown as follows:
[0136] V D =0+w 23 +w 33
[0137] The weight values of other objects are all 0.
[0138] Since the embodiment of the present application can extract a first number of objects according to the importance of each object in the current sentence to obtain a first object sequence, obtain a second object sequence according to the semantic information of the current sentence, extract a second number of objects according to the popularity of each object in the current sentence to obtain a third object sequence, and then determine the subject object of the current sentence based on the first object sequence, the second object sequence and the third object sequence, the embodiment of the present application can fuse the importance, voice information and popularity to determine the subject object of the current sentence, thereby improving the accuracy of determining the subject object.
[0139] S205: Acquire all events corresponding to the subject object based on a preset mapping relationship.
[0140] In some embodiments, a mapping relationship table may be pre-configured for each subject object, and all events corresponding to the subject object may be maintained in the mapping relationship table, and then the event corresponding to the subject object of the current statement may be obtained based on the mapping relationship table.
[0141] S206: Acquire context information (ContextInformation) of the subject object according to the text content input by the user.
[0142] The context information of a subject object refers to the surrounding information related to the subject object, through which the content related to the subject object can be understood more comprehensively and accurately.
[0143] S207: Select an event associated with the subject object from all events corresponding to the subject object according to the context information to obtain the associated event.
[0144] It should be noted that the associated event may be one event or multiple events.
[0145] S208. Determine at least one data indicator based on the subject object and the associated event.
[0146] S209: Generate a query statement based on each indicator of the at least one data indicator to generate a query statement.
[0147] S210. Execute the query statement to obtain at least one data indicator associated with the subject object and the associated event.
[0148] S211. Expand the current statement according to the at least one data indicator.
[0149] S212: Display the extended content corresponding to the current sentence after the current sentence in the first text format.
[0150] The first text format is different from the second text format, and the second text format is the format of the text content input by the user.
[0151] In the embodiment of the present application, the purpose of the first text format displaying the extended content corresponding to the current sentence after the current sentence is to distinguish the current sentence input by the user from the extended content of the current sentence. Therefore, the first text format is not limited in the embodiment of the present application, and the difference between the extended content corresponding to the current sentence and the actual format of the current sentence shall prevail.
[0152] For example, refer to Figure 3 As shown, Figure 3 The text content "the equipment was upgraded" is the current sentence 31, and the text content "the efficiency of the equipment was improved by 30% after the upgrade" is the extended content 32 corresponding to the current sentence. The current sentence 31 is displayed in a first color and a non-tilted first text format, while the extended content 32 corresponding to the current sentence is displayed in a second color and a tilted second text format.
[0153] S213: In response to a user confirmation operation on the extended content, convert the extended content from the first text format to the second text format, or in response to a user text input operation, delete the extended content.
[0154] In some embodiments, the user's confirmation operation on the expanded content may be moving a text insertion point cursor to after the expanded content.
[0155] For example, refer to Figure 4As shown, after the extended content 32 corresponding to the current sentence is displayed in the first text format after the current sentence, if the user moves the text insertion point cursor 400 to after the extended content 32, the extended content 32 is displayed in the first color and non-italic first text format.
[0156] For example, refer to Figure 5 As shown, after the extended content 32 corresponding to the current sentence is displayed in the first text format on the current sentence, if the user ignores the extended content 32 and continues to input text, the extended content 32 is deleted in response to the user's text input operation.
[0157] In some embodiments, the embodiments of the present application can implement the above text editing method based on a natural language processing model (NLP). That is, the natural language processing model is used to implement the steps of determining the subject object of the current sentence, determining the associated event associated with the subject object, generating a query statement based on the subject object and the associated event, executing the query statement to obtain data indicators, and expanding the current sentence according to the at least one data indicator.
[0158] In some embodiments, the natural language processing model may be a Large Language Model (LLM).
[0159] Based on the same inventive concept, as an implementation of the above method, an embodiment of the present application also provides a text editing device, which corresponds to the aforementioned method embodiment. For ease of reading, this embodiment will no longer repeat the details of the aforementioned method embodiment one by one, but it should be clear that the text editing device in this embodiment can correspond to all the contents in the aforementioned method embodiment.
[0160] The present application embodiment provides a text editing device, Figure 6 is a structural diagram of the text editing device, such as Figure 6 As shown, the text editing device 600 includes:
[0161] The subject determination unit 61 is used to determine the subject object of the current sentence during the text input process of the user;
[0162] An event determination unit 62, configured to determine an associated event associated with the subject object according to the text content input by the user;
[0163] A generating unit 63, configured to generate a query statement based on the subject object and the associated event;
[0164] An execution unit 64, configured to execute the query statement to obtain at least one data indicator associated with the subject object and the associated event;
[0165] The expansion unit 65 is used to expand the current statement according to the at least one data indicator.
[0166] As an optional implementation of an embodiment of the present application, the topic determination unit 61 is specifically used to extract a first number of objects according to the importance of each object in the current sentence to obtain a first object sequence; obtain a second object sequence according to the semantic information of the current sentence; extract a second number of objects according to the popularity of each object in the current sentence to obtain a third object sequence; determine the topic object of the current sentence based on the first object sequence, the second object sequence and the third object sequence.
[0167] As an optional implementation of the embodiment of the present application, the topic determination unit 61 is specifically used to obtain the word frequency and inverse document frequency of each object in the current sentence; calculate the importance of each object in the current sentence based on the word frequency and inverse document frequency of each object in the current sentence; and combine the first number of objects with the highest importance into the first object sequence.
[0168] As an optional implementation of an embodiment of the present application, the topic determination unit 61 is specifically used to perform a sentence embedding operation on the current sentence to obtain a sentence embedding vector of the current sentence; obtain a target sentence vector with the greatest similarity to the sentence embedding vector in a preset sentence vector set; and obtain an object sequence corresponding to the target sentence vector based on a preset correspondence as the second object sequence.
[0169] As an optional implementation of the embodiment of the present application, the topic determination unit 61 is specifically used to obtain the number of queries for each object in the current statement within a preset time length; obtain the popularity of each object in the current statement based on the number of queries for each object in the current statement; and combine the second number of objects with the highest popularity into the third object sequence.
[0170] As an optional implementation of an embodiment of the present application, the topic determination unit is specifically used to calculate the weight value of each object based on the weight coefficient of each position in the first object sequence, the weight coefficient of each position in the second object sequence, and the weight coefficient of each position in the third object sequence; and select the object with the largest weight value as the topic object of the current sentence.
[0171] As an optional implementation of the embodiment of the present application, the event determination unit 62 is specifically used to obtain all events corresponding to the subject object based on a preset mapping relationship; obtain context information of the subject object according to the text content input by the user; and select an event associated with the subject object from all events corresponding to the subject object according to the context information to obtain the associated event.
[0172] As an optional implementation of the embodiment of the present application, the generation unit 63 is specifically used to determine at least one data indicator based on the subject object and the associated event; and generate a query statement based on each indicator of the at least one data indicator.
[0173] As an optional implementation of the embodiment of the present application, the expansion unit 65 is also used to display the expanded content corresponding to the current sentence in a first text format after the current sentence is expanded according to the at least one data indicator, and the first text format is different from the second text format, and the second text format is the format of the text content input by the user; in response to the user's confirmation operation on the expanded content, the expanded content is converted from the first text format to the second text format; in response to the user's text input operation, the expanded content is deleted.
[0174] The text editing device provided in the embodiment of the present application can execute the text editing method provided in any of the above embodiments, and its implementation principle and technical effect are similar, which will not be repeated here.
[0175] Based on the same inventive concept, an embodiment of the present application also provides an electronic device. Figure 7 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application, such as Figure 7 As shown, the electronic device provided in this embodiment includes: a memory 701 and a processor 702, wherein the memory 701 is used to store a computer program, and the processor 702 is used to execute the text editing method provided in the above embodiment when executing the computer program.
[0176] Based on the same inventive concept, an embodiment of the present application further provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the computing device implements the text editing method provided in the above embodiment.
[0177] Based on the same inventive concept, an embodiment of the present application further provides a computer program product. When the computer program product is executed on a computer, the computing device implements the text editing method provided in the above embodiment.
[0178] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems, or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the present application may adopt the form of a computer program product implemented on one or more computer-usable storage media that include computer-usable program code.
[0179] The processor can be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), dedicated injection circuits,
[0180] (Application Specific Integrated Circuit, ASIC), off-the-shelf programmable gate array (Field-Programmable Gate Array, FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor can be a microprocessor or the processor can also be any conventional processor, etc.
[0181] The memory may include non-permanent memory in a computer-readable medium, random access memory (RAM) and / or non-volatile memory in the form of read-only memory (ROM) or flash RAM. The memory is an example of a computer-readable medium.
[0182] Computer readable media include permanent and non-permanent, removable and non-removable storage media. Storage media can be implemented by any method or technology to store information, and the information can be computer-readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, magnetic disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer readable media does not include temporary computer readable media (transitory media), such as modulated data signals and carrier waves.
[0183] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit it. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some or all of the technical features therein, and these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the various embodiments of the present application.
Claims
1. A text editing method, characterized in that: include: During the text input process by the user, determining the subject object of the current sentence; Determining an associated event associated with the subject object according to the text content input by the user; Generate a query statement based on the subject object and the associated event; Execute the query statement to obtain at least one data indicator associated with the subject object and the associated event; The current statement is expanded according to the at least one data indicator.
2. The method according to claim 1, characterized in that: Determining the subject object of the current sentence includes: Extracting a first number of objects according to the importance of each object in the current sentence to obtain a first object sequence; Acquire a second object sequence according to the semantic information of the current sentence; Extracting a second number of objects according to the heat of each object in the current statement to obtain a third object sequence; A subject object of a current sentence is determined based on the first object sequence, the second object sequence, and the third object sequence.
3. The method according to claim 2, characterized in that The step of extracting a first number of objects according to the importance of each object in the current sentence to obtain a first object sequence includes: Get the term frequency TF and inverse document frequency IDF of each object in the current sentence; Calculate the importance of each object in the current sentence based on the TF and IDF of each object in the current sentence; A first number of objects with the highest importance are combined into the first object sequence.
4. The method according to claim 2, characterized in that: The step of acquiring a second object sequence according to the semantic information of the current sentence includes: Perform sentence embedding operation on the current sentence to obtain the sentence embedding vector of the current sentence; Obtain a target sentence vector having the greatest similarity to the sentence embedding vector in a preset sentence vector set; Based on a preset corresponding relationship, an object sequence corresponding to the target sentence vector is obtained as the second object sequence.
5. The method according to claim 2, characterized in that: The step of extracting a second number of objects according to the heat of each object in the current statement to obtain a third object sequence includes: Get the query count of each object in the current statement within the preset time length; Get the popularity of each object in the current statement based on the query count of each object in the current statement; The second number of objects with the highest heat levels are combined into the third object sequence.
6. The method according to claim 2, characterized in that The determining the subject object of the current sentence based on the first object sequence, the second object sequence, and the third object sequence includes: Calculating a weight value of each object according to a weight coefficient of each position in the first object sequence, a weight coefficient of each position in the second object sequence, and a weight coefficient of each position in the third object sequence; The object with the largest weight value is selected as the subject object of the current sentence.
7. The method according to claim 1, characterized in that The determining of the associated event associated with the subject object according to the text content input by the user includes: Acquire all events corresponding to the subject object based on a preset mapping relationship; Acquiring context information of the subject object according to the text content input by the user; An event associated with the subject object is selected from all events corresponding to the subject object according to the context information to obtain the associated event.
8. The method according to claim 1, characterized in that The generating of a query statement based on the subject object and the associated event includes: determining at least one data indicator based on the subject object and the associated event; A query statement is generated based on each indicator of the at least one data indicator.
9. The method according to claim 1, characterized in that: After expanding the current statement according to the at least one data indicator, the method further includes: Displaying the extended content corresponding to the current sentence after the current sentence in a first text format, wherein the first text format is different from a second text format, and the second text format is a format of the text content input by the user; In response to a user confirmation operation on the extended content, the extended content is converted from the first text format to the second text format, or in response to a user text input operation, the extended content is deleted.
10. A text editing device, characterized in that: include: A subject determination unit, used to determine the subject object of the current sentence during the text input process of the user; An event determination unit, configured to determine an associated event associated with the subject object according to the text content input by the user; A generating unit, configured to generate a query statement based on the subject object and the associated event; An execution unit, configured to execute the query statement to obtain at least one data indicator associated with the subject object and the associated event; An expansion unit is used to expand the current statement according to the at least one data indicator.
11. An electronic device, characterized in that: include: A memory and a processor, wherein the memory is used to store a computer program and the processor is used to enable the electronic device to implement the text editing method according to any one of claims 1 to 9 when executing the computer program.
12. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a computing device, the computing device implements the text editing method according to any one of claims 1 to 9.
13. A computer program product, characterized in that When the computer program product runs on a computer, the computer is enabled to implement the text editing method according to any one of claims 1 to 9.