Smart phone book searching method based on TF-IDF pinyin vector model

By using the TF-IDF pinyin vector model, combined with the cosine similarity and edit distance algorithms, the problems of low efficiency, poor accuracy and large storage space in phone book searches in embedded communication devices are solved, and efficient and accurate contact searches are achieved.

CN120743976AActive Publication Date: 2025-10-03BEIJING FANGWEI ZHILIAN TECHNOLOGY CO LTD
View PDF 4 Cites 0 Cited by

Patent Information

Application Number
CN202510807232.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-06-17
Publication Date
2025-10-03
Estimated Expiration
2045-06-17

AI Technical Summary

Technical Problem

The existing phone book search methods in embedded communication devices have problems such as weak semantic understanding ability, low computational efficiency, large memory usage and limited fuzzy matching ability, which makes it difficult to meet real-time search needs.

Method used

A TF-IDF-based pinyin vector model is used to establish a character index table through pinyin conversion, calculate the IDF value and TF-IDF vector of the character, and combine the cosine similarity and edit distance algorithms to achieve efficient and accurate fuzzy search.

Benefits of technology

It improves search accuracy, reduces storage space requirements, and lowers computing resource consumption, enabling efficient and accurate contact searches on resource-constrained embedded devices.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120743976A_ABST
    Figure CN120743976A_ABST
Patent Text Reader

Abstract

The invention discloses a smart phone book searching method based on a TF-IDF pinyin vector model, and belongs to the field of communication. The method specifically comprises the following steps: firstly, performing pinyin conversion on a contact name of communication equipment to obtain a character string, and calculating an IDF value of each character; calculating a word frequency TF value of each character, further obtaining a TF-IDF value, and carrying out normalization processing; the method comprises the following steps: when a user inputs information of a contact person M to be queried, after a normalized TF-IDF vector is obtained, calculating a cosine similarity between the TF-IDF vector of the contact person M and the stored TF-IDF vector of each contact person; traversing each stored contact person, respectively calculating the contact person M and the standardized editing distance between the name, Chinese name and pinyin of each contact person, and selecting the maximum value as the final editing distance similarity; constructing a contact person M and a similarity score of each contact person through cosine similarity and final editing distance similarity weighting; sorting in a descending order; and screening out the first K search results and displaying the search results to the user. According to the method, the search precision is remarkably improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention belongs to the field of communications, and in particular relates to an intelligent phone book search method based on a TF-IDF phonetic vector model. Background Art

[0002] With the development of communication technology, embedded communication devices such as IP phones and conference phones are widely used by enterprises and individuals. These devices usually need to store a large amount of contact information. However, users often need to quickly find specific contacts during daily use. The large amount of information slows down the user's search speed.

[0003] Currently, the common phone book search methods in embedded phone products are:

[0004] 1. Prefix matching method: Only matches contacts that begin with the characters entered by the user. For example, if you enter "li", it will only match "li" instead of "lixiaoming". This method has a limited matching range.

[0005] 2. Substring matching method: Searches for a substring containing the user input in the contact name or pinyin. Although this method increases the matching range, it cannot distinguish the importance of the match and has low computational efficiency.

[0006] 3. Edit distance method: This method evaluates similarity by calculating the edit distance (such as Levenshtein distance) between the user input and the contact. Although this method can tolerate spelling errors, it does not consider the importance of characters and has high computational overhead for long strings.

[0007] The above methods have the following common problems:

[0008] 1) Weak semantic understanding ability: Unable to recognize the importance of different characters, for example, rare characters should contribute more to matching than common characters.

[0009] 2) Low computing efficiency: Especially when there are a large number of contacts, the response speed is slow and it is difficult to meet real-time search needs.

[0010] 3) Large memory usage: Especially for resource-constrained embedded devices, it is difficult to achieve efficient storage.

[0011] 4) Limited fuzzy matching capabilities: It is difficult to handle user input errors or partial matches, which reduces the user experience.

[0012] With the development of artificial intelligence technology, vectorization methods in natural language processing have provided new solutions to these problems. However, traditional word embedding models (such as Word2Vec and BERT) require extensive corpus training, resulting in high computational complexity and difficulty in implementation on resource-constrained embedded devices.

[0013] Therefore, a method for searching a smart phone directory with high computational efficiency, compact storage and accurate search is needed. Summary of the Invention

[0014] The present invention provides an intelligent phone book search method based on the TF-IDF pinyin vector model, aiming to solve the problems of low phone book search efficiency, poor accuracy, large memory usage and difficulty in adapting to fuzzy search requirements in the existing technology. It is suitable for embedded communication devices with limited processing power and storage space, and can achieve efficient and accurate contact search functions with minimal system resource consumption.

[0015] The specific steps of the smart phone book search method based on the TF-IDF phonetic vector model are as follows:

[0016] Step 1: Save the contact information of an embedded communication device to a phone book CSV file;

[0017] The phone book CSV file includes information such as the name, department, email address, and landline number of all contacts.

[0018] Step 2: Convert the contact names in the phonebook CSV file to pinyin, obtain the pinyin strings, and build a character index table; at the same time, calculate the IDF value of each character to form an IDF matrix;

[0019] Specifically: first, convert the names of all contacts in the phone book into pinyin to obtain a pinyin string;

[0020] Then, a character-level index table is built to assign an index position to each unique pinyin character.

[0021] Pinyin uses 26 English letters, so the index table size is 26, and each letter corresponds to an index position: 'a' corresponds to index 0, 'b' corresponds to index 1, and so on, 'z' corresponds to index 25.

[0022] Next, count the occurrence frequency of each character in the corpus in all contact pinyin documents and calculate the IDF value of each character:

[0023] IDF(*) = log(m / (n+1))+1

[0024] * represents any of the 26 characters from a to z, m represents the total number of contacts, and n represents the number of contacts containing the character *.

[0025] Step 3: Perform word frequency statistics on the pinyin string of each contact to obtain the word frequency TF value of each character, calculate the TF-IDF value based on the IDF value of each character, and perform normalization to obtain the TF-IDF vector of each contact;

[0026] First, for each contact's pinyin string, count the number of times each character appears and divide it by the total number of characters in the pinyin string to get the word frequency (TF) value of the character:

[0027] TF(*) = t(*) / Z;

[0028] t(*) indicates the number of times the character * appears, and Z indicates the total number of pinyin characters;

[0029] Then, calculate the TF-IDF value of each character: TF-IDF(*) = TF(*) × IDF(*).

[0030] Next, construct the TF-IDF vector for each contact based on the character index table, and fill the positions where no characters appear with 0;

[0031] The TF-IDF vector consists of 26 elements, each of which is the TF-IDF value of each character or 0.

[0032] Finally, perform L2 normalization on the TF-IDF vector: divide each element of the vector by the Euclidean norm of the vector; the normalized vector is associated with the contact information and stored.

[0033] Step 4: Serialize and save the character index table, IDF value matrix, and TF-IDF vector of each contact in binary format;

[0034] Specifically, it includes: serializing and saving the character index table and IDF value matrix in binary format; and serializing and saving the TF-IDF vectors and contact information of all contacts in binary format.

[0035] Step 5: When the user enters the contact M information to be queried, the name is converted to pinyin and the TF-IDF vector of contact M is calculated according to the above steps;

[0036] Step 6: Calculate the cosine similarity between the TF-IDF vector of contact M and the TF-IDF vectors of each saved contact;

[0037] Cosine similarity calculation: Similarity = query TF-IDF vector · contact TF-IDF vector;

[0038] Step 7: For the saved current contact N, calculate the standardized edit distance between the Chinese name and the pinyin of the contacts M and N respectively, and select the maximum value as the final edit distance similarity of contacts M and N;

[0039] Normalized Chinese edit distance: Normalized Chinese edit distance = 1 – d1 / L1;

[0040] d1 is the Chinese edit distance, which refers to the difference in the number of characters between the two Chinese names of contacts M and N;

[0041] L1 is the length of the longer Chinese name of the two contacts M and N;

[0042] Normalized phonetic edit distance: Normalized phonetic edit distance = 1 – d2 / L2;

[0043] d2 is the pinyin edit distance, which refers to the difference in the number of characters between the pinyin of the two names of contacts M and N;

[0044] L2 is the longer pinyin length of the two contacts M and N.

[0045] Step 8: Construct the similarity score of contacts M and N by weighting the cosine similarity and the final edit distance similarity;

[0046] The cosine similarity and edit distance are combined to form the final similarity score:

[0047] Final similarity = α × cosine similarity + (1-α) × normalized edit distance,

[0048] Where α is the weight coefficient, and its value range is [0,1];

[0049] Step 9: Return to step 7, traverse each saved contact one by one, calculate the similarity score between contact M and each contact, sort each contact in descending order according to the similarity score; and filter out all contacts with similarity higher than a preset threshold as search results.

[0050] Step 10: Display the search results to the user, allowing the user to select a contact and provide detailed information viewing and call functions;

[0051] The advantages of the present invention are:

[0052] 1. A smart phone book search method based on the TF-IDF pinyin vector model. This method vectorizes contact pinyin information and combines it with the edit distance algorithm to achieve efficient and accurate fuzzy search. This method significantly improves search accuracy, greatly increasing the probability of target contacts appearing in the top positions. It also achieves efficient computing performance and short search response time, which is faster than traditional methods.

[0053] 2. A smart phone book search method based on the TF-IDF pinyin vector model uses sparse vector storage and binary serialization technology to significantly reduce storage space requirements, saving a lot of storage space compared to traditional indexing methods.

[0054] 3. A smart phone book search method based on the TF-IDF pinyin vector model automatically understands the importance of characters through IDF values, without the need for manually defined weight rules, and can correctly handle most spelling errors.

[0055] 4. A smart phone book search method based on the TF-IDF pinyin vector model. This method does not require external corpus training and builds the model based solely on the device's own contact data. It has better privacy, can work properly even in offline environments, has low resource consumption, and can still run efficiently on embedded devices with limited memory. BRIEF DESCRIPTION OF THE DRAWINGS

[0056] Figure 1 This is a flow chart of a method for searching an intelligent phonebook based on a TF-IDF phonetic vector model according to the present invention;

[0057] Figure 2 This is a flowchart of contact pinyin vectorization in an embodiment of the present invention;

[0058] Figure 3 is a flowchart of query processing and similarity calculation in an embodiment of the present invention;

[0059] Figure 4 This is a flow chart of the dual edit distance optimization effect according to an embodiment of the present invention. DETAILED DESCRIPTION

[0060] In order to facilitate those skilled in the art to understand and implement the present invention, the present invention is described in further detail and in depth with reference to the accompanying drawings.

[0061] The present invention discloses a smart phone book search method based on the TF-IDF pinyin vector model, which is suitable for embedded devices such as IP phones, conference phones and smart communication terminals that require efficient and accurate contact search. Specifically, the system converts the names of all contacts in the phone book into pinyin, establishes a character-level index table and calculates the IDF value; performs word frequency statistics on the pinyin string of each contact, obtains the word frequency TF value of each character, calculates the TF-IDF vector in combination with the IDF value and performs normalization processing; the character index table, IDF value matrix and contact vector are serialized and saved in binary format; when the user enters a query string, the system receives the input and converts it into pinyin, and uses the same method to calculate the TF-IDF vector of the query string; based on the vector, the cosine similarity and edit distance with each contact vector are calculated, and after comprehensive scoring, they are sorted by similarity, and the most relevant contacts are screened out and displayed to the user. The edit distance includes the edit distance between the Chinese name and the pinyin, and the maximum value is taken as the final edit distance similarity, thereby improving the search accuracy; the invention realizes efficient and accurate fuzzy search by vectorizing the contact pinyin information and combining the edit distance algorithm, thereby simplifying the steps for users to find contacts.

[0062] like Figure 1 The figure shows the complete process from contact data preprocessing to user query response; the specific steps are as follows:

[0063] Step 1: Save the contact information of an embedded communication device to a phone book CSV file;

[0064] The phone book CSV file includes information such as the name, department, email address, and landline number of all contacts.

[0065] Step 2: Convert the contact names in the phonebook CSV file to pinyin, obtain the pinyin strings, and build a character index table; at the same time, calculate the IDF value of each character to form an IDF matrix;

[0066] Specifically: first, convert the names of all contacts in the phone book into pinyin to obtain a pinyin string;

[0067] Then, a character-level index table is built to assign an index position to each unique pinyin character.

[0068] Pinyin only uses 26 English letters, so the index table size is 26, and each letter corresponds to an index position: 'a' corresponds to index 0, 'b' corresponds to index 1, and so on, 'z' corresponds to index 25.

[0069] Next, count the occurrence frequency of each character in the corpus in all contact pinyin documents and calculate the IDF value of each character:

[0070] IDF(*) = log(m / (n+1))+1

[0071] * represents any of the 26 characters from a to z, m represents the total number of contacts, and n represents the number of contacts containing the character *.

[0072] Step 3: Perform word frequency statistics on the pinyin string of each contact to obtain the word frequency TF value of each character, calculate the TF-IDF value based on the IDF value of each character, and perform normalization to obtain the TF-IDF vector of each contact;

[0073] First, for each contact's pinyin string, count the number of times each character appears and divide it by the total number of characters in the pinyin string to get the word frequency (TF) value of the character:

[0074] TF(*) = t(*) / Z;

[0075] t(*) indicates the number of times the character * appears, and Z indicates the total number of pinyin characters;

[0076] Then, calculate the TF-IDF value of each character: TF-IDF(*) = TF(*) × IDF(*).

[0077] Next, construct the TF-IDF vector for each contact based on the character index table, and fill the positions where no characters appear with 0;

[0078] The TF-IDF vector consists of 26 elements, each of which is the TF-IDF value of each character or 0.

[0079] Finally, perform L2 normalization on the TF-IDF vector: divide each element of the vector by the Euclidean norm of the vector; the normalized vector is associated with the contact information and stored.

[0080] Step 4: Serialize and save the character index table, IDF value matrix, and TF-IDF vector of each contact in binary format;

[0081] Specifically, it includes: serializing and saving the character index table and IDF value matrix in binary format; and serializing and saving the TF-IDF vectors and contact information of all contacts in binary format.

[0082] Step 5: When the user enters the contact M information to be queried, the name is converted to pinyin and the TF-IDF vector of contact M is calculated according to the above steps;

[0083] Step 6: Calculate the cosine similarity between the TF-IDF vector of contact M and the TF-IDF vectors of each saved contact;

[0084] Cosine similarity calculation: Similarity = query TF-IDF vector · contact TF-IDF vector;

[0085] Step 7: For the saved current contact N, calculate the standardized edit distance between the Chinese name and the pinyin of the contacts M and N respectively, and select the maximum value as the final edit distance similarity of contacts M and N;

[0086] The dual edit distance includes: calculating the edit distance of Chinese names and the edit distance of pinyin for the preliminary screening result set; taking the maximum of the two standardized edit distances as the final edit distance similarity;

[0087] Normalized Chinese edit distance: Normalized Chinese edit distance = 1 - Chinese edit distance / the longer Chinese name length in the contact;

[0088] Normalized phonetic edit distance: Normalized phonetic edit distance = 1 - phonetic edit distance / the longer phonetic length in the contact.

[0089] The Chinese edit distance refers to the difference in the number of characters between the two Chinese names of contacts M and N;

[0090] The pinyin edit distance refers to the difference in the number of characters between the two pinyin names of contacts M and N;

[0091] Step 8: Construct the similarity score of contacts M and N by weighting the cosine similarity and the final edit distance similarity;

[0092] The cosine similarity and edit distance are combined to form the final similarity score:

[0093] Final similarity = α × cosine similarity + (1-α) × normalized edit distance,

[0094] Where α is the weight coefficient, and its value range is [0,1];

[0095] Step 9: Return to step 7, traverse each saved contact one by one, calculate the similarity score between contact M and each contact, sort each contact in descending order according to the similarity score; and select the top K contacts with similarity higher than a preset threshold as the search results.

[0096] K is a manually set integer value based on actual needs. When the similarity scores of the two contacts are close, the contact with the higher edit distance similarity is prioritized based on the final edit distance similarity between contact M and the two saved contacts. When the similarity of the search results is less than the preset threshold, the contact with the higher edit distance similarity is selected and sorted higher.

[0097] Step 10: Display the search results to the user, allowing the user to select a contact and provide detailed information viewing and call functions;

[0098] 1) Results display;

[0099] Specifically, it includes: displaying search results to users in order of similarity; and supporting users to select contacts by pressing buttons or touching.

[0100] 2) User interaction;

[0101] Specifically including: providing contact details viewing and calling functions.

[0102] Example:

[0103] Step 1: Preprocess pinyin vectorization: count character frequencies, calculate IDF values, and build an index table to prepare for subsequent vectorization.

[0104] Parameter configuration includes: Phonebook CSV file, which is used to obtain information of all contacts. The specific configuration process can be exported through the device phonebook function.

[0105] 1) Pinyin conversion and index construction;

[0106] Specifically include: performing pinyin conversion on the names of all contacts in the phone book to obtain pinyin strings;

[0107] For example, the contact "Li Xiaoming" is converted to "lixiaoming", "Zhang San" is converted to "zhangsan", and "Wang Wu" is converted to "wangwu";

[0108] Establish a character-level index table and assign index positions to each unique pinyin character;

[0109] Considering that Chinese pinyin only uses 26 English letters, the size of the index table is 26, and each letter corresponds to an index position: 'a' corresponds to index 0, 'b' corresponds to index 1, and so on, 'z' corresponds to index 25.

[0110] 2) IDF value calculation and storage;

[0111] Specifically include: counting the document frequency of each character in all contacts' pinyin in the corpus;

[0112] For example, assume there are 1000 contacts in the system, the character 'l' appears in 300 contacts, and the character 'i' appears in 50 contacts; calculate the IDF value of each character: IDF(character) = log(total number of contacts / (number of contacts containing the character + 1)) + 1. For example, IDF('a') = log(1000 / (300 + 1)) + 1 ≈ 1.519, IDF('i') = log(1000 / (50 + 1)) + 1 ≈ 2.293;

[0113] Store the character index table and the IDF value matrix to form the basis of the TF-IDF model.

[0114] Step 2: Construct the TF-IDF vector of contacts. Perform word frequency statistics on the pinyin string of each contact, calculate the TF-IDF vector in combination with the IDF value, and perform normalization processing to form the feature representation of the contact;

[0115] The system performs character frequency statistics on the pinyin string of each contact, calculates the TF value, calculates the TF-IDF value in combination with the IDF value, constructs a vector and performs normalization processing. This process constructs a unique TF-IDF vector representation for each contact;

[0116] The main process of converting the contact name into a standardized TF-IDF vector is as Figure 2 shown;

[0117] 1). Word frequency statistics and TF-IDF calculation;

[0118] Specifically, for the pinyin string of each contact, count the frequency of each character appearance;

[0119] Taking the contact "Li Xiaoming (lixiaoming)" as an example, 'l' appears 1 time, 'i' appears 3 times, 'x' appears 1 time, 'a' appears 1 time, 'o' appears 1 time,'m' appears 1 time, 'n' appears 1 time, 'g' appears 1 time;

[0120] Calculate the TF value of each character: TF(character) = number of character appearances / total number of pinyin characters. For example, TF('a') = 1 / 10 ≈ 0.1, TF('i') = 3 / 10 ≈ 0.3; Combine with the IDF value in step one to calculate the TF-IDF value: TF-IDF(character) = TF(character) × IDF(character). For example, TF-IDF('a') = 0.1 * 1.519 ≈ 0.152, TF-IDF('i') = 0.3 * 2.293 ≈ 0.459;

[0121] 2). Vector construction and normalization;

[0122] Specifically, according to the character index table, construct the TF-IDF vector of the contact, and fill 0 at the positions where characters do not appear;

[0123] For example, the vector of "Li Xiaoming (lixiaoming)" is [0.152, 0,..., 0.459, 0.377, 0.310, 0.144, 0.149, 0,..., 0.255, 0,..., 0];

[0124] Perform L2 normalization on the TF-IDF vector: divide each element of the vector by the Euclidean norm of the vector. For example, the Euclidean norm of the "Li Xiaoming" vector is sqrt(0.152² + 0.459² + 0.377² + 0.310² + 0.144² + 0.149² + 0.255²) ≈ 0.7616, and the normalized vector is [0.20, 0,..., 0.603, 0.495, 0.407, 0.189, 0.196, 0,..., 0.335, 0,..., 0];

[0125] Associate and store the normalized vector with the contact information.

[0126] Step 3: Model Persistent Storage. Serialize and save the character index table, IDF value matrix, and contact vectors in binary format, and use a compact storage structure to reduce memory occupancy.

[0127] To improve the system startup speed and reduce runtime calculations, this method persists the preprocessing results. The vectorizer contains the character index table and IDF value matrix, which are stored in binary format. The contact vectors use the sparse representation method, only storing non-zero elements, significantly reducing the storage space occupancy.

[0128] 1). Data serialization;

[0129] Specifically, it includes: Serialize and save the character index table and IDF value matrix in binary format. When specifically implemented, a vectorizer data structure can be used, which contains the mapping from characters to indices and the IDF value array; Serialize and save the normalized TF-IDF vectors of all contacts and contact information in binary format.

[0130] 2). Optimize the storage structure;

[0131] Specifically, it includes: Design a compact storage structure to reduce memory occupancy, and use the sparse representation method to store non-zero elements. For example, the contact vectors can use a data structure that contains contact IDs, names, pinyin, and sparse vectors (index-value pairs); By only storing non-zero elements, the storage space occupancy is significantly reduced. When fully implemented, all data is serialized and saved in binary format to the Flash storage, and directly loaded into memory when the device starts, without recalculation.

[0132] Step 4: Vectorize User Queries. Receive the user input and convert it to pinyin, calculate the TF-IDF vector of the query string using the same method as for contacts, and normalize it.

[0133] When the user enters a query string, the system first performs preprocessing, then calculates the TF-IDF vector of the query string using the same method as for contacts, and performs normalization processing to ensure the same dimension as the contact vectors. The main process is as Figure 3 shown.

[0134] 1). Pinyin preprocessing; <​​​​​​Specifically, it includes: using the same method as in step two to calculate the TF-IDF vector of the query string. For the query "lixia", the character frequencies are counted as follows: 'l' appears 1 time, 'i' appears 2 times, 'x' appears 1 time, 'a' appears 1 time. Calculate the TF values: TF('l') = 1 / 5 = 0.2, TF('i') = 2 / 5 = 0.4, TF('x') = 1 / 5 = 0.2, TF('a') = 1 / 5 = 0.2;

[0138] Calculate the TF-IDF values: TF-IDF('l') = 0.2 * 1.519 ≈ 0.304, TF-IDF('i') = 0.4 * 1.301 ≈ 0.520, TF-IDF('x') = 0.2 * 1.699 ≈ 0.340, TF-IDF('a') = 0.2 * 1.398 ≈ 0.280;

[0139] Perform L2 normalization on the query vector to ensure the same dimension as the contact vector. For example, the normalization coefficient of "lixia" is sqrt(0.304² + 0.520² + 0.340² + 0.280²) ≈ 0.746, and the normalized vector is [0.375, 0,..., 0.697, 0.408, 0.456, 0,..., 0].

[0140] Step five: Similarity calculation. Calculate the cosine similarity between the query vector and the contact vector;

[0141] The system calculates the cosine similarity between the query vector and each contact vector.

[0142] 1). Similarity calculation;

[0143] Specifically, it includes: calculating the cosine similarity between the normalized query vector and each normalized contact vector; the cosine similarity calculation is simplified to the vector dot product: similarity = query vector · contact vector;

[0144] For example, calculate the cosine similarity between the query "Li Xia (lixia)" and the contact "Li Xiaoming (lixiaoming)":

[0145] dot_product = 0.375 * 0.20 + 0.697 * 0.603 + 0.408 * 0.189 + 0.456 * 0.335 + 0 * 0.495 + 0 * 0.407 + 0 * 0.196 = 0.075 + 0.420 + 0.077 + 0.153 + 0 + 0 + 0 ≈ 0.725;

[0146] Step 6: Double optimization of similarity and edit distance. Calculate the edit distance of both the Chinese name and the pinyin simultaneously, and take the maximum value as the final edit distance similarity. Construct a new similarity score by weighting the two similarities, and improve the search accuracy through threshold screening.

[0147] The present invention particularly introduces a double edit distance optimization mechanism, which calculates the edit distance of both the Chinese name and the pinyin simultaneously to obtain more accurate results. This double edit distance optimization mechanism effectively solves the matching problems of similar pinyin but different Chinese meanings, and the cases of large edit distances in pinyin but similar semantics, making the search results more in line with the user's intention.

[0148] 1). Double edit distance calculation;

[0149] Specifically, for the initially screened result set, calculate the edit distance of the Chinese name and the edit distance of the pinyin simultaneously. Standardization of Chinese edit distance: Standardized Chinese edit distance = 1 - Chinese edit distance / Chinese name length.

[0150] For example, when the user searches for "Li Xia" and matches the contact "Li Xiaoming", the Chinese edit distance between "Li Xiaoming" and "Li Xia" = 2 (replace "Xia" with "Xiao" and add "Ming"), and the standardized Chinese edit distance = 1 - 2 / 3 = 0.33. Standardization of pinyin edit distance: Standardized pinyin edit distance = 1 - pinyin edit distance / pinyin length. The pinyin edit distance between "lixiaoming" and "lixia" = 5 (insert "oming"), and the standardized pinyin edit distance = 1 - 5 / 10 = 0.5.

[0151] 2). Result optimization and re - sorting.

[0152] Specifically, take the maximum value of the two standardized edit distances as the final edit distance similarity. For example, for "Li Xiaoming": max(0.50, 0.33) = 0.50.

[0153] Integrate the cosine similarity and the edit distance to form the final similarity score:

[0154] For example, assume the TF - IDF cosine similarity between Li Xia and Li Xiaoming: "Li Xiaoming" = 0.725. Comprehensive similarity (α = 0.6): "Li Xiaoming" = 0.6 * 0.725 + 0.4 * 0.50 = 0.635. Sort all contacts in descending order according to the similarity score. Screen out the top K contacts with similarity higher than the preset threshold as the search results. When the similarities of two results are close (the difference is less than the preset threshold β), preferentially select the result with a higher edit distance similarity.

[0155] Step 7: Result display and interaction: sort the search results by final similarity and display them to the user. The user can select a contact and view details and make a call.

[0156] The system sorts the search results in descending order of similarity and displays them to the user. Users can use the up and down navigation keys to select the desired contact and press the confirm key to view contact details or directly call the contact. The sorting results accurately reflect the degree of similarity to the query, including exact matches, prefix matches, and similar sound matches.

[0157] 1) Results display;

[0158] Specifically, the first K results that meet the final similarity threshold are displayed to the user, such as Figure 4 As shown, the system calculates the similarity of all contacts, sorts them in descending order, and displays the top K results (K=3 in this embodiment): 1. Li Xiao (lixiao): similarity 0.891, 2. Liu Xiao (liuxiao): similarity 0.823, 3. Li Xiaoming (lixiaoming): similarity 0.635; users are supported to select contacts by pressing keys or touching.

[0159] 2) User interaction;

[0160] Specifically, it provides contact details viewing and calling functions. Users can select the required contact by using the up and down navigation keys, and press the confirm key to view contact details or make a call directly.

Claims

1. A method for searching an intelligent phonebook based on a TF-IDF phonetic vector model, characterized in that: The specific steps are as follows: Step 1: Save the contact information of an embedded communication device to a phone book CSV file; Step 2: Convert each contact name in the phonebook CSV file to pinyin, obtain the pinyin string and build a character index table; at the same time, calculate the IDF value of each character to form an IDF matrix; The IDF value calculation formula is: IDF(*) = log(m / (n+1))+1 * represents any of the 26 characters from a to z, m represents the total number of contacts, and n represents the number of contacts containing the character *; Step 3: Perform word frequency statistics on the pinyin string of each contact to obtain the word frequency TF value of each character, calculate the TF-IDF value based on the IDF value of each character, and perform normalization to obtain the TF-IDF vector of each contact; The formula for calculating the word frequency TF value is: TF(*) = t(*) / Z; t(*) indicates the number of times the character * appears, and Z indicates the total number of pinyin characters; The TF-IDF value is calculated as follows: TF-IDF(*) = TF(*) × IDF(*); Step 4: Serialize and persist the character index table, IDF value matrix, and TF-IDF vector of each contact in binary format; Step 5: When the user enters the contact M information to be queried, the name is converted to pinyin and the TF-IDF vector of contact M is calculated according to the above steps; Step 6: Calculate the cosine similarity between the TF-IDF vector of contact M and the TF-IDF vectors of each saved contact; Step 7: For the saved current contact N, calculate the double-normalized edit distances of the Chinese names and the pinyin of the contacts M and N respectively, and select the maximum value as the final edit distance similarity of contacts M and N; Step 8: Construct the similarity score of contacts M and N by weighting the cosine similarity and the final edit distance similarity; The cosine similarity and edit distance are combined to form the final similarity score: Final similarity = α × cosine similarity + (1-α) × normalized edit distance, Where α is the weight coefficient, and its value range is [0,1]; Step 9. Return to step 7, traverse each saved contact one by one, calculate the similarity score between contact M and each contact, sort the contacts in descending order according to the similarity score; filter out the top K contacts with similarity higher than a preset threshold as the search results; K is set as an integer value according to actual needs; Step 10: Display the search results to the user, support the user to select contacts, and provide details viewing and call functions.

2. A method for searching an intelligent phonebook based on a TF-IDF phonetic vector model as claimed in claim 1, characterized in that: The phone book CSV file includes the name, department, email address and landline number information of all contacts.

3. A method for searching an intelligent phonebook based on a TF-IDF phonetic vector model as claimed in claim 1, characterized in that: The step 2 is specifically as follows: First, convert the names of all contacts in the phone book into pinyin to obtain the pinyin strings; Then, a character-level index table is created to assign an index position to each unique pinyin character; Pinyin uses 26 English letters, so the index table size is 26, and each letter corresponds to an index position: 'a' corresponds to index 0, 'b' corresponds to index 1, and so on, 'z' corresponds to index 25; Next, the frequency of occurrence of each character in the corpus in all the pinyin of the contacts is counted, and the IDF value of each character is calculated.

4. A method for searching an intelligent phonebook based on a TF-IDF phonetic vector model as claimed in claim 1, characterized in that: The step three is specifically as follows: First, for each contact's pinyin string, count the number of times each character appears and divide it by the total number of characters in the pinyin string to get the word frequency (TF) value of the character. Then, calculate the TF-IDF value of each character; Next, construct the TF-IDF vector for each contact based on the character index table, and fill the positions where no characters appear with 0; The TF-IDF vector consists of 26 elements, each of which is the TF-IDF value of each character or 0. Finally, perform L2 normalization on the TF-IDF vector: divide each element of the vector by the Euclidean norm of the vector; the normalized vector is associated with the contact information and stored.

5. A method for searching an intelligent phonebook based on a TF-IDF phonetic vector model as claimed in claim 1, characterized in that: The step 4 specifically includes: serializing and saving the character index table and the IDF value matrix in binary format; serializing and saving the TF-IDF vectors and contact information of all contacts in binary format; that is, the contact vectors are stored using a sparse representation method, and only the indices and values ​​of non-zero elements are saved.

6. A method for searching an intelligent phonebook based on a TF-IDF phonetic vector model as claimed in claim 1, characterized in that: In step 6, the cosine similarity calculation is simplified to the dot product operation of two normalized vectors, namely: Similarity = query's TF-IDF vector · contact's TF-IDF vector.

7. A method for searching an intelligent phonebook based on a TF-IDF phonetic vector model as claimed in claim 1, characterized in that: In step 7, the edit distance adopts the Levenshtein distance algorithm, and the normalization formula is: Normalized Chinese edit distance: Normalized Chinese edit distance = 1 – d1 / L1; d1 is the Chinese edit distance, which refers to the difference in the number of characters between the two Chinese names of contacts M and N; L1 is the length of the longer Chinese name of the two contacts M and N; Normalized phonetic edit distance: Normalized phonetic edit distance = 1 – d2 / L2; d2 is the pinyin edit distance, which refers to the difference in the number of characters between the pinyin of the two names of contacts M and N; L2 is the longer pinyin length of the two contacts M and N.

8. A method for searching an intelligent phonebook based on a TF-IDF phonetic vector model as claimed in claim 1, characterized in that: In step nine, when the similarity scores of the first and second contacts are close, the contact with the higher edit distance similarity is prioritized according to the final edit distance similarity between the contact M and the two saved contacts.

Citation Information

Patent Citations

  • Text similarity ordering method based on ES search

    CN107943762A

  • Searching method and device, equipment and storage medium

    CN112818080A

  • Address book user searching method and system

    CN119961503A

  • A method for efficiently supporting interactive, fuzzy search on structured data

    WO2010003129A2