User address text verification method and device, electronic equipment and storage medium
By pre-training and optimizing the training of primary and secondary tasks on user address text, the problem of low verification accuracy of user address text is solved, the generalization performance and prediction accuracy of the model are improved, and the time of manual annotation and feature engineering is reduced. rely.
Patent Information
- Application Number
- CN202311199461.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-09-18
- Publication Date
- 2024-10-18
AI Technical Summary
The existing technology has low accuracy in user address text verification, and manual judgment speed and accuracy are low. Machine learning models require a large amount of annotated data and feature engineering, making it difficult to automatically mine implicit information in the data, resulting in a decline in model accuracy.
By obtaining the first sample address data for pre-training of primary and secondary tasks, the initial address verification model is obtained, and the second sample address data and its annotation information (real address, false address, fuzzy address, heterogeneous address) are used to perform the initial address verification model. The model is optimized and trained to form a target address verification model, and the text of the address to be verified is verified.
It improves the accuracy of user address text verification, reduces the use of annotated data and the subjective risk of manual judgment, realizes parameter sharing and mutual learning through primary and secondary task joint learning, and improves the generalization performance and prediction accuracy of the model.
Smart Images

Figure CN118798168A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of data processing technology, and in particular to a method, device, electronic device and storage medium for verifying user address text. Background Art
[0002] As an important text data resource containing geospatial information, "address" records the geospatial information corresponding to social production activities and human behavior activities, thereby giving non-spatial data spatial attributes, and has important application value in the fields of intelligent anti-fraud. Among them, verifying the accuracy and authenticity of user address text to resist fraud risks is an important application scenario. There are a large number of abbreviations, aliases, popular names, irregular writing, disordered structures, and inconsistent, incomplete, and irregular descriptions of the same address in addresses. At present, the authenticity of addresses can be verified by manual rule comparison, and the authenticity of addresses can also be distinguished by machine learning based on classification models trained with a large amount of labeled data. However, the speed and accuracy of manual discrimination are relatively low; and current machine learning requires a large amount of labeled data for model training, and needs to extract address-related features through feature rules, and then use machine learning models for classification, which requires a large amount of manually labeled data, resulting in a long training time. It is difficult to grasp the features of some addresses with incomplete structures, wrong structures, or missing markers, and it is too dependent on feature engineering, making it difficult to automatically mine implicit information in the data, resulting in a decrease in model accuracy. Due to the above reasons, the accuracy of the current user address text verification is low. Summary of the invention
[0003] The embodiments of the present application provide a user address text verification method, device, electronic device and storage medium to solve the problem of low accuracy in the current user address text verification.
[0004] In a first aspect, an embodiment of the present application provides a method for verifying a user address text, comprising:
[0005] Get the address text to be verified;
[0006] The address text to be verified is input into the target address verification model to obtain the address verification result output by the target address verification model; wherein the target address verification model is obtained by optimizing and training the initial address verification model through the second sample address data and its annotation information; the initial address verification model is obtained by pre-training including primary and secondary tasks based on the first sample address data; the annotation information of the second sample address data includes real address, false address, fuzzy address and heterogeneous address;
[0007] A risk warning is issued based on the address verification result.
[0008] In one embodiment, the target address verification model is determined by the following steps:
[0009] Acquire first sample address data;
[0010] Performing data preprocessing on the first sample address data to obtain preprocessed sample address data;
[0011] Performing address pair matching based on the preprocessed sample address data to obtain training data; the training data includes matching address pairs and unmatched address pairs;
[0012] Performing pre-training including primary and secondary tasks based on the training data to obtain an initial address verification model;
[0013] Acquire second sample address data and its annotation information;
[0014] Based on the second sample address data and its annotation information, the initial address verification model is optimized and trained to obtain a target address verification model.
[0015] In one embodiment, performing data preprocessing on the first sample address data to obtain preprocessed sample address data includes:
[0016] Deleting completely repeated address text data in the first sample address data to obtain remaining sample address data;
[0017] Deleting blank characters and separators in the remaining sample address data to obtain third sample address data;
[0018] Performing text conversion on the third sample address data to obtain fourth sample address data;
[0019] Performing word segmentation processing on the fourth sample address data to obtain fifth sample address data;
[0020] The fifth sample address data is enhanced based on a multi-operator fusion method to obtain preprocessed sample address data including the fifth sample address data and enhanced sample address data.
[0021] In one embodiment, performing word segmentation processing on the fourth sample address data to obtain the fifth sample address data includes:
[0022] Obtaining a preset word list; the preset word list includes words of a preset text;
[0023] Pre-segmenting the fourth sample address data according to the preset word list to obtain segmented address data;
[0024] Matching the word segmentation address data with the preset word list, and using the word segmentation address data with the same vocabulary in the preset word list as the first word segmentation data;
[0025] Performing secondary word segmentation on the word segmentation address data that does not have the same vocabulary in the preset word list to obtain second word segmentation data;
[0026] Fifth sample address data is generated according to the first word segmentation data and the second word segmentation data.
[0027] In one embodiment, performing address pair matching based on the pre-processed sample address data includes at least one of the following:
[0028] Determine a matching address pair for two address data with completely identical spatial positions in the preprocessed sample address data, and determine a non-matching address pair for two address data with non-completely identical spatial positions in the preprocessed sample address data;
[0029] constructing a matching address pair and an unmatching address pair based on the fifth sample address data and the enhanced sample address data in the preprocessed sample address data;
[0030] Probabilistic matching is performed based on the pre-processed sample address data to construct matching address pairs and unmatching address pairs.
[0031] In one embodiment, the pre-training including primary and secondary tasks based on the training data to obtain an initial address verification model includes:
[0032] Performing text replacement processing on the training data to obtain replacement data;
[0033] Pre-training including primary and secondary tasks is performed according to the replacement data to obtain an initial address verification model.
[0034] In one embodiment, the primary and secondary tasks include a main task, a first task and a second task; wherein the main task is used to constrain whether the address pair matches; the first task is used to constrain the ratio of the minimum editing distance of the two address texts in the address pair to the average length of the two address texts; the second task is used to encode the semantic information of the address text itself.
[0035] In a second aspect, an embodiment of the present application provides a user address text verification device, comprising:
[0036] The acquisition module is used to obtain the address text to be verified;
[0037] An input module is used to input the address text to be verified into a target address verification model to obtain an address verification result output by the target address verification model; wherein the target address verification model is obtained by optimizing and training an initial address verification model through the second sample address data and its annotation information; the initial address verification model is obtained by pre-training including primary and secondary tasks based on the first sample address data; the annotation information of the second sample address data includes real addresses, false addresses, fuzzy addresses and heterogeneous addresses;
[0038] An alarm module is used to issue a risk alarm based on the address verification result.
[0039] In a third aspect, an embodiment of the present application provides an electronic device, comprising a processor and a memory storing a computer program, wherein when the processor executes the program, the user address text verification method described in the first aspect is implemented.
[0040] In a fourth aspect, an embodiment of the present application provides a storage medium, which is a computer-readable storage medium and includes a computer program. When the computer program is executed by a processor, the user address text verification method described in the first aspect is implemented.
[0041] The user address text verification method, device, electronic device and storage medium provided in the embodiment of the present application obtain an initial address verification model by pre-training including primary and secondary tasks with the first sample address data, and optimize the training of the initial address verification model by the second sample address data and its corresponding real address, false address, fuzzy address and heterogeneous address and other annotation information to obtain a target address verification model, so that the address text to be verified can be verified by the target address verification model to obtain an accurate address verification result. By performing optimization training after model pre-training, the use of annotation data can be reduced, and the subjective risk of manual judgment can be reduced; and, by jointly learning the primary and secondary tasks, parameter sharing and mutual reference can be achieved, and the generalization performance of the model can be improved; and, by training with the annotation information of four types of samples instead of traditional two-category training, the model can be fine-tuned; based on this, the accuracy of model prediction can be improved, thereby improving the accuracy of user address text verification. BRIEF DESCRIPTION OF THE DRAWINGS
[0042] In order to more clearly illustrate the technical solutions in the present application or the prior art, a brief introduction will be given below to 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 application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0043] Figure 1This is one of the flow charts of the user address text verification method provided in the embodiment of the present application;
[0044] Figure 2 It is a schematic diagram of the process of determining the target address verification model in the user address text verification method provided in the embodiment of the present application;
[0045] Figure 3 This is the second flow chart of the user address text verification method provided in the embodiment of the present application;
[0046] Figure 4 This is a functional module diagram of an embodiment of a user address text verification device of the present application;
[0047] Figure 5 It is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0048] In order to make the purpose, technical scheme and advantages of the present application clearer, the technical scheme in the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, rather than all the embodiments. In the description of this specification, the description of the reference terms "one embodiment", "some embodiments", "example", "specific example", or "some examples" means that the specific features, structures, materials or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the embodiments of the present application. In this specification, the schematic representation of the above terms does not necessarily target the same embodiment or example. Moreover, the specific features, structures, materials or characteristics described can be combined in any one or more embodiments or examples in a suitable manner. In addition, in the absence of mutual contradiction, those skilled in the art can combine and combine the different embodiments or examples described in this specification and the features of different embodiments or examples. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in the art without making creative work are within the scope of protection of this application.
[0049] The current address text verification technology solutions in the industry are as follows:
[0050] Solution 1: Rule-based address text verification based on external information.
[0051] This solution can verify the authenticity of the address by comparing rules when external authoritative information (such as location coordinate dictionary mapping) is known.
[0052] Solution 2: Address text verification based on machine learning classification model.
[0053] This solution first requires manual annotation of a large number of address text data sets. After obtaining the annotated sample set, address-related features are extracted through feature rules, and then classified using a machine learning model.
[0054] The disadvantages of the above solution 1 are as follows:
[0055] It has great limitations and is often one-sided or redundant.
[0056] Manually summarized address rules are very complex, requiring a lot of time and manpower costs, and it is difficult to cover all address rules.
[0057] It requires a complex external mapping dictionary, which is difficult to meet the growing massive demand of the Internet.
[0058] The disadvantages of the above solution 2 are as follows:
[0059] It is difficult to capture the characteristics of some addresses with incomplete or incorrect structures or missing marker words, resulting in decreased model accuracy and insufficient robustness.
[0060] It relies too heavily on feature engineering, making it difficult to automatically mine implicit information in the data, and its generalization capabilities are insufficient.
[0061] It relies on manually labeled data, which is very costly.
[0062] In summary, the above solutions have problems such as subjective risks, high costs, poor robustness, and insufficient generalization ability.
[0063] Based on the above problems, the present application example provides a user address text verification method, device, electronic device and storage medium.
[0064] The user address text verification method, device, electronic device and storage medium provided by the present invention are described in detail below in conjunction with the embodiments.
[0065] Figure 1 This is one of the flow charts of the user address text verification method provided in the embodiment of the present application. Figure 1 , the embodiment of the present application provides a user address text verification method, the method may include:
[0066] Step 100, obtaining the address text to be verified;
[0067] It should be noted that the executor of the user address text verification method provided in the embodiment of the present application can be a computer device, such as a mobile phone, a tablet computer, a laptop computer, a PDA, a vehicle-mounted electronic device, a wearable device, an ultra-mobile personal computer (UMPC), a netbook or a personal digital assistant (PDA), etc.
[0068] In the present application, the text of the user address that has not been verified can be obtained as the address text to be verified.
[0069] Step 200, inputting the address text to be verified into the target address verification model, and obtaining the address verification result output by the target address verification model;
[0070] In the present application, the first sample address data can be obtained in advance, and the second sample address data and its marking information can be obtained. That is, each second sample address data corresponds to a marking information. Among them, the number of first sample address data can be much larger than the number of second sample address data.
[0071] The labeling information of the second sample address data includes four types of sample labels: real address, false address, fuzzy address and heterogeneous address.
[0072] A real address is a completely normal user address; a fake address is a fabricated address that does not exist at all; a fuzzy address is an address that is blurred and then traded through other contact methods; a heterogeneous address is an address that is attacked in order to counter the risk control rules of various platforms by using typos, pinyin, special characters in the middle of the address to split keywords, etc.
[0073] Combining expert knowledge in the anti-fraud field, four categories of fine-tuned sample business labels are defined to have a more direct and smoother effect on downstream business applications.
[0074] Furthermore, the RoBERTa model is pre-trained including primary and secondary tasks based on the acquired first sample address data, and an initial address verification model is obtained after the training is completed.
[0075] Among them, RoBERTa (Robustly Optimized BERT Pretraining Approach) is a pre-trained language model based on a deformed Transformer model structure and is widely used in the field of natural language processing.
[0076] The Transformer model is a neural network model based on the self-attention mechanism.
[0077] Furthermore, the present application can train the initial address verification model through the second sample address data and its annotation information, thereby optimizing and adjusting the initial address verification model so that the model has higher processing accuracy, and obtaining the target address verification model after completing the optimization training, wherein the target address verification model can predict the type of the input address text.
[0078] Therefore, after obtaining the address text to be verified, the address text to be verified can be input into the target address verification model, and the input address text to be verified is processed by the target address verification model to obtain the address verification result output by the target address verification model.
[0079] The address verification result is one of a real address, a false address, an ambiguous address and a heterogeneous address.
[0080] Step 300: Issue a risk warning based on the address verification result.
[0081] After obtaining the address verification result, risk warning processing can be performed based on the address verification result.
[0082] Specifically, if the address verification result is a real address, the address is determined to be a risk-free address, so subsequent processing actions for the address can be performed. For example, if the address is used as a delivery address when shopping, the address can be directly confirmed as the delivery address.
[0083] If the address verification result is a false address, the address will be marked as a high-risk address and subsequent processing actions for the address will be refused.
[0084] If the address verification result is an ambiguous address, the address will be marked as a medium-risk address, and a prompt will be given to adjust the address to make it valid.
[0085] If the address verification result is a heterogeneous address, the address is marked as a medium-risk address and verified through the corresponding geographic location information. If the verification fails, subsequent processing actions for the address are refused. If the verification passes, subsequent processing actions for the address are performed.
[0086] The user address text verification method provided in the embodiment of the present application obtains an initial address verification model by pre-training the first sample address data including primary and secondary tasks, and optimizes and trains the initial address verification model by the second sample address data and its corresponding real address, false address, fuzzy address and heterogeneous address and other annotation information to obtain a target address verification model, so that the address text to be verified can be verified by the target address verification model to obtain an accurate address verification result. By performing optimization training after model pre-training, the use of annotation data can be reduced, and the subjective risk of manual judgment can be reduced; and, by jointly learning the primary and secondary tasks, parameter sharing and mutual reference can be achieved, and the generalization performance of the model can be improved; and, by training with the annotation information of four types of samples instead of traditional binary classification training, the model can be fine-tuned; based on this, the accuracy of model prediction can be improved, thereby improving the accuracy of user address text verification.
[0087] This application is fine-tuned based on the pre-trained model to reduce the subjective risk and labor cost of manual judgment, improve the accuracy of verification, and can identify a variety of different types of address fraud, making the entire process automated and greatly reducing the cost of manual labeling.
[0088] Through the joint constraints of multiple subtasks, this application can effectively capture the spatial semantic relationship between address texts, learn the administrative hierarchy elements of the address and the affiliation between administrative divisions without relying on external mapping dictionaries, and can semantically represent single words in the address and their contextual environment information, and still maintain the true relationship of address samples in high-dimensional space.
[0089] Figure 2 This is a schematic diagram of the process of determining the target address verification model in the user address text verification method provided in the embodiment of the present application. Figure 2 In one embodiment, the target address verification model is determined by the following steps:
[0090] Step 1, obtaining first sample address data;
[0091] In the present application, a large number of unlabeled user addresses can be obtained, and the first sample address data is formed by all user addresses.
[0092] Step 2, performing data preprocessing on the first sample address data to obtain preprocessed sample address data;
[0093] The present application can perform data preprocessing operations such as deduplication, removal of illegal characters, text conversion, word segmentation and data enhancement on the first sample address data, and obtain preprocessed sample address data after completing the data preprocessing.
[0094] Step 3, performing address pair matching based on the preprocessed sample address data to obtain training data;
[0095] After obtaining the preprocessed sample address data, the present application can construct training data based on the preprocessed sample address data by one or more matching methods such as spatial matching, enhanced matching, and probability matching. Among them, training data including matching address pairs and unmatched address pairs can be obtained through matching.
[0096] Step 4: Perform pre-training including primary and secondary tasks based on the training data to obtain an initial address verification model;
[0097] After obtaining the training data, the RoBERTa model can be pre-trained including primary and secondary tasks through the training data, and the initial address verification model can be obtained after the training is completed.
[0098] The primary and secondary tasks include the primary task, the first task and the second task. The first task and the second task can also be called the first auxiliary task and the second auxiliary task.
[0099] The main task is used to constrain whether the address pair matches; the first task is used to constrain the ratio of the minimum edit distance between the two address texts in the address pair to the average length of the two address texts; the second task is used to encode the semantic information of the address text itself.
[0100] The use of pre-trained models has higher accuracy than traditional machine learning and deep learning URL classification models, and can realize and support the inspection of large quantities of address texts, reduce the pressure of manual labeling, reduce the subjective risks of manual judgment and labor costs, and automate the entire process.
[0101] Step 5, obtaining second sample address data and its annotation information;
[0102] The present application can also obtain a small amount of annotated user addresses, form second sample address data from the user addresses, and obtain the annotation information set for each second sample address data.
[0103] Step 6: Based on the second sample address data and its annotation information, the initial address verification model is optimized and trained to obtain a target address verification model.
[0104] This application can be based on the fine-tuning theory of Natural Language Processing (NLP), change some parameters to adapt to the second stage of the multi-classification model aimed at address text verification that integrates anti-fraud field knowledge, and build an address verification model that can complete address text verification with higher accuracy.
[0105] Unlike the pre-training learning method, the data set during fine-tuning has business labels in the anti-fraud field, and there is no need to build a self-supervised target to understand the address semantic information. Different from the binary classification problem of common authenticity verification tasks, this embodiment combines expert knowledge in the anti-fraud field to define four types of fine-tuning sample business labels as follows:
[0106] Label=0: real address, the user is completely normal.
[0107] Label=1: False address, a fabricated address that does not exist at all.
[0108] Label=2: Fuzzy address, blur the address and conduct transactions through other contact methods.
[0109] Label=3: Heterogeneous addresses. In order to counter the risk control rules of various platforms, the attacks are carried out by using typos, pinyin, and special characters in the middle of the address to split keywords.
[0110] Therefore, the present application can optimize and train the initial address verification model through the second sample address data and its annotation information to better adapt to the address text verification scenario, and obtain the target address verification model after fine-tuning.
[0111] This embodiment performs optimization training after model pre-training, which can reduce the use of labeled data and reduce the subjective risk of manual judgment; and through joint learning of primary and secondary tasks, parameter sharing and mutual reference can be achieved, which can improve the generalization performance of the model; and through training with labeled information of four types of samples instead of traditional two-category training, model fine-tuning can be achieved; based on this, the accuracy of model prediction can be improved, thereby improving the accuracy of user address text verification.
[0112] In one embodiment, performing data preprocessing on the first sample address data to obtain preprocessed sample address data includes:
[0113] Step 21, deleting completely repeated address text data in the first sample address data to obtain remaining sample address data;
[0114] When preprocessing the first sample address data, the present application can first delete the completely repeated address text data in the first sample address data, that is, delete one of the two completely repeated address text data, and obtain the remaining sample address data after deleting all repeated data.
[0115] Step 22, deleting blank characters and separators in the remaining sample address data to obtain third sample address data;
[0116] Taking into account that illegal characters will greatly interfere with the learning of address semantic representation, blank characters and separators in the remaining sample address data are deleted. However, considering the characteristics of fraud-related addresses in anti-fraud business, special characters in the remaining sample address data are retained, and the remaining sample address data are determined as the third sample address data.
[0117] Step 23, performing text conversion on the third sample address data to obtain fourth sample address data;
[0118] In order to avoid the influence of dictionary redundancy and difficulty in identifying synonyms on semantic learning, all traditional Chinese characters in the third sample address data were converted into simplified Chinese characters, and all uppercase letters were converted into lowercase letters.
[0119] Furthermore, in order to unify the representation of characters, all non-Chinese full-width characters in the third sample address data are converted into half-width characters.
[0120] After completing the text conversion, the fourth sample address data is obtained.
[0121] Step 24, performing word segmentation processing on the fourth sample address data to obtain fifth sample address data;
[0122] If the keywords involved in some anti-fraud cases are too obscure, they are easily regarded as unknown words by the word segmenter. Therefore, this embodiment improves the Tokenize operation to obtain the AF_Tokenize operation, and performs the AF_Tokenize operation on the fourth sample address data to implement word segmentation processing on the fourth sample address data. After completing the word segmentation processing, the fifth sample address data is obtained.
[0123] Among them, Tokenize is the process of splitting a text into tokens.
[0124] Step 25: Perform data enhancement on the fifth sample address data based on a multi-operator fusion method to obtain preprocessed sample address data including the fifth sample address data and enhanced sample address data.
[0125] Understandably, in the anti-fraud business, people have various expressions about addresses, and people often confront the existing verification mechanism from the perspectives of false addresses, ambiguous addresses, special character addresses, etc. In natural language, there is a close contextual relationship between words, and random transformations will cause ambiguity or lose the original semantics. Therefore, in the process of enhancing the address annotation data, it is necessary to analyze the element combination rules of the Chinese address and formulate a complete annotation data enhancement plan to avoid the generation of address noise data and low-quality data. In order to enrich the training data, enhance the robustness of the model, better extract the address text features, learn the feature information expression and generalization model, this embodiment adopts a multi-operator fusion method to perform data enhancement on the address text.
[0126] The multi-operators in this application may include but are not limited to number replacement, synonymous Chinese character replacement, address element exchange and address element deletion, etc.
[0127] Among them, the number replacement may, for example, replace the original number 8 with number 10; the synonymous Chinese character replacement may, for example, replace building with building; the address element exchange may, for example, exchange the positions of province information and prefecture-level city information; the address element deletion may, for example, delete the province information or prefecture-level city information, etc.
[0128] Based on the fusion of the above multiple operators, the fifth sample address data can be enhanced to obtain enhanced sample address data. The fifth sample address data and the enhanced sample address data are further used together as pre-processed sample address data.
[0129] By adopting the multi-operator fusion method to enhance the address text data, it conforms to the combination law of address elements, can improve the data volume and data quality of address data, and to a certain extent alleviate the problems of abbreviations, aliases, popular names, non-standard writing, and disordered structure.
[0130] This embodiment can improve data quality, reduce the risk of overfitting, improve model performance, and accelerate the training process by deduplicating, removing illegal characters, segmenting and enhancing sample data, thereby improving the accuracy of model prediction and further improving the accuracy of user address text verification.
[0131] In one embodiment, the fourth sample address data is segmented to obtain fifth sample address data, including:
[0132] Step 241, obtaining a preset word list; the preset word list includes words of the preset text;
[0133] In this application, a vocabulary table may be set in advance according to the vocabulary involved in the anti-fraud case text, for example, named anti_fraud_vocab.txt.
[0134] Therefore, the present application can obtain a preset vocabulary.
[0135] Step 242, pre-segmenting the fourth sample address data according to a preset word list to obtain segmented address data;
[0136] After obtaining the preset word list, anti_fraud_vocab.txt can be used as the word list to pre-segment the address texts in the fourth sample address data, that is, the texts in the address text that are the same as the words in the word list are grouped into one word. After completing the pre-segmentation, the segmented address data is obtained, for example, it can be expressed as [w1, w2, ..., w l ].
[0137] Step 243, matching the word segmentation address data with the preset word list, and taking the word segmentation address data with the same vocabulary in the preset word list as the first word segmentation data;
[0138] Furthermore, each word segmentation address data is matched with a word in a preset word list. If the word segmentation address data has the same word in the preset word list, the word segmentation address data is retained and used as the first word segmentation data.
[0139] Step 244, performing a second word segmentation on the word segmentation address data that does not have the same vocabulary in the preset word list to obtain second word segmentation data;
[0140] If the segmented address data does not have the same vocabulary in the preset vocabulary, the segmented address data is segmented again using the tokenize function provided by BERT, and the segmented data is determined as the second segmented data.
[0141] Among them, BERT (Bidirectional Encoder Representations from Transformers) is a pre-trained language model based on the Transformer architecture.
[0142] Step 245 , generating fifth sample address data according to the first segmented word data and the second segmented word data.
[0143] After obtaining the first word segmentation data and the second word segmentation data, the word segmentation contents in each first word segmentation data can be concatenated in the order before word segmentation, and the word segmentation contents in each second word segmentation data can be concatenated in the order before word segmentation, finally forming the fifth sample address data.
[0144] This embodiment can avoid the blocking of keywords involved in anti-fraud cases through improved word segmentation processing, which helps to ultimately improve the accuracy of user address text verification.
[0145] In one embodiment, address pair matching is performed based on pre-processed sample address data, including at least one of the following:
[0146] Step 31, determining a matching address pair for two address data with completely identical spatial positions in the preprocessed sample address data, and determining a non-matching address pair for two address data with non-completely identical spatial positions in the preprocessed sample address data;
[0147] In the present application, spatial matching can be performed based on preprocessed sample address data. Specifically, part of the coordinate information carried by the sample address data can be preprocessed, and two address data with exactly the same spatial position in the preprocessed sample address data can be regarded as matching addresses, thereby automatically constructing a matching address pair (for example: <(No. 8, B Road, District A, Hangzhou City, Zhejiang Province, C Research Institute, Hangzhou City, Zhejiang Province), 1>). On this basis, the constructed matching address pairs can also be manually adjusted to filter out address pairs whose actual spatial positions are different due to errors caused by data collection and other reasons, but whose spatial coordinates are displayed as the same position (for example: different house number addresses in the same building in a community).
[0148] At the same time, two address data with different spatial positions in the pre-processed sample address data can be determined as a mismatched address pair.
[0149] Step 32, constructing a matching address pair and an unmatching address pair based on the fifth sample address data and the enhanced sample address data in the preprocessed sample address data;
[0150] In the present application, two address data indicating the same position before and after enhancement can be determined as a matching address pair; and two address data indicating different positions before and after enhancement can be determined as a non-matching address pair.
[0151] Step 33: Perform probabilistic matching based on the pre-processed sample address data to construct matching address pairs and unmatched address pairs.
[0152] In the present application, for each address text in the preprocessed sample address data, an address text can be randomly selected from the remaining address texts with a specified probability, such as 85%, to construct an unmatched address pair; and the address text itself can be selected with another probability, such as 15%, to construct a matched address pair.
[0153] The present application can combine the above three matching methods to match address pairs, thereby obtaining a matching address pair sample of <(S Qi ,S Ti ),L i >(i=1,2,...,N), where S Qi ,S Ti For two address texts, L iIndicates whether two address texts match. 1 indicates that the sample is a matching address pair, and 0 indicates that the sample is an unmatched address pair.
[0154] This embodiment constructs address pair samples by fusing three different modes: spatial matching, enhanced matching, and probability matching. It makes full use of information from different sources of multi-source samples, improves sample quality, and improves training efficiency. At the same time, it constructs matching address pairs and unmatched address pairs as training data, which helps to provide positive and negative samples, enhance the robustness of the model, improve generalization ability, and contain data distribution information, thereby improving the accuracy and adaptability of user address verification.
[0155] In one embodiment, pre-training including primary and secondary tasks is performed based on training data to obtain an initial address verification model, including:
[0156] Step 41, performing text replacement processing on the training data to obtain replacement data;
[0157] The two address texts of each address pair in the training data are segmented at the word level, and the address corpus dictionary is constructed. The length of the two address texts is padded to the maximum length set by the parameters, that is, special characters are added at the end of the text. Then, using the BERT method, 15% of the tokens are randomly masked or replaced, 80% of which are replaced with special tags, 10% of the tokens are retained as original tokens, and 10% of the tokens are replaced with randomly selected tokens from the address corpus dictionary. After completing the text replacement of all address pairs, the replacement data is obtained.
[0158] Step 42, pre-training including primary and secondary tasks is performed based on the replacement data to obtain an initial address verification model.
[0159] Furthermore, the RoBERTa model can be pre-trained on both primary and secondary tasks by replacing the data.
[0160] Specifically, the main task is used to constrain whether the address pair matches. For the same two address texts, after randomly marking 15% of the tokens, the pre-trained model constraint still needs to accurately judge the relationship between the two address texts, so that the model can better learn the semantic representation of the address token and its context. In addition, it is also necessary to learn whether the two addresses correspond to the same spatial location, although different people have different ways of filling in the address text. Specifically, when training the model by replacing the address pairs in the data, a sample encoding identifier [CLS0] is reserved. After the Transformer feature extractor of the model extracts the semantic information layer by layer, the multi-dimensional vector corresponding to [CLS0] is extracted from the vector matrix output by the top layer, and the logit is input into the softmax layer. The cross entropy loss is calculated to obtain the loss function L0.
[0161] Due to the diversity and particularity of address text semantics, a single main task may not be able to capture all the information well, so consider adding two auxiliary tasks to help pre-training.
[0162] The first auxiliary task, i.e., the first task, is used to constrain the ratio of the minimum edit distance of the two address texts to the average length of the two addresses. This task can reflect the similarity of the two address texts to a certain extent. After the addresses are specially marked and multi-layer semantic abstraction is performed, the similarity between the two addresses can still be maintained in the corresponding high-dimensional space. Specifically, when training the model by replacing the address pairs in the data, an identification bit [CLS1] is reserved. After the Transformer feature extractor extracts the semantic information layer by layer, the multi-dimensional vector corresponding to [CLS1] is extracted from the vector matrix output by the top layer, and input into a regression model to calculate the mean square error loss to obtain the loss function L1. The second auxiliary task, i.e., the second task, is used to encode the semantic information of the address text itself, i.e., the masked language model. Its processing method is the same as the original RoBERTa model, and the loss function L2 is obtained.
[0163] Through multi-task learning with priority, the model parameters are updated by gradient descent. The update amount of each model parameter is Δθ = -μu, where u is the model parameter and μ is the update step of the model parameter. The gradient corresponding to the loss function of each task is g i (i=0,1,2). Since L0 is the main task loss, the overall objective function of the model needs to maximize u and g i The inner product of is expressed as follows:
[0164]
[0165] When solving the problem, the objective function is transformed into an unconstrained optimization problem using the Lagrange multiplier method. The specific expression is as follows:
[0166]
[0167] Wherein, λ1 and λ2 are both preset weight values.
[0168] It should be noted that in the subsequent optimization training process, the last two layers of vectors corresponding to [CLS0] and [CLS1] can be concatenated in the same dimension and then connected to the fully connected layer and the softmax layer to obtain the probability distribution of the address text multi-classification problem. The address verification result is output as p(label=j), where j=0,1,2,3.
[0169] This embodiment sets multiple auxiliary task constraints for pre-training through primary and secondary multi-task learning. Under the premise of ensuring the optimal learning of the main task, the gradient of the auxiliary task does not rise, which is equivalent to giving the main task loss function a regular term to better match the performance requirements of the main task. In addition, through joint learning of primary and secondary tasks, parameter sharing and mutual reference can be achieved, so that the model can obtain better generalization performance, thereby improving the accuracy of user address text verification.
[0170] Figure 3 This is a flow chart of the second method for verifying the user address text provided in the embodiment of the present application. Figure 3 In one embodiment, the present application may first perform data preprocessing on the sample address data, wherein the data preprocessing process may not include data enhancement; further perform data enhancement on the preprocessed data, and construct address pair samples based on the enhanced data and the data before enhancement, and pre-train the model through the address text in the address pair samples, wherein when pre-training the model, multi-task learning with priority can be performed, and the model can be fine-tuned after the pre-training is completed, thereby obtaining an address verification multi-classification model as the target address verification model, and then the model can be used for result business applications such as user address verification.
[0171] Furthermore, the present application also provides a user address text verification device.
[0172] Reference Figure 4 , Figure 4 This is a functional module diagram of an embodiment of a user address text verification device of the present application.
[0173] The user address text verification device comprises:
[0174] The acquisition module 410 is used to acquire the address text to be verified;
[0175] An input module 420 is used to input the address text to be verified into a target address verification model to obtain an address verification result output by the target address verification model; wherein the target address verification model is obtained by optimizing and training an initial address verification model through the second sample address data and its annotation information; the initial address verification model is obtained by pre-training including primary and secondary tasks based on the first sample address data; the annotation information of the second sample address data includes a real address, a false address, an ambiguous address and a heterogeneous address;
[0176] The warning module 430 is used to issue a risk warning based on the address verification result.
[0177] The user address text verification device provided in the embodiment of the present application obtains an initial address verification model by pre-training including primary and secondary tasks with the first sample address data, and optimizes and trains the initial address verification model by the second sample address data and its corresponding real address, false address, fuzzy address, heterogeneous address and other annotation information to obtain a target address verification model, so that the address text to be verified can be verified by the target address verification model to obtain an accurate address verification result. By performing optimization training after model pre-training, the use of annotation data can be reduced, and the subjective risk of manual judgment can be reduced; and, by jointly learning the primary and secondary tasks, parameter sharing and mutual reference can be achieved, and the generalization performance of the model can be improved; and, by training with the annotation information of four types of samples instead of traditional binary classification training, the model can be fine-tuned; based on this, the accuracy of model prediction can be improved, thereby improving the accuracy of user address text verification.
[0178] Figure 5 An example of a physical structure diagram of an electronic device is shown in FIG. Figure 5 As shown, the electronic device may include: a processor 510, a communication interface 520, a memory 530 and a communication bus 540, wherein the processor 510, the communication interface 520 and the memory 530 communicate with each other via the communication bus 540. The processor 510 may call a computer program in the memory 530 to execute the steps of the user address text verification method, for example including:
[0179] Get the address text to be verified;
[0180] The address text to be verified is input into the target address verification model to obtain the address verification result output by the target address verification model; wherein the target address verification model is obtained by optimizing and training the initial address verification model through the second sample address data and its annotation information; the initial address verification model is obtained by pre-training including primary and secondary tasks based on the first sample address data; the annotation information of the second sample address data includes real address, false address, fuzzy address and heterogeneous address;
[0181] A risk warning is issued based on the address verification result.
[0182] In addition, the logic instructions in the above-mentioned memory 530 can be implemented in the form of a software functional unit and can be stored in a computer-readable storage medium when it is sold or used as an independent product. Based on this understanding, the technical solution of the present application can be essentially or partly embodied in the form of a software product that contributes to the prior art, and the computer software product is stored in a storage medium, including several instructions to enable a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.
[0183] On the other hand, an embodiment of the present application further provides a storage medium, wherein the storage medium is a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, wherein the computer program is used to enable a processor to execute the steps of the methods provided in the above embodiments, for example, including:
[0184] Get the address text to be verified;
[0185] The address text to be verified is input into the target address verification model to obtain the address verification result output by the target address verification model; wherein the target address verification model is obtained by optimizing and training the initial address verification model through the second sample address data and its annotation information; the initial address verification model is obtained by pre-training including primary and secondary tasks based on the first sample address data; the annotation information of the second sample address data includes real address, false address, fuzzy address and heterogeneous address;
[0186] A risk warning is issued based on the address verification result.
[0187] The computer-readable storage medium can be any available medium or data storage device that can be accessed by the processor, including but not limited to magnetic storage (such as floppy disks, hard disks, magnetic tapes, magneto-optical disks (MO), etc.), optical storage (such as CD, DVD, BD, HVD, etc.), and semiconductor storage (such as ROM, EPROM, EEPROM, non-volatile memory (NANDFLASH), solid-state drive (SSD)), etc.
[0188] The device embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. Ordinary technicians in this field can understand and implement it without paying creative labor.
[0189] Through the description of the above implementation methods, those skilled in the art can clearly understand that each implementation method can be implemented by means of software plus a necessary general hardware platform, and of course, it can also be implemented by hardware. Based on this understanding, the above technical solution is essentially or the part that contributes to the prior art can be embodied in the form of a software product, and the computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, a disk, an optical disk, etc., including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment or some parts of the embodiments.
[0190] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit it. Although the present application 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 embodiments of the present application.
Claims
1. A user address text verification method, characterized in that: include: Get the address text to be verified; The address text to be verified is input into the target address verification model to obtain the address verification result output by the target address verification model; wherein the target address verification model is obtained by optimizing and training the initial address verification model through the second sample address data and its annotation information; the initial address verification model is obtained by pre-training including primary and secondary tasks based on the first sample address data; the annotation information of the second sample address data includes real address, false address, fuzzy address and heterogeneous address; A risk warning is issued based on the address verification result.
2. The user address text verification method according to claim 1, characterized in that: The target address verification model is determined by the following steps: Acquire first sample address data; Performing data preprocessing on the first sample address data to obtain preprocessed sample address data; Performing address pair matching based on the preprocessed sample address data to obtain training data; the training data includes matching address pairs and unmatched address pairs; Performing pre-training including primary and secondary tasks based on the training data to obtain an initial address verification model; Acquire second sample address data and its annotation information; Based on the second sample address data and its annotation information, the initial address verification model is optimized and trained to obtain a target address verification model.
3. The user address text verification method according to claim 2, characterized in that: The performing data preprocessing on the first sample address data to obtain preprocessed sample address data includes: Deleting completely repeated address text data in the first sample address data to obtain remaining sample address data; Deleting blank characters and separators in the remaining sample address data to obtain third sample address data; Performing text conversion on the third sample address data to obtain fourth sample address data; Performing word segmentation processing on the fourth sample address data to obtain fifth sample address data; The fifth sample address data is enhanced based on a multi-operator fusion method to obtain preprocessed sample address data including the fifth sample address data and enhanced sample address data.
4. The user address text verification method according to claim 3, characterized in that: The performing word segmentation processing on the fourth sample address data to obtain the fifth sample address data includes: Obtaining a preset word list; the preset word list includes words of a preset text; Pre-segmenting the fourth sample address data according to the preset word list to obtain segmented address data; Matching the word segmentation address data with the preset word list, and using the word segmentation address data with the same vocabulary in the preset word list as the first word segmentation data; Performing secondary word segmentation on the word segmentation address data that does not have the same vocabulary in the preset word list to obtain second word segmentation data; Fifth sample address data is generated according to the first word segmentation data and the second word segmentation data.
5. The user address text verification method according to claim 3, characterized in that: The performing address pair matching based on the pre-processed sample address data includes at least one of the following: Determine a matching address pair for two address data with completely identical spatial positions in the preprocessed sample address data, and determine a non-matching address pair for two address data with non-completely identical spatial positions in the preprocessed sample address data; constructing a matching address pair and an unmatching address pair based on the fifth sample address data and the enhanced sample address data in the preprocessed sample address data; Probabilistic matching is performed based on the pre-processed sample address data to construct matching address pairs and unmatching address pairs.
6. The user address text verification method according to claim 2, characterized in that: The pre-training including primary and secondary tasks based on the training data to obtain an initial address verification model includes: Performing text replacement processing on the training data to obtain replacement data; Pre-training including primary and secondary tasks is performed according to the replacement data to obtain an initial address verification model.
7. The user address text verification method according to any one of claims 1 to 6, characterized in that: The primary and secondary tasks include a main task, a first task and a second task; wherein the main task is used to constrain whether the address pair matches; the first task is used to constrain the ratio of the minimum editing distance of the two address texts in the address pair to the average length of the two address texts; the second task is used to encode the semantic information of the address text itself.
8. A user address text verification device, characterized in that: include: The acquisition module is used to obtain the address text to be verified; An input module is used to input the address text to be verified into a target address verification model to obtain an address verification result output by the target address verification model; wherein the target address verification model is obtained by optimizing and training an initial address verification model through the second sample address data and its annotation information; the initial address verification model is obtained by pre-training including primary and secondary tasks based on the first sample address data; the annotation information of the second sample address data includes real addresses, false addresses, fuzzy addresses and heterogeneous addresses; An alarm module is used to issue a risk alarm based on the address verification result.
9. An electronic device comprising a processor and a memory storing a computer program, characterized in that: When the processor executes the computer program, the user address text verification method described in any one of claims 1 to 7 is implemented.
10. A storage medium, the storage medium being a computer-readable storage medium, comprising a computer program, characterized in that: When the computer program is executed by a processor, the user address text verification method described in any one of claims 1 to 7 is implemented.
Citation Information
Cited By
Address text processing method and device, equipment, medium and product
CN119476290A
