Commodity name intelligent code mapping method and system based on pre-training model
Through the intelligent coding mapping method based on the pre-trained model, combined with the cache mechanism and feedback mechanism, and weighted and reordered with historical invoice data, the problem of low accuracy of matching product name tax classification code in the existing technology is solved, and more efficient and accurate matching effect is achieved.
Patent Information
- Application Number
- CN202411840646.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-13
- Publication Date
- 2025-03-28
AI Technical Summary
In the prior art, in the tax classification and coding matching of product names, it is difficult to effectively extract text features and semantic information, resulting in a low matching accuracy.
The intelligent coding mapping method based on the pretrained model is adopted, and the pretrained model and the historical invoice data are weighted and reordered, combined with the cache mechanism and feedback mechanism, the accuracy of the model matching the new product categories is improved.
It significantly improves the accuracy of product name tax classification encoding mapping, reduces the time and error rate of manual mapping, and improves the overall matching efficiency and accuracy.
Smart Images

Figure CN119719779A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to a method for mapping commodity name tax classification codes, and in particular to a method and system for intelligent coding mapping of commodity names based on a pre-training model. Background Art
[0002] According to the requirements of the State Administration of Taxation, when enterprises issue value-added tax invoices, the abbreviations corresponding to the tax classification codes for goods and services should be automatically displayed and printed in the "Name of goods or taxable services, services" or "Item" column on the face of the invoice. On the one hand, it is to improve the accuracy of the use of commodity codes, and on the other hand, it is convenient for taxpayers to more clearly identify the commodity codes corresponding to the consumption content when issuing invoices. If the taxpayer does not issue an invoice with a tax classification code correctly or in a standardized manner, the tax authorities will impose penalties in accordance with the relevant invoice regulations. Whether users are issuing single or batch goods, taxpayers need to find the corresponding tax classification abbreviation from more than 4,000 taxable commodities before they can issue them. The traditional manual mapping method consumes a lot of time and energy, is inefficient and prone to errors.
[0003] The existing technologies mainly include: Bayesian algorithm, support vector machine and deep learning algorithm based on neural network. Among them, the Bayesian algorithm needs to calculate the prior probability. It assumes that each feature is independent of each other. In reality, each feature is not independent of each other and the prior probability has errors, which will eventually lead to poor prediction results. Support vector machine is a linear classifier with the largest interval in feature space. It requires a lot of manual feature engineering, such as statistical word frequency, feature hashing and feature dimensionality reduction. The generalization performance of the model is poor. Based on the neural network algorithm of deep learning, word embedding n-gram cannot capture the reasoning ability of text context semantics, because it can only calculate the probability based on the previous n words and cannot understand the contextual semantic relationship between words. Therefore, the generalization ability of the model is poor and the prediction effect is poor. Summary of the invention
[0004] The present invention provides a method and system for intelligent coding mapping of commodity names based on a pre-trained model, which solves the problem that due to the wide variety of commodity codes, the commodity name text is short and contains less text information, the existing technology has poor extraction of text features and poor representation of text semantics, and cannot obtain deeper semantic information, and the matching effect of commodity tax classification codes is poor. The accuracy of the model matching of new commodity categories is improved through a weighted ranking mechanism of historical invoices and model inference results. The technical solution is as follows:
[0005] A method for intelligent coding mapping of commodity names based on a pre-trained model comprises the following steps:
[0006] S1: The user enters the product name, and the product tax classification code is matched through the cache mechanism. If the match is successful, the matching result is directly returned. If it is unsuccessful, it goes to step S2;
[0007] S2: Matching is performed through the model service of the pre-trained model. If the match is successful, the pre-trained model is weighted and sorted with the historical invoice data through a weighted sorting mechanism, and finally the model inference result is returned to the user. At the same time, the model inference result is written into the cache mechanism. If the match is inaccurate, go to step S3;
[0008] S3: Users submit accuracy results through the feedback mechanism. After the salesperson reviews and approves the results, the data enters the business database for use in the next upgrade and iteration of the pre-trained model.
[0009] Furthermore, in step S2, the training process of the pre-trained model includes the following steps:
[0010] S11: Data fusion is performed through multiple data sources to obtain data summary;
[0011] S12: performing data preprocessing on the data aggregation to obtain a training sample set;
[0012] S13: Perform text preprocessing on the training data set to process the text into an input parameter form acceptable to the product code matching model;
[0013] S14: passing the training data set that has undergone text preprocessing to the product code matching model for training;
[0014] S15: Save the trained model weight file to the model service of the pre-trained model, perform service packaging and model deployment.
[0015] Furthermore, in step S12, the data preprocessing is to fuse data from different data sources, count the number of commodity code names and abbreviation categories, obtain the category quantity distribution, and then use the sampling algorithm to solve the problem of sample imbalance. For sample categories with a number greater than a threshold, undersampling is required, and for sample categories with a number less than a threshold, data enhancement is performed, and the finally processed data is used as a training data set.
[0016] Furthermore, in step S13, the text preprocessing is to process the text into an input form accepted by the model, including two processes: word segmentation and word embedding. Word segmentation is to convert sentences or short texts into phrases of word granularity or character granularity, collectively referred to as tokens, and the tokens are mapped into encoding sequences through a vocabulary. The encoding sequences are converted into high-dimensional dense vector representations of specific dimensions through a word embedding model as input parameters of the model.
[0017] Furthermore, in step S14, the product code matching model is a text classification model based on the pre-trained model ERNIE.
[0018] The cache mechanism is set up with two layers, the first layer caches the historical invoicing data, and the second layer cache mechanism is the record of the model's historical reasoning.
[0019] Furthermore, in step S12, the calculation formula of the weighted ranking mechanism is as follows:
[0020]
[0021] Among them, n represents the number of parts that need to be calculated for weighted probability, and p t Represents the probability of each commodity tax classification name, i represents a natural number, and Score represents the score of the weighted ranking mechanism;
[0022]
[0023] Among them, a is the weight adjustment factor, which is used to set the threshold size of the commodity tax classification probability, and r is the curve parameter, which is used to adjust the shape of the function curve.
[0024] A system for intelligent coding mapping of commodity names based on a pre-trained model includes a pre-trained model, a cache mechanism, a weighted ranking mechanism and a feedback mechanism. The cache mechanism includes a first mechanism and a second mechanism. When a user cannot obtain a matching result through the first mechanism, the user matches through the model service of the pre-trained model, and performs weighted ranking with historical invoice data through the weighted ranking mechanism. When a matching result is still not obtained, the accuracy result is submitted through the feedback mechanism.
[0025] The pre-trained model includes a data fusion module, a data preprocessing module, a text preprocessing module, a product code matching model, and a service packaging module. The summary data is obtained by fusing multiple data sources. After the summary data is subjected to data preprocessing and text preprocessing, it is passed to the product code matching model for training, and finally the trained model is packaged and deployed as a service.
[0026] The method and system for intelligent coding mapping of commodity names based on pre-trained models effectively improves the accuracy of commodity name tax classification coding mapping through a specific data preprocessing method based on a pre-trained model, a cache mechanism, and weighted ranking of model reasoning, thereby realizing commodity coding mapping efficiently and accurately. BRIEF DESCRIPTION OF THE DRAWINGS
[0027] Figure 1 It is a flowchart of the method for intelligent coding mapping of commodity names based on the pre-training model;
[0028] Figure 2is a flow chart of the data preprocessing module;
[0029] Figure 3 It is a schematic diagram of the cache mechanism flow. DETAILED DESCRIPTION
[0030] like Figure 1 As shown, the method for intelligent coding mapping of commodity names based on the pre-trained model includes the following steps:
[0031] S1: The user enters the product name, and the product tax classification code is matched through the cache mechanism. If the match is successful, the matching result is directly returned. If it is unsuccessful, it goes to step S2;
[0032] S2: Matching is performed through the model service of the pre-trained model. If the match is successful, the pre-trained model is weighted and sorted with the historical invoice data through a weighted sorting mechanism, and finally the model inference result is returned to the user. At the same time, the model inference result is written into the cache mechanism. If the match is inaccurate, go to step S3;
[0033] S3: Users submit accuracy results through the feedback mechanism. After the salesperson reviews and approves the results, the data enters the business database for use in the next upgrade and iteration of the pre-trained model.
[0034] Wherein, in step S2, the training process of the pre-trained model includes the following steps:
[0035] S11: Data fusion is performed through multiple data sources to obtain data summary;
[0036] The multiple data sources include a business database and a vertical domain database;
[0037] S12: performing data preprocessing on the data aggregation to obtain a training sample set;
[0038] like Figure 2 As shown, the data preprocessing is to fuse data from different data sources, count the number of commodity code names and abbreviation categories, obtain the category quantity distribution, and then use the sampling algorithm to solve the problem of sample imbalance. For categories with a number greater than a threshold, undersampling is required, and for categories with a number less than a threshold, data enhancement is performed, and the finally processed data is used as a training data set.
[0039] In one embodiment, the specific operation steps are as follows:
[0040] Data preprocessing is an important part of ensuring data quality, which mainly includes multi-data source fusion, data cleaning, sample balancing, etc. First, the business commodity database, vertical domain database and other multi-data sources are fused to generate a summary data set. Filter out the following from the data set: commodity name, commodity tax classification code, commodity tax classification code name, commodity tax classification code abbreviation, delete the data with empty commodity name and commodity tax classification code, and count the number of categories of commodity tax classification code name and abbreviation for each category. Divide the data set into training set and test set according to 7:3, and process the data with unbalanced samples in the training set by sampling algorithm. For the classification with sample category data exceeding a certain threshold, the data is under-sampled. For the classification with the number of categories less than a certain threshold, data enhancement is performed and similar nouns are replaced, such as "potato" is replaced with "potato", etc. In order to ensure the effect of the model, the sampling algorithm only processes the training set, and the test set maintains the original data distribution without sampling. The specific threshold setting is determined according to the experimental test results to determine the optimal parameter value.
[0041] S13: Perform text preprocessing on the training data set to process the text into an input parameter form acceptable to the product code matching model;
[0042] Text preprocessing is to process text into a form that can be accepted by the model. It mainly includes two processes: word segmentation and word embedding. Word segmentation is to convert sentences or short texts into phrases (characters) of word granularity or character granularity, collectively referred to as tokens. The tokens are mapped to encoding sequences through the vocabulary. The encoding sequences are converted into high-dimensional dense vector representations of specific dimensions through the word embedding model as the input parameters of the model.
[0043] In one embodiment, the specific operation steps are as follows:
[0044] Text preprocessing is to segment and embed the text. For example, the product name "white thermoplastic acrylic floor paint" has the following segmentation results: ['CLS', 'white', 'heat', 'plastic', 'property', 'acrylic', 'ene', 'acid', 'floor', 'floor', 'paint', 'SEP']. The first word is the CLS mark, which can be used for subsequent classification tasks. SEP represents the sentence symbol, which is used to separate two sentences in the input corpus. The segmentation result is mapped into the encoding sequence input_ids through the vocabulary, and the result is: [1,368,506,1261,92,2269,2387,865,31,2193,2188,2]. Finally, the encoding sequence is converted into a 768-dimensional high-dimensional dense vector representation such as [[0.5266,-0.1351,-0.7377,...,0.0786,0.1343,-0.3493], [0.5266,-0.1351,-0.7377,...,0.0786,0.1343,-0.3493],] through the embedding model.
[0045] S14: passing the text-preprocessed training data set to the commodity code matching model for training; the commodity code matching model is a text classification model based on the pre-trained model ERNIE, which is a knowledge-enhanced pre-trained language model. It uses a self-attention mechanism, pre-training tasks, and a semantic framework for continuous learning. The model contains rich syntactic, grammatical, and semantic information knowledge. Based on its prior knowledge, it can better learn the inter-class and intra-class features of more than 4,000 categories of commodity name tax classification codes through model fine-tuning training by setting domain training data. This can improve the accuracy of commodity name tax classification code matching.
[0046] S15: Finally, the trained model weight file is saved to the model service of the pre-trained model for service packaging and model deployment.
[0047] The cache mechanisms in step S1 and step S2 are two different cache mechanisms. Figure 3 As shown, in order to improve the query efficiency, the present invention sets up a two-layer cache mechanism. The first layer cache is the historical invoicing data, and the second layer cache mechanism is the record of the model's historical reasoning. When the user enters the product name for the product name tax classification code, the two layers of cache retrieval are performed first. If the match is successful, the corresponding result is returned. If it fails, the model service reasoning is performed, and the model service reasoning result is added to the second layer cache. The retrieval process can be recalled through ES or text similarity sorting. The specific implementation of the retrieval method is prior art and will not be repeated. By passing the product name through this cache mechanism, the efficiency of retrieval is greatly improved.
[0048] In one embodiment, the specific operation steps are as follows:
[0049] The system has set up a two-layer cache mechanism. One layer is the historical invoice issuance data, which is the business data synchronized from the business database, and the other layer is the historical record data of model reasoning. Input: Product name "white thermoplastic acrylic floor paint", output:
[0050]
[0051]
[0052]
[0053] In step S2, for some newly added commodity codes, the preprocessing model has poor model reasoning effect because the training data does not cover them or the coverage data is small. The present invention sets a weighted ranking mechanism, and its calculation formula is as follows:
[0054]
[0055] Among them, n represents the number of parts that need to be calculated for weighted probability, and p t Represents the probability of each commodity tax classification name, i represents a natural number. Score represents the score of the weighted ranking mechanism.
[0056]
[0057] Among them, a is the weight adjustment factor, which is used to set the threshold value of commodity tax classification probability, and r is the curve parameter, which is used to adjust the shape of the function curve. t When it is less than the threshold, the model classification probability will be given a relatively small weight, and this part will account for a smaller proportion of the total weighted result. t When it is greater than the threshold, a larger weight value will be given to the model classification probability, and the probability of this part will account for a larger proportion of the overall probability, thereby improving the overall matching accuracy of the model.
[0058] A system for intelligent coding mapping of commodity names based on a pre-trained model includes a pre-trained model, a cache mechanism, a weighted ranking mechanism and a feedback mechanism. The cache mechanism includes a first mechanism and a second mechanism. When a user cannot obtain a matching result through the first mechanism, the user matches through the model service of the pre-trained model, and performs weighted ranking with historical invoice data through the weighted ranking mechanism. When a matching result is still not obtained, the accuracy result is submitted through the feedback mechanism.
[0059] Specifically, when a user starts using it, he or she enters the name of the product, and first matches the product tax classification code through the cache mechanism. If the match is successful, the matching result will be directly returned. If the match is not successful, the model service will be used for matching. After the model service matches, it will use the weighted ranking mechanism to weight the historical invoice data to improve the overall matching accuracy of the model, and finally return it to the user. At the same time, the model inference result will be written into the cache mechanism. If the same product name is matched next time, the cache will be directly called to improve query efficiency. In addition, if the matching result is inaccurate, the user can submit the accuracy result through the feedback mechanism. After the salesperson reviews and approves it, the data will enter the business database for the next model upgrade and iteration.
[0060] The pre-trained model includes a data fusion module, a data preprocessing module, a text preprocessing module, a product code matching model, and a service packaging module. The summary data is obtained by fusing multiple data sources. After the summary data is subjected to data preprocessing and text preprocessing, it is passed to the product code matching model for training, and finally the trained model is packaged and deployed as a service.
[0061] The present invention mainly improves the accuracy of commodity name tax classification code mapping through a specific data preprocessing method, and based on a pre-trained model, a caching mechanism, and weighted ranking of model reasoning, thereby efficiently and accurately realizing commodity code mapping.
Claims
1. A method for intelligent coding mapping of commodity names based on a pre-trained model, comprising the following steps: S1: The user enters the product name, and the product tax classification code is matched through the cache mechanism. If the match is successful, the matching result is directly returned. If it is unsuccessful, it goes to step S2; S2: Matching is performed through the model service of the pre-trained model. If the match is successful, the pre-trained model is weighted and sorted with the historical invoice data through a weighted sorting mechanism, and finally the model inference result is returned to the user. At the same time, the model inference result is written into the cache mechanism. If the match is inaccurate, go to step S3; S3: Users submit accuracy results through the feedback mechanism. After the salesperson reviews and approves the results, the data enters the business database for use in the next upgrade and iteration of the pre-trained model.
2. The method for intelligent coding mapping of commodity names based on a pre-training model according to claim 1, characterized in that: In step S2, the training process of the pre-trained model includes the following steps: S11: Data fusion is performed through multiple data sources to obtain data summary; S12: performing data preprocessing on the data aggregation to obtain a training sample set; S13: Perform text preprocessing on the training data set to process the text into an input parameter form acceptable to the product code matching model; S14: passing the training data set that has undergone text preprocessing to the product code matching model for training; S15: Save the trained model weight file to the model service of the pre-trained model, perform service packaging and model deployment.
3. The method for intelligent coding mapping of commodity names based on a pre-training model according to claim 2 is characterized in that: In step S12, the data preprocessing is to fuse data from different data sources, count the number of commodity code names and abbreviation categories, obtain the category quantity distribution, and then use the sampling algorithm to solve the problem of sample imbalance. For sample categories with a number greater than a threshold, undersampling is required, and for sample categories with a number less than a threshold, data enhancement is performed, and the finally processed data is used as a training data set.
4. The method for intelligent coding mapping of commodity names based on a pre-training model according to claim 2, characterized in that: In step S13, the text preprocessing is to process the text into an input form accepted by the model, including two processes: word segmentation and word embedding. Word segmentation is to convert sentences or short texts into phrases of word granularity or character granularity, collectively referred to as tokens, and map tokens into encoding sequences through a vocabulary. The encoding sequences are converted into high-dimensional dense vector representations of specific dimensions through a word embedding model as input parameters of the model.
5. The method for intelligent coding mapping of commodity names based on a pre-training model according to claim 2 is characterized in that: In step S14, the product code matching model is a text classification model based on the pre-trained model ERNIE.
6. The method for intelligent coding mapping of commodity names based on a pre-training model according to claim 1, characterized in that: The cache mechanism is set up with two layers, the first layer caches the historical invoicing data, and the second layer cache mechanism is the record of the model's historical reasoning.
7. The method for intelligent coding mapping of commodity names based on a pre-training model according to claim 1, characterized in that: In step S12, the calculation formula of the weighted ranking mechanism is as follows: Among them, n represents the number of parts that need weighted probability calculation, p t Represents the probability of each commodity tax classification name, i represents a natural number, and Score represents the score of the weighted ranking mechanism; Among them, a is the weight adjustment factor, which is used to set the threshold size of the commodity tax classification probability, and r is the curve parameter, which is used to adjust the shape of the function curve.
8. A system for intelligent coding mapping of product names based on a pre-trained model, characterized in that: It includes a pre-trained model, a cache mechanism, a weighted ranking mechanism and a feedback mechanism. The cache mechanism includes a first mechanism and a second mechanism. When the user cannot obtain a matching result through the first mechanism, the user matches through the model service of the pre-trained model, and weighted ranks with historical invoice data through the weighted ranking mechanism. If a matching result is still not obtained, the accuracy result is submitted through the feedback mechanism.
9. The system for intelligent coding mapping of commodity names based on a pre-training model according to claim 8, characterized in that: The pre-trained model includes a data fusion module, a data preprocessing module, a text preprocessing module, a product code matching model, and a service packaging module. The summary data is obtained by fusing multiple data sources. After the summary data is subjected to data preprocessing and text preprocessing, it is passed to the product code matching model for training, and finally the trained model is packaged and deployed as a service.
Citation Information
Cited By
Multiple semantic analysis commodity name pairing and mutual recognition method
CN120509401A
Multi-e-commerce platform invoice centralized processing method and system
CN120743989A