Paper book AI auxiliary reading system and method and computer program product
Through the combination of large language models and RAG technology, efficient AI-assisted reading of paper books is achieved, which solves the problems of high complexity and poor answering effect of existing technologies, supports the reading of large books, and improves the depth and depth of content understanding. accuracy.
Patent Information
- Application Number
- CN202410758178.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-13
- Publication Date
- 2024-10-01
AI Technical Summary
Existing AI-assisted reading technology is highly complex to use in paper books, has poor answering effects, and does not support books with large number of pages.
An AI-assisted reading system for paper books based on large language models and RAG technology is used to generate content slices by slicing the electronic versions of paper books, and uses a generative large language model to perform search prompt word enhancement questions, combined with vector similarity. And keyword retrieval recalls content slices to generate answers to questions.
It reduces the complexity of use, improves the relevance and accuracy of answers, enables readers to understand the content of paper books more quickly and deeply, supports the reading of larger books, and improves recall results through multi-channel recall and rearrangement algorithms. quality.
Smart Images

Figure CN118733752A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of AI technology, and in particular to a paper book AI-assisted reading system, method and computer program product, which are implemented based on a large language model and RAG (Retrieval-Augmented Generation) technology. Background Art
[0002] With the help of AI-assisted reading technology, readers can understand the content of e-books more quickly and deeply. For example, a generative large language model can be used to answer readers' questions based on the content of the book.
[0003] At present, the main form of application of generative large language models in e-books is to upload e-books to the generative large language model, then ask questions, and the generative large language model will answer based on the content of the e-book. Typical applications include Tongyi Qianwen and Kimi. However, these applications have the following defects:
[0004] First, readers are required to provide book content, which increases the complexity and difficulty of use.
[0005] Second, some of the recalled content was not highly relevant to the target question, resulting in poor answering results;
[0006] Third, there is an upper limit on the number of words and the number of books uploaded by users, and books with a large number of pages are not supported. Summary of the invention
[0007] In view of the above-mentioned defects, the technical problem to be solved by the present invention is to provide a paper book AI-assisted reading system, method and computer program product to solve the problem that the existing technology is complex and difficult to use and the answer effect is poor.
[0008] To this end, the present invention provides a paper book AI-assisted reading method based on a large language model and RAG, comprising the following steps:
[0009] Slicing the electronic version of the paper book to obtain content slices of the electronic version of the paper book, and storing them in the auxiliary reading database, wherein each content slice includes: slice location information, original text, content summary and keywords;
[0010] Scan the auxiliary reading mark on the paper book to open the auxiliary reading interface, and enter the question through the auxiliary reading interface;
[0011] The text of the question is split into words, and the distance between each word obtained by the splitting and the professional vocabulary vector of the field related to the paper book is calculated to obtain the professional vocabulary closest to each word, and then the question and the professional vocabulary closest to each word are sent to the generative large language model, which rewrites the question to generate search prompt words to enhance the question;
[0012] Searching the auxiliary reading database according to the search prompt word enhanced question to obtain the corresponding recallable content slices; calculating the similarity between all the recallable content slices and the search prompt word enhanced question in sequence, and selecting some of the recallable content slices as recall content slices according to the order of similarity scores from high to low;
[0013] A large language model is used to generate answers to questions based on questions and recalled content slices, and displayed on the auxiliary reading interface.
[0014] In the above method, preferably, slicing the electronic version of the paper book to obtain content slices of the electronic version of the paper book specifically includes the following steps:
[0015] Define the hierarchical relationship of paper books and the beginning mark templates in each hierarchy to form the book structure splitting rules;
[0016] Using the book structure splitting rules, the book body content is split to obtain structure slices with complete content and a character count of 512±200;
[0017] Use the large language model to summarize the content and extract keywords for each structure slice to obtain the primary slice;
[0018] Perform semantic processing on all primary slices to obtain semantic slices, and further perform semantic splitting and merging on the semantic slices;
[0019] The split and merged semantic slices are re-summarized and keywords are extracted to obtain the final book content slices.
[0020] In the above method, preferably, semantic processing is performed on all primary slices to obtain semantic slices, and the semantic slices are further semantically split and merged. The specific processing process is as follows:
[0021] Calculate the content information content of each primary slice;
[0022] Compare the content information amount of each primary slice with the set threshold value. When the content information amount exceeds the set threshold value, further split the primary slice until the content information amount of all primary slices meets the set threshold requirement;
[0023] The similarity score of each primary slice is calculated, and the primary slices whose similarity reaches the similarity threshold are merged.
[0024] In the above method, preferably, rewriting the question by a generative large language model to generate a search prompt word enhanced question includes the following steps:
[0025] Split the question into words to obtain split words;
[0026] According to the field of the paper book, the distance between the split words and the professional word vectors in the field of the paper book is calculated to obtain the professional word that is closest to the split words;
[0027] Send the question and professional terms to the large language model, rewrite and generate search prompt words to enhance the question.
[0028] In the above method, preferably, vector similarity retrieval and keyword retrieval are used to recall the matched content slices respectively, and the similarity scores of all the recalled content slices are calculated in turn with the search prompt word enhanced question, and the three content slices with the highest similarity scores are used as the final recalled slices.
[0029] In the above method, preferably, the similarity score is calculated using the following formula:
[0030] Similarity Score=α·Rouge_L(text1,text2)+β·(|keywords1∩
[0031] keywords2| / |keywords1∪keywords2|)+γ·
[0032] cos(vec(text1),vec(text2))+δ·cos(sentvec(text1),sentvec(text2))+
[0033] ζ·CoveredContent(slice1,slice2) / TotalContent(slice1);
[0034] In the formula,
[0035] ROUGE-L(text1,text2) is the similarity between two slices text1 and text2 on the longest common subsequence;
[0036] K is the overlap between keywords keywords1 and keywords2 in the two slices, K = |keywords1∩keywords2| / |keywords1∪keywords2|;
[0037] W is the vocabulary similarity, W = cos(vec(slice1), vec(slice2)), where vec(slice) is the vocabulary embedding vector of slice slice;
[0038] S is the sentence similarity, S = cos(sentvec(slice1), sentvec(slice2)), where sentvec(slice) is the sentence embedding vector of slice slice;
[0039] C is the content coverage, C = CoveredContent(slice1, slice2) / TotalContent(slice1), where CoveredContent is calculated by the N-gram matching method in natural language processing;
[0040] α, β, γ, δ, and ζ are constant weights. They are first randomly assigned default values and then modified based on test results to determine the final values.
[0041] The present invention also provides a paper book AI-assisted reading system based on a large language model and RAG, comprising:
[0042] The slicing processing module is used to slice the electronic version of the paper book to obtain content slices of the electronic version of the paper book and save them in the auxiliary reading database. Each content slice includes: slice location information, original text, content summary and keywords;
[0043] An input module is used to scan the auxiliary reading mark on the paper book, open the auxiliary reading interface, and input questions through the auxiliary reading interface;
[0044] The retrieval prompt word enhancement module is used to split the text of the question into words, and calculate the distance between each word obtained by the split and the professional vocabulary vector of the field related to the paper book to obtain the professional vocabulary closest to each word, and then send the question and the professional vocabulary closest to each word to the generative large language model, which rewrites the question to generate a retrieval prompt word enhanced question;
[0045] The recall module is used to search the auxiliary reading database according to the search prompt word enhanced question to obtain the corresponding recallable content slices; all the recallable content slices are sequentially calculated with the search prompt word enhanced question for similarity, and according to the order of similarity scores from high to low, some of the recallable content slices are used as recall content slices;
[0046] The output module is used to use the large language model to generate answers to the questions based on the questions and recalled content slices, and display them on the auxiliary reading interface.
[0047] In the above system, preferably, the slice processing module includes:
[0048] The format template slicer is used to split the main text of the book using the book structure splitting rules to obtain structure slices with complete content and a character count of 512±200; wherein the hierarchical relationship of paper books and the beginning identification templates in each hierarchy are defined to form the book structure splitting rules;
[0049] A first content summarization and first keyword extraction unit, used to perform content summarization and keyword extraction on each structure slice using a large language model to obtain a primary slice;
[0050] A slice semantic processor is used to perform semantic processing on all primary slices to obtain semantic slices, and further perform semantic splitting and merging on the semantic slices;
[0051] The second content summarization and second keyword extraction unit is used to re-summarize the content and extract keywords from the split and merged semantic slices to obtain the final book content slices.
[0052] In the above system, preferably, the slice semantic processor further splits the primary slice according to the comparison result of the content information amount of each primary slice with the set threshold.
[0053] The present invention also provides a computer program product, including a computer program / instruction, which, when executed by a processor, implements the above-mentioned AI-assisted reading method for paper books based on a large language model and RAG.
[0054] It can be seen from the above technical solutions that the AI-assisted paper book reading system, method and computer program product provided by the present invention solve the problems of high complexity and difficulty in using the prior art and poor answering effect. Compared with the prior art, the present invention has the following beneficial effects:
[0055] Based on the big language model and RAG, AI-assisted reading of paper books is realized, which perfectly combines the capabilities of the big language model with paper books. Based on the semantic retrieval and question-and-answer service of the whole book, readers can understand the content of paper books more quickly and deeply. BRIEF DESCRIPTION OF THE DRAWINGS
[0056] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the following briefly introduces and describes the drawings required for use in the embodiments of the present invention or the description of the prior art. Obviously, the drawings described below are only some embodiments of the present invention, and for ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0057] Figure 1 A flow chart of a paper book AI-assisted reading method based on a large language model and RAG provided for this application;
[0058] Figure 2 A schematic diagram of generating a query for search prompt word enhancement in this application;
[0059] Figure 3 A flowchart of slicing the electronic version of a paper book to obtain content slices of the electronic version of the paper book in this application;
[0060] Figure 4 This is a schematic diagram of the book structure breakdown in this application;
[0061] Figure 5 A schematic diagram of content summarization and keyword extraction for structure slices in this application;
[0062] Figure 6 A flowchart from user question to answer recall for the best solution for this application. DETAILED DESCRIPTION
[0063] This application implements AI-assisted reading of paper books based on a large language model and RAG, perfectly combining the capabilities of a large language model with paper books, and based on full-book semantic retrieval and question-and-answer services, enables readers to understand the content of paper books more quickly and deeply.
[0064] Specifically, paper books are printed with auxiliary reading marks, such as QR codes. Readers can scan the auxiliary reading marks through mobile electronic devices such as mobile phones to enter the AI assisted reading platform. The AI assisted reading platform stores electronic content slices of paper books. Readers can ask questions about paper books through the AI assisted reading platform and answer the questions based on the large language model and RAG.
[0065] The following will be combined with the accompanying drawings of the embodiments of the present invention to clearly and completely describe the technical solutions of the embodiments of the present invention. Obviously, the embodiments described below are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present invention.
[0066] In order to more clearly explain and illustrate the technical solution and implementation of the present invention, several preferred specific embodiments for implementing the technical solution of the present invention are introduced below.
[0067] It should be noted that the directional words such as "inside, outside", "front, back" and "left, right" in this article are expressed based on the product usage status. Obviously, the use of the corresponding directional words does not constitute a limitation on the protection scope of this scheme.
[0068] like Figure 1 As shown, the present application provides a paper book AI-assisted reading method based on a large language model and RAG, comprising the following steps:
[0069] Step 110, slicing the electronic version of the paper book to obtain content slices of the electronic version of the paper book, and saving them in the auxiliary reading database.
[0070] The content slice is used for RAG recall to generate answers to questions asked by readers. The auxiliary reading database is stored in the cloud or downloaded to the local electronic device.
[0071] Each content slice includes the slice location information, original text, content summary and keywords. This enables one-click location of the original text, and readers can easily see the original text content and context while seeing the questions asked, which helps readers understand the original text in combination with questions and answers.
[0072] Step 120, by scanning the auxiliary reading mark on the paper book, the auxiliary reading interface is opened, and the question is input through the auxiliary reading interface.
[0073] Assisted reading logos are usually in the form of QR codes and printed on paper books. Readers can scan the assisted reading logo through mobile electronic devices such as mobile phones to enter the AI assisted reading platform and open the assisted reading interface.
[0074] The auxiliary reading interface is used to input questions and display answers to the questions. Inputting questions supports text input and voice input. Among them, when using the voice input mode, the voice is converted into text using the voice-to-text tool.
[0075] When scanning to enter the assisted reading platform, you need to enter the user code for verification. Only after successful verification will the assisted reading interface be opened and the AI assisted reading function be used. If the verification fails, the reader will be prompted that the user does not have permission to use it, and the correct way to use it. For example, the process of recharging to purchase a user code and the process of using the AI assisted reading function, etc.
[0076] Step 130, the text of the question is split into words, and the distance between each word obtained by the splitting and the professional vocabulary vector of the field related to the paper book is calculated to obtain the professional vocabulary closest to each word, and then the question and the professional vocabulary closest to each word are sent to the generative large language model, and the generative large language model rewrites the question to generate retrieval prompt words to enhance the question. The professional vocabulary in the field related to paper books is summarized in advance and saved on the AI assisted reading platform, and can also be downloaded to the local electronic device.
[0077] Because most readers' questions are non-professional, the words used in their questions are not standard or are highly colloquial, which results in unsatisfactory recall effects of traditional RAG. This application enhances the search prompt words of the questions, so that the questions use professional words in the relevant fields of the paper book as much as possible, thereby increasing the matching between the questions and the book content and improving the recall effect of RAG.
[0078] Retrieval cue word enhancement, that is, the generative large language model rewrites the question to generate retrieval cue word enhancement questions.
[0079] First, we conduct a preliminary analysis of the questions asked by readers and users, split the questions into words, and then calculate the distance between the words obtained by splitting and the professional word vectors in the field of the paper book according to the field of the paper book to obtain the most similar book words. Then, we send the questions asked by readers and professional words to the large language model, and rewrite them to generate search prompt words to enhance the questions. As a result, we add words with stronger relevance to the questions asked by readers and users, increase the matching between the questions asked by readers and the content of the book, and thus improve the recall effect.
[0080] Figure 2 An example of search cue word enhancement is shown.
[0081] User question: How to divide property during divorce?
[0082] Book field: Law of the People's Republic of China.
[0083] After the search prompt words are enhanced: What are the specific legal basis and practical operations for the division of divorce property in the Marriage Law?
[0084] Step 140, search the auxiliary reading database according to the search prompt word enhanced question to obtain the corresponding recallable content slices; calculate the similarity between all the recallable content slices and the search prompt word enhanced question in turn, and select some of the recallable content slices as recalled content slices according to the order of similarity scores from high to low.
[0085] The traditional RAG method usually directly uses the vector similarity retrieval method to perform slice recall, resulting in that some of the content in the recalled top_k slices is not highly correlated with the target question, and the recall effect is not ideal. The present application adds keyword retrieval recall on the basis of traditional vector similarity retrieval, that is, the keywords in the title after the retrieval prompt is enhanced (the keywords are obtained in the retrieval prompt word enhancement step) are used to match keywords with the original content and summarized content in the content slice, and the matched content slices are also used together. In other words, the present application uses a multi-way recall method, combining vector similarity retrieval recall and keyword recall, which can enrich the recall results and avoid omissions.
[0086] Furthermore, this application also uses a relevance score-based re-ranking algorithm to re-order the recalled results, obtain the contents of the three content slices with the highest relevance to the question, and answer the question. This can maximize the use of book content and provide accurate answers.
[0087] Step 150: Generate an answer to the question using the large language model based on the question and the recalled content slices, and display it on the auxiliary reading interface.
[0088] This application combines the content of paper books with the capabilities of the current powerful large language model. Readers can get the semantic retrieval and question-answering services of the whole book based on the large model at a very low cost and difficulty. In addition, each question can be located in the original text of the book during the use of the reader, allowing readers to understand the content of the book more quickly and deeply. The large language model can use existing general models, such as Tongyi Qianwen, Kimi, Wenxin Yiyan, etc., and use the interfaces of these large language models to summarize content and extract keywords, generate search prompts to enhance questions, and generate answers.
[0089] At the same time, this application optimizes the traditional RAG method, reorders the recalled content slices, and improves the quality and relevance of the generated results. After testing, for the same question, the excellent answer rate of this application method reached 87.7% compared with the traditional RAG method.
[0090] In the present application, the electronic version of the paper book is sliced in a different way from the existing conventional technology. The existing conventional slicing technology usually slices according to the number of characters. This method is prone to semantic slicing, that is, the content in the slice is not a complete paragraph, resulting in poor recall effect. The present application uses a semi-automatic slicing technology that combines book structure splitting and book semantic splitting. It can quickly slice books efficiently and with high quality. At the same time, the slicing method has good scalability and can be quickly expanded for slicing of various types of books.
[0091] To this end, in step 110 of the present application, the electronic version of the paper book is sliced to obtain content slices of the electronic version of the paper book, which is achieved by the following method: manually giving the sequence format of the book chapter titles, structurally splitting the entire book according to the sequence format of the book chapter titles, summarizing the content and extracting keywords for each slice after the structural splitting, further semantically splitting and merging the slices after the structural splitting, merging slices with similar semantic content but distributed in different positions in the book, and finally re-summarizing the content and extracting keywords for the merged slices to obtain the final book content slices.
[0092] like Figure 3 As shown, step 110 specifically includes the following steps:
[0093] Step 111, define the hierarchical relationships of book chapters, sections, etc. and the paragraph format templates in each hierarchy to form book structure splitting rules. The format template segmenter uses the above book structure splitting rules to split the book body content to obtain complete structure slices with a character count of 512±200.
[0094] The following are some examples:
[0095] Assuming that the top-level title in the book's text structure is [Introduction, Chapter 1, Chapter 2, ..., Chapter n, Conclusion], by defining the top-level title or the top-level title format and using regular matching, the beginning of the large chapter can be located.
[0096] Each top-level title has subdivided sections. Each section may be marked in a separate line "I. xxx" or a separate line "(I) xxx". This kind of regular section title format can be obtained by manually analyzing the book, writing the format into a regular expression, and expressing the hierarchical relationship in the form of an array. By default, the 0th item in the array is the top level, the 1st item is the second level under the top level, and so on. There may be multiple rules for each level, and the array is used to record the possible title formats in the level.
[0097] The format template slicer first uses the hierarchical relationship array to locate the beginning of each main content and the beginning of the next main content. The content between these two positions is the main text of the book, such as Figure 4 shown.
[0098] After obtaining the main text content, the format template slicer will count the number of words, the number of paragraphs (paragraphs are separated by line breaks) and other information of the content, and split multiple paragraphs according to the number of characters to obtain structural slices with complete content and a character count of 512±200. Structural slices include: slice location information and original text.
[0099] Step 112, use the big language model to summarize the content and extract keywords from each structure slice to obtain a primary slice. That is, the content summarizer uses the big language model interface to summarize the slice content, and the key adjustment extractor uses the big language model interface to extract keywords from the slice content. The primary slice includes: slice location information, original text, content and keywords. Figure 5 shown.
[0100] Step 113, using a slice semantic processor to perform semantic processing on all primary slices to obtain semantic slices.
[0101] Step 114, re-summarize the content and extract keywords for the semantic slices to generate the final book content slices.
[0102] During the semantic processing, some primary slices may be split and some may be merged, so it is necessary to re-summarize the content and extract keywords for the semantic slices.
[0103] The specific process of obtaining semantic slices is as follows:
[0104] Step 1131, calculate the content information amount I of each primary slice using the following formula:
[0105]
[0106] In the formula,
[0107] N is the total number of characters in the text.
[0108] A is the average word length, which is calculated by dividing the total number of characters by the total number of words, A=N / W, where W is the total number of words.
[0109] H is the entropy of word frequency distribution, which is used to measure the diversity of vocabulary usage and information density in the text.
[0110] M is the number of unique words, and pi is the frequency of each word.
[0111] P is the number of paragraphs, that is, the number of paragraphs in the text.
[0112] S is the number of sentences, that is, the number of sentences in the text.
[0113] K is the number of keywords, that is, the number of keywords in the text.
[0114] D is information density, that is, the average amount of information in each paragraph. D = I paragraph / P,I paragraph It is the total amount of information in the paragraph.
[0115] x1, x2, x3, x4, x5, x6, and x7 are constant weights. They are first randomly assigned default values and then modified based on test results to determine the final values.
[0116] Step 1132, compare the content information volume of each primary slice with the set threshold. When the content information volume exceeds the set threshold, it is considered that the content of the current slice is too much and needs to be further split until the content information volume of all primary slices meets the set threshold requirements.
[0117] Step 1133, calculate the similarity score of each primary slice, and merge the primary slices whose similarity reaches the similarity threshold. Because a high similarity score indicates that the two primary slices may be describing the same semantic content, but they may be distributed in different locations in the book, or even far apart. Merging similar primary slices is conducive to improving the effect of subsequent answers to the content of the whole book.
[0118] The formula for calculating the similarity score is as follows:
[0119] Similarity Score=αR+βK+γW+δS+ζC
[0120] =α·Rouge_L(text1,text2)+β·(|keywords1∩keywords2| /
[0121] |keywords1∪keywords2|)+γ·cos(vec(text1),vec(text2))+δ·
[0122] cos(sentvec(text1),sentvec(text2))+ζ·
[0123] CoveredContent(slice1,slice2) / TotalContent(slice1).
[0124] In the formula,
[0125] ROUGE-L(text) is the length of the longest common subsequence divided by the length of the automatic summary of the slice text, and ROUGE_L(text1, text2) represents the similarity between the two slices text1 and text2 on the longest common subsequence.
[0126] K is the overlap degree of keywords keywords1 and keywords2 in the two slices, K = |keywords1∩keywords2| / |keywords1∪keywords2|, which is used to measure the overlap of keywords keywords1 and keywords2 in the two slices.
[0127] W is the vocabulary similarity, W = cos(vec(slice1), vec(slice2)), where vec(slice) is the vocabulary embedding vector of slice slice, which can be calculated using the cosine similarity of the vocabulary embedding.
[0128] S is the sentence similarity, S = cos(sentvec(slice1), sentvec(slice2)), where sentvec(slice) is the sentence embedding vector of slice slice, which can be calculated using the cosine similarity of sentence embedding.
[0129] C is the content coverage,
[0130] C=CoveredContent(slice1, slice2) / TotalContent(slice1), where CoveredContent is calculated by the N-gram matching method in natural language processing.
[0131] α, β, γ, δ, and ζ are constant weights. They are first randomly assigned default values and then modified based on test results to determine the final values.
[0132] In this application, in order to solve the problem that the recall effect of traditional RAG is not ideal, on the basis of enhancing the retrieval prompt words, a multi-way recall strategy and a recall slice rearrangement strategy are added for further optimization.
[0133] In this application, the slice recall method used in step 140 is as follows:
[0134] Step 141, a multi-way recall strategy, that is, using vector similarity retrieval and keyword retrieval to respectively recall the matched content slices.
[0135] In traditional RAG methods, vector retrieval is usually used directly to recall slices. This solution adopts a multi-way recall strategy. On the basis of using vector retrieval, keyword retrieval recall is added, that is, the keywords in the title after the retrieval prompt is enhanced (the keywords in this step are directly obtained in the retrieval prompt word enhancement step) are used to match the original content and summarized content in the slice, and the matched slices are also used together to avoid omissions.
[0136] Step 142, deduplicate the slice contents, that is, deduplicate the duplicate slices.
[0137] Since a multi-way recall strategy is used, there may be a situation where the same slices exist in the slices recalled by the two recall methods. Therefore, it is necessary to deduplicate the duplicate slices.
[0138] Step 143, slice correlation rearrangement.
[0139] All the recalled slices are compared with the readers' questions enhanced by the search prompt words in turn to calculate the Similarity Score, and finally the three slices with the highest scores are taken as the final recalled slices.
[0140] (The detailed calculation method of Similar Score has been introduced in step 1133 and will not be repeated here.
[0141] Based on the above description, the optimal solution in this application (search prompt word enhancement + multi-way recall strategy + recall slice re-arrangement strategy) has a complete process from user question to answer recall as follows: Figure 6 shown.
[0142] Based on the above method, the present invention also provides a paper book AI-assisted reading system based on a large language model and RAG, comprising:
[0143] The slicing processing module is used to slice the electronic version of the paper book to obtain content slices of the electronic version of the paper book and save them in the auxiliary reading database. Each content slice includes: slice location information, original text, content summary and keywords;
[0144] An input module is used to scan the auxiliary reading mark on the paper book, open the auxiliary reading interface, and input questions through the auxiliary reading interface;
[0145] The retrieval prompt word enhancement module is used to split the text of the question into words, and calculate the distance between each word obtained by the split and the professional vocabulary vector of the field related to the paper book to obtain the professional vocabulary closest to each word, and then send the question and the professional vocabulary closest to each word to the generative large language model, which rewrites the question to generate a retrieval prompt word enhanced question;
[0146] The recall module is used to search the auxiliary reading database according to the search prompt word enhanced question to obtain the corresponding recallable content slices; all the recallable content slices are sequentially calculated with the search prompt word enhanced question for similarity, and according to the order of similarity scores from high to low, some of the recallable content slices are used as recall content slices;
[0147] The output module is used to use the large language model to generate answers to the questions based on the questions and recalled content slices, and display them on the auxiliary reading interface.
[0148] In the above system, the slice processing module includes:
[0149] The format template slicer is used to split the main text of the book using the book structure splitting rules to obtain structure slices with complete content and a character count of 512±200; wherein the hierarchical relationship of paper books and the beginning identification templates in each hierarchy are defined to form the book structure splitting rules;
[0150] A first content summarization and first keyword extraction unit, used to perform content summarization and keyword extraction on each structure slice using a large language model to obtain a primary slice;
[0151] A slice semantic processor is used to perform semantic processing on all primary slices to obtain semantic slices, and further perform semantic splitting and merging on the semantic slices;
[0152] The second content summarization and second keyword extraction unit is used to re-summarize the content and extract keywords from the split and merged semantic slices to obtain the final book content slices.
[0153] In the above system, the slice semantic processor further splits the primary slice according to the comparison result of the content information amount of each primary slice with the set threshold.
[0154] The above-mentioned AI-assisted reading method for paper books based on a large language model and RAG can be implemented as a computer software program. For example, the present invention also provides a computer program product, including a computer program / instruction, which implements the above-mentioned AI-assisted reading method for paper books based on a large language model and RAG when executed by a processor.
[0155] Based on the description of the above specific embodiments, the paper book AI-assisted reading system, method and computer program product provided by the present invention have the following advantages compared with the prior art:
[0156] First, the content of paper books is combined with the capabilities of today’s powerful large language models, allowing readers to understand the content of books more quickly and deeply.
[0157] Second, by using a semi-automatic slicing technology that combines book structure splitting and book semantic splitting, books can be quickly sliced efficiently and with high quality. At the same time, this slicing method has good scalability and can be quickly expanded to slice various types of books.
[0158] Third, the recall method uses multi-way recall, which combines vector similarity retrieval recall and traditional keyword recall, which can enrich the recall results and avoid omissions.
[0159] Fourth, for the recall results, a re-ranking algorithm based on relevance scores is used to re-rank the recall results, and the content of the three slices with the highest relevance to the readers' questions is obtained to answer the readers' questions, so as to maximize the use of book content.
[0160] Fifth, the system supports one-click positioning of the original text, so readers can easily see the original content and context of the original text, which is conducive to readers understanding the original text in combination with questions and answers.
[0161] Sixth, it is no longer limited by the upper word count and number of books in the electronic version of the book, and has strong expansion capabilities.
[0162] Finally, it should be noted that the terms "comprises", "includes" or any other variants thereof as used herein are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, an element defined by the phrase "comprises a ..." does not exclude the presence of other identical elements in the process, method, article or device including the element.
[0163] The present invention is not limited to the above-mentioned optimal implementation mode. Anyone should be aware that any structural changes made under the inspiration of the present invention, and any technical solutions that are the same or similar to the present invention, fall within the protection scope of the present invention.
Claims
1. A paper book AI-assisted reading method based on a large language model and RAG, characterized in that: The following steps are involved: Slicing the electronic version of the paper book to obtain content slices of the electronic version of the paper book, and storing them in the auxiliary reading database, wherein each content slice includes: slice location information, original text, content summary and keywords; Scan the auxiliary reading mark on the paper book to open the auxiliary reading interface, and enter the question through the auxiliary reading interface; The text of the question is split into words, and the distance between each word obtained by the splitting and the professional vocabulary vector of the field related to the paper book is calculated to obtain the professional vocabulary closest to each word, and then the question and the professional vocabulary closest to each word are sent to the generative large language model, which rewrites the question to generate search prompt words to enhance the question; Searching the auxiliary reading database according to the search prompt word enhanced question to obtain the corresponding recallable content slices; calculating the similarity between all the recallable content slices and the search prompt word enhanced question in sequence, and selecting some of the recallable content slices as recall content slices according to the order of similarity scores from high to low; A large language model is used to generate answers to questions based on questions and recalled content slices, and displayed on the auxiliary reading interface.
2. The method according to claim 1, characterized in that: The electronic version of the paper book is sliced to obtain content slices of the electronic version of the paper book, which specifically includes the following steps: Define the hierarchical relationship of paper books and the beginning mark templates in each hierarchy to form the book structure splitting rules; Using the book structure splitting rules, the book body content is split to obtain structure slices with complete content and a character count of 512±200; Use the large language model to summarize the content and extract keywords for each structure slice to obtain the primary slice; Perform semantic processing on all primary slices to obtain semantic slices, and further perform semantic splitting and merging on the semantic slices; The split and merged semantic slices are re-summarized and keywords are extracted to obtain the final book content slices.
3. The method according to claim 2, characterized in that All primary slices are semantically processed to obtain semantic slices, and the semantic slices are further semantically split and merged. The specific processing process is as follows: Calculate the content information of each primary slice; Compare the content information amount of each primary slice with the set threshold value. When the content information amount exceeds the set threshold value, further split the primary slice until the content information amount of all primary slices meets the set threshold requirement; The similarity score of each primary slice is calculated, and the primary slices whose similarity reaches the similarity threshold are merged.
4. The method according to claim 1, characterized in that The generative large language model rewrites the question to generate search prompt words to enhance the question, including the following steps: Split the question into words to obtain split words; According to the field of the paper book, the distance between the split words and the professional word vectors in the field of the paper book is calculated to obtain the professional word that is closest to the split words; Send the question and professional terms to the large language model, rewrite and generate search prompt words to enhance the question.
5. The method according to claim 1, characterized in that Vector similarity retrieval and keyword retrieval are used to recall the matched content slices respectively, and the similarity scores of all the recalled content slices are calculated with the search prompt word enhanced question in turn, and the three content slices with the highest similarity scores are taken as the final recalled slices.
6. The method according to claim 5, characterized in that The similarity score is calculated using the following formula: Similarity Score=α·Rouge_L(text1,text2)+β·(|keywords1∩ keywords2| / |keywords1∪keywords2|)+γ· cos(vec(text1),vec(text2))+δ·cos(sentvec(text1),sentvec(text2))+ζ·CoveredContent(slice1,slice2) / TotalContent(slice1); In the formula, ROUGE-L(text1,text2) is the similarity between two slices text1 and text2 on the longest common subsequence; K is the overlap between keywords 1 and keywords 2 in the two slices. K=|keywords1∩keywords2| / |keywords1∪keywords2|; W is the vocabulary similarity, W = cos(vec(slice1), vec(slice2)), where vec(slice) is the vocabulary embedding vector of slice slice; S is the sentence similarity, S = cos(sentvec(slice1), sentvec(slice2)), where sentvec(slice) is the sentence embedding vector of slice slice; C is the content coverage, C=CoveredContent(slice1,slice2) / TotalContent(slice1), where, CoveredContent is calculated by the N-gram matching method in natural language processing; α, β, γ, δ, and ζ are constant weights. They are first randomly assigned default values and then modified based on test results to determine the final values.
7. A paper book AI-assisted reading system based on a large language model and RAG, characterized in that: include: The slicing processing module is used to slice the electronic version of the paper book to obtain content slices of the electronic version of the paper book and save them in the auxiliary reading database. Each content slice includes: slice location information, original text, content summary and keywords; An input module is used to scan the auxiliary reading mark on the paper book, open the auxiliary reading interface, and input questions through the auxiliary reading interface; The retrieval prompt word enhancement module is used to split the text of the question into words, and calculate the distance between each word obtained by the split and the professional vocabulary vector of the field related to the paper book to obtain the professional vocabulary closest to each word, and then send the question and the professional vocabulary closest to each word to the generative large language model, which rewrites the question to generate a retrieval prompt word enhanced question; The recall module is used to search the auxiliary reading database according to the search prompt word enhanced question to obtain the corresponding recallable content slices; all the recallable content slices are sequentially calculated with the search prompt word enhanced question for similarity, and according to the order of similarity scores from high to low, some of the recallable content slices are used as recall content slices; The output module is used to use the large language model to generate answers to the questions based on the questions and recalled content slices, and display them on the auxiliary reading interface.
8. The system according to claim 7, characterized in that The slice processing module comprises: The format template slicer is used to split the main text of the book using the book structure splitting rules to obtain structure slices with complete content and a character count of 512±200; wherein the hierarchical relationship of paper books and the beginning identification templates in each hierarchy are defined to form the book structure splitting rules; A first content summarization and first keyword extraction unit, used to perform content summarization and keyword extraction on each structure slice using a large language model to obtain a primary slice; A slice semantic processor is used to perform semantic processing on all primary slices to obtain semantic slices, and further perform semantic splitting and merging on the semantic slices; The second content summarization and second keyword extraction unit is used to re-summarize the content and extract keywords from the split and merged semantic slices to obtain the final book content slices.
9. The system according to claim 8, characterized in that The slice semantic processor further splits the primary slice according to the comparison result of the content information amount of each primary slice with the set threshold.
10. A computer program product comprising a computer program / instructions, characterized in that When the computer program / instructions are executed by a processor, the method according to any one of claims 1 to 6 is implemented.
Citation Information
Cited By
Digital publication multi-mode interactive reading method based on large language model
CN122861654A
