Method and device for identifying document section title, electronic device, storage medium

By recognizing paragraph formatting features and regular expression matching features in a document, the system automatically identifies chapter titles, solving the problem of low efficiency in manually editing a table of contents in existing technologies, and achieving convenience and efficiency improvement in automatically generating a table of contents.

CN114330313BActive Publication Date: 2026-03-24GUANGZHOU KINGSOFT MOBILE TECH +3
View PDF 1 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-11-30
Publication Date
2026-03-24

AI Technical Summary

Technical Problem

In existing technologies, a table of contents cannot be automatically generated after a user has written a document. The table of contents needs to be manually edited and organized, which is inefficient and costly.

Method used

By recognizing paragraph formatting features, paragraph vectors, and regular expression matching features in a document, the system automatically identifies chapter titles and generates a table of contents based on these features.

Benefits of technology

It improves the efficiency of automatically recognizing document chapter titles, reduces the cost of manual judgment, and facilitates the automatic generation of a table of contents.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114330313B_ABST
    Figure CN114330313B_ABST
Patent Text Reader

Abstract

The application relates to the technical field of text processing, and discloses a method for identifying chapter titles of a document, which comprises the following steps: determining at least one paragraph in the document; obtaining format features, paragraph vectors and regular matching features of each paragraph; the regular matching features are used for representing regular matching results of each paragraph to preset characters; and whether each paragraph is a chapter title in the document is identified according to the format features, the paragraph vectors and the regular matching features of each paragraph. In this way, the user does not need to manually judge whether each paragraph in the document is a chapter title, the efficiency of identifying whether each paragraph in the document is a chapter title is improved, and a table of contents can be automatically generated according to the paragraphs determined as chapter titles. The application further discloses a device for identifying chapter titles of a document, an electronic device and a storage medium.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of text processing technology, such as a method and apparatus, electronic device, and storage medium for identifying document chapter titles. Background Technology

[0002] The table of contents of a document is mainly used to present chapter information to readers, making it easier for them to quickly browse or edit the chapters they need.

[0003] A document's table of contents is typically a section that identifies the chapters within the document, such as "2.1 Human-Computer Interaction Framework Design". Currently, after a user writes a document, a table of contents cannot be automatically generated based on the document's content. Users must manually edit and organize the table of contents, which requires them to identify whether each paragraph is a chapter title, resulting in low efficiency and high labor costs. Summary of the Invention

[0004] To provide a basic understanding of some aspects of the disclosed embodiments, a brief summary is given below. This summary is not intended as a general commentary, nor is it intended to identify key / important components or describe the scope of protection of these embodiments, but rather as a prelude to the detailed description that follows.

[0005] This disclosure provides a method, apparatus, electronic device, and storage medium for identifying document chapter titles, enabling automatic identification of whether paragraphs in a document are chapter titles.

[0006] In some embodiments, a method for identifying document chapter titles includes: determining at least one paragraph in the document; obtaining format features, paragraph vectors, and regular expression matching features of each paragraph; the regular expression matching features are used to characterize the regular expression matching results of each paragraph for preset characters; and identifying whether each paragraph is a chapter title in the document based on the format features, paragraph vectors, and regular expression matching features of each paragraph.

[0007] In some embodiments, obtaining the paragraph vector of each paragraph includes: performing word vectorization on each paragraph to obtain the word vector corresponding to each paragraph; performing word position vectorization on each paragraph to obtain the word position vector corresponding to each paragraph; and obtaining the paragraph vector of each paragraph based on the word vector and word position vector corresponding to each paragraph.

[0008] In some embodiments, obtaining the paragraph vector of each paragraph based on the word vector and word position vector corresponding to each paragraph includes: superimposing the word vector and word position vector corresponding to each paragraph to obtain the tensor corresponding to each paragraph; mapping the tensor corresponding to each paragraph to the encoding vector corresponding to each paragraph, and determining the encoding vector corresponding to each paragraph as the paragraph vector of each paragraph.

[0009] In some embodiments, obtaining the paragraph vector of each paragraph includes: performing word vectorization on each paragraph to obtain the word vector corresponding to each paragraph; performing sentence vectorization on each paragraph to obtain the sentence vector corresponding to each paragraph; performing word position vectorization on each paragraph to obtain the word position vector corresponding to each paragraph; and obtaining the paragraph vector of each paragraph based on the word vector, sentence vector, and word position vector corresponding to each paragraph.

[0010] In some embodiments, the paragraph vector of each paragraph is obtained based on the word vector, clause vector and word position vector corresponding to each paragraph, including: superimposing the word vector, clause vector and word position vector corresponding to each paragraph to obtain the tensor corresponding to each paragraph; mapping the tensor corresponding to each paragraph to the encoding vector corresponding to each paragraph, and determining the encoding vector corresponding to each paragraph as the paragraph vector of each paragraph.

[0011] In some embodiments, obtaining the regular expression matching features of each paragraph includes: performing the following processing for each paragraph: finding at least one preset character in the paragraph; vectorizing the found at least one preset character to obtain at least one character feature corresponding to the at least one preset character; and fusing the at least one character feature to obtain the regular expression matching features of the paragraph.

[0012] In some embodiments, obtaining the format features of each paragraph includes: performing the following processing for each paragraph: extracting the format information of the paragraph; and vectorizing the extracted format information to obtain the format features of the paragraph.

[0013] In some embodiments, identifying whether each paragraph is a chapter title based on its format features, paragraph vector, and regular expression matching features includes: concatenating the format features, paragraph vector, and regular expression matching features of each paragraph to obtain the identification features of each paragraph; performing classification and identification processing on each of the identification features to obtain the identification result corresponding to each paragraph; the identification result is used to characterize whether the paragraph is a chapter title in the document.

[0014] In some embodiments, after identifying whether each paragraph is a chapter title in the document based on its format features, paragraph vector, and regular expression matching features, the method further includes: generating a table of contents based on the paragraph if it is a chapter title; and displaying the generated table of contents in the document.

[0015] In some embodiments, generating a directory based on the paragraphs includes: obtaining feature information of the paragraphs; performing a lookup operation on the feature information in a preset rule file table to obtain the directory level of the paragraphs; the preset rule file table stores the correspondence between feature information and directory levels; and generating a directory based on the directory level of the paragraphs.

[0016] In some embodiments, an apparatus for identifying document chapter titles includes: a paragraph determination module configured to determine at least one paragraph in a document; a format feature acquisition module configured to acquire format features of each paragraph; a paragraph vector acquisition module configured to acquire paragraph vectors of each paragraph; a regular expression matching feature acquisition module configured to acquire regular expression matching features of each paragraph; wherein the regular expression matching features are used to characterize the regular expression matching result of each paragraph for a preset character; and a chapter title identification module configured to identify whether each paragraph is a chapter title in the document based on the format features, paragraph vectors, and regular expression matching features of each paragraph.

[0017] In some embodiments, the paragraph vector acquisition module includes: a vector processing submodule configured to perform word vectorization processing on each paragraph to obtain word vectors corresponding to each paragraph; and to perform word position vectorization processing on each paragraph to obtain word position vectors corresponding to each paragraph; and a paragraph vector acquisition submodule configured to acquire paragraph vectors for each paragraph based on the word vectors and word position vectors corresponding to each paragraph.

[0018] In some embodiments, the paragraph vector acquisition submodule includes: an overlay module configured to overlay the word vectors and word position vectors corresponding to each paragraph to obtain tensors corresponding to each paragraph; a tensor mapping module configured to map the tensors corresponding to each paragraph to the encoding vectors corresponding to each paragraph; and a paragraph vector determination module configured to determine the encoding vectors corresponding to each paragraph to the paragraph vectors of each paragraph.

[0019] In some embodiments, the paragraph vector acquisition module includes: a vector processing submodule configured to perform word vectorization processing on each paragraph to obtain word vectors corresponding to each paragraph; perform sentence vectorization processing on each paragraph to obtain sentence vectors corresponding to each paragraph; perform word position vectorization processing on each paragraph to obtain word position vectors corresponding to each paragraph; and a paragraph vector acquisition submodule configured to acquire paragraph vectors for each paragraph based on the word vectors, sentence vectors, and word position vectors corresponding to each paragraph.

[0020] In some embodiments, the paragraph vector acquisition submodule includes: an overlay module configured to overlay the word vectors, clause vectors and word position vectors corresponding to each paragraph to obtain tensors corresponding to each paragraph; a tensor mapping module configured to map the tensors corresponding to each paragraph to the encoding vectors corresponding to each paragraph; and a paragraph vector determination module configured to determine the encoding vectors corresponding to each paragraph to the paragraph vectors of each paragraph.

[0021] In some embodiments, the regular expression matching feature acquisition module is configured to acquire the regular expression matching features of each paragraph by performing the following processing for each paragraph: finding at least one preset character in the paragraph; vectorizing the found at least one preset character to obtain at least one character feature corresponding to the at least one preset character; and fusing the at least one character feature to obtain the regular expression matching features of the paragraph.

[0022] In some embodiments, the format feature acquisition module is configured to acquire the format features of each paragraph by performing the following processing for each paragraph: extracting the format information of the paragraph; and vectorizing the extracted format information to obtain the format features of the paragraph.

[0023] In some embodiments, the chapter title recognition module includes: a splicing module configured to splice the format features, paragraph vectors and regular expression matching features of each paragraph to obtain the recognition features of each paragraph; and a classification recognition module configured to perform classification recognition processing on each of the recognition features to obtain the recognition result corresponding to each paragraph; the recognition result is used to characterize whether the paragraph is a chapter title in the document.

[0024] In some embodiments, the apparatus for identifying document chapter titles further includes: a table of contents generation module configured to generate a table of contents based on the paragraphs when the paragraphs are chapter titles; and a table of contents display module configured to display the generated table of contents in the document.

[0025] In some embodiments, the directory generation module is configured to generate a directory based on the directory paragraphs by: obtaining feature information of the paragraphs; performing a lookup operation on the feature information in a preset rule file table to obtain the directory level of the paragraphs; the preset rule file table stores the correspondence between feature information and directory levels; and generating a directory from the paragraphs according to the directory level.

[0026] In some embodiments, the electronic device includes a processor and a memory storing program instructions, the processor being configured to perform the method described above for identifying document chapter titles when the program instructions are executed.

[0027] In some embodiments, the storage medium stores program instructions that, when executed, perform the method described above for identifying document chapter titles.

[0028] The method, apparatus, electronic device, and storage medium for identifying document chapter titles provided in this disclosure can achieve the following technical effects:

[0029] First, at least one paragraph in the document is identified. Then, the paragraph's formatting features, paragraph vector, and regular expression matching features are obtained. Finally, based on these features, the system automatically identifies whether each paragraph is a chapter title. This method eliminates the need for manual user judgment of paragraph titles, improving efficiency and facilitating the automatic generation of a table of contents based on identified chapter titles.

[0030] The above general description and the description below are exemplary and illustrative only and are not intended to limit this application. Attached Figure Description

[0031] One or more embodiments are illustrated by way of example with reference to the accompanying drawings. These illustrations and drawings do not constitute a limitation on the embodiments. Elements having the same reference numerals in the drawings are shown as similar elements. The drawings are not to be scaled. And wherein:

[0032] Figure 1 This is a schematic diagram of a method for identifying document chapter titles provided in an embodiment of this disclosure;

[0033] Figure 2 This is a schematic diagram of distillation using the Bert model, according to an embodiment of this disclosure;

[0034] Figure 3 This is a schematic diagram of another method for identifying document chapter titles provided in an embodiment of this disclosure;

[0035] Figure 4 This is an application illustration of an embodiment of the present disclosure;

[0036] Figure 5 This is a schematic diagram of a device for identifying document chapter titles provided in an embodiment of this disclosure;

[0037] Figure 6 This is a schematic diagram of another device for identifying document chapter titles provided in an embodiment of this disclosure;

[0038] Figure 7 This is a schematic diagram of an electronic device provided in an embodiment of this disclosure. Detailed Implementation

[0039] To provide a more detailed understanding of the features and technical content of the embodiments of this disclosure, the implementation of the embodiments of this disclosure will be described in detail below with reference to the accompanying drawings. The accompanying drawings are for illustrative purposes only and are not intended to limit the embodiments of this disclosure. In the following technical description, for ease of explanation, several details are used to provide a full understanding of the disclosed embodiments. However, one or more embodiments may still be implemented without these details. In other cases, well-known structures and devices may be simplified in their depiction to simplify the drawings.

[0040] The terms "first," "second," etc., used in the specification, claims, and accompanying drawings of this disclosure are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate for the embodiments of this disclosure described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion.

[0041] Unless otherwise stated, the term "multiple" means two or more.

[0042] In this embodiment of the disclosure, the character " / " indicates that the objects before and after it are in an "or" relationship. For example, A / B means: A or B.

[0043] The term "and / or" describes an association between objects, indicating that three relationships can exist. For example, A and / or B means: A or B, or A and B.

[0044] The term "correspondence" can refer to an association or binding relationship. The correspondence between A and B means that there is an association or binding relationship between A and B.

[0045] Combination Figure 1 As shown in the embodiments of this disclosure, a method for identifying document chapter titles is provided, including:

[0046] Step S101: Identify at least one paragraph in the document;

[0047] Step S102: Obtain the format features, paragraph vectors, and regular expression matching features of each paragraph; the regular expression matching features are used to characterize the regular expression matching results of each paragraph for preset characters;

[0048] Step S103: Identify whether each paragraph is a chapter title in the document based on its format features, paragraph vector, and regular expression matching features.

[0049] The method for identifying document chapter titles provided in this disclosure first identifies at least one paragraph in the document, then obtains the paragraph's format features, paragraph vector, and regular expression matching features, and finally automatically identifies whether each paragraph is a chapter title in the document based on the paragraph's format features, paragraph vector, and regular expression matching features. This method eliminates the need for users to manually determine whether each paragraph in the document is a chapter title, thus improving the efficiency of identifying whether a paragraph in the document is a chapter title and facilitating the automatic generation of a table of contents based on the paragraphs identified as chapter titles.

[0050] Optionally, determining at least one paragraph in the document includes: extracting at least one paragraph in the document using paragraph separators and / or line breaks.

[0051] Optionally, the format features of each paragraph are obtained, including: performing the following processing for each paragraph: extracting the format information of the paragraph; and vectorizing the extracted format information to obtain the format features of the paragraph.

[0052] Optionally, the paragraph formatting information includes one or more of the following: paragraph font size, font, number of sentences, number of words, paragraph margins, paragraph length, whether it is underlined, and paragraph indentation. The extracted formatting information can be vectorized using techniques such as term frequency statistics and TF-IDF (Term Frequency-Inverse Text Frequency Index).

[0053] Optionally, obtaining the regular expression matching features of each paragraph includes: performing the following processing for each paragraph: finding at least one preset character in the paragraph; vectorizing the found at least one preset character to obtain at least one character feature corresponding to the at least one preset character; and fusing the at least one character feature to obtain the regular expression matching features of the paragraph. Optionally, the preset characters include characters such as one, two, three, four, five, six, seven, eight, nine, ten, numbers, or dates. For example, if the preset character is "2.1", and the character "2.1" is matched in the paragraph "2.1 Human-Computer Interaction Framework Design", then the character "2.1" is vectorized to obtain the regular expression matching features of the paragraph. The vectorization of the found preset characters can be performed using techniques such as word frequency statistics and the TF-IDF (Term Frequency-Inverse Text Frequency Index).

[0054] Optionally, obtaining the paragraph vector of each paragraph includes: performing word vectorization on each paragraph to obtain the word vector corresponding to each paragraph; performing word position vectorization on each paragraph to obtain the word position vector corresponding to each paragraph; and obtaining the paragraph vector of each paragraph based on the word vector and word position vector corresponding to each paragraph.

[0055] Optionally, the paragraph vector of each paragraph is obtained based on the word vector and word position vector corresponding to each paragraph, including: superimposing the word vector and word position vector corresponding to each paragraph to obtain the tensor corresponding to each paragraph; mapping the tensor corresponding to each paragraph to the encoding vector corresponding to each paragraph, and determining the encoding vector corresponding to each paragraph as the paragraph vector of each paragraph.

[0056] Since word vectors represent the semantics of words, and word position vectors represent the relative positions of words within a sentence, obtaining paragraph vectors through word vectors and word position vectors can reconstruct the paragraphs of a document to the greatest extent possible. This makes it more accurate to identify chapter titles in paragraphs by simultaneously utilizing paragraph formatting features, paragraph vectors, and regular expression matching features.

[0057] Optionally, the word vectors and word position vectors corresponding to each paragraph are superimposed to obtain the tensor corresponding to each paragraph, including: performing the following processing on the word vectors and word position vectors corresponding to each paragraph: adding the word vectors and word position vectors, and determining the vector obtained after the addition as the tensor corresponding to the paragraph.

[0058] Alternatively, paragraph vectors for each paragraph can be obtained using a paragraph vector extraction model (such as the TinyBERT model).

[0059] Optionally, the encoder in the paragraph vector extraction model includes several blocks, and each block has an identical structure. Each paragraph is input into the paragraph vector extraction model, which performs word vectorization on each paragraph to obtain its corresponding word vector (Token Embedding) and word position vectorization on each paragraph to obtain its corresponding word position vector (Position Embedding). The word vectors and word position vectors for each paragraph are then superimposed to obtain the tensor for each paragraph. The encoder of the paragraph vector extraction model inputs the tensor for each paragraph into the first block for matrix operations and outputs the first representation vector. The first representation vector is then input into the second block for matrix operations and outputs the second representation vector. The second representation vector is then input into the next block for matrix operations, and so on, until a preset number (positive integer) of blocks have been processed to obtain the encoded vector for each paragraph, which serves as the paragraph vector for each paragraph. Optionally, the dimension of the paragraph vector is a preset value (positive integer). Optionally, the length of each paragraph does not exceed a set threshold (positive integer).

[0060] The paragraph vector extraction model can convert each paragraph of a text into a numerical vector, which serves as the paragraph vector for each paragraph. This allows for a faster acquisition of the paragraph vectors for each paragraph.

[0061] Optionally, obtaining the paragraph vector of each paragraph includes: performing word vectorization on each paragraph to obtain the word vector corresponding to each paragraph; performing sentence vectorization on each paragraph to obtain the sentence vector corresponding to each paragraph; performing word position vectorization on each paragraph to obtain the word position vector corresponding to each paragraph; and obtaining the paragraph vector of each paragraph based on the word vector, sentence vector, and word position vector corresponding to each paragraph.

[0062] Optionally, word vectorization is performed on each paragraph to obtain the corresponding word vectors. This includes using the Word2vec model to train the words in each paragraph into a K-dimensional dense word vector. The Word2vec model is a deep learning tool with neural networks. Here, K is a positive integer.

[0063] Optionally, sentence vectorization is performed on each paragraph to obtain the sentence vector corresponding to each paragraph, including: performing the following processing on each paragraph: encoding each sentence in the paragraph to obtain the sentence vector corresponding to each sentence; and fusing the sentence vectors corresponding to each sentence (e.g., vector concatenation, vector superposition, etc.) to obtain the sentence vector corresponding to the paragraph.

[0064] Optionally, word position vectorization is performed on each paragraph to obtain the word position vector corresponding to each paragraph, including: performing the following processing on each paragraph: encoding the position of each word in the paragraph in the corresponding sentence to obtain the position vector corresponding to each word; and fusing the position vectors corresponding to each word (e.g., vector concatenation, vector superposition, etc.) to obtain the word position vector corresponding to the paragraph.

[0065] Optionally, the paragraph vector of each paragraph is obtained based on the word vector, clause vector and word position vector corresponding to each paragraph, including: superimposing the word vector, clause vector and word position vector corresponding to each paragraph to obtain the tensor corresponding to each paragraph; mapping the tensor corresponding to each paragraph to the encoding vector corresponding to each paragraph; and determining the encoding vector corresponding to each paragraph as the paragraph vector of each paragraph.

[0066] Since word vectors represent the semantics of words, clause vectors represent which sentence a word belongs to, and word position vectors represent the relative positions of words within a sentence, obtaining paragraph vectors through word vectors, clause vectors, and word position vectors can reconstruct the paragraphs of a document to the greatest extent possible. Furthermore, it can identify scenarios where a paragraph contains multiple chapter titles, making the accuracy of chapter title identification in paragraphs higher by simultaneously utilizing paragraph format features, paragraph vectors, and regular expression matching features.

[0067] Optionally, the word vectors, clause vectors, and word position vectors corresponding to each paragraph are superimposed to obtain the tensor corresponding to each paragraph. This includes performing the following processing on the word vectors, clause vectors, and word position vectors corresponding to each paragraph: adding the word vectors, clause vectors, and word position vectors together, and determining the vector obtained after the addition as the tensor corresponding to the paragraph.

[0068] Optionally, paragraph vectors for each paragraph can be obtained using a paragraph vector extraction model.

[0069] Optionally, each paragraph is input into a paragraph vector extraction model. The model performs word vectorization on each paragraph to obtain its corresponding word vector (Token Embedding), sentence vectorization on each paragraph to obtain its corresponding sentence vector (Segment Embedding), and word position vectorization on each paragraph to obtain its corresponding word position vector (Position Embedding). The word vectors, sentence vectors, and word position vectors for each paragraph are then superimposed to obtain a tensor for each paragraph. The encoder of the paragraph vector extraction model inputs the tensor for each paragraph into the first block for matrix operations and outputs the first representation vector. The first representation vector is then input into the second block for matrix operations and outputs the second representation vector. This process continues until a preset number of blocks (positive integers) of blocks have been processed, resulting in the encoded vector for each paragraph, which serves as the paragraph vector. Optionally, the dimension of the paragraph vector is a preset value (positive integer). Optionally, the length of each paragraph does not exceed a set threshold (positive integer). For example, inputting the paragraph "Company Development Plan" into the paragraph vector extraction model yields the paragraph vector as: [0.3939, 0.2939, -0.9333, ... 0.4343].

[0070] The paragraph vector extraction model can convert each paragraph of a text into a numerical vector, which serves as the paragraph vector for each paragraph. This allows for a faster acquisition of the paragraph vectors for each paragraph.

[0071] In some embodiments, the TinyBERT model is a model distilled from the BERT model. Figure 2 A schematic diagram of distillation in the BERT model, as shown below. Figure 2As shown, the knowledge learned by the Teacher-BERT model is transferred to the Student-TinyBERT model. The BERT model has N Transformer Layers (prediction layers), and the TinyBERT model has M Transformer Layers, where N > M, meaning M Transformer Layers are selected from the BERT model for Transformer Layer distillation. The mapping function from the TinyBERT model to the BERT model is n = g(m), meaning the m-th layer of the TinyBERT model learns knowledge starting from the n-th layer of the BERT model. Figure 2 In this model, the feature representations of the Embedding Layer and Prediction Layer of the BERT model are also used for knowledge distillation. Specifically, the Embedding Layer of the TinyBERT model learns knowledge from the Embedding Layer of the BERT model, treating the Embedding Layer as the 0th layer, i.e., the mapping function is 0 = g(0); the Prediction Layer of the TinyBERT model learns knowledge from the Prediction Layer of the BERT model, treating the Prediction Layer as the N+1th layer, i.e., the mapping function is N+1 = g(M+1); the mapping function between the Transformer Layer of the TinyBERT model and the Prediction Layer of the BERT model is n = g(m). Figure 2 In this diagram, d represents the dimension of the hidden layer features of the BERT model, and d' represents the dimension of the hidden layer features of the TinyBERT model, with d' < d to obtain a smaller TinyBERT model network. During training, the attention matrix and output of each Transformer layer in the Teacher BERT model are used as supervision information for the TinyBERT model, thereby training TinyBERT.

[0072] Optionally, each paragraph can be identified as a chapter title in the document based on its formatting features, paragraph vectors, and regular expression matching features. This includes: concatenating the formatting features, paragraph vectors, and regular expression matching features of each paragraph to obtain the identification features of each paragraph; performing classification and identification processing on each identification feature to obtain the identification result corresponding to each paragraph; and using the identification result to characterize whether a paragraph is a chapter title in the document. In this way, identifying whether a paragraph is a chapter title in the document based on the concatenated identification features of each paragraph's formatting features, paragraph vectors, and regular expression matching features eliminates the need for manual user judgment of whether paragraphs in the document are chapter titles. This not only improves the efficiency of identifying whether paragraphs in the document are chapter titles but also facilitates the automatic generation of a table of contents based on paragraphs identified as chapter titles.

[0073] Optionally, each of the identification features is classified and identified separately to obtain the identification result corresponding to each paragraph, including: using a preset classifier to classify and identify each of the identification features separately to obtain the identification result corresponding to each paragraph.

[0074] Optionally, the format features, paragraph vectors, and regular expression matching features of each paragraph are concatenated separately to obtain the recognition features of each paragraph. This includes performing the following processing on each paragraph: concatenating the paragraph's format features, paragraph vectors, and regular expression matching features sequentially to obtain the paragraph's recognition features; or multiplying the paragraph's format features, paragraph vectors, and regular expression matching features by their respective weights and then concatenating them sequentially to obtain the paragraph's recognition features. This makes the paragraph's recognition features more representative, thereby improving the accuracy of chapter title recognition.

[0075] Optionally, the weights corresponding to the paragraph format features, paragraph vectors, and regularity matching features are obtained during model training, or are preset.

[0076] Optionally, a pre-trained chapter title recognition and classification model can be used to identify each paragraph based on its format features, paragraph vectors, and regular expression matching features, so as to identify whether each paragraph is a chapter title in the document.

[0077] Optionally, the format features, paragraph vectors, and regular expression matching features of each paragraph are input into a pre-trained chapter title recognition and classification model. The model sequentially concatenates these features to obtain the recognition features for each paragraph. The model then performs classification processing on each feature to obtain the corresponding recognition result for each paragraph, indicating whether it is a chapter title in the document. For example, if the recognition result for a paragraph is "label_1", it indicates that the paragraph is a chapter title; if the result is "label_0", it indicates that the paragraph is not a chapter title. In this way, by using the chapter title recognition and classification model to identify paragraphs, it can automatically determine whether a paragraph is a chapter title, eliminating the need for manual user judgment. This allows for faster processing of massive amounts of paragraphs and improves the accuracy of identifying document chapter titles.

[0078] In some embodiments, the document contains a first paragraph "2.1 Human-Computer Interaction Framework Design" and a second paragraph "2.1.1 Human-Computer Collaborative System". The format features, paragraph vectors, and regular expression matching features of each paragraph are obtained. These features are then input into a pre-trained chapter title recognition and classification model. The model concatenates these features sequentially, resulting in the following recognition features for the first paragraph: [0.3838, 0.323, 0.4843, 0.4343, ..., 12, 23, 243, 1], and for the second paragraph: [0.2338, 0.312, 0.4203, 0.2132, ..., 2, 13, 123, 4]. The model then performs classification processing on these two features, resulting in the recognition result for both paragraphs being "label_1". Therefore, both paragraphs are determined to be chapter titles in the document.

[0079] Optionally, before using the pre-trained chapter title recognition and classification model to identify each paragraph, the method further includes training the chapter title recognition and classification model. Training the chapter title recognition and classification model includes: acquiring several document samples; acquiring at least one paragraph sample from each document sample and labeling each paragraph sample with a sample label; acquiring format feature samples, paragraph vector samples, and regular expression matching feature samples for each paragraph sample; and training the chapter title recognition and classification model (e.g., the LightGBM model) using the format feature samples, paragraph vector samples, regular expression matching feature samples, and sample labels for each paragraph sample to obtain the trained chapter title recognition and classification model. Optionally, the sample labels include: labels indicating that a paragraph is a chapter title, such as "label_1", and labels indicating that a paragraph is not a chapter title, such as "label_0".

[0080] The LightGBM model is a decision tree classification model. Decision tree classification determines whether a paragraph is a chapter title based on its identification features and the tree nodes. The LightGBM model uses a histogram algorithm to discretize continuous feature values ​​into k integers and constructs a histogram of width k. When traversing the data in the identification features, the discretized values ​​are used as indices to accumulate statistics in the histogram. After one data traversal, the histogram has accumulated the necessary statistics. Then, based on the discrete values ​​of the histogram, the optimal split point is obtained. The histogram algorithm reduces the computational cost of segmentation gain and replaces continuous values ​​with discrete bins, using a smaller data type to store training data and eliminating the need to store additional information for pre-sorted feature values, thus reducing memory usage. Thus, when the chapter title recognition and classification model is the LightGBM model, the LightGBM model can identify chapter titles for each paragraph based on the format features, paragraph vectors, and regular expression matching features of each paragraph. This can improve the accuracy of identifying document chapter titles, reduce memory consumption, and enable faster processing of the recognition of massive numbers of paragraphs.

[0081] Combination Figure 3 As shown, this disclosure provides another method for identifying document chapter titles, including:

[0082] Step S201: Identify at least one paragraph in the document.

[0083] Step S202: Obtain the format features and regular expression matching features of each paragraph; perform word vectorization, sentence vectorization and word position vectorization on each paragraph to obtain the word vector, sentence vector and word position vector corresponding to each paragraph.

[0084] Step S203: Superimpose the word vectors, clause vectors and word position vectors corresponding to each paragraph to obtain the tensors corresponding to each paragraph.

[0085] Step S204: Map the tensors corresponding to each paragraph to the encoding vectors corresponding to each paragraph; determine the encoding vectors corresponding to each paragraph as the paragraph vectors of each paragraph.

[0086] Step S205: The format features, paragraph vectors and regular expression matching features of each paragraph are concatenated sequentially to obtain the recognition features of each paragraph.

[0087] Step S206: Perform classification and recognition processing on each recognition feature to obtain the recognition result corresponding to each paragraph; the recognition result is used to characterize whether the paragraph is a chapter title in the document.

[0088] This embodiment first identifies at least one paragraph in the document, then obtains the paragraph's formatting features, paragraph vector, and regular expression matching features. Finally, based on these features, it automatically identifies whether each paragraph is a chapter title in the document. This method eliminates the need for manual user judgment to determine whether paragraphs are chapter titles, improving efficiency and reducing labor costs. Furthermore, it intelligently identifies chapter titles within the document, facilitating quick document editing and reading.

[0089] Optionally, after identifying whether each paragraph is a chapter title in the document based on its format features, paragraph vector, and regular expression matching features, the method further includes: if the paragraph is a chapter title, generating a table of contents based on the paragraphs that are chapter titles; and displaying the generated table of contents in the document.

[0090] Optionally, generating a table of contents based on paragraphs that serve as chapter titles includes: obtaining feature information of paragraphs that serve as chapter titles; performing a lookup operation on the feature information in a preset rule file table to obtain the table of contents level of the corresponding paragraphs; the preset rule file table stores the correspondence between feature information and table of contents level; and generating a table of contents based on the corresponding table of contents level for paragraphs that serve as chapter titles.

[0091] In this way, by obtaining format features, paragraph vectors, and regular expression matching features from paragraphs in the document, it can be identified whether the paragraph is a chapter title in the document. After identification, these identified chapter titles are compiled into a table of contents, and then the table of contents is displayed in the document, thus realizing page navigation.

[0092] Optionally, obtaining the feature information of paragraphs that serve as chapter titles includes: performing the following processing for each paragraph that serves as a chapter title: extracting the font and / or font size of the characters in the paragraph, and determining the font and / or font size of the characters in the paragraph as the feature information of the paragraph. In some embodiments, if the font of the characters in a paragraph that serves as a chapter title is Founder Xiaobiao Song and the font size is 12, the corresponding directory level of the paragraph is matched to a first-level directory in the rule file table. For example, if the font of a paragraph that serves as a chapter title is Founder Heiti and the font size is 3, the corresponding directory level of the paragraph is matched to a second-level directory in the rule file table.

[0093] Optionally, obtain the feature information of the paragraph that is the chapter title, including: when the first character of the paragraph from left to right is a number (which can be an Arabic numeral, such as "1", "2", etc., or a number expressed in any language, such as Chinese numerals "one", "two", etc.), determine the first character and the subsequent consecutive numeric characters as the feature information. In some embodiments, if the feature information is "2", then the corresponding paragraph's directory level is determined as the first-level directory in the rule file table. For another example, if the feature information is "2.1", then the corresponding paragraph's directory level is determined as the second-level directory in the rule file table.

[0094] In practical applications, as Figure 4 shown, each paragraph in the document is identified separately. Paragraphs "2. Prior Art" and "2.1 Existing cloud documents, word documents do not have the function of intelligent directory recognition" are both chapter titles in the document. The feature information of the paragraph "2. Prior Art" is "2", so the corresponding paragraph is the first-level directory; the feature information of the paragraph "2.1 Existing cloud documents, word documents do not have the function of intelligent directory recognition" is "2.1", so the corresponding paragraph is the second-level directory. Then, generate a directory based on the identified chapter titles according to the corresponding directory levels and display the directory page.

[0095] Combined with Figure 5 shown, an apparatus for identifying chapter titles in a document provided by an embodiment of the present disclosure includes: a paragraph determination module 1, a format feature acquisition module 2, a paragraph vector acquisition module 3, a regular expression matching feature acquisition module 4, and a chapter title recognition module 5. The paragraph determination module 1 is configured to determine at least one paragraph in the document; the format feature acquisition module 2 is configured to acquire the format features of each paragraph; the paragraph vector acquisition module 3 is configured to acquire the paragraph vectors of each paragraph; the regular expression matching feature acquisition module 4 is configured to acquire the regular expression matching features of each paragraph; the regular expression matching features are used to represent the regular expression matching results of each paragraph for a preset character; the chapter title recognition module 5 is configured to respectively identify whether each paragraph is a chapter title in the document according to the format features, paragraph vectors, and regular expression matching features of each paragraph.

[0096] Using the apparatus for identifying chapter titles in a document provided by an embodiment of the present disclosure, first determine at least one paragraph in the document, then acquire the format features, paragraph vectors, and regular expression matching features of the paragraph, and finally automatically identify whether each paragraph is a chapter title in the document according to the format features, paragraph vectors, and regular expression matching features of each paragraph. This method does not require the user to manually judge whether each paragraph in the document is a chapter title, which not only improves the efficiency of identifying whether a paragraph in the document is a chapter title, but also facilitates automatically generating a directory according to the paragraphs determined to be chapter titles.

[0097] Combined with Figure 6As shown, the paragraph vector acquisition module 3 includes a vector processing submodule 31 and a paragraph vector acquisition submodule 32. The vector processing submodule 31 is configured to perform word vectorization processing on each paragraph to obtain the word vectors corresponding to each paragraph; and to perform word position vectorization processing on each paragraph to obtain the word position vectors corresponding to each paragraph. The paragraph vector acquisition submodule 32 is configured to obtain the paragraph vectors of each paragraph based on the word vectors and word position vectors corresponding to each paragraph.

[0098] Optionally, the paragraph vector acquisition submodule 32 includes: an overlay module 321, a tensor mapping module 322, and a paragraph vector determination module 323. The overlay module 321 is configured to overlay the word vectors and word position vectors corresponding to each paragraph to obtain the tensors corresponding to each paragraph. The tensor mapping module 322 is configured to map the tensors corresponding to each paragraph to the corresponding encoding vectors for each paragraph. The paragraph vector determination module 323 is configured to determine the encoding vectors corresponding to each paragraph as the paragraph vectors for each paragraph.

[0099] Optionally, the vector processing submodule 31 is configured to perform word vectorization processing on each paragraph to obtain the word vectors corresponding to each paragraph; perform sentence vectorization processing on each paragraph to obtain the sentence vectors corresponding to each paragraph; and perform word position vectorization processing on each paragraph to obtain the word position vectors corresponding to each paragraph. The paragraph vector acquisition submodule 32 is configured to obtain the paragraph vectors of each paragraph based on the word vectors, sentence vectors, and word position vectors corresponding to each paragraph.

[0100] Optionally, the overlay module 321 is configured to overlay the word vectors, clause vectors and word position vectors corresponding to each paragraph to obtain the tensors corresponding to each paragraph; the tensor mapping module 322 is configured to map the tensors corresponding to each paragraph to the encoding vectors corresponding to each paragraph; and the paragraph vector determination module 323 is configured to determine the encoding vectors corresponding to each paragraph to the paragraph vectors of each paragraph.

[0101] Optionally, the regular expression matching feature acquisition module 4 is configured to acquire the regular expression matching features of each paragraph in the following way: performing the following processing for each paragraph: finding at least one preset character in the paragraph; vectorizing the found at least one preset character to obtain at least one character feature corresponding to the at least one preset character; and fusing the at least one character feature to obtain the regular expression matching features of the paragraph.

[0102] Optionally, the format feature acquisition module 2 is configured to acquire the format features of each paragraph by performing the following processing for each paragraph: extracting the format information of the paragraph; and vectorizing the extracted format information to obtain the format features of the paragraph.

[0103] Optionally, the chapter title recognition module 5 includes a splicing module 51 and a classification recognition module 52. The splicing module 51 is configured to splice the format features, paragraph vectors, and regular expression matching features of each paragraph to obtain the recognition features of each paragraph. The classification recognition module 52 is configured to perform classification recognition processing on each recognition feature to obtain the recognition result corresponding to each paragraph; the recognition result is used to characterize whether a paragraph is a chapter title in the document.

[0104] Optionally, the classification and recognition module 52 is configured to classify and recognize each recognition feature separately in the following way to obtain the recognition result corresponding to each paragraph: using a preset classifier to classify and recognize each recognition feature separately to obtain the recognition result corresponding to each paragraph.

[0105] Optionally, the apparatus for identifying document chapter titles further includes a table of contents generation module 6 and a table of contents display module 7. The table of contents generation module 6 is configured to generate a table of contents based on the paragraphs that are chapter titles. The table of contents display module 7 is configured to display the generated table of contents in the document.

[0106] Optionally, the table of contents generation module is configured to generate a table of contents based on paragraphs that serve as chapter titles in the following manner: obtaining the feature information of the paragraphs; performing a lookup operation on the feature information in a preset rule file table to obtain the table of contents level of the paragraphs; the preset rule file table stores the correspondence between feature information and table of contents level; and generating a table of contents for the paragraphs according to the corresponding table of contents level.

[0107] Combination Figure 6As shown in the embodiment of this disclosure, the apparatus for identifying document chapter titles includes a paragraph determination module 1 that determines at least one paragraph in the document and sends it to a format feature acquisition module 2, a paragraph vector acquisition module 3, and a regular expression matching feature acquisition module 4. The format feature acquisition module 2 acquires the format features of each paragraph and sends them to the chapter title recognition module 5. The regular expression matching feature acquisition module 4 acquires the regular expression matching features of each paragraph and sends them to the chapter title recognition module 5. The vector processing submodule 31 of the paragraph vector acquisition module 3 receives each paragraph and performs word vectorization, sentence vectorization, and word position vectorization on each paragraph to obtain the word vector, sentence vector, and word position vector corresponding to each paragraph, and sends them to the paragraph vector acquisition submodule 32. The superposition module 321 of the paragraph vector acquisition submodule 32 receives the word vector, sentence vector, and word position vector corresponding to each paragraph and superimposes them to obtain the tensor corresponding to each paragraph. Tensor mapping module 322 maps the tensors corresponding to each paragraph to the corresponding encoding vectors for each paragraph. Paragraph vector determination module 323 determines the encoding vectors corresponding to each paragraph as paragraph vectors for each paragraph and sends each paragraph vector to chapter title recognition module 5. The concatenation module 51 of chapter title recognition module 5 receives the paragraph vectors sent by paragraph vector determination module 323, receives the format features sent by format feature acquisition module 2, and receives the regular expression matching features sent by regular expression matching feature acquisition module 4. It then concatenates the format features, paragraph vectors, and regular expression matching features of each paragraph to obtain the recognition features of each paragraph. Classification recognition module 52 performs classification recognition processing on each recognition feature to obtain the recognition results corresponding to each paragraph. The recognition results are used to characterize whether a paragraph is a chapter title in the document. Classification recognition module 52 sends the paragraphs identified as chapter titles to table of contents generation module 6. Table of contents generation module 6 generates a table of contents based on the paragraphs as chapter titles and sends the generated table of contents to table of contents display module 7. Table of contents display module 7 displays the generated table of contents in the document.

[0108] This embodiment first identifies at least one paragraph in the document, then obtains the paragraph's formatting features, paragraph vector, and regular expression matching features. Finally, based on these features, it automatically identifies whether each paragraph is a chapter title in the document. This method eliminates the need for manual user judgment to determine whether paragraphs are chapter titles, improving efficiency and reducing labor costs. Furthermore, it intelligently identifies chapter titles within the document, facilitating quick document editing and reading.

[0109] Combination Figure 7As shown, this disclosure provides an electronic device including a processor 600 and a memory 601 storing program instructions. Optionally, the electronic device may further include a communication interface 602 and a bus 603. The processor 600, communication interface 602, and memory 601 can communicate with each other via the bus 603. The communication interface 602 can be used for information transmission. The processor 600 can call the program instructions in the memory 601 to execute the method for identifying document chapter titles described in the above embodiment.

[0110] Furthermore, the logic instructions in the aforementioned memory 601 can be implemented as software functional units and, when sold or used as independent products, can be stored in a computer-readable storage medium.

[0111] The memory 601, as a computer-readable storage medium, can be used to store software programs and computer-executable programs, such as program instructions / modules corresponding to the methods in the embodiments of this disclosure. The processor 600 executes functional applications and data processing by running the program instructions / modules stored in the memory 601, thereby implementing the method for identifying document chapter titles in the above embodiments.

[0112] The memory 601 may include a program storage area and a data storage area. The program storage area may store the operating system and applications required for at least one function; the data storage area may store data created based on the use of the terminal device. Furthermore, the memory 601 may include high-speed random access memory and may also include non-volatile memory.

[0113] Optionally, the electronic device includes a computer.

[0114] This disclosure provides a storage medium storing program instructions that, when executed, perform the method described above for identifying document chapter titles.

[0115] This disclosure provides a computer program product, which includes a computer program stored on a computer-readable storage medium. The computer program includes program instructions that, when executed by a computer, cause the computer to perform the aforementioned method for identifying document chapter titles.

[0116] The aforementioned computer-readable storage medium may be a transient computer-readable storage medium or a non-transitory computer-readable storage medium.

[0117] The technical solutions of this disclosure can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes one or more instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the method described in this disclosure. The aforementioned storage medium can be a non-transitory storage medium, including: a USB flash drive, a portable hard drive, a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk, and other media capable of storing program code; it can also be a transient storage medium.

[0118] The foregoing description and accompanying drawings fully illustrate embodiments of this disclosure to enable those skilled in the art to practice them. Other embodiments may include structural, logical, electrical, procedural, and other changes. The embodiments represent only possible variations. Individual components and functions are optional unless explicitly required, and the order of operation may vary. Parts and features of some embodiments may be included in or replace parts and features of other embodiments. Moreover, the terminology used in this application is for describing embodiments only and is not intended to limit the claims. As used in the description of embodiments and claims, the singular forms “a,” “an,” and “the” are intended to equally include the plural forms unless the context clearly indicates otherwise. Similarly, the term “and / or” as used in this application means including one or more of the associated listed items and all possible combinations thereof. Additionally, when used in this application, the term "comprise" and its variations "comprises" and / or "comprising" refer to the presence of stated features, integrals, steps, operations, elements, and / or components, but do not exclude the presence or addition of one or more other features, integrals, steps, operations, elements, components, and / or groups thereof. Without further limitations, an element defined by the phrase "comprises a..." does not exclude the presence of other identical elements in the process, method, or apparatus that includes said element. In this document, each embodiment may focus on the differences from other embodiments, and similar or identical parts between embodiments can be referred to mutually. For methods, products, etc., disclosed in the embodiments, if they correspond to the method section disclosed in the embodiments, the relevant parts can be referred to the description of the method section.

[0119] Those skilled in the art will recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of the embodiments of this disclosure. Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working processes of the systems, devices, and units described above can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here.

[0120] The methods and products (including but not limited to devices and equipment) disclosed in the embodiments herein can be implemented in other ways. For example, the device embodiments described above are merely illustrative. For instance, the division of units may be merely a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. In addition, the coupling or direct coupling or communication connection between the shown or discussed units may be through some interfaces, and the indirect coupling or communication connection between devices or units may be electrical, mechanical, or other forms. The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units, that is, they may be located in one place or distributed across multiple network units. Some or all of the units may be selected to implement this embodiment according to actual needs. Furthermore, the functional units in the embodiments of this disclosure may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit.

[0121] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to embodiments of this disclosure. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. In some alternative implementations, the functions marked in the blocks may occur in a different order than that shown in the drawings. For example, two consecutive blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. In the descriptions corresponding to the flowcharts and block diagrams in the accompanying drawings, the operations or steps corresponding to different blocks may also occur in a different order than disclosed in the description, and sometimes there is no specific order between different operations or steps. For example, two consecutive operations or steps may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. Each block in a block diagram and / or flowchart, and combinations of blocks in a block diagram and / or flowchart, can be implemented using a dedicated hardware-based system that performs the specified function or action, or using a combination of dedicated hardware and computer instructions.

Claims

1. A method for identifying document chapter titles, characterized in that, include: Identify at least one paragraph in the document; Obtain the format features, paragraph vectors, and regular expression matching features of each paragraph; The regular expression matching feature is used to characterize the regular expression matching results of each paragraph for the preset characters; Based on the format characteristics, paragraph vectors, and regular expression matching features of each paragraph, we can identify whether each paragraph is a chapter title in the document. The paragraph vector is obtained based on word vectors and word position vectors, or based on word vectors, clause vectors, and word position vectors. The word position vector is obtained by encoding the position of each word in the paragraph in the corresponding sentence to obtain the position vector corresponding to each word; and fusing the position vectors corresponding to each word to obtain the word position vector corresponding to the paragraph. The process of identifying whether each paragraph is a chapter title in the document based on its format features, paragraph vectors, and regular expression matching features includes: concatenating the format features, paragraph vectors, and regular expression matching features of each paragraph to obtain the identification features of each paragraph; or multiplying the format features, paragraph vectors, and regular expression matching features of each paragraph by their respective weights before concatenating them to obtain the identification features of the paragraph; performing classification and identification processing on each of the identification features to obtain the identification results corresponding to each paragraph; and using the identification results to characterize whether a paragraph is a chapter title in the document.

2. The method according to claim 1, characterized in that, Obtain the paragraph vector for each paragraph, including: Each paragraph is processed into a word vector to obtain the corresponding word vector. Each paragraph is processed into a word position vector to obtain the word position vector corresponding to each paragraph; The paragraph vector for each paragraph is obtained by using the word vector and word position vector corresponding to each paragraph.

3. The method according to claim 2, characterized in that, The paragraph vector for each paragraph is obtained based on the word vector and word position vector corresponding to each paragraph, including: The word vectors and word position vectors corresponding to each paragraph are superimposed to obtain the tensors corresponding to each paragraph. The tensors corresponding to each paragraph are mapped to the corresponding encoding vectors of each paragraph, and the encoding vectors corresponding to each paragraph are determined as the paragraph vectors of each paragraph.

4. The method according to claim 1, characterized in that, Obtain the paragraph vector for each paragraph, including: Each paragraph is processed into a word vector to obtain the corresponding word vector. Each paragraph is segmented into sentence vectors to obtain the corresponding sentence vectors for each paragraph. Each paragraph is processed into a word position vector to obtain the word position vector corresponding to each paragraph; The paragraph vector for each paragraph is obtained by using the word vector, clause vector, and word position vector corresponding to each paragraph.

5. The method according to claim 4, characterized in that, The paragraph vector for each paragraph is obtained based on the word vector, clause vector, and word position vector corresponding to each paragraph, including: The word vectors, clause vectors and word position vectors corresponding to each paragraph are superimposed to obtain the tensors corresponding to each paragraph. The tensors corresponding to each paragraph are mapped to the corresponding encoding vectors of each paragraph, and the encoding vectors corresponding to each paragraph are determined as the paragraph vectors of each paragraph.

6. The method according to claim 1, characterized in that, Obtain the regular expression matching features for each paragraph, including: For each of the paragraphs, perform the following processing: Find at least one preset character in the paragraph; The found at least one preset character is vectorized to obtain at least one character feature that corresponds one-to-one with the at least one preset character; The at least one character feature is fused to obtain the regular expression matching feature of the paragraph.

7. The method according to claim 1, characterized in that, Obtain the formatting characteristics of each paragraph, including: For each of the paragraphs, perform the following processing: Extract the formatting information of the paragraph; The extracted format information is vectorized to obtain the format features of the paragraph.

8. The method according to any one of claims 1 to 7, characterized in that, After identifying whether each paragraph is a chapter title in the document based on its formatting features, paragraph vectors, and regular expression matching features, the process also includes: If the paragraph is a chapter title, a table of contents is generated based on the paragraph. The generated table of contents will be displayed in the document.

9. The method according to claim 8, characterized in that, Generate a table of contents based on the paragraphs, including: Obtain the feature information of the paragraph; The feature information is looked up in a preset rule file table to obtain the directory level of the paragraph; the preset rule file table stores the correspondence between feature information and directory level. Generate a table of contents based on the paragraphs and the table of contents hierarchy.

10. A device for identifying document chapter titles, characterized in that, include: The paragraph identification module is configured to identify at least one paragraph in a document; The format feature acquisition module is configured to acquire the format features of each paragraph; The paragraph vector acquisition module is configured to acquire the paragraph vector of each paragraph; The regular expression matching feature acquisition module is configured to acquire the regular expression matching features of each paragraph; The regular expression matching feature is used to characterize the regular expression matching results of each paragraph for the preset characters; The chapter title recognition module is configured to identify whether each paragraph is a chapter title in the document based on the format features, paragraph vectors, and regular expression matching features of each paragraph. The paragraph vector is obtained based on word vectors and word position vectors, or based on word vectors, clause vectors, and word position vectors. The word position vector is obtained by encoding the position of each word in the paragraph in the corresponding sentence to obtain the position vector corresponding to each word; and fusing the position vectors corresponding to each word to obtain the word position vector corresponding to the paragraph. The chapter title recognition module includes a splicing module and a classification recognition module. The splicing module is configured to splice the format features, paragraph vectors, and regular expression matching features of each paragraph to obtain the recognition features of each paragraph; or, to multiply the format features, paragraph vectors, and regular expression matching features of each paragraph by their respective weights before splicing to obtain the recognition features of the paragraph. The classification recognition module is configured to perform classification recognition processing on each of the recognition features to obtain the recognition result corresponding to each paragraph. The recognition result is used to characterize whether a paragraph is a chapter title in the document.

11. An electronic device comprising a processor and a memory storing program instructions, characterized in that, The processor is configured to, when executing the program instructions, perform the method for identifying document chapter titles as described in any one of claims 1 to 9.

12. A storage medium storing program instructions, characterized in that, When the program instructions are executed, they perform the method for identifying document chapter titles as described in any one of claims 1 to 9.

Citation Information

Patent Citations

  • Document title tree construction method and device, electronic equipment and storage medium

    CN111460083A