Address error correction method fusing large language model and map positioning
Through deep learning's named entity recognition and map API query combined with error correction processing of large language models, it solves the problem of low accuracy of address error correction methods in the existing technology in the process of speech to text and users filling in address information, and achieves a better Efficient and accurate address correction effect.
Patent Information
- Application Number
- CN202411349210.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-26
- Publication Date
- 2025-01-21
AI Technical Summary
The existing address error correction methods are difficult to ensure the accuracy of address text during the process of voice-to-text conversion and user filling in address information, and the generalization ability of the continuous update standard address library and deep learning model is affected by the data set.
The named entity recognition (NER) method of deep learning is used to identify address entity data from text in different input modes, and a list of candidate addresses is generated through map API query, and a comprehensive algorithm combining string similarity and set similarity is used to calculate the optimal match. The address is finally corrected through a large language model.
The address text accuracy of the AI model in the process of converting speech to text and users filling in address information has been significantly improved, and it can effectively handle various address errors while maintaining the natural fluency of the text and the accuracy of the information.
Smart Images

Figure CN119337865A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of natural language processing, and in particular relates to an address error correction method integrating a large language model with map positioning. Background Art
[0002] In the current technical context, each address error correction method has its own unique technology and processing flow, aiming to improve the accuracy and efficiency of address matching through different mechanisms.
[0003] The patent "Address Error Correction Method, Device, Computer Equipment and Storage Medium CN115618867A" focuses on the use of word segmentation algorithms and pinyin conversion technology. The specific operation process is as follows: First, the system obtains the address text to be corrected and uses the word segmentation algorithm to decompose it into multiple address words. These words are then converted into pinyin text for further processing. By matching these pinyin and address words with the records in the candidate standard address library, the system can form two groups of address sets: one group is based on the direct matching results of the words, and the other group is based on the matching results of the pinyin. After the two groups of address sets are merged, the system extracts the same standard addresses from them to form the final candidate address set. Finally, the system determines the final target standard address through similarity comparison. The key to this method is that it requires precise word segmentation and pinyin conversion technology, as well as relying on a comprehensive standard address library that is continuously updated to ensure the accuracy of address matching and error correction.
[0004] The patent "Address Correction Method and Its Device, Equipment, Medium, and Product CN116522910A" adopts a dual-tower model in deep learning, and obtains data from a detailed address training set to train an address feature extraction model. During the training process, one or more supervision labels are attached to each address sample. Once the model training is completed, it can be used to process the address text entered by the user. In actual applications, the system compares the user's address with the addresses in the standard error correction address library and judges by calculating the similarity between the addresses. Once the similarity reaches the preset threshold, the system will filter out a list of standard error correction addresses, thereby achieving efficient and accurate address correction. Compared with relying on a continuously updated standard error correction address library and the trained deep learning performance, the generalization ability of the model will be affected by the data set. Summary of the invention
[0005] In response to the problems in the prior art, the present invention provides an address error correction method that integrates a large language model and map positioning; the invention is committed to integrating cutting-edge natural language processing technology and map API to significantly improve the address text accuracy of the AI model in speech-to-text processing and the process of users filling in personal address information.
[0006] In order to solve the technical problems of the prior art, the present invention adopts the following technical solutions to implement:
[0007] An address error correction method integrating a large language model and map positioning comprises the following steps:
[0008] Step 1: Identify address entity data from texts in different input modes using a deep learning NER method;
[0009] Step 2: Generate a candidate address list by querying address entity data through a map API search engine;
[0010] Step 3: Use the comprehensive similarity evaluation score to calculate the best matching address for the candidate address list;
[0011] Step 4: Determine whether the best matching address is consistent with the address entity data and the original address information in the text; if the condition is met, end; otherwise, proceed to the next step;
[0012] Step 5: Correct the wrong address in the original text according to the address entity data and the matching address; including:
[0013] Generate the best matching address data set according to the address entity data, the best matching address and its corresponding annotation data according to the constructor;
[0014] The best matching address data set is evaluated sequentially through the comprehensive evaluation index score and input into the large language model to obtain the correction result;
[0015] Select the data with the lowest comprehensive evaluation index score in the large language model and less than the set threshold p to construct a prompt sample set;
[0016] The large language model corrects the prompt sample set according to the prompt learning method to construct the text correction prompt output.
[0017] Furthermore, the process of using the comprehensive similarity evaluation score to calculate the best matching address from the candidate address list in step 2 includes:
[0018] Calculate the edit distance of the string in the candidate address list according to the following formula to obtain the string similarity
[0019]
[0020] Where: A and B are two strings with lengths of m and n respectively; D(i,j) is the edit distance between the first i characters of A and the first j characters of B; if the last character is the same, the cost is 0, otherwise it is 1;
[0021] The Jaccard similarity coefficient of the word set in the candidate address list is calculated according to the following formula to obtain the set similarity;
[0022]
[0023] Among them: A and B are word sets;
[0024] Calculate the string similarity and set similarity according to the following formula to obtain a comprehensive similarity evaluation score;
[0025]
[0026] Where: α and β are weight coefficients; max(|A|,|B|) is the length of the longer string in A and B, which is used to normalize the edit distance to a value between 0 and 1;
[0027] According to the comprehensive evaluation score, the address candidate list with the highest score is extracted as the best matching address. Further, according to the address entity data, the best matching address and its corresponding annotation data, the process of generating the best matching address data set according to the constructor includes:
[0028] Create the best matching address dataset through the constructor:
[0029] Delete content function:
[0030] D i =Remove(Label i ,p del ,Round(0,n),loc,constraint)
[0031] Among them, p del is the probability of deleting characters, Round(0,n) indicates the number of characters that need to be changed, n is a hyperparameter, loc is the position of the characters that need to be changed, and constraint is the restriction not to change the administrative area;
[0032] Add details function:
[0033] D i =Add(Label i ,p add ,Round(0,n),loc,constraint)
[0034] Among them, p add To add the probability of characters;
[0035] Replacement function:
[0036] D i =Replace(Labeli ,p rep ,loc)
[0037] Among them, p rep is the probability of replacement, including character, place name, administrative district and street name replacement;
[0038] Address change function:
[0039] D i =Modify(Label i ,p mod ,Label j )
[0040] Among them, p mod is the probability of address change. j Indicates that the data in the Label data set is not the i-th item;
[0041] Add details function:
[0042] D i =Add(Label i ,p add ,Round(0,n),loc,constraint)
[0043] Among them, p add To add the probability of characters;
[0044] Replacement function:
[0045] D i =Replace(Label i ,p rep ,loc)
[0046] Among them, p rep is the probability of replacement, including character, place name, administrative district and street name replacement;
[0047] Address change function:
[0048] D i =Modify(Label i ,p mod ,Label j )
[0049] Among them, p mod is the probability of address change; Label j Indicates the data in the Label dataset that is not the i-th item.
[0050] Beneficial Effects
[0051] 1. The present invention provides an address error correction method that combines a large language model with a map API and a named entity recognition module.
[0052] 2. The present invention protects the quality of the prompt sample set formed by iterative optimization using a comprehensive algorithm of string similarity and set similarity.
[0053] 3. The iterative optimization method of the prompt sample data set of the present invention can be extended to other fields. The technology described in the present invention can not only be applied to address error correction tasks, but can also be extended to other fields such as medical and education industries with the same process design. BRIEF DESCRIPTION OF THE DRAWINGS
[0054] Figure 1 It is a flow chart of the optimal matching address of an address error correction method integrating a large language model and map positioning according to the present invention;
[0055] Figure 2 It is a flow chart of a prompt sample set of an address error correction method integrating a large language model and map positioning according to the present invention;
[0056] Figure 3 The present invention is a flow chart of an address error correction method integrating a large language model and map positioning. DETAILED DESCRIPTION
[0057] The following is combined with Figure 1 ~Attached Figure 3 The present invention is described as follows:
[0058] The core of the present invention is divided into three stages. The first stage is to use the named entity recognition (NER) method to accurately extract address information from the user's conversation content.
[0059] The second stage is to query through the map API to obtain a list of possible correct addresses. Based on this, a similarity algorithm will be used to combine string similarity and set similarity algorithms to evaluate and determine the address that best matches the user input.
[0060] In the third stage, a number of address texts will be collected as the real annotated Label data set. The Label data set will be adjusted by deleting content with a certain probability, adding detailed content, and replacing similar addresses through the map API to simulate the best data set D matched by the second stage.
[0061] Constructing the data set {D, Label} dynamically optimizes the LLM prompt samples through the data set, so that it can cope with the optimization of the address identified by the second step as not a standard address, ensuring that the output address information is both accurate and in line with the user's intention.
[0062] Stage 1: Named Entity Recognition (NER)
[0063] Purpose: Automatically identify address-related entities from user speech transcriptions.
[0064] Method: Use a deep learning-based NER model, such as the open source Transformer-based named entity model or UI E model, which has the ability to accurately identify the components of the address and pre-process it to obtain the administrative district, street name, etc., as well as the key address without overly detailed content such as building and door number.
[0065] Phase 2: Select the address to be matched
[0066] Purpose: Use the identified address entity to query the map API and obtain the best matching address to be evaluated through evaluation indicators.
[0067] method:
[0068] The first step is to call APIs such as Baidu Maps and Amap, input the address information recognized by NER, and collect the address candidate list returned by the API.
[0069] The second step is to formulate a candidate list of addresses to evaluate and select the similarity index of the best matching address.
[0070] Process: The similarity between the original address string and each candidate address string needs to be calculated. The similarity algorithm will consider string similarity indicators such as Edit D i stance, LCS algorithm, etc. and set similarity indicators such as Jaccard similarity algorithm.
[0071] String similarity examines the order of the characters in the output recognition results, such as the minimum number of operations required to convert another string by inserting, deleting or replacing characters. Set similarity measures the similarity of two sets from a holistic perspective, focusing on the presence or absence of character elements.
[0072] String Similarity Metrics
[0073] The string similarity in this article will use the Edit Distance algorithm, which calculates the minimum number of modifications between two strings and is usually used to measure the similarity between two address strings.
[0074] The edit distance is the minimum number of operations required to convert one string into another by inserting, deleting, or replacing. Suppose there are two strings A and B, whose lengths are m and n respectively. Define D(i,j) as the edit distance between the first i characters of A and the first j characters of B. The specific formula is as follows:
[0075]
[0076] If the last character is the same, the cost is 0, otherwise it is 1.
[0077] Set similarity index
[0078] The set similarity index adopts the Jaccard similarity algorithm, which measures the similarity between two sets and can be used to evaluate the similarity between sets formed by address segmentation. The specific formula is as follows:
[0079] Jaccard similarity is the ratio of the size of the intersection of two sets to the size of their union. If A and B are two sets, then Jaccard similarity is defined as:
[0080]
[0081] In address matching applications, A and B can be sets of words in the address.
[0082] Comprehensive evaluation indicators
[0083]
[0084] Among them, α and β are weight coefficients used to balance the contribution of edit distance and Jaccard similarity in the total score. max(|A|,|B|) is the length of the longer string in A and B, which is used to normalize the edit distance to a value between 0 and 1.
[0085] The address with the highest score in the address candidate list extracted by the map API through the evaluation index is the address to be matched.
[0086] Before proceeding to the next stage, the addresses to be matched in the above indicators and the text addresses extracted from NER are preliminarily preprocessed, that is, the correct address matching relationship is preliminarily determined through the rules.
[0087] For example, the preprocessing stage can use whether there is a subset relationship, where the subset relationship formula is whether the address to be matched is in the text address, or whether the text address is in the address to be matched. If there is a subset relationship, the address can be considered correct and there is no need to proceed to the next stage. Otherwise, it needs to be handed over to the large language model for semantic processing.
[0088] Sample of dynamic optimization tips for the third stage
[0089] Purpose: The main purpose of this stage is to measure the output of the large language model by constructing several data sets for the first time to optimize the prompt samples, so as to improve the performance of the model in the address error correction task. The adjusted model should be able to effectively handle various possible errors while maintaining the natural fluency of the text and the accuracy of the information.
[0090] method:
[0091] The first step is data preparation
[0092] The data preparation phase involves collecting, constructing, and adjusting address datasets to simulate the error conditions that occur in the real environment as closely as possible. The specific steps are as follows:
[0093] 1. Data collection: Use the map API to collect address data to form a truly annotated Label dataset.
[0094] 2. Data construction: Data construction is not limited to the following methods, but only to highlight the possibilities of various situations so that the large model can learn and generalize.
[0095] Constructing data set D (address data set for the best match in the second stage of simulation)
[0096] The constructed functions are as follows. The specific changes are not limited to the following one, and can be composed of multiple functions. However, each group of changes will have at least two or more data with the same combination.
[0097] Delete content function:
[0098] D i =Remove(Label i ,p del ,Round(0,n),loc,constraint)
[0099] Among them, p del is the probability of deleting characters, Round(0,n) indicates the number of characters that need to be changed, n is a hyperparameter, loc is the position of the characters that need to be changed, and constraint is the restriction not to change the administrative district.
[0100] Add details function:
[0101] D i =Add(Label i ,p add ,Round(0,n),loc,constraint)
[0102] Among them, p add To increase the probability of characters.
[0103] Replacement function:
[0104] D i =Replace(Label i ,p rep ,loc)
[0105] Among them, p rep is the probability of replacement, including character, place name, administrative district and street name replacement.
[0106] Address change function:
[0107] D i =Modify(Label i ,p mod ,Label j )
[0108] Among them, p mod is the probability of address change. j Indicates the data in the Label dataset that is not the i-th item.
[0109] Label adjustment, i.e. labeling data
[0110] 1. If D i If it is constructed by deletion and addition without replacement and modification, it means that Label i There is no obvious error in the address, so the corresponding Label data remains unchanged.
[0111] Label_new i =Label i
[0112] 2. If D i Contains replacement but not changes, indicating that Label i The address contains typos and other errors. i The corresponding replaced content is also synchronized to Label_new i Address.
[0113]
[0114] Among them, j represents the Label i The number of replacements made to the data.
[0115] 3. If D i Contains the modified structure, indicating that D i With Label i Will not match, Label i The data remains unchanged.
[0116] Label_newi =Label i
[0117] Through the above method, a new dataset D_new will be obtained, including the map API recognition address dataset D simulated in the second phase, the address extraction dataset Label simulated by NER, the label data that needs to be corrected to Label_new, and the entire change process modify_Records from Label to D.
[0118] D_new:{D,Label,Label_new,modify_Records}
[0119] Step 2: Build a prompt sample
[0120] Perform prompt sample optimization for each modify_Records combination. The steps are as follows:
[0121] 1. Initial setting: First, set the threshold p. At this time, no prompt samples are used in the initial stage.
[0122] 2. Evaluation index: The comprehensive evaluation index Score of string similarity and set similarity in the second stage is adopted.
[0123] 3. Model input and evaluation: Input the data D in the combination into the big model in turn, calculate the output result R, and calculate the Score score with R and Label_new.
[0124] 4. Prompt sample selection: Output the data {D, Label, Label_new} with the lowest score value in the combination and less than the threshold p to the prompt sample set.
[0125] Step 3 Prompt Construction
[0126] The prompt sample set extracted in the second step is used as the prompt sample of LLM through prompt learning to construct text correction prompts.
[0127] The prompt structure is as follows.
[0128]
[0129] Fourth stage result output
[0130] Output: The user will receive an updated text containing the corrected address, which will more accurately reflect the user's actual address information and reduce service delays caused by address errors.
[0131] Implementation Step 1: Named Entity Recognition (NER)
[0132] First, the work order text recorded by the customer service is analyzed by using advanced deep learning technologies such as UI E. In this process, the system will automatically identify and extract the address information in the text. For example, the text content of the address to be extracted first uses NER technology to accurately extract the complete address path in the text content, and then pre-processes it to remove the building, door number, etc. to obtain the key address Key_path.
[0133] Implementation step 2: Map API query
[0134] Next, input the key address Key_path information into the map API (such as Baidu Maps or Amap) for query. This step will return a series of possible standard addresses, such as Return_path_1 and Return_path_2.
[0135] Implementation step 3: Address matching using a comprehensive similarity algorithm
[0136] The best matching address is determined by calculating the comprehensive similarity score (string similarity index combined with set similarity index) between the identified address and each candidate address returned by the map API. The comprehensive similarity score with Return_path_1 is Score_1, and the comprehensive similarity score with Return_path_1 is Score_2. Max(Score_1, Score_2) is selected from the candidate addresses as the matching address Return_path. It is also determined whether the identified address is a subset of the current candidate address and whether the administrative district is consistent. If both are met, the address is determined to be correct and the step ends.
[0137] Steps 4 and 5 are only required for the first time.
[0138] Implementation Step 4: Dataset Preparation
[0139] Collect hundreds of standard address data exported by the map API as a sample data set.
[0140] Through a series of operations such as adding, deleting, modifying, and replacing addresses, at least two sample data are taken to perform the same operation each time, and the transformed data is obtained as the optimal matching address Return_paths in the simulation implementation step three, and the original sample data is used as the Key_paths extracted from the simulation implementation step one, and the corresponding label data Labels and a series of operation record sets Records are obtained according to the operation rules. Together, they constitute a data set.
[0141] Implementation step 5: Prompt sample preparation
[0142] The multiple data sets with the same operation records obtained in the fourth step are sequentially input into a large model such as ChatGPT for correction, and the correction result is R. The comprehensive similarity score Score and the threshold p are set for R and the labeled data Label. If the Score is less than p, it enters the candidate pool. When all the data in a group are evaluated, the minimum value in the candidate pool is extracted as the prompt sample. In this way, all groups are traversed, and finally a prompt sample set is obtained.
[0143] Implementation Step 6: Model Output
[0144] By using the large model to take the prompt sample set as the prompt language learning process, the addresses to be corrected that cannot be judged as correct in step three are corrected based on this sample set.
Claims
1. An address error correction method integrating a large language model and map positioning, characterized in that: The steps include: Step 1: Identify address entity data from texts in different input modes using a deep learning NER method; Step 2: Generate a list of candidate addresses by querying address entity data through the map API search engine; Step 3: Use the comprehensive similarity evaluation score to calculate the best matching address for the candidate address list; Step 4: Determine whether the best matching address is consistent with the address entity data and the original address information in the text; if the condition is met, end; Otherwise, proceed to the next step; Step 5: Correct the wrong address in the original text according to the address entity data and the matching address; including: Generate the best matching address data set according to the address entity data, the best matching address and its corresponding annotation data according to the constructor; The best matching address data set is evaluated sequentially through the comprehensive evaluation index score and input into the large language model to obtain the correction result; Select the data with the lowest comprehensive evaluation index score in the large language model and less than the set threshold p to construct a prompt sample set; The large language model corrects the prompt sample set according to the prompt learning method to construct the text correction prompt output.
2. The address error correction method integrating a large language model and map positioning according to claim 1 is characterized in that: The process of using the comprehensive similarity evaluation score to calculate the best matching address from the candidate address list in step 2 includes: Calculate the edit distance of the string in the candidate address list according to the following formula to obtain the string similarity Where: A and B are two strings with lengths of m and n respectively; D(i,j) is the edit distance between the first i characters of A and the first j characters of B; if the last character is the same, the cost is 0, otherwise it is 1; The Jaccard similarity coefficient of the word set in the candidate address list is calculated according to the following formula to obtain the set similarity; Among them: A and B are word sets; Calculate the string similarity and set similarity according to the following formula to obtain a comprehensive similarity evaluation score; Where: α and β are weight coefficients; max(|A|,|B|) is the length of the longer string in A and B, which is used to normalize the edit distance to a value between 0 and 1; According to the comprehensive evaluation score, the address with the highest score in the candidate address list is extracted as the best matching address.
3. The address error correction method integrating large language model and map positioning according to claim 1 is characterized in that: The process of generating the best matching address data set according to the address entity data, the best matching address and its corresponding annotation data according to the constructor includes: Create the best matching address dataset through the constructor: Delete content function: D i =Remove(Label i ,p del ,Round(0,n),loc,constraint) Among them, p del is the probability of deleting characters, Round(0,n) indicates the number of characters that need to be changed, n is a hyperparameter, loc is the position of the characters that need to be changed, and constraint is the restriction not to change the administrative area; Add details function: D i =Add(Label i ,p add ,Round(0,n),loc,constraint) Among them, p add To add the probability of characters; Replacement function: D i =Replace(Label i ,p rep ,loc) Among them, p rep is the probability of replacement, including character, place name, administrative district and street name replacement; Address change function: D i =Modify(Label i ,p mod ,Label j ) Among them, p mod is the probability of address change; Label j Indicates that the data in the Label data set is not the i-th item; Among them, p del is the probability of deleting characters, Round(0,n) indicates the number of characters that need to be changed, n is a hyperparameter, loc is the position of the characters that need to be changed, and constraint is the restriction not to change the administrative district. Add details function: D i =Add(Label i ,p add ,Round(0,n),loc,constraint) Among them, p add To add the probability of characters; Replacement function: D i =Replace(Label i ,p rep ,loc) Among them, p rep is the probability of replacement, including replacement of characters, place names, administrative districts, and street names; Address change function: D i =Modify(Label i ,p mod ,Label j ) Among them, p mod is the probability of address change; Label j Indicates that the data in the Label dataset is not the i-th item.
Citation Information
Patent Citations
Address error correction method and device, computer equipment and storage medium
CN115618867A
Address error correction method and device, equipment, medium and product
CN116522910A
Cited By
Intelligent address resolution method based on word segmentation engine antagonism error correction
CN121168443A
A Smart Address Parsing Method Based on Adversarial Error Correction of Word Segmentation Engine
CN121168443B