Method and system for building AI knowledge base model for enterprises
By preprocessing and entity recognition of enterprise knowledge texts, building enterprise knowledge graphs and using graph neural network training to generate AI knowledge base models, the problem that existing technology is difficult to adapt to different industry application scenarios is solved, and efficient knowledge retrieval and Intelligent service.
Patent Information
- Application Number
- CN202411446819.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-16
- Publication Date
- 2024-12-27
- Estimated Expiration
- 2044-10-16
AI Technical Summary
The existing knowledge base model is difficult to adapt to application scenarios in different industries, and the construction method is cumbersome and low efficiency, so it is impossible to effectively process the enterprise's huge and complex knowledge documents to train a standard knowledge base model.
By obtaining enterprise knowledge text, preprocessing and entity division, using BiLSTM model to identify part of speech, extracting structured text information, building enterprise knowledge graphs, and generating an AI knowledge base model through graph neural network training to achieve adaptation to different application scenarios.
It improves the accuracy of structured information extraction and the efficiency of knowledge retrieval, and can provide intelligent question-and-answer, recommendation and analysis services to adapt to the diverse application scenarios of enterprises.
Smart Images

Figure CN118964641B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of creating an AI knowledge base model for an enterprise, and in particular to a method and system for building an AI knowledge base model for an enterprise. Background Art
[0002] The knowledge base model is a method that uses machine learning technology to extract knowledge from large amounts of data and build a structured knowledge base. This model has a wide range of applications in information retrieval, question-answering systems, recommendation systems and other fields.
[0003] The existing knowledge base model can be trained through a large number of enterprise knowledge documents. However, as the business of enterprises continues to develop, the number of enterprise knowledge documents is huge and diverse, and the relationship between enterprise data is also complicated. Therefore, it is necessary to analyze and process the association relationship of enterprise knowledge documents in order to train a standard knowledge base model to adapt to application scenarios such as intelligent question-and-answer interaction, material recommendation, and customer insight in different industries. However, the existing organization and construction of training data is relatively chaotic, making it difficult to train a knowledge base model that can cope with various application scenarios of enterprises.
[0004] In the technical solution with application number CN202111555500.8, although it crawls the knowledge information stored on existing websites, parses and maps the knowledge information, obtains a predefined legal field knowledge base model, and obtains natural language questions based on natural language sequences, trains the predefined legal field knowledge base model, obtains the entity representation and relationship representation of the predefined legal field knowledge base model, preprocesses the natural language questions, generates a continuous representation of the natural language questions, obtains a triple representation, scores the triples to obtain a scoring result, converts the scoring result into a probability distribution, and optimizes the scoring result through a teacher model and a student model to obtain the final legal field knowledge base model, the trained knowledge base model can only be applied to the legal field and cannot be applied to different industries.
[0005] In the technical solution with application number CN202311635195.2, although it realizes the construction of a standard digital knowledge base, the construction method is cumbersome and inefficient. Summary of the invention
[0006] The present invention provides a method and system for constructing an AI knowledge base model for an enterprise, by organizing and constructing training data to train a knowledge base model that can cope with various application scenarios of the enterprise.
[0007] To solve the above problems, the present invention adopts the following technical solutions:
[0008] The present invention provides a method for constructing an AI knowledge base model for an enterprise, comprising:
[0009] Acquire enterprise knowledge text, pre-process the enterprise knowledge text, and obtain standard enterprise knowledge text;
[0010] The standard enterprise knowledge text is divided into a plurality of paragraphs, and the standard enterprise knowledge text of each paragraph is divided into entities to obtain a plurality of entities;
[0011] Using a pre-trained BiLSTM model to identify the part of speech of each entity, and extracting structured text information of the standard enterprise knowledge text according to the part of speech of each entity;
[0012] Extracting multiple key knowledge points from the structured text information, and constructing an enterprise knowledge graph of the standard enterprise knowledge text according to the multiple key knowledge points, wherein the enterprise knowledge graph represents the relationship between each of the key knowledge points;
[0013] Construct a graph neural network, use the enterprise knowledge graph to train the graph neural network, and generate an AI knowledge base model.
[0014] Preferably, multiple key knowledge points are extracted from the structured text information, including:
[0015] Performing vectorization processing on the structured text information to generate a target feature vector;
[0016] Using the Density Peaks clustering algorithm to cluster all the target feature vectors to obtain at least one class and a center vector;
[0017] Extracting relevant context of the structured text information corresponding to each class, and generating a label corresponding to each class according to the relevant context;
[0018] The correlation between the central vector and the label corresponding to each class is calculated, and the text content corresponding to the class with a correlation greater than a preset value is screened out as the key knowledge point.
[0019] Preferably, vectorizing the structured text information to generate a target feature vector includes:
[0020] Using a pre-trained Word2Vec model, each entity of the structured text information is converted into a word embedding vector;
[0021] Generate a word embedding matrix according to all the word embedding vectors, calculate the average value of all the word embedding vectors to obtain the average word embedding vector, and multiply the word embedding matrix by the average word embedding vector to obtain a target word embedding matrix, wherein each row of the word embedding matrix represents a word embedding vector of an entity;
[0022] Calculating a covariance matrix of the target word embedding matrix, wherein the covariance matrix is used to determine the variance and correlation of entities in the structured text information;
[0023] Calculate the eigenvalues and corresponding first eigenvectors of the covariance matrix, wherein the first eigenvectors are used to define a principal component space, and the eigenvalues represent the variance contribution of each principal component;
[0024] According to the magnitude of the eigenvalues, select the first eigenvectors corresponding to the first N largest eigenvalues to obtain a second eigenvector, wherein N is a positive integer, and the second eigenvector represents the main change direction of the structured text information;
[0025] All the word embedding vectors are mapped to the new space formed by the second feature vector to obtain a target feature vector after dimensionality reduction.
[0026] Furthermore, after the graph neural network is trained using the enterprise knowledge graph to generate an AI knowledge base model, the method further includes:
[0027] Get the conversation content entered by the customer in the chat box;
[0028] Performing vectorization processing on the conversation content to obtain a vector corresponding to the conversation content;
[0029] Calling the AI knowledge base model to analyze and process the vector corresponding to the conversation content, and screening out text information whose vector corresponding to the conversation content has a similarity greater than a preset degree;
[0030] Reply information corresponding to the conversation content is generated according to the text information, and the reply information is returned to the client.
[0031] Furthermore, after generating reply information corresponding to the conversation content according to the text information and returning the reply information to the client, the method further includes:
[0032] Obtaining multiple rounds of conversation content with the customer;
[0033] Extracting keywords from the multiple rounds of conversation content, and analyzing the sentiment tendency of each keyword using TextBlob;
[0034] The customer's interest points are determined according to the sentiment tendency of each keyword, product information related to the interest points is matched, and the product information is recommended to the customer.
[0035] Preferably, constructing the enterprise knowledge graph of the standard enterprise knowledge text according to the multiple key knowledge points includes:
[0036] Determine entity information, relationship information, and attribute value pairs of the plurality of key knowledge points;
[0037] Selecting an initial knowledge representation model, mapping entity information, relationship information, and attribute value pairs of the plurality of key knowledge points to the initial knowledge representation model to obtain a first knowledge representation, wherein the initial knowledge representation model includes a graph database model;
[0038] Converting entity information from different sources in the first knowledge representation into a unified standard format to obtain multiple standard entity information;
[0039] Convert each of the standard entity information into a vector to obtain an entity vector;
[0040] respectively calculating the Euclidean distance between each two entity vectors, and performing entity matching on the entity information of the first knowledge representation according to the Euclidean distance to obtain a second knowledge representation;
[0041] The second knowledge representation is evaluated in sequence for completeness, consistency, accuracy and coverage, and the second knowledge representation that passes all evaluations is used as the enterprise knowledge graph of the standard enterprise knowledge text.
[0042] Preferably, the enterprise knowledge graph is used to train the graph neural network to generate an AI knowledge base model, including:
[0043] Inputting the enterprise knowledge graph into the graph neural network for multiple iterative training to obtain a predicted label output by the graph neural network;
[0044] Obtaining the real label corresponding to the enterprise knowledge graph;
[0045] According to the predicted labels and the true labels, a cross entropy loss function is used to calculate the loss value of the graph neural network after each training;
[0046] When the loss value is greater than a preset loss value, the original parameters of the graph neural network are adjusted according to the loss value, and the graph neural network with adjusted parameters is trained again using the enterprise knowledge graph until the training stop condition of the graph neural network is reached.
[0047] Preferably, adjusting the original parameters of the graph neural network according to the loss value includes:
[0048] Obtaining original parameters of the graph neural network;
[0049] Calculate the gradient of the enterprise knowledge graph with respect to each of the original parameters using the cross entropy loss function and the loss value;
[0050] Sort the gradient of each of the original parameters in descending order to obtain a target sorting, wherein the gradient represents the speed and direction of change of the cross entropy loss function;
[0051] The original parameters of the graph neural network are adjusted in turn according to each gradient corresponding to the target sorting.
[0052] Preferably, the enterprise knowledge text is preprocessed to obtain a standard enterprise knowledge text, including:
[0053] After the enterprise knowledge text is cleaned, deduplicated, formatted and stop words are removed, a standard enterprise knowledge text is generated.
[0054] The present invention provides a system for building an AI knowledge base model for an enterprise, comprising:
[0055] An acquisition module, used for acquiring enterprise knowledge text, preprocessing the enterprise knowledge text, and obtaining a standard enterprise knowledge text;
[0056] A segmentation module is used to segment the standard enterprise knowledge text into multiple paragraphs, and perform entity division on the standard enterprise knowledge text in each paragraph to obtain multiple entities;
[0057] A recognition module, used to recognize the part of speech of each entity using a pre-trained BiLSTM model, and extract structured text information of the standard enterprise knowledge text according to the part of speech of each entity;
[0058] A construction module, used to extract multiple key knowledge points from the structured text information, and construct an enterprise knowledge graph of the standard enterprise knowledge text according to the multiple key knowledge points, wherein the enterprise knowledge graph represents the relationship between each of the key knowledge points;
[0059] The training module is used to build a graph neural network, use the enterprise knowledge graph to train the graph neural network, and generate an AI knowledge base model.
[0060] Compared with the prior art, the technical solution of the present invention has at least the following advantages:
[0061] The method and system for building an AI knowledge base model for an enterprise provided by the present invention obtains enterprise knowledge text, pre-processes the enterprise knowledge text, obtains a standard enterprise knowledge text, divides the standard enterprise knowledge text into multiple paragraphs, and divides the standard enterprise knowledge text of each paragraph into entities to obtain multiple entities. The pre-trained BiLSTM model is used to identify the part of speech of each entity, and the structured text information of the standard enterprise knowledge text is extracted according to the part of speech of each entity, which can more accurately identify the entities and their attributes in the text, thereby improving the accuracy of structured information extraction; at the same time, by extracting multiple key knowledge points from the structured text information, the unstructured text is converted into structured knowledge points, which is convenient for model analysis and processing; and the enterprise knowledge map of the standard enterprise knowledge text is constructed according to multiple key knowledge points. The enterprise knowledge map can integrate and represent key knowledge points and their interrelationships, provide a comprehensive and interconnected knowledge view for the model, and also help the model discover new knowledge connections and insights, and promote model self-optimization. In addition, the structured knowledge points and knowledge map also make knowledge retrieval faster and more accurate, and improve the efficiency of knowledge application. Finally, by building a graph neural network and using the enterprise knowledge graph to train the graph neural network and generate an AI knowledge base model, we can provide more intelligent question-answering, recommendation, and analysis services to cope with various application scenarios of the enterprise. BRIEF DESCRIPTION OF THE DRAWINGS
[0062] Figure 1 This is a flowchart of an embodiment of a method for building an AI knowledge base model for an enterprise according to the present invention;
[0063] Figure 2 This is a flowchart of another embodiment of the method for constructing an AI knowledge base model for an enterprise according to the present invention;
[0064] Figure 3 This is a module block diagram of an embodiment of a system for building an AI knowledge base model for an enterprise according to the present invention. DETAILED DESCRIPTION
[0065] In order to enable those skilled in the art to better understand the solutions of the present invention, 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.
[0066] In some of the processes described in the specification and claims of the present invention and the above-mentioned figures, multiple operations that appear in a specific order are included, but it should be clearly understood that these operations may not be executed in the order in which they appear in this article or executed in parallel. The sequence numbers of the operations, such as S11, S12, etc., are only used to distinguish between different operations, and the sequence numbers themselves do not represent any execution order. In addition, these processes may include more or fewer operations, and these operations may be executed in sequence or in parallel. It should be noted that the descriptions of "first", "second", etc. in this article are used to distinguish different messages, devices, modules, etc., do not represent the order of precedence, and do not limit the "first" and "second" to be different types.
[0067] It will be understood by those of ordinary skill in the art that, unless expressly stated, the singular forms "a", "an", "said" and "the" used herein may also include plural forms. It should be further understood that the term "comprising" used in the specification of the present invention refers to the presence of the features, integers, steps, operations, elements and / or components, but does not exclude the presence or addition of one or more other features, integers, steps, operations, elements, components and / or groups thereof. It should be understood that when we refer to an element as being "connected" or "coupled" to another element, it may be directly connected or coupled to the other element, or there may be intermediate elements. In addition, the "connection" or "coupling" used herein may include wireless connection or wireless coupling. The term "and / or" used herein includes all or any unit and all combinations of one or more associated listed items.
[0068] It will be understood by those skilled in the art that, unless otherwise defined, all terms (including technical and scientific terms) used herein have the same meaning as those generally understood by those skilled in the art in the art to which the present invention belongs. It should also be understood that terms such as those defined in general dictionaries should be understood to have meanings consistent with the meanings in the context of the prior art, and will not be interpreted with idealized or overly formal meanings unless specifically defined as here.
[0069] The technical solutions in the embodiments of the present invention will be described clearly and completely below in conjunction with the drawings in the embodiments of the present invention, wherein the same or similar reference numerals throughout represent the same or similar elements or elements with the same or similar functions. Obviously, the described embodiments are only some embodiments of the present invention, not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of the present invention.
[0070] See also Figure 1 The present invention provides a method for constructing an AI knowledge base model for an enterprise, comprising:
[0071] S11. Obtain enterprise knowledge texts, preprocess the enterprise knowledge texts to obtain standard enterprise knowledge texts;
[0072] S12. Split the standard enterprise knowledge texts into multiple paragraphs, and respectively perform entity partitioning on the standard enterprise knowledge texts of each paragraph to obtain multiple entities;
[0073] S13. Use a pre-trained BiLSTM model to identify the part-of-speech of each entity, and extract the structured text information of the standard enterprise knowledge texts according to the part-of-speech of each entity;
[0074] S14. Extract multiple key knowledge points from the structured text information, and construct an enterprise knowledge graph of the standard enterprise knowledge texts according to the multiple key knowledge points. The enterprise knowledge graph represents the relationships between the key knowledge points;
[0075] S15. Construct a graph neural network, and use the enterprise knowledge graph to train the graph neural network to generate an AI knowledge base model.
[0076] As described in step S11 above, enterprise knowledge texts refer to various documents containing enterprise information, such as reports, manuals, policy documents, etc. In this step, enterprise knowledge texts can be collected through digital means, including scanning, document conversion, etc., ensuring the data source of the AI knowledge base model.
[0077] The methods of preprocessing include cleaning the text, removing irrelevant content, punctuation marks, and special characters, etc. For example, NLP tools can be used to clean and segment the enterprise knowledge texts to obtain standard enterprise knowledge texts, so as to improve the quality of text data and lay a good foundation for subsequent processing.
[0078] In one embodiment, in step S11, preprocessing the enterprise knowledge texts to obtain standard enterprise knowledge texts may specifically include:
[0079] After performing text cleaning, text deduplication, format standardization processing, and removing stop words on the enterprise knowledge texts, standard enterprise knowledge texts are generated.
[0080] In this embodiment, text cleaning refers to removing irrelevant or unnecessary information in the text to perform text analysis more accurately; text deduplication refers to identifying and deleting duplicate content in the text to reduce data redundancy; format standardization processing refers to converting text data into a unified format for easy processing and analysis; stop words refer to words that frequently appear in the text but contribute little to the meaning of the text, such as "of", "and", "is", etc.
[0081] As described in the above step S12, this embodiment can use a sentence segmentation algorithm to segment the standard enterprise knowledge text into multiple paragraphs, and can also use the NLP library to perform text segmentation on the standard enterprise knowledge text to segment the long text into multiple paragraphs or sentences, so as to facilitate segment-by-segment processing and make entity recognition more accurate because the information contained in each paragraph is more concentrated.
[0082] Then, the named entity recognition algorithm is used to perform entity recognition and division on the standard corporate knowledge text of each paragraph, and multiple entities are obtained, such as names of people, places, organization names, etc., to extract key information from the text and provide nodes for building a knowledge graph.
[0083] Among them, the named entity recognition (NER) algorithm is a technology in the field of natural language processing (NLP), which aims to identify entities with specific meanings from unstructured text data and classify them into predefined categories. These entities are usually noun phrases in the text, which can include names, places, organizations, time expressions, numbers, proper nouns, etc.
[0084] As described in step S13 above, the pre-trained BiLSTM model is used to determine the part of speech of each entity and to mark it, such as noun, verb, etc., which helps to understand the grammatical structure of the text and provide support for information extraction. Then, according to the part of speech of each entity, a rule-based extraction algorithm is used to extract structured text information, such as attribute-value pairs, from the standard enterprise knowledge text to convert the unstructured text into a structured form that is easy to store and query.
[0085] Among them, the BiLSTM model is an extension of the long short-term memory network (LSTM), which takes into account both past and future information when processing sequence data. This model is particularly suitable for tasks that require understanding context, such as language models, text classification, named entity recognition, etc.
[0086] Rule-based extraction algorithms are a type of text processing method that uses predefined rules to extract specific information from text. These rules can be based on linguistic knowledge, keyword matching, pattern recognition, etc.
[0087] As described in step S14 above, key knowledge points are entities that can represent the semantics of standard enterprise knowledge texts, such as keywords, topics, etc., and knowledge graphs are semantic networks that represent entities and their relationships in the form of graphs. This step can construct an enterprise knowledge graph of standard enterprise knowledge texts based on multiple key knowledge points, and use a graph database or RDF to store the knowledge graph, thereby providing an intuitive and flexible way of representing knowledge, which facilitates the model to perform complex queries and analysis.
[0088] As described in step S15 above, the graph neural network is a deep learning model for processing graph structured data. This step uses the enterprise knowledge graph to train the graph neural network and generate an AI knowledge base model, so that the model can capture the complex patterns and relationships in the knowledge graph and improve the intelligence level of the knowledge base.
[0089] The method for building an AI knowledge base model for an enterprise provided by the present invention obtains enterprise knowledge text, pre-processes the enterprise knowledge text, obtains a standard enterprise knowledge text, divides the standard enterprise knowledge text into multiple paragraphs, and divides the standard enterprise knowledge text of each paragraph into entities to obtain multiple entities. The pre-trained BiLSTM model is used to identify the part of speech of each entity, and the structured text information of the standard enterprise knowledge text is extracted according to the part of speech of each entity, so that the entities and their attributes in the text can be more accurately identified, thereby improving the accuracy of structured information extraction; at the same time, by extracting multiple key knowledge points from the structured text information, the unstructured text is converted into structured knowledge points, which is convenient for model analysis and processing; and the enterprise knowledge map of the standard enterprise knowledge text is constructed according to multiple key knowledge points. The enterprise knowledge map can integrate and represent key knowledge points and their interrelationships, provide a comprehensive and interconnected knowledge view for the model, and also help the model discover new knowledge connections and insights, and promote model self-optimization. In addition, the structured knowledge points and knowledge map also make knowledge retrieval faster and more accurate, and improve the efficiency of knowledge application. Finally, by building a graph neural network and using the enterprise knowledge graph to train the graph neural network and generate an AI knowledge base model, we can provide more intelligent question-answering, recommendation, and analysis services to cope with various application scenarios of the enterprise.
[0090] In one embodiment, reference Figure 2 As shown, in step S14, multiple key knowledge points are extracted from the structured text information, which may specifically include the following steps:
[0091] S141, performing vectorization processing on the structured text information to generate a target feature vector;
[0092] S142, clustering all the target feature vectors using a Density Peaks clustering algorithm to obtain at least one class and a center vector;
[0093] S143, extracting the relevant context of the structured text information corresponding to each class, and generating a label corresponding to each class according to the relevant context;
[0094] S144, calculating the correlation between the central vector and the label corresponding to each class, and screening out the text content corresponding to the class with a correlation greater than a preset value as the key knowledge point.
[0095] As described in step S141 above, vectorization is the process of converting text into numerical vectors that capture the characteristics of the text. In this step, algorithms such as TF-IDF, Word2Vec, and BERT can be used to vectorize structured text information to generate target feature vectors. These algorithms can convert text into vectors of fixed dimensions to convert text information into a format that can be processed by machine learning algorithms.
[0096] As described in step S142 above, Density Peaks is a clustering algorithm based on the local density and distance of data points. The algorithm determines the cluster center by calculating the local density of each point and the distance from other points. Therefore, the Density Peaks clustering algorithm can be used to cluster all target feature vectors, perform cluster analysis on the target feature vectors, obtain at least one class and center vector, and there is no need to pre-specify the number of clusters, and can identify clusters of any shape.
[0097] As described in step S143 above, context refers to information surrounding text information, which helps to understand the meaning of the text. In this step, the relevant context of the structured text information corresponding to each class can be extracted through a window method or a context modeling algorithm to determine the text fragments around each cluster center as context, providing richer semantic information for each cluster.
[0098] Among them, labels are classifications or summaries of text information, which help identify the subject or content of the text. Based on contextual information, rules or machine learning algorithms can be used to generate labels corresponding to each class to assign a descriptive label to each cluster for easy understanding and use.
[0099] As described in step S144 above, the correlation measures the correlation or similarity between the central vector and the label. In this step, methods such as cosine similarity and Jaccard index can be used to calculate the correlation between the central vector and the label corresponding to each class to quantify the degree of match between the vector and the label, which helps to screen meaningful clusters.
[0100] Finally, highly relevant categories are screened out according to the correlation threshold. These categories represent key knowledge points. The key knowledge points are the most important and representative information points in the standard enterprise knowledge text, which helps to accurately construct the enterprise knowledge graph corresponding to the standard enterprise knowledge text.
[0101] In one embodiment, vectorization is performed on the structured text information to generate a target feature vector, including:
[0102] Using a pre-trained Word2Vec model, each entity of the structured text information is converted into a word embedding vector;
[0103] Generate a word embedding matrix according to all the word embedding vectors, calculate the average value of all the word embedding vectors to obtain the average word embedding vector, and multiply the word embedding matrix by the average word embedding vector to obtain a target word embedding matrix, wherein each row of the word embedding matrix represents a word embedding vector of an entity;
[0104] Calculating a covariance matrix of the target word embedding matrix, wherein the covariance matrix is used to determine the variance and correlation of entities in the structured text information;
[0105] Calculate the eigenvalues and corresponding first eigenvectors of the covariance matrix, wherein the first eigenvectors are used to define a principal component space, and the eigenvalues represent the variance contribution of each principal component;
[0106] According to the magnitude of the eigenvalues, select the first eigenvectors corresponding to the first N largest eigenvalues to obtain a second eigenvector, wherein N is a positive integer, and the second eigenvector represents the main change direction of the structured text information;
[0107] All the word embedding vectors are mapped to the new space formed by the second feature vector to obtain a target feature vector after dimensionality reduction.
[0108] In this embodiment, Word2Vec is a pre-trained word embedding model that can convert vocabulary into vector form to represent the semantic information of words. Word2Vec obtains the embedding vector of each word through training, and these vectors capture the contextual information of the word. In this embodiment, each entity of the structured text information is converted into a corresponding word embedding vector by inputting the structured text information into the pre-trained Word2Vec model.
[0109] The word embedding matrix is an entity-vector matrix, and each row corresponds to the word embedding vector of an entity. This embodiment initializes a matrix whose number of rows is equal to the number of entities in the entity set and the number of columns is equal to the dimension of the word embedding vector. The entity set is traversed, and the word embedding vector of each entity is filled in as a row of the matrix, and all word embedding vectors are ensured to have the same dimension to ensure the consistency of the number of columns of the matrix. For entities that do not exist in the word embedding model (unregistered words), you can choose to randomly initialize the vector, use a special vector (such as a zero vector or an average vector) to fill, or infer the word embedding vector through context information, and finally generate a word embedding matrix.
[0110] At the same time, the average of all word embedding vectors is calculated to obtain the average word embedding vector to provide a reference vector for subsequent matrix transformation.
[0111] The target word embedding matrix is obtained by multiplying the word embedding matrix with the average word embedding vector. The word embedding vector of each entity is mapped to a new space through multiplication transformation to help highlight the differences or similarities between entities.
[0112] The covariance matrix is a statistic used to measure the variance and correlation in a vector set. In this embodiment, the covariance matrix can be calculated based on the row vectors of the target word embedding matrix to characterize the correlation and degree of variation between entity vectors.
[0113] The eigenvalue and the first eigenvector are used to describe the characteristics of the covariance matrix. The first eigenvector points to the direction of the maximum variance and is used to define the principal component space. The eigenvalue represents the variance contribution of each principal component.
[0114] Then, the most important N eigenvectors are selected according to the size of the eigenvalue to obtain the second eigenvector, which is a collection of eigenvectors with the largest variance contribution except the first eigenvector. These eigenvectors capture the main change direction of the data. At the same time, the original word embedding vector is projected into the new space formed by the second eigenvector. The new space is defined by the second eigenvector and is used for dimensionality reduction, thereby reducing the dimension of the data while retaining the main change information.
[0115] Through the above technical means, this embodiment can convert high-dimensional word embedding vectors into low-dimensional representations, while retaining the main change characteristics of text data, which is helpful for subsequent text analysis and processing.
[0116] In one embodiment, calculating the covariance matrix of the target word embedding matrix includes:
[0117] Calculate the sample mean of the target word embedding matrix, and subtract the sample mean from each word embedding vector in turn to obtain a centered matrix;
[0118] For the centralization matrix, calculate the product of the centralization matrix and its own transposition to obtain an initial covariance matrix;
[0119] Decomposing the initial covariance matrix into multiple smaller sub-matrices, and recursively multiplying the multiple sub-matrices using the Strassen algorithm to obtain multiple target sub-matrices;
[0120] The multiple target sub-matrices are combined according to the rules of the Strassen algorithm to obtain a covariance matrix.
[0121] This embodiment first calculates the sample mean (or sample mean vector) of the target word embedding matrix. This is the basis for calculating the elements on the diagonal of the covariance matrix. The sample mean is subtracted from each word embedding vector in turn to obtain a centering matrix to eliminate the overall translation of each vector so that the covariance matrix can reflect the relative changes between vectors.
[0122] For the centered matrix, calculate its product with its own transpose to get the initial covariance matrix. Mathematically, if X is a centered matrix, the initial covariance matrix can be obtained by L = (1 / (n-1))*X*X T Get, where n is the number of word embedding vectors.
[0123] The Strassen algorithm is an efficient matrix multiplication algorithm that recursively decomposes a matrix into smaller sub-matrices and uses the relationship between these sub-matrices to reduce the number of multiplication operations. This embodiment can decompose the initial covariance matrix into multiple smaller sub-matrices. For the initial covariance matrix, it can be decomposed into seven sub-matrices, and the Strassen algorithm is applied to these sub-matrices for recursive multiplication. This means that each sub-matrix will also be further decomposed and multiplied to finally obtain multiple target sub-matrices. Finally, the calculated multiple target sub-matrices are combined according to the rules of the Strassen algorithm to obtain the final covariance matrix.
[0124] In one embodiment, after the graph neural network is trained using the enterprise knowledge graph to generate an AI knowledge base model, the method further includes:
[0125] Get the conversation content entered by the customer in the chat box;
[0126] Performing vectorization processing on the conversation content to obtain a vector corresponding to the conversation content;
[0127] Calling the AI knowledge base model to analyze and process the vector corresponding to the conversation content, and screening out text information whose vector corresponding to the conversation content has a similarity greater than a preset degree;
[0128] Reply information corresponding to the conversation content is generated according to the text information, and the reply information is returned to the client.
[0129] In this embodiment, the conversation content refers to the text message or voice message input by the customer in the chat interface. When the conversation content is a voice message, it needs to be converted into text information first.
[0130] Vectorization is the process of converting text into numerical vectors that can represent the characteristics of the text. For example, the conversation content is converted into a vector using algorithms such as Word2Vec, BERT or TF-IDF, and the vector corresponding to the conversation content is input into the AI knowledge base model, and the AI knowledge base model is called to analyze and process the vector corresponding to the conversation content. The model can understand the semantic content entered by the customer and match it with the information in the knowledge base, and screen out the text information whose vector corresponding to the conversation content is greater than the preset similarity, so as to quickly locate the information most relevant to the customer's query and improve the accuracy of the response. Finally, the reply information corresponding to the conversation content is generated according to the text information, and the reply information is returned to the customer to complete the interaction with the customer and provide the required information or solution. Among them, similarity refers to the similarity between two vectors, which can be calculated by measurement methods such as cosine similarity, which will not be repeated here.
[0131] In one embodiment, after generating reply information corresponding to the conversation content according to the text information and returning the reply information to the client, the method further includes:
[0132] Obtaining multiple rounds of conversation content with the customer;
[0133] Extracting keywords from the multiple rounds of conversation content, and analyzing the sentiment tendency of each keyword using TextBlob;
[0134] The customer's interest points are determined according to the sentiment tendency of each keyword, product information related to the interest points is matched, and the product information is recommended to the customer.
[0135] In this embodiment, the multi-round dialogue content refers to the continuous communication record between the customer and the system. After the system completes several rounds of dialogue with the customer, it obtains the multi-round dialogue content with the customer, and uses the TF-IDF and TextRank keyword extraction algorithms to extract keywords from the multi-round dialogue content. The keywords provide a preliminary understanding of the customer's interests and needs, and use TextBlob to analyze the emotional tendency of each keyword, such as positive or negative. The TextBlob is a sentiment analysis library used to identify the emotional tendency in the text to determine the emotional color of each keyword and provide a basis for understanding customer preferences. For example, when the keyword "A game" is mentioned in the conversation content, and after sentiment analysis, it is determined that the emotional tendency corresponding to the keyword is positive, it indicates that the customer is more interested in A game.
[0136] Among them, points of interest refer to topics or areas where customers show special attention or emotional inclinations. This embodiment can identify customers' interests based on the emotional inclinations and contextual information of keywords to help the system understand customers' needs and preferences more accurately. After determining the customer's points of interest, a matching algorithm is used to associate the points of interest with product information, and product information related to the points of interest is found from the knowledge base and recommended to the customer, so as to achieve intelligent and accurate recommendation of product information.
[0137] For example, suppose a customer has the following multi-turn conversation with the system:
[0138] Customer: "I'm looking for a new smartphone." System: "Do you have any special requirements for the camera function of the phone?" Customer: "I think phones with good night photography are great." The system records the customer's two sentences and extracts "smartphone", "night photography" and "great". Then, using TextBlob to analyze, it is found that the sentiment tendencies of "smartphone", "night photography" and "great" are all positive, and it is determined that the customer is interested in smartphones with good night photography functions. The system then finds several smartphones with high ratings and strong night photography functions in the knowledge base, recommends these phones to the customer, and briefly introduces their camera functions.
[0139] In one embodiment, constructing the enterprise knowledge graph of the standard enterprise knowledge text according to the multiple key knowledge points may specifically include:
[0140] Determine entity information, relationship information, and attribute value pairs of the plurality of key knowledge points;
[0141] Selecting an initial knowledge representation model, mapping entity information, relationship information, and attribute value pairs of the plurality of key knowledge points to the initial knowledge representation model to obtain a first knowledge representation, wherein the initial knowledge representation model includes a graph database model;
[0142] Converting entity information from different sources in the first knowledge representation into a unified standard format to obtain multiple standard entity information;
[0143] Convert each of the standard entity information into a vector to obtain an entity vector;
[0144] respectively calculating the Euclidean distance between each two entity vectors, and performing entity matching on the entity information of the first knowledge representation according to the Euclidean distance to obtain a second knowledge representation;
[0145] The second knowledge representation is evaluated in sequence for completeness, consistency, accuracy and coverage, and the second knowledge representation that passes all evaluations is used as the enterprise knowledge graph of the standard enterprise knowledge text.
[0146] This embodiment uses text analysis and information extraction technology to determine key information such as entity information, relationship information, and attribute value pairs of multiple key knowledge points from enterprise documents as basic data for building a knowledge graph. The key knowledge points include entities (such as companies, products), relationships (such as "belongs to", "developed"), and attribute value pairs (such as product prices and models).
[0147] The extracted key information is mapped to the graph database model. Each entity and relationship is a node and edge in the graph, thus forming a structured knowledge representation that is easy to query and update. The knowledge representation model is a method used to organize and store knowledge. The graph database model stores entities and relationships in the form of a graph, such as using the graph database Neo4j for data storage.
[0148] Unifying the standard format means standardizing entity information from different sources to obtain multiple standard entity information, so as to eliminate data redundancy and inconsistency and improve data consistency and comparability. For example, entity information from different sources should be named and attributed in a standardized manner. Then, word embedding technology or feature extraction methods are used to convert entities into vectors. Entity vectors convert entity information into numerical vectors for easy calculation and comparison.
[0149] The Euclidean distance formula is used to calculate the Euclidean distance between every two entity vectors. Based on the Euclidean distance threshold, similar entity vectors are matched as the same entity to obtain the second knowledge representation. The entity matching is the process of identifying and merging different expressions or records referring to the same entity, which solves the entity disambiguation problem and integrates knowledge.
[0150] Evaluation is the process of verifying the quality of knowledge representation, including completeness, consistency, accuracy and coverage, to ensure the quality of the knowledge graph and to discover and correct problems. Among them, completeness evaluation is used to check whether all known products and technologies have been entered into the graph. Consistency evaluation is used to ensure that the "developer" and "release time" information of each product are not contradictory. Accuracy evaluation is used to verify the accuracy of product attributes by comparing with officially released product specifications. Coverage evaluation is used to determine whether the graph covers all major product lines and technology areas of the enterprise.
[0151] In one embodiment, the graph neural network is trained using the enterprise knowledge graph to generate an AI knowledge base model, including:
[0152] Inputting the enterprise knowledge graph into the graph neural network for multiple iterative training to obtain a predicted label output by the graph neural network;
[0153] Obtaining the real label corresponding to the enterprise knowledge graph;
[0154] According to the predicted labels and the true labels, a cross entropy loss function is used to calculate the loss value of the graph neural network after each training;
[0155] When the loss value is greater than a preset loss value, the original parameters of the graph neural network are adjusted according to the loss value, and the graph neural network with adjusted parameters is trained again using the enterprise knowledge graph until the training stop condition of the graph neural network is reached.
[0156] This embodiment can use the nodes and edges in the enterprise knowledge graph as input, transmit and update information through the graph neural network, and generate prediction labels, so that the graph neural network can learn the entity and relationship features in the enterprise knowledge graph through training.
[0157] The true label is the actual category or attribute value corresponding to the entity or relationship in the enterprise knowledge graph. This embodiment obtains the correct label of each entity or relationship from the knowledge base or annotated data to provide a standard for evaluating the prediction accuracy of the graph neural network. Then, the cross entropy loss function is used to calculate the difference between the predicted label and the true label, and the loss value after each training of the graph neural network is obtained, which quantifies the accuracy of the model prediction and guides the adjustment of the model parameters. Among them, the cross entropy loss function is an indicator for evaluating the difference between the predicted probability distribution and the actual distribution.
[0158] When the loss value is greater than the preset loss value, the original parameters of the graph neural network are adjusted through the back propagation algorithm to reduce the prediction error and improve the model performance. The parameters of the graph neural network include weights and biases in the network, which are the parts that the model needs to learn during the training process. This parameter adjustment is the process of optimizing the model weights and biases based on the loss value feedback.
[0159] The training stop condition is a rule that determines when the model training ends, such as when the loss value is lower than a threshold or when the training reaches a predetermined number of times. The system monitors the training process of the graph neural network after adjusting the parameters, implements early stopping or other stopping criteria, avoids overfitting, and ensures the generalization ability of the model.
[0160] Through the above process, the graph neural network can continuously optimize its own parameters, improve the accuracy of predicting entity attributes in the enterprise knowledge graph, and ultimately generate a well-trained AI knowledge base model.
[0161] In one embodiment, adjusting the original parameters of the graph neural network according to the loss value includes:
[0162] Obtaining original parameters of the graph neural network;
[0163] Calculate the gradient of the enterprise knowledge graph with respect to each of the original parameters using the cross entropy loss function and the loss value;
[0164] Sort the gradient of each of the original parameters in descending order to obtain a target sorting, wherein the gradient represents the speed and direction of change of the cross entropy loss function;
[0165] The original parameters of the graph neural network are adjusted in turn according to each gradient corresponding to the target sorting.
[0166] This embodiment obtains the original parameters of the graph neural network. During the training process, the cross entropy loss function and the loss value are derived with respect to each parameter through the back propagation algorithm to obtain the gradient of the enterprise knowledge graph with respect to each of the original parameters. The gradient is the partial derivative of the loss function with respect to the parameter, which indicates the sensitivity of the loss function to the change of the parameter and provides information on the direction and speed of reducing the loss.
[0167] The absolute value of the gradient indicates the sensitivity of parameter adjustment to the loss function. Sorting is the process of arranging parameters in descending order according to the size of the gradient. This embodiment calculates the absolute value of the gradient of each parameter and arranges them in descending order to identify the parameters that have the greatest impact on the loss function and adjust these parameters first.
[0168] Parameter adjustment is the process of updating parameters based on gradient information, with the goal of reducing losses. This embodiment can adjust the parameters with the greatest impact based on the sorting results, and adjust the original parameters of the graph neural network in turn according to each gradient corresponding to the target sorting. When updating the parameters, the parameters are subtracted from the learning rate and multiplied by the gradient to achieve iterative optimization of the parameters, so as to improve the efficiency and effect of model training by selectively adjusting the parameters.
[0169] Please refer to Figure 3 The present invention provides a system for building an AI knowledge base model for an enterprise, comprising:
[0170] An acquisition module 31 is used to acquire enterprise knowledge text and pre-process the enterprise knowledge text to obtain a standard enterprise knowledge text;
[0171] A segmentation module 32 is used to segment the standard enterprise knowledge text into multiple paragraphs, and perform entity segmentation on the standard enterprise knowledge text in each paragraph to obtain multiple entities;
[0172] The recognition module 33 is used to recognize the part of speech of each entity by using the pre-trained BiLSTM model, and extract the structured text information of the standard enterprise knowledge text according to the part of speech of each entity;
[0173] A construction module 34 is used to extract multiple key knowledge points from the structured text information, and construct an enterprise knowledge graph of the standard enterprise knowledge text according to the multiple key knowledge points, wherein the enterprise knowledge graph represents the relationship between each of the key knowledge points;
[0174] The training module 35 is used to construct a graph neural network, use the enterprise knowledge graph to train the graph neural network, and generate an AI knowledge base model.
[0175] The system for building an AI knowledge base model for an enterprise provided by the present invention obtains enterprise knowledge text, pre-processes the enterprise knowledge text, obtains a standard enterprise knowledge text, divides the standard enterprise knowledge text into multiple paragraphs, and divides the standard enterprise knowledge text of each paragraph into entities to obtain multiple entities. The pre-trained BiLSTM model is used to identify the part of speech of each entity, and the structured text information of the standard enterprise knowledge text is extracted according to the part of speech of each entity, so that the entities and their attributes in the text can be more accurately identified, thereby improving the accuracy of structured information extraction; at the same time, by extracting multiple key knowledge points from the structured text information, the unstructured text is converted into structured knowledge points, which is convenient for model analysis and processing; and the enterprise knowledge map of the standard enterprise knowledge text is constructed according to multiple key knowledge points. The enterprise knowledge map can integrate and represent key knowledge points and their interrelationships, provide a comprehensive and interconnected knowledge view for the model, and also help the model discover new knowledge connections and insights, and promote model self-optimization. In addition, the structured knowledge points and knowledge map also make knowledge retrieval faster and more accurate, and improve the efficiency of knowledge application. Finally, by building a graph neural network and using the enterprise knowledge graph to train the graph neural network and generate an AI knowledge base model, we can provide more intelligent question-answering, recommendation, and analysis services to cope with various application scenarios of the enterprise.
[0176] In one embodiment, the building module 34 may also be used to:
[0177] Performing vectorization processing on the structured text information to generate a target feature vector;
[0178] Using the Density Peaks clustering algorithm to cluster all the target feature vectors to obtain at least one class and a center vector;
[0179] Extracting relevant context of the structured text information corresponding to each class, and generating a label corresponding to each class according to the relevant context;
[0180] The correlation between the central vector and the label corresponding to each class is calculated, and the text content corresponding to the class with a correlation greater than a preset value is screened out as the key knowledge point.
[0181] In one embodiment, the construction module 34 may also be specifically used for:
[0182] Using a pre-trained Word2Vec model, each entity of the structured text information is converted into a word embedding vector;
[0183] Generate a word embedding matrix according to all the word embedding vectors, calculate the average value of all the word embedding vectors to obtain the average word embedding vector, and multiply the word embedding matrix by the average word embedding vector to obtain a target word embedding matrix, wherein each row of the word embedding matrix represents a word embedding vector of an entity;
[0184] Calculating a covariance matrix of the target word embedding matrix, wherein the covariance matrix is used to determine the variance and correlation of entities in the structured text information;
[0185] Calculate the eigenvalues and corresponding first eigenvectors of the covariance matrix, wherein the first eigenvectors are used to define a principal component space, and the eigenvalues represent the variance contribution of each principal component;
[0186] According to the magnitude of the eigenvalues, select the first eigenvectors corresponding to the first N largest eigenvalues to obtain a second eigenvector, wherein N is a positive integer, and the second eigenvector represents the main change direction of the structured text information;
[0187] All the word embedding vectors are mapped to the new space formed by the second feature vector to obtain a target feature vector after dimensionality reduction.
[0188] In one embodiment, the system for building an AI knowledge base model for an enterprise further includes a calling module for:
[0189] Get the conversation content entered by the customer in the chat box;
[0190] Performing vectorization processing on the conversation content to obtain a vector corresponding to the conversation content;
[0191] Calling the AI knowledge base model to analyze and process the vector corresponding to the conversation content, and screening out text information whose vector corresponding to the conversation content has a similarity greater than a preset degree;
[0192] Reply information corresponding to the conversation content is generated according to the text information, and the reply information is returned to the client.
[0193] In one embodiment, the calling module may also be used to:
[0194] Obtaining multiple rounds of conversation content with the customer;
[0195] Extracting keywords from the multiple rounds of conversation content, and analyzing the sentiment tendency of each keyword using TextBlob;
[0196] The customer's interest points are determined according to the sentiment tendency of each keyword, product information related to the interest points is matched, and the product information is recommended to the customer.
[0197] In one embodiment, the construction module 34 may also be specifically used for:
[0198] Determine entity information, relationship information, and attribute value pairs of the plurality of key knowledge points;
[0199] Selecting an initial knowledge representation model, mapping entity information, relationship information, and attribute value pairs of the plurality of key knowledge points to the initial knowledge representation model to obtain a first knowledge representation, wherein the initial knowledge representation model includes a graph database model;
[0200] Converting entity information from different sources in the first knowledge representation into a unified standard format to obtain multiple standard entity information;
[0201] Convert each of the standard entity information into a vector to obtain an entity vector;
[0202] respectively calculating the Euclidean distance between each two entity vectors, and performing entity matching on the entity information of the first knowledge representation according to the Euclidean distance to obtain a second knowledge representation;
[0203] The second knowledge representation is evaluated in sequence for completeness, consistency, accuracy and coverage, and the second knowledge representation that passes all evaluations is used as the enterprise knowledge graph of the standard enterprise knowledge text.
[0204] In one embodiment, the training module 35 may also be used to:
[0205] Inputting the enterprise knowledge graph into the graph neural network for multiple iterative training to obtain a predicted label output by the graph neural network;
[0206] Obtaining the real label corresponding to the enterprise knowledge graph;
[0207] According to the predicted labels and the true labels, a cross entropy loss function is used to calculate the loss value of the graph neural network after each training;
[0208] When the loss value is greater than a preset loss value, the original parameters of the graph neural network are adjusted according to the loss value, and the graph neural network with adjusted parameters is trained again using the enterprise knowledge graph until the training stop condition of the graph neural network is reached.
[0209] In one embodiment, the training module 35 may also be specifically used for:
[0210] Obtaining original parameters of the graph neural network;
[0211] Calculate the gradient of the enterprise knowledge graph with respect to each of the original parameters using the cross entropy loss function and the loss value;
[0212] Sort the gradient of each of the original parameters in descending order to obtain a target sorting, wherein the gradient represents the speed and direction of change of the cross entropy loss function;
[0213] The original parameters of the graph neural network are adjusted in turn according to each gradient corresponding to the target sorting.
[0214] In one embodiment, the acquisition module 31 may also be used to:
[0215] After the enterprise knowledge text is cleaned, deduplicated, formatted and stop words are removed, a standard enterprise knowledge text is generated.
[0216] Regarding the system in the above embodiment, the specific manner in which each module performs operations has been described in detail in the embodiment of the method, and will not be elaborated here.
[0217] In one embodiment, the present invention further proposes a storage medium storing computer-readable instructions, which, when executed by one or more processors, enables one or more processors to execute the above-mentioned method of building an AI knowledge base model for an enterprise. The storage medium may be a ROM, a random access memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, an optical data storage device, etc.
[0218] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiments can be implemented by instructing the relevant hardware through a computer program, and the computer program can be stored in a storage medium. When the program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, the aforementioned storage medium can be a non-volatile storage medium such as a disk, an optical disk, a read-only memory (ROM), or a random access memory (RAM).
[0219] The technical features of the above-described embodiments may be arbitrarily combined. To make the description concise, not all possible combinations of the technical features in the above-described embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0220] The above-mentioned embodiments only express several implementation methods of the present invention, and the description thereof is relatively specific and detailed, but it cannot be understood as limiting the scope of the patent of the present invention. It should be pointed out that, for ordinary technicians in this field, several variations and improvements can be made without departing from the concept of the present invention, which all belong to the protection scope of the present invention. Therefore, the protection scope of the patent of the present invention shall be subject to the attached claims.
Claims
1. A method for building an AI knowledge base model for an enterprise, characterized in that: include: Acquire enterprise knowledge text, pre-process the enterprise knowledge text, and obtain standard enterprise knowledge text; The standard enterprise knowledge text is divided into a plurality of paragraphs, and the standard enterprise knowledge text of each paragraph is divided into entities to obtain a plurality of entities; Using a pre-trained BiLSTM model to identify the part of speech of each entity, and extracting structured text information of the standard enterprise knowledge text according to the part of speech of each entity; Extracting multiple key knowledge points from the structured text information, and constructing an enterprise knowledge graph of the standard enterprise knowledge text according to the multiple key knowledge points, wherein the enterprise knowledge graph represents the relationship between each of the key knowledge points; Constructing a graph neural network, using the enterprise knowledge graph to train the graph neural network, and generating an AI knowledge base model; The extracting of multiple key knowledge points from the structured text information includes: Performing vectorization processing on the structured text information to generate a target feature vector; Using the Density Peaks clustering algorithm to cluster all the target feature vectors to obtain at least one class and a center vector; Extracting relevant context of the structured text information corresponding to each class, and generating a label corresponding to each class according to the relevant context; Calculate the correlation between the central vector and the label corresponding to each class, and select the text content corresponding to the class with a correlation greater than a preset value as the key knowledge point; The vectorization processing of the structured text information to generate a target feature vector includes: Using a pre-trained Word2Vec model, each entity of the structured text information is converted into a word embedding vector; Generate a word embedding matrix according to all the word embedding vectors, calculate the average value of all the word embedding vectors to obtain the average word embedding vector, and multiply the word embedding matrix by the average word embedding vector to obtain a target word embedding matrix, wherein each row of the word embedding matrix represents a word embedding vector of an entity; Calculating a covariance matrix of the target word embedding matrix, wherein the covariance matrix is used to determine the variance and correlation of entities in the structured text information; Calculate the eigenvalues and corresponding first eigenvectors of the covariance matrix, wherein the first eigenvectors are used to define a principal component space, and the eigenvalues represent the variance contribution of each principal component; According to the magnitude of the eigenvalues, select the first eigenvectors corresponding to the first N largest eigenvalues to obtain a second eigenvector, wherein N is a positive integer, and the second eigenvector represents the main change direction of the structured text information; Mapping all the word embedding vectors into a new space formed by the second feature vector to obtain a target feature vector after dimensionality reduction; Wherein, the calculating the covariance matrix of the target word embedding matrix includes: Calculate the sample mean of the target word embedding matrix, and subtract the sample mean from each word embedding vector in turn to obtain a centered matrix; For the centralization matrix, calculate the product of the centralization matrix and its own transposition to obtain an initial covariance matrix; Decomposing the initial covariance matrix into multiple smaller sub-matrices, and recursively multiplying the multiple sub-matrices using the Strassen algorithm to obtain multiple target sub-matrices; Combining multiple target sub-matrices according to the rules of the Strassen algorithm to obtain a covariance matrix; Among them, for the centralization matrix, the product of the centralization matrix and its own transposition is calculated to obtain the initial covariance matrix, including the following formula: L=(1 / (n-1))*X*X T ; The X is the centering matrix, and n is the number of word embedding vectors; The step of constructing the enterprise knowledge graph of the standard enterprise knowledge text according to the multiple key knowledge points includes: Determine entity information, relationship information, and attribute value pairs of the plurality of key knowledge points; Selecting an initial knowledge representation model, mapping entity information, relationship information, and attribute value pairs of the plurality of key knowledge points to the initial knowledge representation model to obtain a first knowledge representation, wherein the initial knowledge representation model includes a graph database model; Converting entity information from different sources in the first knowledge representation into a unified standard format to obtain multiple standard entity information; Convert each of the standard entity information into a vector to obtain an entity vector; respectively calculating the Euclidean distance between each two entity vectors, and performing entity matching on the entity information of the first knowledge representation according to the Euclidean distance to obtain a second knowledge representation; Sequentially performing integrity assessment, consistency assessment, accuracy assessment, and coverage assessment on the second knowledge representation, and using the second knowledge representation that passes all assessments as the enterprise knowledge graph of the standard enterprise knowledge text; The step of training the graph neural network using the enterprise knowledge graph to generate an AI knowledge base model includes: Inputting the enterprise knowledge graph into the graph neural network for multiple iterative training to obtain a predicted label output by the graph neural network; Obtaining the real label corresponding to the enterprise knowledge graph; According to the predicted labels and the true labels, a cross entropy loss function is used to calculate the loss value of the graph neural network after each training; When the loss value is greater than a preset loss value, adjusting the original parameters of the graph neural network according to the loss value, and retraining the graph neural network after adjusting the parameters using the enterprise knowledge graph until the training stop condition of the graph neural network is reached; Wherein, adjusting the original parameters of the graph neural network according to the loss value includes: Obtaining original parameters of the graph neural network; Calculate the gradient of the enterprise knowledge graph with respect to each of the original parameters using the cross entropy loss function and the loss value; Sort the gradient of each of the original parameters in descending order to obtain a target sorting, wherein the gradient represents the speed and direction of change of the cross entropy loss function; The original parameters of the graph neural network are adjusted in turn according to each gradient corresponding to the target sorting.
2. The method for constructing an AI knowledge base model for an enterprise according to claim 1, characterized in that: After the graph neural network is trained by using the enterprise knowledge graph to generate an AI knowledge base model, the method further includes: Get the conversation content entered by the customer in the chat box; Performing vectorization processing on the conversation content to obtain a vector corresponding to the conversation content; Calling the AI knowledge base model to analyze and process the vector corresponding to the conversation content, and screening out text information whose vector corresponding to the conversation content has a similarity greater than a preset degree; Reply information corresponding to the conversation content is generated according to the text information, and the reply information is returned to the client.
3. The method for constructing an AI knowledge base model for an enterprise according to claim 2, characterized in that: After generating reply information corresponding to the content of the conversation according to the text information and returning the reply information to the client, the method further includes: Obtaining multiple rounds of conversation content with the customer; Extracting keywords from the multiple rounds of conversation content, and analyzing the sentiment tendency of each keyword using TextBlob; The customer's interest points are determined according to the sentiment tendency of each keyword, product information related to the interest points is matched, and the product information is recommended to the customer.
4. The method for constructing an AI knowledge base model for an enterprise according to claim 1, characterized in that: Preprocess the enterprise knowledge text to obtain a standard enterprise knowledge text, including: After the enterprise knowledge text is cleaned, deduplicated, formatted and stop words are removed, a standard enterprise knowledge text is generated.
5. A system for building an AI knowledge base model for an enterprise, characterized in that: include: An acquisition module, used for acquiring enterprise knowledge text, preprocessing the enterprise knowledge text, and obtaining a standard enterprise knowledge text; A segmentation module is used to segment the standard enterprise knowledge text into multiple paragraphs, and perform entity division on the standard enterprise knowledge text in each paragraph to obtain multiple entities; A recognition module, used to recognize the part of speech of each entity using a pre-trained BiLSTM model, and extract structured text information of the standard enterprise knowledge text according to the part of speech of each entity; A construction module, used to extract multiple key knowledge points from the structured text information, and construct an enterprise knowledge graph of the standard enterprise knowledge text according to the multiple key knowledge points, wherein the enterprise knowledge graph represents the relationship between each of the key knowledge points; A training module, used to construct a graph neural network, train the graph neural network using the enterprise knowledge graph, and generate an AI knowledge base model; The extracting of multiple key knowledge points from the structured text information includes: Performing vectorization processing on the structured text information to generate a target feature vector; Using the Density Peaks clustering algorithm to cluster all the target feature vectors to obtain at least one class and a center vector; Extracting relevant context of the structured text information corresponding to each class, and generating a label corresponding to each class according to the relevant context; Calculate the correlation between the central vector and the label corresponding to each class, and select the text content corresponding to the class with a correlation greater than a preset value as the key knowledge point; The vectorization processing of the structured text information to generate a target feature vector includes: Using a pre-trained Word2Vec model, each entity of the structured text information is converted into a word embedding vector; Generate a word embedding matrix according to all the word embedding vectors, calculate the average value of all the word embedding vectors to obtain the average word embedding vector, and multiply the word embedding matrix by the average word embedding vector to obtain a target word embedding matrix, wherein each row of the word embedding matrix represents a word embedding vector of an entity; Calculating a covariance matrix of the target word embedding matrix, wherein the covariance matrix is used to determine the variance and correlation of entities in the structured text information; Calculate the eigenvalues and corresponding first eigenvectors of the covariance matrix, wherein the first eigenvectors are used to define a principal component space, and the eigenvalues represent the variance contribution of each principal component; According to the magnitude of the eigenvalues, select the first eigenvectors corresponding to the first N largest eigenvalues to obtain a second eigenvector, wherein N is a positive integer, and the second eigenvector represents the main change direction of the structured text information; Mapping all the word embedding vectors into a new space formed by the second feature vector to obtain a target feature vector after dimensionality reduction; Wherein, the calculating the covariance matrix of the target word embedding matrix includes: Calculate the sample mean of the target word embedding matrix, and subtract the sample mean from each word embedding vector in turn to obtain a centered matrix; For the centralization matrix, calculate the product of the centralization matrix and its own transposition to obtain an initial covariance matrix; Decomposing the initial covariance matrix into multiple smaller sub-matrices, and recursively multiplying the multiple sub-matrices using the Strassen algorithm to obtain multiple target sub-matrices; Combining multiple target sub-matrices according to the rules of the Strassen algorithm to obtain a covariance matrix; Among them, for the centralization matrix, the product of the centralization matrix and its own transposition is calculated to obtain the initial covariance matrix, including the following formula: L=(1 / (n-1))*X*X T ; The X is the centering matrix, and n is the number of word embedding vectors; The step of constructing the enterprise knowledge graph of the standard enterprise knowledge text according to the multiple key knowledge points includes: Determine entity information, relationship information, and attribute value pairs of the plurality of key knowledge points; Selecting an initial knowledge representation model, mapping entity information, relationship information, and attribute value pairs of the plurality of key knowledge points to the initial knowledge representation model to obtain a first knowledge representation, wherein the initial knowledge representation model includes a graph database model; Converting entity information from different sources in the first knowledge representation into a unified standard format to obtain multiple standard entity information; Convert each of the standard entity information into a vector to obtain an entity vector; respectively calculating the Euclidean distance between each two entity vectors, and performing entity matching on the entity information of the first knowledge representation according to the Euclidean distance to obtain a second knowledge representation; Sequentially performing integrity assessment, consistency assessment, accuracy assessment, and coverage assessment on the second knowledge representation, and using the second knowledge representation that passes all assessments as the enterprise knowledge graph of the standard enterprise knowledge text; The step of training the graph neural network using the enterprise knowledge graph to generate an AI knowledge base model includes: Inputting the enterprise knowledge graph into the graph neural network for multiple iterative training to obtain a predicted label output by the graph neural network; Obtaining the real label corresponding to the enterprise knowledge graph; According to the predicted labels and the true labels, a cross entropy loss function is used to calculate the loss value of the graph neural network after each training; When the loss value is greater than a preset loss value, adjusting the original parameters of the graph neural network according to the loss value, and retraining the graph neural network after adjusting the parameters using the enterprise knowledge graph until the training stop condition of the graph neural network is reached; Wherein, adjusting the original parameters of the graph neural network according to the loss value includes: Obtaining original parameters of the graph neural network; Calculate the gradient of the enterprise knowledge graph with respect to each of the original parameters using the cross entropy loss function and the loss value; Sort the gradient of each of the original parameters in descending order to obtain a target sorting, wherein the gradient represents the speed and direction of change of the cross entropy loss function; The original parameters of the graph neural network are adjusted in turn according to each gradient corresponding to the target sorting.
Citation Information
Patent Citations
Knowledge graph retrieval method and system based on knowledge base representation
CN114218372A
Knowledge base construction method and system for standard digitization
CN117667890A
Data processing method based on knowledge graph
CN117973519A
Assistant decision-making system based on knowledge enhancement large model under background of group-type enterprise
CN118069716A
Industrial chain analysis method and system based on knowledge graph
CN118626811A