Chinese address element parsing method, device and storage medium based on vocabulary enhancement
By constructing floor plans to integrate character and vocabulary information, using deep learning methods and improved relative position coding, the accuracy problem of Chinese address element analysis is solved, and higher address resolution accuracy and false address recognition capabilities are achieved.
Patent Information
- Application Number
- CN202210339889.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-04-01
- Publication Date
- 2025-09-02
- Estimated Expiration
- 2042-04-01
AI Technical Summary
The existing Chinese address element analysis technology has low accuracy and cannot effectively utilize the character information and vocabulary information of the address text, resulting in inaccurate analysis results.
By constructing floor plans, integrating embedded representations of characters and vocabulary, features are extracted using deep learning methods, combined with BERT model and dictionary tree, semantic information and boundary information of address elements are enhanced, and feature extraction and classification are adopted using improved relative position coding and self-attention mechanisms.
It improves the accuracy of Chinese address feature resolution, reduces the error rate of address feature resolution, and can identify false addresses, improving the overall accuracy of address resolution.
Smart Images

Figure CN114792091B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of data processing technology, and in particular to a Chinese address element parsing method, device and storage medium based on vocabulary enhancement. Background Art
[0002] Addresses, as an important form of textual data, record the geographic spatial information corresponding to social production activities and human behavior, and have important application value in fields such as geographic business intelligence, urban governance, and financial risk control. With the rapid development of the internet, big data, and geographic information systems, public demand for location information is rapidly increasing. Using computers to quickly and accurately parse addresses has become a hot topic.
[0003] Chinese address element parsing involves breaking down Chinese address text into semantically distinct address element entities and assigning these entities to corresponding categories. China, with its vast territory and diverse geography and cultures, lacks an authoritative, nationwide standard for naming locations. Furthermore, in everyday applications, Chinese addresses are mostly expressed in the form of unstructured text, resulting in complex and arbitrary data structures and often accompanied by issues such as missing or redundant address elements. Consequently, current address element parsing technologies for Chinese text often suffer from low accuracy, making them unsuitable for practical application. Summary of the Invention
[0004] Based on the problem of low accuracy in parsing Chinese address elements, the present invention provides a Chinese address element parsing method, device and storage medium, which can effectively improve the accuracy of Chinese address element parsing.
[0005] In a first aspect, an embodiment of the present invention provides a method for parsing Chinese address elements, comprising:
[0006] Get the Chinese address text to be parsed;
[0007] Determine each character in the Chinese address text and its corresponding embedded representation;
[0008] Determining each word in the Chinese address text and its corresponding embedding representation;
[0009] All determined characters and words are treated as tokens, and a planar graph is constructed based on the embedding representation of each token, the position of the token in the Chinese address text, and the relationship between tokens. The planar graph, composed of the embedding representation of the token itself and the head and tail position information of the token in the sentence, is used to provide semantic information and boundary information of the words.
[0010] Determine the final relative position code between each two tokens based on the head and tail position information of the tokens in the sentence in the plane graph;
[0011] Based on the determined embedding representation and the final relative position encoding, feature extraction is performed through deep learning;
[0012] Classification is performed based on the extracted features to obtain the parsed address elements.
[0013] Optionally, determining each word in the Chinese address text and its corresponding embedded representation includes:
[0014] Determine a dictionary corresponding to the Chinese address text;
[0015] Based on the dictionary, a dictionary tree is established;
[0016] Matching the Chinese address text based on the dictionary tree to obtain each word in the Chinese address text;
[0017] Based on the embedding representation resource library corresponding to the dictionary, the embedding representation of each word in the Chinese address text is obtained.
[0018] Optionally, the planar graph includes a first planar graph and a second planar graph, wherein the first planar graph is a planar lattice structure for representing the association relationship between characters and self-matching words, and the second planar graph is a planar transfer structure for representing the association relationship between characters and nearest context words;
[0019] The method of determining the final relative position encoding between each two tokens based on the head and tail position information of the tokens in the sentence in the planar graph includes: performing the following steps for each two tokens:
[0020] Calculating relative position codes between two tokens based on the first planar graph and the second planar graph respectively;
[0021] The relative position codes calculated based on the first planar graph and the second planar graph are concatenated and subjected to linear transformation by a neural network to obtain the final relative position code between the two tokens.
[0022] Optionally, calculating the relative position encoding between two tokens includes:
[0023] Determine the corresponding head and tail position information of the two tokens in the sentence, including the head position and the tail position;
[0024] Determine the four relative distances between two tokens: head-to-head, head-to-tail, tail-to-head, and tail-to-tail;
[0025] If there is a containment relationship between two tokens, the four relative distances determined are reduced simultaneously;
[0026] Perform nonlinear transformation on the four relative distances to obtain relative position encoding.
[0027] Optionally, the simultaneously reducing the four determined relative distances includes:
[0028] Multiply the four relative distances determined by e at the same time w , perform exponential reduction; where w is the product of the head-to-head and tail-to-tail distances between two tokens.
[0029] Optionally, determining the corresponding head and tail position information of the two tokens in the sentence includes:
[0030] If the token is a character, its head position and tail position are the same, which are the position of the character in the sentence;
[0031] If the token is a word, for the first plane graph, its head position and tail position are the positions of the start and end characters of the word in the sentence respectively; for the second plane graph, its head position and tail position are the positions of the preceding and following adjacent characters of the word in the sentence respectively, and do not exceed the scope of the sentence.
[0032] Optionally, determining each character in the Chinese address text and its corresponding embedded representation includes:
[0033] The Chinese address text is input into a pre-trained BERT model to determine each character in the Chinese address text and its corresponding embedded representation.
[0034] In a second aspect, an embodiment of the present invention further provides a method for identifying a false address, comprising:
[0035] Performing address element parsing based on the Chinese address element parsing method based on vocabulary enhancement as described in any one of the above;
[0036] Perform hierarchical determination on the address elements. If there are address entities of the same level with different names, it is identified as a false address. Otherwise, proceed to the next step.
[0037] Match the address elements with the five-level address database to obtain the corresponding address codes. Verify whether the address codes corresponding to the higher-level address elements are correctly correlated with the address codes corresponding to the lower-level address elements. If so, proceed to the next step. Otherwise, identify it as a false address.
[0038] A first address and a second address are divided according to address elements, a geographic fence is determined based on the first address, and longitude and latitude coordinates are determined based on the second address. It is checked whether the positional relationship between the geographic fence and the longitude and latitude coordinates is incorrect. If so, it is identified as a false address, otherwise it is identified as a real address; wherein, the first address includes provincial, municipal and district address elements, and the second address includes all lower-level address elements except provincial, municipal and district levels.
[0039] In a third aspect, an embodiment of the present invention further provides a device including a memory and a processor, wherein the memory stores a computer program, and when the processor executes the computer program, the method described in any embodiment of this specification is implemented.
[0040] In a fourth aspect, an embodiment of the present invention further provides a computer-readable storage medium having a computer program stored thereon, which, when executed in a computer, enables the computer to execute the method described in any embodiment of this specification.
[0041] The embodiments of the present invention provide a Chinese address element parsing method, device and storage medium based on vocabulary enhancement. The present invention integrates vocabulary information into the Chinese address element parsing process, integrates the semantic information and boundary information of the vocabulary, effectively enhances the semantic information of the characters, and improves the final Chinese address element parsing accuracy.
[0042] An embodiment of the present invention also provides a method, device and storage medium for identifying false addresses. The present invention performs multiple rounds of analysis and judgment based on the parsed address elements, and ultimately determines whether the input address is a false address, which can effectively identify false addresses in Chinese address texts. BRIEF DESCRIPTION OF THE DRAWINGS
[0043] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0044] Figure 1 This is a flow chart of a Chinese address element parsing method provided by one embodiment of the present invention;
[0045] Figure 2 This is a flow chart of a false address identification method provided by one embodiment of the present invention. Specific embodiments
[0046] In order to make the purpose, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present invention.
[0047] As mentioned earlier, addresses, as an important form of textual data, record the geospatial information corresponding to social production activities and human behavior, and have significant application value in fields such as geographic business intelligence, urban governance, and financial risk management. With the rapid development of the internet, big data, and geographic information systems, public demand for location information has rapidly increased, and the ability to quickly and accurately parse addresses using computers has become a hot topic. Chinese address element parsing involves breaking down Chinese address text into semantically distinct address element entities and assigning these entities to corresponding categories. The results of Chinese address element parsing directly impact the accuracy of spatial positioning technologies such as geocoding.
[0048] However, China's vast territory and diverse geography and cultures have yet to establish an authoritative, nationwide standard for naming locations. Furthermore, in everyday applications, Chinese addresses are often expressed as unstructured text, resulting in complex and arbitrary data structures and often accompanied by issues such as missing or redundant address elements. Currently, address element parsing technologies for Chinese text often suffer from low accuracy, making them unsuitable for practical application.
[0049] Research in the field of Chinese address element parsing can be broadly summarized into three areas: dictionary matching, machine learning, and deep learning. Among them, deep learning-based Chinese address element parsing methods, due to their deep network structure, can extract deeper text features, significantly improving parsing efficiency and computational performance, and have gradually become the mainstream approach in this field. However, existing deep learning methods still process characters as the basic unit and fail to fully integrate the character and lexical information of address text. Incorporating lexical information can enhance the semantic information of characters and improve the final classification accuracy. In view of this, the present invention proposes a Chinese address element parsing technology based on lexical enhancement.
[0050] The specific implementation of the above concept is described below.
[0051] Please refer to Figure 1 , an embodiment of the present invention provides a Chinese address element parsing method based on vocabulary enhancement, the method comprising:
[0052] Step 100: Obtain the Chinese address text to be parsed;
[0053] Step 102, determining each character in the Chinese address text and its corresponding embedding;
[0054] Step 104, determining each word in the Chinese address text and its corresponding embedding;
[0055] Step 106: Tokens are used for all characters determined in step 102 and all words determined in step 104, where each token represents one character or one word. A flat graph is constructed based on the embedded representation of each token, the position of each token in the Chinese address text, and the relationships between tokens. The flat graph is composed of the embedded representation of each token and the head and tail position information of each token in the sentence, and is used to provide semantic information and boundary information of the words.
[0056] Step 108: determining the final relative position code between every two tokens based on the corresponding head and tail position information of the tokens in the sentence in the constructed plane diagram;
[0057] Step 110: performing feature extraction through deep learning based on the embedding representation corresponding to each token determined in steps 102 and 104, and the final relative position encoding between every two tokens determined in step 108;
[0058] Step 112: Classify based on the extracted features to obtain parsed address elements.
[0059] In order to fully utilize vocabulary information to enhance the character sequence of Chinese address text and eliminate potential address entity ambiguity in the context, the above embodiment of the present invention constructs a plan view and utilizes the semantic information and boundary information of the vocabulary in the address text to effectively enhance the semantics of specific characters, thereby reducing the error rate of address element parsing.
[0060] Described below Figure 1 How to perform the steps shown.
[0061] For step 100, the Chinese address text to be parsed is obtained. A single Chinese address or multiple Chinese addresses can be obtained at a time, and the address elements of each Chinese address can be parsed separately. However, the data belonging to the same address should be in the same sentence to avoid ambiguity caused by punctuation errors.
[0062] With respect to step 102, determining each character in the Chinese address text and its corresponding embedded representation further includes:
[0063] The Chinese address text is input into a pre-trained BERT model to determine each character in the Chinese address text and its corresponding embedded representation.
[0064] The present invention parses the original address text into address element entities, which include provincial, municipal and district entities. In order to more accurately identify address elements in the deep learning process, it is necessary to use richer semantic features to express the characters in the address text, that is, it is necessary to obtain the embedded representation (or distributed embedded vector) corresponding to the characters. The above embodiment uses an advanced large-scale pre-trained BERT model to implement this process. Traditional language models, such as word2vec, GPT, etc., can only perform one-way predictions and are prone to misinterpretation of semantics. The BERT model uses a bidirectional Transformer as an encoder to pre-train a deep bidirectional representation of address text characters, thereby making full use of the information on both the front and back sides to obtain a better distributed representation, which helps to correctly identify the address level.
[0065] With respect to step 104, determining each word in the Chinese address text and its corresponding embedded representation further includes:
[0066] Determine a dictionary corresponding to the Chinese address text;
[0067] Based on the dictionary, a dictionary tree is established;
[0068] Matching the Chinese address text based on the dictionary tree to obtain each word in the Chinese address text;
[0069] Based on the embedding representation library corresponding to the dictionary, the embedding representation of each word in the Chinese address text is obtained.
[0070] In the above embodiment, the vocabulary contained in each address text is obtained by querying the dictionary trie. A dictionary trie is a tree-like structure widely used for counting and sorting large numbers of strings. Its advantage is that it minimizes unnecessary string comparisons and is highly efficient. From the public dictionary embedding representation repository, you can select the repository ctb.50d.vec to obtain the embedding representations corresponding to each vocabulary word. Each word has an embedding representation of 50 dimensions. These embeddings are also trained on a large-scale model and have excellent representational capabilities.
[0071] A flat-graph is a directed acyclic graph. Optionally, the flat-graph includes a first flat-graph and a second flat-graph. Among them, the first flat-graph is a flat-lattice structure, which is used to represent the association relationship between characters and self-matching vocabulary, so as to provide semantic information and boundary information of the self-matching vocabulary. The second flat-graph is a flat-shift structure, which is used to represent the association relationship between characters and the nearest context vocabulary, so as to provide semantic information and boundary information of the nearest context vocabulary;
[0072] Correspondingly, for step 108, based on the head and tail position information corresponding to the tokens in the sentence in the flat-graph, determining the final relative position encoding between every two tokens further includes: for every two tokens, the following steps are performed:
[0073] Based on the first flat-graph and the second flat-graph respectively, calculate the relative position encoding between the two tokens;
[0074] Concatenate the relative position encodings calculated based on the first flat-graph and the second flat-graph respectively, and after linear transformation by a neural network, obtain the final relative position encoding between the two tokens.
[0075] In the above embodiments of the present invention, the collaborative and complementary first flat-graph and second flat-graph are adopted, and the self-matching vocabulary (i.e., the vocabulary containing the current character) and the nearest context vocabulary (i.e., the vocabulary closest to the current character but not containing the current character) in the address text are used to enhance specific characters, so as to make full use of the semantic information and boundary information of the vocabulary.
[0076] The prior art usually does not consider the influence of the nearest context vocabulary on eliminating ambiguity. Taking the address text "Changyi Shanghai Road" as an example, for the character "Shang", the addition of the self-matching vocabulary "Shanghai Road" and the nearest context vocabulary "Changyi" (as a municipal entity, there should not be another municipal entity following it) will prevent the "Shanghai" in this text from being misrecognized as a municipal entity (city), but as a part of "Shanghai Road", it is marked as a road name entity (road). In the above embodiments of the present invention, through the independent first flat-graph and second flat-graph, the relative position encodings that enhance the semantic association of the corresponding characters by including the self-matching vocabulary and the nearest context vocabulary are obtained respectively, and then concatenated and linearly transformed to achieve fusion, that is, integrate the two types of vocabulary information, improve the enhancement effect of the vocabulary information on the characters, and at the same time effectively solve the problem that the traditional graph structure (i.e., Flat-Lattice) can only effectively enhance the word-ending characters when performing vocabulary enhancement.
[0077] Suppose and Respectively represent the relative position encoding between two tokens (token i and token j) calculated based on the first plane graph and the second plane graph, and The fusion process expression is as follows:
[0078]
[0079] Among them, W t Is a learnable parameter matrix, which performs matrix multiplication with the vector concatenated in brackets. Represents the vector concatenation operation, Encodes the final relative position between two tokens.
[0080] Furthermore, with respect to step 108, calculating the relative position code between two tokens based on the first planar graph includes the following steps:
[0081] Based on the first plane graph, determining the corresponding head and tail position information of the two tokens in the sentence, including the head position (head) and the tail position (tail);
[0082] Determine the four relative distances between two tokens: head-to-head, head-to-tail, tail-to-head, and tail-to-tail;
[0083] If there is a containment relationship between the two tokens, the four determined relative distances are reduced simultaneously. If there is no containment relationship between the two tokens, the four determined relative distances are kept unchanged and the next step is performed.
[0084] Perform nonlinear transformation on the four relative distances obtained to obtain relative position encoding.
[0085] With respect to step 108, based on the second planar graph, calculating the relative position code between the two tokens includes the following steps:
[0086] Based on the second plane graph, determining the corresponding head and tail position information of the two tokens in the sentence, including the head position and the tail position;
[0087] Determine the four relative distances between two tokens: head-to-head, head-to-tail, tail-to-head, and tail-to-tail;
[0088] If there is a containment relationship between the two tokens, the four determined relative distances are reduced simultaneously. If there is no containment relationship between the two tokens, the four determined relative distances are kept unchanged and the next step is performed.
[0089] Perform nonlinear transformation on the four relative distances obtained to obtain relative position encoding.
[0090] Preferably, the simultaneously reducing the four determined relative distances includes:
[0091] Multiply the four relative distances determined by e at the same time w , perform exponential reduction; where w is the product of the head-to-head and tail-to-tail distances between two tokens.
[0092] In the above embodiment, for two tokens, token i and token j, among the four relative distances, the head-to-head relative distance, i.e., the distance between the head position of token i and the head position of token j, is expressed as The relative distance between the head and tail of token i is the distance between the head position of token i and the tail position of token j, which is recorded as The tail-head relative distance is the distance between the tail position of token i and the head position of token j, which is recorded as The tail-to-tail relative distance is the distance between the tail position of token i and the tail position of token j, which is recorded as With head[i] and head[j] representing the head position of token i and token j respectively, and tail[i] and tail[j] representing the tail position of token i and token j respectively, the expression for calculating the relative position encoding between two tokens in step 108 is:
[0093]
[0094]
[0095]
[0096]
[0097]
[0098]
[0099] When using traditional relative position coding, there is a problem that the non-first and last characters in the vocabulary cannot be effectively enhanced due to the large relative distance between the vocabulary and the non-first and last characters it contains. The above embodiment deepens the enhancement effect of the non-first and last characters in the vocabulary by exponentially reducing the relative distances between different tokens. The improved relative position coding first calculates the relative distances between the head, head and tail, tail and head of the two tokens, and then reduces the four relative distances of the two tokens with a containment relationship (w≤0). The advantage of exponential reduction is that when the relative distance between the two tokens is small, the greater the correlation between them, the more obvious the effect of exponential reduction, especially for the non-first and last characters in the vocabulary, their relative distances to the vocabulary are short, and after exponential reduction, effective enhancement can be achieved.
[0100] In addition to the exponential reduction method described in the above embodiment, the simultaneous reduction of the four determined relative distances may also be performed using the following rules:
[0101] d=(d / abs(d))*0.5
[0102] or
[0103] d=d / (1-w)
[0104] or
[0105] d=d*(1+0.5*arctan(w))
[0106] or
[0107] d=d*(2*arccot(-w)) / π
[0108] Where d represents the relative distance,
[0109] Perform nonlinear transformation on the four relative distances to obtain the final relative position code R ij , the expression is:
[0110]
[0111] Among them, ReLU() is a linear rectification function, which is a commonly used activation function in neural networks. r Is a learnable parameter matrix, which performs matrix multiplication with the vector concatenated in brackets, PE d It is the encoding representation of the relative distance d, and its elements are calculated as follows:
[0112]
[0113]
[0114] where d model Represents the dimension of the model input vector, and i represents the index corresponding to the current position in the position encoding.
[0115] Furthermore, with respect to step 108, determining the corresponding head and tail position information of the two tokens in the sentence includes:
[0116] If the token is a character, its head position and tail position are the same, which are the position of the character in the sentence;
[0117] If the token is a word, for the first planar graph, its head position and tail position are respectively the positions of the starting and ending characters of the word in the sentence. For the second planar graph, its head position and tail position are respectively the positions of the adjacent characters before and after the word in the sentence, and do not exceed the sentence range.
[0118] Since the first planar graph is used to represent the association relationship between characters and self-matching words, and the second planar graph is used to represent the association relationship between characters and the nearest context words, in the first planar graph and the second planar graph, the head and tail position information corresponding to the token in the sentence is not the same. Still taking the address text "Changyi Shanghai Road" as an example, if the token is the character "Shang", its head and tail positions are the same, both being the position 3 of "Shang" in the sentence; if the token is the word "Shanghai", for the first planar graph, its head and tail positions are respectively the positions 3 and 4 of the starting and ending characters "Shang" and "Hai" in the sentence. For the second planar graph, its head position is the position 2 of the adjacent character "Yi" before "Shanghai" in the sentence, and its tail position is the position 5 of the adjacent character "Lu" after "Shanghai" in the sentence; if the token is the word "Shanghai Road", for the first planar graph, its head and tail positions are respectively the positions 3 and 5 of the starting and ending characters "Shang" and "Lu" in the sentence. For the second planar graph, its head position is the position 2 of the adjacent character "Yi" before "Shanghai Road" in the sentence. Since "Lu" has reached the end of the sentence, its tail position is the position 5 of "Lu" in the sentence.
[0119] The above embodiments detail how to determine the head position and tail position of each token based on the first planar graph and the second planar graph respectively, and then the relative position encoding between every two tokens can be determined. Through this method, in the subsequent deep learning process, the self-matching words and the nearest context words can be better utilized to enhance the semantics of characters, so as to achieve a more accurate division of address entities.
[0120] Regarding step 110, the feature extraction through deep learning includes:
[0121] Feature extraction is performed through a deep learning model based on the self-attention mechanism.
[0122] Deep learning models based on the self-attention mechanism, such as the Transformer, are currently a popular architecture for capturing contextual information. Compared to RNNs, they can achieve parallelization, improve processing speed, and address long-distance dependencies. They use the self-attention mechanism to fully fuse word embeddings with character embeddings, improving the final character embedding representation. The Transformer takes the embedding representation and the fused relative position encoding as input. The Transformer uses the self-attention mechanism to model the relationship between two tokens. The closer the relative positions of two tokens, the deeper their mutual influence, and the correspondingly larger the self-attention weight. Therefore, the closer the relative position of an address text character is to its self-matching word or context-matching word, the stronger the lexical information enhancement effect on that character.
[0123] With respect to step 112, the classification based on the extracted features includes:
[0124] The extracted features are input into the Conditional Random Field (CRF) for classification.
[0125] After feature extraction by Transformer, the feature representation of the address text character sequence is input into the conditional random field for classification. The classification process of CRF is as follows:
[0126] Generate an alternative annotation sequence of the same length based on the length of the input address text;
[0127] For all candidate labeling sequences, calculate the corresponding conditional probability based on the state characteristic function and state transition function of each node;
[0128] The label sequence with the highest conditional probability score is output as the final label sequence, indicating that this sequence is the label sequence with the highest probability.
[0129] In the above embodiment, to improve the accuracy of the final prediction results, a conditional random field is used after the Transformer. This conditional random field calculates the corresponding conditional probabilities for all possible outcome sequences. The conditional probability reflects the likelihood of obtaining the current outcome sequence given the data. This requires calculating the state characteristic function and state transition function of each node. The present invention selects the sequence with the highest conditional probability as the final prediction sequence, resulting in a more reliable and accurate parsing result. For a more detailed classification process, please refer to the existing art and will not be further described here.
[0130] To verify the feasibility of the proposed Chinese address element parsing method, the present invention also constructs a corresponding Chinese address element parsing model (hereinafter referred to as the present invention model) based on the Chinese address element parsing method, and conducts training and testing. Specifically, the present invention model may include:
[0131] Input module, used to obtain the Chinese address text to be parsed;
[0132] A character module, configured to determine each character in the Chinese address text and its corresponding embedded representation;
[0133] a vocabulary module, configured to determine each vocabulary word in the Chinese address text and a corresponding embedding representation;
[0134] A floor plan module is configured to construct a floor plan using all determined characters and words as tokens based on the embedded representation of each token, the position of the token in the Chinese address text, and the relationship between tokens. The floor plan is composed of the embedded representation of the token itself and the head and tail position information of the token in the sentence, and is configured to provide semantic information and boundary information of the words.
[0135] an encoding module, configured to determine a final relative position encoding between each two tokens based on the head and tail position information of the tokens in the sentence in the planar graph;
[0136] The feature module is used to extract features through deep learning based on the determined embedding representation and the final relative position encoding;
[0137] The classification module is used to perform classification based on the extracted features to obtain the parsed address elements.
[0138] In an embodiment of the present invention, the input module can be used to execute step 100 in the above method embodiment, the character module can be used to execute step 102 in the above method embodiment, the vocabulary module can be used to execute step 104 in the above method embodiment, the floor plan module can be used to execute step 106 in the above method embodiment, the encoding module can be used to execute step 108 in the above method embodiment, the feature module can be used to execute step 108 in the above method embodiment, the feature module can be used to execute step 110 in the above method embodiment, and the classification module can be used to execute step 112 in the above method embodiment.
[0139] This embodiment of the present invention trains the proposed model using a correctly annotated Chinese address dataset and tests it on the publicly available TCAddress dataset for Chinese address parsing, the self-annotated SNIAddress dataset for Chinese address parsing, and the benchmark datasets for Chinese named entity recognition (named entity recognition) Weibo, OntoNotes, MSRA, and Resume. These datasets are derived from different domains: the Weibo corpus is sourced from social media, the Resume corpus is sourced from Sina Finance's resume data, and the MSRA and OntoNotes corpus are sourced from news data. The proposed model uses the TENER model without vocabulary augmentation, as well as the recent state-of-the-art (SOTA) models BERT-BiLSTM-CRF and FLAT and LEBERT in Chinese named entity recognition, as benchmark comparison models. The F1 score is used as the final evaluation metric. The test results show that, compared to the TENER model without vocabulary augmentation, the proposed model with vocabulary augmentation achieves significantly improved F1 scores on both TCAddress and SNIAddress datasets, demonstrating the importance of vocabulary augmentation for the Chinese address parsing task. In addition, the model of the present invention is superior to the existing SOTA models (BERT-BiLSTM-CRF, FLAT, LEBERT, etc.) in the field of Chinese address element parsing and Chinese named entity recognition, and has achieved the best performance on six data sets. Specifically, the model of the present invention achieved an F1 score of 69.70 on the Weibo data set, which is 0.92 higher than the 2022 SOTA model LEBERT. In addition, on the Chinese address element parsing data set TCAddress, the F1 score of the model of the present invention reached 92.38, which is also the highest score at present. Compared with the SOTA model BERT-BiLSTM-CRF in the field of Chinese address element parsing, the F1 score has increased by as much as 3.59, and on the data set SNIAddress, the F1 score of the model of the present invention has also increased by 0.77. The test results prove the effectiveness of the Chinese address element parsing method (and model) of the present invention in data from different fields. In addition, the present invention also verifies the effectiveness of the innovations of the present invention through ablation experiments: 1) Both the planar lattice structure and the planar transfer structure in the planar graph play a positive role in improving the parsing performance. When any one of them is removed, the performance of the model will decline; 2) The improved relative position encoding also plays an important role. On the Weibo dataset, the use of the improved relative position encoding improves the F1 value of the model by 0.58; 3) The relative position encoding fusion method of the present invention further improves the F1 value of the model compared to the commonly used method of fusing the output.
[0140] In summary, the present invention provides a Chinese address element parsing method and model based on vocabulary enhancement. By introducing self-matching vocabulary and recent context vocabulary information, the character sequence embedding representation of Chinese address text is effectively enhanced, and an improved method is proposed to determine the final relative position encoding between each two tokens, thereby achieving effective enhancement of non-first and last characters in the word and improving the accuracy of the parsing results.
[0141] Introducing lexical information into the field of Chinese address element parsing is groundbreaking. Word boundaries within lexical information play a crucial role in entity boundary delineation. However, due to the scarcity of annotated data resources, pre-trained models such as BERT perform poorly on this task. However, lexical augmentation approaches or even surpasses BERT's performance. To effectively capture the lexical information corresponding to address text, this paper proposes the use of a planar graph comprising a planar lattice structure and a planar transition structure. This approach addresses the problem that graph-based lexical augmentation only effectively augments final characters. The self-matching lexicon corresponding to a character in a Chinese address text, as well as the information from the nearest contextual lexicon, helps enhance understanding of that character. For example, in the case of "Jilin City Changyi Shanghai Road" and "Sichuan Panzhihua Renhe District," the self-matching lexicon "Shanghai Road" and "Changyi Shanghai Road" can be used to disambiguate potential address entities in the context, preventing the identification of Shanghai Road in Changyi District, Jilin City, as Changyi District, Shanghai City. Furthermore, by incorporating the semantic information from the nearest contextual lexicon "Renhe District," "Panzhihua" is recognized as a city-level entity rather than a specific type of flower, as a district-level entity is more likely to be preceded by a city-level entity. Therefore, the planar lattice structure and planar transfer structure proposed in the present invention can be used to capture the boundaries and semantic information of self-matching words and nearest context words respectively, thereby realizing the fusion of multiple word information.
[0142] In addition, after the present invention obtains the relative position relationship between two tokens (character and character, character and word, word and word), it needs to be encoded and a dense vector is used to model the relative position relationship (i.e., determine the relative position encoding). The traditional relative position encoding has the problem of not being able to effectively enhance the non-first and last characters in the vocabulary. Therefore, the present invention proposes an improved relative position encoding, which deepens the enhancement effect of the non-first and last characters in the vocabulary by exponentially reducing the relative distance between different tokens. When the relative distance between the two tokens is small, it means that the correlation is greater, and the effect of exponential reduction is more obvious. In particular, for the non-first and last characters in the vocabulary, their relative distance from the vocabulary is short, and after exponential scaling, effective enhancement can be achieved.
[0143] To enhance the two types of lexical information (i.e., self-matching lexical information and recent context lexical information), the present invention also fuses their relative position encodings. The final fused relative position encoding is obtained by concatenating the two relative position encodings and then subjecting them to a linear transformation via a neural network. This fused relative position encoding serves as the input to the Transformer. As a currently popular structure for capturing contextual information, the Transformer, compared to RNNs, can achieve parallelization, improve processing speed, and address long-distance dependencies. It fully integrates lexical embeddings with character embeddings through a self-attention mechanism, improving the final character embedding representation.
[0144] To improve the accuracy of the final prediction results, the present invention connects a conditional random field after the Transformer. The conditional random field calculates the conditional probabilities of all possible result sequences. The conditional probability reflects the possibility of obtaining the current result sequence under given data. After the conditional random field, the final prediction sequence is more reliable and more accurate.
[0145] In particular, Figure 2 As shown, the embodiment of the present invention also provides a false address identification method, comprising the following steps:
[0146] S1. Perform address element parsing based on the Chinese address element parsing method described in any of the above embodiments;
[0147] S2. Perform a hierarchical determination on the obtained address elements. If there are address entities of the same level with different names, it is identified as a false address. Otherwise, proceed to the next step.
[0148] S3. Match the obtained address elements with the five-level address database to obtain corresponding address codes, and verify whether the address codes corresponding to the high-level address elements are correctly correlated with the address codes corresponding to the low-level address elements. If so, proceed to the next step; otherwise, identify the address as a false address. The five levels of the five-level address database are, from high to low, provincial, municipal, county, township, and village, with provincial being the highest level and village being the lowest.
[0149] S4. Divide the obtained address elements into a first address and a second address, determine a geo-fence based on the first address, determine the longitude and latitude coordinates based on the second address, and verify whether the positional relationship between the geo-fence and the longitude and latitude coordinates is correct (i.e., determine whether the longitude and latitude coordinates are within the geo-fence). If so, identify it as a false address, otherwise identify it as a true address; wherein, the first address includes provincial, municipal and district address elements, and the second address includes all lower-level address elements except provincial, municipal and district levels.
[0150] Currently, users are increasingly filling out false addresses in fields like logistics and finance, causing significant losses to related companies. In real-world scenarios, false addresses often manifest in two main forms: overlapping addresses and fictitious addresses. Overlapping addresses contain duplicate address elements of the same level, with the duplicates spatially conflicting. Fictional addresses, on the other hand, represent addresses that do not exist in reality. Most mainstream methods for detecting false addresses rely on the results of Chinese address element parsing. Improving the performance of Chinese address element parsing models can help increase the accuracy of false address detection.
[0151] Based on the above-mentioned Chinese address element parsing method, the embodiment of the present invention proposes a false address identification method. The false address identification method first obtains Chinese address elements with high accuracy by parsing the text, and then uses the obtained address elements to perform multiple rounds of judgment to finally determine whether the input address is a false address.
[0152] Specifically, the method for identifying fake addresses performs a factor-level determination in step S2, determining whether there is address overlap within the address text. The method then compares all address entities at the same level. If there are identical entities with different names, address overlap is considered present, indicating a fake address. For example, "33 Henan South Road, Huangpu District, Shanghai, Qiaoxi District, Shijiazhuang City, Hebei Province" would be considered a fake address because "Shijiazhuang City" conflicts with "Shanghai City" and there are identical entities with different names.
[0153] In step S3, the above-mentioned false address identification method further uses the five-level address database to determine whether there is a correct correlation between address entities at different levels. In the statistical division code and urban-rural division code compilation rules published by the National Bureau of Statistics, there is a correlation between the address codes corresponding to high-level address elements and the address codes corresponding to low-level address elements within their geographical scope. For example, the address code of "Fuyang City, Anhui Province" is "341200000000", and the address code of "Yingshang County, Fuyang City, Anhui Province" is "341226000000", and the first four digits of the address code of "Yingshang County, Fuyang City, Anhui Province" are equivalent to the first four digits of the address code of "Fuyang City, Anhui Province". According to the correlation between the address codes corresponding to address elements at different levels, the false address identification method performs coarse-grained address element relationship verification based on the five-level address database. Specifically, address elements are matched against a five-level address database to obtain corresponding address codes. The address codes corresponding to higher-level address elements are then verified for correct correlation (i.e., correlation that reflects correct inclusion) between the address codes corresponding to lower-level address elements. This allows for the determination of address overlap and false addresses within the address text. If, based on the address code correlation, a lower-level address element actually contains a higher-level address element, or a higher-level address element does not contain a lower-level address element, the verification fails and the corresponding address is classified as false. The five-level address database can be constructed based on the statistical regional division and urban-rural division codes published by the National Bureau of Statistics. Given the lag in data published by the National Bureau of Statistics and the potential for missing data, other data sources can also be referenced. These include the administrative division codes of the People's Republic of China published by the Ministry of Civil Affairs, which can serve as supplementary data at the province, city, and district levels; and the frequently updated administrative divisions of AutoNavi and Tencent Maps, which can serve as supplementary data at the province, city, district, and town levels. This ultimately creates a comprehensive five-level address database.
[0154] In step S4, the above-mentioned false address identification method further determines whether there is an inclusion relationship between the province, city, and district addresses and the detailed address in terms of geographical location. Through element-level determination and coarse-grained address element relationship verification based on the five-level address library, it is basically possible to determine whether there is a false address in the address text, but there may still be fraudulent situations where some false addresses are missed, such as "No. 100000, Xitucheng Road, Haidian District, Beijing". Therefore, the present invention can also use the public map API to perform fine-grained address element relationship verification. Furthermore, for the first address obtained, its corresponding geo-fence can be determined through the AutoNavi map API. The geo-fence is a virtual spatial fence that can reflect the spatial geographic scope of the province, city, and district address (that is, the first address including provincial, municipal, and district address elements). In actual use, the "v1 / track / geofence / add / district" interface can be called to determine the geo-fence, and multiple interfaces under "v1 / track / geofence / " can be called to manage the geo-fence. For the second address obtained, the longitude and latitude coordinates can be determined through the AutoNavi Map API, and the detailed address (that is, the second address including all lower-level address elements except the provincial, municipal and district levels) can be uniquely matched with a certain spatial location point. In actual use, the "v3 / geocode / geo" interface can be called to query the longitude and latitude coordinates of the detailed address. After obtaining the geofence of the province, city and district address and the longitude and latitude coordinates of the detailed address, the spatial position relationship between the geofence and the longitude and latitude coordinates can be determined. In actual use, the "v1 / track / geofence / status / location" interface can be called to query whether the longitude and latitude coordinates of the detailed address are within the geofence of the province, city and district address. If the longitude and latitude coordinates of the detailed address are correctly queried and the longitude and latitude coordinates are indeed included in the geofence of the province, city and district address, the address text has successfully passed the fine-grained address element relationship verification, otherwise it is deemed to have failed.
[0155] In the above embodiment, after the address text is parsed and the corresponding address elements are obtained, it is considered to have passed the authenticity verification and confirmed as a real address only if it successfully passes the three rounds of verification steps S2, S3, and S4. Otherwise, it will be identified as a fake address. This method is more accurate and reliable, and can provide strong technical support for automatically verifying and screening address information.
[0156] An embodiment of the present invention also provides a device including a memory and a processor, wherein the memory stores a computer program, and when the processor executes the computer program, it implements a Chinese address element parsing method or a false address identification method based on vocabulary enhancement in any embodiment of the present invention.
[0157] An embodiment of the present invention also provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the processor executes a Chinese address element parsing method or a false address identification method based on vocabulary enhancement in any embodiment of the present invention.
[0158] Specifically, a system or device equipped with a storage medium can be provided, on which software program codes that implement the functions of any of the above-mentioned embodiments are stored, and a computer (or CPU or MPU) of the system or device can be enabled to read and execute the program codes stored in the storage medium.
[0159] In this case, the program code itself read from the storage medium can realize the function of any one of the above-mentioned embodiments, and thus the program code and the storage medium storing the program code constitute part of the present invention.
[0160] Examples of storage media for providing program code include floppy disks, hard disks, magneto-optical disks, optical disks (e.g., CD-ROMs, CD-Rs, CD-RWs, DVD-ROMs, DVD-RAMs, DVD-RWs, DVD+RWs), magnetic tapes, non-volatile memory cards, and ROMs. Alternatively, the program code may be downloaded from a server computer via a communication network.
[0161] In addition, it should be clear that the functions of any of the above embodiments can be achieved not only by executing the program code read by the computer, but also by enabling the operating system operating on the computer to complete part or all of the actual operations based on the instructions of the program code.
[0162] In addition, it can be understood that the program code read from the storage medium is written to the memory provided in the expansion board inserted into the computer or written to the memory provided in the expansion module connected to the computer, and then based on the instructions of the program code, the CPU installed on the expansion board or expansion module is caused to perform part or all of the actual operations, thereby realizing the functions of any of the above embodiments.
[0163] It should be noted that, in this article, relational terms such as first and second are used only to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply the existence of any such actual relationship or order between these entities or operations. Moreover, the terms "comprises", "comprising" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device comprising a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprising a ..." do not exclude the presence of other identical factors in the process, method, article or device comprising the elements.
[0164] Those skilled in the art will understand that all or part of the steps of implementing the above-mentioned method embodiment can be completed by hardware related to program instructions, and the aforementioned program can be stored in a computer-readable storage medium. When the program is executed, it executes the steps of the above-mentioned method embodiment; and the aforementioned storage medium includes: ROM, RAM, disk or optical disk, etc. Various media that can store program codes.
[0165] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the various embodiments of the present invention.
Claims
1. A Chinese address element parsing method based on vocabulary enhancement, characterized in that: include: Get the Chinese address text to be parsed; Determine each character in the Chinese address text and its corresponding embedded representation; Determining each word in the Chinese address text and its corresponding embedding representation; All determined characters and words are treated as tokens, and a planar graph is constructed based on the embedded representation of each token, the position of the token in the Chinese address text, and the relationship between tokens. The planar graph is composed of the embedded representation of the token itself and the head and tail position information of the token in the sentence, and is used to provide semantic information and boundary information of the vocabulary. Determine the final relative position code between each two tokens based on the head and tail position information of the tokens in the sentence in the plane graph; Based on the determined embedding representation and the final relative position encoding, feature extraction is performed through deep learning; Classify based on the extracted features to obtain the parsed address elements; The planar graph includes a first planar graph and a second planar graph, wherein the first planar graph is a planar lattice structure for representing the association relationship between characters and self-matching words, and the second planar graph is a planar transfer structure for representing the association relationship between characters and nearest context words; The method of determining the final relative position code between each two tokens based on the head and tail position information of the tokens in the sentence in the plane diagram comprises: performing the following steps for each two tokens: calculating the relative position code between the two tokens based on the first plane diagram and the second plane diagram respectively; splicing the relative position codes calculated based on the first plane diagram and the second plane diagram respectively, and obtaining the final relative position code between the two tokens through linear transformation of a neural network; The calculation of the relative position encoding between two tokens includes: determining the head and tail position information of the two tokens in the sentence, including the head position and the tail position; determining four relative distances between the two tokens: head-to-head, head-to-tail, tail-to-head, and tail-to-tail; if there is a containment relationship between the two tokens, multiplying the four relative distances determined by e at the same time w , perform exponential reduction; where w is the product of the head-to-head and tail-to-tail relative distances between two tokens; for two tokens with a containment relationship, w≤0; perform nonlinear transformation on the four relative distances to obtain relative position encoding; The first and second planes are adopted to cooperate and complement each other, and the self-matching words and the nearest context words in the address text are used to enhance specific characters.
2. The Chinese address element parsing method according to claim 1, characterized in that: The determining of each word in the Chinese address text and its corresponding embedded representation includes: Determine a dictionary corresponding to the Chinese address text; Based on the dictionary, a dictionary tree is established; Matching the Chinese address text based on the dictionary tree to obtain each word in the Chinese address text; Based on the embedding representation resource library corresponding to the dictionary, the embedding representation of each word in the Chinese address text is obtained.
3. The Chinese address element parsing method according to claim 1, characterized in that: Determining the corresponding head and tail position information of the two tokens in the sentence includes: If the token is a character, its head position and tail position are the same, which are the position of the character in the sentence; If the token is a word, for the first plane graph, its head position and tail position are the positions of the start and end characters of the word in the sentence respectively; for the second plane graph, its head position and tail position are the positions of the preceding and following adjacent characters of the word in the sentence respectively, and do not exceed the scope of the sentence.
4. The Chinese address element parsing method according to claim 1, characterized in that: The determining of each character in the Chinese address text and the corresponding embedded representation includes: The Chinese address text is input into a pre-trained BERT model to determine each character in the Chinese address text and its corresponding embedded representation.
5. A method for identifying a false address, characterized in that: The steps include: Performing address element parsing based on the Chinese address element parsing method based on vocabulary enhancement as described in any one of claims 1 to 4 above; Perform hierarchical determination on the address elements. If there are address entities of the same level with different names, it is identified as a false address. Otherwise, proceed to the next step. Match the address elements with the five-level address database to obtain the corresponding address codes. Verify whether the address codes corresponding to the higher-level address elements are correctly correlated with the address codes corresponding to the lower-level address elements. If so, proceed to the next step. Otherwise, identify it as a false address. A first address and a second address are divided according to address elements, a geographic fence is determined based on the first address, and longitude and latitude coordinates are determined based on the second address. It is checked whether the positional relationship between the geographic fence and the longitude and latitude coordinates is incorrect. If so, it is identified as a false address, otherwise it is identified as a real address; wherein, the first address includes provincial, municipal and district address elements, and the second address includes all lower-level address elements except provincial, municipal and district levels.
6. A device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the method according to any one of claims 1 to 5 is implemented.
7. A storage medium having a computer program stored thereon, characterized in that: When the computer program is executed in a computer, the computer is caused to execute the method according to any one of claims 1 to 5.
Citation Information
Patent Citations
BERT-FLAT-based Chinese named entity recognition method
CN112270193A
Address information detection method and device, electronic equipment and storage medium
CN113434708A