Method and system for automatically identifying mobile phone number
By establishing a global standard mobile phone number regular expression library and encrypting it in chat records, and combining the decision tree classification model to match mobile phone numbers, the problem of insufficient accuracy and data security of automatic identification of mobile phone numbers in the prior art is solved. It realizes efficient and secure identification and processing of mobile phone numbers.
Patent Information
- Application Number
- CN202411469382.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-21
- Publication Date
- 2025-02-11
AI Technical Summary
The existing methods of automatically identifying mobile phone numbers are insufficient in terms of accuracy and data security, and cannot fully cover the global mobile phone number format, and ignore the encryption processing of chat record content, which poses a risk of information leakage.
Establish a global standard mobile phone number regular expression library, covering mobile phone numbers in various formats and types around the world, and encrypted and protected when processing chat records. Through the combination of the decision tree classification model and the global standard mobile phone number regular expression library, efficient and accurate classification and matching of mobile phone numbers can be achieved.
It improves the breadth and accuracy of mobile phone number identification, ensures the security of user data during transmission and decryption, effectively maintains user privacy, and realizes fast, accurate and automatic identification of mobile phone numbers.
Smart Images

Figure CN119415561A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of communication technology and relates to information security technology, and specifically to a method and system for automatically identifying mobile phone numbers. Background Art
[0002] With the rapid development of communication technology, mobile phone numbers have become an indispensable tool for people's daily communication. Among them, automatic mobile phone number recognition technology, as a key technology, has been widely used in many fields, especially in modern customer service chat systems. For example, when customer service staff handle user inquiries, they often need to obtain the user's contact information for follow-up. Automatic mobile phone number recognition technology can quickly extract valid mobile phone numbers from chat records, reduce manual input and verification time, and significantly improve customer service work efficiency. In addition, automatic mobile phone number recognition can also enable the customer service system to automatically generate service tickets for users, or actively contact users through text messages, phone calls, etc., to provide a more convenient and personalized service experience.
[0003] However, existing automatic recognition methods are usually based on regular expression libraries for matching, but these libraries often only consider the mobile phone number formats of some countries and regions, and fail to fully cover global information, resulting in insufficient recognition results. At the same time, when processing user chat records, the customer service system must ensure data security and privacy protection. However, existing methods often ignore the encryption of chat record content, which poses a risk of information leakage. Once user data is illegally obtained or abused, it will cause serious losses to users and enterprises. Therefore, it is particularly important to develop an efficient and secure method for automatic mobile phone number recognition. Summary of the invention
[0004] The present invention aims to solve at least one of the technical problems existing in the prior art; to this end, the present invention proposes a method and system for automatically identifying mobile phone numbers, which are used to solve the technical problems of insufficient accuracy of automatic identification methods, insufficient data security and privacy protection in existing customer service chat systems.
[0005] To achieve the above object, the first aspect of the present invention provides a method and system for automatically identifying a mobile phone number, comprising:
[0006] S1, establishing a global standard mobile phone number regular expression library according to the standard mobile phone number formats of different countries or regions; wherein the global standard mobile phone number regular expression library is divided into a domestic number regular expression library and a foreign number regular expression library;
[0007] S2, obtaining and encrypting a number of chat record texts, transmitting the encrypted number of chat record texts to a decryption terminal for decryption, and obtaining a number of mobile phone number related character sequences according to the decrypted number of chat record texts;
[0008] S3, filtering non-numeric characters in character sequences related to a number of mobile phone numbers to obtain a list of a number of mobile phone numbers;
[0009] S4, using the global standard mobile phone number regular expression library to match a number of mobile phone number lists to obtain a number of mobile phone numbers;
[0010] S5, determining whether the plurality of mobile phone numbers are in the number database; if yes, obtaining the location and operator information of the plurality of mobile phone numbers from the number database; if no, initiating a query request to the operator through a secure API interface, obtaining the location and operator information of the plurality of mobile phone numbers, and updating the number database; wherein the number database is deployed on a local end or in the cloud;
[0011] It should be noted that some chat record texts are exported from the chat system and converted into txt text format, and the export and processing of chat records are permitted by the user.
[0012] By establishing a global standard mobile phone number regular expression library, the breadth and accuracy of mobile phone number recognition are improved; when processing chat record text, it is first encrypted and protected to ensure the security of user data during transmission and decryption, and effectively maintain user privacy; using string search algorithms and character filtering technology, mobile phone numbers are quickly extracted from decrypted chat records; by matching the global standard mobile phone number regular expression library, mobile phone numbers can be quickly identified, and when necessary, query requests can be initiated to operators through a secure API interface to obtain and update the mobile phone number's location and operator information.
[0013] Furthermore, the obtaining and encrypting of a plurality of chat record texts includes:
[0014] A1, setting a digital code sequence according to a preset period, and recording the position of each digital identifier in the digital code sequence, to obtain a plurality of digital identifiers and a plurality of code positions corresponding to each other; wherein the digital code sequence includes a plurality of unique digital identifiers, and adjacent digital identifiers are not continuous;
[0015] A2, obtaining and traversing a plurality of chat record texts, dividing characters in the current chat record text into a plurality of text segments according to a preset character length, and recording positions of the plurality of text segments in the current chat record text, to obtain a plurality of text segments and a plurality of segment positions corresponding to each other;
[0016] A3, one-to-one correspondence is made between the plurality of coding positions and the plurality of segment positions, and the digital identifiers corresponding to the coding positions are assigned to the text segments corresponding to the segment positions, thereby obtaining a plurality of text segments with digital identifiers;
[0017] A4, randomly shuffles the text fragments with digital identifiers to obtain a number of disordered text fragments, and completes the encryption of the current chat record text;
[0018] A5, marking the next chat record text as the current chat record text, repeating A2 to A5 until a number of chat record texts are traversed to obtain a number of encrypted chat record texts.
[0019] Furthermore, the encrypted chat record texts are transmitted to a decryption terminal for decryption, including:
[0020] B1, traverse the encrypted chat record texts, extract several text fragments and corresponding digital identifiers in the current chat record text;
[0021] B2, sorting the plurality of digital identifiers according to the order in the digital coding sequence, and recombining the plurality of text fragments according to the order of the plurality of digital identifiers to obtain a decrypted current chat record text;
[0022] B3, marking the next chat record text as the current chat record text, repeating B1 to B3 until all encrypted chat record texts are traversed to obtain decrypted chat record texts.
[0023] By regularly setting a unique and discontinuous digital coding sequence at a preset period, the characters in the chat record text are segmented and encoded, and the order of the segmented fragments is disrupted to ensure the high security of the encrypted data and increase the difficulty of cracking. After the preset period is reached, the above steps are performed again to further improve the security of the data.
[0024] Furthermore, the decrypted chat record texts are used to obtain a number of mobile phone number related character sequences, including:
[0025] S2-1, marking the contact prompt words and their corresponding English words as mobile phone number related words; wherein the contact prompt words include "mobile phone number", "telephone number", "number" and "contact information";
[0026] S2-2, obtaining the current chat text data from the decrypted chat record texts, and using a string search algorithm to determine whether the mobile phone number related words exist in the current chat text data; if yes, obtaining the starting index and ending index of the mobile phone number related words in the current chat record text, and jumping to S2-3; if no, deleting the current chat record text, marking the next chat record text as the current chat record text, and repeating S2-2;
[0027] S2-3, obtaining a number of characters before the start index and a number of characters after the end index, obtaining a mobile phone number related character sequence of the current chat record text, and removing non-mobile phone number related character sequences of the current chat record text;
[0028] S2-4, marking the next chat record text as the current chat record text, and repeating S2-2 to S2-3 until a number of chat record texts are traversed to obtain a number of mobile phone number related character sequences.
[0029] Furthermore, the character filtering of non-numeric characters in the character sequences related to the mobile phone numbers includes:
[0030] S3-1, traversing a number of characters in a number of mobile phone number-related character sequences, and obtaining a number of continuous digital segments in the current mobile phone number-related character sequence;
[0031] S3-2, determining whether the character lengths of the plurality of continuous digital segments are within the threshold range of the length of the mobile phone number; if yes, retaining the plurality of continuous digital segments to obtain a number list of the current mobile phone number; if no, ignoring the plurality of continuous digital segments; wherein ignoring is to remove the continuous digital segments from the character sequence related to the current mobile phone number;
[0032] S3-3, marking the next mobile phone number-related character sequence as the current mobile phone number-related character sequence, repeating S3-1 to S3-3 until a number of mobile phone number-related character sequences are traversed to obtain a number of mobile phone number lists.
[0033] Furthermore, the step of obtaining a plurality of continuous digital segments in a character sequence related to the current mobile phone number includes:
[0034] S3-11, set an indicator variable i, and use i to track the position of the current character in the character sequence related to the current mobile phone number; where i=0, 1, 2, ..., n, and n is a positive integer;
[0035] S3-12, compare whether i is less than the length of the character sequence related to the current mobile phone number; if yes, obtain the character currently pointed to by i, and jump to S3-13; if no, output the obtained number lists as several continuous number fragments to obtain several continuous number fragments;
[0036] S3-13, determine whether the character currently pointed to is a number or a preset character; if yes, append the character currently pointed to to the current number list, increase the value of i by 1, and jump to S3-12; if no, jump to S3-14; the preset characters are the separators in the mobile phone number, including: dash "-" and "_" and space;
[0037] S3-14, determine whether the current number list is empty; if yes, the value of i is increased by 1 and jump to S3-12; if no, the current number fragment is obtained and a new empty number list is created as the current number list.
[0038] Locating the approximate position of the mobile phone number in the chat record text through contact prompt words can help improve the efficiency of subsequent mobile phone number recognition; further processing the extracted mobile phone number-related character sequence by traversing the character sequence and identifying continuous digital fragments, and filtering out mobile phone number digital fragments that meet the length requirements, thereby eliminating interference from non-mobile phone numbers and improving the accuracy of extraction.
[0039] Furthermore, the global standard mobile phone number regular expression library is used to match several mobile phone number lists, including:
[0040] S4-1, using a decision tree classification model and the global standard mobile phone number regular expression to match a list of mobile phone numbers to obtain a number of completely matched numbers, a number of partially matched numbers, and a number of non-mobile phone numbers;
[0041] S4-2, using the Levenshtein distance algorithm to calculate the edit distance between the plurality of partially matched numbers and the global standard mobile phone number, and determining whether the edit distance is less than a preset distance threshold; if yes, marking the plurality of partially matched numbers as a plurality of normal mobile phone numbers; if no, marking the plurality of partially matched numbers as a plurality of non-mobile phone numbers;
[0042] S4-3, outputting the several completely matched numbers and the several normal mobile phone numbers as several mobile phone numbers to obtain several mobile phone numbers.
[0043] Furthermore, the use of the decision tree classification model and the global standard mobile phone number regular expression to match a plurality of mobile phone number lists includes:
[0044] S4-11, collecting mobile phone numbers of various formats and types around the world as a number data set, and performing data cleaning on the number data set to obtain a preprocessed number data set;
[0045] S4-12, converting the preprocessed mobile phone number into a feature vector, inputting the feature vector and the corresponding label into the constructed decision tree classification model for training, and obtaining a decision tree classification model whose input is the mobile phone number and output is the category of the mobile phone number; wherein the category of the mobile phone number includes domestic number, foreign number and non-mobile number;
[0046] S4-13, traversing a list of several mobile phone numbers and inputting them into the decision tree classification model to obtain several mobile phone number categories;
[0047] S4-14, determining whether the plurality of mobile phone number categories are non-mobile phone numbers; if yes, obtaining the plurality of non-mobile phone numbers; if no, extracting a regular expression library corresponding to the plurality of mobile phone number categories from the global standard mobile phone number regular expression, and matching the plurality of corresponding mobile phone number lists using the corresponding regular expression library to obtain a plurality of fully matched numbers and a plurality of partially matched numbers;
[0048] It should be noted that the mobile phone number category is a domestic number corresponding to the domestic number regular expression library, and the mobile phone number category is a foreign number corresponding to the foreign number regular expression library.
[0049] By combining the decision tree classification model with the global standard mobile phone number regular expression library, efficient and accurate classification and matching of mobile phone numbers is achieved. Among them, the decision tree classification model can initially screen out non-mobile phone numbers, reducing the complexity of subsequent matching work; the regular expression library ensures the accuracy of matching, and the Levenshtein distance algorithm further handles partial matching situations and improves the flexibility of recognition; the final output mobile phone number list contains fully matched numbers and verified normal mobile phone numbers, realizing accurate, fast and automatic recognition of mobile phone numbers.
[0050] A second aspect of the present invention provides a system for automatically identifying a mobile phone number, comprising:
[0051] Chat record processing module: used to obtain a number of chat record texts and perform encryption and decryption security processing to obtain a number of decrypted chat record texts;
[0052] Mobile phone number matching module: used to extract several mobile phone number lists from several decrypted chat record texts, and use the pre-built global standard mobile phone number regular expression library to match several mobile phone number lists to obtain several mobile phone numbers;
[0053] Information query module: used to call the number database or initiate a query request to the operator through a secure API interface to obtain the location and operator information of several mobile phone numbers and update it to the number database; the number database is deployed locally or in the cloud;
[0054] Mobile phone number storage module: used to encrypt the plurality of mobile phone numbers and the corresponding locations and operator information and store them in a pre-built user database.
[0055] Compared with the prior art, the present invention has the following beneficial effects:
[0056] By establishing a global standard mobile phone number regular expression library, it covers mobile phone numbers of various formats and types around the world, improving the breadth and accuracy of mobile phone number recognition; when processing chat record text, strict encryption protection is performed to ensure the security of user data during transmission and decryption, and effectively maintain user privacy; through the combination of the decision tree classification model and the global standard mobile phone number regular expression library, efficient and accurate classification and matching of mobile phone numbers are achieved, which can quickly identify mobile phone numbers and reduce interference from non-mobile phone numbers; query requests are initiated to operators through local or cloud number databases, or secure API interfaces, to obtain and update the mobile phone number's location and operator information, thereby ensuring the timeliness and accuracy of the number information. BRIEF DESCRIPTION OF THE DRAWINGS
[0057] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0058] Figure 1 A flowchart of a method for automatically identifying a mobile phone number provided by the present invention;
[0059] Figure 2 A schematic diagram of the process of obtaining a mobile phone number list provided by the present invention;
[0060] Figure 3 A schematic diagram of a process for obtaining continuous digital segments in a character sequence related to a mobile phone number provided by the present invention;
[0061] Figure 4 A schematic diagram of the framework of a system for automatically identifying mobile phone numbers provided by the present invention. DETAILED DESCRIPTION
[0062] The technical solution of the present invention will be clearly and completely described below in conjunction with the embodiments. Obviously, the described embodiments are only part of the embodiments of the present invention, rather than all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0063] See also Figure 1-Figure 3 The first aspect of the present invention provides a method and system for automatically identifying a mobile phone number, including:
[0064] S1, establishing a global standard mobile phone number regular expression library according to the standard mobile phone number formats of different countries or regions; wherein the global standard mobile phone number regular expression library is divided into a domestic number regular expression library and a foreign number regular expression library;
[0065] S2, obtaining and encrypting a number of chat record texts, transmitting the encrypted number of chat record texts to a decryption terminal for decryption, and obtaining a number of mobile phone number related character sequences according to the decrypted number of chat record texts;
[0066] S3, filtering non-numeric characters in character sequences related to a number of mobile phone numbers to obtain a list of a number of mobile phone numbers;
[0067] S4, using a global standard mobile phone number regular expression library to match a number of mobile phone number lists to obtain a number of mobile phone numbers;
[0068] S5, determine whether several mobile phone numbers are in the number database; if yes, obtain the location and operator information of several mobile phone numbers from the number database; if not, initiate a query request to the operator through a secure API interface to obtain the location and operator information of several mobile phone numbers, and update it to the number database; wherein the number database is deployed locally or in the cloud.
[0069] In a modern customer service system, customers may come from all over the world. In order to ensure that the contact information they provide can be accurately and efficiently identified and processed, it is crucial to establish a global mobile phone number regular expression library. In this embodiment, it is first necessary to collect mobile phone number format information from countries and regions around the world from the communications administration bureaus or professional forums, blogs, etc. of various countries and regions, including the length, prefix, separator, etc. of the number; then, based on the collected information, define a regular expression template for each mobile phone number format. Taking the mobile phone numbers of China, the United States, India, and the United Kingdom as examples, the corresponding regular expressions obtained are:
[0070] {"CN":"^(\+?0?86\-?)?1[3-9]\\d{9}$", / / China
[0071] "US":"^(\\+?1\\s?)?\\(?\\d{3}\\)?[-.\\s]?\\d{3}[-.\\s]?\\d{4}$", / / United States
[0072] "IN":"^(\\+?91|0)?[7-9]\\d{9}$", / / India
[0073] "GB":"^(\\+?44|0)7\\d{9}$", / / United Kingdom}
[0074] Since the domestic customer service system mainly serves Chinese people, the global mobile phone number regular expression is divided into a domestic number regular expression library and a foreign number regular expression library. This will make the subsequent matching process faster and more convenient.
[0075] Chat records often contain a large amount of personal information, such as mobile phone numbers, addresses, private conversations, etc. Once this information is leaked, it may pose a serious threat to the user's privacy. Through encryption processing, it can be ensured that even if the data is intercepted during transmission, the content cannot be directly read, thereby effectively protecting the privacy of the user. In this embodiment, the chat record text is encrypted by splitting the chat record text and sending it in random order;
[0076] Specifically, we first need to determine a preset cycle for regularly setting and changing the digital coding sequence. The digital coding series consists of a number of unique digital identifiers, and the adjacent digital identifiers are discontinuous numbers, which are stored in the form of list-elements on the encryption and decryption ends, which is equivalent to a string of passwords, used to encrypt the subsequent chat record text;
[0077] Next, after obtaining several chat record texts, each chat record text is segmented according to the preset character length to obtain several text fragments. The position of each fragment in the chat record text is recorded, and then the digital identifier in the digital coding sequence of the corresponding position is assigned to the text fragment, which is equivalent to resetting an ID for the text fragment to determine its correct order according to the digital coding sequence; finally, the text fragments carrying the digital identifiers are shuffled and transmitted to the decryption end in a random order; it is worth noting that the digital identifiers in the digital coding sequence should be as many as possible, and their number should be greater than the number of text fragments in each chat record text; at the same time, it should be noted that
[0078] Here is an example of encrypting a chat record text: Assume that the content of an existing chat record text is: {"This is an example of a chat record text. Now I want to encrypt it to achieve encryption of the chat content"}, set the digital coding sequence with one week as a cycle, and obtain the digital coding sequence of the current week as {5,8,12,4,6,3,21,34,2,7,9,1,44,31}, and segment the chat record text with a preset character length of 6 to obtain: {["This is a chat"], ["Record text example"], ["Now I want to encrypt"], ["To achieve"], ["Encryption of the chat content"], ["Encryption***"]}, where the number of characters in the last text segment is less than the preset character length, and a substitute symbol can be used to supplement its number of characters to the preset character length; for example, the substitute symbol in this implementation is "*";
[0079] Then, the digital identifiers in the digital coding sequence are assigned to the text fragments one by one, and the text fragments with identifiers are obtained as follows: {[5: "This is a chat"], [8: "Record text example"], [12: "Now I want to"], [4: "It is encrypted"], [6: "Processing, in order to achieve"], [3: "Encryption of chat content"], [21: "Encryption***"]};
[0080] Then the order of the text fragments with digital identifiers is scrambled, and the following may be obtained: {[6: "processing, in order to achieve"], [8: "record text example"], [4: "encrypting"], [21: "encryption"], [5: "this is a chat"], [12: "now I want to"], [3: "encryption of chat content"]}, and the encrypted chat record text is obtained; the text is then transmitted to the decryption end to prevent the leakage of customer personal data;
[0081] After receiving the encrypted chat record texts, the decryption end uses the digital coding sequence to decrypt them. Specifically, it first traverses the encrypted chat record texts, extracts the text fragments and the corresponding digital identifiers in the chat record texts; then sorts the digital identifiers according to the order in the digital coding sequence to obtain the sorted text fragments, and then recombines them to obtain the decrypted chat record text;
[0082] Taking the encrypted chat record text and digital code sequence obtained above as an example, the current encrypted chat record text content is: {[6: "processing, to achieve"], [8: "record text example"], [4: "encrypt it"], [21: "encryption processing ***"], [5: "this is a chat"], [12: "now I want to"], [3: "addition of chat content"]}, obtain the identifier of each text fragment, and then rearrange the text fragments according to the position of the corresponding identifier in the digital code sequence. Sequence, get: {[5: "This is a chat"], [8: "Record text example"], [12: ", now I want to"], [4: "It is encrypted"], [6: "process, to achieve"], [3: "Encryption of chat content"], [21: "Encryption***"]}; finally remove the digital identifier and combine several text fragments to get the original chat record text: {"This is a chat record text example, now I want to encrypt it to achieve encryption of chat content"}.
[0083] By splitting the chat record text and sending it in random order, combined with encryption using a dynamically changing digital coding sequence, not only is the content of the chat record hidden, but the difficulty of data cracking is further increased by disrupting the order of text fragments and attaching digital identifiers, ensuring the high security of the chat records during transmission and storage.
[0084] In order to quickly identify mobile phone numbers, a quick positioning method is added to the processing of decrypted chat record text. In the customer service chat system, if the customer service needs the customer's mobile phone number for a follow-up visit, they will ask questions like "Please leave your contact information" or "What is your mobile phone number?" during the communication process with the customer. Therefore, by locating the position of the contact prompt word, the approximate position of the mobile phone number can be found among several characters in the chat text;
[0085] Specifically, words such as "mobile phone number", "telephone number", "number", "contact information" and their corresponding English words are marked as mobile phone number related words; then a string search algorithm is used to determine whether there are mobile phone number related words in the chat text; if yes, the starting index and ending index of the mobile phone number related words in the chat record text are obtained, and then a number of characters before the starting index and a number of characters after the ending index are obtained to obtain a mobile phone number related character sequence, and characters in the chat record text that are not mobile phone number related character sequences are removed to protect the user's privacy; if no, the chat record text is deleted;
[0086] The mobile phone number related character sequence obtained through the above processing contains both part of the text content and the possible mobile phone number; therefore, the mobile phone number related character sequence needs to be further processed to extract only the numeric part therein to determine whether the numeric part is a mobile phone number;
[0087] In this embodiment, firstly, several continuous digital segments in the character sequence related to the mobile phone number are obtained by traversal, and the digital segments whose number of characters is not within the threshold range of the mobile phone number length are eliminated, that is, the number of digits contained in the digital segment is less than the number of digits of the world's shortest mobile phone number or greater than the number of digits of the world's longest mobile phone number, and it can be directly determined as a non-mobile phone number. In the process of obtaining the digital segment, the indicator variable i is set to track the characters in the character sequence related to the mobile phone number, and the continuous digital segments are obtained. When it is recognized that the number is followed by other symbols, if the symbol belongs to the preset character, it is added to the digital segment, that is, the form of "138-1234-5678" or "13712345678" is also retained as a digital segment; in this embodiment, the preset characters include hyphens "-" and "_" and spaces, etc.;
[0088] Finally, the extracted digital fragments are marked as a mobile phone number list, that is, all possible mobile phone numbers that appear in a chat conversation are saved in a mobile phone number list.
[0089] After obtaining the mobile phone number list, the global standard mobile phone number regular expression library can be used to match the mobile phone number list to determine whether several digital segments in the mobile phone number list are correct mobile phone numbers;
[0090] In order to avoid the problem of slow processing speed caused by the complexity of the regular expression library when directly matching all numbers, a method combining a decision tree classification model to classify the digital fragments in the mobile phone number list is adopted to pre-process the mobile phone number categories.
[0091] First, we need to build a decision tree model for mobile phone number classification:
[0092] Step 1: Collect mobile phone numbers of various formats and types from around the world as a number dataset, and perform data cleaning on the number dataset to obtain a preprocessed number dataset;
[0093] Step 2: Convert the preprocessed mobile phone number into a feature vector, input the feature vector and the corresponding label into the constructed decision tree classification model for training, and obtain a decision tree classification model whose input is the mobile phone number and output is the category of the mobile phone number; wherein the categories of mobile phone numbers include domestic numbers, foreign numbers, and non-mobile phone numbers;
[0094] Then, a list of several mobile phone numbers is input into the decision tree model for classification, and several mobile phone numbers classified as domestic numbers and foreign numbers are retained; then, several domestic numbers are matched with a domestic number regular expression library, and foreign numbers are matched with a foreign number regular expression library to obtain matching results;
[0095] The matching results include complete matches and partial matches. To ensure that no mobile phone number is missed, for partially matched numbers, such as "86-13712345678", the Levenshtein distance algorithm is continued to be used to calculate the edit distance between the partially matched number and the global standard mobile phone number to determine whether the edit distance is less than a preset distance threshold. If yes, the partially matched number is marked as a number of normal mobile phone numbers; if no, the partially matched number is marked as a non-mobile phone number.
[0096] Finally, the completely matched numbers and normal mobile phone numbers are output to obtain several mobile phone numbers.
[0097] After obtaining the mobile phone number, the user's location and operator information can be queried from the pre-established number database; if the number database does not contain a certain mobile phone number, a query request is initiated to the operator through a secure API interface to obtain the location and operator information of the mobile phone number, and update it to the number database to facilitate subsequent queries and follow-ups.
[0098] Part of the data in the above formula is calculated by removing the dimension and taking its numerical value. The formula is a formula closest to the actual situation obtained by software simulation of a large amount of collected data; the preset parameters and preset thresholds in the formula are set by technical personnel in this field according to actual conditions or obtained through simulation of a large amount of data.
[0099] See also Figure 4 The second aspect of the present invention provides a system for automatically identifying a mobile phone number, comprising:
[0100] Chat record processing module: used to obtain a number of chat record texts and perform encryption and decryption security processing to obtain a number of decrypted chat record texts;
[0101] Mobile phone number matching module: used to extract several mobile phone number lists from several decrypted chat record texts, and use the pre-built global standard mobile phone number regular expression library to match several mobile phone number lists to obtain several mobile phone numbers;
[0102] Information query module: used to call the number database or initiate a query request to the operator through a secure API interface to obtain the location and operator information of several mobile phone numbers and update it to the number database; the number database is deployed locally or in the cloud;
[0103] Mobile phone number storage module: used to encrypt the mobile phone numbers and the corresponding location and operator information and store them in a pre-built user database;
[0104] Among them, the chat record processing module, the mobile phone number matching module, the information query module and the mobile phone number storage module are in communication connection.
[0105] Working principle of the present invention:
[0106] First, according to the standard mobile phone number formats of different countries or regions, a global standard mobile phone number regular expression library is established. The library is divided into a domestic number regular expression library and a foreign number regular expression library. Then, several chat record texts are obtained and encrypted. By splitting the text and sending it in random order, combined with dynamically changing digital coding sequences, the security of the transmission process is ensured. After the encrypted text is received at the decryption end, the decryption operation is performed to restore the original chat record;
[0107] Then, by locating the position of the contact prompt word, the approximate position of the mobile phone number is found in the chat text, and the character sequence related to the mobile phone number is extracted, and the character filtering operation is performed to retain only the digital part to obtain a mobile phone number list;
[0108] Next, the global standard mobile phone number regular expression library is used to match the mobile phone number list to determine whether the digital fragments in it are correct mobile phone numbers. In order to improve the matching speed, the decision tree classification model is combined to pre-process and classify the digital fragments in the mobile phone number list;
[0109] Finally, for the matched mobile phone number, its location and operator information are queried from the number database. If the number database does not contain the mobile phone number, a query request is initiated to the operator through a secure API interface and updated to the number database.
[0110] The above embodiments are only used to illustrate the technical method of the present invention rather than to limit it. Although the present invention has been described in detail with reference to the preferred embodiments, those skilled in the art should understand that the technical method of the present invention may be modified or replaced by equivalents without departing from the spirit and scope of the technical method of the present invention.
Claims
1. A method for automatically identifying a mobile phone number, characterized in that: include: S1, establishing a global standard mobile phone number regular expression library according to the standard mobile phone number formats of different countries or regions; wherein the global standard mobile phone number regular expression library is divided into a domestic number regular expression library and a foreign number regular expression library; S2, obtaining and encrypting a number of chat record texts, transmitting the encrypted number of chat record texts to a decryption terminal for decryption, and obtaining a number of mobile phone number related character sequences according to the decrypted number of chat record texts; S3, filtering non-numeric characters in character sequences related to a number of mobile phone numbers to obtain a list of a number of mobile phone numbers; S4, using the global standard mobile phone number regular expression library to match a number of mobile phone number lists to obtain a number of mobile phone numbers; S5, determine whether several mobile phone numbers are in the number database; if yes, obtain the location and operator information of several mobile phone numbers from the number database; if not, initiate a query request to the operator through a secure API interface, obtain the location and operator information of several mobile phone numbers, and update it to the number database; wherein the number database is deployed locally or in the cloud.
2. A method for automatically identifying a mobile phone number according to claim 1, characterized in that: The obtaining and encrypting of a plurality of chat record texts includes: A1, setting a digital code sequence according to a preset period, and recording the position of each digital identifier in the digital code sequence, to obtain a plurality of digital identifiers and a plurality of code positions corresponding to each other; wherein the digital code sequence includes a plurality of unique digital identifiers, and adjacent digital identifiers are not continuous; A2, obtaining and traversing a plurality of chat record texts, dividing characters in the current chat record text into a plurality of text segments according to a preset character length, and recording positions of the plurality of text segments in the current chat record text, to obtain a plurality of text segments and a plurality of segment positions corresponding to each other; A3, one-to-one correspondence is made between the plurality of coding positions and the plurality of segment positions, and the digital identifiers corresponding to the coding positions are assigned to the text segments corresponding to the segment positions, thereby obtaining a plurality of text segments with digital identifiers; A4, randomly shuffles the text fragments with digital identifiers to obtain a number of disordered text fragments, and completes the encryption of the current chat record text; A5, marking the next chat record text as the current chat record text, repeating A2 to A5 until a number of chat record texts are traversed to obtain a number of encrypted chat record texts.
3. The method for automatically identifying a mobile phone number according to claim 1, characterized in that: The step of transmitting the encrypted chat record texts to the decryption terminal for decryption includes: B1, traverse the encrypted chat record texts, extract several text fragments and corresponding digital identifiers in the current chat record text; B2, sorting the plurality of digital identifiers according to the order in the digital coding sequence, and recombining the plurality of text fragments according to the order of the plurality of digital identifiers to obtain a decrypted current chat record text; B3, marking the next chat record text as the current chat record text, repeating B1 to B3 until all encrypted chat record texts are traversed to obtain decrypted chat record texts.
4. The method for automatically identifying a mobile phone number according to claim 1, characterized in that: The method of obtaining a plurality of mobile phone number related character sequences according to the decrypted plurality of chat record texts includes: S2-1, marking the contact prompt words and their corresponding English words as mobile phone number related words; wherein the contact prompt words include "mobile phone number", "telephone number", "number", and "contact information"; S2-2, obtaining the current chat text data from the decrypted chat record texts, and using a string search algorithm to determine whether the mobile phone number related words exist in the current chat text data; if yes, obtaining the starting index and ending index of the mobile phone number related words in the current chat record text, and jumping to S2-3; if no, deleting the current chat record text, marking the next chat record text as the current chat record text, and repeating S2-2; S2-3, obtaining a number of characters before the start index and a number of characters after the end index, obtaining a mobile phone number related character sequence of the current chat record text, and removing non-mobile phone number related character sequences of the current chat record text; S2-4, marking the next chat record text as the current chat record text, and repeating S2-2 to S2-3 until a number of chat record texts are traversed to obtain a number of mobile phone number related character sequences.
5. The method for automatically identifying a mobile phone number according to claim 1, characterized in that: The character filtering of non-numeric characters in character sequences related to a number of mobile phone numbers includes: S3-1, traversing a number of characters in a number of mobile phone number-related character sequences, and obtaining a number of continuous digital segments in the current mobile phone number-related character sequence; S3-2, determining whether the character lengths of the plurality of continuous digital segments are within the threshold range of the length of the mobile phone number; if yes, retaining the plurality of continuous digital segments to obtain a number list of the current mobile phone number; if no, ignoring the plurality of continuous digital segments; wherein ignoring is to remove the continuous digital segments from the character sequence related to the current mobile phone number; S3-3, marking the next mobile phone number-related character sequence as the current mobile phone number-related character sequence, repeating S3-1 to S3-3 until a number of mobile phone number-related character sequences are traversed to obtain a number of mobile phone number lists.
6. A method for automatically identifying a mobile phone number according to claim 5, characterized in that: The step of obtaining a plurality of continuous digital segments in a character sequence related to the current mobile phone number includes: S3-11, set an indicator variable i, and use i to track the position of the current character in the character sequence related to the current mobile phone number; where i=0, 1, 2, ..., n, and n is a positive integer; S3-12, compare whether i is less than the length of the character sequence related to the current mobile phone number; if yes, obtain the character currently pointed to by i, and jump to S3-13; if no, output the obtained number lists as several continuous number fragments to obtain several continuous number fragments; S3-13, determine whether the character currently pointed to is a number or a preset character; if yes, append the character currently pointed to to the current number list, increase the value of i by 1, and jump to S3-12; if no, jump to S3-14; the preset characters are the separators in the mobile phone number, including: hyphen "-" and "_" and space; S3-14, determine whether the current number list is empty; if yes, the value of i is increased by 1 and jump to S3-12; if no, the current number fragment is obtained and a new empty number list is created as the current number list.
7. The method for automatically identifying a mobile phone number according to claim 1, characterized in that: The global standard mobile phone number regular expression library is used to match several mobile phone number lists, including: S4-1, using a decision tree classification model and the global standard mobile phone number regular expression to match a list of mobile phone numbers to obtain a number of completely matched numbers, a number of partially matched numbers, and a number of non-mobile phone numbers; S4-2, using the Levenshtein distance algorithm to calculate the edit distance between the plurality of partially matched numbers and the global standard mobile phone number, and determining whether the edit distance is less than a preset distance threshold; if yes, marking the plurality of partially matched numbers as a plurality of normal mobile phone numbers; if no, marking the plurality of partially matched numbers as a plurality of non-mobile phone numbers; S4-3, outputting the several completely matched numbers and the several normal mobile phone numbers as several mobile phone numbers to obtain several mobile phone numbers.
8. A method for automatically identifying a mobile phone number according to claim 7, characterized in that: The use of the decision tree classification model and the global standard mobile phone number regular expression to match a plurality of mobile phone number lists includes: S4-11, collecting mobile phone numbers of various formats and types around the world as a number data set, and performing data cleaning on the number data set to obtain a preprocessed number data set; S4-12, converting the preprocessed mobile phone number into a feature vector, inputting the feature vector and the corresponding label into the constructed decision tree classification model for training, and obtaining a decision tree classification model whose input is the mobile phone number and output is the category of the mobile phone number; wherein the category of the mobile phone number includes domestic number, foreign number and non-mobile number; S4-13, traversing a list of several mobile phone numbers and inputting them into the decision tree classification model to obtain several mobile phone number categories; S4-14, determine whether several mobile phone number categories are non-mobile phone numbers; if yes, obtain several non-mobile phone numbers; if not, extract a regular expression library corresponding to several mobile phone number categories from the global standard mobile phone number regular expression, and use the corresponding regular expression library to match the corresponding several mobile phone number lists to obtain several fully matched numbers and several partially matched numbers.
9. A system for automatically identifying mobile phone numbers, characterized in that: include: Chat record processing module: used to obtain a number of chat record texts and perform encryption and decryption security processing to obtain a number of decrypted chat record texts; Mobile phone number matching module: used to extract several mobile phone number lists from several decrypted chat record texts, and use the pre-built global standard mobile phone number regular expression library to match several mobile phone number lists to obtain several mobile phone numbers; Information query module: used to call the number database or initiate a query request to the operator through a secure API interface to obtain the location and operator information of several mobile phone numbers and update it to the number database; the number database is deployed locally or in the cloud; Mobile phone number storage module: used to encrypt the multiple mobile phone numbers and the corresponding locations and operator information and store them in a pre-built user database.