An intelligent retrieval management method and system based on OCR and document parsing
By combining OCR technology and in-depth semantic analysis in the intelligent search management system, comprehensive semantic labels are generated and word vector mapping matrix is constructed, and the problem of accuracy and inefficiency in the identification in the existing system is solved, achieving more efficient and accurate search results.
Patent Information
- Application Number
- CN202411281754.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-13
- Publication Date
- 2025-02-25
- Estimated Expiration
- 2044-09-13
AI Technical Summary
When faced with large-scale mixed data, the existing intelligent search management system has low recognition accuracy and efficiency, and relies on keyword matching to ignore semantic understanding, resulting in insufficient relevance and accuracy of search results.
Using an intelligent search management method based on OCR and document parsing, paper documents are converted into machine-readable text through document scanning and processing modules, and in-depth semantic understanding is carried out in combination with semantic analysis and label generation modules, comprehensive semantic labels are generated, and a mapping matrix between labels and text word vectors is constructed through feature extraction and mapping modules, so as to achieve the matching degree evaluation of user needs and document content and sorting of search results.
It significantly improves the relevance and accuracy of the search results, solves the problem of insufficient search results caused by traditional systems due to neglecting semantic understanding, and improves the system's data processing capabilities and efficiency.
Smart Images

Figure CN119128058B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of intelligent retrieval management, and in particular to an intelligent retrieval management method and system based on OCR and document parsing. Background Art
[0002] Optical character recognition (OCR) technology, as a technology for automatically recognizing printed or handwritten text, has been widely used in the field of document digitization and information extraction. OCR technology can convert text information in paper documents into machine-readable text format, thereby realizing the electronicization of documents. However, traditional OCR technology still has problems with recognition accuracy when facing complex document formats, diverse fonts and blurred text, resulting in low efficiency in subsequent document parsing and information retrieval. In order to improve the level of intelligence in document retrieval and management, researchers have proposed a method that combines OCR technology with document parsing technology. Document parsing technology not only involves the recognition of text content, but also includes the understanding of document structure and semantics. By combining OCR-recognized text with document parsing technology, the context and structure of document content can be better understood, and the accuracy and efficiency of information retrieval can be improved.
[0003] However, the existing intelligent retrieval management systems still have certain limitations and shortcomings in actual application. For example, the existing intelligent retrieval management systems often face the problem of large-scale and mixed retrieval data, and often rely on keyword matching while ignoring semantic understanding. This approach may lead to insufficient relevance and accuracy of retrieval results. Summary of the invention
[0004] The purpose of the present invention is to provide an intelligent retrieval management method and system based on OCR and document parsing to solve the problems raised in the above background technology.
[0005] In order to solve the above technical problems, the present invention provides the following technical solutions:
[0006] An intelligent retrieval management system based on OCR and document parsing, the system includes: a document scanning and processing module, a semantic analysis and label generation module, a feature extraction and mapping module, and a user demand analysis and retrieval module;
[0007] The document scanning and processing module uses a scanner to convert paper documents into image files, and applies OCR technology to convert image files into machine-readable text; it pre-processes image files and compares historical image files through feature point detection and RANSAC algorithm, screens and stores valid image files, and finally imports them into the database to form a text data set;
[0008] The semantic analysis and label generation module performs semantic analysis on each text in the text dataset, applies the topic model to generate basic semantic labels, uses NER technology to identify entities and relationships to generate supplementary semantic labels, and applies the sentiment analysis model to determine the sentiment labels of the text; it aggregates the basic semantic labels, supplementary semantic labels, and sentiment labels to form comprehensive semantic labels;
[0009] The feature extraction and mapping module extracts keywords from text data and calculates TF-IDF values to generate word vectors for the keyword set; associates the word vector of each text data with its semantic label and constructs a mapping matrix between the label and the text word vector;
[0010] The user demand analysis and retrieval module analyzes user demand data, cleans and standardizes data, extracts keywords and identifies entities and relationships, and generates a feature matrix for user queries. It evaluates the matching degree between text data and user needs by calculating similarity with the mapping matrix in the text data, and sorts and outputs the retrieval results.
[0011] Further, the document scanning and processing module includes an image scanning and preprocessing unit, a historical image comparison unit, and an OCR recognition unit;
[0012] The image scanning and preprocessing unit uses a scanner to scan paper documents into image files and performs preprocessing operations on the scanned image files; the historical image comparison unit obtains historical image files from the database, compares and analyzes them with the preprocessed image files, uses a feature point detection algorithm to extract key points and their descriptors, uses the RANSAC algorithm to estimate the transformation model, and calculates the reprojection error, sets a threshold based on the mean or standard deviation of the reprojection error, and filters and stores the filtered image files; the OCR recognition unit uses optical character recognition technology on the filtered image files, converts them into a machine-readable text format, and imports them into the database.
[0013] Furthermore, the semantic analysis and label generation module includes a topic modeling unit, an entity recognition and relationship extraction unit, a sentiment analysis unit, and a label aggregation unit;
[0014] The topic modeling unit uses the topic model to obtain the topic distribution of text data and generates basic semantic tags; the entity recognition and relationship extraction unit uses NER technology to identify entities in the text, uses the relationship extraction algorithm to identify the relationship between entities, and generates supplementary semantic tags; the sentiment analysis unit uses the sentiment analysis model to identify the sentiment tendency of the text, assigns scores according to the sentiment analysis results, and determines the final sentiment tags; the label aggregation unit aggregates the basic semantic tags, supplementary semantic tags and sentiment tags to form complete semantic tags.
[0015] Furthermore, the feature extraction and mapping module includes a keyword extraction unit, a word vector calculation unit, and a mapping matrix construction unit;
[0016] The keyword extraction unit extracts keywords from the text data, calculates the word frequency TF, the inverse document frequency IDF, and calculates TF-IDF, and selects the top m keywords based on TF-IDF to build a keyword set; the word vector calculation unit maps the keyword set to the word vector space and calculates the average word vector of the text data; the mapping matrix construction unit uses One-Hot Encoding to encode the semantic label into a vector, associates the word vector of each text data with its corresponding semantic label vector, and builds a mapping matrix between the label and the text word vector;
[0017] The user demand analysis and retrieval module includes a user demand data processing unit, a demand feature and semantic label generation unit, and a similarity calculation and ranking unit;
[0018] The user demand data processing unit obtains user demand data, cleans and standardizes it, and performs keyword extraction, entity recognition and relationship analysis on the user demand data; the demand feature and semantic label generation unit generates semantic labels for the user demand data, calculates word vectors for the user demand data, and associates them with the semantic labels to construct a feature matrix for the user query; the similarity calculation and sorting unit performs similarity calculation on the feature matrix of the user query and the mapping matrix of the labels and text word vectors in the text data set, thereby obtaining the matching degree between the user demand and the document content, sorts the text data according to the matching degree, and outputs the final retrieval results.
[0019] An intelligent retrieval management method based on OCR and document parsing, the method comprising the following steps:
[0020] Step S100. Scan the paper document into an image file using a scanner, convert the image file into a machine-readable text format using optical character recognition technology, import it into a database and form a text data set; perform semantic analysis on each text data in the text data set and generate corresponding semantic tags;
[0021] Step S200. Extract keywords from each text data in the text data set, and construct word vectors for the corresponding text data based on the extracted keywords; associate the word vectors of each text data with semantic labels, thereby obtaining a mapping matrix between labels and text word vectors;
[0022] Step S300: Obtain user demand data, analyze the user demand data, and thereby obtain the user's search intention and demand characteristics; based on the user's search intention and demand characteristics, construct a feature matrix of the user query;
[0023] Step S400. Calculate the similarity between the feature matrix of the user query and the mapping matrix of the labels and text word vectors in the text data set, so as to evaluate the matching degree between the user demand and the text data; and sort the text data in the text data set according to the matching degree between the user demand and the text data, so as to output the final retrieval result.
[0024] Furthermore, the text data set formed in step S100 includes the following contents:
[0025] Use a high-resolution scanner to scan paper documents into image files, and pre-process the image files; obtain the historical image files pre-saved in the database, and compare and analyze the historical image files with the pre-processed image files. The specific comparison and analysis process is as follows:
[0026] The key points and descriptors of the historical image file and the preprocessed image file are extracted by using a feature point detection algorithm, and the key point pairs in the historical image file and the preprocessed image file are matched by using the descriptors, and the matched key point pairs are selected, and the key point pairs are expressed as: (an, bn), where an represents the key point of the nth historical image file, bn represents the key point of the nth preprocessed image file, and n represents the key point number;
[0027] The RANSAC algorithm is used to estimate the transformation model from the historical image file to the preprocessed image file, and the transformation model is expressed as: M = RANSAC ((ai, bi)), where M represents the transformation matrix, and RANSAC () is used to estimate the robust algorithm of the model; the key points in the historical image file are mapped to the preprocessed image file through the transformation matrix, and the reprojection error is calculated, and for the i-th key point pair, the corresponding reprojection error is calculated as follows:
[0028] ei=|M·ai-bi|,
[0029] Calculate the statistics of the reprojection errors corresponding to all key points, i.e., the mean or standard deviation; screen the preprocessed image files according to the threshold set according to the mean or standard deviation of the reprojection errors, store the preprocessed image files that are less than or equal to the mean or standard deviation of the reprojection errors, and screen out the preprocessed image files that are greater than the mean or standard deviation of the reprojection errors; convert the screened image files into a machine-readable text format using optical character recognition technology, import them into the database and form a text data set.
[0030] Furthermore, in step S100, semantic analysis is performed on each text data in the text data set, and the specific contents of generating corresponding semantic tags are as follows:
[0031] For each text data in the text data set, the topic model is used to obtain the topic distribution of the text data, each text data is mapped to a set of topics, and the text data is screened according to the probability value corresponding to each topic, and the text data with a probability value greater than or equal to the preset probability threshold is selected as the basic semantic label;
[0032] Use NER technology to identify entities in text data, and use relationship extraction algorithm to obtain the relationship between entities, which are used as supplementary semantic labels; use sentiment analysis model to identify the sentiment tendency of text data, and the sentiment tendency includes positive, negative and neutral; assign scores to each sentiment category, and determine the sentiment label of the text according to the score, where the calculation process of determining the sentiment label of the text is as follows:
[0033] For each text data t, the predicted probability values of three emotion categories are generated based on the sentiment analysis model, and are expressed as: P(t) = [P1(t), P2(t), P3(t)], where P1(t) represents the probability that text t has positive emotion, P2(t) represents the probability that text t has negative emotion, and P3(t) represents the probability that text t has neutral emotion;
[0034] According to the predicted probability value of the generated emotion category, a score is assigned to each emotion category, and the final emotion label is determined according to the score of the emotion category, the maximum score S1 in the emotion category is obtained, and the corresponding maximum score S1 is compared with the preset score threshold S. If the maximum score S1 ≥ the score threshold S, the emotion category corresponding to the maximum score S1 is used as the emotion label of the text data, otherwise the emotion label of the text data is marked as an undetermined label;
[0035] For each text data, the basic semantic labels, supplementary semantic labels and sentiment labels are summarized to form a semantic label.
[0036] Further, step S200 includes:
[0037] S201. Perform keyword extraction on each text data in the text data set, calculate the word frequency TF of the extracted keywords, and the corresponding calculation formula is: TF(w,d)=count(w,d) / t_nd, where count(w,d) represents the number of occurrences of word w in text data d, and t_nd represents the sum of all words in text data d; calculate the inverse document frequency IDF, and IDF(w)=log(N / DF(w)), where N is the total number of text data in the text data set, and DF(w) represents the number of text data containing word w; calculate TF-IDF, and TF-IDF(w,d)=TF(w,d)×IDF(w); select the first m keywords to form a keyword set according to the numerical value corresponding to TF-IDF, where m represents the number of selected keywords;
[0038] S202. Map the keyword set corresponding to each text data into the word vector space, so that each element in the keyword set corresponds to a word vector, and calculate the average word vector v_d of the corresponding text data, and v_d = (1 / |K_d|)∑(w_i∈K_d)w_i, where K_d represents the keyword set in the text data d, and w_i represents the word vector of the i-th keyword in the text data d;
[0039] S203. For the semantic label of each text data, use One-Hot Encoding to encode the semantic label into a vector y_t, associate the word vector v_d of each text data with its corresponding semantic label vector y_t, and construct a mapping matrix M between the label and the text word vector.
[0040] Furthermore, step S300 includes:
[0041] S301. Obtain user demand data, clean the user demand data, remove noise information and invalid data; and standardize the cleaned user demand data and convert it into a machine-readable text format; extract keywords from the converted user demand data, and use NER technology to identify entities and relationships in user needs, so as to obtain the user's search intention; combine the user demand data and the user's search intention to analyze the emotional tendency in the user demand, and analyze the emotional tendency in the user demand with reference to the analysis process of the emotional tags of the text data;
[0042] S302. Referring to the analysis process of the semantic tags of the text data in step S100, combined with the analysis results of S301, corresponding semantic tags are generated for the user demand data; according to the keywords in the user demand data, corresponding demand features are obtained, and corresponding word vectors are generated by combining the demand features with the keywords in the user demand data; referring to the construction process of the mapping matrix M in S203, the feature matrix X of the user query is constructed by combining the semantic tags and word vectors of the user demand data.
[0043] Furthermore, step S400 includes:
[0044] The feature matrix X of the user query is calculated in turn with the mapping matrix M of the labels and text word vectors corresponding to the text data in the text dataset, and the similarity calculation result is used as the matching degree D between the user demand and the document content; the text data in the text dataset is sorted in descending order according to the corresponding matching degree D, so as to output the final retrieval result.
[0045] Compared with the prior art, the beneficial effects of the present invention are as follows: the present invention introduces semantic analysis technology, and through in-depth semantic understanding of text data and generation of corresponding semantic tags, the retrieval system no longer relies solely on keyword matching, but can understand and grasp the deep meaning of the text; this method significantly improves the relevance and accuracy of the retrieval results, and solves the problem of insufficient retrieval effect caused by ignoring semantic understanding in the existing system. When constructing a text data set, the present invention adopts advanced image processing technologies such as image preprocessing and feature point matching, combines OCR technology to convert paper documents into readable text format, and effectively screens historical image files, thereby effectively coping with the problem of large-scale mixed data, which greatly improves the data processing capacity and efficiency of the system. The present invention converts complex text data into a word vector form that is easy to calculate and compare by constructing a mapping matrix between labels and text word vectors, and performs similarity calculation in combination with the feature matrix of user queries, thereby achieving fast and accurate retrieval; compared with traditional keyword matching methods, this method greatly improves retrieval efficiency and response speed. When obtaining user needs, the present invention not only performs keyword extraction and entity recognition, but also deeply analyzes the user's search intention and emotional tendency, so as to more accurately understand the user's real needs; this user-oriented retrieval method enables the system to provide retrieval results that are more in line with user expectations, significantly improving the user experience. BRIEF DESCRIPTION OF THE DRAWINGS
[0046] The accompanying drawings are used to provide a further understanding of the present invention and constitute a part of the specification. Together with the embodiments of the present invention, they are used to explain the present invention and do not constitute a limitation of the present invention. In the accompanying drawings:
[0047] Figure 1 It is a schematic diagram of an intelligent retrieval management system module based on OCR and document parsing of the present invention. DETAILED DESCRIPTION
[0048] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments 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 creative work are within the scope of protection of the present invention.
[0049] See also Figure 1 , the present invention provides a technical solution:
[0050] An intelligent retrieval management system based on OCR and document parsing, the system includes: a document scanning and processing module, a semantic analysis and label generation module, a feature extraction and mapping module, and a user demand analysis and retrieval module;
[0051] The document scanning and processing module uses a scanner to convert paper documents into image files, and applies OCR technology to convert image files into machine-readable text; it pre-processes image files and compares historical image files through feature point detection and RANSAC algorithm, screens and stores valid image files, and finally imports them into the database to form a text data set;
[0052] The semantic analysis and label generation module performs semantic analysis on each text in the text dataset, applies the topic model to generate basic semantic labels, uses NER technology to identify entities and relationships to generate supplementary semantic labels, and applies the sentiment analysis model to determine the sentiment labels of the text; it aggregates the basic semantic labels, supplementary semantic labels, and sentiment labels to form comprehensive semantic labels;
[0053] The feature extraction and mapping module extracts keywords from text data and calculates TF-IDF values to generate word vectors for the keyword set; associates the word vector of each text data with its semantic label and constructs a mapping matrix between the label and the text word vector;
[0054] The user demand analysis and retrieval module analyzes user demand data, cleans and standardizes data, extracts keywords and identifies entities and relationships, and generates a feature matrix for user queries. It evaluates the matching degree between text data and user needs by calculating similarity with the mapping matrix in the text data, and sorts and outputs the retrieval results.
[0055] The document scanning and processing module includes an image scanning and preprocessing unit, a historical image comparison unit, and an OCR recognition unit;
[0056] The image scanning and preprocessing unit uses a scanner to scan paper documents into image files and performs preprocessing operations on the scanned image files; the historical image comparison unit obtains historical image files from the database, compares and analyzes them with the preprocessed image files, uses a feature point detection algorithm to extract key points and their descriptors, uses the RANSAC algorithm to estimate the transformation model, and calculates the reprojection error, sets a threshold based on the mean or standard deviation of the reprojection error, and filters and stores the filtered image files; the OCR recognition unit uses optical character recognition technology on the filtered image files, converts them into a machine-readable text format, and imports them into the database.
[0057] The semantic analysis and label generation module includes a topic modeling unit, an entity recognition and relationship extraction unit, a sentiment analysis unit, and a label aggregation unit;
[0058] The topic modeling unit uses the topic model to obtain the topic distribution of text data and generate basic semantic tags; the entity recognition and relationship extraction unit uses NER technology to identify entities in the text, uses the relationship extraction algorithm to identify the relationship between entities, and generates supplementary semantic tags; the sentiment analysis unit uses the sentiment analysis model to identify the sentiment tendency of the text, assigns scores according to the sentiment analysis results, and determines the final sentiment tags; the label aggregation unit aggregates the basic semantic tags, supplementary semantic tags and sentiment tags to form complete semantic tags.
[0059] The feature extraction and mapping module includes a keyword extraction unit, a word vector calculation unit, and a mapping matrix construction unit;
[0060] The keyword extraction unit extracts keywords from the text data, calculates the word frequency TF, the inverse document frequency IDF, and calculates TF-IDF, and selects the top m keywords based on TF-IDF to build a keyword set; the word vector calculation unit maps the keyword set to the word vector space and calculates the average word vector of the text data; the mapping matrix construction unit uses One-Hot Encoding to encode the semantic label into a vector, associates the word vector of each text data with its corresponding semantic label vector, and builds a mapping matrix between the label and the text word vector;
[0061] The user demand analysis and retrieval module includes a user demand data processing unit, a demand feature and semantic label generation unit, and a similarity calculation and ranking unit;
[0062] The user demand data processing unit obtains user demand data, cleans and standardizes it, and performs keyword extraction, entity recognition and relationship analysis on the user demand data; the demand feature and semantic label generation unit generates semantic labels for the user demand data, calculates word vectors for the user demand data, and associates them with the semantic labels to construct a feature matrix for the user query; the similarity calculation and sorting unit performs similarity calculation on the feature matrix of the user query and the mapping matrix of the labels and text word vectors in the text data set, thereby obtaining the matching degree between the user demand and the document content, sorts the text data according to the matching degree, and outputs the final retrieval results.
[0063] An intelligent retrieval management method based on OCR and document parsing, the method comprising the following steps:
[0064] Step S100. Scan the paper document into an image file using a scanner, convert the image file into a machine-readable text format using optical character recognition technology, import it into a database and form a text data set; perform semantic analysis on each text data in the text data set and generate corresponding semantic tags;
[0065] Step S200. Extract keywords from each text data in the text data set, and construct word vectors for the corresponding text data based on the extracted keywords; associate the word vectors of each text data with semantic labels, thereby obtaining a mapping matrix between labels and text word vectors;
[0066] Step S300: Obtain user demand data, analyze the user demand data, and thereby obtain the user's search intention and demand characteristics; based on the user's search intention and demand characteristics, construct a feature matrix of the user query;
[0067] Step S400. Calculate the similarity between the feature matrix of the user query and the mapping matrix of the labels and text word vectors in the text data set, so as to evaluate the matching degree between the user demand and the text data; and sort the text data in the text data set according to the matching degree between the user demand and the text data, so as to output the final retrieval result.
[0068] The text data set formed in step S100 includes the following contents:
[0069] Use a high-resolution scanner to scan paper documents into image files, and pre-process the image files; obtain the historical image files pre-saved in the database, and compare and analyze the historical image files with the pre-processed image files. The specific comparison and analysis process is as follows:
[0070] The key points and descriptors of the historical image file and the preprocessed image file are extracted by using a feature point detection algorithm, and the key point pairs in the historical image file and the preprocessed image file are matched by using the descriptors, and the matched key point pairs are selected, and the key point pairs are expressed as: (an, bn), where an represents the key point of the nth historical image file, bn represents the key point of the nth preprocessed image file, and n represents the key point number;
[0071] The RANSAC algorithm is used to estimate the transformation model from the historical image file to the preprocessed image file, and the transformation model is expressed as: M = RANSAC ((ai, bi)), where M represents the transformation matrix, and RANSAC () is used to estimate the robust algorithm of the model; the key points in the historical image file are mapped to the preprocessed image file through the transformation matrix, and the reprojection error is calculated, and for the i-th key point pair, the corresponding reprojection error is calculated as follows:
[0072] ei=|M·ai-bi|,
[0073] Calculate the statistics of the reprojection errors corresponding to all key points, i.e., the mean or standard deviation; screen the preprocessed image files according to the threshold set according to the mean or standard deviation of the reprojection errors, store the preprocessed image files that are less than or equal to the mean or standard deviation of the reprojection errors, and screen out the preprocessed image files that are greater than the mean or standard deviation of the reprojection errors; convert the screened image files into a machine-readable text format using optical character recognition technology, import them into the database and form a text data set.
[0074] The specific contents of performing semantic analysis on each text data in the text data set and generating corresponding semantic tags in step S100 are as follows:
[0075] For each text data in the text data set, the topic model is used to obtain the topic distribution of the text data, each text data is mapped to a set of topics, and the text data is screened according to the probability value corresponding to each topic, and the text data with a probability value greater than or equal to the preset probability threshold is selected as the basic semantic label;
[0076] In this embodiment, the calculation process for determining the basic semantic label is as follows:
[0077] Select and train a topic model. Common topic models include LDA and NMF. The goal of the training process is to learn the word distribution of each topic and the topic distribution of each document. Use the topic model algorithm to train the data and obtain the word distribution T_k of each topic, where k is the topic number, and the topic distribution T_d of each document, where d is the document number.
[0078] For each text t_d, where d is the document number, the topic model generates the topic distribution of the text, and the topic distribution is: T_d = [T_d1, T_d2, ..., T_dk], where T_dk represents the probability value of the text d corresponding to the topic k; a preset probability threshold p is set to filter the basic semantic tags with significant topics. The selection of this threshold can be determined according to the needs of the specific application. For example, the optimal threshold can be selected by methods such as cross-validation;
[0079] For each text t_d, according to its topic distribution T_d and the preset probability threshold p, the qualified topics are screened out. The specific steps are as follows:
[0080] For each topic k, determine the relationship between its corresponding probability value T_dk and the threshold p, select topics that are greater than or equal to the threshold p, and use the selected topics as the basic semantic labels of the corresponding text.
[0081] Use NER technology to identify entities in text data, and use relationship extraction algorithm to obtain the relationship between entities, which are used as supplementary semantic labels; use sentiment analysis model to identify the sentiment tendency of text data, and the sentiment tendency includes positive, negative and neutral; assign scores to each sentiment category, and determine the sentiment label of the text according to the score, where the calculation process of determining the sentiment label of the text is as follows:
[0082] For each text data t, the predicted probability values of three emotion categories are generated based on the sentiment analysis model, and are expressed as: P(t) = [P1(t), P2(t), P3(t)], where P1(t) represents the probability that text t has positive emotion, P2(t) represents the probability that text t has negative emotion, and P3(t) represents the probability that text t has neutral emotion;
[0083] According to the predicted probability value of the generated emotion category, a score is assigned to each emotion category, and the final emotion label is determined according to the score of the emotion category, the maximum score S1 in the emotion category is obtained, and the corresponding maximum score S1 is compared with the preset score threshold S. If the maximum score S1 ≥ the score threshold S, the emotion category corresponding to the maximum score S1 is used as the emotion label of the text data, otherwise the emotion label of the text data is marked as an undetermined label;
[0084] For each text data, the basic semantic labels, supplementary semantic labels and sentiment labels are summarized to form a semantic label.
[0085] Step S200 includes:
[0086] S201. Perform keyword extraction on each text data in the text data set, calculate the word frequency TF of the extracted keywords, and the corresponding calculation formula is: TF(w,d)=count(w,d) / t_nd, where count(w,d) represents the number of occurrences of word w in text data d, and t_nd represents the sum of all words in text data d; calculate the inverse document frequency IDF, and IDF(w)=log(N / DF(w)), where N is the total number of text data in the text data set, and DF(w) represents the number of text data containing word w; calculate TF-IDF, and TF-IDF(w,d)=TF(w,d)×IDF(w); select the first m keywords to form a keyword set according to the numerical value corresponding to TF-IDF, where m represents the number of selected keywords;
[0087] S202. Map the keyword set corresponding to each text data into the word vector space, so that each element in the keyword set corresponds to a word vector, and calculate the average word vector v_d of the corresponding text data, and v_d = (1 / |K_d|)∑(w_i∈K_d)w_i, where K_d represents the keyword set in the text data d, and w_i represents the word vector of the i-th keyword in the text data d;
[0088] S203. For the semantic label of each text data, use One-Hot Encoding to encode the semantic label into a vector y_t, associate the word vector v_d of each text data with its corresponding semantic label vector y_t, and construct a mapping matrix M between the label and the text word vector.
[0089] Step S300 includes:
[0090] S301. Obtain user demand data, clean the user demand data, remove noise information and invalid data; and standardize the cleaned user demand data and convert it into a machine-readable text format; extract keywords from the converted user demand data, and use NER technology to identify entities and relationships in user needs, so as to obtain the user's search intention; combine the user demand data and the user's search intention to analyze the emotional tendency in the user demand, and analyze the emotional tendency in the user demand with reference to the analysis process of the emotional tags of the text data;
[0091] S302. Referring to the analysis process of the semantic tags of the text data in step S100, combined with the analysis results of S301, corresponding semantic tags are generated for the user demand data; according to the keywords in the user demand data, corresponding demand features are obtained, and corresponding word vectors are generated by combining the demand features with the keywords in the user demand data; referring to the construction process of the mapping matrix M in S203, the feature matrix X of the user query is constructed by combining the semantic tags and word vectors of the user demand data.
[0092] Step S400 includes:
[0093] The feature matrix X of the user query is calculated in turn with the mapping matrix M of the labels and text word vectors corresponding to the text data in the text dataset, and the similarity calculation result is used as the matching degree D between the user demand and the document content; the text data in the text dataset is sorted in descending order according to the corresponding matching degree D, so as to output the final retrieval result.
[0094] It should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof 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.
[0095] Finally, it should be noted that the above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art can still modify the technical solutions described in the aforementioned embodiments or replace some of the technical features therein by equivalents. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.
Claims
1. An intelligent retrieval management method based on OCR and document parsing, characterized by: The method comprises the following steps: Step S100. Scan the paper document into an image file using a scanner, convert the image file into a machine-readable text format using optical character recognition technology, import it into a database and form a text data set; perform semantic analysis on each text data in the text data set and generate corresponding semantic tags; Step S200. Extract keywords from each text data in the text data set, and construct word vectors for the corresponding text data based on the extracted keywords; associate the word vectors of each text data with semantic labels, thereby obtaining a mapping matrix between labels and text word vectors; Step S300: Obtain user demand data, analyze the user demand data, and thereby obtain the user's search intention and demand characteristics; based on the user's search intention and demand characteristics, construct a feature matrix of the user query; Step S400. Calculate the similarity between the feature matrix of the user query and the mapping matrix of the labels and text word vectors in the text data set, so as to evaluate the matching degree between the user demand and the text data; and sort the text data in the text data set according to the matching degree between the user demand and the text data, so as to output the final search result; The specific contents of performing semantic analysis on each text data in the text data set and generating corresponding semantic tags in step S100 are as follows: For each text data in the text data set, the topic model is used to obtain the topic distribution of the text data, each text data is mapped to a set of topics, and the text data is screened according to the probability value corresponding to each topic, and the text data with a probability value greater than or equal to the preset probability threshold is selected as the basic semantic label; Use NER technology to identify entities in text data, and use relationship extraction algorithm to obtain the relationship between entities, which are used as supplementary semantic labels; use sentiment analysis model to identify the sentiment tendency of text data, and the sentiment tendency includes positive, negative and neutral; assign scores to each sentiment category, and determine the sentiment label of the text according to the score, where the calculation process of determining the sentiment label of the text is as follows: For each text data t, the predicted probability values of three emotion categories are generated based on the sentiment analysis model, and are expressed as: P(t) = [P1(t), P2(t), P3(t)], where P1(t) represents the probability that text t has positive emotion, P2(t) represents the probability that text t has negative emotion, and P3(t) represents the probability that text t has neutral emotion; According to the predicted probability value of the generated emotion category, a score is assigned to each emotion category, and the final emotion label is determined according to the score of the emotion category, the maximum score S1 in the emotion category is obtained, and the corresponding maximum score S1 is compared with the preset score threshold S. If the maximum score S1 ≥ the score threshold S, the emotion category corresponding to the maximum score S1 is used as the emotion label of the text data, otherwise the emotion label of the text data is marked as an undetermined label; For each text data, the basic semantic labels, supplementary semantic labels and sentiment labels are summarized to form a semantic label.
2. The intelligent retrieval management method based on OCR and document parsing according to claim 1, characterized in that: The text data set formed in step S100 includes the following contents: Use a high-resolution scanner to scan paper documents into image files, and pre-process the image files; obtain the historical image files pre-saved in the database, and compare and analyze the historical image files with the pre-processed image files. The specific comparison and analysis process is as follows: The key points and descriptors of the historical image file and the preprocessed image file are extracted by using a feature point detection algorithm, and the key point pairs in the historical image file and the preprocessed image file are matched by using the descriptors, and the matched key point pairs are selected, and the key point pairs are expressed as: (an, bn), where an represents the key point of the nth historical image file, bn represents the key point of the nth preprocessed image file, and n represents the key point number; The RANSAC algorithm is used to estimate the transformation model from the historical image file to the preprocessed image file, and the transformation model is expressed as: M = RANSAC ((ai, bi)), where M represents the transformation matrix, and RANSAC () is used to estimate the robust algorithm of the model; the key points in the historical image file are mapped to the preprocessed image file through the transformation matrix, and the reprojection error is calculated, and for the i-th key point pair, the corresponding reprojection error is calculated as follows: ei=|M·ai-bi|, Calculate the statistics of the reprojection errors corresponding to all key points, i.e., the mean or standard deviation; screen the preprocessed image files according to the threshold set according to the mean or standard deviation of the reprojection errors, store the preprocessed image files that are less than or equal to the mean or standard deviation of the reprojection errors, and screen out the preprocessed image files that are greater than the mean or standard deviation of the reprojection errors; convert the screened image files into a machine-readable text format using optical character recognition technology, import them into the database and form a text data set.
3. The intelligent retrieval management method based on OCR and document parsing according to claim 1, characterized in that: The step S200 includes: S201. Perform keyword extraction on each text data in the text data set, calculate the word frequency TF of the extracted keywords, and the corresponding calculation formula is: TF(w,d)=count(w,d) / t_nd, where count(w,d) represents the number of occurrences of word w in text data d, and t_nd represents the sum of all words in text data d; calculate the inverse document frequency IDF, and IDF(w)=log(N / DF(w)), where N is the total number of text data in the text data set, and DF(w) represents the number of text data containing word w; calculate TF-IDF, and TF-IDF(w,d)=TF(w,d)×IDF(w); select the first m keywords to form a keyword set according to the numerical value corresponding to TF-IDF, where m represents the number of selected keywords; S202. Map the keyword set corresponding to each text data into the word vector space, so that each element in the keyword set corresponds to a word vector, and calculate the average word vector v_d of the corresponding text data, and v_d = (1 / |K_d|)∑(w_i∈K_d)w_i, where K_d represents the keyword set in the text data d, and w_i represents the word vector of the i-th keyword in the text data d; S203. For the semantic label of each text data, use One-Hot Encoding to encode the semantic label into a vector y_t, associate the word vector v_d of each text data with its corresponding semantic label vector y_t, and construct a mapping matrix M between the label and the text word vector.
4. The intelligent retrieval management method based on OCR and document parsing according to claim 3 is characterized by: The step S300 includes: S301. Obtain user demand data, clean the user demand data, remove noise information and invalid data; and standardize the cleaned user demand data and convert it into a machine-readable text format; extract keywords from the converted user demand data, and use NER technology to identify entities and relationships in user needs, so as to obtain the user's search intention; combine the user demand data and the user's search intention to analyze the emotional tendency in the user demand, and analyze the emotional tendency in the user demand with reference to the analysis process of the emotional tags of the text data; S302. Referring to the analysis process of the semantic tags of the text data in step S100, combined with the analysis results of S301, corresponding semantic tags are generated for the user demand data; according to the keywords in the user demand data, corresponding demand features are obtained, and corresponding word vectors are generated by combining the demand features with the keywords in the user demand data; referring to the construction process of the mapping matrix M in S203, the feature matrix X of the user query is constructed by combining the semantic tags and word vectors of the user demand data.
5. The intelligent retrieval management method based on OCR and document parsing according to claim 4 is characterized in that: The step S400 includes: The feature matrix X of the user query is calculated in turn with the mapping matrix M of the labels and text word vectors corresponding to the text data in the text dataset, and the similarity calculation result is used as the matching degree D between the user demand and the document content; the text data in the text dataset is sorted in descending order according to the corresponding matching degree D, so as to output the final retrieval result.
6. An intelligent retrieval management system based on OCR and document parsing, applied to an intelligent retrieval management method based on OCR and document parsing as claimed in any one of claims 1 to 5, characterized in that: The system includes: a document scanning and processing module, a semantic analysis and tag generation module, a feature extraction and mapping module, and a user demand analysis and retrieval module; The document scanning and processing module uses a scanner to convert paper documents into image files, and applies OCR technology to convert image files into machine-readable text; pre-processes image files and compares historical image files through feature point detection and RANSAC algorithm, screens and stores valid image files, and finally imports them into a database to form a text data set; The semantic analysis and label generation module performs semantic analysis on each text in the text data set, applies the topic model to generate basic semantic labels, uses NER technology to identify entities and relationships to generate supplementary semantic labels, and applies the sentiment analysis model to determine the sentiment labels of the text; summarizes the basic semantic labels, supplementary semantic labels and sentiment labels to form comprehensive semantic labels; The feature extraction and mapping module extracts keywords from the text data and calculates the TF-IDF value to generate word vectors for the keyword set; associates the word vector of each text data with its semantic label to construct a mapping matrix between the label and the text word vector; The user demand analysis and retrieval module analyzes user demand data, cleans and standardizes data, extracts keywords and identifies entities and relationships, and generates a feature matrix for user queries; evaluates the matching degree between text data and user demand by performing similarity calculations with the mapping matrix in the text data, and sorts and outputs the retrieval results.
7. The intelligent retrieval management system based on OCR and document parsing according to claim 6, characterized in that: The document scanning and processing module includes an image scanning and preprocessing unit, a historical image comparison unit and an OCR recognition unit; The image scanning and preprocessing unit uses a scanner to scan paper documents into image files, and performs preprocessing operations on the scanned image files; the historical image comparison unit obtains historical image files from a database, and compares and analyzes them with the preprocessed image files, uses a feature point detection algorithm to extract key points and their descriptors, uses a RANSAC algorithm to estimate the transformation model, and calculates the reprojection error, sets a threshold according to the mean or standard deviation of the reprojection error, and filters and stores the filtered image files; the OCR recognition unit uses optical character recognition technology on the filtered image files, converts them into a machine-readable text format, and imports them into the database.
8. The intelligent retrieval management system based on OCR and document parsing according to claim 6, characterized in that: The semantic analysis and label generation module includes a topic modeling unit, an entity recognition and relationship extraction unit, a sentiment analysis unit and a label aggregation unit; The topic modeling unit uses the topic model to obtain the topic distribution of text data and generates basic semantic tags; the entity recognition and relationship extraction unit uses the NER technology to identify entities in the text, uses the relationship extraction algorithm to identify the relationship between entities, and generates supplementary semantic tags; the sentiment analysis unit uses the sentiment analysis model to identify the sentiment tendency of the text, assigns scores according to the sentiment analysis results, and determines the final sentiment tags; the label aggregation unit aggregates the basic semantic tags, supplementary semantic tags and sentiment tags to form complete semantic tags.
9. The intelligent retrieval management system based on OCR and document parsing according to claim 6, characterized in that: The feature extraction and mapping module includes a keyword extraction unit, a word vector calculation unit and a mapping matrix construction unit; The keyword extraction unit extracts keywords from the text data, calculates the term frequency TF, the inverse document frequency IDF, and calculates the TF-IDF, and selects the first m keywords according to the TF-IDF to construct a keyword set; The word vector calculation unit maps the keyword set to the word vector space and calculates the average word vector of the text data; The mapping matrix construction unit uses One-Hot Encoding to encode the semantic label into a vector, associates the word vector of each text data with its corresponding semantic label vector, and constructs a mapping matrix between the label and the text word vector; The user demand analysis and retrieval module includes a user demand data processing unit, a demand feature and semantic tag generation unit, and a similarity calculation and ranking unit; The user demand data processing unit obtains user demand data, cleans and standardizes it, and performs keyword extraction, entity recognition and relationship analysis on the user demand data; the demand feature and semantic label generation unit generates semantic labels for the user demand data, calculates word vectors for the user demand data, and associates them with the semantic labels to construct a feature matrix for the user query; the similarity calculation and sorting unit performs similarity calculation on the feature matrix of the user query and the mapping matrix of the labels and text word vectors in the text data set, thereby obtaining the matching degree between the user demand and the document content, sorts the text data according to the matching degree, and outputs the final retrieval result.
Citation Information
Patent Citations
Theme extraction method and device oriented to science and technology requirements and storage medium
CN113255340A
Natural language processing techniques using joint sentiment-topic modeling
US20220036010A1