Methods, apparatus, devices and storage media for determining text categories
By automatically identifying text categories through a pre-defined semantic representation model and a graph neural network model, the problem of low efficiency and low accuracy in existing technologies is solved, and the efficient construction of knowledge bases and knowledge graphs in industrial internet scenarios is realized.
Patent Information
- Application Number
- CN202211485681.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-11-24
- Publication Date
- 2026-11-17
- Estimated Expiration
- 2042-11-24
AI Technical Summary
Existing technologies are inefficient and inaccurate in determining text categories in industrial internet scenarios, affecting the speed and accuracy of knowledge base and knowledge graph construction.
By employing a pre-defined semantic representation model and a pre-defined graph neural network model, keyword and location information are obtained through preprocessing of the target text. The pre-defined graph neural network model is used to automatically identify the text category. Information updates and deep training are performed in conjunction with a pre-defined relationship graph to improve the efficiency and accuracy of text category determination.
It improves the efficiency and accuracy of text category determination, enhances the speed and quality of knowledge base and knowledge graph construction, and reduces the impact of human subjective factors.
Smart Images

Figure CN115757787B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of Internet technology, and in particular to a method, apparatus, device and storage medium for determining text categories. Background Technology
[0002] Currently, in the industrial internet scenario, standard knowledge can be described using knowledge bases or knowledge graphs. This allows for knowledge query functions to be provided to industrial internet practitioners or other users through human-computer interaction (e.g., Q&A). Building a knowledge base or knowledge graph typically involves first acquiring a large amount of text information (e.g., keywords), then manually labeling the text information according to its category, and finally constructing the knowledge base or knowledge graph based on this categorized text information.
[0003] However, existing methods for determining the text category of text information are not only inefficient, affecting the speed of building knowledge bases or knowledge graphs, but also subject to human subjective factors, resulting in low accuracy in determining the classification results. Summary of the Invention
[0004] This application provides a method, apparatus, device, and storage medium for determining text categories, which can improve the efficiency and accuracy of determining text categories.
[0005] To achieve the above objectives, this application adopts the following technical solution:
[0006] In a first aspect, this application provides a method for determining text categories, comprising: preprocessing the target text to obtain N keywords in the target text and the location information corresponding to the N keywords; the target text is text to be classified in an industrial internet scenario; N is a positive integer; calling a preset semantic representation model to process the N keywords and the location information corresponding to the N keywords to determine the N vectors corresponding to the N keywords; calling a preset graph neural network model to process the N vectors corresponding to the N keywords to determine the text category to which each of the N keywords belongs; wherein, the preset graph neural network model is obtained based on the M sample vectors corresponding to the M sample keywords in the sample text and the text category to which the M sample keywords belong; M is a positive integer.
[0007] In the technical solution provided in this application, after obtaining the text to be classified in the industrial internet scenario (i.e., the target text in this application), N keywords and their corresponding location information can be obtained through preprocessing. Then, the N keywords and their corresponding location information can be processed through a preset semantic representation model to determine the N vectors corresponding to the N keywords. Afterwards, the N vectors corresponding to the N keywords can be input into a pre-trained preset graph neural network model. Since this preset graph neural network model is obtained based on the M sample vectors corresponding to the M sample keywords in the sample text and the text categories to which the M sample keywords belong, inputting the N vectors corresponding to the N keywords into it will yield the text category to which each of the N keywords belongs. It can be seen that in this application, by representing the keywords in the text to be classified in the industrial internet scenario as vectors, the text category to which the keywords in the text to be classified belongs can be automatically identified based on the preset graph neural network model trained in advance according to the sample vectors corresponding to the sample keywords. Therefore, compared with existing methods for determining text categories, this application can improve the efficiency of determining text categories, thereby increasing the speed of constructing a knowledge base or knowledge graph in the industrial internet scenario. Furthermore, since the text category is automatically identified based on a preset graph neural network model, the identification results are not affected by human subjective factors, which can improve the accuracy of the identified text category.
[0008] Optionally, in one possible design approach, before the above-mentioned "calling a preset graph neural network model to process the N vectors corresponding to the N keywords", the following may also be included:
[0009] Based on the vector parameters of the M sample vectors corresponding to the M sample keywords, the M sample keywords are divided into X sample sets; each sample set corresponds to a sample vector, the vector parameters of the same sample vector are the same, and the sample keywords in the same sample set belong to the same text category; X is a positive integer;
[0010] Based on a pre-defined relationship graph, target relationship graphs corresponding to X sample sets are determined; the pre-defined relationship graph is used to represent the association between candidate text categories; the target relationship graph includes X nodes, with one node corresponding to one sample set.
[0011] Based on the target relationship graph, X sample vectors corresponding to X nodes, and the text category to which each of the X nodes belongs, the information of the X nodes is updated, and the X nodes after information update are subjected to deep training to obtain a preset graph neural network model.
[0012] Optionally, in another possible design approach, the above-mentioned "updating information on X nodes based on the target relationship graph, X sample vectors corresponding to X nodes, and the text category to which each of the X nodes belongs" may include:
[0013] Based on the target relationship graph and the preset number of convolutional network layers, the associated nodes of the target node are determined from X nodes; the target node is any one of the X nodes.
[0014] Based on the correlation parameters between the target node and associated nodes, the sample vectors corresponding to the target node and the associated nodes, the objective function of the target node is determined.
[0015] The target node is updated based on its objective function and the text category it belongs to.
[0016] Optionally, in another possible design approach, after "determining the associated nodes of the target node from X nodes" as described above, it may also include:
[0017] The degree of association between the target node and the associated node is determined based on the number of sample keywords in the sample set corresponding to the target node, the number of sample keywords in the sample set corresponding to the associated node, and the number M of sample keywords in the sample text.
[0018] Alternatively, in another possible design approach, the number of convolutional network layers is preset to 2 or 3.
[0019] Optionally, in another possible design approach, before dividing the M sample keywords into X sample sets based on the vector parameters of the M sample vectors corresponding to the M sample keywords, the method for determining the text category provided in this application may further include:
[0020] Obtain sample text and preprocess it to obtain M sample keywords and their corresponding location information.
[0021] The preset semantic representation model is invoked to process the M sample keywords and their corresponding location information to determine the M sample vectors corresponding to the M sample keywords.
[0022] Alternatively, in another possible design approach, candidate text categories include at least two of the following: domain nouns, technical nouns, organization names, geographical locations, related nouns, industries, patterns, time periods, policies, mechanisms and standards, indicators, programs and measures, and numerical values.
[0023] Secondly, this application provides a text category determination device, comprising: a preprocessing module and a determination module;
[0024] The preprocessing module is used to preprocess the target text to obtain N keywords in the target text and the location information of the N keywords; the target text is the text to be classified in the industrial internet scenario; N is a positive integer;
[0025] The determination module is used to call a preset semantic representation model to process N keywords and their corresponding position information, and determine N vectors corresponding to the N keywords;
[0026] The determination module is also used to call a preset graph neural network model to process the N vectors corresponding to the N keywords and determine the text category to which each of the N keywords belongs; wherein, the preset graph neural network model is obtained based on the M sample vectors corresponding to the M sample keywords in the sample text and the text category to which the M sample keywords belong; M is a positive integer.
[0027] Optionally, in one possible design, the text category determination device provided in this application further includes a segmentation module and a training module;
[0028] The partitioning module is used to divide the M sample keywords into X sample sets based on the vector parameters of the M sample vectors corresponding to the M sample keywords before the determination module calls the preset graph neural network model to process the N vectors corresponding to the N keywords. Each sample set corresponds to a type of sample vector, the vector parameters of the same type of sample vector are the same, and the sample keywords in the same sample set belong to the same text category; X is a positive integer.
[0029] The determination module is also used to determine the target relation graph corresponding to X sample sets based on the preset relation graph; the preset relation graph is used to represent the association between candidate text categories; the target relation graph includes X nodes, and one node corresponds to one sample set;
[0030] The training module is used to update the information of X nodes based on the target relationship graph, X sample vectors corresponding to X nodes, and the text category to which each of the X nodes belongs, and to perform deep training on the X nodes after the information update to obtain a preset graph neural network model.
[0031] Alternatively, in another possible design, the training module is specifically used for:
[0032] Based on the target relationship graph and the preset number of convolutional network layers, the associated nodes of the target node are determined from X nodes; the target node is any one of the X nodes.
[0033] Based on the correlation parameters between the target node and associated nodes, the sample vectors corresponding to the target node and the associated nodes, the objective function of the target node is determined.
[0034] The target node is updated based on its objective function and the text category it belongs to.
[0035] Optionally, in another possible design approach, the determining module is also used to determine the degree of association between the target node and the associated nodes based on the number of sample keywords in the sample set corresponding to the target node, the number of sample keywords in the sample set corresponding to the associated nodes, and the number of sample keywords M in the sample text after determining the associated nodes of the target node from the X nodes.
[0036] Alternatively, in another possible design approach, the number of convolutional network layers is preset to 2 or 3.
[0037] Optionally, in another possible design, the preprocessing module is also used to obtain sample text and preprocess the sample text before the partitioning module divides the M sample keywords into X sample sets based on the vector parameters of the M sample vectors corresponding to the M sample keywords, so as to obtain the M sample keywords in the sample text and the position information corresponding to the M sample keywords.
[0038] The determination module is also used to call a preset semantic representation model to process the M sample keywords and the location information corresponding to the M sample keywords, and determine the M sample vectors corresponding to the M sample keywords.
[0039] Alternatively, in another possible design approach, candidate text categories include at least two of the following: domain nouns, technical nouns, organization names, geographical locations, related nouns, industries, patterns, time periods, policies, mechanisms and standards, indicators, programs and measures, and numerical values.
[0040] Thirdly, this application provides a text category determination device, including a memory, a processor, a bus, and a communication interface; the memory is used to store computer execution instructions, and the processor is connected to the memory via the bus; when the text category determination device is running, the processor executes the computer execution instructions stored in the memory, so that the text category determination device performs the text category determination method as provided in the first aspect above.
[0041] Fourthly, this application provides a computer-readable storage medium storing instructions that, when executed by a computer, cause the computer to perform the method for determining a text category as provided in the first aspect.
[0042] Fifthly, this application provides a computer program product including computer instructions that, when executed on a computer, cause the computer to perform the method for determining a text category as provided in the first aspect.
[0043] It should be noted that the aforementioned computer instructions may be stored, in whole or in part, on a computer-readable storage medium. This computer-readable storage medium may be packaged together with the processor of a device defining the text category, or it may be packaged separately from the processor of a device defining the text category; this application does not impose any limitations on this.
[0044] The descriptions of the second, third, fourth, and fifth aspects in this application can be referenced to the detailed description of the first aspect; and the beneficial effects of the descriptions of the second, third, fourth, and fifth aspects can be referenced to the analysis of the beneficial effects of the first aspect, which will not be repeated here.
[0045] In this application, the names of the aforementioned devices or functional modules are not limited, and in actual implementation, these devices or functional modules may appear under other names. As long as the function of each device or functional module is similar to that of this application, they all fall within the scope of the claims of this application and their equivalents.
[0046] These or other aspects of this application will become more readily apparent in the following description. Attached Figure Description
[0047] Figure 1 A flowchart illustrating a method for determining a text category provided in an embodiment of this application;
[0048] Figure 2 A schematic diagram of a preset relationship graph provided in an embodiment of this application;
[0049] Figure 3 A schematic diagram of a target relationship graph provided in an embodiment of this application;
[0050] Figure 4 A flowchart illustrating another method for determining text categories provided in this application embodiment;
[0051] Figure 5 A schematic diagram of the structure of a text category determination device provided in an embodiment of this application;
[0052] Figure 6 This is a schematic diagram of the structure of a text category determination device provided in an embodiment of this application. Detailed Implementation
[0053] The method, apparatus, device, and storage medium for determining text categories provided in the embodiments of this application will now be described in detail with reference to the accompanying drawings.
[0054] In this article, the term "and / or" is merely a description of the relationship between related objects, indicating that there can be three relationships. For example, A and / or B can represent three situations: A exists alone, A and B exist simultaneously, and B exists alone.
[0055] The terms "first" and "second," etc., used in the specification and drawings of this application are used to distinguish different objects or to distinguish different treatments of the same object, rather than to describe a specific order of objects.
[0056] Furthermore, the terms "comprising" and "having," and any variations thereof, used in the description of this application are intended to cover non-exclusive inclusion. For example, a process, method, system, product, or apparatus that includes a series of steps or units is not limited to the steps or units listed, but may optionally include other steps or units not listed, or may optionally include other steps or units inherent to such process, method, product, or apparatus.
[0057] It should be noted that in the embodiments of this application, the words "exemplary" or "for example" are used to indicate examples, illustrations, or explanations. Any embodiment or design scheme described as "exemplary" or "for example" in the embodiments of this application should not be construed as being more preferred or advantageous than other embodiments or design schemes. Specifically, the use of the words "exemplary" or "for example" is intended to present the relevant concepts in a specific manner.
[0058] In the description of this application, unless otherwise stated, "a plurality of" means two or more.
[0059] Furthermore, the acquisition, storage, use, and processing of data in this application's technical solution all comply with relevant national laws and regulations.
[0060] Currently, in the industrial internet scenario, standard knowledge can be described using knowledge bases or knowledge graphs. This allows for knowledge query functions to be provided to industrial internet practitioners or other users through human-computer interaction (e.g., Q&A). Building a knowledge base or knowledge graph typically involves first acquiring a large amount of text information (e.g., keywords), then manually labeling the text information according to its category, and finally constructing the knowledge base or knowledge graph based on this categorized text information.
[0061] However, existing methods for determining the text category of text information are not only inefficient, affecting the speed of building knowledge bases or knowledge graphs, but also subject to human subjective factors, resulting in low accuracy in determining the classification results.
[0062] To address the problems existing in the prior art, this application provides a method for determining text categories. Compared with existing methods, this method improves the efficiency of text category determination, thereby increasing the speed of building knowledge bases or knowledge graphs in industrial internet scenarios. Furthermore, since the text category is automatically identified based on a preset graph neural network model, the identification result is not affected by subjective human factors, thus improving the accuracy of the determined text category.
[0063] The text category determination method provided in this application embodiment can be executed by the text category determination device provided in this application embodiment. The device can be implemented by software and / or hardware and integrated into the text category determination device that executes this method.
[0064] The method for determining text categories provided in the embodiments of this application will be described in detail below with reference to the accompanying drawings.
[0065] Reference Figure 1 The method for determining text categories provided in this application includes S101-S103:
[0066] S101. Preprocess the target text to obtain N keywords in the target text and the location information corresponding to the N keywords.
[0067] The method for determining text categories provided in this application embodiment can be applied to industrial internet scenarios. The target text can be the text to be classified in the industrial internet scenario; N is a positive integer.
[0068] In one possible implementation, preprocessing the target text involves processing it using a pre-trained word segmentation model. The target text is divided into multiple sentences based on delimiters, and redundant words are filtered out based on the subject-verb-object structure of each sentence, resulting in N keywords in the target text. Furthermore, the location information corresponding to each keyword can be determined simultaneously. For example, if the target text is "What theory should be followed in the cultivation of the industrial internet ecosystem? The cultivation of the industrial internet ecosystem should follow the VSP theory," then preprocessing this target text will yield two keywords: "industrial internet ecosystem" and "VSP theory." The data obtained after preprocessing the target text can be represented as follows: {"industrial internet ecosystem": [0, 6], "VSP theory": [33, 37]}. Here, [0, 6] represents the location information corresponding to the keyword "industrial internet ecosystem," and [33, 37] represents the location information corresponding to the keyword "VSP theory."
[0069] S102. Call the preset semantic representation model to process the N keywords and their corresponding position information to determine the N vectors corresponding to the N keywords.
[0070] The preset semantic representation model can be a pre-determined model. For example, the preset semantic representation model can be a BERT (Bidirectional Encoder Representation from Transformers, a pre-trained language representation model), which can convert keywords into vector representations based on the keyword's location information and its context. Specific methods for converting keywords into vector representations can be found in existing technologies, and this application does not limit these methods.
[0071] S103. Call the preset graph neural network model to process the N vectors corresponding to the N keywords and determine the text category to which each of the N keywords belongs.
[0072] The preset graph neural network model is obtained based on the M sample vectors corresponding to the M sample keywords in the sample text and the text categories to which the M sample keywords belong; M is a positive integer.
[0073] Optionally, before calling the preset graph neural network model to process the N vectors corresponding to the N keywords, the text category determination method provided in this application embodiment may further include: dividing the M sample keywords into X sample sets based on the vector parameters of the M sample vectors corresponding to the M sample keywords; determining the target relationship graph corresponding to the X sample sets according to the preset relationship graph; updating the information of the X nodes based on the target relationship graph, the X sample vectors corresponding to the X nodes, and the text category to which each of the X nodes belongs, and performing deep training on the X nodes after the information update to obtain the preset graph neural network model.
[0074] In this context, a sample set corresponds to a sample vector, the same sample vector has the same vector parameters, and the sample keywords in the same sample set belong to the same text category; X is a positive integer.
[0075] When keywords are completely identical, the vector parameters of the corresponding sample vectors are the same. For example, if the first and second sentences of a sample text both contain the keyword "industrial internet ecosystem," then these two keywords can be grouped into the same sample set. For instance, among M sample keywords, 10 are "industrial internet ecosystem," 15 are "VSP theory," and 20 are "artificial intelligence." Therefore, the 10 keywords "industrial internet ecosystem" can be grouped into the same sample set, belonging to the text category of domain nouns; the 15 keywords "VSP theory" can also be grouped into the same sample set, belonging to the text category of domain nouns; and the 20 keywords "artificial intelligence" can be grouped into the same sample set, belonging to the text category of technical nouns.
[0076] A preset relationship graph can be a pre-determined relationship graph based on requirements, used to represent the associations between candidate text categories. For example, a preset relationship graph may include multiple nodes, where each node represents a candidate text category, and the associations between candidate text categories can be represented by connecting lines between nodes.
[0077] Optionally, candidate text categories include at least two of the following: domain terms, technical terms, organization names, geographical locations, related terms, industries, models, time periods, policies, mechanisms and standards, indicators, programs and measures, and numerical values.
[0078] Reference Figure 2 This provides a schematic diagram of a pre-defined relationship graph. For example... Figure 2 As shown, the preset relationship graph includes 13 nodes. The text categories corresponding to nodes 1 to 13 are domain nouns, technical nouns, organization names, geographical locations, related nouns, industries, models, time, policies, mechanisms and standards, indicators, plans and measures, and numerical values, respectively. When two nodes are connected by a connecting line, it indicates that there is a relationship between the two candidate text categories corresponding to these two nodes.
[0079] The target relationship graph includes X nodes, with each node corresponding to a sample set. Specifically, each sample set can be treated as a node. Based on the text category to which each sample set belongs, and combined with a pre-defined relationship graph, the relationships between the sample sets are determined. Connecting the nodes corresponding to the sample sets with relationships yields the target relationship graph.
[0080] Optionally, before dividing the M sample keywords into X sample sets based on the vector parameters of the M sample vectors corresponding to the M sample keywords, the text category determination method provided in this application embodiment further includes: obtaining sample text and preprocessing the sample text to obtain the M sample keywords and the position information corresponding to the M sample keywords in the sample text; calling a preset semantic representation model to process the M sample keywords and the position information corresponding to the M sample keywords to determine the M sample vectors corresponding to the M sample keywords.
[0081] Among them, the text categories to which the M sample keywords in the sample text belong must be included in the candidate text categories.
[0082] Optionally, updating the information of the X nodes based on the target relationship graph, the X sample vectors corresponding to the X nodes, and the text categories to which each of the X nodes belongs can include: determining the associated nodes of the target node from the X nodes based on the target relationship graph and a preset number of convolutional network layers; the target node being any one of the X nodes; determining the objective function of the target node based on the association degree parameter between the target node and the associated nodes, the sample vectors corresponding to the target node, and the sample vectors corresponding to the associated nodes; and updating the information of the target node based on the objective function of the target node and the text category to which the target node belongs.
[0083] The preset number of convolutional network layers is a predetermined value. Optionally, in order to ensure the accuracy of the trained model in determining the text category, the number of associated nodes of the target node should not be too large, so the preset number of convolutional network layers should not be too large, and can be 2 or 3 layers.
[0084] Associated nodes are nodes from the target node whose hop count is less than or equal to the preset number of convolutional network layers. (See reference...) Figure 3 It provides a schematic diagram of a target relationship graph, such as Figure 3 As shown, taking node i as the target node as an example, the associated nodes of node i are the nodes in Layer 1 and Layer 2, that is... Figure 3 The nodes are 1, 2, 3, 4 and 5.
[0085] For example, if the updated information of target node i is represented by g(i), the function formed by the sample vector corresponding to target node i and the sample vector corresponding to associated node j is represented by f(j), and the correlation parameter between target node i and associated node j is denoted by a... j In other words, then Where Y represents the total number of associated nodes of the target node.
[0086] Optionally, after determining the associated nodes of the target node from X nodes, the method for determining the text category provided in this application embodiment further includes: determining the degree of association between the target node and the associated nodes based on the number of sample keywords in the sample set corresponding to the target node, the number of sample keywords in the sample set corresponding to the associated nodes, and the number M of sample keywords in the sample text.
[0087] For example, if PMI(i,j) represents the degree of association between target node i and associated node j, then in, w represents the number of sample keywords M in the sample text, w(i) represents the number of sample keywords in the sample set corresponding to target node i, w(j) represents the number of sample keywords in the sample set corresponding to associated node j, w(i,j) = w(i) + w(j), w(i,j) represents the sum of the number of sample keywords in the sample set corresponding to target node i and the number of sample keywords in the sample set corresponding to associated node j.
[0088] In summary, the text category determination method provided in this application, after obtaining the text to be classified in the industrial internet scenario (i.e., the target text in this application), can first obtain N keywords and their corresponding location information through preprocessing. Then, a preset semantic representation model can be used to process the N keywords and their corresponding location information to determine the N vectors corresponding to the N keywords. Afterwards, the N vectors corresponding to the N keywords can be input into a pre-trained preset graph neural network model. Since this preset graph neural network model is obtained based on the M sample vectors corresponding to the M sample keywords in the sample text and the text categories to which the M sample keywords belong, inputting the N vectors corresponding to the N keywords into it can obtain the text category to which each of the N keywords belongs. It can be seen that in this application embodiment, by representing the keywords in the text to be classified in the industrial internet scenario as vectors, the text category to which the keywords in the text to be classified can be automatically identified based on the preset graph neural network model trained in advance according to the sample vectors corresponding to the sample keywords. Therefore, compared with existing methods for determining text categories, this application embodiment can improve the efficiency of determining text categories, thereby increasing the speed of constructing a knowledge base or knowledge graph in the industrial internet scenario. Furthermore, since the text category is automatically identified based on a preset graph neural network model, the identification results are not affected by human subjective factors, which can improve the accuracy of the identified text category.
[0089] Optional, such as Figure 4 As shown, this application embodiment also provides a method for determining text categories, including S401-S409:
[0090] S401. Obtain the sample text and preprocess it to obtain M sample keywords and their corresponding location information.
[0091] S402. Call the preset semantic representation model to process the M sample keywords and the location information corresponding to the M sample keywords, and determine the M sample vectors corresponding to the M sample keywords.
[0092] S403. Based on the vector parameters of the M sample vectors corresponding to the M sample keywords, divide the M sample keywords into X sample sets.
[0093] S404. Determine the target relationship graph corresponding to X sample sets based on the preset relationship graph.
[0094] S405. For each target node among the X nodes, based on the target relationship graph and the preset number of convolutional network layers, determine the associated nodes of the target node from the X nodes, and determine the target function of the target node based on the association degree parameter between the target node and the associated nodes, the sample vector corresponding to the target node and the sample vector corresponding to the associated nodes, and update the information of the target node based on the target function of the target node and the text category to which the target node belongs.
[0095] S406. Perform deep training on the X nodes after information update to obtain a preset graph neural network model.
[0096] S407. Preprocess the target text to obtain N keywords in the target text and the location information corresponding to the N keywords.
[0097] S408. Call the preset semantic representation model to process the N keywords and the location information corresponding to the N keywords, and determine the N vectors corresponding to the N keywords.
[0098] S409. Call the preset graph neural network model to process the N vectors corresponding to the N keywords and determine the text category to which each of the N keywords belongs.
[0099] like Figure 5 As shown in the figure, this application embodiment also provides a text category determination device, which may include a preprocessing module 11 and a determination module 21.
[0100] In this process, the preprocessing module 11 executes S101 in the above method embodiment, and the determining module 21 executes S102 and S103 in the above method embodiment.
[0101] Preprocessing module 11 is used to preprocess the target text to obtain N keywords in the target text and the location information corresponding to the N keywords; the target text is the text to be classified in the industrial Internet scenario; N is a positive integer;
[0102] The determination module 21 is used to call the preset semantic representation model to process N keywords and the position information corresponding to the N keywords, and determine the N vectors corresponding to the N keywords;
[0103] The determination module 21 is also used to call a preset graph neural network model to process the N vectors corresponding to the N keywords and determine the text category to which each of the N keywords belongs; wherein, the preset graph neural network model is obtained based on the M sample vectors corresponding to the M sample keywords in the sample text and the text category to which the M sample keywords belong; M is a positive integer.
[0104] Optionally, in one possible design, the text category determination device provided in this application further includes a segmentation module and a training module;
[0105] The partitioning module is used to divide the M sample keywords into X sample sets based on the vector parameters of the M sample vectors corresponding to the M sample keywords before the determination module 21 calls the preset graph neural network model to process the N vectors corresponding to the N keywords. Each sample set corresponds to a type of sample vector, the vector parameters of the same type of sample vector are the same, and the sample keywords in the same sample set belong to the same text category. X is a positive integer.
[0106] The determination module 21 is also used to determine the target relationship graph corresponding to X sample sets based on the preset relationship graph; the preset relationship graph is used to represent the association between candidate text categories; the target relationship graph includes X nodes, and one node corresponds to one sample set;
[0107] The training module is used to update the information of X nodes based on the target relationship graph, X sample vectors corresponding to X nodes, and the text category to which each of the X nodes belongs, and to perform deep training on the X nodes after the information update to obtain a preset graph neural network model.
[0108] Alternatively, in another possible design, the training module is specifically used for:
[0109] Based on the target relationship graph and the preset number of convolutional network layers, the associated nodes of the target node are determined from X nodes; the target node is any one of the X nodes.
[0110] Based on the correlation parameters between the target node and associated nodes, the sample vectors corresponding to the target node and the associated nodes, the objective function of the target node is determined.
[0111] The target node is updated based on its objective function and the text category it belongs to.
[0112] Optionally, in another possible design, the determining module 21 is also used to determine the degree of association between the target node and the associated node after determining the associated node of the target node from the X nodes, based on the number of sample keywords in the sample set corresponding to the target node, the number of sample keywords in the sample set corresponding to the associated node, and the number of sample keywords M in the sample text.
[0113] Alternatively, in another possible design approach, the number of convolutional network layers is preset to 2 or 3.
[0114] Optionally, in another possible design, the preprocessing module 11 is also used to obtain sample text and preprocess the sample text before the partitioning module divides the M sample keywords into X sample sets based on the vector parameters of the M sample vectors corresponding to the M sample keywords, so as to obtain the M sample keywords in the sample text and the position information corresponding to the M sample keywords.
[0115] The determination module 21 is also used to call a preset semantic representation model to process the M sample keywords and the location information corresponding to the M sample keywords, and determine the M sample vectors corresponding to the M sample keywords.
[0116] Alternatively, in another possible design approach, candidate text categories include at least two of the following: domain nouns, technical nouns, organization names, geographical locations, related nouns, industries, patterns, time periods, policies, mechanisms and standards, indicators, programs and measures, and numerical values.
[0117] Optionally, the text category determination device may also include a storage module for storing program code, etc., of the text category determination device.
[0118] like Figure 6 As shown, embodiments of this application also provide a text category determination device, including a memory 41 and a processor (e.g., ...). Figure 6 The processor includes 42-1 and 42-2, bus 43, and communication interface 44; memory 41 is used to store computer execution instructions, and the processor is connected to memory 41 via bus 43; when the text category determination device is running, the processor executes the computer execution instructions stored in memory 41 to cause the text category determination device to perform the text category determination method provided in the above embodiments.
[0119] In a specific implementation, as one example, the processor may include one or more central processing units (CPUs), for example... Figure 6 CPU0 and CPU1 are shown in the diagram. Furthermore, as one embodiment, the device for determining the text category may include multiple processors, such as... Figure 6 The processors 42-1 and 42-2 are shown in the diagram. Each of these processors (CPUs) can be a single-core processor or a multi-core processor. Here, "processor" can refer to one or more devices, circuits, and / or processing cores used to process data (e.g., computer program instructions).
[0120] The memory 41 may be a read-only memory (ROM) or other type of static storage device capable of storing static information and instructions, random access memory (RAM) or other type of dynamic storage device capable of storing information and instructions, or electrically erasable programmable read-only memory (EEPROM), compact disc read-only memory (CD-ROM) or other optical disc storage, optical disc storage (including compressed optical discs, laser discs, optical discs, digital versatile optical discs, Blu-ray discs, etc.), magnetic disk storage media or other magnetic storage devices, or any other medium capable of carrying or storing desired program code in the form of instructions or data structures and accessible by a computer, but not limited thereto. The memory 41 may exist independently and be connected to the processor via bus 43. The memory 41 may also be integrated with the processor.
[0121] In a specific implementation, memory 41 is used to store the data in this application and the computer execution instructions corresponding to the software program of this application. The processor can perform various functions of the device by running or executing the software program stored in memory 41 and calling the data stored in memory 41 to determine the text category.
[0122] Communication interface 44 uses any transceiver-like device for communicating with other devices or communication networks, such as control systems, radio access networks (RAN), wireless local area networks (WLANs), etc. Communication interface 44 may include a receiving unit to implement receiving functions and a transmitting unit to implement transmitting functions.
[0123] Bus 43 can be an industry standard architecture (ISA) bus, a peripheral component interconnect (PCI) bus, or an extended industry standard architecture (EISA) bus, etc. This bus 43 can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 6 The bus is represented by a single thick line, but this does not mean that there is only one bus or one type of bus.
[0124] As an example, combined Figure 5 The function implemented by the determination module in the text category determination device is the same as... Figure 6 The processor in the same module performs the same function. When the text category determination device includes a storage module, the storage module performs the same function as... Figure 6 The memory in them performs the same function.
[0125] The explanation of the relevant content in this embodiment can be found in the above method embodiment, and will not be repeated here.
[0126] Through the above description of the embodiments, those skilled in the art will clearly understand that, for the sake of convenience and brevity, only the division of the above functional modules is used as an example. In practical applications, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above. The specific working process of the system, device, and unit described above can be referred to the corresponding process in the foregoing method embodiments, and will not be repeated here.
[0127] This application also provides a computer-readable storage medium storing instructions that, when executed by a computer, cause the computer to perform the text category determination method provided in the above embodiments.
[0128] The computer-readable storage medium can be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples of a computer-readable storage medium (a non-exhaustive list) include: an electrical connection having one or more wires, a portable computer disk, a hard disk, RAM, ROM, an erasable programmable read-only memory (EPROM), a register, a hard disk, an optical fiber, a CD-ROM, an optical storage device, a magnetic storage device, or any suitable combination thereof, or any other form of computer-readable storage medium known in the art. An exemplary storage medium is coupled to a processor, enabling the processor to read information from and write information to the storage medium. Of course, the storage medium can also be a component of the processor. The processor and the storage medium can reside in an application-specific integrated circuit (ASIC). In embodiments of this application, the computer-readable storage medium can be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system, apparatus, or device.
[0129] The above description is merely a specific embodiment of this application, but the scope of protection of this application is not limited thereto. Any changes or substitutions within the technical scope disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.
Claims
1. A method for determining text categories, characterized in that, include: Based on the vector parameters of the M sample vectors corresponding to the M sample keywords, the M sample keywords are divided into X sample sets; A sample set corresponds to a sample vector. Sample vectors of the same type have the same vector parameters, and the sample keywords in the same sample set belong to the same text category; where X and M are positive integers. The target relationship graph corresponding to the X sample sets is determined according to the preset relationship graph; the preset relationship graph is used to represent the association between candidate text categories; the target relationship graph includes X nodes, and one node corresponds to one sample set. Based on the target relationship graph, the X sample vectors corresponding to the X nodes, and the text category to which each of the X nodes belongs, the information of the X nodes is updated, and the X nodes after information update are subjected to deep training to obtain a preset graph neural network model. The target text is preprocessed to obtain N keywords in the target text and the location information corresponding to the N keywords; the target text is the text to be classified in the industrial internet scenario; N is a positive integer; A preset semantic representation model is invoked to process the N keywords and their corresponding location information to determine the N vectors corresponding to the N keywords; A preset graph neural network model is invoked to process the N vectors corresponding to the N keywords, thereby determining the text category to which each of the N keywords belongs; The step of updating the information of the X nodes based on the target relationship graph, the X sample vectors corresponding to the X nodes, and the text category to which each of the X nodes belongs includes: Based on the target relationship graph and the preset number of convolutional network layers, the associated nodes of the target node are determined from the X nodes; the target node is any one of the X nodes. Based on the number of sample keywords in the sample set corresponding to the target node, the number of sample keywords in the sample set corresponding to the associated node, and the number M of sample keywords in the sample text, the correlation parameter between the target node and the associated node is determined; based on the correlation parameter between the target node and the associated node, the sample vector corresponding to the target node, and the sample vector corresponding to the associated node, the objective function of the target node is determined. The target node is updated based on its objective function and the text category it belongs to.
2. The method for determining text categories according to claim 1, characterized in that, The preset number of convolutional network layers is 2 or 3.
3. The method for determining text categories according to claim 1, characterized in that, Before dividing the M sample keywords into X sample sets based on the vector parameters of the M sample vectors corresponding to the M sample keywords, the method further includes: Obtain sample text and perform the preprocessing on the sample text to obtain the M sample keywords in the sample text and the position information corresponding to the M sample keywords; The preset semantic representation model is invoked to process the M sample keywords and the location information corresponding to the M sample keywords, and the M sample vectors corresponding to the M sample keywords are determined.
4. The method for determining text categories according to any one of claims 1-3, characterized in that, The candidate text categories include at least two of the following: domain terms, technical terms, organization names, geographical locations, related terms, industries, models, time periods, policies, mechanisms and standards, indicators, programs and measures, and numerical values.
5. A device for determining text categories, characterized in that, include: The preprocessing module is used to preprocess the target text to obtain N keywords in the target text and the location information corresponding to the N keywords; The target text is the text to be classified in an industrial internet scenario; N is a positive integer; The determination module is used to call a preset semantic representation model to process the N keywords and the location information corresponding to the N keywords, and determine the N vectors corresponding to the N keywords; After identifying the associated nodes of the target node from X nodes, the degree of association between the target node and the associated nodes is determined based on the number of sample keywords in the sample set corresponding to the target node, the number of sample keywords in the sample set corresponding to the associated nodes, and the number M of sample keywords in the sample text. The determination module is also used to call a preset graph neural network model to process the N vectors corresponding to the N keywords and determine the text category to which each of the N keywords belongs; The partitioning module is used to divide the M sample keywords into X sample sets based on the vector parameters of the M sample vectors corresponding to the M sample keywords; each sample set corresponds to a sample vector, the vector parameters of the same sample vector are the same, and the sample keywords in the same sample set belong to the same text category; where X and M are positive integers. The first determining module is used to determine the target relationship graph corresponding to the X sample sets according to the preset relationship graph; the preset relationship graph is used to represent the association relationship between candidate text categories; the target relationship graph includes X nodes, and one node corresponds to one sample set. The training module is used to update the information of X nodes based on the target relationship graph, X sample vectors corresponding to X nodes and the text category to which each of the X nodes belongs, and to perform deep training on the X nodes after information update to obtain a preset graph neural network model. The training module is specifically used for: determining the associated nodes of the target node from the X nodes based on the target relationship graph and a preset number of convolutional network layers; the target node is any one of the X nodes; determining the objective function of the target node based on the association degree parameter between the target node and the associated node, the sample vector corresponding to the target node, and the sample vector corresponding to the associated node; and updating the information of the target node based on the objective function of the target node and the text category to which the target node belongs.
6. A device for determining text categories, characterized in that, It includes a memory, a processor, a bus, and a communication interface; the memory is used to store computer-executed instructions, and the processor is connected to the memory via the bus; When the text category determination device is running, the processor executes the computer execution instructions stored in the memory to cause the text category determination device to perform the text category determination method as described in any one of claims 1-4.
7. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores instructions that, when executed by a computer, cause the computer to perform the method for determining a text category as described in any one of claims 1-4.
Citation Information
Patent Citations
Method and device for training business model and determining text classification categories
CN111737474A
Text classification method and device, computer equipment and storage medium
CN113011533A
