Ancient book classification method and system based on machine learning
Through the ancient book classification method based on machine learning, BiLSTM and transfer learning technology, combined with user feedback mechanism, the problems of inefficient and insufficient accuracy of traditional ancient book classification are solved, and efficient and accurate ancient book classification and continuous optimization are achieved.
Patent Information
- Application Number
- CN202411977234.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-31
- Publication Date
- 2025-05-02
AI Technical Summary
It is difficult for the existing technology to efficiently manage and utilize a large number of digital ancient book resources. Traditional ancient book classifications rely on manual cataloging, which are inefficient and prone to errors.
The ancient book classification method based on machine learning is adopted to collect and preprocess ancient book text data, and the long-distance dependence relationship in the text is captured using a two-way long and short-term memory network (BiLSTM), and the classification model is optimized by combining transfer learning technology and user feedback mechanism.
It significantly improves the efficiency and accuracy of ancient book classification, enhances the ability to understand ancient Chinese, reduces data demand, and improves the robustness and user experience of the system through continuous optimization mechanism.
Smart Images

Figure CN119917660A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of book classification, and in particular to an ancient book classification method and system based on machine learning. Background Art
[0002] Ancient books, as treasures of the long history and culture of the Chinese nation, carry a wealth of knowledge and wisdom. However, as time goes by, many precious ancient books are at risk of being damaged or even lost due to natural aging and poor preservation conditions. In order to effectively protect these precious cultural heritages, digitization has become an inevitable choice.
[0003] In recent years, the state and all sectors of society have paid more and more attention to the protection of ancient books. A large number of ancient books have been scanned into electronic documents and uploaded to online databases or library systems. Nevertheless, facing the vast amount of ancient book resources, how to efficiently manage and utilize these digital achievements remains an urgent problem to be solved. Especially for researchers, finding literature on a specific topic or period often takes a lot of time and effort, and in traditional methods, the classification of ancient books relies on manual cataloging and expert identification, which is not only inefficient but also prone to errors. Summary of the invention
[0004] The purpose of the present invention is to provide a method and system for ancient book classification based on machine learning, which significantly improves the efficiency and accuracy of ancient book classification through automated processing technology. It combines character-level and vocabulary-level embedding to enhance the understanding of ancient Chinese; uses BiLSTM to capture long-distance dependencies and improve classification accuracy; transfer learning optimizes model initialization and reduces data requirements; integrates user feedback mechanism to achieve continuous improvement and ensure that the results are close to actual needs, solving the problems raised in the above background technology.
[0005] To achieve the above object, the present invention provides the following technical solutions:
[0006] A method for classifying ancient books based on machine learning comprises the following steps:
[0007] Step 1: Collect and preprocess ancient text data for training, verification and testing;
[0008] Step 2: Extract text features that can effectively represent the content and structure of the preprocessed ancient texts, and use the bidirectional long short-term memory network (BiLSTM) to capture the long-distance dependencies in the texts;
[0009] Step 3: Use transfer learning technology to adjust the pre-trained word segmentation model and classifier;
[0010] Step 4: Output the classification results and provide a user feedback mechanism to continuously optimize the classification model.
[0011] Preferably, the collection and preprocessing of ancient book text data for training, verification and testing is specifically as follows:
[0012] Acquire ancient texts from multiple reliable data sources, including but not limited to national libraries, university libraries, academic research institutions, the National Digital Library of China, Project Gutenberg, and digitized resources from private collections;
[0013] The texts cover different historical periods and ancient books of various types and fields;
[0014] Remove non-content information including but not limited to irrelevant characters, punctuation marks, special symbols and redundant spaces; convert all text to Unicode format; identify and remove duplicate paragraphs or documents.
[0015] Preferably, the collection and preprocessing of ancient book text data for training, verification and testing also includes:
[0016] Use ancient Chinese word segmentation tools to accurately segment text, and combine domain expert knowledge base for auxiliary word segmentation; split long texts into independent sentences based on grammatical rules and text symbols;
[0017] Develop an ancient Chinese classification label system based on existing document classification standards;
[0018] Organize domain experts and trained professionals to manually label some samples; use the existing labeled data to train a preliminary model, use the cross entropy loss function to measure the difference between the model prediction and the true label, and then use the model to predict the category of new data, and finally manually review and correct it;
[0019] The loss function L can be expressed as:
[0020]
[0021] Among them, y is the unique encoding representation of the true label; is the predicted output of the model; m is the number of categories in the category set C.
[0022] Preferably, the preprocessing further includes adopting a K-fold cross-validation strategy to randomly divide the original data set into a training set, a validation set, and a test set according to a set ratio, and calculating the accuracy, recall, and F1 score for the classification category i to which the ancient book belongs, as shown below:
[0023]
[0024] Among them, Pi represents precision, Ri represents recall, TPi, FPi, and FNi represent the number of true positives, false positives, and false negatives, respectively.
[0025] Preferably, the collection and preprocessing also includes data enhancement processing, specifically:
[0026] Use synonym replacement to increase data diversity;
[0027] Generate new but semantically unchanged text instances by changing sentence order or paragraph structure;
[0028] An appropriate amount of minor human-caused errors may be included, including but not limited to spelling errors and misuse of punctuation.
[0029] Preferably, with respect to step 2, extracting text features includes:
[0030] Use character-level embedding to capture information about special words. By training a character-level CNN or RNN model, each Chinese character is mapped into a low-dimensional space to form a character vector.
[0031] Use a pre-trained word embedding model to convert words into dense vector representations;
[0032] Combining character-level, word-level, and sentence-level features to build a multi-level feature representation system;
[0033] Calculate the frequency of occurrence of characters, words, and sentence features in any ancient document, and then determine which feature representation system the features with high frequency belong to:
[0034] TF (t,d) =f (t,d) ;
[0035] f (t,d) Represents the number of characters, words, and sentence features t that appear in document d;
[0036] Count the number of documents containing character, word, and sentence features t:
[0037]
[0038] N = number of documents; nt = number of documents containing ancient text; t.
[0039] Preferably, for step 2, BiLSTM is used to capture the long-distance dependencies in the text, and the forward and reverse LSTM units are combined to record the state of each time step, and finally a new vector formed by concatenating the hidden states is output. The LSTM unit update formula is as follows:
[0040] f t =σ(W f ·[h t-1 ,x t ]+b f)
[0041] Among them, f t : Forget gate output, σ: Sigmoid activation function, W f : Forget gate weight matrix, b f : Forget gate bias, h t-1 : The hidden state of the previous time step, x t : Input of the current time step;
[0042] i t =σ(W i ·[h t-1 ,x t ]+b i )
[0043] Among them, i t : Input gate output; W i : Input gate weight matrix; b i : Input gate bias term;
[0044]
[0045] in, Candidate memory cell state; tanh: hyperbolic tangent activation function; W c : Candidate memory cell weight matrix; b C : Candidate memory cell bias term;
[0046] o t =σ(W o ·[h t-1 ,x t ]+b o )
[0047] Among them, t : Output gate output; W o : Output gate weight matrix; b o : Output gate bias term;
[0048]
[0049] Among them, C t : The memory cell state at the current time step; C t-1 : The memory cell state of the previous time step; f t 、i t and The states from the forget gate, input gate and candidate memory cells respectively;
[0050] h t =o t tanh(C t )
[0051] Among them, h t : The hidden state of the current time step; tanh(C t ): Perform nonlinear transformation on the current memory cell state through the hyperbolic tangent activation function.
[0052] Preferably, the transfer learning technology is used to adjust the pre-trained word segmentation model and classifier, specifically:
[0053] Choose a language model that has been pre-trained on a large-scale Chinese corpus, giving priority to pre-trained models that are optimized for ancient Chinese. Expand the vocabulary of the pre-trained model and add necessary ancient Chinese characters and their embedding vectors.
[0054] Add a multi-layer perceptron (MLP) as the top-level classifier based on the pre-trained model to map the high-level features extracted by the pre-trained model to specific classification labels;
[0055] Build an end-to-end training framework that allows the entire system to be connected from the original text input to the final classification result output; adopt a progressive adjustment strategy, first make an initial adjustment with the learning rate, and then increase the learning rate to optimize the key layers.
[0056] Preferably, the output classification result is specifically:
[0057] Use modern front-end frameworks to build responsive user interfaces, support file upload components, real-time queries, batch processing capabilities, and result visualization, and provide detailed classification explanations to help users understand the classification basis;
[0058] Set up a "Feedback" button to guide users to submit opinions or report errors, regularly summarize user feedback and automatically classify and prioritize it through natural language processing technology, and establish a closed-loop process from feedback collection to problem solving to model updating.
[0059] An ancient book classification system based on machine learning is used to implement an ancient book classification method based on machine learning, including:
[0060] The data collection module is used to collect and preprocess ancient book text data, divide the data into training set, validation set and test set, and use K-fold cross-validation strategy to improve the generalization ability of the model;
[0061] A feature extraction module is used to extract feature information for classification from ancient texts;
[0062] Classifier training module, used to train efficient and accurate ancient book classification models;
[0063] The classification result output module is used to display the classification results and receive user feedback.
[0064] Compared with the prior art, the present invention has the following beneficial effects:
[0065] 1. The present invention enhances the modeling capability of ancient Chinese characteristics by using both character-level embedding and vocabulary-level embedding, which is particularly suitable for processing unregistered words and uncommon characters. It uses Bi LSTM to capture long-distance dependencies in the text, ensuring that the model can understand complex syntactic structures, which is particularly suitable for ancient texts with complex expressions such as classical Chinese, ensuring that the model can understand the text content more accurately, and improving classification accuracy and efficiency;
[0066] 2. The present invention reduces the amount of data and time cost required for training from scratch by utilizing a pre-trained Chinese word segmentation model for transfer learning and fine-tuning, while improving the model's initialization quality and ability to adapt to specific tasks, further improving classification accuracy.
[0067] 3. The present invention designs a user feedback mechanism that allows users to correct misclassifications and update the model accordingly. This closed-loop process of continuous optimization not only improves the robustness and accuracy of the system, but also enhances the user experience. BRIEF DESCRIPTION OF THE DRAWINGS
[0068] Figure 1 It is a flow chart of the ancient book classification method of the present invention;
[0069] Figure 2 This is a module structure diagram of the ancient book classification system of the present invention. DETAILED DESCRIPTION
[0070] 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.
[0071] In order to solve the problem that it takes a lot of time and effort to find ancient books and documents on a specific topic or period, and that traditional ancient book classification relies on manual cataloging, which is prone to errors and inefficient, please refer to Figure 1 and Figure 2 , this embodiment provides the following technical solutions:
[0072] A method for classifying ancient books based on machine learning comprises the following steps:
[0073] Step 1: Collect and preprocess ancient text data for training, verification and testing;
[0074] Step 2: Extract text features that can effectively represent the content and structure of the preprocessed ancient texts, and use the bidirectional long short-term memory network (BiLSTM) to capture the long-distance dependencies in the text, so as to understand the contextual semantics, text background information and the entire text theme, and improve the accuracy of classification;
[0075] Step 3: Use transfer learning technology to combine the pre-trained word segmentation model and classifier for adjustment to improve classification performance;
[0076] Step 4: Output the classification results and provide a user feedback mechanism to continuously optimize the classification model.
[0077] In step 1, ancient text data for training, verification, and testing are collected and preprocessed, specifically:
[0078] Obtain ancient texts from multiple reliable data sources, including but not limited to the National Library, university libraries, academic research institutions, the National Digital Library of China, Project Gutenberg, and private collections of digitized resources; the texts cover different historical periods to ensure that the classification model can adapt to the characteristics of documents from different eras, and the texts cover ancient books of various types and fields, such as philosophy, literature, medicine, law, history, etc., in order to build a highly universal classification system;
[0079] Clean the text and remove non-content information including but not limited to irrelevant characters, punctuation marks, special symbols and redundant spaces; convert all texts into a unified encoding format to ensure compatibility and consistency; identify and remove duplicate paragraphs or documents to avoid affecting the training effect of the model;
[0080] Segment the text and use ancient Chinese word segmentation tools such as Ji eba to accurately segment the text. Since there are a large number of unknown words and polysemous words in ancient Chinese, it is necessary to combine the knowledge base of domain experts for auxiliary word segmentation; segmenting long texts into independent sentences within a reasonable range according to grammatical rules and text symbols helps improve feature extraction efficiency;
[0081] Develop a classification label system for ancient Chinese literature based on existing document classification standards such as the Chinese Library Classification System and the Dewey Decimal Classification System;
[0082] Organize domain experts and trained professionals to manually annotate some samples in detail, use the existing annotated data to train a preliminary model, use the cross-entropy loss function to measure the difference between the model prediction and the true label, and then use the model to predict the category of new data. Finally, manual review and correction are performed to speed up the annotation process and maintain high quality.
[0083] The loss function L can be expressed as:
[0084]
[0085] Among them, y is the unique encoding representation of the true label; is the predicted output of the model; m is the number of categories in the category set C;
[0086] The K-fold cross-validation strategy is adopted to randomly divide the original data set into training set, validation set and test set according to the set ratio (such as 7:1:2) to ensure that each subset is representative in terms of category distribution, prevent overfitting, make full use of data under limited data volume, improve the generalization ability of the model, record the iterative results after each validation, and calculate the accuracy, recall rate and F1 score for the classification category i to which the ancient book belongs;
[0087] Among them, the accuracy is how many of all instances predicted to be of category i are actually of category i, the recall measures how many of all instances actually of category i are successfully predicted, and the F1 score is the harmonic mean of the accuracy and recall, which is used to comprehensively evaluate the performance of the classifier and provides a single indicator to balance the relationship between accuracy and recall.
[0088] The details are as follows:
[0089]
[0090] Among them, Pi represents precision, Ri represents recall, TPi, FPi, and FN i represent the number of true positives, false positives, and false negatives, respectively;
[0091] In the case of severe imbalance in category distribution, relying solely on accuracy may lead to misleading conclusions. The F1 score can better reflect the model's ability to recognize minority categories in this case. By comparing the F1 scores under different models or parameter settings, researchers can find the best configuration to ensure that the model has a high accuracy rate.
[0092] Through K-fold cross-validation, the F1 score can be calculated multiple times under different data partitions to obtain a more stable and reliable model performance evaluation.
[0093] Collection and preprocessing also include data enhancement processing, specifically:
[0094] Use synonym replacement to increase data diversity;
[0095] Generate new but semantically unchanged text instances by changing sentence order or paragraph structure;
[0096] Adding an appropriate amount of small artificial errors, including but not limited to spelling errors and misuse of punctuation, makes the model more robust and able to perform well when faced with imperfect data in the real world.
[0097] In step 2, text features that can effectively represent the content and structure of the preprocessed ancient text are extracted, and the long-distance dependencies in the text are captured using a bidirectional long short-term memory network (Bi LSTM). The extracted text features include:
[0098] Considering that there may be a large number of unknown or uncommon words in ancient texts, character-level embedding can better capture the information of special words. By training a character-level CNN or RNN model, each Chinese character is mapped to a low-dimensional space to form a character vector.
[0099] For known and commonly used words, use pre-trained word embedding models, such as Word2Vec, GloVe, or FastText, to convert words into dense vector representations, which helps preserve the semantic similarity between words and improves the model's understanding of common words;
[0100] Combining character-level, word-level, and sentence-level features, we build a multi-level feature representation system to enhance the expressiveness of the model. High-quality feature representation makes it easier for the model to identify long-distance dependencies in text.
[0101] Calculate the frequency of occurrence of characters, words, and sentence features in any ancient document, and then determine which feature representation system the features with high frequency belong to; the feature representation systems include: handwriting, craftsmanship, and calligraphy:
[0102] TF (t,d) =f (t,d) ;
[0103] f (t,d) Represents the number of characters, words, and sentence features t that appear in document d;
[0104] Count the number of documents containing character, word, and sentence features t:
[0105]
[0106] N = number of documents; nt = number of documents containing ancient text; t.
[0107] Bidirectional long short-term memory network is a special recursive neural network that can process sequence data in both forward and reverse directions, effectively capturing the complex dependencies between the context within a sentence. This is particularly important for understanding the complex syntactic structure in ancient Chinese. The forward LSTM reads the sentence from left to right and records the state of each time step; while the reverse LSTM does the opposite, reading from right to left to ensure that each word is affected by the context on both sides.
[0108] In ancient texts, due to the unique expression of classical Chinese, some key information may appear in different positions of the sentence. BiLSTM can solve this problem well because it not only pays attention to the relationship between the current word and its neighboring words, but also remembers words at a longer distance, thus helping the model understand the meaning of the entire sentence or even the paragraph.
[0109] Therefore, Bi LSTM is used to capture the long-distance dependencies in the text, and the forward and reverse LSTM units are combined to record the state of each time step, and finally a new vector concatenated from the hidden states is output. The update formula is as follows:
[0110] f t =σ(W f ·[h t-1 ,x t ]+b f )
[0111] Among them, f t : Forget gate output, σ: Sigmoid activation function, W f : Forget gate weight matrix, b f : Forget gate bias, h t-1 : The hidden state of the previous time step, x t : Input of the current time step;
[0112] i t =σ(W i ·[h t-1 ,x t ]+b i )
[0113] Among them, i t : Input gate output; W i : Input gate weight matrix; b i : Input gate bias term;
[0114]
[0115] in, Candidate memory cell state; tanh: hyperbolic tangent activation function; W c : Candidate memory cell weight matrix; b C : Candidate memory cell bias term;
[0116] o t =σ(W o ·[h t-1 ,x t ]+b o )
[0117] Among them, t : Output gate output; W o: Output gate weight matrix; b o : Output gate bias term;
[0118]
[0119] Among them, C t : The memory cell state at the current time step; C t-1 : The memory cell state of the previous time step; f t 、i t and The states from the forget gate, input gate, and candidate memory cells respectively
[0120] h t =o t tanh(C t )
[0121] Among them, h t : The hidden state of the current time step; tanh(C t ): Perform nonlinear transformation on the current memory cell state through the hyperbolic tangent activation function;
[0122] Through the above formula, BiLSTM can effectively capture long-term dependencies when processing sequence data, while avoiding the problem of gradient disappearance or explosion;
[0123] The introduction of the attention mechanism enables the model to dynamically adjust the attention paid to each word, and combines multi-level feature fusion to increase the model's representation ability;
[0124] Use transfer learning technology to combine the pre-trained word segmentation model and classifier for adjustment, specifically:
[0125] Choose language models that have been pre-trained on large-scale Chinese corpora, which can capture rich grammatical and semantic information; give priority to pre-trained models that are specially optimized for ancient Chinese;
[0126] Since ancient texts may contain a large number of words that are uncommon in modern Chinese, it is necessary to expand the vocabulary of the pre-trained model and add necessary ancient words and their embedding vectors; decide whether to freeze the weights of some pre-trained layers according to specific needs to prevent overfitting while retaining existing knowledge. For the bottom layer that directly contacts the input text, choose to unfreeze and fine-tune to adapt to the new task characteristics;
[0127] Add a multi-layer perceptron (MLP) as the top-level classifier based on the pre-trained model to map the high-level features extracted by the pre-trained model to specific classification labels; build an end-to-end training framework that allows the entire system to be connected from the original text input to the final classification result output;
[0128] Adopt a progressive adjustment strategy, first make an initial adjustment with the learning rate, then increase the learning rate to optimize the key layers, so that the model potential can be tapped as much as possible while ensuring stability;
[0129] Design a continuous learning mechanism to continuously update and improve the existing model as more high-quality data is obtained. This can be achieved through online learning or periodic retraining to ensure that the model is always in the best state.
[0130] The output classification results are as follows:
[0131] Use modern front-end frameworks to build responsive user interfaces, support file upload components, real-time queries, batch processing capabilities, and result visualization, and provide detailed classification explanations to help users understand the classification basis;
[0132] Set up a "Feedback" button to guide users to submit opinions or report errors. Regularly summarize user feedback and automatically classify and prioritize it through natural language processing technology to establish a closed-loop process from feedback collection to problem solving to model update to ensure that every user suggestion can be effectively handled;
[0133] Design an architecture that supports online learning, control the step size and frequency of incremental learning; regularly retrain the entire model, and introduce an A / B testing mechanism to ensure that the actual effect of the new model is better than the old version.
[0134] An ancient book classification system based on machine learning is used to implement an ancient book classification system based on machine learning, including:
[0135] The data collection module is used to collect and preprocess ancient book text data, divide the data into training set, validation set and test set, and use K-fold cross-validation strategy to improve the generalization ability of the model;
[0136] A feature extraction module is used to extract feature information for classification from ancient texts;
[0137] Classifier training module, used to train efficient and accurate ancient book classification models;
[0138] The classification result output module is used to display the classification results and receive user feedback.
[0139] Working principle: High-quality electronic texts of ancient books are collected from multiple reliable sources. The original texts are preprocessed to ensure the consistency and accuracy of the data. At the same time, strict data annotation standards are established to ensure the accuracy and consistency of classification labels, and the data set is divided into training set, validation set and test set for subsequent model training and evaluation.
[0140] A bidirectional long short-term memory network is used to capture long-distance dependencies in the text and understand the contextual semantics. Taking into account the existence of a large number of unrecognized and rare words in ancient texts, a method combining character-level and vocabulary-level embedding vector representations is adopted to enhance the modeling ability of ancient Chinese characteristics. In this way, the system can more accurately express the meaning of each Chinese character and word, thus providing a solid foundation for classification tasks.
[0141] The transfer learning technology is introduced, and the pre-trained Chinese word segmentation model is combined with the multi-layer perceptron as the top-level classifier. This method not only improves the initialization quality of the model, but also enhances its ability to adapt to specific tasks. By fine-tuning the pre-trained model and adjusting key hyperparameters, it ensures that the classifier can achieve the best performance on limited labeled data. In addition, a cross-validation strategy is implemented and parameter settings are optimized to further improve the generalization ability and classification accuracy of the model.
[0142] Finally, the system provides users with an intuitive and easy-to-understand display of classification results, supports batch document upload and real-time query functions, and integrates visual charts to help users quickly understand the classification distribution. At the same time, a user feedback mechanism is designed to allow users to correct incorrect classifications and update the model accordingly, forming a closed-loop process of continuous optimization.
[0143] 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.
[0144] While the embodiments of the present invention have been shown and described, it will be appreciated by those skilled in the art that many changes, modifications, substitutions and variations can be made to the embodiments without departing from the principles and spirit of the invention.
Claims
1. A method for classifying ancient books based on machine learning, characterized in that: The steps include: Step 1: Collect and preprocess ancient text data for training, verification and testing; Step 2: Extract text features that can represent the content and structure of ancient books from the preprocessed ancient book texts, and use a bidirectional long short-term memory network to capture long-distance dependencies in the text; Step 3: Use transfer learning technology to adjust the pre-trained word segmentation model and classifier; Step 4: Output the classification results and provide a user feedback mechanism to continuously optimize the classification model.
2. The ancient book classification method based on machine learning according to claim 1 is characterized in that: The collection and preprocessing of ancient book text data for training, verification and testing is specifically as follows: Acquire ancient texts from multiple reliable data sources, including but not limited to national libraries, university libraries, academic research institutions, the National Digital Library of China, Project Gutenberg, and digitized resources from private collections; The texts cover different historical periods and ancient books of various types and fields; Remove non-content information including but not limited to irrelevant characters, punctuation marks, special symbols and redundant spaces; convert all text to Unicode format; identify and remove duplicate paragraphs or documents.
3. The ancient book classification method based on machine learning according to claim 2 is characterized in that: The collecting and preprocessing of ancient book text data for training, verification and testing also includes: Use ancient Chinese word segmentation tools to accurately segment text, and combine domain expert knowledge base for auxiliary word segmentation; split long texts into independent sentences based on grammatical rules and text symbols; Develop an ancient Chinese classification label system based on existing document classification standards; Organize domain experts and trained professionals to manually label some samples; use the existing labeled data to train a preliminary model, use the cross entropy loss function to measure the difference between the model prediction and the true label, and then use the model to predict the category of new data, and finally manually review and correct it; The loss function L can be expressed as: Among them, y is the unique encoding representation of the true label; is the predicted output of the model; m is the number of categories in the category set C.
4. The ancient book classification method based on machine learning according to claim 3 is characterized in that: The preprocessing also includes adopting a K-fold cross-validation strategy to randomly divide the original data set into a training set, a validation set, and a test set according to a set ratio, and calculating the accuracy, recall, and F1 score for the classification category i to which the ancient book belongs, as shown below: Among them, Pi represents precision, Ri represents recall, TPi, FPi, and FNi represent the number of true positives, false positives, and false negatives, respectively.
5. The ancient book classification method based on machine learning according to claim 4 is characterized in that: The collection and preprocessing also includes data enhancement processing, specifically: Use synonym replacement to increase data diversity; Generate new but semantically unchanged text instances by changing sentence order or paragraph structure; Minor human-caused errors are included, including but not limited to spelling errors and misuse of punctuation.
6. The ancient book classification method based on machine learning according to claim 5 is characterized in that: As described in step 2, extracting text features includes: Use character-level embedding to capture information about special words. By training a character-level CNN or RNN model, each Chinese character is mapped into a low-dimensional space to form a character vector. Use a pre-trained word embedding model to convert words into dense vector representations; Combining character-level, word-level, and sentence-level features to build a multi-level feature representation system; Calculate the frequency of occurrence of characters, words, and sentence features in any ancient document, and then determine which feature representation system the features with high frequency belong to: TF(t,d)=f(t,d); f(t, d) represents the number of characters, words, and sentence features t that appear in document d; Count the number of documents containing character, word, and sentence features t: N = number of documents; nt = number of documents containing ancient text; t.
7. The ancient book classification method based on machine learning according to claim 6 is characterized in that: As described in step 2, BiLSTM is used to capture the long-distance dependencies in the text, and the forward and reverse LSTM units are combined to record the state of each time step, and finally a new vector concatenated from the hidden states is output. The LSTM unit update formula is as follows: f t =σ(W f ·[h t-1 ,x t ]+b f ) Among them, f t : Forget gate output, σ: Sigmoid activation function, W f : Forget gate weight matrix, b f : Forget gate bias, h t-1 : The hidden state of the previous time step, x t : Input of the current time step; i t =σ(W i ·[h t-1 ,x t ]+b i ) Among them, i t : Input gate output; W i : Input gate weight matrix; b i : Input gate bias term; in, Candidate memory cell state; tanh: hyperbolic tangent activation function; W c : Candidate memory cell weight matrix; b C : Candidate memory cell bias term; the t =σ(W o ·[h t-1 ,x t ]+b o ) Among them, t : Output gate output; W o : Output gate weight matrix; b o : Output gate bias term; Among them, C t : The memory cell state at the current time step; C t-1 : The memory cell state of the previous time step; f t 、i t and The states from the forget gate, input gate and candidate memory cells respectively; h t =o t ·tanh(C t ) Among them, h t : The hidden state of the current time step; tanh(C t ): Perform nonlinear transformation on the current memory cell state through the hyperbolic tangent activation function.
8. The ancient book classification method based on machine learning according to claim 7 is characterized in that: The transfer learning technology is used to adjust the pre-trained word segmentation model and classifier, specifically: Choose language models that have been pre-trained on large-scale Chinese corpora, giving priority to pre-trained models that are optimized for ancient Chinese. Expand the vocabulary of pre-trained models and add ancient Chinese characters and embedding vectors. Add a multi-layer perceptron as the top-level classifier based on the pre-trained model to map the high-level features extracted by the pre-trained model to specific classification labels; Build an end-to-end training framework that can conduct from the original text input to the final classification result output; adopt a progressive adjustment strategy, first make an initial adjustment with the learning rate, and then increase the learning rate to optimize the key layers.
9. The ancient book classification system based on machine learning according to claim 8 is characterized in that: The output classification results are specifically: Use the front-end framework to build a responsive user interface, support file upload components, real-time query, batch processing capabilities and result visualization, and provide classification explanations to help users understand the classification basis; Set up a "Feedback" button to guide users to submit opinions or report errors, regularly summarize user feedback and automatically classify and prioritize it through natural language processing technology, and establish a closed-loop process from feedback collection to problem solving to model updating.
10. A machine learning-based ancient book classification system, used to implement the machine learning-based ancient book classification method according to any one of claims 1 to 9, characterized in that: include: The data collection module is used to collect and preprocess ancient book text data, divide the data into training set, validation set and test set, and use K-fold cross-validation strategy to improve the generalization ability of the model; A feature extraction module is used to extract feature information for classification from ancient texts; Classifier training module, used to train ancient book classification models; The classification result output module is used to display the classification results and receive user feedback.
Citation Information
Cited By
Ancient text semantic understanding separation method and system
CN119886134A
A method and system for semantic understanding and segmentation of classical Chinese texts
CN119886134B