A method for mapping non-standard model strings to standard model strings

By establishing the mapping relationship between standard models and non-standard model sets and using the Needleman_Wunsch algorithm, the difficulty of converting non-standard model strings into standard model strings is solved, efficient and accurate mapping is achieved, and the management efficiency of the information system is improved.

CN112131838BActive Publication Date: 2024-08-23WUXI YIMAIDE TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202011047910.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-09-29
Publication Date
2024-08-23
Estimated Expiration
2040-09-29

AI Technical Summary

Technical Problem

The existing technology has difficulties in converting manually filled non-standard model strings into standard model strings, especially because the model code may contain special symbols and other reasons, which makes information system management complicated.

Method used

By establishing the mapping relationship between the standard model set S and the non-standard model set E, they are merged to form a set Z, and the Needleman_Wunsch algorithm is used to calculate the matching score and find the most similar standard model string to achieve efficient and accurate mapping of non-standard model strings.

Benefits of technology

It effectively solves the problem of difficulty in converting non-standard model strings caused by manual filling, and improves the management efficiency and accuracy of the information system.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN112131838B
    Figure CN112131838B
Patent Text Reader

Abstract

The present invention relates to the technical field of computer character text processing, and in particular to a method for mapping a non-standard model string to a standard model string, aiming to solve the problem in the prior art that the manual filling content is complicated and the management work of the information system is troublesome. The technical key points are: comprising the following steps: agreeing on a set S of standard models; agreeing on a set E of non-standard models; establishing a mapping relationship from elements in E to elements in S; merging the set S with the set E to form a set Z; sorting the set Z, and finding the element in the set Z that is most similar to the non-standard model string k to be mapped; taking the most similar element z, if z is an element of the set S but not an element of the set E, directly returning z; if z is an element in the set E, mapping z to an element in S using the mapping relationship in step 3 and then returning it.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention relates to the technical field of computer character text processing, and in particular to a method for mapping a non-standard type character string into a standard type character string. Background Art

[0002] Usually, physical goods / products have their own model codes, which represent the specific prototype of the product. Goods with the same model code belong to the same product. In actual supply chain management, especially in the specific links of sales, delivery, storage, transportation, invoice, etc., the model code of the goods will be recorded. Due to the limitations of actual conditions, the staff at each link need to fill in the model code of the goods manually, or fill in the model code of the goods in various information management systems.

[0003] For a manufacturer, the model code of its products is a finite set, because the types of products it produces cannot be infinite, and the model codes in this finite set are called standard model codes. In actual business, because there are many links that require manual reporting by staff, due to various reasons, many non-standard models will appear in the manual reporting, that is, the model codes filled in manually are not standard model codes.

[0004] Since the manual reporting content is varied, it causes a lot of trouble to the management of the information system. The existing technical solution is to try to convert the non-standard model string into the standard model string by removing some characters (for example, Chinese, special symbols +, -, comma, etc.). However, there are often difficulties. For example, some model codes have +- symbols, so the effect is not good. Summary of the invention

[0005] Therefore, the technical problem to be solved by the present invention is to overcome the defects in the prior art caused by the complexity of manual filling content and the troublesome management of the information system, thereby providing a method for mapping non-standard model strings to standard model strings.

[0006] The above technical objectives of the present invention are achieved through the following technical solutions:

[0007] A method for mapping a non-standard model string to a standard model string comprises the following steps:

[0008] Step 1: Agree on a set S of standard models, where the elements in S are strings;

[0009] Step 2: Agree on a set E of non-standard models, where the elements in E are strings;

[0010] Step 3: Establish a mapping relationship from the elements in E to the elements in S;

[0011] Step 4: Merge the set S and the set E to form a set Z;

[0012] Step 5: Sort the set Z.

[0013] Step 6: For the non-standard model string k that needs to be mapped, find the element in the set Z that is most similar to k. If it cannot be found, return INVALID, the algorithm ends, and proceed to the next step after finding the most similar element;

[0014] Step 7: Take the element z obtained in step 6 that is most similar to k. If z is an element of the set S but not an element of the set E, return z directly; if z is an element of the set E, use the mapping relationship in step 3 to map z to an element in S and then return it.

[0015] In some implementations of the present application, the criterion for sorting the set Z in step five is to sort from high to low according to the length of the character string.

[0016] In some implementations of the present application, the specific steps of step 6 are: taking the elements in Z from front to back according to the order in step 5 and assigning them to the string z, and checking whether z is a substring of the string k;

[0017] If z is a substring of k, go to step 7;

[0018] If z is not a substring of k, use the Needleman-Wunsch algorithm to calculate the matching score between the non-standard model string k and any element z in Z. If the matching score is less than the threshold, INVALID is returned and the algorithm ends; otherwise, go to step seven.

[0019] In some embodiments of the present application, the Needleman-Wunsch algorithm comprises the following steps:

[0020] S1: Select two strings str1 and str2, and calculate the lengths of the two strings len(str1) and len(str2);

[0021] S2: Create a proof table with len(str1)+1 rows and len(str2)+1, and initialize all to 0, then fill in the arithmetic progression in the first row and the first column, with the difference being -3;

[0022] S3: Fill in the remaining numbers in the table, and use F(i,j) to represent the value of the i-th row and j-th column in the table.

[0023]

[0024] xi Represents the i-th character in the string str1, x j Represents the jth character in the string str2, s(x i ,x j ) Determine whether the two characters are the same. If they are the same, the value is 8, if they are different, the value is -5, where d is the case of adding a blank space for matching, d = -3.

[0025] S4: After filling in the form according to S3, use the following formula to calculate the fuzzy matching score:

[0026] vague_match=max(F(i,j)) / [8*min(len(str1),len(str2))].

[0027] The present application provides a method for mapping a non-standard model string to a standard model string, which combines a known standard model set S and a known common non-standard model set E into a large set Z, and searches for the best matching element from the set Z, so that codes for various non-standard models can be efficiently and accurately mapped to standard model codes. BRIEF DESCRIPTION OF THE DRAWINGS

[0028] In order to more clearly illustrate the specific implementation methods of the present invention or the technical solutions in the prior art, the drawings required for use in the specific implementation methods or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some implementation methods of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0029] Figure 1 A schematic diagram of the steps of a method for mapping a non-standard model character string to a standard character string according to an embodiment of the present invention;

[0030] Figure 2 The matrix table diagram of S2 in step 7 of the method for mapping a non-standard model character string to a standard character string according to an embodiment of the present invention;

[0031] Figure 3 A matrix table diagram of S3 in step 7 of a method for mapping a non-standard model character string to a standard character string according to an embodiment of the present invention;

[0032] Figure 4 This is a matrix table diagram of S4 in step 7 of the method for mapping a non-standard model character string to a standard model character string according to an embodiment of the present invention. DETAILED DESCRIPTION

[0033] In order to make the purpose, technical solution and advantages of the present invention more clearly understood, the present invention is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not intended to limit the present invention.

[0034] The English version of the instruction manual:

[0035] Needleman_Wunsch algorithm: A method to align two strings using a dynamic programming algorithm.

[0036] The present invention will be further described in detail below in conjunction with the accompanying drawings and specific embodiments.

[0037] A method for mapping nonstandard model strings to standard model strings, see Figure 1 , which includes the following steps:

[0038] Step 1: A set S of standard models is agreed upon, wherein the elements in S are character strings, and each character string in the set S represents a standard model number.

[0039] In one embodiment, the set S is shown in the following table:

[0040]

[0041] Step 2: A set E of non-standard models is agreed upon, where the elements in E are strings, and each string in the set E represents a common non-standard model number.

[0042] In one embodiment, the set E is shown in the following table:

[0043] AABOO,ZCBOO,PCBOO,ZCTOO,ZMAOO,ZMBOO,ZLBOO,ZXROO,ZMTOO

[0044] Step 3: Establish a mapping relationship from the elements in E to the elements in S.

[0045] As shown in the following table:

[0046]

[0047]

[0048] Step 4: Combine the set S and the set E to form a set Z.

[0049] As shown in the following table:

[0050]

[0051] Step 5: Sort the set Z.

[0052] In one embodiment, the criterion for sorting the set Z is to sort the strings from high to low according to their length. The sorting result is:

[0053]

[0054]

[0055]

[0056] Step 6: For the non-standard model string k that needs to be mapped, find the element in the set Z that is most similar to k. If not found, return INVALID and the algorithm ends.

[0057] Specifically, in one implementation, the elements in Z are taken from front to back according to the order in step five and assigned to the string z, and it is checked whether z is a substring of the string k.

[0058] It can be understood that when z=k, z is also a substring of k. Or when z=ABC and k=DEFABC, z is a substring of k; or when z=ABC and k=123ABCDEF, z is a substring of k. The string z that meets the above conditions is a substring of the string k.

[0059] If the matched character string z is a substring of the character string k, proceed to step seven.

[0060] If the string z is not a substring of the string k, perform the following steps:

[0061] Use the Needleman-Wunsch algorithm to calculate the match score between the non-standard model string k and any element z in Z. It is understandable that the maximum match score is 1. The closer it is to 1, the more similar the two strings are. When the match score is 1, the two strings are exactly the same. When the maximum match score is less than the threshold value, INVALID is returned and the algorithm ends. Otherwise, z corresponding to the maximum match score is taken as the element most similar to k, and the process proceeds to step 7. In one embodiment, the threshold value is 0.5.

[0062] In one embodiment, the Needleman-Wunsch algorithm comprises the following steps:

[0063] S1: First calculate the lengths of the two strings len(str1) and len(str2).

[0064] Assume that the two strings to be compared are str1 = "CAATTGA", str2 = "GAATCTGC", one of which is the buyer's name on the invoice, and the other is the buyer's name on the delivery note. Then the length of str1 is len(str1) = 7, and the length of str2 is len(str2) = 8.

[0065] S2: Please refer to Figure 2 , create a matrix table of len(str1)+1 rows and len(str2)+1, and initialize all to 0, then fill the 1st row and 1st column with an arithmetic progression with a difference of -3.

[0066] S3: Please refer to Figure 3 , fill in the rest of the numbers in the table. Specifically: Use F(i,j) to represent the value of the i-th row and j-th column in the table. Obviously, F(0,0) = 0, and the first row and first column of the table have been initialized.

[0067] Then there is

[0068]

[0069] In the above formula, xi represents the i-th character in the string str1, and xj represents the j-th character in the string str2. s(xi,xj) determines whether the two characters are the same. If they are the same, the value is 8, and if they are different, the value is -5. Among them, d is the case of adding a blank space for matching, d = -3.

[0070] S4: After filling in the form according to S3, use the following formula to calculate the fuzzy matching score:

[0071] vague_match=max(F(i,j)) / [8*min(len(str1),len(str2))].

[0072] In one embodiment, see Figure 4 , find the largest number 32 in the table, the length of the shorter of the two strings being compared is 7, so the score of the fuzzy comparison is 32 / (7*8).

[0073] Step 7: Take the element z obtained in step 6 that is most similar to k. If z is an element of the set S but not an element of the set E, return z directly. If z is an element of the set E, map z to an element of S using the mapping relationship in step 3 and then return it.

[0074] The present application provides a method for mapping a non-standard model string to a standard model string, which combines a known standard model set S and a known common non-standard model set E into a large set Z, and searches for the best matching element from the set Z, so that codes for various non-standard models can be efficiently and accurately mapped to standard model codes.

[0075] Obviously, the above embodiments are merely examples for the purpose of clear explanation, and are not intended to limit the implementation methods. For those skilled in the art, other different forms of changes or modifications can be made based on the above description. It is not necessary and impossible to list all the implementation methods here. The obvious changes or modifications derived therefrom are still within the scope of protection of the invention.

Claims

1. A method for mapping a non-standard model character string to a standard character string, characterized by: The following steps are involved: Step 1: Agree on a set S of standard models, where the elements in S are strings; Step 2: Agree on a set E of non-standard models, where the elements in E are strings; Step 3: Establish a mapping relationship from the elements in E to the elements in S; Step 4: Merge the set S and the set E to form a set Z; Step 5: Sort the set Z. Step 6: For the non-standard model string k that needs to be mapped, find the element in the set Z that is most similar to k. If it cannot be found, return INVALID, the algorithm ends, and proceed to the next step after finding the most similar element; Step 7: Take the element z obtained in step 6 that is most similar to k. If z is an element of the set S but not an element of the set E, return z directly; if z is an element of the set E, use the mapping relationship in step 3 to map z to an element in S and then return it.

2. The method for mapping a non-standard model character string to a standard character string according to claim 1, characterized in that: The criterion for sorting the set Z in step 5 is to sort the strings from high to low according to their lengths.

3. The method for mapping a non-standard model character string to a standard character string according to claim 2, characterized in that: The specific steps of step 6 are: according to the order in step 5, take the elements in Z from front to back and assign them to the string z, and check whether z is a substring of the string k; If z is a substring of k, go to step 7; If z is not a substring of k, use the Needleman-Wunsch algorithm to calculate the matching score between the non-standard model string k and any element z in Z. If the matching score is less than the threshold, INVALID is returned and the algorithm ends; otherwise, go to step seven.

4. The method for mapping a non-standard model character string to a standard character string according to claim 3, characterized in that: The Needleman-Wunsch algorithm comprises the following steps: S1: Select two strings str1 and str2, and calculate the lengths of the two strings len(str1) and len(str2); S2: Create a proof table with [len(str1)+1] rows and [len(str2)+1] columns, and initialize all of them to 0, then fill in the arithmetic progression in the first row and the first column, with the difference being -3; S3: Fill in the remaining numbers in the table, and use F(i,j) to represent the value of the i-th row and j-th column in the table. x i Represents the i-th character in the string str1, x j Represents the jth character in the string str2, s(x i ,x j ) Determine whether the two characters are the same. If they are the same, the value is 8. If they are different, the value is -5. Where d is the case of adding a blank space for matching, d = -3; S4: After filling in the form according to S3, use the following formula to calculate the fuzzy matching score: vague_match=max(F(i,j)) / [8*min(len(str1),len(str2))].