Historical place name classification method and device and computer readable storage medium

By improving the bidirectional encoder converter and part-of-speech tagging technology, the problem of lack of part-of-speech auxiliary information in historical place name classification has been solved, achieving higher classification accuracy and the ability to identify synonym relationships.

CN121456676APending Publication Date: 2026-02-03SUZHOU UNIV
View PDF 5 Cites 0 Cited by

Patent Information

Application Number
CN202610005753.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-01-05
Publication Date
2026-02-03

AI Technical Summary

Technical Problem

Existing methods for classifying historical place names do not incorporate part-of-speech information, making it difficult to effectively extract the correlation features between words, resulting in low accuracy of classification results.

Method used

An improved bidirectional encoder-transformer is used in combination with dense and sparse self-attention modules to generate high-confidence historical place name categories through global semantic feature vectors and part-of-speech tagging.

Benefits of technology

It improves the accuracy of classifying historical place names, especially in the ability to identify polysemy and synonym relationships in text, significantly improving the accuracy of classification results.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121456676A_ABST
    Figure CN121456676A_ABST
Patent Text Reader

Abstract

The invention belongs to the technical field of text classification, and relates to a historical place name classification method and device and a computer readable storage medium. Performing mapping and linear transformation on the to-be-classified text, and outputting a query vector, a key vector and a value vector; obtaining an intermediate matrix based on the query vector and the key vector, respectively inputting the intermediate matrix into a dense self-attention module and a sparse self-attention module, and outputting global dense correlation attention weight distribution and high-confidence sparse correlation attention weight distribution; obtaining an attention weight matrix based on the global dense correlation attention weight distribution and the high-confidence sparse correlation attention weight distribution; obtaining a global semantic feature vector based on the attention weight matrix and the value vector; performing part-of-speech tagging on the text to be classified to obtain a part-of-speech sequence; splicing the part-of-speech sequence and a to-be-classified text, inputting the spliced part-of-speech sequence and the to-be-classified text into a text convolutional neural network, and outputting an n-gram phrase And outputting a historical place name category based on the global semantic feature vector and the n-gram phrase feature vector.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of text classification technology, and in particular to a method, apparatus and computer-readable storage medium for classifying historical place names. Background Technology

[0002] The core significance of historical place name classification is to systematically organize historical place name resources, providing accurate and reusable place name information support for historical research, cultural inheritance, and practical applications. Through place name classification, the scope of territories and changes in geographical environment during different historical periods can be clearly identified, providing basic data for historical geography. Furthermore, by classifying and labeling existing or historically identical places with the same name, confusion in modern place name management can be resolved, providing a reference for personnel in geographical surveying and mapping.

[0003] Traditional methods for classifying historical place names rely on statistical features, primarily capturing shallow features by analyzing the frequency and rarity of words in text. This simple extraction of place names fails to establish deep semantic connections, neglecting crucial information such as unique synonym mappings within historical place names, resulting in low accuracy in classification. Existing technologies utilize deep learning models for historical place name classification, such as... Figure 1 As shown, the text to be classified is vectorized, and then a convolutional neural network is used to extract its feature information. Pooling layers are then used to extract the most important features, and finally, a fully connected layer is used to output the classification result based on the feature information. However, because neural network models can only extract local features, they ignore information such as place name changes attached to the text's meaning. For example, "Luoyang: capital of the Eastern Han Dynasty, renamed Luoyang during the Cao Wei Dynasty, and Dongdu during the Sui and Tang Dynasties." If a neural network model is simply used to extract features, the alias relationship between Luoyang and Luoyang, reflected in the "renamed" clause, will be completely lost. This is because historical place names usually appear in the text as technical terms with relatively fixed grammatical attributes and specific connections with other words in the text. However, existing methods do not introduce part-of-speech auxiliary information during classification and cannot effectively extract the relational features between words. Therefore, they cannot effectively distinguish between distracting words and core entity words, thus affecting classification accuracy.

[0004] In summary, existing methods for classifying historical place names suffer from several problems. They fail to incorporate part-of-speech information, cannot effectively extract the association features between words, and thus cannot effectively distinguish between distracting words and core entity words, resulting in low accuracy of classification results. Summary of the Invention

[0005] Therefore, the technical problem to be solved by the present invention is to overcome the problem that the existing historical place name classification methods do not introduce part-of-speech auxiliary information, cannot effectively extract the correlation features between words, and thus cannot effectively distinguish between interfering words and core entity words, resulting in low accuracy of classification results.

[0006] To solve the above-mentioned technical problems, the present invention provides a method for classifying historical place names, including: The text to be classified is input into an improved bidirectional encoder-transformer, which outputs a global semantic feature vector, specifically including: The program performs mapping and linear transformation on the text to be classified, outputting query vector, key vector, and value vector; it also performs matrix multiplication on the query vector and key vector, outputting an intermediate matrix. The intermediate matrix is ​​input into the dense self-attention module for transformation, and the output is the global dense association attention weight distribution; the intermediate matrix is ​​input into the sparse self-attention module for feature selection and fusion, and the output is the high-confidence sparse association attention weight distribution. After assigning weights to the global dense association attention weight distribution and the high-confidence sparse association attention weight distribution, the elements are added together to obtain the attention weight matrix; the attention weight matrix is ​​then multiplied by the value vector to output the global semantic feature vector. The text to be classified is labeled with part-of-speech tags to obtain a part-of-speech sequence; the part-of-speech sequence is concatenated with the text to be classified and input into a text convolutional neural network to output an n-gram grammatical phrase feature vector. The global semantic feature vector and the n-gram phrase feature vector are concatenated and input into a fully connected layer to output the historical place name categories in the text to be classified.

[0007] Preferably, the intermediate matrix is ​​input into the sparse self-attention module for feature selection and fusion, including: The attention score matrix is ​​obtained by the dot product of the query vector and the key vector; Using ReLU 2 The activation function performs a non-linear transformation on each element of the attention score matrix to obtain a sparse attention score matrix. The attention weight matrix is ​​obtained by normalizing the sparse attention score matrix using the softmax function; the attention weight matrix is ​​then multiplied by the value vector to obtain the high-confidence sparse correlation attention weight distribution.

[0008] Preferably, weights are assigned to the globally densely associated attention weight distribution and the high-confidence sparsely associated attention weight distribution, including: Perform an exponential operation on the first learnable parameter and the second learnable parameter to obtain the first learnable parameter term and the second learnable parameter term; Based on the sum of the first and second learnable parameter terms, a normalization term is constructed; The weights of the global dense association attention weight distribution are obtained based on the ratio of the first learnable parameter term to the normalized term. The weights of the high-confidence sparse association attention weight distribution are obtained based on the ratio of the second learnable parameter term to the normalization.

[0009] Preferably, the globally densely associated attention weight distribution is represented as: , in, This represents the distribution of globally densely associated attention weights; This represents a dense self-attention module; Represents the query vector; Represents the key vector; Represents a value vector; Represents the normalization function; Indicates transpose; Indicates the dimension of the key vector; The high-confidence sparse association attention weight distribution is represented as follows: , , in, This represents the distribution of attention weights for high-confidence sparse associations. Indicates the activation function; Represents the sparse attention score matrix; This represents the attention weight matrix.

[0010] Preferably, the global semantic feature vector is represented as: , in, Represents the global semantic feature vector; This indicates an improved bidirectional encoder-decoder; This represents the distribution of globally densely associated attention weights; Represents the query vector; Represents the key vector; Represents a value vector; This represents the distribution of attention weights for high-confidence sparse associations. express The weights; express The weights; , , in, This represents the first learnable parameter; This represents the second learnable parameter.

[0011] Preferably, the HanLP word segmenter is used to perform part-of-speech tagging on each word in the text to be classified; The part-of-speech tags of each word are converted into low-dimensional vectors to obtain the part-of-speech embedding vectors of each word. Based on the part-of-speech embedding vectors of all words in the text to be classified, the part-of-speech sequence of the text to be classified is obtained.

[0012] Preferably, the text convolutional neural network includes multiple convolutional kernels in parallel with different window sizes; the text convolutional neural network performs feature extraction on the input concatenated feature vector, including the following steps: Multiple convolution kernels are used to perform convolution operations on the input concatenated feature vectors, and multiple grammatical phrase features of different lengths are output. Pooling operations are used to fuse features of multiple grammatical phrases of different lengths to obtain an n-grammatical phrase feature vector.

[0013] Preferably, the improved bidirectional encoder is further comprising, before inputting the text to be classified into the converter: Add missing fields to the text to be categorized, and remove special characters, spaces, and punctuation marks from the text to be categorized; The text to be classified is concatenated with fields for place name, place name associated events, and place name origin to obtain the preprocessed text to be classified.

[0014] The present invention also provides a historical place name classification device, comprising: The global feature extraction module is used to input the text to be classified into the improved bidirectional encoder-decoder and output a global semantic feature vector, which specifically includes: The text processing submodule is used to map and linearly transform the text to be classified, and output query vector, key vector and value vector; it also performs matrix multiplication on the query vector and key vector and outputs an intermediate matrix. The attention information acquisition submodule is used to input the intermediate matrix into the dense self-attention module for transformation and output the global dense association attention weight distribution; the intermediate matrix is ​​input into the sparse self-attention module for feature selection and fusion and output the high-confidence sparse association attention weight distribution. The feature acquisition module submodule is used to assign weights to the global dense association attention weight distribution and the high-confidence sparse association attention weight distribution, and then add them element by element to obtain the attention weight matrix; the attention weight matrix is ​​then multiplied with the value vector to output the global semantic feature vector. The local feature extraction module is used to perform part-of-speech tagging on the text to be classified, and obtain a part-of-speech sequence; the part-of-speech sequence is concatenated with the text to be classified and input into the text convolutional neural network, and the output is an n-gram grammatical phrase feature vector; The classification module is used to concatenate the global semantic feature vector and the n-gram grammatical phrase feature vector and input them into the fully connected layer, and output the historical place name categories in the text to be classified.

[0015] The present invention also provides a computer-readable storage medium storing a computer program, which, when executed by a processor, implements the steps of the above-described historical place name classification method.

[0016] The historical place name classification method provided in this application has the following beneficial effects: First, the text to be classified is processed to obtain query vectors, key vectors, and value vectors. Then, a dense self-attention module in an improved bidirectional encoder-transformer applies standard Softmax to the intermediate matrix of the query and key vectors, outputting global dense relational attention weights. This focuses on the semantic relationships between each word and other words in the text, ensuring no distant word relationships are missed. This provides crucial contextual information for determining whether a word is a historical place name, preventing the loss of relational features due to local perspectives. Simultaneously, a sparse self-attention module sparsifies the intermediate matrix, retaining only high-confidence relational paths to reduce interference from irrelevant context in core entity judgments, further focusing on the specific semantic relationships of historical place names. Finally, weight fusion preserves the semantic integrity of the global context, generating a global semantic feature vector that integrates accurate relational features. This method clearly depicts the core dependencies between historical place names and their contexts, strengthening the correlation features between words. Furthermore, by tagging words in the text to be classified with parts-of-speech tags, a sequence reflecting word attributes is obtained. This sequence is then concatenated with the text and input into a neural network. Using parts-of-speech as auxiliary information, the neural network learns both lexical semantics and part-of-speech attributes simultaneously, quickly filtering out candidate words with place name attributes and initially eliminating non-place name interference words. It exhibits stronger grammatical judgment capabilities in recognizing "place name + function word" structures, improving the accuracy of judging "verb modifying noun + noun" combinations, and demonstrating high recognition accuracy in handling polysemy (i.e., place name renaming) problems in text. Finally, global semantic features and local phrase collocation features are concatenated and input into a fully connected layer to accurately distinguish interference words (such as specific phrases without historical place names / global semantics) from core historical place names, ultimately outputting highly accurate classification results. Attached Figure Description

[0017] To make the content of this invention easier to understand, the invention will be further described in detail below with reference to specific embodiments and accompanying drawings, wherein: Figure 1 This application provides a schematic diagram of the existing historical place name classification model structure; Figure 2 A flowchart of the historical place name classification method provided for this application; Figure 3 A schematic diagram of the improved bidirectional encoder-converter provided in this application; Figure 4 This is a schematic diagram of the historical place name classification model structure provided in the embodiments of this application; Figure 5 A schematic diagram of the historical place name classification device provided for this application. Detailed Implementation

[0018] The present invention will be further described below with reference to the accompanying drawings and specific embodiments, so that those skilled in the art can better understand and implement the present invention. However, the embodiments described are not intended to limit the present invention.

[0019] Please see Figure 2 , Figure 2 The diagram shown is a flowchart of the historical place name classification method provided in this application. The method specifically includes: S10: Input the text to be classified into the improved bidirectional encoder-converter and output a global semantic feature vector.

[0020] Optionally, before step S10, preprocessing of the text to be classified is further included. The specific steps of preprocessing include: Step 1-1: Add missing fields to the text to be classified and remove special characters, spaces, and punctuation. Step 1-2: Concatenate the place names, place-related events, and place-origin fields from the text to be classified to obtain the preprocessed text to be classified.

[0021] For example, if the place name is Jinling, then the event associated with the place name is an event that occurs in Jinling or an event related to Jinling that occurs elsewhere.

[0022] Specifically, step S10 includes: S100: Performs mapping and linear transformation on the text to be classified, outputting query vector, key vector, and value vector; performs matrix multiplication on the query vector and key vector, outputting an intermediate matrix.

[0023] Specifically, the mapping and linear transformation of the text to be classified includes: segmenting the text to be classified to obtain a token sequence, mapping each token to a low-dimensional embedding representation, and performing linear transformations on the initial embedding vector through three different learnable weight matrices to obtain the query vector, key vector, and value vector.

[0024] S101: Input the intermediate matrix into the dense self-attention module for transformation, and output the global dense association attention weight distribution; input the intermediate matrix into the sparse self-attention module for feature selection and fusion, and output the high-confidence sparse association attention weight distribution.

[0025] S102: After assigning weights to the global dense association attention weight distribution and the high-confidence sparse association attention weight distribution, add them element by element to obtain the attention weight matrix; perform matrix multiplication on the attention weight matrix and the value vector to output the global semantic feature vector.

[0026] S20: Perform part-of-speech tagging on the text to be classified to obtain a part-of-speech sequence; concatenate the part-of-speech sequence with the text to be classified and input it into a text convolutional neural network to output an n-gram grammatical phrase feature vector.

[0027] S30: Concatenate the global semantic feature vector and the n-gram phrase feature vector and input them into the fully connected layer to output the historical place name categories in the text to be classified.

[0028] For example, such as Figure 3 The diagram shows the principle of the improved bidirectional encoder-transformer provided in this application. The bidirectional encoder-transformer consists of three parts: SSA branch (Sparse Self-Attention), which uses the ReLU² activation function to sparsify the token relevance scoring matrix and retains only the attention path with high confidence; DSA branch (Dense Self-Attention), which retains the standard Softmax Attention as a semantic compensation path; and adaptive fusion, which introduces learnable parameters a1 and a2 to weight the outputs of the two branches and finally outputs a global semantic feature vector representing the overall text.

[0029] Specifically, the intermediate matrix is ​​input into the sparse self-attention module for feature selection and fusion, including: Step 2-1: Obtain the attention score matrix based on the dot product of the query vector and the key vector.

[0030] Step 2-2: Using ReLU 2 The activation function performs a nonlinear transformation on each element of the attention score matrix to obtain a sparse attention score matrix.

[0031] Steps 2-3: Normalize the sparse attention score matrix using the softmax function to obtain the attention weight matrix; multiply the attention weight matrix with the value vector to obtain the high-confidence sparse association attention weight distribution.

[0032] Specifically, the distribution of globally densely associated attention weights is represented as follows: , in, This represents the distribution of globally densely associated attention weights; This represents a dense self-attention module; Represents the query vector; Represents the key vector; Represents a value vector; Represents the normalization function; Indicates transpose; This represents the dimension of the key vector.

[0033] The high-confidence sparse association attention weight distribution is represented as follows: , , in, This represents the distribution of attention weights for high-confidence sparse associations. Indicates the activation function; Represents the sparse attention score matrix; This represents the attention weight matrix.

[0034] Furthermore, weights are assigned to the globally densely associated attention weight distribution and the high-confidence sparsely associated attention weight distribution, including: Step 3-1: Perform an exponential operation on the first learnable parameter and the second learnable parameter to obtain the first learnable parameter term and the second learnable parameter term.

[0035] Step 3-2: Construct a normalization term based on the sum of the first and second learnable parameter terms.

[0036] Step 3-3: Based on the ratio of the first learnable parameter term to the normalized term, obtain the weights of the global dense association attention weight distribution.

[0037] Steps 3-4: Based on the ratio of the second learnable parameter term to the normalized value, obtain the weights of the high-confidence sparse association attention weight distribution.

[0038] Specifically, the global semantic feature vector is represented as: , in, Represents the global semantic feature vector; This indicates an improved bidirectional encoder-decoder; This represents the distribution of globally densely associated attention weights; Represents the query vector; Represents the key vector; Represents a value vector; This represents the distribution of attention weights for high-confidence sparse associations. express The weights; express The weights; , , in, This represents the first learnable parameter; This represents the second learnable parameter.

[0039] Furthermore, the steps for obtaining a part-of-speech sequence by performing part-of-speech tagging on the text to be classified include: Step 4-1: Use the HanLP word segmenter to perform part-of-speech tagging on each word in the text to be categorized.

[0040] Step 4-2: Convert the part-of-speech tags of each word into low-dimensional vectors to obtain the part-of-speech embedding vectors of each word.

[0041] Step 4-3: Based on the part-of-speech embedding vectors of all words in the text to be classified, obtain the part-of-speech sequence of the text to be classified.

[0042] For example, by outputting the corresponding part of speech (POS) for each word, such as noun (n), verb (v), locative word (f), proper noun (ns), etc., a sequence of parts of speech is obtained.

[0043] Furthermore, in some embodiments of this application, the text convolutional neural network includes multiple convolutional kernels that are parallel and have different window sizes; the step of the text convolutional neural network extracting features from the input concatenated feature vector includes:

[0044] Step 5-1: Use multiple convolution kernels to perform convolution operations on the input concatenated feature vectors to output multiple grammatical phrase features of different lengths.

[0045] Step 5-2: Use pooling to fuse features of multiple grammatical phrases of different lengths to obtain an n-grammatical phrase feature vector.

[0046] In one specific embodiment of this application, the text convolutional neural network includes three convolutional kernels with sizes of 3, 4, and 5, respectively.

[0047] like Figure 4The diagram shows the structure of the historical place name classification model provided in this application. Through an improved bidirectional encoder-transformer (ASSA-BERT) with an adaptive fusion mechanism of sparse and dense attention, it achieves accurate capture of key semantics in historical texts. The deep interaction architecture of part-of-speech features and text features significantly enhances the model's ability to parse the grammatical structure of classical Chinese. Furthermore, an innovative multi-level fusion strategy of global and local features is designed, enabling the model to balance long-distance semantic dependencies with the extraction of features from key local segments. These innovations result in this application significantly outperforming existing technologies in multiple evaluation metrics, including classification accuracy, computational efficiency, and domain adaptability. It not only demonstrates unique advantages in handling complex historical place name classification tasks but also enhances the recognition of complex semantics such as alternative names and temporal expressions. By improving the processing capabilities of ancient texts, it provides reliable technical support and innovative solutions for the digitization of ancient books.

[0048] The above-mentioned historical place name classification method will be further explained and illustrated through several examples below: Example 1 of this application provides a classification process for the historical place name "Jinling": Step 1: Text preprocessing, concatenating the contents of each field according to a uniform format to construct the complete text:

[0049] "Jinling, located in present-day Qingliang Mountain in the city, has a history dating back to the seventh year of King Wei of Chu in the Warring States period (333 BC), and is now known as Nanjing. Regarding the origin of the name Jinling, it is generally believed that Zhongshan Mountain in Nanjing was called Jinling Mountain during the Spring and Autumn Period, hence the name Jinling County comes from Jinling Mountain. There are two other theories: one is the 'buried gold' theory, which states that Nanjing's terrain possessed a strong royal aura, and King Wei of Chu buried gold to suppress it; another theory says that Qin Shi Huang cast a golden figure at Jinlinggang in present-day Xiaguan and buried it there to suppress the aura. The second theory is that it was named after a neighboring place. The Tang Dynasty's *Jiankang Shilu* states: 'Jinling of Chu is now Shitou City. Some say it is adjacent to the mausoleum of Jintan in Huayang, hence the name Jinling.' Related figures include Wang Dao, Qin Shi Huang, Sun Quan, Sun Sheng, the Kaihuang Emperor of Sui, and Du Fuwei. Related events are recorded in the Tang Dynasty's *Yuanhe Junxian Zhi*: 'Shangyuan County, Runzhou, Jiangnan Circuit, was originally Jinling. During the time of Qin Shi Huang, a geomancer said that five hundred years later, Jinling would have the aura of a capital city.'" Therefore, the First Emperor traveled east to quell the rebellion, renaming the area Moling and cutting off the northern mountains (note: often called Fangshan) to suppress its power. When Sun Quan assumed the title, he claimed it was fitting. Sun Sheng believed that the First Emperor's reign, spanning 437 years from the Sun family, was still insufficient in terms of historical records. The Jin dynasty crossed the Yangtze River 526 years later and established its capital there. In the ninth year of the Kaihuang era of the Sui dynasty, after conquering Chen, Jiangzhou was established at Shitou City, with Jiangning County under its jurisdiction. In the third year of the Wude era, Du Fuwei returned to the Han court, and Jiangning County was renamed Guihua County. In the eighth year, Guihua was renamed Jinling County, and in the ninth year, it was renamed Baixia County. During the Five Dynasties period, Yang Wu promoted Shengzhou to Jinling Prefecture, with its seat in Shangyuan County, both within the present-day Nanjing city area. Other information: Wang Dao of the Eastern Jin dynasty referred to Jiankang as "the ancient Jinling." Later generations used Jinling as an alternative name for Nanjing. Remove special characters, spaces, and other invalid symbols. Use a Chinese stop word list to remove stop words from the text, including function words, prepositions, conjunctions, auxiliary words, pronouns, and modal particles.

[0050] The preprocessed text is as follows: "Jinling, located in Qingliang Mountain in the city. Its history dates back to the seventh year of King Wei of Chu in the Warring States period (333 BC), now known as Nanjing. The origin of Jinling is generally believed to be that Zhongshan Mountain in Nanjing was called Jinling Mountain in the Spring and Autumn Period, and the name of Jinling City comes from Jinling Mountain. There are two other theories: the buried gold theory, which is that it is said that the terrain of Nanjing was full of royal aura, and King Wei of Chu buried gold to suppress it; Qin Shi Huang went down to Jinlinggang and cast a golden figure to bury here to suppress it. The adjacent place name theory, the Tang Dynasty's "Jiankang Shilu" says: "Chu Jinling, now Shitoucheng. It is adjacent to Huayang Jintan Mausoleum, hence the name Jinling." Related figures: Wang Dao, Qin Shi Huang, Sun Quan, Sun Sheng, Sui Kaihuang, Du Fuwei. Related event record: Tang Dynasty's "Yuanhe Junxian Zhi" says: "Shangyuan County, Runzhou, Jiangnan Circuit, was originally Jinling. During the time of Qin Shi Huang, a fortune teller said that the aura of Jinling City would appear in 500 years. Qin Shi Huang was disgusted by it when he traveled east, so he changed the name of the place to Moling and cut off the northern mountain (note: often called Fangshan) to stop its momentum." Sun Quan claimed the title was fitting. Sun Sheng believed that the reign of the First Emperor and the Sun family lasted 437 years, which, according to historical records, was still less than that. The Jin dynasty crossed the Yangtze River, and after 526 years, established its capital there. In the ninth year of the Kaihuang era of the Sui dynasty, the Chen dynasty was conquered, and Jiangzhou was established at Stone City, with Jiangning County under its jurisdiction. In the third year of the Wude era, Du Fuwei surrendered, and Jiangning County was renamed Guihua County. In the eighth year, it was renamed Guihua Jinling County, and in the ninth year, it was renamed Baixia County. During the Five Dynasties period, the Yang Wu dynasty elevated it to Shengzhou Jinling Prefecture, with its seat in Shangyuan County, all within the present-day Nanjing city area. Note: Wang Dao of the Eastern Jin dynasty referred to "Jiankang as ancient Jinling." Later generations used Jinling as an alternative name for Nanjing.

[0051] Step 2: Part-of-speech tagging. Use HanLP to perform part-of-speech tagging and extract the part-of-speech sequence. ["ns", "w", "n", "n", "ns", "w", "nz", "n", "nx", "nx", "w", "v", "n", "ns", "w", "n", "v", "t", "nr", "t", "t", "w", "n", "ns", "w", "n", "a","v", "ns", "ns", "t", "v", "ns", "n", "v", "d", "m", "n", "nz", "v", "v", "n", "n", "a", "nr", "v", "n", "v", "r", "nr", "ns", "ns", "v", "n", "v", "r","v", "r", "v", "n", "n", "v", "t", "nw", "v", "ns", "ns", "t", "ns", "n", "v", "ns", "ns", "c", "v", "ns", "w", "vn", "n", "nr", "nr", "nr", "nr", "t","nr", "vn", "n", "v", "t", "nw", "ns", "ns", "ns", "d", "ns", "n", "nr", "t","n", "v", "t", "f", "ns", "n", "n", "nr", "v", "v", "r", "v", "n", "v", "ns","v", "ns", "v", "ns", "v", "ns", "v", "n", "v", "ns", "v", "n", "v", "r", "nr", "v", "nr", "v", "nr", "m", "v", "n", "d", "d", "v", "t", "v", "m", "d","v", "t", "t", "v", "ns", "v", "ns", "ns", "v", "t", "t", "nr", "v", "v", "ns", "ns", "t", "v", "ns", "t", "v", "ns", "t", "v", "ns", "t", "nr", "v", "ns", "ns", "v", "ns", "d", "t", "ns", "n", "n", "t", "nr", "v", "ns", "t", "ns", "n", "ns", "v","ns", "n"].

[0052] Step 3: ASSA-BERT encoding. The preprocessed text is converted into a token vector and input into the improved bidirectional encoder-decoder. The SSA branch retains high-confidence paths such as "Jinling", "Jinling Mountain", and "the aura of the capital"; the DSA branch retains the overall context flow; a1 and a2 are trainable fusion coefficients, and the final output is the CLS semantic representation.

[0053] Step 4: TextCNN processing. After preprocessing, the text is segmented by the Jiaba word segmenter, and unique IDs are assigned to each word and part-of-speech tag to generate embedding vectors.

[0054] Word embedding (Word2Vec) + part-of-speech embedding (random initialization) are used to concatenate the two vectors and input them into TextCNN. Multiple convolutional kernels are used to extract feature fragments such as "Jinling Mountain", "establishment of prefecture", and "capital city".

[0055] Step 5: Feature fusion and classification. Concatenate the TextCNN output and BERT-ASSA output vectors, input them into the Softmax classifier, and output the result as "City Name" with a confidence score of 0.91.

[0056] This application provides a classification process for the historical place name "Zhetang": Step 1: Text preprocessing, concatenating the contents of each field according to a uniform format to construct the complete text: Zhetang is located in the northwest of Lishui County. It borders Yongyang Town and Dongping Town to the east, Shiqiu Town and Yongyang Town to the south (separated by the Yigan River), Lukou Subdistrict of Jiangning District to the west (facing the Lishui River), and Hushu Subdistrict of Jiangning District (formerly Zhougang Town) and Guozhuang Town of Jurong City to the north (reaching the Erqian River). Its history dates back to the seventh year of the Wanli reign of the Ming Dynasty, and it is now called Zhetang Subdistrict. According to the Lishui County Gazetteer of the seventh year of the Wanli reign, Zhetang was an ancient trading center, named after the large Zhetang pond located nearby. Related figures This includes Ye Mingchen, the Governor-General of Guangdong and Guangxi during the Qing Dynasty, and Zheng Qian, the Governor of Jiangsu Province in the early Republic of China. Other information: Zhetang is a natural town, covering an area of ​​71 square kilometers with a population of 29,000. In 1949, Zhetang Township was established, located in the natural town of Zhetang. In 1956, it was changed to Zhetang Commune, reverting to a township in 1983, and then to a town in 1990. Wushan Township merged into it in 1999. It was established as a town in the eighth year of the Guangxu Emperor's reign (1882), and was one of the larger towns in Lishui County, known for its thriving commerce, especially its traditional Chinese medicine industry.

[0057] Remove special characters, spaces, and other invalid symbols. Use a Chinese stop word list to remove stop words from the text, including function words, prepositions, conjunctions, auxiliary words, pronouns, and modal particles. The preprocessed text is as follows: "Zhetang is located in the northwest of Lishui County. It borders Yongyang Town and Dongping Town to the east, is bordered by Shiqiu Town and Yongyang Town to the south, faces Lukou Street of Jiangning District across the Lishui River to the west, and is adjacent to Hushu Street of Jiangning District and Guozhuang Town of Jurong City to the north. Its history dates back to the seventh year of the Wanli reign of the Ming Dynasty, and it is now called Zhetang Street. The reason for the name is recorded in the Lishui County Annals of the seventh year of the Wanli reign of the Ming Dynasty: Zhetang was an ancient commodity exchange place, named after the large pond Zhetang." Related figures include Ye Mingchen, Governor-General of Guangdong and Guangxi during the Qing Dynasty, and Zheng Qian, Governor of Jiangsu Province in the early Republic of China. Information: Zhetang Natural Town covers an area of ​​71 square kilometers and has a population of 29,000. In 1949, the town was established as Zhetang Township, which became Zhetang Commune in 1956. It reverted to a township in 1983, became a town in 1990, and was merged into Wushan Township in 1999. Established as a town in 1882 (the eighth year of the Guangxu Emperor's reign), it was one of the major towns in Lishui County, renowned for its thriving commerce, especially its traditional Chinese medicine industry. Step 2: Part-of-speech tagging. Use HanLP to perform part-of-speech tagging and extract the part-of-speech sequence. ["ns", "w", "n", "n", "ns", "w", "nz", "n", "nx", "nx", "w", "v", "ns", "f", "w", "f", "v", "ns", "ns", "w", "f", "p", "ns", "ns", "ns", "m", "n", "n", "w", "f", "v", "ns", "ns", "ns", "v", "w", "f", "v", "ns", "ns", "ns", "b", "ns", "ns", "ns", "v", "w", "n", "v", "t", "t", "w", "n", "n", "ns", "w", "v", "n", "t", "t", "nw", "v", "ns", "t", "n", "v", "n", "v", "ns","ns", "v", "w", "vn", "n", "t", "ns", "n", "nr", "w", "t", "ns", "n", "nr", "w", "n", "ns", "n", "n", "m", "q", "w", "n", "m", "m", "w", "t", "n", "ns", "n", "v", "ns", "w", "t", "v", "ns", "w", "t", "v", "n", "w", "t", "d", "v", "n", "w", "t", "ns", "v", "w", "t", "t", "t", "w", "v", "n", "w", "ns", "n", "m", "w", "n", "a", "w", "d", "n", "n", "v"].

[0058] Step 3: ASSA-BERT encoding, the preprocessed text is converted into token vectors and input into the improved BERT model: The SSA branch retains high-confidence paths such as "goods", "exchange", and "prosperity"; the DSA branch retains the overall context flow; a1 and a2 are trainable fusion coefficients, and the final output is the CLS semantic representation.

[0059] Step 1: TextCNN processing. After preprocessing, the text is segmented by the Jiaba word segmenter, and unique IDs are assigned to each word and part-of-speech tag to generate embedding vectors. Word embedding (Word2Vec) + part-of-speech embedding (random initialization) are used to concatenate the two vectors and input them into TextCNN. Multiple convolutional kernels are then used to extract feature fragments such as "thriving commerce" and "traditional Chinese medicine industry".

[0060] Step 5: Feature fusion and classification. Concatenate the TextCNN output and BERT-ASSA output vectors, input them into the Softmax classifier, and output the result: "Commercial place name" with a confidence score of 0.85.

[0061] Based on the historical place name classification method provided in the above embodiments, this application also provides a historical place name classification device, such as... Figure 5 As shown, the device specifically includes: The global feature extraction module 10 is used to input the text to be classified into the improved bidirectional encoder-converter and output a global semantic feature vector, which specifically includes: The text processing submodule is used to map and linearly transform the text to be classified, and output query vector, key vector and value vector; it also performs matrix multiplication on the query vector and key vector and outputs an intermediate matrix.

[0062] The attention information acquisition submodule is used to transform the intermediate matrix into the dense self-attention module and output the global dense association attention weight distribution; and to input the intermediate matrix into the sparse self-attention module for feature selection and fusion and output the high-confidence sparse association attention weight distribution.

[0063] The feature acquisition module submodule is used to assign weights to the global dense association attention weight distribution and the high-confidence sparse association attention weight distribution, and then add them element by element to obtain the attention weight matrix; the attention weight matrix is ​​then multiplied by the value vector to output the global semantic feature vector.

[0064] The local feature extraction module 20 is used to perform part-of-speech tagging on the text to be classified to obtain a part-of-speech sequence; the part-of-speech sequence is concatenated with the text to be classified and input into the text convolutional neural network to output an n-gram grammatical phrase feature vector.

[0065] The classification module 30 is used to concatenate the global semantic feature vector and the n-gram grammatical phrase feature vector and input them into the fully connected layer, and output the historical place name categories in the text to be classified.

[0066] This application also provides a computer-readable storage medium storing a computer program that, when executed by a processor, implements the steps of the historical place name classification method described above.

[0067] Those skilled in the art will understand that embodiments of this application can be provided as methods, systems, or computer program products. Therefore, this application can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, this application can take the form of a computer program product embodied on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0068] This application is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of this application. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, generate instructions for implementing the flowchart... Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.

[0069] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.

[0070] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.

[0071] Obviously, the above embodiments are merely illustrative examples for clear explanation and are not intended to limit the implementation. Those skilled in the art will recognize that other variations or modifications can be made based on the above description. It is neither necessary nor possible to exhaustively list all possible implementations here. However, obvious variations or modifications derived therefrom are still within the scope of protection of this invention.

Claims

1. A method for classifying historical place names, characterized in that, include: The text to be classified is input into an improved bidirectional encoder-transformer, which outputs a global semantic feature vector, specifically including: The program performs mapping and linear transformation on the text to be classified, outputting query vector, key vector, and value vector; it also performs matrix multiplication on the query vector and key vector, outputting an intermediate matrix. The intermediate matrix is ​​input into the dense self-attention module for transformation, and the output is a global dense association attention weight distribution; the intermediate matrix is ​​input into the sparse self-attention module for feature selection and fusion, and the output is a high-confidence sparse association attention weight distribution. After assigning weights to the global dense association attention weight distribution and the high-confidence sparse association attention weight distribution, the elements are added together to obtain the attention weight matrix; the attention weight matrix is ​​then multiplied by the value vector to output the global semantic feature vector. The text to be classified is labeled with part-of-speech tags to obtain a part-of-speech sequence; the part-of-speech sequence is concatenated with the text to be classified and input into a text convolutional neural network to output an n-gram grammatical phrase feature vector. The global semantic feature vector and the n-gram phrase feature vector are concatenated and input into a fully connected layer to output the historical place name categories in the text to be classified.

2. The historical place name classification method according to claim 1, characterized in that, The intermediate matrix is ​​input into the sparse self-attention module for feature selection and fusion, including: The attention score matrix is ​​obtained by the dot product of the query vector and the key vector; Using ReLU 2 The activation function performs a non-linear transformation on each element of the attention score matrix to obtain a sparse attention score matrix. The attention weight matrix is ​​obtained by normalizing the sparse attention score matrix using the softmax function; the attention weight matrix is ​​then multiplied by the value vector to obtain the high-confidence sparse correlation attention weight distribution.

3. The historical place name classification method according to claim 1, characterized in that, Assigning weights to the globally densely associated attention weight distribution and the high-confidence sparsely associated attention weight distribution includes: Perform an exponential operation on the first learnable parameter and the second learnable parameter to obtain the first learnable parameter term and the second learnable parameter term; Based on the sum of the first and second learnable parameter terms, a normalization term is constructed; The weights of the global dense association attention weight distribution are obtained based on the ratio of the first learnable parameter term to the normalized term. The weights of the high-confidence sparse association attention weight distribution are obtained based on the ratio of the second learnable parameter term to the normalization.

4. The historical place name classification method according to claim 1, characterized in that, The global dense association attention weight distribution is represented as follows: , in, This represents the distribution of globally densely associated attention weights; This represents a dense self-attention module; Represents the query vector; Represents the key vector; Represents a value vector; Represents the normalization function; Indicates transpose; Indicates the dimension of the key vector; The high-confidence sparse association attention weight distribution is represented as follows: , , in, This represents the distribution of attention weights for high-confidence sparse associations. Indicates the activation function; Represents the sparse attention score matrix; This represents the attention weight matrix.

5. The historical place name classification method according to claim 1, characterized in that, The global semantic feature vector is represented as: , in, Represents the global semantic feature vector; This indicates an improved bidirectional encoder-decoder; This represents the distribution of globally densely associated attention weights; Represents the query vector; Represents the key vector; Represents a value vector; This represents the distribution of attention weights for high-confidence sparse associations. express The weights; express The weights; , , in, This represents the first learnable parameter; This represents the second learnable parameter.

6. The historical place name classification method according to claim 1, characterized in that, The HanLP word segmenter was used to perform part-of-speech tagging on each word in the text to be classified. The part-of-speech tags of each word are converted into low-dimensional vectors to obtain the part-of-speech embedding vectors of each word. Based on the part-of-speech embedding vectors of all words in the text to be classified, the part-of-speech sequence of the text to be classified is obtained.

7. The historical place name classification method according to claim 1, characterized in that, A text convolutional neural network includes multiple convolutional kernels in parallel with different window sizes; the steps for feature extraction from the concatenated feature vector of the input text convolutional neural network include: Multiple convolution kernels are used to perform convolution operations on the input concatenated feature vectors, and multiple grammatical phrase features of different lengths are output. Pooling operations are used to fuse features of multiple grammatical phrases of different lengths to obtain an n-grammatical phrase feature vector.

8. The historical place name classification method according to claim 1, characterized in that, The improved bidirectional encoder preceding the input text to be classified also includes: Add missing fields to the text to be categorized, and remove special characters, spaces, and punctuation marks from the text to be categorized; The text to be classified is concatenated with fields for place name, place name associated events, and place name origin to obtain the preprocessed text to be classified.

9. A historical place name classification device, characterized in that, include: The global feature extraction module is used to input the text to be classified into the improved bidirectional encoder-decoder and output a global semantic feature vector, which specifically includes: The text processing submodule is used to map and linearly transform the text to be classified, and output query vector, key vector and value vector; it also performs matrix multiplication on the query vector and key vector and outputs an intermediate matrix. The attention information acquisition submodule is used to input the intermediate matrix into the dense self-attention module for transformation and output the global dense association attention weight distribution; the intermediate matrix is ​​input into the sparse self-attention module for feature selection and fusion and output the high-confidence sparse association attention weight distribution. The feature acquisition module submodule is used to assign weights to the global dense association attention weight distribution and the high-confidence sparse association attention weight distribution, and then add them element by element to obtain the attention weight matrix; the attention weight matrix is ​​then multiplied with the value vector to output the global semantic feature vector. The local feature extraction module is used to perform part-of-speech tagging on the text to be classified, and obtain a part-of-speech sequence; the part-of-speech sequence is concatenated with the text to be classified and input into the text convolutional neural network, and the output is an n-gram grammatical phrase feature vector; The classification module is used to concatenate the global semantic feature vector and the n-gram grammatical phrase feature vector and input them into the fully connected layer, and output the historical place name categories in the text to be classified.

10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that, when executed by a processor, implements the steps of the historical place name classification method according to any one of claims 1 to 8.

Citation Information

Patent Citations

  • Tourism resource hierarchical multi-label classification method and system

    CN118312833A

  • Chinese semantic parsing method and parser fusing part-of-speech features

    CN119323214A

  • Text classification method, electronic equipment and storage medium

    CN120744127A

  • Unmanned aerial vehicle image small target detection method based on dynamic filtering and adaptive sparse Transform

    CN121010905A

  • Attention-based text classification method and apparatus, and computer-readable medium

    WO2023165102A1