A method and system for data pattern matching for interfaces
By utilizing natural language processing tools and cosine similarity calculation in interface data pattern matching, the parameter names and semantic similarity of heterogeneous interfaces are automatically matched, solving the data pattern matching problem between systems and improving interoperability and efficiency between systems.
Patent Information
- Application Number
- CN202311268093.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-09-27
- Publication Date
- 2025-12-05
- Estimated Expiration
- 2043-09-27
AI Technical Summary
Existing technologies lack detailed solutions for interface descriptions in heterogeneous interface matching between systems, which requires tedious manual data pattern matching work and affects the interoperability between systems.
After obtaining the initial data pattern of the interface and performing preprocessing, the name similarity of parameter names and the semantic similarity of parameter descriptions are calculated separately. The results are then merged to output the data pattern matching result. Automatic matching is achieved by using natural language processing tools and cosine similarity calculation, combined with a classification and evaluation model.
Automatic pattern matching between heterogeneous interfaces is achieved, improving interoperability between systems and saving time and costs.
Smart Images

Figure CN117272066B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of pattern matching technology, and in particular to a data pattern matching method and system for interfaces. Background Technology
[0002] Pattern matching is a complex problem involving knowledge representation methods, machine learning, and information retrieval. The matching process usually requires the use of certain heuristic rules and generally lacks rigorous mathematical theoretical support.
[0003] In existing research, scholars have provided detailed descriptions of pattern matching techniques and categorized current pattern matching technologies, such as... Figure 1 As shown, they are divided into two main categories: independent matching methods and combined matching methods. The basic techniques involved typically include:
[0004] (1) Name-based method: calculates the similarity of names, tags and entity annotations by comparing strings;
[0005] (2) Structure-based methods consider the internal structure of entities and their relational structures. Internal structure includes things like name annotations, characteristics, and data types—that is, the definition of the entity itself; relational structure refers to the relationships between entities. Structure-based methods are often also called constraint-based methods. These methods primarily rely on the internal structure of entities, utilizing attribute sets, attribute ranges, the cardinality or multiplicity of sets, and the transitivity and symmetry of attributes to calculate the similarity between entities.
[0006] (3) Semantic-based methods, the main feature of which is to use model-theoretic semantics to judge the results, also known as deductive methods;
[0007] (4) Instance-based methods, using common instance sets, instance identification techniques, and heterogeneity statistical methods based on instance sets and similarity-based methods.
[0008] Correspondingly, to improve matching quality, multiple matching techniques are typically employed, along with specific matching strategies or combinations thereof. Common matching strategies include:
[0009] (1) Matcher combination can be sequential or parallel combination;
[0010] (2) Similarity aggregation: Structured objects usually involve different relationships. If the similarity between related entities is computable, then in order to evaluate the similarity between entities, the obtained similarities must be aggregated.
[0011] (3) Global similarity calculation: Composite similarity calculation is local because it only considers the similarity of neighboring nodes. However, similarity may involve the entire pattern, and the final similarity depends on all entities. Therefore, the matching strategy must consider global similarity. There are roughly two methods for global similarity calculation: one is graph-based similarity propagation, with similarity flooding being a typical example; the other is to convert the similarity definition into a set of equations and solve them using numerical analysis methods.
[0012] (4) Learning methods usually use some instances to classify matching entities. These instances require some sample data to learn. This sample data can be provided by the algorithm itself or by the user.
[0013] (5) Probabilistic methods, similar to machine learning, are also commonly used in the matching process. The most common probabilistic method is Bayesian network.
[0014] (6) User participation and dynamic combination: User participation is very useful and necessary in designing the matching system structure. There are three aspects in which users can participate in the matching process: providing the initial comparison and parameters, dynamically combining the matcher, and providing feedback information to the matcher to obtain better matching results.
[0015] It can be seen that although the existing technology has the characteristics of strong versatility, it does not focus on specific solutions for the detailed scenarios described in the interface documentation. Summary of the Invention
[0016] This invention provides a data pattern matching method and system for interfaces, which solves the defects of existing technology in pattern matching for heterogeneous interfaces in a system.
[0017] In a first aspect, the present invention provides a data pattern matching method for an interface, comprising:
[0018] Obtain the initial data patterns of any two interfaces to be matched, and preprocess the initial data patterns to obtain the preprocessed data patterns;
[0019] Obtain the language attributes of the parameter names and parameter descriptions in the preprocessed data mode;
[0020] If it is determined that the language attribute contains English words, then the name similarity of the parameter name is calculated to obtain the name similarity result;
[0021] If it is determined that the language attribute contains Chinese words, then the semantic similarity of the parameter description is calculated to obtain the semantic similarity result;
[0022] By combining the name similarity results and the semantic similarity results, the data pattern matching results of any two interfaces to be matched are output.
[0023] According to the present invention, a data pattern matching method for interfaces is provided, wherein the initial data patterns of any two interfaces to be matched are obtained, and the initial data patterns are preprocessed to obtain preprocessed data patterns, including:
[0024] Obtain the sequence number, parameter name, parameter description, English word segmentation list, and Chinese word segmentation list for each of the two interfaces to be matched.
[0025] A matrix list is constructed using the sequence number, parameter name, parameter description, English word segmentation list, and Chinese word segmentation list as column vectors, and the preprocessed data pattern is output.
[0026] According to a data pattern matching method for an interface provided by the present invention, obtaining the language attributes of parameter names and parameter descriptions in the preprocessed data pattern includes:
[0027] The values of the parameter names are segmented using natural language processing tools to obtain segmentation vectors;
[0028] If the length of the word segmentation vector is determined to be greater than or equal to 1, and the word segmentation vector is a non-empty character and a non-invalid character, then it is marked as 1; otherwise, it is marked as 0, and the word segmentation result is recorded in the word table.
[0029] The flag value of each parameter name is obtained by the ratio of the sum of the number of rows marked as 1 in each parameter name to the total number of rows. If the flag value is greater than a preset ratio, the language attribute of the parameter name in the matrix list is determined to be English; otherwise, the language attribute of the parameter name in the matrix list is determined to be Chinese.
[0030] According to a data pattern matching method for an interface provided by the present invention, if it is determined that the language attribute contains English words, the name similarity of the parameter name is calculated to obtain the name similarity result, including:
[0031] The interface document is converted into a thesaurus, which includes an entity object table, a location table, an attribute table, and a verb table.
[0032] The subject thesaurus is segmented, extracted, and pause words are removed sequentially to obtain new terms, and the new terms are used to construct and maintain the subject thesaurus.
[0033] Obtain the first counting marker of the vector in the English word segmentation list in the maintained thesaurus, and construct the English word segmentation list and thesaurus matrix using the first counting marker as the vector;
[0034] Extract the parameter names from the English word segmentation list and the thesaurus matrix, calculate the name similarity of the parameter names using cosine similarity, and obtain the name similarity results.
[0035] According to a data pattern matching method for an interface provided by the present invention, if it is determined that the language attribute contains Chinese words, the semantic similarity of the parameter description is calculated to obtain a semantic similarity result, including:
[0036] The interface document is converted into a thesaurus, which includes an entity object table, a location table, an attribute table, and a verb table.
[0037] The subject thesaurus is segmented, extracted, and pause words are removed sequentially to obtain new terms, and the new terms are used to construct and maintain the subject thesaurus.
[0038] Obtain the second counting marker of the vector in the Chinese word segmentation list in the maintained thesaurus, and construct the Chinese word segmentation list and thesaurus matrix using the second counting marker as the vector;
[0039] Extract the parameter descriptions from the Chinese word segmentation list and the thesaurus matrix, and calculate the semantic similarity of the parameter descriptions using cosine similarity to obtain the semantic similarity result.
[0040] According to a data pattern matching method for interfaces provided by the present invention, the method fuses the name similarity result and the semantic similarity result to output the data pattern matching result for any two interfaces to be matched, including:
[0041] The maximum value between the name similarity result and 0 is used as the first matching value, and the semantic similarity result is used as the second matching value.
[0042] Obtain the absolute value of the difference between the indexes of any two vector pairs of interfaces to be matched, and use the absolute value of the difference between the indexes of the vector pairs as the difference value;
[0043] Using the first matching value, the second matching value, and the difference value, a fusion judgment function is established based on the classification and evaluation model;
[0044] Based on the fusion judgment function, the model is trained for classification to obtain the data pattern matching result of any two interfaces to be matched.
[0045] According to the present invention, a data pattern matching method for interfaces is provided, which performs model classification training based on the fusion judgment function to obtain the data pattern matching results of any two interfaces to be matched, including:
[0046] Manually label the general interface data model to obtain interface matching training samples;
[0047] The interface classifier is obtained by calculating and updating the fusion judgment function through the interface matching training samples and preset constants, first matching value weight coefficient, second matching value weight coefficient and difference value weight coefficient.
[0048] Based on the interface matching training samples, determine the parameter threshold, extract the interface classifier output results that are greater than the parameter threshold, and output the data pattern matching results of any two interfaces to be matched.
[0049] Secondly, the present invention also provides a data pattern matching system for an interface, comprising:
[0050] The preprocessing module is used to obtain the initial data patterns of any two interfaces to be matched, and to preprocess the initial data patterns to obtain the preprocessed data patterns.
[0051] The acquisition module is used to acquire the language attributes of parameter names and parameter descriptions in the preprocessed data mode;
[0052] The first calculation module is used to calculate the name similarity of the parameter name and obtain the name similarity result if it is determined that the language attribute contains English words;
[0053] The second calculation module is used to calculate the semantic similarity of the parameter description if it is determined that the language attribute contains Chinese words, and obtain the semantic similarity result.
[0054] The fusion module is used to fuse the name similarity results and the semantic similarity results, and output the data pattern matching results of any two interfaces to be matched.
[0055] Thirdly, the present invention also provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor, when executing the program, implements the data pattern matching method for an interface as described above.
[0056] Fourthly, the present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the data pattern matching method for an interface as described above.
[0057] The data pattern matching method and system for interfaces provided by this invention solves the problem of needing to manually match data patterns between interfaces when integrating heterogeneous data by automatically matching patterns between heterogeneous pattern interfaces provided by different systems. This improves the interoperability between systems and saves time and cost for processing heterogeneous data when different systems exchange and share data through interfaces. Attached Figure Description
[0058] To more clearly illustrate the technical solutions in this invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of this invention. For those skilled in the art, other drawings can be obtained from these drawings without creative effort.
[0059] Figure 1 It is a pattern matching classification graph provided by existing technology;
[0060] Figure 2 This is one of the flowcharts illustrating the data pattern matching method for interfaces provided by the present invention;
[0061] Figure 3 This is the second flowchart of the data pattern matching method for interfaces provided by the present invention;
[0062] Figure 4 This is a schematic diagram of the data pattern matching system for interfaces provided by the present invention;
[0063] Figure 5 This is a schematic diagram of the structure of the electronic device provided by the present invention. Detailed Implementation
[0064] To make the objectives, technical solutions, and advantages of this invention clearer, the technical solutions of this invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of this invention. All other embodiments obtained by those skilled in the art based on the embodiments of this invention without creative effort are within the scope of protection of this invention.
[0065] Typically, improving interoperability between systems requires addressing the heterogeneity of their data schemas. When integrating data from different systems using technologies such as interfaces, data schema mismatches often arise, leading to a significant amount of tedious manual matching work.
[0066] Taking the two interface documents shown in Tables 1 and 2 below as examples, on the one hand, the parameter names have heterogeneity in Chinese and English, and on the other hand, the parameter descriptions provide semantic information for the parameter names in the interface, but there is also heterogeneity in the description of the semantic method.
[0067] Table 1
[0068]
[0069] Table 2
[0070]
[0071] To address the above problems, this invention proposes a data pattern matching method for interfaces, particularly heterogeneous interfaces. Figure 2 This is one of the flowcharts illustrating the data pattern matching method for interfaces provided in this embodiment of the invention, such as... Figure 2 As shown, it includes:
[0072] Step 100: Obtain the initial data patterns of any two interfaces to be matched, and preprocess the initial data patterns to obtain preprocessed data patterns;
[0073] Step 200: Obtain the language attributes of the parameter names and parameter descriptions in the preprocessed data pattern;
[0074] Step 300: If it is determined that the language attribute contains English words, then calculate the name similarity of the parameter name to obtain the name similarity result;
[0075] Step 400: If it is determined that the language attribute contains Chinese words, then calculate the semantic similarity of the parameter description to obtain the semantic similarity result;
[0076] Step 500: Combine the name similarity results and the semantic similarity results to output the data pattern matching results of any two interfaces to be matched.
[0077] Specifically, such as Figure 3 As shown, when performing interface data pattern matching, each time the descriptions of two interfaces to be matched are taken as input, the initial data patterns of the two input interfaces are preprocessed, and the data patterns of the two interfaces to be matched are judged. By calculating whether their parameter names both contain English words, the similarity of their parameter names is calculated for the data patterns to be matched that both contain English words. Otherwise, for the data patterns to be matched that contain Chinese words, the semantic similarity between their parameter descriptions is calculated. Finally, the results of calculating the similarity of parameter names and the results of calculating the similarity of parameter descriptions are fused together to output the data pattern matching result of the two interfaces to be matched.
[0078] This invention solves the problem of manually matching data patterns between interfaces when integrating heterogeneous data by enabling automatic pattern matching between heterogeneous pattern interfaces provided by different systems. This improves interoperability between systems and saves time and cost for processing heterogeneous data when different systems exchange and share data through interfaces.
[0079] Based on the above embodiments, initial data patterns of any two interfaces to be matched are obtained, and preprocessing of the initial data patterns yields preprocessed data patterns, including:
[0080] Obtain the sequence number, parameter name, parameter description, English word segmentation list, and Chinese word segmentation list for each of the two interfaces to be matched.
[0081] A matrix list is constructed using the sequence number, parameter name, parameter description, English word segmentation list, and Chinese word segmentation list as column vectors, and the preprocessed data pattern is output.
[0082] Specifically, in this embodiment of the invention, the initial data patterns of any two input interfaces are processed and uniformly represented in matrix form. Here, the matrix is set to 5 columns, and the column fields include "id, name, description, enWordsList, cnWordsList", which respectively represent "serial number, parameter name, parameter description, list of English words after segmentation, and list of Chinese words after segmentation". The latter two columns of parameters are stored in the subsequent word segmentation results.
[0083] Based on the above embodiments, the language attributes of parameter names and parameter descriptions in the preprocessed data mode are obtained, including:
[0084] The values of the parameter names are segmented using natural language processing tools to obtain segmentation vectors;
[0085] If the length of the word segmentation vector is determined to be greater than or equal to 1, and the word segmentation vector is a non-empty character and a non-invalid character, then it is marked as 1; otherwise, it is marked as 0, and the word segmentation result is recorded in the word table.
[0086] The flag value of each parameter name is obtained by the ratio of the sum of the number of rows marked as 1 in each parameter name to the total number of rows. If the flag value is greater than a preset ratio, the language attribute of the parameter name in the matrix list is determined to be English; otherwise, the language attribute of the parameter name in the matrix list is determined to be Chinese.
[0087] Specifically, depending on the actual application scenario, the values in the parameter name "name" are usually all English words and their abbreviations, or all Chinese pinyin and their abbreviations. Therefore, it is sufficient to simply iterate through and determine whether the value under each parameter name is an English word.
[0088] First, using the open-source tool Natural Language Toolkit (NLTK), the value of each parameter name is segmented by calling the nltk.tokenize.simple.LineTokenizer class.
[0089] If the length of the returned word segmentation vector is greater than or equal to 1 and consists of non-empty characters and is not NULL, it is marked as 1; otherwise, it is marked as 0. The word segmentation results are stored in the wordList column, which is the word list column.
[0090] Calculate the value in each parameter name "name" and get value = (sum of the number of rows marked as 1) / (total number of rows). If value > 50%, it is determined that all parameter names in the matrix contain English words, and the relevance calculation step for English words in parameter names is initiated. Otherwise, if value ≤ 50%, it is determined that all parameter descriptions in the matrix contain Chinese words, and the relevance calculation step for Chinese words in parameter descriptions is initiated.
[0091] Based on the above embodiments, if it is determined that the language attribute contains English words, then the name similarity of the parameter name is calculated to obtain the name similarity result, including:
[0092] The interface document is converted into a thesaurus, which includes an entity object table, a location table, an attribute table, and a verb table.
[0093] The subject thesaurus is segmented, extracted, and pause words are removed sequentially to obtain new terms, and the new terms are used to construct and maintain the subject thesaurus.
[0094] Obtain the first counting marker of the vector in the English word segmentation list in the maintained thesaurus, and construct the English word segmentation list and thesaurus matrix using the first counting marker as the vector;
[0095] Extract the parameter names from the English word segmentation list and the thesaurus matrix, calculate the name similarity of the parameter names using cosine similarity, and obtain the name similarity results.
[0096] Otherwise, if it is determined that the language attribute contains Chinese words, then the semantic similarity of the parameter description is calculated to obtain the semantic similarity result, including:
[0097] The interface document is converted into a thesaurus, which includes an entity object table, a location table, an attribute table, and a verb table.
[0098] The subject thesaurus is segmented, extracted, and pause words are removed sequentially to obtain new terms, and the new terms are used to construct and maintain the subject thesaurus.
[0099] Obtain the second counting marker of the vector in the Chinese word segmentation list in the maintained thesaurus, and construct the Chinese word segmentation list and thesaurus matrix using the second counting marker as the vector;
[0100] Extract the parameter descriptions from the Chinese word segmentation list and the thesaurus matrix, and calculate the semantic similarity of the parameter descriptions using cosine similarity to obtain the semantic similarity result.
[0101] Specifically, in this embodiment of the invention, the similarity calculation of parameter names adopts a method based on manually maintained vocabulary and utilizes word embedding representation to calculate similarity, including:
[0102] First, maintain several commonly used thesaurus, as shown in Tables 3 to 6. Each thesaurus actually represents a theme list. The terms in the interface document, after word segmentation, extraction, and removal of pause words, are manually maintained as a summary table, and their presentation is consistent with Tables 3 to 6.
[0103] Table 3
[0104]
[0105]
[0106] Table 4
[0107]
[0108] Table 5
[0109]
[0110] Table 6
[0111]
[0112] Then, the enWordsList-themeList matrix is constructed, as shown in Table 7. The right four columns in Table 7 actually represent different theme lists, while enWordsList represents the vector after word segmentation. The word in the vector is counted if it has appeared in the themeList, otherwise the count is 0.
[0113] Table 7
[0114] enWordsList Entity Location Attribute Verb Other [device,ID] 1 0 1 0 0 [device,Type] 1 0 1 0 0 [status,Type] 0 0 2 0 0 [device,code] 1 0 1 0 0 [status] 0 0 1 0 0
[0115] Each row in the table above is the vector of parameter name "name" in the interface. The similarity between two parameter names is calculated using cosine similarity (cos()). If the similarity between name=deviceID and name=deviceCode is 1 after calculation, it is the output result.
[0116] If it is determined that the word contains Chinese words, the semantic similarity between the parameters is calculated. This is still done by using word embedding representation based on a manually maintained vocabulary. The processing steps are similar to those for processing English words, except that the processing for English words is converted to processing for Chinese words.
[0117] Based on the above embodiments, the name similarity result and the semantic similarity result are fused to output the data pattern matching result of any two interfaces to be matched, including:
[0118] The maximum value between the name similarity result and 0 is used as the first matching value, and the semantic similarity result is used as the second matching value.
[0119] Obtain the absolute value of the difference between the indexes of any two vector pairs of interfaces to be matched, and use the absolute value of the difference between the indexes of the vector pairs as the difference value;
[0120] Using the first matching value, the second matching value, and the difference value, a fusion judgment function is established based on the classification and evaluation model;
[0121] Based on the fusion judgment function, the model is trained for classification to obtain the data pattern matching result of any two interfaces to be matched.
[0122] Specifically, model classification training is performed based on the fusion judgment function to obtain the data pattern matching results of any two interfaces to be matched, including:
[0123] Manually label the general interface data model to obtain interface matching training samples;
[0124] The interface classifier is obtained by calculating and updating the fusion judgment function through the interface matching training samples and preset constants, first matching value weight coefficient, second matching value weight coefficient and difference value weight coefficient.
[0125] Based on the interface matching training samples, determine the parameter threshold, extract the interface classifier output results that are greater than the parameter threshold, and output the data pattern matching results of any two interfaces to be matched.
[0126] Specifically, in this embodiment of the invention, the name similarity result is recorded as the first matching value, i.e., resultc, and resultC = Max{0, resultc}. The semantic similarity result is used as the second matching value, i.e., resultD, and the absolute value of the difference between the indices of each pair of vectors in the data models to be matched is recorded as the difference value, difference. Then, a fusion judgment function is established using a logit model, y = logit(resultC, resultD, difference), and the fusion judgment function is trained, including:
[0127] The first step is to establish training samples by manually labeling the matching results of the data model;
[0128] The second step is to calculate y = logit(x) using training samples, where x = β0 + β1resultC + β2resultD + β3differ, and establish a judgment function or classifier. Here, a preset constant, the weight coefficient of the first matching value, the weight coefficient of the second matching value, and the weight coefficient of the difference value are introduced into the fusion judgment function to calculate and update the function.
[0129] The third step is to determine the final matching result through the updated fusion judgment function. A parameter threshold θ obtained from the training data is introduced. When y>θ, the matching relationship between the two vector pairs in the two data patterns is established, that is, the data pattern matching result of the two interfaces to be matched is obtained.
[0130] The data pattern matching system for interfaces provided by the present invention is described below. The data pattern matching system for interfaces described below and the data pattern matching method for interfaces described above can be referred to in correspondence.
[0131] Figure 4 This is a schematic diagram of the structure of the data pattern matching system for interfaces provided in an embodiment of the present invention, as shown below. Figure 4 As shown, it includes: a preprocessing module 41, an acquisition module 42, a first calculation module 43, a second calculation module 44, and a fusion module 45, wherein:
[0132] The preprocessing module 41 is used to obtain the initial data patterns of any two interfaces to be matched, and preprocess the initial data patterns to obtain preprocessed data patterns; the acquisition module 42 is used to obtain the language attributes of parameter names and parameter descriptions in the preprocessed data patterns; the first calculation module 43 is used to calculate the name similarity of the parameter names if it is determined that the language attribute contains English words, and obtain the name similarity result; the second calculation module 44 is used to calculate the semantic similarity of the parameter descriptions if it is determined that the language attribute contains Chinese words, and obtain the semantic similarity result; the fusion module 45 is used to fuse the name similarity result and the semantic similarity result, and output the data pattern matching result of the any two interfaces to be matched.
[0133] Figure 5 An example is a schematic diagram of the physical structure of an electronic device, such as... Figure 5As shown, the electronic device may include a processor 510, a communications interface 520, a memory 530, and a communication bus 540, wherein the processor 510, communications interface 520, and memory 530 communicate with each other through the communication bus 540. The processor 510 can call logical instructions in the memory 530 to execute a data pattern matching method for the interfaces. This method includes: acquiring initial data patterns of any two interfaces to be matched; preprocessing the initial data patterns to obtain preprocessed data patterns; acquiring the language attributes of parameter names and parameter descriptions in the preprocessed data patterns; if it is determined that the language attributes contain English words, calculating the name similarity of the parameter names to obtain a name similarity result; if it is determined that the language attributes contain Chinese words, calculating the semantic similarity of the parameter descriptions to obtain a semantic similarity result; fusing the name similarity result and the semantic similarity result to output the data pattern matching result of the any two interfaces to be matched.
[0134] Furthermore, the logical instructions in the aforementioned memory 530 can be implemented as software functional units and, when sold or used as independent products, can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, essentially, or the part that contributes to the prior art, or a part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0135] On the other hand, the present invention also provides a non-transitory computer-readable storage medium storing a computer program thereon. When executed by a processor, the computer program implements a data pattern matching method for interfaces provided by the above methods. The method includes: obtaining initial data patterns of any two interfaces to be matched; preprocessing the initial data patterns to obtain preprocessed data patterns; obtaining the language attributes of parameter names and parameter descriptions in the preprocessed data patterns; if it is determined that the language attributes contain English words, calculating the name similarity of the parameter names to obtain a name similarity result; if it is determined that the language attributes contain Chinese words, calculating the semantic similarity of the parameter descriptions to obtain a semantic similarity result; fusing the name similarity result and the semantic similarity result to output the data pattern matching result of the any two interfaces to be matched.
[0136] The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs. Those skilled in the art can understand and implement this without any creative effort.
[0137] Through the above description of the embodiments, those skilled in the art can clearly understand that each embodiment can be implemented by means of software plus necessary general-purpose hardware platforms, and of course, it can also be implemented by hardware. Based on this understanding, the above technical solutions, in essence or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, magnetic disk, optical disk, etc., and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute the methods described in the various embodiments or some parts of the embodiments.
[0138] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, and not to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features; and these modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. A data pattern matching method for an interface, characterized in that, include: Obtain the initial data patterns of any two interfaces to be matched, and preprocess the initial data patterns to obtain the preprocessed data patterns; Obtain the language attributes of the parameter names and parameter descriptions in the preprocessed data mode; If it is determined that the language attribute contains English words, then the name similarity of the parameter name is calculated to obtain the name similarity result; If it is determined that the language attribute contains Chinese words, then the semantic similarity of the parameter description is calculated to obtain the semantic similarity result; By combining the name similarity results and the semantic similarity results, the data pattern matching results for any two interfaces to be matched are output, including: The maximum value between the name similarity result and 0 is used as the first matching value, and the semantic similarity result is used as the second matching value. Obtain the absolute value of the difference between the indexes of any two vector pairs of interfaces to be matched, and use the absolute value of the difference between the indexes of the vector pairs as the difference value; Using the first matching value, the second matching value, and the difference value, a fusion judgment function is established based on the classification and evaluation model; Based on the fusion judgment function, the model is trained for classification to obtain the data pattern matching result of any two interfaces to be matched.
2. The data pattern matching method for an interface according to claim 1, characterized in that, Obtain the initial data patterns of any two interfaces to be matched, and preprocess the initial data patterns to obtain preprocessed data patterns, including: Obtain the sequence number, parameter name, parameter description, English word segmentation list, and Chinese word segmentation list for each of the two interfaces to be matched. A matrix list is constructed using the sequence number, parameter name, parameter description, English word segmentation list, and Chinese word segmentation list as column vectors, and the preprocessed data pattern is output.
3. The data pattern matching method for an interface according to claim 1, characterized in that, The language attributes of parameter names and parameter descriptions in the preprocessed data mode are obtained, including: The values of the parameter names are segmented using natural language processing tools to obtain segmentation vectors; If the length of the word segmentation vector is determined to be greater than or equal to 1, and the word segmentation vector is a non-empty character and a non-invalid character, then it is marked as 1; otherwise, it is marked as 0, and the word segmentation result is recorded in the word table. The flag value of each parameter name is obtained by the ratio of the sum of the number of rows marked as 1 in each parameter name to the total number of rows. If the flag value is greater than a preset ratio, the language attribute of the parameter name in the matrix list is determined to be English; otherwise, the language attribute of the parameter name in the matrix list is determined to be Chinese.
4. The data pattern matching method for an interface according to claim 1, characterized in that, If it is determined that the language attribute contains English words, then the name similarity of the parameter name is calculated to obtain the name similarity result, including: The interface document is converted into a thesaurus, which includes an entity object table, a location table, an attribute table, and a verb table. The subject thesaurus is segmented, extracted, and pause words are removed sequentially to obtain new terms, and the new terms are used to construct and maintain the subject thesaurus. Obtain the first counting marker of the vector in the English word segmentation list in the maintained thesaurus, and construct the English word segmentation list and thesaurus matrix using the first counting marker as the vector; Extract the parameter names from the English word segmentation list and the thesaurus matrix, calculate the name similarity of the parameter names using cosine similarity, and obtain the name similarity results.
5. The data pattern matching method for an interface according to claim 1, characterized in that, If it is determined that the language attribute contains Chinese words, then the semantic similarity of the parameter description is calculated to obtain the semantic similarity result, including: The interface document is converted into a thesaurus, which includes an entity object table, a location table, an attribute table, and a verb table. The subject thesaurus is segmented, extracted, and pause words are removed sequentially to obtain new terms, and the new terms are used to construct and maintain the subject thesaurus. Obtain the second counting marker of the vector in the Chinese word segmentation list in the maintained thesaurus, and construct the Chinese word segmentation list and thesaurus matrix using the second counting marker as the vector; Extract the parameter descriptions from the Chinese word segmentation list and the thesaurus matrix, and calculate the semantic similarity of the parameter descriptions using cosine similarity to obtain the semantic similarity result.
6. The data pattern matching method for an interface according to claim 1, characterized in that, Based on the fusion judgment function, model classification training is performed to obtain the data pattern matching results of any two interfaces to be matched, including: Manually label the general interface data model to obtain interface matching training samples; The interface classifier is obtained by calculating and updating the fusion judgment function through the interface matching training samples and preset constants, first matching value weight coefficient, second matching value weight coefficient and difference value weight coefficient. Based on the interface matching training samples, determine the parameter threshold, extract the interface classifier output results that are greater than the parameter threshold, and output the data pattern matching results of any two interfaces to be matched.
7. A data pattern matching system for an interface, based on the data pattern matching method for an interface according to any one of claims 1 to 6, characterized in that, include: The preprocessing module is used to obtain the initial data patterns of any two interfaces to be matched, and to preprocess the initial data patterns to obtain the preprocessed data patterns. The acquisition module is used to acquire the language attributes of parameter names and parameter descriptions in the preprocessed data mode; The first calculation module is used to calculate the name similarity of the parameter name and obtain the name similarity result if it is determined that the language attribute contains English words; The second calculation module is used to calculate the semantic similarity of the parameter description if it is determined that the language attribute contains Chinese words, and obtain the semantic similarity result. The fusion module is used to fuse the name similarity results and the semantic similarity results, and output the data pattern matching results of any two interfaces to be matched.
8. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the program, it implements the data pattern matching method for the interface as described in any one of claims 1 to 6.
9. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the data pattern matching method for an interface as described in any one of claims 1 to 6.
Citation Information
Patent Citations
System publishing method and device, computer equipment and storage medium
CN112363929A
Interest category identification method and device, equipment, storage medium and program product
CN115114911A