A method and system for assisting in the revision of written text
By extracting entity text and projecting multi-dimensional space from user text descriptions, a scene polyhedron is constructed. Feature encoding and convolution processing are then performed using a writing error detection model, which solves the problem of insufficient scene adaptation in existing technologies. This enables accurate identification and processing of writing scenarios with interwoven multi-element elements, thereby improving writing quality and efficiency.
Patent Information
- Application Number
- CN202511096490.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-08-06
- Publication Date
- 2025-12-05
- Estimated Expiration
- 2045-08-06
AI Technical Summary
Existing text writing correction and assistance technologies have limitations in scene adaptation and cannot truly reflect writing scenarios with multiple intertwined elements, resulting in single scene tags being unable to accurately identify and process the user's writing intent.
By acquiring user text descriptions, extracting and sorting entity texts, performing multi-dimensional spatial projection and context fusion, constructing scene polyhedrons, and using a writing error detection model for multi-head self-attention feature encoding and convolution processing, scene-aware feature vectors are generated, and error types and location identifiers are output.
It achieves accurate identification and processing of writing scenarios with multiple interwoven elements, which can more realistically reflect the user's writing intentions and improve writing quality and efficiency.
Smart Images

Figure CN120596674B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of artificial intelligence, and in particular to a text writing revision auxiliary method and system. BACKGROUND
[0002] In the digital age of information explosion, the application scenarios of text writing are becoming more and more extensive. No matter it is daily communication, academic creation, or business document writing, official document processing, etc., higher requirements are put forward for the efficiency and quality of writing, which makes the demand for text writing assistance continue to rise.
[0003] At present, the revision assistance technology for text writing has gradually developed, covering grammar correction, semantic fluency optimization or format specification verification, etc. In order to be closer to the user's use intention, the application scenario is used in the revision assistance of text writing to adapt to the specific writing specifications and expression habits in different scenarios, such as focusing on the accuracy of terminology and the standardization of citation format in academic scenarios, and focusing on the professionalism and etiquette of diction in business scenarios.
[0004] However, the existing mainstream assistance method still has significant limitations in scene adaptation. The core problem is that the recognition and processing of application scenarios still stay in the stage of single labeling, that is, the writing content is usually simply classified into a certain preset scene category, and then the fixed revision logic under this category is applied. However, in real writing, the scene is often a multi-element interwoven one, and a single scene label cannot truly reflect the user's writing intention. SUMMARY
[0005] The embodiments of the present application provide a text writing revision auxiliary method and system, which retains the multi-dimensional characteristics of the scene, thereby solving the problem that the single scene label in the prior art cannot reflect the real scene of multi-element interweaving.
[0006] An embodiment of the present application provides a text writing revision auxiliary method, comprising:
[0007] obtaining a current text description of a user;
[0008] extracting all entity texts in the current text description, and performing semantic sorting on each entity text to generate an entity text sequence;
[0009] inputting each entity text in the entity text sequence into a preset word vector model, identifying the specification score, the sentiment score and the writing object level of each entity text, and performing spatial projection to obtain a corresponding first projection point;
[0010] For each entity text, taking the entity text as a center text, taking the entity texts in a preset window on both sides of the center text as context support texts, performing attention weighted fusion on the projection points of the center text according to the projection points of the context support texts, and obtaining corresponding second projection points;
[0011] According to all the second projection points, a current scene polyhedron is constituted;
[0012] The first projection points of the entity text sequence and the current scene polyhedron are input into the trained writing error detection model, so that the writing error detection model performs multi-head self-attention feature coding on the first projection points of the entity text sequence to generate a text feature vector; the current scene polyhedron is discretized into a 3D grid for convolution processing to generate a scene vector; the scene vector is weighted and fused based on the text feature vector to obtain a scene-aware feature vector; the scene-aware feature vector is decoded to output an error type prediction and a position identification;
[0013] The error type prediction and the position identification are pushed to the user.
[0014] Further, after the error type prediction and the position identification are pushed to the user, the method further comprises:
[0015] Based on the error type prediction and the position identification, a pre-corrected text description is obtained;
[0016] The pre-corrected text description and the current scene polyhedron are input into a preset multi-dimensional knowledge material model, so that the multi-dimensional knowledge material model performs semantic analysis on the pre-corrected text description to obtain all valid texts in the pre-corrected text description, and performs semantic sorting on each valid text to generate a valid text sequence; wherein all valid texts include all entity texts and all non-entity texts;
[0017] Each valid text in the valid text sequence is input into a preset word vector model to identify the specification score, the sentiment score and the writing object level of each valid text, and to perform spatial projection to obtain corresponding third projection points;
[0018] According to the second projection points of the entity texts and the corresponding third projection points, an affine transformation matrix is determined;
[0019] According to the affine transformation matrix, the third projection points of each valid text are transformed to obtain fourth projection points of each valid text;
[0020] Obtain the projection point set of each material in the material library;
[0021] According to the intersection over union of the current text volume and the material volume, determine the relevant material; wherein the current text volume is constituted by the fourth projection points of each valid text, and the material volume is constituted by the projection point set of the material.
[0022] Pushing related materials to a user.
[0023] Further, all entity texts in the current literal description are extracted, including:
[0024] The current literal description is input into an entity text extraction model, so that the entity text extraction model performs word segmentation and cleaning on the current literal description to obtain preprocessed segmented texts;
[0025] The preprocessed segmented texts are mapped to a preset entity type set through a full connection layer and a softmax classifier to obtain a plurality of entity texts.
[0026] Further, the entity texts are semantically sorted to generate an entity text sequence, including:
[0027] The entity texts are randomly sorted to generate a first to-be-verified text sequence;
[0028] Any entity text in the first to-be-verified text sequence is taken as a swap text, and the iteration inversion operation is repeatedly executed to obtain an entity text sequence;
[0029] The iteration inversion operation includes:
[0030] The remaining entity texts in the current first to-be-verified text sequence except the current fixed text are taken as current selectable texts; wherein the current first to-be-verified text sequence at the initial time is the first to-be-verified text sequence, and the current fixed text at the initial time is the swap text;
[0031] The current swap text and the current selectable text are positionally exchanged to generate a plurality of second to-be-verified text sequences; wherein the current swap text at the initial time is the swap text;
[0032] The current first to-be-verified text sequence and each second to-be-verified text sequence are respectively inverted through a preset inversion model to generate corresponding inverted literal descriptions;
[0033] The similarity of each inverted literal description and the current literal description is calculated to obtain a corresponding similarity result;
[0034] An entity text is selected from the current selectable text as the current swap text in the next iteration inversion operation, and is combined with the current fixed text to form an updated fixed text;
[0035] In the case where the current selectable text is less than a preset threshold, the to-be-verified text sequence corresponding to the maximum similarity result is taken as the entity text sequence;
[0036] Otherwise, the to-be-verified text sequence corresponding to the maximum similarity result is taken as the current first to-be-verified text sequence when the next iteration inversion operation is performed, and the updated fixed text is taken as the current fixed text when the next iteration inversion operation is performed.
[0037] Further, the text writing correction auxiliary method further comprises:
[0038] Obtaining a marked text in the current text description by a user;
[0039] Generating an importance weighting matrix according to the current text description and the marked text;
[0040] Inverting the current first to-be-verified text sequence and each second to-be-verified text sequence respectively through a preset inversion model to generate corresponding inversion text descriptions, comprising:
[0041] Inverting the current first to-be-verified text sequence and each second to-be-verified text sequence respectively through the preset inversion model based on the importance weighting matrix to generate corresponding inversion text descriptions.
[0042] Further, the feature encoding of each first projection point of the entity text sequence is performed through multi-head self-attention to generate a text feature vector, comprising:
[0043] Performing linear transformation on each first projection point of the entity text sequence to obtain a query matrix, a key matrix and a value matrix;
[0044] Dividing the query matrix, the key matrix and the value matrix according to a single-head feature dimension to obtain a plurality of groups of sub-matrices;
[0045] After self-attention calculation is performed on each group of sub-matrices, transverse splicing is performed to obtain a multi-head fusion matrix;
[0046] Performing global average pooling on the multi-head fusion matrix to obtain a text feature vector corresponding to the entity text sequence.
[0047] Further, the current scene polyhedron is discretized into a 3D grid for convolution processing to generate a scene vector, comprising:
[0048] Performing spatial discretization operation on the current scene polyhedron to obtain a binary 3D grid matrix;
[0049] Repeating the 3D convolution operation and the pooling operation until the spatial dimension of the pooled feature map is less than a preset threshold to obtain a high-order pooled feature vector corresponding to the final pooled feature map;
[0050] Adjusting the dimension of the high-order pooled feature vector to a preset dimension through linear transformation to obtain a scene vector;
[0051] The 3D convolution operation comprises: performing 3D convolution operation on the 3D grid matrix through a preset number of 3D convolution kernels to obtain a convolution feature map.
[0052] The pooling operation comprises: performing 3D pooling operation on the convolution feature map to obtain a pooled feature map.
[0053] Further, after the error type prediction and the position identification are pushed to the user, the method further comprises:
[0054] obtaining modification feedback of the user; the modification feedback comprises: accepting modification or rejecting modification;
[0055] After a preset number of modification feedbacks are collected, the model parameters in the writing error detection model are adjusted according to the preset number of modification feedbacks to obtain an updated writing error detection model;
[0056] The updated writing error detection model is used in next-time writing correction assistance.
[0057] On the basis of the above method embodiment, the application correspondingly provides a system embodiment, which comprises: a text description acquisition module, an entity text extraction module, an entity text projection module, a projection adaptive fusion module, a scene polyhedron construction module, a writing error detection module and an error pushing module.
[0058] The text description acquisition module is configured to acquire the current text description of the user.
[0059] The entity text extraction module is configured to extract all entity texts in the current text description, perform semantic sorting on the entity texts, and generate an entity text sequence.
[0060] The entity text projection module is configured to input each entity text in the entity text sequence into a preset word vector model, identify the specification score, the sentiment score and the writing object level of each entity text, and perform spatial projection to obtain a corresponding first projection point.
[0061] The projection adaptive fusion module is configured to, for each entity text, take the entity text as a center text, take the entity texts in a preset window on both sides of the center text as context support texts, perform attention weighted fusion on the projection point of the center text according to the projection points of the context support texts, and obtain a corresponding second projection point.
[0062] The scene polyhedron construction module is configured to construct a current scene polyhedron according to all second projection points.
[0063] The writing error detection module is configured to input the current literal description and the current scene polyhedron thereof into the trained writing error detection model, so that the writing error detection model performs multi-head self-attention feature coding on the entity text sequence to generate a text feature vector; the current scene polyhedron is discretized into a 3D grid for convolution processing to generate a scene vector; the scene vector is used to perform weighted fusion on the text feature vector to obtain a scene-aware feature vector; and the scene-aware feature vector is decoded to output an error type prediction and a position identifier.
[0064] The error pushing module is configured to push the error type prediction and the position identifier to the user.
[0065] Further, the literal writing correction auxiliary system further comprises a pre-correction module, a material determination module and a material pushing module.
[0066] The pre-correction module is configured to pre-correct the current literal description based on the error type prediction and the position identifier to obtain a pre-corrected literal description.
[0067] The material determination module comprises an effective text extraction unit, an effective text projection unit, an affine matrix determination unit, an affine transformation unit, a material acquisition unit and a related material confirmation unit.
[0068] The effective text extraction unit is configured to input the pre-corrected literal description and the current scene polyhedron into a preset multi-dimensional knowledge material model, so that the multi-dimensional knowledge material model performs semantic analysis on the pre-corrected literal description to obtain all effective texts in the pre-corrected literal description, and performs semantic sorting on each effective text to generate an effective text sequence; wherein all the effective texts comprise all entity texts and all non-entity texts.
[0069] The effective text projection unit is configured to input each effective text in the effective text sequence into a preset word vector model to identify the specification score, the sentiment score and the writing object level of each effective text, and perform spatial projection to obtain a corresponding third projection point.
[0070] The affine matrix determination unit is configured to determine an affine transformation matrix according to the second projection point of the entity text and the corresponding third projection point.
[0071] The affine transformation unit is configured to transform the third projection point of each effective text according to the affine transformation matrix to obtain a fourth projection point of each effective text.
[0072] The material acquisition unit is configured to acquire a projection point set of each material in a material library.
[0073] The related material confirmation unit is configured to determine the related material according to an intersection-union ratio of a current text volume and each material volume, wherein the current text volume is composed of fourth projection points of each valid text, and the material volume is composed of a projection point set of the material.
[0074] The material pushing module is configured to push the related material to the user.
[0075] Compared with the prior art, the beneficial effects of the present application are as follows:
[0076] The present application obtains the current literal description of the user, extracts all entity texts in the current literal description, excludes redundant information interference, performs semantic sorting on each entity text, and generates an entity text sequence. Then, each entity text in the entity text sequence is input into a preset word vector model, the specification score, the sentiment score and the writing object level of each entity text are identified, and spatial projection is performed to obtain the corresponding first projection point, so as to convert the entity into a quantifiable three-dimensional space coordinate, and the richness of the feature is retained. For each entity text, the entity text is taken as a center text, the entity texts in the preset window on both sides of the center text are taken as context support texts, the projection points of the context support texts are used to perform attention weighted fusion on the projection point of the center text, so that the entity feature is dynamically adjusted through the context, and the corresponding second projection point is obtained, so that the entity feature is more suitable for the actual semantics in the specific scene. According to all the second projection points, a current scene polyhedron is formed, the polyhedron structure in the three-dimensional space is used to represent the scene, the second projection points of multiple entities jointly form the polyhedron, each vertex represents an entity and its literal meaning of the scene, and the spatial relationship between the vertices reflects the interweaving logic of the entities, so that the multi-dimensional characteristics of the scene are completely retained, instead of simplifying the scene into a single category, and the writing intention of the user can be more truly reflected. Finally, each first projection point of the entity text sequence and the current scene polyhedron are input into the trained writing error detection model, so that the writing error detection model performs multi-head self-attention feature coding on each first projection point of the entity text sequence, generates a text feature vector, discretizes the current scene polyhedron into a 3D grid for convolution processing, generates a scene vector, performs weighted fusion on the text feature vector based on the scene vector, obtains a scene-aware feature vector, decodes the scene-aware feature vector, and outputs an error type prediction and a position identifier. The error type prediction and the position identifier are pushed to the user.
[0077] In summary, the present application extracts entity texts and performs multi-dimensional spatial projection, fuses the context to construct a scene polyhedron to represent a real scene with multiple elements interwoven, and realizes scene-aware writing error detection through the fusion of scene features and text features, thereby solving the problem that a single scene label cannot reflect a real scene with multiple elements interwoven in the prior art. BRIEF DESCRIPTION OF DRAWINGS
[0078] Figure 1 is a flowchart of a text writing revision assistance method provided by an embodiment of the present application;
[0079] Figure 2 is a structural diagram of a text writing revision assistance system provided by an embodiment of the present application. DETAILED DESCRIPTION
[0080] The technical solutions in the embodiments of the present application will be clearly and completely described in conjunction with the accompanying drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, rather than all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by a person of ordinary skill in the art without creative labor fall within the protection scope of the present application.
[0081] In the description of the present application, it should be understood that the terms "first", "second" are only for the purpose of description, and cannot be understood as indicating or implying relative importance or implicitly indicating the number of the indicated technical features.
[0082] As shown in Figure 1 In order to solve the problem that a single scene tag cannot reflect the real scene of multi-element interweaving in the prior art, an embodiment of the present application provides a text writing revision assistance method, which at least includes the following steps:
[0083] Step S1: obtaining a current text description of a user;
[0084] For step S1, the original text content that the user is creating or to be revised is collected by the text writing revision assistance system, which can be a mail draft, a report text or a government notice, etc.
[0085] It should be noted that the acquisition method of the current text description is not limited to traditional manual text input. Speech-to-text is also an efficient and convenient input form. Through integrated speech recognition technology, the user's spoken speech content can be converted into text form in real time as the current text description to be processed, so that the text content generated in the case of fast recording or instant creation of the user can be effectively acquired.
[0086] Step S2: extracting all entity texts in the current text description, and performing semantic sorting on each entity text to generate an entity text sequence;
[0087] In a preferred embodiment, all entity texts in the current text description are extracted, including:
[0088] input the current literal description into the entity text extraction model to make the entity text extraction model perform word segmentation and cleaning on the current literal description to obtain preprocessed segmented text;
[0089] map the preprocessed segmented text to a preset entity type set through a full connection layer and a softmax classifier to obtain several entity texts.
[0090] For step S2, the current literal description obtained in step S1 is input into the entity text extraction model. The entity text extraction model first performs a word segmentation operation on the current literal description, splits the continuous text into meaningful lexical units through the BERT segmentation algorithm in natural language processing, and simultaneously performs cleaning to remove punctuation and stop words, which are text without substantive or low semantic contribution such as "of" and "of". The preprocessed segmented text is obtained. Next, the full connection layer in the entity text extraction model is used to convert the features of the segmented text, map each segmented word to a fixed-dimensional feature vector, and convert the text information into a numerical representation that can be processed by a computer. Then, through the softmax classifier, each segmented vector is mapped to a pre-set entity type set, such as a person, a place, a time, or a thing, and the probability distribution of each entity type to which the segmented word belongs is output. Subsequently, the segmented words with a probability exceeding a pre-set confidence threshold in the probability distribution are selected and determined as entities of the corresponding entity type, so that several entity texts representing specific semantics and belonging to various entity types are identified and extracted.
[0091] It should be noted that the entity text extraction model is constructed and trained based on the BERT model. Specifically, a plurality of first training literal descriptions are obtained, the first training literal descriptions cover texts in multiple fields, such as business emails, literary works, or official documents, etc., to ensure the model's applicability to a wide range of fields. Each first training literal description is manually annotated with entities to obtain corresponding first entity annotated texts. Then, the plurality of training literal descriptions and the corresponding first entity annotated texts are input into the entity text extraction model to be trained, so that the entity text extraction model performs forward propagation on each training literal description. First, the BERT layer built-in the model performs word segmentation on each training literal description through the BERT analysis algorithm to obtain a plurality of subwords, and then the full connection layer built-in the model further maps the subwords to feature vectors. Finally, the softmax layer built-in the model outputs the predicted probability distribution of each position entity type. Then, the first cross-entropy loss is calculated based on the predicted probability distribution and the first entity annotated text, and the model parameters are adjusted layer by layer based on the loss using a backpropagation algorithm such as the Adam optimizer. The training process is repeatedly iterated until the loss converges and the model prediction stabilizes, and a trained entity text extraction model that can accurately extract entities is obtained.
[0092] After the entity texts are identified from the current literal description, the entity texts are unordered lexical units and cannot reflect semantic correlations therebetween, and therefore the entity text sequence needs to be generated through semantic ordering.
[0093] In a preferred embodiment, the semantic ordering is performed on each entity text to generate an entity text sequence, including:
[0094] The random ordering is performed on each entity text to generate a first to-be-verified text sequence;
[0095] Any entity text in the first to-be-verified text sequence is taken as a swap text, and the iteration inversion operation is repeatedly performed to obtain an entity text sequence;
[0096] The iteration inversion operation includes:
[0097] The remaining entity texts in the current first to-be-verified text sequence except for a current fixed text are taken as a current selectable text; wherein the current first to-be-verified text sequence at the initial time is the first to-be-verified text sequence, and the current fixed text at the initial time is the swap text;
[0098] The current swap text and the current selectable text are subjected to position swapping to generate a plurality of second to-be-verified text sequences; wherein the current swap text at the initial time is the swap text;
[0099] The current first to-be-verified text sequence and each second to-be-verified text sequence are respectively subjected to inversion through a preset inversion model to generate corresponding inversion literal descriptions;
[0100] The similarity of each inversion literal description and the current literal description is calculated to obtain a corresponding similarity result;
[0101] An entity text is selected from the current selectable text as a current swap text in the next iteration inversion operation, and is combined with the current fixed text to form an updated fixed text;
[0102] In a case where the current selectable text is less than a preset threshold, the to-be-verified text sequence corresponding to the maximum similarity result is taken as the entity text sequence;
[0103] Otherwise, the to-be-verified text sequence corresponding to the maximum similarity result is taken as the current first to-be-verified text sequence in the next iteration inversion operation, and the updated fixed text is taken as the current fixed text in the next iteration inversion operation.
[0104] In an embodiment of the present application, first, the extracted entity texts are randomly ordered to generate a first to-be-verified text sequence, and then any entity text in the sequence is selected as a swap text to enter the following iteration inversion operation:
[0105] The remaining entity texts in the current first to-be-verified text sequence except the current fixed text are taken as current optional texts, wherein the initial fixed text is the exchange text, the current exchange text is exchanged with each current optional text respectively to generate a plurality of second to-be-verified text sequences, and the possibility of entity position adjustment can be comprehensively traversed in this way of two-by-two exchange; the current first to-be-verified text sequence and each second to-be-verified text sequence are inversed respectively through a preset inversion model to obtain corresponding inversion textual descriptions; the similarity of the inversion textual descriptions and the current textual description is calculated through cosine similarity, the sequence with the highest similarity is selected as the optimization result of the current round, and the next exchange text is determined from the current optional texts to form an updated fixed text together with the current fixed text, and the remaining entity texts are taken as new current optional texts; the above iteration and inversion operation is repeated until the number of current optional texts is less than a preset threshold, which is 2 in the embodiment, and the to-be-verified text sequence corresponding to the maximum similarity result is taken as the final entity text sequence, which accurately reflects the real semantic association between entities through iteration and optimization of entity positions and combination of the semantic matching degree of the inversion text and the original text.
[0106] It should be noted that the inversion model adopts a Transformer encoder-decoder architecture and is trained in the following manner: first, training data covering multiple fields are obtained, including a plurality of entity sequences and corresponding second training textual descriptions, the entity sequences and the corresponding second training textual descriptions are input into the inversion model to be trained, the input entity sequences are encoded into hidden vector representations by the built-in encoder to capture the semantic association between entities; the first inversion textual description is generated based on the hidden vector by the built-in decoder, and during training, the cross-entropy loss function is used to calculate the difference between the first inversion textual description generated by the decoder and the second training textual description, and the parameters of the encoder and the decoder are iteratively optimized through the back propagation algorithm until the second cross-entropy loss of the first inversion textual description and the second training textual description converges, and finally the inversion model that can accurately restore the entity sequence to the first inversion textual description conforming to the semantic logic is obtained.
[0107] The present application reorganizes discrete entity texts into an ordered sequence with strong semantic association by iteratively optimizing entity positions and combining the semantic matching degree of the inversion text and the original text, and accurately reflects the real semantic association between entities.
[0108] In a preferred embodiment, the text writing correction assistance method further comprises:
[0109] Obtaining the marked text of the user in the current textual description;
[0110] Generating an importance weighting matrix according to the current textual description and the marked text;
[0111] The preset inversion model is used to respectively invert the current first to-be-verified text sequence and each second to-be-verified text sequence to generate corresponding inverted textual descriptions, including:
[0112] The preset inversion model is used to respectively invert the current first to-be-verified text sequence and each second to-be-verified text sequence based on the importance weighting matrix to generate corresponding inverted textual descriptions.
[0113] In an embodiment of the present application, the user may specify some text as important content in the current textual description by manual marking, such as bold, highlight or annotation, and the marked text corresponds to the extracted entity text, which reflects the user's attention priority for specific information.
[0114] According to the entity set of the current textual description and the marked text, a weight value is assigned to each entity text, wherein the entity corresponding to the marked text is assigned a higher weight, such as a weight value of 1.5, and the unmarked entity is assigned a basic weight, such as a weight value of 1.0. These weight values are stored in the form of a matrix, the row or column corresponds to the entity serial number, and the matrix element is the weight value, forming an importance weighting matrix for quantifying the user's attention to the entity.
[0115] In the process of semantic sorting of each entity text, the inversion model first converts each entity in the sequence into an embedding vector before encoding the current first to-be-verified text sequence or each second to-be-verified text sequence, that is, the entity vocabulary is mapped to a high-dimensional semantic vector through the word embedding layer set in the model; then, the importance weighting matrix is used to perform element-by-element weighting operation on these embedding vectors, and the embedding vector of the user-marked entity is significantly amplified in the operation due to the higher weight, while the embedding vector of the unmarked entity maintains the basic weight. This weighting method allows the model to preferentially capture the semantic association between the high-weight entity and other entities in the encoding stage. After completing the encoding, the decoder in the inversion model generates a second inverted textual description based on the hidden vector obtained by encoding. Since the semantics of the high-weight entity has been highlighted in the encoding stage, the generated second inverted textual description will focus more on the important entities marked by the user.
[0116] Step S3: respectively input each entity text in the entity text sequence into the preset word vector model, identify the specification score, sentiment score and writing object level of each entity text, and perform spatial projection to obtain corresponding first projection points;
[0117] For step S3, each entity text in the entity text sequence is input into the preset word vector model one by one, and the word vector model has determined the specification score, sentiment score and writing object level of a plurality of texts through training. For example, for the entity text "cooperation agreement", a higher specification score is obtained because it conforms to the business scenario specification, a positive sentiment score is obtained because it implies positive cooperation, and a corresponding high-level writing object level is obtained because it involves important cooperation parties. Then, the quantification results of the three dimensions are respectively mapped to the X-axis, Y-axis and Z-axis of the three-dimensional semantic space. Through this mapping mode, each entity text will form a unique corresponding coordinate point in the three-dimensional semantic space, thereby completing the conversion of the entity text from semantic features to spatial position.
[0118] It should be noted that the present application uses a pre-trained Word2vec model as the word vector model to be trained, obtains a plurality of second entity annotated texts and the specification annotation score, sentiment annotation score and writing object annotation level corresponding to the second entity annotated texts, inputs these texts into the word vector model to be trained to obtain the corresponding specification prediction score, sentiment prediction score and writing object prediction level, then calculates the mean square error loss of the three dimensions according to the specification annotation score and specification prediction score, sentiment annotation score and sentiment prediction score, and writing object annotation level and writing object prediction level, respectively, and assigns corresponding weight values to the losses of different dimensions, and then calculates the total mean square error loss, which is fed back to the model through the back propagation algorithm, and the model parameters are adjusted constantly, so that the model gradually learns to accurately predict the specification score, sentiment score and writing object level of the entity text from the word vector features until the total mean square error loss converges. At this time, the obtained model is the preset word vector model used in step S3.
[0119] Step S4: For each entity text, the entity text is taken as a center text, and the entity texts within the preset window on both sides of the center text are taken as context supporting texts. The projection points of the context supporting texts are used to perform attention weighted fusion on the projection point of the center text to obtain a corresponding second projection point.
[0120] For step S4, when processing the entity text sequence, each entity text is regarded as the center text, and the entity texts within the preset window range on both sides thereof are regarded as the context supporting texts, for example, the entity text sequence is [A, B, C, D, E, F], when the window size is set to 2 and the center text is A, the context supporting texts thereof include B and C on the right side; when the center text is B, the context supporting texts thereof include A on the left side and C and D on the right side; when the center text is C, the context supporting texts thereof include A and B on the left side and D and E on the right side. Based on the first projection points of the context supporting texts in the three-dimensional semantic space, the correlation strength between the center text and each context supporting text is calculated through the attention mechanism, specifically, the cosine similarity between the center text and each context supporting text is calculated, which is used to measure the direction consistency of the semantic vectors, and then, the similarity is normalized into the attention weight by using the softmax function. With the first projection point of the center text as the benchmark, the difference between each context supporting text projection point and the center projection point is calculated, and the weighted sum of the differences is calculated according to the corresponding attention weight, and finally, the weighted total deviation is superimposed on the center projection point to generate the second projection point.
[0121] According to the application, by fusing the context information, if the semantic correlation between the context supporting text and the center text is strong, the difference between the projection points after weighting will strengthen the semantic of the center text; if the semantic correlation is weak, the difference after weighting only fine-tunes the semantic of the center text, so that the second projection point can reflect the semantic of the entity in the specific context while retaining the basic semantic of the center text, compared with the first projection point.
[0122] Step S5: according to all the second projection points, a polyhedron in the current scene is formed;
[0123] For step S5, all the second projection points generated in step S4 are regarded as the vertices, and a polyhedron structure in a high-dimensional semantic space is formed through geometric connection, and the geometric characteristics of the polyhedron directly reflect the semantic relationship network between entities.
[0124] The present application realizes multi-dimensional quantitative analysis of the text scene by constructing a scene polyhedron, and converts the originally abstract text scene from qualitative description into quantitative indicators that can be calculated and compared. The volume of the polyhedron can intuitively quantify the semantic richness of the scene. The larger the volume, the more extensive the semantic dimensions of the entity text involved in the text, such as the specification score, the sentiment score, and the level of the writing object, and the more comprehensive the information covered. The center of gravity of the polyhedron can accurately locate the semantic center of the scene, and its coordinates are calculated by the average of all second projection points, which can reflect the semantic tendency of the whole text. For example, in the official document scene, if the center of gravity is biased towards the high specification score and high level writing object area, it indicates that the whole text conforms to the formal and authoritative expression characteristics. At the same time, by detecting the distribution dispersion degree of the polyhedron vertex, the coherence of the text can be effectively evaluated. If the vertex distribution is compact, it means that the semantic correlation between entities is close, and the text logic is coherent. If the vertex is excessively dispersed, or even an isolated point deviating from the overall distribution appears, it indicates that the text may have theme jumping or expression contradiction.
[0125] Step S6: input each first projection point of the entity text sequence and the current scene polyhedron into the trained writing error detection model, so that the writing error detection model performs multi-head self-attention feature encoding on each first projection point of the entity text sequence to generate a text feature vector; the current scene polyhedron is discretized into a 3D grid for convolution processing to generate a scene vector; the scene vector is used to weight and fuse the text feature vector to obtain a scene-aware feature vector; and the scene-aware feature vector is decoded to output an error type prediction and a position identification;
[0126] In a preferred embodiment, the multi-head self-attention feature encoding of each first projection point of the entity text sequence generates a text feature vector, including:
[0127] Performing linear transformation on each first projection point of the entity text sequence obtains a query matrix, a key matrix, and a value matrix;
[0128] The query matrix, the key matrix, and the value matrix are divided into several groups of sub-matrices according to the single-head feature dimension;
[0129] After self-attention calculation is performed on each group of sub-matrices, transverse splicing is performed to obtain a multi-head fusion matrix;
[0130] Global average pooling is performed on the multi-head fusion matrix to obtain a text feature vector corresponding to the entity text sequence.
[0131] In a preferred embodiment, the current scene polyhedron is discretized into a 3D grid for convolution processing to generate a scene vector, including:
[0132] Performing spatial discretization operation on the current scene polyhedron obtains a binary 3D grid matrix;
[0133] The 3D convolution operation and the pooling operation are repeatedly performed until the spatial dimension of the pooled feature map is less than a preset threshold, to obtain a high-order pooled feature vector corresponding to a final pooled feature map;
[0134] The dimension of the high-order pooled feature vector is adjusted to a preset dimension through linear transformation, to obtain a scene vector;
[0135] The 3D convolution operation includes: performing 3D convolution operation on the 3D grid matrix through a preset number of 3D convolution kernels to obtain a convolution feature map.
[0136] The pooling operation includes: performing 3D pooling operation on the convolution feature map to obtain a pooled feature map.
[0137] For step S6, the entity text sequence is subjected to error detection through the trained writing error detection model. Specifically, first, the first projection points of the entity text sequence and the current scene polyhedron are input into the trained writing error detection model, and double-channel feature encoding is performed in the writing error detection model. In the text feature encoding channel, the model performs multi-head self-attention feature encoding on each first projection point to generate a text feature vector. In this process, each first projection point is first subjected to linear transformation, mapping the three-dimensional coordinates to a high-dimensional query matrix, key matrix and value matrix. The query matrix is used to locate the semantic requirements of the current entity, the key matrix is used to match the semantic features of other entities, and the value matrix is used to extract the core semantic information of the entity. The three matrices are divided into multiple groups according to a single-head feature dimension, such as dividing a 64-dimensional feature into 8 8-dimensional single-heads, to obtain a plurality of groups of sub-matrices, so that the model can analyze the entity relationship from multiple semantic angles (such as standardization, sentiment orientation and hierarchical correlation) at the same time. Self-attention calculation is performed on each group of sub-matrices. Specifically, the similarity between the query and the key is used to assign weights, and the value matrix is weighted and aggregated to capture the long-distance dependency relationship between entities. The calculation results of all single-heads are horizontally spliced to form a multi-head fusion matrix that fuses multi-perspective semantics. Finally, global average pooling is performed on the multi-head fusion matrix to compress the spatial dimension and retain the global semantics, and finally a text feature vector representing the semantic features of the entire entity text sequence is obtained.
[0138] Meanwhile, in the scene feature encoding channel, the model processes the current scene polyhedron to generate a scene vector. Specifically, first, the scene polyhedron is spatially discretized to divide the three-dimensional space into a grid of a predetermined size, and a binary 3D grid matrix is generated according to whether the vertex falls within the grid, converting the abstract geometric structure into a calculable binary 3D grid matrix; then, high-order scene features are extracted through multiple rounds of 3D convolution and pooling operations, 3D convolution is performed on the 3D grid matrix through a predetermined number of 3D convolution kernels, the local spatial correlation within the grid is captured, a convolution feature map is obtained, and 3D pooling is performed on the convolution feature map to retain key features while reducing the spatial dimension, a pooling feature map is obtained, the convolution and pooling processes are repeated until the spatial dimension of the pooling feature map is less than a predetermined threshold, and a high-order pooling feature vector corresponding to the final pooling feature map is obtained; finally, the dimension of the high-order pooling feature vector is adjusted to a predetermined dimension through linear transformation to form a scene vector that can represent the overall semantic tendency of the scene.
[0139] In the feature fusion stage, the scene vector is input into a weight generation network composed of two fully connected layers to generate a scene-aware weight, the generated scene-aware weight is multiplied element by element with the text feature vector to obtain a weighted scene-aware feature vector. Finally, the scene-aware feature vector is decoded to output the prediction of the error type existing in the entity text sequence, such as specification expression error, syntax error, or improper address, and the corresponding position identifier, such as the position of the entity text with errors.
[0140] It should be noted that the training process of the writing error detection model is based on a multi-stage supervised learning framework, which enables the model to learn to identify error patterns from a three-dimensional semantic space. First, third training textual descriptions in multiple fields are obtained, which cover both texts with errors, such as content containing specification expression flaws, grammatical errors, improper address, etc., and texts without errors. Then, sample projection points and sample scene polyhedrons of entities are generated for each third training textual description, and error types and positions are manually labeled, and no error samples are marked as no error, thereby constructing a training data set containing positive and negative samples. The model adopts a dual-channel architecture, and the text encoder processes the sample projection points based on the multi-head self-attention mechanism, and the scene encoder extracts the geometric features of the sample scene polyhedrons through a 3D convolutional network, and the two are fused through a learnable weight generation network to output classification prediction of error types and regression prediction of error positions. During the training process, the third cross-entropy loss between the classification prediction of error types and the labeled types is calculated to obtain the error type classification loss; the binary cross-entropy loss between the regression prediction of error positions and the labeled positions is calculated to obtain the error position regression loss, and the total loss is calculated by the weighted sum of the error type classification loss and the error position regression loss. According to the total loss, the model parameters of the writing error detection model are adjusted, such as the encoder weights and the fusion network coefficients, and the iterative training is performed until the total loss converges, and the trained writing error detection model is obtained. After the training is completed, the writing error detection model can map the text semantics and scene geometric features, and accurately identify various errors in the text.
[0141] Step S7: Push the error type prediction and position identification to the user.
[0142] For step S7, if step S6 detects an error, the error type prediction and position identification identified by the writing error detection model are displayed to the user in a pop-up window, and the original error position is highlighted simultaneously. If step S6 does not detect an error, the user is fed back through a simple prompt that the text meets the current scene semantic specification and does not need to be corrected, so that the user can clearly know the text detection state.
[0143] The application maps entity text into a first projection point containing a specification score, a sentiment score, and a writing object level. On this basis, in combination with context support text within a preset window on both sides of each entity text, a second projection point is generated by attention weighted fusion, so that the semantic representation of the entity retains its own attributes and is integrated into the context association. Subsequently, based on the scene polyhedron constructed by all second projection points, the overall semantics of the text are converted into a calculable geometric structure, and the semantic richness of the scene is quantified, so that the writing error detection model can combine local features and global features of the scene to make judgments, effectively avoiding misjudgments caused by a single scene label, effectively assisting users in improving the normativity, coherence, and scene adaptability of the text, especially in writing scenes such as official documents and professional reports that have strict context requirements, which can significantly reduce the risk of expression errors and improve writing efficiency and quality.
[0144] In order to help the author to get rid of the problem of difficult to find materials in the writing of official documents, in a preferred embodiment, after step S7, the following steps are further included:
[0145] Step S801: based on the error type prediction and position identification, the current text description is pre-corrected to obtain a pre-corrected text description;
[0146] For step S801, the current text description and the error type prediction and position identification identified in step S6 are input into the trained pre-correction model, so that the pre-correction model generates a pre-corrected text description according to the error type prediction and position identification.
[0147] It should be noted that the pre-correction model is trained in the following way: first, a plurality of fourth training text descriptions, corresponding state information and corrected text descriptions are obtained, the state information includes information in a normal state or information in an error state, the normal state indicates that no error is detected in step S6, at this time, the information in the normal state is no error, and the error state indicates that an error is detected in step S6, at this time, the information in the error state is error type prediction and position identification. The plurality of fourth training text descriptions, the corresponding state information and the corrected text descriptions are input into the pre-correction model to be trained, so that the pre-correction model takes the plurality of fourth training text descriptions and the corresponding state information as input and takes the predicted text description as output for iterative training. During the training process, the fourth cross-entropy loss is calculated according to the corrected text description and the predicted text description, and the model parameters are updated based on the fourth cross-entropy loss by back propagation until the fourth cross-entropy loss function converges, and finally the trained pre-correction model is obtained.
[0148] Step S901: input the pre-corrected text description and the current scene polyhedron into a preset multi-dimensional knowledge material model, so that the multi-dimensional knowledge material model performs semantic analysis on the pre-corrected text description, obtains all valid texts in the pre-corrected text description, and performs semantic sorting on each valid text to generate a valid text sequence; wherein all valid texts include all entity texts and all non-entity texts.
[0149] For step S901, the pre-corrected text description obtained in step S801 and the current scene polyhedron obtained in step S5 are input into a preset multi-dimensional knowledge material model. The multi-dimensional knowledge material model performs word segmentation operation on the pre-corrected text description, and through the BERT word segmentation algorithm in natural language processing, the continuous text is split into meaningful word units, and at the same time, punctuation and stop words are removed. The stop words are "of", "of", and other texts without substantive or low semantic contribution. All valid texts in the pre-corrected text description are obtained, and the valid texts include all entity texts and all non-entity texts.
[0150] It should be noted that the entity text represents a text with a clear entity such as a person, a place, a time or a thing, and the non-entity text represents a text with no clear entity direction but with semantic function, such as "overall" representing degree, and "but" representing logical connection. These non-entity texts are selected based on semantic function to support the scene expression.
[0151] Step S1001: input each valid text in the valid text sequence into a preset word vector model to identify the specification score, the sentiment score and the writing object level of each valid text, and perform spatial projection to obtain a corresponding third projection point;
[0152] For step S1001, each valid text in the valid text sequence is input into a preset word vector model one by one. The word vector model has determined the specification score, the sentiment score and the writing object level of a plurality of texts through training. Then, the quantization results of the three dimensions are respectively mapped to the X-axis, the Y-axis and the Z-axis of the three-dimensional semantic space. In this way, each valid text will form a unique corresponding coordinate point in the three-dimensional semantic space, thereby completing the conversion of the valid text from the semantic feature to the spatial position, and obtaining the corresponding third projection point of the valid text.
[0153] Step S1101: determining an affine transformation matrix according to the second projection point of the entity text and the corresponding third projection point;
[0154] For step S1101, the third projection point belonging to the entity text is determined from the effective text, and then the third projection point of the entity text is associated with the second projection point of the entity text obtained after context fusion. Specifically, based on the mathematical principle of linear transformation, taking the least square method as the calculation tool, a linear equation set capable of describing the conversion relationship from the basic semantic space (i.e. the third projection point) to the scenario semantic space (i.e. the second projection point) is constructed and solved, the linear transformation parameters including scaling, rotation, translation and the like are obtained through fitting, and finally the affine transformation matrix is determined.
[0155] Step S1201: Transforming the third projection point of each effective text according to the affine transformation matrix to obtain the fourth projection point of each effective text;
[0156] For step S1201, the third projection point corresponding to all effective texts in the effective text sequence is substituted into the affine transformation matrix in turn, and each effective text originally based on the third projection point of the basic semantic space is converted into the fourth projection point adapted to the scenario semantic space by using matrix operation.
[0157] The basic and scenario mapping relationship constructed by the affine transformation matrix can efficiently convert the original basic semantic features of the text into semantic expression that meets the current scenario polyhedron demand, and complete the feature calibration of the effective text from general semantic description to scenario precise adaptation.
[0158] Step S1301: Obtaining the projection point set of each material in the material library;
[0159] For step S1301, the projection point set of each material is obtained from the preset material library.
[0160] It should be noted that the projection point set of each material in the material library is obtained by using the crawler technology to collect various text descriptions as materials from multiple sources such as industry websites and department official websites, performing text cleaning and word vector coding on each material, mining semantic features of the material and converting the semantic features into high-dimensional vectors to obtain the standard score, sentiment score and writing object level involved in the effective text of the material, and performing space projection to obtain the projection point set of each material.
[0161] Step S1401: Determining the related material according to the intersection-over-union of the current text volume and the material volume; wherein the current text volume is composed of the fourth projection point of each effective text, and the material volume is composed of the projection point set of the material;
[0162] For step S1401, the current text volume is constructed according to the fourth projection points of each valid text obtained in step S1201, and the material volume of each material is constructed according to the projection point set of each material obtained in step S1301. The intersection volume or the union volume ratio of the current text volume and each material volume in the material library is calculated. The higher the intersection-union ratio, the higher the semantic overlap between the material and the current text, that is, the more the content of the material fits the current writing requirement. Set the intersection-union ratio threshold IoU, such as IoU > 0.3, and keep the materials with an intersection-union ratio higher than the threshold as relevant materials.
[0163] Step S1501: push the relevant materials to the user.
[0164] For step S1501, the relevant materials screened out in step S1401 are pushed to the user through a visual interface, so as to help the writer get rid of the problem of difficult-to-find materials and improve the quality and efficiency of writing.
[0165] In a preferred embodiment, after step S7, the following steps are further included:
[0166] Step S802: obtain the modification feedback of the user; the modification feedback includes: accepting the modification or rejecting the modification;
[0167] For step S802, after the error type prediction and position identification are pushed to the user, the user may accept the modification or reject the modification, and the system obtains the feedback of the user accepting the modification or rejecting the modification.
[0168] Step S902: after collecting a preset number of modification feedbacks, adjusting the model parameters in the writing error detection model according to the preset number of modification feedbacks to obtain an updated writing error detection model;
[0169] For step S902, when a preset number of user modification feedbacks are collected, such as 50 feedbacks, the writing error detection model is dynamically adjusted according to the adjustment feedback of the user. If the user accepts the modification, it means that the correction logic of the writing error detection model for this type of text is effective; if the user rejects the modification, it means that the writing error detection model has deviation, and the decoding layer of the writing error detection model is adjusted. Specifically, a rejection sample penalty term is added to the loss function of the writing error detection model, that is, a new loss function is constructed by adding a ReLU term to the original cross-entropy loss, and the decoding layer gradient generated by the rejection sample is weighted by three times during the back propagation of the writing error detection model, so as to accelerate the model correction, thereby obtaining an updated writing error detection model with stronger adaptability.
[0170] Step S1002: use the updated writing error detection model in the next writing correction assistance.
[0171] For step S1002, after completing the model parameter adjustment and updating, in the subsequent text writing correction assistance scene, when there is a new entity text sequence to be processed, the first projection point thereof is extracted according to the steps, and the updated writing error detection model is input in combination with the current scene polyhedron.
[0172] The present application predicts the error type and position by using the writing error detection model and pushes them to the user, then acquires the feedback of the user's acceptance or rejection of the modification, adjusts the model parameters according to the feedback collected for a preset number of times to update the model, and uses the updated model for the next text writing correction assistance process, thereby constructing a closed loop of continuous iteration and optimization of the model, which can adapt the writing error detection model to the user's needs and improve the accuracy and effectiveness of the text writing correction assistance.
[0173] As shown in the above method embodiment, corresponding system embodiments are provided; Figure 2
[0174] An embodiment of the present application provides a text writing correction assistance system, which comprises a text description acquisition module, an entity text extraction module, an entity text projection module, a projection adaptive fusion module, a scene polyhedron construction module, a writing error detection module and an error pushing module.
[0175] The text description acquisition module is used for acquiring the current text description of the user.
[0176] The entity text extraction module is used for extracting all entity texts in the current text description, performing semantic sorting on the entity texts, and generating an entity text sequence.
[0177] The entity text projection module is used for inputting each entity text in the entity text sequence into a preset word vector model, identifying the specification score, the sentiment score and the writing object level of each entity text, and performing space projection to obtain a corresponding first projection point.
[0178] The projection adaptive fusion module is used for, for each entity text, taking the entity text as a center text, taking the entity texts in the preset window on both sides of the center text as context support texts, performing attention weighted fusion on the projection point of the center text according to the projection points of the context support texts, and obtaining a corresponding second projection point.
[0179] The scene polyhedron construction module is used for constructing a current scene polyhedron according to all second projection points.
[0180] The writing error detection module is configured to input the current literal description and the current scene polyhedron thereof into the trained writing error detection model, so that the writing error detection model performs multi-head self-attention feature coding on the entity text sequence to generate a text feature vector; the current scene polyhedron is discretized into a 3D grid for convolution processing to generate a scene vector; the scene vector is used to perform weighted fusion on the text feature vector to obtain a scene-aware feature vector; and the scene-aware feature vector is decoded to output an error type prediction and a position identifier.
[0181] The error pushing module is configured to push the error type prediction and the position identifier to the user.
[0182] In a preferred embodiment, the literal writing correction auxiliary system further comprises a pre-correction module, a material determination module, and a material pushing module.
[0183] The pre-correction module is configured to perform pre-correction on the current literal description based on the error type prediction and the position identifier to obtain a pre-corrected literal description.
[0184] The material determination module comprises an effective text extraction unit, an effective text projection unit, an affine matrix determination unit, an affine transformation unit, a material acquisition unit, and a related material confirmation unit.
[0185] The effective text extraction unit is configured to input the pre-corrected literal description and the current scene polyhedron into a preset multi-dimensional knowledge material model, so that the multi-dimensional knowledge material model performs semantic analysis on the pre-corrected literal description to obtain all effective texts in the pre-corrected literal description, and performs semantic sorting on each effective text to generate an effective text sequence; wherein all effective texts comprise all entity texts and all non-entity texts.
[0186] The effective text projection unit is configured to input each effective text in the effective text sequence into a preset word vector model to identify the specification score, the sentiment score, and the writing object level of each effective text, and perform spatial projection to obtain a corresponding third projection point.
[0187] The affine matrix determination unit is configured to determine an affine transformation matrix according to the second projection point of the entity text and the corresponding third projection point.
[0188] The affine transformation unit is configured to transform the third projection point of each effective text according to the affine transformation matrix to obtain a fourth projection point of each effective text.
[0189] The material acquisition unit is configured to acquire a projection point set of each material in a material library.
[0190] The related material confirmation unit is configured to determine the related material according to an intersection-union ratio of a current text volume and each material volume, wherein the current text volume is composed of fourth projection points of each valid text, and the material volume is composed of a projection point set of the material.
[0191] The material pushing module is configured to push the related material to the user.
[0192] It can be understood that the system embodiments described above correspond to the method embodiments of the present application, and can implement the text writing correction auxiliary method provided by any one of the method embodiments of the present application.
[0193] It should be noted that the system embodiments described above are only illustrative, and part or all of the modules can be selected to achieve the purpose of the embodiment scheme according to actual needs. In addition, in the system embodiments provided by the present application, the connection relationship between the modules indicates that there is a communication connection between them, which can be implemented as one or more communication buses or signal lines. Those skilled in the art can understand and implement without creative labor.
[0194] The above is the preferred embodiment of the present application. It should be noted that for those skilled in the art, without departing from the principles of the present application, a number of improvements and refinements can be made, which are also considered within the scope of protection of the present application.
Claims
1. A method of assisting in the correction of a piece of writing, characterized in that, The method comprises the following steps: obtaining a current text description of a user; extracting all entity texts in the current text description and performing semantic sorting on each entity text to generate an entity text sequence; inputting each entity text in the entity text sequence into a preset word vector model to identify the specification score, sentiment score and writing object level of each entity text, and performing spatial projection to obtain a corresponding first projection point; for each entity text, taking the entity text as a center text, taking the entity texts within a preset window on both sides of the center text as context supporting texts, and performing attention weighted fusion on the projection point of the center text according to the projection points of the context supporting texts to obtain a corresponding second projection point; constructing a current scene polyhedron according to all second projection points; inputting each first projection point of the entity text sequence and the current scene polyhedron into a trained writing detection model to enable the writing detection model to perform multi-head self-attention feature coding on each first projection point of the entity text sequence to generate a text feature vector; discretizing the current scene polyhedron into a 3D grid for convolution processing to generate a scene vector; and performing weighted fusion on the text feature vector based on the scene vector to obtain a scene-aware feature vector; decoding the scene-aware feature vector to output an error type prediction and a position identification; pushing the error type prediction and the position identification to the user; after pushing the error type prediction and the position identification to the user, the method further comprises the following steps: pre-correcting the current text description based on the error type prediction and the position identification to obtain a pre-corrected text description; inputting the pre-corrected text description and the current scene polyhedron into a preset multi-dimensional knowledge material model to enable the multi-dimensional knowledge material model to perform semantic analysis on the pre-corrected text description to obtain all valid texts in the pre-corrected text description, and perform semantic sorting on each valid text to generate a valid text sequence; wherein all valid texts include all entity texts and all non-entity texts; inputting each valid text in the valid text sequence into a preset word vector model to identify the specification score, sentiment score and writing object level of each valid text, and performing spatial projection to obtain a corresponding third projection point; determining an affine transformation matrix according to the second projection point of the entity text and the corresponding third projection point; transforming the third projection point of each valid text according to the affine transformation matrix to obtain a fourth projection point of each valid text; obtaining a projection point set of each material in a material library; determining a related material according to the intersection over union of the current text volume and the material volume; wherein the current text volume is composed of the fourth projection point of each valid text, and the material volume is composed of the projection point set of the material; pushing the related material to the user.
2. The letter-writing revision assistance method according to claim 1, characterized by, The method for extracting all entity texts in the current text description comprises the following steps: inputting the current text description into an entity text extraction model to enable the entity text extraction model to perform word segmentation and cleaning on the current text description to obtain preprocessed segmented texts; mapping the preprocessed segmented texts to a preset entity type set through a fully connected layer and a softmax classifier to obtain a plurality of entity texts.
3. The letter-writing revision assistance method according to claim 2, characterized by, The semantic sequence of each entity text is generated, including: Randomly sorting each entity text to generate a first to-be-verified text sequence; Taking any entity text in the first to-be-verified text sequence as a swap text, repeatedly performing the iterative inversion operation to obtain the entity text sequence; The iterative inversion operation includes: Taking the remaining entity texts in the current first to-be-verified text sequence except the current fixed text as the current selectable text; wherein the current first to-be-verified text sequence at the initial time is the first to-be-verified text sequence, and the current fixed text at the initial time is the swap text; Swapping the current swap text and the current selectable text to generate a plurality of second to-be-verified text sequences; wherein the current swap text at the initial time is the swap text; Inverting the current first to-be-verified text sequence and each second to-be-verified text sequence through a preset inversion model to generate corresponding inversion textual descriptions; Calculating the similarity between each inversion textual description and the current textual description to obtain a corresponding similarity result; Selecting an entity text from the current selectable text as the current swap text for the next time of performing the iterative inversion operation, and combining it with the current fixed text to form an updated fixed text; In the case where the current selectable text is less than a preset threshold, the to-be-verified text sequence corresponding to the maximum similarity result is taken as the entity text sequence; Otherwise, the to-be-verified text sequence corresponding to the maximum similarity result is taken as the current first to-be-verified text sequence for the next time of performing the iterative inversion operation, and the updated fixed text is taken as the current fixed text for the next time of performing the iterative inversion operation.
4. The letter-writing revision assistance method according to claim 3, characterized by, Also including: Obtaining a marked text of the user in the current textual description; Generating an importance weighting matrix according to the current textual description and the marked text; Inverting the current first to-be-verified text sequence and each second to-be-verified text sequence through a preset inversion model based on the importance weighting matrix to generate corresponding inversion textual descriptions. Inverting the current first to-be-verified text sequence and each second to-be-verified text sequence through a preset inversion model based on the importance weighting matrix to generate corresponding inversion textual descriptions.
5. The letter-writing revision aid method according to claim 1, characterized by, Feature encoding of each first projection point of the entity text sequence through multi-head self-attention to generate a text feature vector, including: Linear transformation is performed on each first projection point of the entity text sequence to obtain a query matrix, a key matrix and a value matrix; The query matrix, the key matrix and the value matrix are divided into a plurality of groups of sub-matrices according to a single-head feature dimension; After self-attention calculation is performed on each group of sub-matrices, horizontal splicing is performed to obtain a multi-head fusion matrix; Global average pooling is performed on the multi-head fusion matrix to obtain a text feature vector corresponding to the entity text sequence.
6. The letter-writing revision aid method according to claim 1, characterized by, Discretizing the current scene polyhedron into a 3D grid for convolution processing to generate a scene vector, including: Performing a spatial discretization operation on the current scene polyhedron to obtain a binary 3D grid matrix; Repeating the 3D convolution operation and the pooling operation until the spatial dimension of the pooled feature map is less than a preset threshold to obtain a high-order pooled feature vector corresponding to the final pooled feature map; Adjust dimensions of the high-order pooling feature vector to preset dimensions through linear transformation to obtain the scene vector; The 3D convolution operation comprises: performing 3D convolution operation on the 3D grid matrix through a preset number of 3D convolution kernels to obtain a convolution feature map; The pooling operation comprises: performing 3D pooling operation on the convolution feature map to obtain a pooled feature map.
7. The letter-writing revision aid method according to claim 1, characterized by, After the error type prediction and the position identification are pushed to the user, the method further comprises: Obtaining modification feedback of the user; the modification feedback comprises: accepting modification or rejecting modification; After a preset number of modification feedbacks are collected, adjusting model parameters in the writing error detection model according to the preset number of modification feedbacks to obtain an updated writing error detection model; The updated writing error detection model is used in next-time writing correction assistance.
8. A text writing revision assistance system characterized by comprising: Comprise: The text description acquisition module, the entity text extraction module, the entity text projection module, the projection adaptive fusion module, the scene polyhedron construction module, the writing error detection module and the error pushing module; The text description acquisition module is used to acquire the current text description of the user; The entity text extraction module is used to extract all entity texts in the current text description, and perform semantic sorting on each entity text to generate an entity text sequence; The entity text projection module is used to input each entity text in the entity text sequence into a preset word vector model, identify the specification score, the sentiment score and the writing object level of each entity text, and perform spatial projection to obtain a corresponding first projection point; The projection adaptive fusion module is used to, for each entity text, take the entity text as a center text, take entity texts within a preset window on both sides of the center text as context supporting texts, and perform attention weighted fusion on the projection point of the center text according to the projection points of the context supporting texts to obtain a corresponding second projection point; The scene polyhedron construction module is used to construct a current scene polyhedron according to all second projection points; The writing error detection module is used to input the current text description and the current scene polyhedron thereof into a trained writing error detection model, so that the writing error detection model performs multi-head self-attention feature coding on the entity text sequence to generate a text feature vector; discretizes the current scene polyhedron into a 3D grid for convolution processing to generate a scene vector; performs weighted fusion on the text feature vector based on the scene vector to obtain a scene-aware feature vector; and decodes the scene-aware feature vector to output error type prediction and position identification; The error pushing module is used to push the error type prediction and the position identification to the user; Further comprise: a pre-correction module, a material determination module and a material pushing module; The pre-correction module is used to pre-correct the current text description based on the error type prediction and the position identification to obtain a pre-corrected text description; The material determination module comprises: an effective text extraction unit, an effective text projection unit, an affine matrix determination unit, an affine transformation unit, a material acquisition unit and a related material confirmation unit; The effective text extraction unit is configured to input the pre-corrected literal description and the current scene polyhedron into a preset multi-dimensional knowledge material model, so that the multi-dimensional knowledge material model performs semantic analysis on the pre-corrected literal description to obtain all effective texts in the pre-corrected literal description, and performs semantic sorting on each effective text to generate an effective text sequence; wherein all the effective texts include all entity texts and all non-entity texts; The effective text projection unit is configured to input each effective text in the effective text sequence into a preset word vector model, identify a specification score, an emotion score, and a writing object level of each effective text, and perform spatial projection to obtain a corresponding third projection point; The affine matrix determination unit is configured to determine an affine transformation matrix according to the second projection point of the entity text and the corresponding third projection point; The affine transformation unit is configured to transform the third projection point of each effective text according to the affine transformation matrix to obtain a fourth projection point of each effective text; The material acquisition unit is configured to acquire a projection point set of each material in a material library; The related material confirmation unit is configured to determine a related material according to an intersection-union ratio of a current text volume and a material volume; wherein the current text volume is composed of the fourth projection point of each effective text, and the material volume is composed of the projection point set of the material; The material pushing module is configured to push the related material to the user.
Citation Information
Patent Citations
Text processing method and device, electronic equipment and storage medium
CN116341532A
Lightweight large model-based electric power knowledge system construction and intelligent question and answer method
CN119597864A