A space gene recognition and extraction method and system based on ancient poetry texts

CN117194608BActive Publication Date: 2026-10-30NANJING SOUTHEAST UNIV URBAN PLANNING & DESIGN INST CO LTD +1
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202311067128.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-08-23
Publication Date
2026-10-30
Estimated Expiration
2043-08-23

AI Technical Summary

Benefits of technology

[0052]通过上述设计方案,本发明可以带来如下有益效果:基于古代诗词文本,能够获取到大量历史真实存在的、内涵多义信息空间感知数据,明确了一种全新的空间基因识别提取数据源;运用文本挖掘技术,提取城市的特征空间要素及其相互关系,形成了一整套系统且科学的空间基因识别提取方法流程,为城市研究者识别城市空间基因提供了一种实用的技术手段。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117194608B_ABST
    Figure CN117194608B_ABST
Patent Text Reader

Abstract

The application discloses a kind of space gene identification extraction method and system based on ancient poetry text, belong to urban planning technical field. Including the following steps: collect the data of ancient poetry text about the city studied, and the data is preprocessed;Using the method of part-of-speech tagging combined with word frequency analysis extracts space-related high-frequency words, adds special place name words and filters, constructs space-related keyword set;In space-related keyword set and the text corpus to be measured, compound word splitting and synonym replacement are carried out;Co-word network is constructed;The community division is carried out to the co-word network, and the space element co-occurrence combination is obtained;The space gene of the city is obtained.The method of the application is based on ancient poetry text, through the historical space perception data with abundant sample size, extracts the characteristic space element of city and its mutual relationship, provides a technical means for city researchers to identify city space gene.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the field of urban planning technology, specifically relating to a method and system for spatial gene identification and extraction based on ancient poetry texts. Background Technology

[0002] Since the beginning of the 21st century, rapid urban expansion has led to numerous problems, such as the homogenization of urban landscapes. The concept of "spatial genes" is of great significance in solving the problem of "thousands of cities looking alike." It emphasizes that only by protecting the stable regional combination patterns among urban spatial elements, rather than by replicating symbols or imitating forms to preserve urban cultural heritage, can a win-win situation be achieved between the preservation of historical heritage and urban development.

[0003] Currently, the identification and extraction of spatial genes typically employs traditional methods such as literature review and questionnaires, relying heavily on the capabilities and experience of planners and designers. Subjective factors have a significant impact, resulting in limited data sample sizes. Ancient Chinese poetry, as one of the most abundant surviving textual materials, contains a wealth of historical spatial information, often including multiple spatial elements and their relationships within a single sentence. With the increasing maturity of text mining technology and the widespread application of big data technology in urban planning, researchers can obtain a large amount of historically authentic, multi-faceted spatial elements and their relationships based on ancient Chinese poetry text data, thereby enabling better identification of spatial genes. Summary of the Invention

[0004] In view of the shortcomings of the prior art, the purpose of this invention is to provide a method and system for spatial gene identification and extraction based on ancient poetry texts, so as to solve the problems mentioned in the background art.

[0005] The objective of this invention can be achieved through the following technical solutions:

[0006] Firstly, a spatial gene recognition and extraction method based on ancient poetry texts is provided, including the following steps:

[0007] The preprocessing step involves receiving ancient Chinese poems and texts about the city under study and preprocessing the ancient Chinese poems and texts to obtain dataset D1.

[0008] The analysis steps involve collecting high-frequency place names and nouns in dataset D1, adding proper place names, filtering the high-frequency place names and nouns in dataset D1, and constructing a spatially related keyword set C1.

[0009] The merging process involves splitting compound words and replacing synonyms in the spatially related keyword set C1 and dataset D1, and merging duplicate words in the spatially related keyword set C1 to obtain the spatially related keyword set C2 and dataset D2.

[0010] The construction steps are as follows: construct a co-occurrence matrix based on the co-occurrence relationship of spatially related keyword set C2 in dataset D2, and construct a co-occurrence network based on the co-occurrence matrix;

[0011] The partitioning step involves dividing the co-word network into communities and obtaining spatial element co-occurrence combinations based on the community partitioning results.

[0012] The extraction step involves extracting lines from the ancient poetry text data that describe space in detail, filtering and interpreting the co-occurrence combinations of spatial elements, and obtaining the spatial genes of the city under study.

[0013] Furthermore, the steps for collecting the ancient poetry text data include:

[0014] Collect and study ancient poems related to the city, as well as poetry collections compiled by local authorities throughout history. Extract the main text of the ancient poems and organize them into structured data by chapter.

[0015] Furthermore, the preprocessing step for the ancient poetry text data includes:

[0016] The ancient poetry text data is deduplicated, invalid characters are filtered out using regular expressions, sentences are segmented, and stop words are removed, while proper place names are retained; wherein, the stop words include commonly used function words and other meaningless words in ancient poetry, and the proper place names are proper place names or names of things based on local history.

[0017] Furthermore, the construction of the spatially related keyword set C1 specifically involves:

[0018] Part-of-speech tagging and word frequency statistics were performed on the preprocessed ancient poetry text data, and place names and nouns with word frequencies greater than the preset word frequency threshold were selected as spatially related high-frequency words.

[0019] After merging and deduplicating high-frequency spatial terms and proper place names, further filtering was performed to obtain the spatially related keyword set C1.

[0020] Furthermore, the aforementioned compound word splitting refers to breaking down the parallel compound words that frequently appear in classical Chinese poetry into two or more words for separate statistical analysis.

[0021] Furthermore, the specific steps for constructing the co-word network are as follows:

[0022] For each text in dataset D2, construct a two-dimensional array formatted_data;

[0023] Construct a two-dimensional matrix matrix with a size of (length of set C2 + 1) × (length of set C2 + 1), and use all spatially related keywords as the first row and first column of the co-occurrence matrix;

[0024] If the row key and column key are the same, then their co-occurrence count is 0, that is, the number of occurrences on the matrix diagonal is 0;

[0025] Iterate through formatted_data, combining the extracted row keywords and column keywords. If a set of keywords co-occurs, increment the corresponding matrix by 1 to obtain the co-occurrence matrix M.

[0026] Remove keywords and their rows and columns whose sum of co-occurrence counts with any other keyword is less than a certain threshold to obtain the co-word matrix M';

[0027] Construct a co-occurrence network based on the keyword co-occurrence matrix M', where nodes are spatially related keywords, edges represent the co-occurrence relationship of keywords, nodes are connected when words co-occur, and the weight of an edge is the number of times it co-occurs.

[0028] Furthermore, the Louvain algorithm is used to perform community partitioning on the co-word network, including the following steps:

[0029] (1) Initialize the community, treating each node as an independent community. The number of communities is the same as the number of nodes, and the weight of the edges within a community is 0.

[0030] (2) Traverse all nodes in the data. For each node i, traverse all its neighboring nodes and calculate the modularity Q and modularity gain ΔQ before and after node i is added to the neighboring nodes. The calculation of Q and ΔQ is as follows:

[0031]

[0032]

[0033] Where m represents the sum of weights of all edges in the network; ∑in represents the sum of weights of edges within community c; ∑tot represents the sum of weights of edges connected to nodes within community c (including edges inside and outside the community); k i It is the sum of the weights of the edges connected to node i; k i,in It is the sum of the number of edges connecting node i to nodes in community c;

[0034] If the maximum modularity gain ΔQmax > 0, then node i is added to the community of the neighboring node with the largest modularity increment; if all ΔQ < 0, then node i remains unchanged.

[0035] (3) Repeat step (2) until the algorithm is stable, that is, the community affiliation of all nodes no longer changes;

[0036] (4) Merge the nodes in each community into a new super node, with the edge weight being the sum of the edge weights of all nodes in the original community, and reconstruct the subgraph;

[0037] (5) Repeat steps (1)-(3) to consolidate the new network until the algorithm is stable. Return the community partitioning results, that is, divide the spatially related keyword set C2 into k groups, denoted as Z1, Z2...Z k Each group is a combination of spatial elements co-occurring.

[0038] Furthermore, the steps for obtaining the spatial genes of the studied city are as follows:

[0039] The original structured text data is broken down into individual lines of poetry, separated by periods, and denoted as dataset D3;

[0040] Dataset D4 is obtained by preprocessing duplicate data in dataset D3, splitting compound words, and replacing synonyms.

[0041] Extract Z from D4 that simultaneously contain n (n≥2) Z. i The sentence containing the words in (i = 1, 2, ..., k) is returned and the corresponding poem in D3 is obtained. The poem is then filtered according to the level of detail of the spatial description to obtain the specific spatial description poem, which corresponds to k sets of co-occurrence combinations of spatial elements.

[0042] By comparing specific descriptive verses about space, the co-occurrence combinations of spatial elements are screened and interpreted. If the specific descriptive verses can reflect stable spatial element combinations, the combination is retained and interpreted; otherwise, the combination is screened and eliminated. Finally, the spatial genes of the city under study are obtained.

[0043] Secondly, a spatial gene recognition and extraction system based on ancient poetry texts is provided, including the following modules:

[0044] The preprocessing module is used to receive ancient poems and texts about the city under study and to preprocess the ancient poems and texts to obtain dataset D1.

[0045] The analysis module is used to collect high-frequency place names and nouns in dataset D1, add proper place names, filter high-frequency place names and nouns in dataset D1, and construct a spatially related keyword set C1;

[0046] The merging module is used to split compound words and replace synonyms in the spatially related keyword set C1 and dataset D1, and to merge duplicate words in the spatially related keyword set C1 to obtain the spatially related keyword set C2 and dataset D2.

[0047] The module is used to construct a co-occurrence matrix based on the co-occurrence relationships of spatially related keyword set C2 in dataset D2, and to construct a co-occurrence network based on the co-occurrence matrix;

[0048] The partitioning module is used to perform community partitioning on the co-word network and obtain spatial element co-occurrence combinations based on the community partitioning results.

[0049] The extraction module is used to extract the verses that describe space in detail from the ancient poetry text data, filter and interpret the co-occurrence combinations of spatial elements, and obtain the spatial genes of the city under study.

[0050] Thirdly, a computing device is provided, comprising:

[0051] One or more processors, memory, and one or more programs, wherein the one or more programs are stored in the memory and configured to be executed by the one or more processors, the one or more programs including instructions for performing any of the methods according to claims 1-8.

[0052] Through the above design scheme, the present invention can bring the following beneficial effects: Based on ancient poetry texts, it can obtain a large amount of historically real spatial perception data with multiple connotations, thus clarifying a brand-new spatial gene identification and extraction data source; by using text mining technology, it can extract the characteristic spatial elements of the city and their interrelationships, forming a complete and scientific method and process for spatial gene identification and extraction, providing urban researchers with a practical technical means to identify urban spatial genes. Attached Figure Description

[0053] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, for those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0054] Figure 1 This is a flowchart of the method in an embodiment of the present invention;

[0055] Figure 2 This is a visualization of the co-word network in an embodiment of the present invention. Detailed Implementation

[0056] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0057] like Figure 1 As shown, this embodiment provides a spatial gene identification and extraction method based on ancient poetry texts, including the following steps:

[0058] Step 1: Receive ancient poems and texts about the city under study, and preprocess the ancient poems and texts to obtain dataset D1;

[0059] The textual data of ancient poems about a certain city were mainly obtained from the collection of ancient poems related to the city and the poetry collections compiled by local authorities throughout history. The main text of the ancient poems was extracted and organized into structured data by chapter.

[0060] The preprocessing operations include data deduplication, filtering invalid characters using regular expressions, sentence segmentation, and removal of stop words, while retaining proper place names; wherein, the stop words include commonly used function words in classical Chinese poetry and other meaningless words, and the proper place names are proper place names or names of objects based on local history.

[0061] Step 2: Analyze dataset D1 using part-of-speech tagging combined with word frequency analysis. Collect high-frequency place names and nouns in dataset D1 and add proper place names. Filter the high-frequency place names and nouns in dataset D1 to construct a spatially related keyword set C1. Specifically, after adding proper place names, merging and deduplicating, filter high-frequency place names and nouns with high spatial relevance to form the spatially related keyword set C1.

[0062] Specifically as follows:

[0063] Step 2.1: Perform part-of-speech tagging and word frequency statistics on the preprocessed corpus, and select place names and nouns with word frequencies greater than the preset word frequency threshold as space-related high-frequency words;

[0064] The term "high-frequency words" refers to words that appear relatively frequently. The frequency threshold for high-frequency words is related to the amount of documents input into the system and should not be set to a fixed value.

[0065] Step 2.2: After merging and deduplicating the spatially related high-frequency words and proper place names, further filtering is performed to obtain the target spatially related keyword set.

[0066] Step 3: Perform compound word splitting and synonym replacement in spatially related keyword set C1 and dataset D1, and merge duplicate words in spatially related keyword set C1 to obtain spatially related keyword set C2 and dataset D2;

[0067] Compound word splitting refers to breaking down the parallel compound words that frequently appear in classical Chinese poetry into two or more words for separate statistical analysis.

[0068] Step 4: Construct a co-occurrence matrix based on the co-occurrence relationships of spatially related keyword set C2 in dataset D2, and construct a co-word network based on the co-occurrence matrix;

[0069] Specifically as follows:

[0070] Step 4.1: Construct a two-dimensional array formatted_data for each text in dataset D2;

[0071] Step 4.2: Create a two-dimensional matrix matrix with a size of (length of set C2 + 1) × (length of set C2 + 1), and use all spatially related keywords as the first row and first column of the co-occurrence matrix;

[0072] Step 4.3: If the row keywords and column keywords are the same, then their co-occurrence count is 0, that is, the number of occurrences on the matrix diagonal is 0;

[0073] Step 4.4: Traverse formatted_data, combine the extracted row keywords and column keywords, and increment the corresponding matrix by 1 if a set of keywords co-occurs, to obtain the co-occurrence matrix M;

[0074] Step 4.5: Remove keywords and their rows and columns whose sum of co-occurrence counts with any other keyword is less than a certain threshold, to obtain the co-occurrence matrix M';

[0075] The threshold setting is related to the amount of documents input into the system and should not be set to a fixed value.

[0076] Step 4.6: Construct a co-occurrence network based on the keyword co-occurrence matrix M', where nodes are spatially related keywords, edges represent the co-occurrence relationship of keywords, nodes are connected when words co-occur, and the weight of the edge is the number of co-occurrences.

[0077] Step 5: Divide the co-occurrence network into communities and obtain spatial element co-occurrence combinations based on the community division results;

[0078] Specifically as follows:

[0079] Step 5.1: Initialize the community. Treat each node as an independent community. The number of communities is the same as the number of nodes. The weight of the edges within a community is 0.

[0080] Step 5.2: Traverse all nodes in the data. For each node i, traverse all its neighboring nodes and calculate the modularity Q and modularity gain ΔQ of node i before and after adding neighboring nodes. Q is given by equations (1) and (2):

[0081]

[0082]

[0083] In the formula, m represents the sum of weights of all edges in the network; ∑in represents the sum of weights of edges within community c; ∑tot represents the sum of weights of edges connected to nodes within community c (including edges inside and outside the community); k iIt is the sum of the weights of the edges connected to node i; k i,in It is the sum of the number of edges connecting node i to nodes in community c;

[0084] If the maximum modularity gain ΔQmax > 0, then node i is added to the community of the neighboring node with the largest modularity increment; if all ΔQ < 0, then node i remains unchanged.

[0085] Step 5.3: Repeat step 5.2 until the algorithm is stable, that is, the community affiliation of all nodes no longer changes;

[0086] Step 5.4: Merge the nodes in each community into a new super node, with the edge weight being the sum of the edge weights of all nodes in the original community, and reconstruct the subgraph;

[0087] Step 5.5: Repeat steps 5.1-5.3 to consolidate the new network until the algorithm is stable. Return the community partitioning results, that is, divide the spatially related keyword set C2 into k groups, denoted as Z1, Z2...Z k Each group is a combination of spatial elements co-occurring.

[0088] Step 6: Extract the verses that describe space in detail from the ancient poetry text data, filter and interpret the co-occurrence combinations of spatial elements, and obtain the spatial genes of the city under study;

[0089] Specifically as follows:

[0090] Step 6.1: Decompose the original structured text data into individual lines of poetry using periods as separators, and denote this as dataset D3;

[0091] Step 6.2: Perform preprocessing, compound word splitting, and synonym replacement on the duplicate data in dataset D3 to obtain dataset D4;

[0092] Step 6.3: Extract Z elements containing n (n≥2) elements from D4. i The sentence containing the words in (i = 1, 2, ..., k) is returned and the corresponding poem in D3 is obtained. The poem is then filtered according to the level of detail of the spatial description to obtain the specific spatial description poem, which corresponds to k sets of co-occurrence combinations of spatial elements.

[0093] The level of detail in the spatial description is initially determined by sentences containing n (n≥2) words from Zi (i=1,2……k), and then filtered based on the specific content. The value of n is related to the amount of documents input by the system and should not be set to a fixed value.

[0094] Step 6.4: Screen and interpret the co-occurrence combinations of spatial elements against the specific spatial description verses. If the specific description verses can reflect a stable spatial element combination relationship, this group is retained and interpreted; otherwise, this group is screened out, and the spatial genes of the city are finally sorted out.

[0095] For a clearer understanding of the technical features, purposes and effects of the present invention, the ancient poetry text of a certain city is taken as an example now.

[0096] 1. Collect ancient poetry text data about a certain city, and preprocess the data to obtain the data set D1.

[0097] In this embodiment, the ancient poetry text data of a certain city mainly comes from the Internet and poetry collections compiled and included by local authorities of the city in past dynasties. The main content of the ancient poetry is extracted and organized into structured data by chapters.

[0098] The preprocessing operations on the ancient poetry text data include data deduplication, filtering invalid characters through regular expressions, sentence word segmentation and stop word removal, while retaining proper place names; wherein the invalid characters are mainly punctuation marks; Python 3.7 software and the jieba library are used for word segmentation, stop word removal and proper place name retention, the stop words include common function words and other meaningless words in ancient poetry, such as "er", "he", "hu", "nai", "yan", etc., the proper place names are proper place names or object names based on local history. For this embodiment, the added proper place names include words such as "Xiagu Cheng", "Fuyu Pagoda", "Yue River", "White Duckweed Island", etc. The processed data set D1 (partial examples) is shown in Table 1.

[0099] Table 1

[0100]

[0101]

[0102] 2. Analyze the data set D1 by adopting the method of part-of-speech tagging combined with word frequency analysis, count high-frequency place names and nouns, add proper place names, screen and construct a space-related keyword set, denoted as C1;

[0103] In this embodiment, the posseg module of the jieba library is used to perform part-of-speech tagging on the data set D1, the word frequency of words tagged as 'nt' and 'n' is counted, and the high-frequency word threshold is set to be greater than or equal to 3.

[0104] After merging the proper place names and deduplicating, further screening is carried out to remove words with low spatial correlation, and the obtained space-related keywords C1 include words such as "Huzhou", "stream", "mountain", "Wucheng", "water", "willow", "landscape", "Tiao", "Crystal Palace", etc.

[0105] 3. Perform compound word splitting and synonym replacement on the spatially related keyword set C1 and dataset D1, and merge the duplicate words in C1 to obtain the spatially related keyword set C2 and dataset D2;

[0106] In this embodiment, the compound word splitting and synonym replacement are shown in Tables 2 and 3, and the resulting C2 contains a total of 94 words.

[0107] Table 2

[0108]

[0109]

[0110] Table 3

[0111]

[0112] 4. Construct a co-occurrence matrix M based on the co-occurrence relationships of C2 in dataset D2, and construct a co-occurrence network based on the co-occurrence matrix M;

[0113] In this embodiment, a two-dimensional array formatted_data is constructed for each text in dataset D2;

[0114] Create a two-dimensional matrix matrix of size 95×95. Use all spatially related keywords as the first row and first column of the co-occurrence matrix. Set the diagonal of the matrix to 0. Iterate through formatted_data and combine the extracted row keywords with the extracted column keywords. If a group of keywords co-occurs, increment the corresponding matrix by 1 to obtain the co-occurrence matrix M. Remove keywords and their rows and columns whose sum of co-occurrence counts with any other keyword is less than 3 to obtain the co-occurrence matrix M', as shown in Table 4.

[0115] A co-occurrence network is constructed based on the co-occurrence matrix M', where nodes are spatially related keywords, edges represent the co-occurrence relationships of keywords, nodes are connected when words co-occur, and the weight of an edge is the number of times it co-occurs. The co-occurrence network is visualized as follows: Figure 2 As shown.

[0116] Table 4

[0117]

[0118] 5. The Louvain algorithm is used to divide the co-word network into communities. Based on the community division results, the co-occurrence combination of spatial elements is obtained. The community division results of this example are shown in Table 5.

[0119] Table 5

[0120]

[0121]

[0122] 6. Extract the poetic lines that describe the space in detail, screen and interpret the co-occurrence combinations of spatial elements, and obtain the spatial genes of the city.

[0123] The original structured text data is decomposed into individual lines of poetry using periods as separators, and denoted as dataset D3. The processed dataset D3 (partial examples) is shown in Table 6.

[0124] Table 6

[0125]

[0126]

[0127] Dataset D4 is obtained by preprocessing duplicate data, splitting compound words, and replacing synonyms in dataset D3. Sentences containing words from two cluster groups 1-5 are extracted from D4 and the corresponding poems from D3 are returned. The poems are then filtered according to the level of detail in the spatial description to obtain detailed descriptions of the co-occurrence combinations of the five spatial elements. The co-occurrence combinations of spatial elements are then filtered or interpreted by comparing them with the specific spatial description poems to obtain the spatial genes of the city.

[0128] Taking group 1 in this example as an example, the corresponding spatial description of the poem (partial examples) and spatial gene extraction are shown in Table 7:

[0129] Table 7

[0130]

[0131]

[0132] Another embodiment of the present invention provides a spatial gene identification and extraction system based on ancient poetry texts, comprising the following modules:

[0133] The preprocessing module is used to receive ancient poems and texts about the city under study and to preprocess the ancient poems and texts to obtain dataset D1.

[0134] The analysis module is used to collect high-frequency place names and nouns in dataset D1, add proper place names, filter high-frequency place names and nouns in dataset D1, and construct a spatially related keyword set C1;

[0135] The merging module is used to split compound words and replace synonyms in the spatially related keyword set C1 and dataset D1, and to merge duplicate words in the spatially related keyword set C1 to obtain the spatially related keyword set C2 and dataset D2.

[0136] The module is used to construct a co-occurrence matrix based on the co-occurrence relationships of spatially related keyword set C2 in dataset D2, and to construct a co-occurrence network based on the co-occurrence matrix;

[0137] The partitioning module is used to perform community partitioning on the co-word network and obtain spatial element co-occurrence combinations based on the community partitioning results.

[0138] The extraction module is used to extract lines from the ancient poetry text data that describe space in detail, filter and interpret the co-occurrence combinations of spatial elements, and obtain the spatial genes of the city under study.

[0139] In the description of this specification, the references to terms such as "an embodiment," "example," "specific example," and "embodiment" refer to a specific feature, structure, material, or characteristic described in connection with that embodiment or example, which is included in at least one embodiment or example of the invention. In this specification, the illustrative expressions of the above terms do not necessarily refer to the same embodiment or example. Furthermore, the specific features, structures, materials, or characteristics described may be combined in any suitable manner in one or more embodiments or examples.

[0140] 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.

[0141] 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.

[0142] 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 1One or more processes and / or boxes Figure 1 The function specified in one or more boxes.

[0143] 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.

[0144] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention and not to limit it. Although the present invention has been described in detail with reference to the above embodiments, those skilled in the art should understand that modifications or equivalent substitutions can still be made to the specific implementation of the present invention. Any modifications or equivalent substitutions that do not depart from the spirit and scope of the present invention should be covered within the scope of protection of the claims of the present invention.

Claims

1. A method for spatial gene identification and extraction based on ancient poetry texts, characterized in that, Includes the following steps: Receive ancient poems and texts about the city under study, and preprocess the ancient poems and texts to obtain dataset D1; Part-of-speech tagging and word frequency statistics are performed on the preprocessed ancient poetry text data. Place names and nouns with word frequencies greater than the preset word frequency threshold are selected as spatially related high-frequency words. After merging spatially related high-frequency words with proper place names to remove duplicates, further screening is performed to remove words with little spatial relevance, resulting in a spatially related keyword set C1. Compound words are split and synonyms are replaced in spatially related keyword set C1 and dataset D1. Duplicate words in spatially related keyword set C1 are merged to obtain spatially related keyword set C2 and dataset D2. Construct a co-occurrence matrix based on the co-occurrence relationships of spatially related keyword set C2 in dataset D2, and then construct a co-word network based on the co-occurrence matrix; The Louvain algorithm is used to perform community partitioning on the co-word network, and multiple sets of spatially related keywords Z are obtained based on the community partitioning results. i (i=1, 2...k) and the corresponding spatial elements co-occurrence combinations; Extract lines from the ancient poems that describe space in detail, screen and interpret the co-occurrence combinations of spatial elements, and obtain the spatial genes of the city under study; The steps for obtaining the spatial genes of the studied city are as follows: The ancient Chinese poetry text data is broken down into individual lines of poetry, separated by periods, and denoted as the dataset. ; For dataset Data preprocessing, compound word splitting, and synonym replacement were performed to obtain the dataset. ; exist Extract Z that simultaneously contain n (n≥2) Z i Find the sentences containing the words in (i=1, 2, ..., k) and return them. The corresponding verses; Based on the level of detail in the spatial description, specific poetic lines describing the space are obtained, each corresponding to k sets of co-occurrence combinations of spatial elements. By comparing specific spatial descriptive verses, the co-occurrence combinations of spatial elements are screened and interpreted. If the specific spatial descriptive verses can reflect stable spatial element combination relationships, then the co-occurrence combinations of spatial elements are retained and interpreted. Otherwise, the co-occurrence combinations of spatial elements are screened and eliminated. Finally, the spatial genes of the city under study are obtained. The specific steps for constructing the co-word network are as follows: For each text in dataset D2, construct a two-dimensional array formatted_data; Construct a two-dimensional matrix matrix with a size of (length of set C2 + 1) × (length of set C2 + 1), and use all spatially related keywords as the first row and first column of the co-occurrence matrix; If the row key and column key are the same, then their co-occurrence count is 0, that is, the number of occurrences on the matrix diagonal is 0; Iterate through formatted_data, combining the extracted row keywords and column keywords. If a set of keywords co-occurs, increment the corresponding matrix by 1 to obtain the co-occurrence matrix M. Remove keywords and their rows and columns whose sum of co-occurrence counts with any other keyword is less than a certain threshold to obtain the co-word matrix M'; Construct a co-occurrence network based on the keyword co-occurrence matrix M', where nodes are spatially related keywords, edges represent the co-occurrence relationship of keywords, nodes are connected when words co-occur, and the weight of an edge is the number of times it co-occurs.

2. The spatial gene identification and extraction method based on ancient poetry texts according to claim 1, characterized in that, The steps for collecting the ancient poetry text data include: We collect and study ancient poems related to the city, as well as poetry collections compiled by local authorities throughout history. We extract the main text of the ancient poems and organize them into structured data by chapter.

3. The spatial gene identification and extraction method based on ancient poetry texts according to claim 1, characterized in that, The steps for preprocessing the ancient poetry text data include: The ancient poetry text data is deduplicated, invalid characters are filtered out using regular expressions, sentences are segmented, and stop words are removed, while proper place names are retained; wherein, the stop words include commonly used function words and other meaningless words in ancient poetry, and the proper place names are proper place names or names of things based on local history.

4. The spatial gene identification and extraction method based on ancient poetry texts according to claim 1, characterized in that, The term "compound word splitting" refers to breaking down parallel compound words in classical Chinese poetry into two or more separate words for statistical analysis.

5. The spatial gene identification and extraction method based on ancient poetry texts according to claim 1, characterized in that, The Louvain algorithm is used to perform community partitioning on the co-word network, which includes the following steps: (1) Initialize the community, treating each node as an independent community. The number of communities is the same as the number of nodes, and the weight of the edges within a community is 0. (2) Traverse all nodes in the data. For each node i, traverse all its neighboring nodes and calculate the modularity of node i before and after adding neighboring nodes. and modularity gain , and The calculation is as follows: In the formula, This represents the sum of the weights of all edges in the network; Indicates community The sum of the weights of the internal edges; Indicates association with the community The sum of the edge weights of the internal nodes, which is associated with the community. The edges of internal nodes include those inside and outside the community; It is associated with the node The sum of the weights of the edges; It is a node Connect to the community The sum of the edge weights of the nodes in the array; (3) Repeat step (2) until the algorithm is stable, that is, the community affiliation of all nodes no longer changes; (4) Merge the nodes in each community into a new super node, with the edge weight being the sum of the edge weights of all nodes in the original community, and reconstruct the subgraph; (5) Repeat steps (1)-(3) to consolidate the new network until the algorithm is stable. Return the community partitioning results, that is, divide the spatially related keyword set C2 into k groups, denoted as Z1, Z2...Z k Each group is a combination of spatial elements co-occurring.

6. A system for performing the spatial gene identification and extraction method based on ancient poetry texts as described in any one of claims 1-5, characterized in that, Includes the following modules: The preprocessing module is used to receive ancient poems and texts about the city under study and to preprocess the ancient poems and texts to obtain dataset D1. The analysis module is used to collect high-frequency place names and nouns in dataset D1, add proper place names, filter high-frequency place names and nouns in dataset D1, and construct a spatially related keyword set C1; The merging module is used to split compound words and replace synonyms in the spatially related keyword set C1 and dataset D1, and to merge duplicate words in the spatially related keyword set C1 to obtain the spatially related keyword set C2 and dataset D2. The module is used to construct a co-occurrence matrix based on the co-occurrence relationships of spatially related keyword set C2 in dataset D2, and to construct a co-occurrence network based on the co-occurrence matrix; The partitioning module is used to perform community partitioning on the co-word network and obtain spatial element co-occurrence combinations based on the community partitioning results. The extraction module is used to extract the verses that describe space in detail from the ancient poetry text data, filter and interpret the co-occurrence combinations of spatial elements, and obtain the spatial genes of the city under study.

7. A computing device, characterized in that, include: One or more processors, a memory, and one or more programs, wherein the one or more programs are stored in the memory and configured to be executed by the one or more processors, the one or more programs including instructions for performing any of the methods according to claims 1-5.

Citation Information

Patent Citations

  • Community discovery method based on Louvain algorithm, computer equipment and readable storage medium thereof

    CN111028092A

  • Space gene recognition and extraction method based on social media text data

    CN116414985A