Intelligent recall method and device for document writing and document generation method and device

The intelligent recall method of document writing through structured processing and weighted calculation solves the problem of inaccurate recall content, improves the accuracy and semantic understanding of document writing in the medical field, and reduces the generation of erroneous information.

CN118747293APending Publication Date: 2024-10-08BEIJING DEEP MFG TECH CO LTD
View PDF 0 Cites 7 Cited by

Patent Information

Application Number
CN202410619691.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-05-20
Publication Date
2024-10-08

AI Technical Summary

Technical Problem

In the existing document writing process, the recalled content is inaccurate, especially in the medical field, resulting in the generated documents possibly containing erroneous information and hallucinations, and general information recall technology cannot effectively handle semantic similarity and contextual integrity.

Method used

By structuring and preprocessing the reference file, the vector cosine similarity and semantic matching similarity between the target chapter content and the reference chapter content are calculated, and a weighted calculation is performed to determine whether to recall the reference chapter content to improve the accuracy of recall. sex and relevance.

Benefits of technology

It improves the accuracy and semantic understanding of recalled content during the document writing process, reduces the generation of erroneous information, enhances the reliability and relevance of recall results, and meets the high-quality text requirements in the medical field.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118747293A_ABST
    Figure CN118747293A_ABST
Patent Text Reader

Abstract

The invention provides an intelligent recall method and device for document writing and a document generation method and device.The intelligent recall method for document writing comprises the steps that structured processing is conducted on a reference file, the reference file obtained after structured processing is preprocessed, and target chapter content is preprocessed, the target chapter content is chapter title information of to-be-generated content; calculating the vector cosine similarity between the preprocessed target chapter content and the preprocessed reference chapter content of the reference file, and calculating the semantic matching similarity between the preprocessed target chapter content and the preprocessed reference chapter content; and performing weighted calculation on the cosine similarity and the semantic matching similarity to obtain a similarity score, and determining whether to recall the reference chapter or not based on the similarity score. The technical problem that recalled contents are inaccurate during document writing is solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of artificial intelligence technology, and more specifically, to a method and device for intelligent recall of document writing and a method and device for document generation. Background Art

[0002] With the development of artificial intelligence technology, especially since the release of the GPT4 large language model, the powerful text understanding generation capability has given unlimited possibilities for text generation content. Large language models are able to produce text or image content that looks very real. However, these models may also produce "hallucinations", where the information generated by the model seems reasonable but is actually wrong or inconsistent with reality. At present, the hallucination problem of large language models is mainly solved through information recall. The retrieved documents provide the generator with additional, topic-related information, which helps the model use more accurate facts and data when generating answers. By referring to the information in the retrieved documents, the generator can produce content that is more in line with the facts and reduce the phenomenon of hallucinations based on false information.

[0003] The general information recall technology will divide the text content into fixed-length blocks to prevent the input of too much content into the large language model, which will cause the model to be distracted. Each block will then be vectorized and the input content will be vectorized, and similar content will be recalled by calculating vector similarity. The general method of fixed-length fast segmentation leads to incomplete semantic information of each block, and the method of calculating sentence similarity alone cannot accurately recall similar content.

[0004] According to the existing demand for automatic writing of medical documents, it is necessary to summarize and analyze the reference materials during the writing process. In order to provide the model with higher-quality professional texts for reference and improve writing efficiency, a better text recall strategy is needed.

[0005] To address the above-mentioned problems, no effective solution has been proposed yet. Summary of the invention

[0006] The embodiments of the present invention provide a method and device for intelligent recall of document writing and a method and device for document generation, so as to at least solve the technical problem of inaccurate recall content when writing a document.

[0007] According to one aspect of an embodiment of the present invention, there is provided a method for intelligent recall of document writing, comprising: structuring a reference file, preprocessing the reference file after the structuring, and preprocessing a target chapter content, wherein the target chapter content is chapter title information of content to be generated; calculating the vector cosine similarity between the preprocessed target chapter content and the preprocessed reference chapter content of the reference file, and calculating the semantic matching similarity between the preprocessed target chapter content and the reference chapter content; performing weighted calculation on the cosine similarity and the semantic matching similarity to obtain a similarity score, and determining whether to recall the reference chapter based on the similarity score.

[0008] According to another aspect of an embodiment of the present invention, a document generation method is also provided, including: receiving target chapter content; using the above-mentioned document writing intelligent recall method to determine whether to recall reference chapter content; if it is determined that the reference chapter content needs to be recalled, recalling the reference chapter content, and generating a document based on the target chapter content and the reference chapter content.

[0009] According to another aspect of an embodiment of the present invention, there is also provided an intelligent recall device for document writing, comprising: a processing module, configured to perform structural processing on a reference file, preprocess the reference file after structural processing, and preprocess the target chapter content, wherein the target chapter content is content intelligently generated based on the reference chapter content; a similarity calculation module, configured to calculate the vector cosine similarity between the preprocessed target chapter content and the preprocessed reference chapter content of the reference file, and calculate the semantic matching similarity between the preprocessed target chapter content and the reference chapter content of the processed reference file; a recall module, configured to perform weighted calculation on the cosine similarity and the semantic matching similarity to obtain a similarity score, and determine whether to recall the reference chapter content based on the similarity score.

[0010] According to another aspect of an embodiment of the present invention, a document generation device is also provided, including: a receiving module, configured to receive target chapter content; a judging module, configured to use the above-mentioned document writing intelligent recall method to judge whether it is necessary to recall the reference chapter content; a recall module, configured to recall the reference chapter content if it is judged that the reference chapter content needs to be recalled, and generate a document based on the target chapter content and the reference chapter content.

[0011] In an embodiment of the present invention, a reference file is structured, the reference file after structured processing is preprocessed, and the target chapter content is preprocessed, wherein the target chapter content is the chapter title information of the content to be generated; the vector cosine similarity between the preprocessed target chapter content and the preprocessed reference chapter content of the reference file is calculated, and the semantic matching similarity between the preprocessed target chapter content and the reference chapter content is calculated; the cosine similarity and the semantic matching similarity are weighted to obtain a similarity score, and whether to recall the reference chapter is determined based on the similarity score. Through the above method, the technical problem of inaccurate content recall during document writing is solved. BRIEF DESCRIPTION OF THE DRAWINGS

[0012] The drawings constituting part of the present application are used to provide a further understanding of the present application. The illustrative embodiments and descriptions of the present application are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings:

[0013] Figure 1 is a flow chart of a document writing intelligent recall method according to an embodiment of the present application;

[0014] Figure 2 is a flow chart of another document writing intelligent recall method according to an embodiment of the present application;

[0015] Figure 3 is a flow chart of a similarity calculation method according to an embodiment of the present application;

[0016] Figure 4 is a flow chart of another document writing intelligent recall method according to an embodiment of the present application;

[0017] Figure 5 is a flow chart of a method for preprocessing data according to an embodiment of the present application;

[0018] Figure 6 is a flow chart of a document generation method according to an embodiment of the present application;

[0019] Figure 7 is a structural schematic diagram of a document writing intelligent recall device according to an embodiment of the present application;

[0020] Figure 8 is a structural schematic diagram of a document generation device according to an embodiment of the present application;

[0021] Fig. 9 A schematic diagram of the structure of an electronic device suitable for implementing the embodiments of the present disclosure is shown. DETAILED DESCRIPTION

[0022] It should be noted that, in the absence of conflict, the embodiments and features in the embodiments of the present application can be combined with each other. The present application will be described in detail below with reference to the accompanying drawings and in combination with the embodiments.

[0023] It should be noted that the terms used herein are only for describing specific embodiments and are not intended to limit the exemplary embodiments according to the present application. As used herein, unless the context clearly indicates otherwise, the singular form is also intended to include the plural form. In addition, it should be understood that when the terms "comprise" and / or "include" are used in this specification, it indicates the presence of features, steps, operations, devices, components and / or combinations thereof.

[0024] Unless otherwise specifically stated, the relative arrangement, numerical expressions and numerical values ​​of the parts and steps set forth in these embodiments do not limit the scope of the application. Meanwhile, it should be understood that, for ease of description, the sizes of the various parts shown in the accompanying drawings are not drawn according to actual proportional relationships. The technology, methods and equipment known to those of ordinary skill in the relevant art may not be discussed in detail. In all examples shown and discussed here, any specific value should be interpreted as being merely exemplary, rather than as a limitation. Therefore, other examples of exemplary embodiments may have different values. It should be noted that similar reference numerals and letters represent similar items in the following drawings, and therefore, once a certain item is defined in an accompanying drawing, it does not need to be further discussed in subsequent drawings.

[0025] Example 1

[0026] Existing recall technical documents need to be segmented into multiple text blocks before vector embedding. Without considering the input length limit and cost issues of large models, the purpose is to minimize the noise in the embedded content while maintaining semantic coherence, so as to more effectively find the part of the document that is most relevant to the user query. If the block is too large, it may contain too much irrelevant information, thereby reducing the accuracy of retrieval. On the contrary, if the block is too small, necessary contextual information may be lost, resulting in a lack of coherence or depth in the generated response. Fixed-length blocks lead to incomplete semantics and insufficient semantic matching. The vector similarity method cannot handle semantic similarity well. Different words in a sentence have different levels of importance, resulting in the loss of semantically similar text.

[0027] The present application embodiment discloses a document writing intelligent recall method, such as Figure 1 As shown, the method comprises the following steps:

[0028] Step S102, structurally processing the reference file, preprocessing the structurally processed reference file, and preprocessing the target chapter content, wherein the target chapter content is chapter title information of the content to be generated.

[0029] First, the reference file is structured. It is determined whether the reference file conforms to the preset format; if the reference file conforms to the preset format, the chapter title and the content corresponding to the chapter title are extracted from the reference file; if the reference file does not conform to the preset format, the chapter title and the content corresponding to the chapter title are identified and split from the reference file based on the context of the reference file; wherein the content corresponding to the chapter title includes the reference chapter content. This embodiment can ensure the format consistency of the document by performing structured processing on the reference file, making subsequent processing more efficient and accurate. Secondly, by extracting the chapter title and the corresponding content, the structure of the document can be made clearer, which is convenient for users to understand and retrieve relevant information. Even if the reference file does not conform to the preset format, the context-based splitting method can effectively identify the chapter title and content, and retain the integrity and coherence of the document. Most importantly, this structured processing can provide a more accurate data basis for subsequent text analysis and similarity calculation, thereby improving the quality and accuracy of the recalled content.

[0030] Next, the reference document after structured processing is preprocessed. For example, based on a medical dictionary, the reference chapter content in the reference document after structured processing is segmented to obtain a first segmented word set corresponding to the reference chapter content, and stop words are filtered out from the first segmented word set; the segmented words in the filtered first segmented word set that meet preset conditions are expanded and weighted, and the word vectors of the segmented words in the first segmented word set after expanded and weighted processing are calculated to obtain a first word vector set; the first sentence vector of the whole sentence corresponding to the word vector in the first word vector set is calculated, and the word vector in the first word vector set and the corresponding first sentence vector are weighted summed to obtain a reference content vector.

[0031] At the same time, the target chapter content is preprocessed. For example, based on a medical dictionary, the target chapter content is segmented to obtain a second segmentation set corresponding to the target chapter content, and stop words are filtered out from the second segmentation set; the segmentations in the filtered second segmentation set that meet the preset conditions are expanded and weighted, and the word vectors of the segmentations in the second segmentation set after the expansion and weighting are calculated to obtain a second word vector set; the second sentence vector of the whole sentence corresponding to the word vector in the second word vector set is calculated, and the word vector in the second word vector set and the corresponding second sentence vector are weighted summed to obtain the target chapter content vector.

[0032] This embodiment can more accurately represent the terms and content in the medical field by performing word segmentation, filtering stop words, expanding word meanings, and weighting processing based on a medical dictionary, making the expression of text vectors richer and more accurate. Such a preprocessing process can not only improve the semantic understanding ability of medical field texts, but also enhance the accuracy of similarity calculations, thereby improving the efficiency and accuracy of document recall. At the same time, similar preprocessing of the target chapter content can also ensure that the characteristics and semantic information of the text are taken into account in subsequent similarity calculations, thereby providing a more reliable basis for the final recall results.

[0033] Step S104, calculating the vector cosine similarity between the preprocessed target chapter content and the preprocessed reference chapter content of the reference file, and calculating the semantic matching similarity between the preprocessed target chapter content and the reference chapter content.

[0034] Vector cosine similarity is used to measure the degree of similarity between two vectors in direction. In this scheme, calculating the vector cosine similarity between the preprocessed target chapter content vector and the reference chapter content vector can help determine their semantic similarity. A higher vector cosine similarity indicates that the two vectors are closer in semantics, thereby increasing the accuracy and relevance of the recalled content.

[0035] In addition to vector cosine similarity, this embodiment uses a semantic matching model (such as GPT4) to understand and analyze the target chapter content and the reference chapter content, and can obtain the semantic matching similarity between them. Semantic matching similarity takes more consideration of the semantic relationship between texts, and can better capture the meaning and contextual information of the text, thereby improving the precision and accuracy of the recalled content.

[0036] Step S106: performing weighted calculation on the cosine similarity and the semantic matching similarity to obtain a similarity score, and determining whether to recall the reference chapter based on the similarity score.

[0037] After calculating the vector cosine similarity and semantic matching similarity respectively, the two similarities are calculated together to obtain a comprehensive similarity score. Such a comprehensive similarity calculation can more comprehensively consider all aspects of the texts and provide a more accurate and reliable basis for the final reference document recall.

[0038] When calculating the similarity score, a similarity threshold can be set, and whether to recall the reference chapter is determined based on the comparison result between the similarity score and the threshold. For example, if the similarity score is greater than a preset threshold, it is determined to recall the reference chapter; if the similarity score is less than or equal to the preset threshold, it is determined not to recall the reference chapter. By setting a similarity threshold, the recall rate and accuracy of the recall result can be balanced to meet the requirements of different application scenarios and user needs.

[0039] In the embodiment of the present application, the document is processed by structured parsing, and the chapters and contents are treated as a whole according to the medical document writing scenario. It can maintain semantic coherence and retain the structure of the original document. Structured parsing allows the large model to better understand the structure and content of the reference document, reduce the noise of the input content, and improve the accuracy of the recalled content.

[0040] In addition, the embodiment of the present application weights the vectors of words and sentences by medical field terms. By weighting the medical terms, the importance of professional vocabulary can be more accurately represented in the vector space, thereby improving the recall quality of queries related to professional terms. Advanced language models such as GPT4 can understand and process complex natural languages. Combined with their semantic analysis capabilities, they can improve the understanding of query intent and extract more relevant reference content. Finally, the vector similarity results are weighted and summed with the GPT4 semantic analysis similarity results to obtain the final high-similarity reference content. By adjusting the weighting scheme, the retrieval system can be customized according to specific application scenarios or user needs to make it more in line with the needs of specific user groups.

[0041] Example 2

[0042] The present application embodiment discloses another document writing intelligent recall method, such as Figure 2 As shown, the method comprises the following steps:

[0043] Step S202, uploading reference files.

[0044] Users need to upload reference files required for medical writing. These files should be in Docx or doc format for subsequent processing and analysis. The above reference files are represented by Rd, and multiple reference files can be represented by Rd1, Rd2, Rd3...

[0045] Step S204: Process the uploaded reference file.

[0046] There are two situations that need to be distinguished for reference files. For files with regular formats, the font, text position and size format features are used to automatically extract chapter titles and corresponding content. For files that lack a clear format, the text is divided into blocks and input into the split model in sequence. The split model will identify and split the chapter titles and their corresponding content based on the context to obtain the reference chapter content. The above reference chapter content is represented by Rc, and each Rc contains a chapter title Ct and a chapter content Cc.

[0047] Step S206, determine whether to recall.

[0048] In a specific medical writing scenario, the content of the first chapter is usually not of reference value, so it will be automatically excluded. In addition, structured data such as experimental flow charts are key information in the literature. If they exist, they need to be specially extracted for subsequent use.

[0049] The target chapter content is preprocessed, the target chapter content and the reference chapter content are similarly calculated, and based on the result of the similarity calculation, it is determined whether to recall the reference chapter content.

[0050] The following is a detailed description of the similarity calculation method, which is a key step in the entire process and involves extracting key text reference content. The method involves two key points: providing a professional medical field vocabulary to expand the meaning of professional word segmentation terms; weighted similarity calculation, including words, sentences, and GPT4 semantic analysis, to make the results more accurate.

[0051] Specifically, the similarity calculation method is as follows: Figure 3 As shown, the following steps are included:

[0052] Step S302, performing structural processing on the reference file Rd.

[0053] Step S304, preprocessing the reference file after the structured processing.

[0054] The text of the reference chapter content Cc of the chapter content Rc in the reference file Rd is segmented. The medical dictionary is used in the segmentation process to ensure the integrity of the medical word segmentation. Then, stop word filtering is performed. After that, the professional terms are expanded and weighted in combination with the medical field vocabulary. The professional terms have a large weight ratio and are expanded according to words with similar meanings in the dictionary. Finally, the words after the segmentation filter are vectorized and combined with the global vectorized representation of the whole sentence for weighted summation, integrating the semantics of the words and sentences.

[0055] Step S306: pre-process the target chapter content.

[0056] The processing method is the same as step S304, which will not be described again. The target chapter content is represented by Gc.

[0057] Step S308, performing similarity calculation.

[0058] Similarity calculation methods may include the following:

[0059] 1) Calculate the cosine similarity of the first vector.

[0060] Calculate the similarity of the vectors of the segmented sentences (the sentence Gci in Gc and the sentence Cci in Cc). For each word in the sentence, multiply its word2vec vector by its TF-IDF weight. Here, the sentence is represented by s and the segmented words in the sentence are represented by w. i The formula is as follows:

[0061] tv(w i , s) = tfidf(w i ,s,S)·v(w i )

[0062] Among them, tv(w i ,s) represents the word (w i ) in the sentence(s) is the TF-IDF weighted word embedding (word2vec) vector, v(w i ) is the word2vec vector of the word, tfidf(w i ,s,S) is the TF-IDF weight of the word.

[0063] Based on the word embedding (word2vec) vector, calculate the average of the weighted word2vec vector sum of all words:

[0064]

[0065] Among them, TV(s) is the text vector of sentence(s), and n represents the number of words(wi) in sentence(s).

[0066] The cosine similarity calculation is performed between the vectors of the target chapter content and the reference chapter content. The specific calculation formula can be:

[0067]

[0068] Among them, Cos( TVG,TVC ) represents the vector cosine similarity, TV Gc The vector representing the content of the target chapter, TV Cc A vector representing the content of the reference chapter, TV Gc is the sum of the vectors calculated by substituting each sentence Gci in Gc into the above TV(s) formula, TVCc It is the sum of the vectors calculated by substituting each sentence Cci in Cc into the above TV(s) formula.

[0069] This embodiment multiplies word embeddings by TF-IDF weights, so that the sentence vector can more accurately reflect the semantic content of the sentence, which helps to improve the quality of semantic expression at the sentence level. At the same time, based on the average value of the weighted Word2Vec vector, the text vector of the sentence is obtained. In this way, the semantic contribution of each word in the sentence is evenly integrated, so that the sentence vector more comprehensively represents the semantic information of the sentence, which is conducive to the accuracy and performance improvement of subsequent tasks such as sentence similarity calculation and text classification.

[0070] 2) Calculate the cosine similarity of the second vector.

[0071] The target chapter content and the reference chapter content are directly converted into sentence vectors through GPT4.

[0072] The cosine similarity calculation is performed between the sentence vectors directly converted from the target chapter content and the reference chapter content. The specific calculation formula can be:

[0073]

[0074] Among them, Cos( VG,VC ) represents the vector cosine similarity, V Gc The sentence vector representing the content of the target chapter, V Cc Sentence vector representing the content of the reference section.

[0075] The methods of generating vectors in the first vector cosine similarity and the second vector cosine similarity are different.

[0076] 3) Calculate semantic matching similarity.

[0077] Use a semantic matching model such as GPT4 to directly understand and analyze the target chapter content and the reference chapter content to obtain the semantic matching similarity. The specific calculation formula is:

[0078]

[0079] Among them, Mcos( VG,VC ) represents the vector cosine similarity of the model, MV Gc The vector representing the target chapter content (original content, without operations such as word segmentation and expansion of professional terms), MV Cc A vector representing the content of the reference chapter (original content, without operations such as word segmentation and expansion of professional terms).

[0080] Step S310, calculate the similarity score, the specific formula is:

[0081] SimScore = λ×Cos(TV G , TV C )+σ×Cos(VG,VC)+(1-σ-λ)×Mcos(VG,VC)

[0082] Wherein, SimScore represents the similarity score, σ and λ represent the first weight coefficient and the second weight coefficient (wherein the sum of σ and λ is between 0 and 1).

[0083] The cosine similarity of the first and second vectors and the semantic matching similarity calculated above are weighted, and reference documents that meet the similarity threshold are recalled. Steps S304 to S310 are performed on all target sections of the reference files in sequence, and all reference documents that meet the requirements are recalled.

[0084] This application effectively improves the semantic uniformity and accuracy of the recalled content by processing the reference text in a structured process and calculating the weighted similarity at the word, sentence, and semantic levels. Specifically, the reference materials are structured and segmented into chapters according to the medical writing scenario, and GPT is used to process files without regular formats. In addition, professional thesaurus, fusion words, sentence vector similarity, and the ability of large models to understand and process complex languages ​​are used in combination with medical scenarios to obtain advanced recall results.

[0085] Example 3

[0086] The present application embodiment discloses another document writing intelligent recall method, such as Figure 4 As shown, the method comprises the following steps:

[0087] Step S402: structurally process the reference file.

[0088] 1) For files with regular format, automatically extract chapter titles and corresponding content using font, text position and size format features.

[0089] First, the system identifies possible chapter titles by analyzing font features. This includes checking for different font styles, such as bold, italic, or specific font types. Chapter titles usually have larger font sizes, so the system can set a font size threshold to identify possible title text.

[0090] Secondly, the system analyzes the positional features of the text to determine possible chapter title locations. Chapter titles are usually located at the top of the page or have a fixed position, so the system can identify potential title locations by checking the positional coordinates of the text. In addition, some files can adopt specific layout structures, such as the title being located in the upper left corner or centered on the page, and the system can use these layout structure features to further determine the title location.

[0091] Once the system has identified the possible title locations, it can begin extracting the corresponding content. The system can search downward from the title location and use preset rules to extract text content that matches the title format. These rules include considering the format of the title, such as specific identifiers, styles, or text structure. Using these rules, the system can accurately extract the chapter title and its corresponding content.

[0092] In general, the implementation scheme of automatically extracting chapter titles and corresponding contents by using font, text position and size format features can analyze the font, position and layout features of the text and combine rules to identify and extract the chapter structure in the file, thereby realizing intelligent processing and content extraction of neatly formatted files.

[0093] 2) For files that lack a clear format, the text segmentation method is adopted, and the chapter titles and their corresponding contents are identified and segmented through the splitting model to obtain the reference chapter content.

[0094] First, the entire reference file is divided into smaller text blocks. The text can be divided into paragraph or sentence level blocks based on line breaks, punctuation marks, etc. This block division method ensures that each text block contains certain information and reduces the complexity of processing.

[0095] A deep learning model, such as a recurrent neural network (RNN), a convolutional neural network (CNN), or an attention mechanism, can be used to build a split model. The training data for the split model can be a text dataset that has been annotated with a chapter structure, as well as the location information of the corresponding chapter titles and content. The split model is trained using the annotated training data, with the goal of enabling the model to accurately identify the chapter titles in the text and their corresponding content. During the training process, a loss function, such as a cross entropy loss function, and an optimizer, such as stochastic gradient descent (SGD) or Adam, can be used to optimize the model parameters.

[0096] The trained splitting model is applied to actual document processing to perform chapter splitting on files that lack a clear format. For each text block, the possible chapter titles are identified through the splitting model, and the corresponding content is determined based on the title. Through the above steps, a technical solution for performing chapter splitting on files that lack a clear format can be implemented. This embodiment utilizes a deep learning model and a text segmentation method to effectively identify and split the chapter structure in a file, providing a basis for subsequent content extraction and processing.

[0097] Step S404: pre-process the reference file and the target chapter content.

[0098] Perform the following preprocessing operations on the text in the reference chapter content and the target chapter content of the reference document, as Figure 5 shown. The preprocessing includes the following steps:

[0099] Step S4042, word segmentation.

[0100] Use a word segmentation tool, such as the jieba Chinese word segmentation library, to perform word segmentation on the text of the target chapter content and the reference chapter content. During the word segmentation process, a medical dictionary needs to be used as an additional word library to ensure the integrity of medical words. This can ensure that professional terms are not incorrectly split into multiple words.

[0101] Step S4044, stop word filtering.

[0102] Perform stop word filtering on the word segmentation results to remove some words that are common but have no actual meaning in medical texts, such as "de" (of), "shi" (is), etc. Stop word filtering can reduce noise and improve the efficiency and accuracy of subsequent processing.

[0103] Step S4046, semantic expansion and weight marking.

[0104] Combine the professional word library in the medical field to perform semantic expansion and weight marking on the word segmentation results. For medical terms, their weight information can be obtained through a medical dictionary or a professional medical term library, and their importance can be marked. For each word, assign a weight according to its importance in the medical word library. The weight of professional words is usually higher than that of general words.

[0105] For words with similar meanings existing in the word library, perform similar word expansion. By looking for words with similar meanings in the dictionary, the vocabulary can be expanded, enabling the model to better understand the content in medical texts.

[0106] Step S4048, vector representation.

[0107] Convert the words that have been expanded and weighted to vector representation. First, calculate the frequency of each word in the target chapter content and the reference chapter content. High-frequency words are usually important for the expression of the text. Calculate the inverse document frequency of each word, that is, the importance of the word in the entire corpus. The document frequency information of the training corpus can be used for calculation. Multiply the word frequency and the inverse document frequency to get the TF-IDF value of each word. The TF-IDF value can highlight words that appear frequently in the current document but less frequently in the entire corpus. Use natural language processing tools such as NLTK (NaturalLanguage Toolkit) or spaCy to perform part-of-speech tagging on the text to extract grammatical information of words, such as nouns, verbs, adjectives, etc. These part-of-speech tags can provide additional information about the structure and content of the text. By calculating the correlation between the feature and the target variable (similarity score), screen out features with high correlation with the similarity score. Correlation analysis can be performed using methods such as the Pearson correlation coefficient and the Spearman correlation coefficient. The information gain method is used to evaluate the importance of each feature for classification (similarity score) so as to select the most discriminative features. Information gain indicates the degree to which the uncertainty of classification is reduced when a certain feature is known. The extracted and selected features are converted into feature vectors. Features such as word frequency and TF-IDF value are converted into vector representations using the Bag-of-Words (BoW) model or the TF-IDF weighted Bag-of-Words model. For non-numerical features such as part-of-speech tags, one-hot encoding or word embedding techniques can be used to convert them into numerical feature vectors.

[0108] This embodiment converts the text into a feature vector and uses various feature information such as word frequency, TF-IDF value, part-of-speech tags, etc., which can not only better reflect the grammatical and semantic information of the text, but also highlight the keywords that are important in the text but rarely appear in the entire corpus. Through feature selection and correlation analysis, features with high correlation with similarity scores are screened out, which improves the distinguishability of features. Finally, the extracted and selected features are converted into feature vectors, making the similarity calculation more accurate, thereby improving the accuracy and reliability of text similarity scores.

[0109] Step S406, calculating the similarity.

[0110] The calculated feature vector is used to calculate the similarity. Methods such as vector cosine similarity can be used to measure the similarity between the target chapter content and the reference chapter content. At the same time, a semantic matching model such as GPT4 is used to directly understand and analyze the target chapter content and the reference chapter content to obtain semantic matching similarity.

[0111] Finally, the vector cosine similarity and semantic matching similarity are weighted to obtain a similarity score, and the recall section of the reference document is determined based on the similarity score.

[0112] In some embodiments, the similarity score may be obtained by:

[0113] Sim(S1, S2) = β1·β2

[0114] β1=k·λ

[0115] β2=α1Cos(TV G , TV C )+α2Cos(VG, VC)+α3Mcos(VG, VC)

[0116] Sim(S1, S2) is a similarity score, and its value is determined by two parts. β1 represents the similarity adjustment coefficient, and β2 represents the semantic similarity value. β1 contains two specific parameters: k and λ. Among them, k is the sentence weight coefficient, that is, the adjustment coefficient of the sentence weight, and its value is set to 2*i / (m+n). m and n represent the number of weighted words contained in S1 and S2, respectively, and i is the number of corresponding weighted words in S1 and S2. λ is a negation coefficient. When the two part-of-speech tags are completely inconsistent, it is set to -1, and it is generally 1. S1 and S2 represent the sentences in the target chapter content and the sentences in the reference chapter content, respectively.

[0117] Since a sentence is divided into two weight proportions by professional terms, the value of β2 is given by Cos( TVG,TVC )、Cos( VG,VC ) and Mcos( VG,VC ) consists of three similarity values, α1 represents the ratio of the number of weighted words in the target chapter content Gc to the number of words in the sentence, α2 represents the ratio of the number of weighted words in the reference chapter content Cc to the number of words in the sentence, and α3 represents the ratio of the number of non-weighted words to the sum of the numbers of words in the two sentences.

[0118] This embodiment combines the weights and semantic similarity values ​​of the words in the sentence, and takes into account the consistency of the part-of-speech tags, so that the sentence similarity calculation is more comprehensive and accurate. The method for calculating the sentence similarity of this embodiment not only takes into account the contribution of each word in the sentence, but also comprehensively considers the importance of the words and the consistency of the part-of-speech tags in the sentence, thereby better capturing the semantic relationship between sentences. This method makes the sentence similarity calculation more detailed and accurate, helps to perform more precise semantic comparison and semantic analysis of the text, and improves the efficiency and accuracy of text processing tasks.

[0119] Example 4

[0120] The present application embodiment provides a document generation method. Figure 6 As shown, the following steps are included:

[0121] Step S602, receiving target chapter content;

[0122] Step S604, using the document writing intelligent recall method to determine whether to recall the reference chapter content.

[0123] The document writing intelligent recall method is the same as the method in Examples 1 to 3, which will not be described again here.

[0124] Step S606: When it is determined that the reference chapter content needs to be recalled, the reference chapter content is recalled, and a document is generated based on the target chapter content and the reference chapter content.

[0125] Example 5

[0126] The present application embodiment provides a document writing intelligent recall device, such as Figure 7 As shown, it includes a processing module 72 , a similarity calculation module 74 and a recall module 76 .

[0127] The processing module 72 is configured to perform structural processing on the reference file, preprocess the reference file after structural processing, and preprocess the target chapter content, wherein the target chapter content is content intelligently generated based on the reference chapter content.

[0128] The similarity calculation module 74 is configured to calculate the vector cosine similarity between the preprocessed target chapter content and the preprocessed reference chapter content of the reference file, and calculate the semantic matching similarity between the preprocessed target chapter content and the processed reference chapter content of the reference file;

[0129] The recall module 76 is configured to perform weighted calculation on the cosine similarity and the semantic matching similarity to obtain a similarity score, and determine whether to recall the reference chapter content based on the similarity score.

[0130] The present application also provides a document generation device, such as Figure 8 As shown, the document generation device includes: a receiving module 82, configured to receive target chapter content; a judgment module 84 is configured to use the document writing intelligent recall method described in Examples 1 to 3 to judge whether it is necessary to recall the reference chapter content; a generation module 86 is configured to recall the reference chapter content when it is judged that the reference chapter content needs to be recalled, and generate a document based on the target chapter content and the reference chapter content.

[0131] It should be noted that the device provided in the above embodiment is only illustrated by the division of the above functional modules. In actual applications, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the device is divided into different functional modules to complete all or part of the functions described above. In addition, the device provided in the above embodiment and the corresponding document writing intelligent recall method or the corresponding document generation device embodiment belong to the same concept. The specific implementation process is detailed in the method embodiment and will not be repeated here.

[0132] Example 5

[0133] Fig. 9 FIG. 1 shows a schematic diagram of the structure of an electronic device suitable for implementing the embodiment of the present disclosure. It should be noted that: Fig. 9 The electronic device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present disclosure.

[0134] like Fig. 9 As shown, the electronic device includes a central processing unit (CPU) 1001, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 1002 or a program loaded from a storage part 1008 into a random access memory (RAM) 1003. In the RAM 1003, various programs and data required for system operation are also stored. The CPU 1001, the ROM 1002, and the RAM 1003 are connected to each other via a bus 1004. An input / output (I / O) interface 1005 is also connected to the bus 1004.

[0135] The following components are connected to the I / O interface 1005: an input section 1006 including a keyboard, a mouse, etc.; an output section 1007 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker, etc.; a storage section 1008 including a hard disk, etc.; and a communication section 1009 including a network interface card such as a LAN card, a modem, etc. The communication section 1009 performs communication processing via a network such as the Internet. A drive 1010 is also connected to the I / O interface 1005 as needed. A removable medium 1011, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 1010 as needed, so that a computer program read therefrom is installed into the storage section 1008 as needed.

[0136] In particular, according to an embodiment of the present disclosure, the process described below with reference to the flowchart can be implemented as a computer software program. For example, an embodiment of the present disclosure includes a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program contains a program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from the network through the communication part 1009, and / or installed from the removable medium 1011. When the computer program is executed by the central processing unit (CPU) 1001, various functions defined in the method and apparatus of the present application are executed. In some embodiments, the electronic device may also include an AI (Artificial Intelligence) processor, which is used to process computing operations related to machine learning.

[0137] It should be noted that the computer-readable medium shown in the present disclosure may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present disclosure, a computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in combination with an instruction execution system, device or device. In the present disclosure, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, in which a computer-readable program code is carried. This propagated data signal may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. Computer-readable signal media may also be any computer-readable medium other than computer-readable storage media, which may send, propagate or transmit a program for use by or in conjunction with an instruction execution system, apparatus or device. The program code contained on the computer-readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wire, optical cable, RF, etc., or any suitable combination of the above.

[0138] The flow charts and block diagrams in the accompanying drawings illustrate the possible architecture, functions and operations of the systems, methods and computer program products according to various embodiments of the present disclosure. In this regard, each box in the flow chart or block diagram can represent a module, a program segment, or a part of a code, and the above-mentioned module, program segment, or a part of a code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram or flow chart, and the combination of the boxes in the block diagram or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.

[0139] The units involved in the embodiments described in the present disclosure may be implemented by software or hardware, and the units described may also be arranged in a processor. The names of these units do not, in some cases, constitute limitations on the units themselves.

[0140] As another aspect, the present application further provides a computer-readable medium, which may be included in the electronic device described in the above embodiment; or may exist independently without being assembled into the electronic device.

[0141] The computer-readable medium carries one or more programs, and when the one or more programs are executed by an electronic device, the electronic device implements the method described in the following embodiments. For example, the electronic device can implement each step of the method embodiment.

[0142] If the integrated units in the above embodiments are implemented in the form of software functional units and sold or used as independent products, they can be stored in the above computer-readable storage medium. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product, which is stored in a storage medium and includes several instructions for enabling one or more computer devices (which may be personal computers, servers, or network devices, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present application.

[0143] In the above embodiments of the present application, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, please refer to the relevant description of other embodiments.

[0144] In the several embodiments provided in the present application, it should be understood that the disclosed terminal device can be implemented in other ways. Among them, the device embodiments described above are only schematic, for example, the division of the units is only a logical function division, and there may be other division methods in actual implementation, for example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of units or modules, which can be electrical or other forms.

[0145] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0146] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.

[0147] The above is only a preferred implementation of the present application. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principles of the present application. These improvements and modifications should also be regarded as the scope of protection of the present application.

Claims

1. A document writing intelligent recall method, characterized in that: include: Performing structural processing on the reference file, preprocessing the structurally processed reference file, and preprocessing the target chapter content, wherein the target chapter content is chapter title information of the content to be generated; Calculating the vector cosine similarity between the preprocessed target chapter content and the preprocessed reference chapter content of the reference file, and calculating the semantic matching similarity between the preprocessed target chapter content and the reference chapter content; The cosine similarity and the semantic matching similarity are weightedly calculated to obtain a similarity score, and whether to recall the reference section is determined based on the similarity score.

2. The method according to claim 1, characterized in that Structuring of reference documents, including: Determining whether the reference file conforms to a preset format; If the reference file conforms to the preset format, extracting chapter titles and content corresponding to the chapter titles from the reference file; In the case that the reference file does not conform to the preset format, the chapter title and the content corresponding to the chapter title are identified and separated from the reference file based on the context of the reference file, and the content corresponding to the chapter title is used as the reference chapter content.

3. The method according to claim 2, characterized in that Preprocessing the reference file after structure processing includes: Based on a medical dictionary, segmenting the reference chapter content in the reference document after structured processing to obtain a first segmentation set corresponding to the reference chapter content, and filtering out stop words from the first segmentation set; Performing word meaning expansion and weighting processing on the words that meet the preset conditions in the filtered first word segmentation set, calculating the word vectors of the words in the first word segmentation set after the word meaning expansion and weighting processing, and obtaining a first word vector set; The first sentence vector of the whole sentence corresponding to the word vector in the first word vector set is calculated, and the word vector in the first word vector set and the corresponding first sentence vector are weighted summed to obtain a reference content vector.

4. The method according to claim 3, characterized in that Preprocess the target chapter content, including: Based on a medical dictionary, the target chapter content is segmented to obtain a second segmentation set corresponding to the target chapter content, and stop words are filtered out from the second segmentation set; Performing word meaning expansion and weighting processing on the words that meet the preset conditions in the filtered second word segmentation set, calculating the word vectors of the words in the second word segmentation set after the word meaning expansion and weighting processing, and obtaining a second word vector set; The second sentence vector of the whole sentence corresponding to the word vector in the second word vector set is calculated, and the word vector in the second word vector set and the corresponding second sentence vector are weighted summed to obtain the target chapter content vector.

5. The method according to claim 4, characterized in that Determining whether to recall the reference section based on the similarity score includes: When the similarity score is greater than a preset threshold, determining to recall the reference chapter; When the similarity score is less than or equal to the preset threshold, it is determined not to recall the reference chapter.

6. A document generation method, characterized in that: include: Receive the target chapter content; Using the document writing intelligent recall method described in any one of claims 1 to 5, determining whether to recall the reference chapter content in the reference document; In the case where it is determined that the reference chapter content needs to be recalled, the reference chapter content is recalled, and a document is generated based on the target chapter content and the reference chapter content.

7. A document writing intelligent recall device, characterized in that: include: A processing module is configured to perform structural processing on the reference file, preprocess the reference file after structural processing, and preprocess the target chapter content, wherein the target chapter content is chapter title information of the content to be generated; A similarity calculation module is configured to calculate the vector cosine similarity between the preprocessed target chapter content and the preprocessed reference chapter content of the reference file, and calculate the semantic matching similarity between the preprocessed target chapter content and the processed reference chapter content of the reference file; The recall module is configured to perform weighted calculation on the cosine similarity and the semantic matching similarity to obtain a similarity score, and determine whether to recall the reference chapter content based on the similarity score.

8. A document generation device, characterized in that: include: A receiving module, configured to receive target chapter content; A judgment module, configured to use the document writing intelligent recall method according to any one of claims 1 to 5 to judge whether the reference chapter content needs to be recalled; The generating module is configured to recall the reference chapter content when it is determined that the reference chapter content needs to be recalled, and generate a document based on the target chapter content and the reference chapter content.

9. An electronic device, characterized in that: include: a memory configured to store a computer program; The processor is configured to make the computer execute the method according to any one of claims 1 to 5 when the program is executed.

10. A computer-readable storage medium having a program stored thereon, characterized in that: When the program is executed, the computer is enabled to execute the method according to any one of claims 1 to 5.

Citation Information

Cited By

  • Non-standard document slicing processing method

    CN119538921A

  • A Slicing Method for Non-standard Documents

    CN119538921B

  • Intelligent writing system and method based on multilayer feature fusion

    CN119830872A

  • An intelligent writing system and method based on multi-layer feature fusion

    CN119830872B

  • Multi-party video conference collaborative conversion method, system and conference terminal

    CN119893029A