Tax label identification method, device, electronic device and storage medium
By using two neural network models to process tax preferential documents, the problem of difficulty in identifying multiple taxes in the existing technology is solved, and the accurate identification of tax tags and effective extraction of multiple taxes is achieved.
Patent Information
- Application Number
- CN202210380174.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-04-12
- Publication Date
- 2025-08-26
- Estimated Expiration
- 2042-04-12
AI Technical Summary
In the prior art, tax preferential documents can only establish correspondence with a single category, and it is difficult to meet the needs of multiple tax identification.
Two neural network models are used to process tax preferential documents. First, the target text with the number of potential tax tags within the preset range is extracted through the first neural network model, and then the second neural network model is used for multi-label identification to determine the tax tag corresponding to the target text.
The accuracy of multi-tax label identification has been improved, and it can effectively meet the multi-tax identification needs of tax preferential documents.
Smart Images

Figure CN114724163B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of tax information processing, and in particular to a tax type label recognition method, device, electronic equipment and storage medium. Background Art
[0002] Tax incentive documents often contain information on multiple tax types with exemptions and reductions. Therefore, extracting this information from these documents is crucial for organizing and summarizing tax incentive documents. However, prior art methods typically associate tax incentive documents with only a single category, meaning they can only extract information on one tax type. This clearly makes it difficult to identify multiple tax types in tax incentive documents. Summary of the Invention
[0003] The purpose of the present invention is to provide a tax type label recognition method, device, electronic device and storage medium, which can use two neural network models to accurately identify multiple tax type labels in tax preferential documents.
[0004] To solve the above technical problems, the present invention provides a tax label recognition method, comprising:
[0005] Obtaining a tax incentive document and segmenting the tax incentive document to obtain clause text;
[0006] Extracting target text from the clause text using a pre-trained first neural network model; the number of tax type labels corresponding to the target text is within a preset range;
[0007] A pre-trained second neural network model is used to perform multi-label recognition on the target text within a preset tax type label range to obtain the tax type label corresponding to the target text.
[0008] Optionally, extracting the target text from the clause text using a pre-trained first neural network model includes:
[0009] Using the first neural network model to perform text classification on the clause text to obtain a classification label corresponding to the clause text; the classification label includes a first label and a second label, the first label indicating that the number of tax type labels in the clause text is within the preset range; the second label indicating that the number of tax type labels in the clause text exceeds the preset range;
[0010] The article text whose classification label is the first label is set as the target text.
[0011] Optionally, after obtaining the classification label corresponding to the clause text, the method further includes:
[0012] Setting the clause text whose classification label is the second label as special text;
[0013] Obtaining a label recognition regular expression corresponding to the target tax type label, and determining whether the label recognition regular expression can match the special text;
[0014] If so, the target tax type label is marked for the special text.
[0015] Optionally, the training process of the first neural network model includes:
[0016] Obtaining a training set; the training set includes a plurality of training clause texts, wherein the training clause texts are annotated with actual tax type labels;
[0017] Counting the number of actual tax type labels corresponding to each of the training clause texts, and determining the tax type number label corresponding to the training clause text according to the number of actual tax type labels; the tax type number label is the first label or the second label;
[0018] Inputting the training clause text into the first neural network model, so that the first neural network extracts features from the received training clause text and generates corresponding tax type number prediction labels using the obtained feature information; the tax type number prediction label is the first label or the second label;
[0019] Generate a loss value using a preset loss function and the tax type number labels and tax type number prediction labels corresponding to each of the training clause texts, and update the weights in the first neural network model using a backpropagation method and the loss value;
[0020] Enter the step of inputting the training clause text into the first neural network model until the loss value is less than a preset threshold, and then exit the training.
[0021] Optionally, inputting the training clause text into the first neural network model comprises:
[0022] Determining whether the text length of the training clause text is greater than a preset upper limit length;
[0023] If so, extracting a first character string of a first preset length from the front of the training clause text and extracting a second character string of a second preset length from the back of the training clause text, and concatenating the first character string and the second character string to obtain a processed training clause text; the sum of the first preset length and the second preset length is equal to the preset upper limit length;
[0024] If not, then fill the training clause text with empty characters until the length of the filled text is equal to the preset upper limit length, thereby obtaining the processed training clause text;
[0025] The processed training clause text is input into the first neural network model.
[0026] Optionally, the tax incentive document is segmented to obtain clause texts, including:
[0027] The tax incentive document is segmented using a preset document segmentation regular expression to obtain the clause text.
[0028] Optionally, the first neural network model and the second neural network model are BERT models.
[0029] The present invention also provides a tax label identification device, comprising:
[0030] An acquisition module is used to acquire tax preferential documents and segment the tax preferential documents to obtain clause texts;
[0031] A target text extraction module is configured to extract target text from the clause text using a pre-trained first neural network model; the number of tax type labels corresponding to the target text is within a preset range;
[0032] The multi-label recognition module is used to perform multi-label recognition on the target text within a preset tax type label range using a pre-trained second neural network model to obtain the tax type label corresponding to the target text.
[0033] The present invention further provides an electronic device, comprising:
[0034] Memory for storing computer programs;
[0035] A processor is used to implement the tax type label identification method as described above when executing the computer program.
[0036] The present invention also provides a storage medium, in which computer-executable instructions are stored. When the computer-executable instructions are loaded and executed by a processor, the tax type label identification method as described above is implemented.
[0037] The present invention provides a tax type label recognition method, comprising: obtaining a tax preferential document and segmenting the tax preferential document to obtain a clause text; extracting a target text from the clause text using a pre-trained first neural network model; the number of tax type labels corresponding to the target text is within a preset range; and performing multi-label recognition on the target text within a preset tax type label range using a pre-trained second neural network model to obtain a tax type label corresponding to the target text.
[0038] It can be seen that the present invention will adopt the first neural network model and the second neural network model to determine the multiple tax type labels corresponding to each clause text in the tax preferential document. Among them, the first neural network model of the present invention is used to pre-process the clause text to extract the target text from these texts, and the number of tax type labels corresponding to the target text is within a preset range. This is because if the number of potential tax type labels corresponding to the clause text is too large, it will affect the recognition accuracy of the neural network model. Therefore, the present invention adopts the first neural network model to pre-process the clause text, which can effectively improve the recognition accuracy of multiple tax type labels; in addition, the present invention will also adopt the second neural network model to perform multi-label recognition on the target text, which can effectively determine the multiple tax type labels corresponding to the target text, and thus can effectively meet the needs of multi-tax type recognition of tax preferential documents. The present invention also provides a label recognition device, electronic device and storage medium, which have the above-mentioned beneficial effects and will not be repeated here. BRIEF DESCRIPTION OF THE DRAWINGS
[0039] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are merely embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on the provided drawings without paying any creative work.
[0040] Figure 1 A flowchart of a tax label identification method provided by an embodiment of the present invention;
[0041] Figure 2 This is a structural block diagram of a tax label recognition device provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0042] To make the objectives, technical solutions, and advantages of the embodiments of the present invention more clear, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative efforts shall fall within the scope of protection of the present invention.
[0043] In the related art, tax preferential documents can usually only establish a correspondence with a single category, that is, the document can usually only extract information on one tax type, which obviously cannot meet the demand for multi-tax type identification of tax preferential documents. In view of this, the present invention provides a tax type label identification method that can use two neural network models to accurately identify multiple tax type labels in tax preferential documents. Please refer to Figure 1 , Figure 1 A flowchart of a tax label identification method provided by an embodiment of the present invention may include:
[0044] S101. Obtain a tax incentive document, and segment the tax incentive document to obtain a clause text.
[0045] It should be noted that the tax preferential document is a document containing a number of tax preferential information, for example, information on tax types involving reductions and exemptions, where the tax types may be personal income tax, stamp duty, etc. The embodiment of the present invention does not limit the method of obtaining the tax preferential document. For example, it can be downloaded manually, or it can be downloaded from a designated website using a preset crawler program, where the crawler is a program or script that captures information on the Internet according to certain rules. The designated website may be the website of the State Administration of Taxation, or the official website of each local tax bureau. In the embodiment of the present invention, in order to improve the efficiency of document acquisition, a preset crawler program may be used to download from a designated website. The embodiment of the present invention does not limit the specific crawler program, and related technologies of crawler program frameworks (such as BeautifulSoup) and related programming languages (such as Python) may be used.
[0046] Furthermore, to facilitate the identification of tax information, the embodiment of the present invention also segments the tax preferential documents to obtain a number of text sequences with clauses as the smallest text units. The embodiment of the present invention does not limit the specific method of segmenting the tax preferential documents. For example, it can be segmented manually or automatically using a preset regular expression. In the embodiment of the present invention, in order to improve the segmentation efficiency, a preset regular expression can be used for segmentation. It should be noted that the embodiment of the present invention does not limit the regular expression used to segment the tax preferential documents, and it can be set according to actual application requirements.
[0047] In one possible scenario, the tax incentive document is segmented to obtain the clause text, which may include:
[0048] Step 11: Use the preset document segmentation regular expression to segment the tax incentive document to obtain the clause text.
[0049] S102. Utilize a pre-trained first neural network model to extract a target text from the clause text; the number of tax type labels corresponding to the target text is within a preset range.
[0050] In an embodiment of the present invention, a pre-trained first neural network model is first used to pre-process the clause text to extract the target text in which the number of tax type labels potentially contained in the above text is within a preset range. In other words, the purpose of this step is to limit the number of tax type labels potentially contained in the target text. This is because the number of tax types potentially contained in each clause text is highly unevenly distributed. If this number is not effectively controlled, it will easily lead to a long-tail effect, which will easily reduce the accuracy of the multi-label prediction results generated by the neural network model for the clause text. It is for this reason that the present invention uses the first neural network model to control the number of tax type labels potentially contained in the clause text, which can effectively improve the accuracy of subsequent multi-label recognition to ensure the reliability of the multi-label recognition results. It should be noted that the embodiment of the present invention is not limited to a specific preset range, for example, it can be [1,4]. Of course, the specific upper limit value can also be adjusted freely. Furthermore, it should be noted that the embodiment of the present invention does not limit the type of task to be performed by the first neural network model. For example, the number of tax type labels corresponding to each clause text can be identified, and then the clause texts can be distinguished based on the identification results. Of course, the clause texts can also be binary-classified to extract clause texts whose potential number of tax type labels is within a preset range, and clause texts whose potential number of tax type labels is outside the preset range, and then the former are set as the target text. In the embodiment of the present invention, considering that the method of determining the number of tax type labels corresponding to each clause text has high requirements for the model training set, it is more difficult to implement in practice and it is difficult to achieve good results; and binary classification of clause texts is a relatively classic classification problem, which is easy to implement and can achieve good results. Therefore, the type of task to be performed by the first neural network model can be binary classification of clause texts.
[0051] In one possible scenario, extracting target text from clause text using a pre-trained first neural network model may include:
[0052] Step 21: Use the first neural network model to perform text classification on the clause text to obtain a classification label corresponding to the clause text; the classification label includes a first label and a second label, wherein the first label indicates that the number of tax type labels in the clause text is within a preset range; and the second label indicates that the number of tax type labels in the clause text exceeds the preset range.
[0053] Step 22: Set the clause text whose classification label is the first label as the target text.
[0054] It should be noted that the embodiment of the present invention does not limit the specific forms of the first label and the second label, as long as they can be distinguished from each other.
[0055] Furthermore, the embodiment of the present invention does not limit the specific type of the first neural network model, as long as it can complete the text classification task. Taking into account that the BERT model (Bidirectional Encoder Representation from Transformers) has good performance and effect on text classification, in the embodiment of the present invention, the first neural network model can adopt the BERT model. It should be pointed out that the BERT model is a pre-trained model, that is, the model has been trained with a large amount of corpus, and when performing actual tasks, the model needs to be fine-tuned using the training set corresponding to the task. The embodiment of the present invention does not limit the specific fine-tuning training process, and reference may be made to the relevant technologies of the BERT model.
[0056] Furthermore, for clause texts potentially containing more tax type tags than a preset range, embodiments of the present invention can also use preset regular expressions to determine the tax type tags corresponding to such texts. This is because tax preferential documents have distinct structural features, and regular expressions can match and search for text with such distinct structural features. Therefore, embodiments of the present invention can set corresponding regular expressions for specified target tax type tags, and then use these regular expressions to match special clause texts containing more tax type tags than the preset range. If a match is successful, the target tax type tag can be labeled for the special text.
[0057] In one possible scenario, after obtaining the classification label corresponding to the clause text, the following may also be included:
[0058] Step 31: Set the clause text whose classification label is the second label as special text;
[0059] Step 32: Obtain the label recognition regular expression corresponding to the target tax type label, and determine whether the label recognition regular expression can match the special text; if so, proceed to step 33; if not, ignore;
[0060] Step 33: Label the target tax type for the special text.
[0061] It should be noted that the embodiment of the present invention is not limited to a specific regular expression for tag recognition, and can be set according to actual application requirements.
[0062] S103: Use the pre-trained second neural network model to perform multi-label recognition on the target text within a preset tax type label range to obtain the tax type label corresponding to the target text.
[0063] After the extraction of the target text is completed, the second neural network model can be used to perform multi-label recognition on the text to extract one or more tax labels corresponding to the text. It can be understood that the tax label corresponding to the target text should belong to the preset tax label range, wherein the range contains multiple preset tax labels. It should be noted that the embodiment of the present invention does not limit the number of tax labels in the preset tax label range, which can be set according to actual application requirements. The embodiment of the present invention also does not limit the specific type of the second neural network model, as long as the model can complete the text multi-label recognition task. Preferably, since the BERT model has a better performance in performing multi-label recognition tasks, the second neural network model in the embodiment of the present invention can also adopt the BERT model.
[0064] Based on the above embodiment, the present invention will use a first neural network model and a second neural network model to determine the multiple tax type labels corresponding to each clause text in the tax preferential document. Among them, the first neural network model of the present invention is used to pre-process the clause text to extract the target text from these texts, and the number of tax type labels corresponding to the target text is within a preset range. This is because if the number of potential tax type labels corresponding to the clause text is too large, it will affect the recognition accuracy of the neural network model. Therefore, the present invention uses the first neural network model to pre-process the clause text, which can effectively improve the recognition accuracy of multiple tax type labels; in addition, the present invention also uses the second neural network model to perform multi-label recognition on the target text, which can effectively determine the multiple tax type labels corresponding to the target text, and thus can effectively meet the needs of multi-tax type recognition of tax preferential documents.
[0065] Based on the above embodiment, the training process of the neural network model is introduced below. In one possible scenario, the training process of the first neural network model may include:
[0066] S201. Obtain a training set; the training set includes multiple training clause texts, and the training clause texts are annotated with actual tax type labels.
[0067] It is understood that the actual tax type labels annotated with the training clause texts in the training set are all manually annotated. The present embodiment does not limit the number of actual tax type labels corresponding to these texts; this number may exceed or be within the above-prescribed range. Furthermore, the present embodiment does not limit the specific number of training clause texts; it can be set based on actual application requirements. It is understood that the greater the number of training clause texts, the better the training effect of the neural network model.
[0068] S202. Count the actual number of tax type labels corresponding to each training clause text, and determine the tax type number label corresponding to the training clause text according to the actual number of tax type labels; the tax type number label is the first label or the second label.
[0069] Since the first neural network model is used to classify the clause texts to determine whether the number of potential tax type labels corresponding to these clause texts is within a preset range or outside the preset range, the embodiment of the present invention first needs to count the actual number of tax type labels corresponding to each training clause text to mark these texts with the corresponding tax type number labels. It can be understood that the tax type number label is the first label or the second label. For the specific meanings of the first label and the second label, please refer to the above embodiment and will not be repeated here. It should be noted that step S202 is a step specially set when training the first neural network model, and this step may not be performed when training the second neural network model.
[0070] S203. Input the training clause text into the first neural network model, so that the first neural network extracts features of the received training clause text and uses the obtained feature information to generate corresponding tax type number prediction labels; the tax type number prediction labels are the first labels or the second labels.
[0071] Specifically, since neural network models typically require text length to be equal to a preset upper limit, embodiments of the present invention also preprocess the training clause text before inputting it into the first neural network model to meet the neural network model's requirements. Specifically, for training clause text whose length exceeds the preset upper limit, a first character string of a first preset length can be extracted from the front of the text, and a second character string of a second preset length can be extracted from the back of the text, where the sum of the first and second preset lengths equals the preset upper limit. Furthermore, simply concatenating the first and second character strings yields training clause text that meets the model's requirements. For training clause text whose length is less than the preset upper limit, a null character must be added to ensure that the padded text length equals the preset upper limit. It should be noted that embodiments of the present invention do not limit the specific values of the first and second preset lengths. For example, the first and second preset lengths can be 25% and 75% of the preset upper limit, respectively, and can be set based on actual application requirements. Embodiments of the present invention also do not limit the placement of the null character padding; for example, the null character can be added at the end of the training clause text. Furthermore, the embodiment of the present invention does not limit the specific value of the preset upper limit length, and reference may be made to the relevant technologies of the BERT model.
[0072] In one possible scenario, inputting the training clause text into the first neural network model may include:
[0073] Step 41: Determine whether the text length of the training clause text is greater than a preset upper limit length; if so, proceed to step 42; if not, proceed to step 43;
[0074] Step 42: extracting a first character string of a first preset length from the front of the training clause text, and extracting a second character string of a second preset length from the back of the training clause text, and concatenating the first character string and the second character string to obtain a processed training clause text; the sum of the first preset length and the second preset length is equal to the preset upper limit length;
[0075] Step 43: Filling the training clause text with null characters until the length of the filled text is equal to the preset upper limit length, thereby obtaining the processed training clause text;
[0076] Step 44: Input the processed training clause text into the first neural network model.
[0077] Furthermore, it should be noted that while this embodiment primarily describes the training process for the first neural network model, this process can also be used to train the second neural network model. The primary difference lies in the fact that the output of the second neural network model is the predicted tax type labels corresponding to the training clause text. During iterative updates, the loss value is calculated based on the predicted tax type labels and the actual tax type labels corresponding to the training clause text. Therefore, the training process for the first neural network model only needs to be adjusted based on these differences, and the training process for the second neural network model will not be detailed here.
[0078] Next, we will briefly introduce the process of inputting the training clause text into the neural network model for feature extraction. First, the input text is converted into a character-level sequence, and the maximum processable length is set to maxlen-1, where maxlen represents the preset upper limit length. For input text that exceeds the maximum length, according to the structural characteristics of the text, the embodiment of the present invention selects the processing method of splicing the head and the tail, that is, the first 0.25*maxlen characters and the last 0.75*maxlen characters are selected as the model input; and for those whose length is less than the maximum length, empty characters are filled in. Further, the cls symbol is added to the beginning of the character sequence to generate the representation of the sequence:
[0079] D i =[cls,t1,t2,...t maxlen-1 ]
[0080] input=V lookup (D i )
[0081] E = Word_Embedding(input)
[0082] Among them, D i represents the i-th character; V represents a vocabulary, which contains all the characters in the training set and their corresponding numbers. In addition, it also contains special characters such as "mask", "cls", "pad", "unk", and "seq" that have no actual semantics and are only used by the model to identify sequences. Among them, cls is used to mark the beginning of a character sequence; V lookup Refers to finding the number of the character in the vocabulary V; Word_Embedding maps the character to the word embedding vector, and the calculation process is input·W e , where W e is the weight matrix in the neural network model, which will be updated with iterative training. Further, the position embedding vector will be generated as follows:
[0083] P = Position_Embedding(input)
[0084] Position_Embedding=pos(input)·W p
[0085] Where P represents the position embedding vector, pos(input) refers to the position of the character in the sequence, and W p is another weight matrix in the neural network model.
[0086] Furthermore, the obtained word embedding vector and position embedding vector are input into the neural network model for processing. The neural network models in the embodiments of the present invention are all BERT models, and the core module of the model is Transformer. The core part of Transformer is the self-attention mechanism. Transformer uses positional embedding (PositionalEncoding) to understand the order of language, and uses the self-attention mechanism (Self Attention Mechanism) and the fully connected layer for calculation. The Transformer model is mainly divided into two parts, namely Encoder (encoder) and Decoder (decoder), where Encoder is responsible for mapping the input (language sequence) into a hidden layer. Specifically, the above process can be expressed as:
[0087] 1. Calculation: X = E + P
[0088] 2. Input the obtained X into the self-attention mechanism for processing:
[0089] Q=W q X
[0090] K=W k X
[0091] V=Wv X
[0092]
[0093] Among them, W q 、W k and W v are all weight matrices in the model, Q, K, and V are the three parameter vectors of the self-attention mechanism, dk represents the dimension, and Z is the feature output by the self-attention layer.
[0094] 3. Perform residual connection and normalization on self-attention features:
[0095] Define the normalization function:
[0096] Among them, x ij represents the jth feature of the i-th sample; μ j represents the mean of the jth feature; represents the variance of the j-th feature.
[0097] Calculation: X attention =X+Z
[0098] X attention =LayNorm(X attention )
[0099] where X attention It is the feature obtained by adding the features output by the self-attention layer and the original input, which is processed by the normalization function. Further, the feedforward residual connection and normalization are performed:
[0100] X hidden =Linear(ReLU(Linear(X attention )))
[0101] X hidden =X hidden +X attention
[0102] X hidden =LayNorm(X hidden )
[0103] Where linear(·) represents the linear connection layer, ReLU(·) represents the linear rectification function, and the final X hidden This is the output of the hidden layer. At this point, the deep semantic feature feature area of the text is complete.
[0104] 4. Use the fully linked layer to reduce the dimension of the first position of the hidden layer, that is, the feature vector corresponding to CLS (this vector includes all the semantic information of the entire sentence) to the number of labels t.
[0105] Y=Linear t (X hidden [0])
[0106] For the first neural network, t is 2; for the second neural network, the value of t is the same as the number of tax type labels included in the preset tax type label range.
[0107] 5. Use the sigmoid classifier to calculate the corresponding labels.
[0108] Y=σ(Y)
[0109] Where σ(x) represents the sigmoid classifier,
[0110] The domain of the sigmoid activation function can take any range of real numbers, and the returned output value is in the range of 0 to 1. As it approaches positive infinity or negative infinity, the function approaches a smooth state. The sigmoid function is also called the S-type function because its function curve resembles an S-shape. It should be noted that the sigmoid function calculates the probability of each label corresponding to the training clause text. For the first neural network model, the sigmoid function output is the probability sequence of the first and second labels corresponding to the training clause text; for the second neural network model, the sigmoid function output is the probability sequence of the various tax type labels corresponding to the training clause text. Furthermore, the label corresponding to the training clause text can be determined based on the probability sequence.
[0111] S204. Generate a loss value using a preset loss function and the tax type number labels and tax type number prediction labels corresponding to each training clause text, and update the weights in the first neural network model using the back propagation method and the loss value.
[0112] Specifically, the embodiment of the present invention may use the BCE loss function to determine the loss value of the neural network model in this round of training, where BCE (Binary Cross Entropy) represents binary cross entropy, and the back propagation method used is the Adam optimization algorithm.
[0113] S205: Enter the step of inputting the training clause text into the first neural network model until the loss value is less than a preset threshold, and then exit the training.
[0114] After training, evaluation metrics can be used to assess the effectiveness of the neural network model. Specifically, Hamming Loss, micro-F1 Score, Accuracy, and Jaccard Index can be used to assess the effectiveness of the neural network model. Specifically, Hamming Loss represents the proportion of incorrect samples in all labels, so the smaller the value, the stronger the classification ability of the classifier. The calculation formula is as follows:
[0115]
[0116] Where |L| represents the total number of labels, xor represents the exclusive OR operation, |Γ| represents the total number of test sets, and Y ti represents the i-th true value, Y pi represents the i-th predicted value.
[0117] Accuracy is defined as: given the prediction result Y p ∈R |Γ|*|L| and the true value Y t ∈R |Γ|*|L| , calculated as follows:
[0118]
[0119] Among them, Ξ(·) is the discriminant function, Ξ(Y ti ,Y pi )=1, all tags are recognized correctly, Ξ(Y ti ,Y pi )=0 Failed to identify all tags.
[0120] The Jaccard index, also known as the Jaccard similarity coefficient, is a statistic used to measure the similarity and diversity of a sample set. It is calculated as follows:
[0121]
[0122] Based on the above embodiment, the embodiment of the present invention can effectively train the first neural network model so that the model can determine whether the potential tax type label corresponding to the input clause text meets the recognition requirements.
[0123] The following introduces the tax type label identification device, electronic device and storage medium provided in the embodiments of the present invention. The tax type label identification device, electronic device and storage medium described below can be referenced to the tax type label identification method described above.
[0124] Please refer to Figure 2 , Figure 2This is a structural block diagram of a tax label recognition device provided by an embodiment of the present invention. The device may include:
[0125] The acquisition module 201 is used to acquire the tax preferential document and segment the tax preferential document to obtain the clause text;
[0126] The target text extraction module 202 is configured to extract the target text from the clause text using a pre-trained first neural network model; the number of tax type labels corresponding to the target text is within a preset range;
[0127] The multi-label recognition module 203 is used to perform multi-label recognition on the target text within a preset tax type label range using a pre-trained second neural network model to obtain the tax type label corresponding to the target text.
[0128] Optionally, the target text extraction module 202 may include:
[0129] a classification unit, configured to perform text classification on the clause text using the first neural network model to obtain a classification label corresponding to the clause text; the classification label includes a first label and a second label, wherein the first label indicates that the number of tax type labels in the clause text is within a preset range; and the second label indicates that the number of tax type labels in the clause text exceeds the preset range;
[0130] A setting unit is used to set the clause text whose classification label is the first label as the target text.
[0131] Optionally, the device may further include:
[0132] A setting module, used for setting the text of the clause whose classification label is the second label as special text;
[0133] A matching judgment module is used to obtain the label recognition regular expression corresponding to the target tax type label and judge whether the label recognition regular expression can match the special text;
[0134] The marking module is used to mark the target tax type label for the special text.
[0135] Optionally, the device may further include:
[0136] A training set acquisition module is used to acquire a training set; the training set includes multiple training clause texts, and the training clause texts are annotated with actual tax type labels;
[0137] The statistics and labeling module is used to count the actual number of tax type labels corresponding to each training clause text, and determine the tax type number label corresponding to the training clause text based on the actual number of tax type labels; the tax type number label is the first label or the second label;
[0138] a model training module, configured to input the training clause text into the first neural network model, so that the first neural network extracts features from the received training clause text and generates corresponding tax type number prediction labels using the obtained feature information; the tax type number prediction labels are the first labels or the second labels;
[0139] a model updating module, configured to generate a loss value using a preset loss function and the tax type number labels and tax type number prediction labels corresponding to each training clause text, and to update the weights in the first neural network model using a backpropagation method and the loss value;
[0140] The judgment module is used to enter the step of inputting the training clause text into the first neural network model until the loss value is less than a preset threshold value, and then exit the training.
[0141] Optionally, the model training module may include:
[0142] A text length judgment unit, used to judge whether the text length of the training clause text is greater than a preset upper limit length;
[0143] a first processing unit configured to extract a first character string of a first preset length from the front of the training clause text and a second character string of a second preset length from the back of the training clause text, and concatenate the first character string and the second character string to obtain a processed training clause text; wherein the sum of the first preset length and the second preset length is equal to a preset upper limit length;
[0144] The second processing unit is configured to fill the training clause text with null characters if no, until the length of the filled text is equal to a preset upper limit length, thereby obtaining a processed training clause text;
[0145] The input unit is used to input the processed training clause text into the first neural network model.
[0146] Optionally, the acquisition module 201 may include:
[0147] The segmentation unit is used to segment the tax preferential document using a preset document segmentation regular expression to obtain the clause text.
[0148] Optionally, the first neural network model and the second neural network model may be BERT models.
[0149] An embodiment of the present invention further provides an electronic device, including:
[0150] Memory for storing computer programs;
[0151] A processor is used to implement the steps of the above-mentioned tax type label identification method when executing a computer program.
[0152] Since the embodiments of the electronic device part correspond to the embodiments of the tax type label identification method part, the embodiments of the electronic device part refer to the description of the embodiments of the tax type label identification method part, which will not be repeated here.
[0153] An embodiment of the present invention further provides a storage medium storing a computer program, which, when executed by a processor, implements the steps of the tax type label identification method of any of the above embodiments.
[0154] Since the embodiments of the storage medium part correspond to the embodiments of the tax type label identification method part, the embodiments of the storage medium part refer to the description of the embodiments of the tax type label identification method part, which will not be repeated here.
[0155] The various embodiments in this specification are described in a progressive manner, with each embodiment focusing on the differences from other embodiments. Reference can be made to the common and similar parts between the various embodiments. For the devices disclosed in the embodiments, since they correspond to the methods disclosed in the embodiments, the description is relatively simple, and the relevant parts can be referred to the method description.
[0156] Professionals may further appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the above description has generally described the components and steps of each example according to their functions. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professionals and technicians may use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of the present invention.
[0157] The steps of the methods or algorithms described in conjunction with the embodiments disclosed herein may be implemented directly using hardware, a software module executed by a processor, or a combination of the two. The software module may be placed in a random access memory (RAM), internal memory, read-only memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, registers, a hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art.
[0158] The above is a detailed introduction to the tax label identification method, device, electronic device, and storage medium provided by the present invention. This article uses specific examples to illustrate the principles and implementation methods of the present invention. The description of the above embodiments is only intended to help understand the method and core concept of the present invention. It should be pointed out that for ordinary technicians in this technical field, without departing from the principles of the present invention, several improvements and modifications can be made to the present invention, and these improvements and modifications also fall within the scope of protection of the claims of the present invention.
Claims
1. A tax label recognition method, characterized in that: include: Obtaining a tax incentive document and segmenting the tax incentive document to obtain clause text; Extracting target text from the clause text using a pre-trained first neural network model, and controlling the number of tax type labels potentially contained in the clause text using the first neural network model; the number of tax type labels corresponding to the target text is within a preset range; Using a pre-trained second neural network model to perform multi-label recognition on the target text within a preset tax type label range, to obtain a tax type label corresponding to the target text; The extracting target text from the clause text using a pre-trained first neural network model includes: Using the first neural network model to perform text classification on the clause text to obtain a classification label corresponding to the clause text; the classification label includes a first label and a second label, the first label indicating that the number of tax type labels in the clause text is within the preset range; the second label indicating that the number of tax type labels in the clause text exceeds the preset range; The article text whose classification label is the first label is set as the target text.
2. The tax label identification method according to claim 1, characterized in that: After obtaining the classification label corresponding to the clause text, the following is also included: Setting the clause text whose classification label is the second label as special text; Obtaining a label recognition regular expression corresponding to the target tax type label, and determining whether the label recognition regular expression can match the special text; If so, the target tax type label is marked for the special text.
3. The tax label identification method according to claim 1, characterized in that: The training process of the first neural network model includes: Obtaining a training set; the training set includes a plurality of training clause texts, wherein the training clause texts are annotated with actual tax type labels; Counting the number of actual tax type labels corresponding to each of the training clause texts, and determining the tax type number label corresponding to the training clause text according to the number of actual tax type labels; the tax type number label is the first label or the second label; Inputting the training clause text into the first neural network model, so that the first neural network extracts features from the received training clause text and generates corresponding tax type number prediction labels using the obtained feature information; the tax type number prediction label is the first label or the second label; Generate a loss value using a preset loss function and the tax type number labels and tax type number prediction labels corresponding to each of the training clause texts, and update the weights in the first neural network model using a backpropagation method and the loss value; Enter the step of inputting the training clause text into the first neural network model until the loss value is less than a preset threshold, and then exit the training.
4. The tax label identification method according to claim 3, characterized in that: Inputting the training clause text into the first neural network model comprises: Determining whether the text length of the training clause text is greater than a preset upper limit length; If so, extracting a first character string of a first preset length from the front of the training clause text and extracting a second character string of a second preset length from the back of the training clause text, and concatenating the first character string and the second character string to obtain a processed training clause text; the sum of the first preset length and the second preset length is equal to the preset upper limit length; If not, then fill the training clause text with empty characters until the length of the filled text is equal to the preset upper limit length, thereby obtaining the processed training clause text; The processed training clause text is input into the first neural network model.
5. The tax label identification method according to claim 1, characterized in that: The tax incentive document is segmented to obtain clause text, including: The tax incentive document is segmented using a preset document segmentation regular expression to obtain the clause text.
6. The tax label recognition method according to any one of claims 1 to 5, characterized in that: The first neural network model and the second neural network model are BERT models.
7. A tax label recognition device, characterized in that: include: An acquisition module is used to acquire tax preferential documents and segment the tax preferential documents to obtain clause texts; a target text extraction module, configured to extract target text from the clause text using a pre-trained first neural network model, so as to control the number of tax type labels potentially contained in the clause text using the first neural network model; the number of tax type labels corresponding to the target text being within a preset range; a multi-label recognition module, configured to perform multi-label recognition on the target text within a preset tax type label range using a pre-trained second neural network model to obtain a tax type label corresponding to the target text; The target text extraction module includes: a classification unit, configured to perform text classification on the clause text using the first neural network model to obtain a classification label corresponding to the clause text; the classification label includes a first label and a second label, the first label indicating that the number of tax type labels in the clause text is within the preset range; and the second label indicating that the number of tax type labels in the clause text exceeds the preset range; A setting unit is configured to set the clause text whose classification label is the first label as the target text.
8. An electronic device, characterized in that: include: Memory for storing computer programs; A processor, configured to implement the tax type label identification method according to any one of claims 1 to 6 when executing the computer program.
9. A storage medium, characterized in that: The storage medium stores computer-executable instructions, which, when loaded and executed by a processor, implement the tax type label identification method according to any one of claims 1 to 6.
Citation Information
Patent Citations
Risk entity acquisition method and device
CN110880142A