Vehicle fault named entity recognition method, device, equipment, medium and product
By preprocessing vehicle fault information and matching with knowledge graphs to generate knowledge attention and enhancing feature sequences for sequence labeling, the low accuracy of pure text feature-driven methods in vehicle fault named entity recognition is solved, achieving higher recognition accuracy and robustness.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- CHONGQING CHANGAN AUTOMOBILE CO LTD
- Filing Date
- 2026-05-15
- Publication Date
- 2026-07-21
AI Technical Summary
Existing plain text feature-driven methods have low accuracy in vehicle fault named entity recognition, and struggle to handle technical terms, synonyms, and ambiguous expressions, leading to misjudgment of entity boundaries and semantic ambiguity.
By preprocessing vehicle fault information, extracting word vector sequences that integrate semantic and word order position information, performing entity matching in conjunction with a pre-defined knowledge graph, generating knowledge attention, and enhancing the context feature sequence by integrating text self-attention, and finally performing sequence labeling.
It significantly improves the accuracy and robustness of named entity recognition for vehicle faults, and can effectively handle named entity recognition in complex fault texts.
Smart Images

Figure CN122221859B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of data processing technology, specifically to a method, apparatus, equipment, medium, and product for vehicle fault named entity recognition. Background Technology
[0002] Named Entity Recognition (NER) is an important technology in the field of natural language processing, aiming to extract meaningful entity phrases from text and is also a key technology for building knowledge graphs. In intelligent question-and-answer systems for automotive faults, users typically describe fault phenomena in unstructured natural language. The system can use named entity recognition to accurately extract structured entities from the fault information input by the user, matching corresponding repair solutions and achieving automatic fault question answering.
[0003] In recent years, deep learning models such as BERT and Bidirectional Long Short-Term Memory (BiLSTM) networks have been widely applied to named entity recognition tasks. Existing models typically identify named entities based solely on the deep contextual semantic features of the user's natural language captured by the deep learning model. However, in specific domains, entity naming is highly specialized, and the natural language descriptions of these specialized terms are diverse. This purely text-driven recognition approach, when faced with a large number of specialized terms, synonyms, abbreviations, and ambiguous expressions, is prone to entity boundary misjudgments, semantic ambiguity, and entity type misclassification due to a lack of domain knowledge guidance. It struggles to bridge the semantic gap between natural language text and structured domain knowledge. Summary of the Invention
[0004] This invention provides a method, apparatus, device, medium, and product for vehicle fault named entity recognition, in order to solve the problem of low accuracy in existing plain text feature-driven methods when performing named entity recognition.
[0005] In a first aspect, the present invention provides a method for vehicle fault named entity recognition, the method comprising: The vehicle fault information input by the user is preprocessed to obtain a standard text sequence, and the embedding vector of each word in the standard text sequence is extracted to obtain a word vector sequence; wherein, the embedding vector is used to represent the fusion feature of semantic information and word order position information of the words; Contextual semantic features are extracted from the word vector sequence to obtain a contextual feature sequence, and text self-attention is obtained based on the contextual feature sequence; Entity matching is performed based on contextual feature sequences and a pre-defined knowledge graph to obtain candidate entity sequences. Prior knowledge information of the candidate entity sequences in the pre-defined knowledge graph is then determined, and knowledge attention is derived based on this prior knowledge information. The prior knowledge information represents entity association information related to the candidate entity sequences. This prior knowledge information includes entity node information and path association information between entity nodes. Entity node information includes the entity type of the first entity in the pre-defined knowledge graph, the first occurrence count of the first entity in the pre-defined knowledge graph, and the second occurrence count of the entity pair consisting of the first and second entities in the pre-defined knowledge graph. The first and second entities are any two entities in the candidate entity sequence. Path association information includes the shortest path type and shortest path length of the shortest path between the first and second entities in the pre-defined knowledge graph. Based on knowledge attention and text self-attention, the context feature sequence is enhanced to obtain the enhanced feature sequence; Sequence labeling is performed based on the enhanced feature sequence to obtain the target entity label sequence; wherein, the target entity label sequence includes the entity label corresponding to each word.
[0006] This invention preprocesses vehicle fault information to obtain a standard text sequence and extracts word vector sequences that integrate semantic and word order information. Through context feature sequence extraction and text self-attention calculation, the semantic relationships within the context feature sequence are mined. Simultaneously, entity matching is performed using a pre-defined knowledge graph to obtain candidate entity sequences. Knowledge attention is generated based on the entity relationship information of the candidate entity sequences in the pre-defined knowledge graph, integrating prior domain knowledge. Then, the context feature sequence is enhanced by fusing knowledge attention and text self-attention, constructing an enhanced feature sequence that combines text semantics and domain knowledge. Finally, sequence labeling is performed based on the enhanced feature sequence to obtain the target entity label sequence. Thus, by integrating text context semantics and prior fault domain knowledge, the accuracy and robustness of vehicle fault named entity recognition are significantly improved.
[0007] In some optional implementations, knowledge attention is obtained based on prior knowledge information, including: Construct a co-occurrence weight matrix based on the first and second occurrence counts; Construct a path dependency weight matrix based on the shortest path type and shortest path length; Construct an entity association matrix based on the co-occurrence weight matrix and the path dependency weight matrix; An entity type weight matrix is constructed based on entity type, and knowledge attention is calculated based on the entity type weight matrix and the entity association matrix.
[0008] This invention constructs a co-occurrence weight matrix based on the first occurrence count of an entity appearing alone and the second occurrence count of two entities appearing together, and constructs a path dependency weight matrix based on the shortest path type and shortest path length between two entities. Then, the co-occurrence weight matrix and the path dependency weight matrix are fused to obtain an entity association matrix, which is then combined with the entity type weight matrix to calculate knowledge attention. This approach characterizes entity association information in the knowledge graph from multiple aspects, including entity co-occurrence strength, path dependency relationship, and entity type, effectively improving the discrimination accuracy of knowledge attention. This facilitates targeted enhancement of contextual feature sequences, providing high-quality enhanced features for subsequent named entity recognition and improving the accuracy of entity recognition in complex faulty texts.
[0009] In some optional implementations, a path dependency weight matrix is constructed based on the shortest path type and shortest path length, including: Determine the semantic enhancement coefficient corresponding to the shortest path type; where the shortest path type includes direct association path and indirect association path. Direct association path is used to represent that the first entity and the second entity are directly connected through different semantic association relations, including synonym relation and equivalence relation. Indirect association path is used to represent that the first entity is indirectly connected to the second entity through other entities. Based on the semantic enhancement coefficient and the shortest path length, the path dependency weight between the first entity and the second entity is obtained. Based on the path dependency weights of all entity pairs, a path dependency weight matrix is constructed.
[0010] This invention distinguishes between direct and indirect association paths, matches corresponding semantic enhancement coefficients for different shortest path types, and calculates path dependency weights between entities by combining the shortest path type and shortest path length. This accurately represents the association strength between entities, so as to highlight key fault information based on path dependency weights, making features more consistent with the semantic logic of knowledge graphs and improving the accuracy of named entity recognition.
[0011] In some optional implementations, text self-attention is obtained based on a sequence of contextual features, including: Determine the query matrix, key matrix, and value matrix corresponding to the context feature sequence; Based on the query matrix and key matrix, semantic association weights are obtained. The value matrix is then weighted according to the semantic association weights to obtain text self-attention.
[0012] This invention determines the corresponding query matrix, key matrix, and value matrix for the context feature sequence, and calculates text self-attention based on the query matrix, key matrix, and value matrix. It can adaptively capture the deep semantic relationships between words within the fault text sequence, automatically focus on key fault features, weaken redundant semantic interference, and improve the expression accuracy and discrimination ability of features.
[0013] In some optional implementations, the contextual feature sequence is enhanced based on knowledge attention and text self-attention to obtain an enhanced feature sequence, including: We obtain fused attention by weighting and fusing knowledge attention and text self-attention; The value matrix corresponding to the context feature sequence is weighted based on fusion attention to obtain value-enhanced features. The context feature sequence and the value-enhanced features are then superimposed to obtain the enhanced feature sequence.
[0014] This invention obtains fused attention by weighted fusion of text self-attention and knowledge attention. It then uses this fused attention to weight the value matrix corresponding to the context feature sequence to obtain value-enhanced features, and superimposes them with the context feature sequence to generate an enhanced feature sequence. This effectively integrates text context semantic information with prior knowledge from the knowledge graph domain, achieving complementary enhancement of text semantic features and fault entity association knowledge. It preserves the contextual dependencies of the fault text while injecting domain knowledge of entity co-occurrence patterns, path associations, and entity types, improving the domain adaptability and discriminative ability of the features. This provides more distinctive enhanced features for subsequent named entity recognition, improving the accuracy and robustness of named entity recognition for automotive faults.
[0015] In some optional implementations, sequence labeling is performed based on the enhanced feature sequence to obtain the target entity label sequence, including: The enhanced feature sequence is input into a preset sequence labeling algorithm to obtain multiple original entity label sequences; the original entity label sequences include the original labels of each word; Determine the label score and transition score corresponding to the original label of each word, and obtain the global score of each original entity label sequence based on the label score and transition score; where the label score is used to characterize the confidence of the original label, and the transition score is used to characterize the transition probability of adjacent labels. The target entity label sequence is obtained based on the original entity label sequence with the highest global score.
[0016] This invention inputs an enhanced feature sequence that integrates textual context semantics and knowledge graph domain information into a pre-defined sequence labeling algorithm. Label inference is performed on each word in the sequence, generating multiple sets of original entity label sequences. Subsequently, the label score and transition score corresponding to each original label in each set of sequences are calculated. The global score of each set of original entity label sequences is obtained by accumulating the label score and transition score. Finally, the original entity label sequence with the highest global score is selected as the target entity label sequence with higher accuracy.
[0017] In some optional implementations, contextual semantic features are extracted from the word vector sequence to obtain a contextual feature sequence, including: The word vector sequence is processed from beginning to end to extract contextual semantic features, resulting in a positive hidden state sequence. The word vector sequence is then processed from end to beginning to extract contextual semantic features, resulting in a negative hidden state sequence. The context feature sequence is obtained based on the forward hidden state sequence and the reverse hidden state sequence.
[0018] This invention extracts contextual semantic features from word vector sequences in two order: from beginning to end and from end to beginning. The extracted positive and negative hidden state sequences are then fused to obtain a contextual feature sequence, which can comprehensively capture the semantic relationships between words and enhance the global expressive power of contextual features.
[0019] In some optional implementations, the embedding vector of each word in the standard text sequence is extracted to obtain a word vector sequence, including: The one-hot vector of each word in the standard text sequence is mapped to a dense vector. The dense vector is then subjected to nonlinear transformation and normalization to obtain the word embedding vector corresponding to each word. The word embedding vector is used to represent the semantic information corresponding to the word. Determine the position embedding vector corresponding to each word, and superimpose the word embedding vector and position embedding vector corresponding to each word to construct the embedding vector of each word, thus obtaining the word vector sequence; wherein, the position embedding vector is used to represent the word order position information corresponding to the word.
[0020] This invention maps the one-hot vector of each word in a standard text sequence to a dense vector, performs nonlinear transformation and normalization to obtain word embedding vectors, representing the deep semantic information of the words. Then, positional embedding vectors are superimposed to incorporate word order position information, constructing a word vector sequence that integrates semantic and word order position information. This transforms the standard text sequence into a high-dimensional word vector sequence, ensuring that the word vector sequence not only contains semantic information but also integrates word order position information. This provides data support for subsequent contextual feature extraction, improving the accuracy and robustness of named entity recognition for automotive faults.
[0021] In a second aspect, the present invention provides a vehicle fault named entity recognition device, the device comprising: The first processing module is used to preprocess the vehicle fault information input by the user to obtain a standard text sequence, and extract the embedding vector of each word in the standard text sequence to obtain a word vector sequence; wherein, the embedding vector is used to represent the fusion feature of semantic information and word order position information of the words; The second processing module is used to extract contextual semantic features from the word vector sequence to obtain a contextual feature sequence, and to obtain text self-attention based on the contextual feature sequence. The third processing module is used to perform entity matching based on contextual feature sequences and a preset knowledge graph to obtain candidate entity sequences, and to determine the prior knowledge information of the candidate entity sequences in the preset knowledge graph. Based on the prior knowledge information, knowledge attention is obtained. The prior knowledge information is used to characterize the entity association information related to the candidate entity sequences. The prior knowledge information includes entity node information and path association information between entity nodes. The entity node information includes the entity type of the first entity in the preset knowledge graph, the first occurrence number of the first entity in the preset knowledge graph, and the second occurrence number of the entity pair consisting of the first entity and the second entity in the preset knowledge graph. The first entity and the second entity are any two entities in the candidate entity sequence. The path association information includes the shortest path type and shortest path length of the shortest path between the first entity and the second entity in the preset knowledge graph. The fourth processing module is used to enhance the context feature sequence based on knowledge attention and text self-attention to obtain an enhanced feature sequence. The fifth processing module is used to perform sequence labeling based on the enhanced feature sequence to obtain the target entity label sequence; wherein, the target entity label sequence includes the entity label corresponding to each word.
[0022] Thirdly, the present invention provides an electronic device, comprising: a memory and a processor, wherein the memory and the processor are communicatively connected to each other, the memory stores computer instructions, and the processor executes the computer instructions to perform the vehicle fault named entity recognition method of the first aspect or any corresponding embodiment described above.
[0023] Fourthly, the present invention provides a computer-readable storage medium storing computer instructions for causing a computer to execute the vehicle fault named entity recognition method of the first aspect or any corresponding embodiment described above.
[0024] Fifthly, the present invention provides a computer program product, including computer instructions for causing a computer to execute the vehicle fault named entity recognition method of the first aspect or any corresponding embodiment described above.
[0025] The beneficial effects of this invention are as follows: This invention preprocesses vehicle fault information to obtain a standard text sequence and extracts word vector sequences that integrate semantic and word order information. Through context feature sequence extraction and text self-attention calculation, the semantic relationships within the context feature sequence are mined. Simultaneously, entity matching is performed using a pre-defined knowledge graph to obtain candidate entity sequences. Knowledge attention is generated based on the entity relationship information of the candidate entity sequences in the pre-defined knowledge graph, integrating prior domain knowledge. Then, the context feature sequence is enhanced by fusing knowledge attention and text self-attention, constructing an enhanced feature sequence that combines text semantics and domain knowledge. Finally, sequence labeling is performed based on the enhanced feature sequence to obtain the target entity label sequence. Thus, by integrating text context semantics and prior fault domain knowledge, the accuracy and robustness of vehicle fault named entity recognition are significantly improved. Attached Figure Description
[0026] To more clearly illustrate the specific embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the specific embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present invention. For those skilled in the art, other drawings can be obtained from these drawings without creative effort.
[0027] Figure 1 This is a schematic diagram of the first process of the vehicle fault named entity recognition method according to an embodiment of the present invention; Figure 2 This is a schematic diagram of the second process of the vehicle fault named entity recognition method according to an embodiment of the present invention; Figure 3 This is a schematic diagram of the third process of the vehicle fault named entity recognition method according to an embodiment of the present invention; Figure 4 This is a schematic diagram illustrating the construction of a word vector sequence according to an embodiment of the present invention; Figure 5 This is a schematic diagram of contextual semantic feature extraction according to an embodiment of the present invention; Figure 6 This is a schematic diagram of attention fusion according to an embodiment of the present invention; Figure 7 This is a schematic diagram of sequence labeling according to an embodiment of the present invention; Figure 8 This is a structural block diagram of a vehicle fault named entity recognition device according to an embodiment of the present invention; Figure 9 This is a schematic diagram of the hardware structure of an electronic device according to an embodiment of the present invention. Detailed Implementation
[0028] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. 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 effort are within the scope of protection of the present invention.
[0029] It is understood that before using the technical solutions disclosed in the various embodiments of the present invention, users should be informed of the types, scope of use, and usage scenarios of the personal information involved in the present invention and their authorization should be obtained in accordance with relevant laws and regulations through appropriate means.
[0030] The terms "first" and "second" are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of technical features indicated. Thus, a feature defined as "first" or "second" may explicitly or implicitly include one or more of that feature. In the description of this invention, "a plurality of" means two or more, unless otherwise explicitly specified.
[0031] With the rapid development of automotive intelligence, intelligent question-and-answer systems for automotive faults have become an important technical means for fault consultation and rapid fault diagnosis. This system receives fault phenomena described by users in natural language, automatically analyzes the fault information and matches repair solutions in the knowledge graph to achieve efficient automatic question and answer.
[0032] Currently, deep learning models such as BERT and BiLSTM are widely used in named entity recognition tasks. However, most of these technologies are text-driven, and without domain knowledge constraints and enhancements, they are prone to entity boundary misjudgment, semantic ambiguity, and entity type misclassification when faced with a large number of technical terms, synonyms, abbreviations, and vague expressions. This makes it difficult to bridge the semantic gap between natural language text and structured domain knowledge.
[0033] To address the aforementioned issues, this invention provides a method for vehicle fault named entity recognition. The method involves preprocessing vehicle fault information to obtain a standard text sequence and extracting word vector sequences that integrate semantic and word order information. Semantic relationships within the context feature sequence are mined through context feature sequence extraction and text self-attention calculation. Simultaneously, entity matching is performed using a pre-defined knowledge graph to obtain candidate entity sequences. Knowledge attention is generated based on the entity association information of the candidate entity sequences in the pre-defined knowledge graph, integrating prior domain knowledge. Then, the context feature sequence is enhanced by fusing knowledge attention and text self-attention, constructing an enhanced feature sequence that combines text semantics and domain knowledge. Finally, sequence labeling is performed based on the enhanced feature sequence to obtain the target entity label sequence. Thus, by integrating text context semantics and prior fault domain knowledge, the accuracy and robustness of vehicle fault named entity recognition are improved.
[0034] According to an embodiment of the present invention, a method for vehicle fault named entity recognition is provided. It should be noted that the steps shown in the flowchart in the accompanying drawings can be executed in a computer system such as a set of computer-executable instructions. Furthermore, although a logical order is shown in the flowchart, in some cases, the steps shown or described may be executed in a different order than that shown here.
[0035] This embodiment provides a vehicle fault named entity recognition method, which can be used in devices for vehicle fault question answering, such as mobile phones and in-vehicle terminals. Figure 1 This is a flowchart of a vehicle fault named entity recognition method according to an embodiment of the present invention, such as... Figure 1 As shown, the process includes the following steps: Step S101: Preprocess the vehicle fault information input by the user to obtain a standard text sequence, and extract the embedding vector of each word in the standard text sequence to obtain a word vector sequence; wherein, the embedding vector is used to represent the fusion feature of semantic information and word order position information of the words.
[0036] Specifically, multimodal preprocessing is performed on the vehicle fault information input by the user. First, unstructured vehicle fault information input by the user is obtained, which includes text, voice, images, and videos. If the input is in voice format, a voice recognition model is used to convert the voice content into vehicle fault description text information; if it is in image or video format, the text content is extracted through feature extraction and uniformly converted into plain text vehicle fault description text information.
[0037] Furthermore, the vehicle fault description text information is preprocessed through cleaning and word segmentation to obtain a standard text sequence that meets the model's input requirements. This standard text sequence includes multiple words. Subsequently, the semantic information and word order position information of each word are fused to obtain the embedding vector of each word, thus constructing a word vector sequence that combines both semantic and word order position information.
[0038] Step S102: Extract contextual semantic features from the word vector sequence to obtain a contextual feature sequence, and obtain text self-attention based on the contextual feature sequence.
[0039] Specifically, BiLSTM can be used to extract bidirectional contextual semantic features from the word vector sequence, capturing the preceding and following dependencies of the word vector sequence to obtain a contextual feature sequence containing global bidirectional semantic dependencies. Then, based on the textual features of the contextual feature sequence itself, such as the query matrix, key matrix, and value matrix, a text self-attention mechanism capable of focusing on the text's own keywords can be obtained.
[0040] Step S103: Entity matching is performed based on the context feature sequence and the preset knowledge graph to obtain a candidate entity sequence, and the prior knowledge information of the candidate entity sequence in the preset knowledge graph is determined. Knowledge attention is obtained based on the prior knowledge information; wherein, the prior knowledge information is used to represent the entity association information related to the candidate entity sequence.
[0041] Specifically, the pre-defined knowledge graph can be a knowledge graph constructed based on vehicle fault information. Entity nodes in this pre-defined knowledge graph represent faulty vehicle components, fault phenomena, and fault repair solutions, while the connection paths between entity nodes represent the relationships between them. Two entity nodes with a relationship can be represented by a triple. Entity nodes can be constructed by extracting semantic features of the corresponding faulty components and fault phenomena. Therefore, semantic similarity matching can be used to determine entity nodes with high similarity to the context feature vector, resulting in a candidate entity sequence.
[0042] Furthermore, prior knowledge information corresponding to candidate entity sequences is extracted from the pre-defined knowledge graph, including entity node information and path association information between entity nodes. Entity node information may include entity type, number of independent occurrences of the entity, and number of co-occurrences of entity pairs; path association information includes the type and length of the shortest path between entities. This prior knowledge information perceived by the knowledge graph is integrated into the attention calculation process to obtain knowledge attention, which is then used to highlight keywords in the fault information by fusing domain prior knowledge information.
[0043] Step S104: Based on knowledge attention and text self-attention, the context feature sequence is enhanced to obtain the enhanced feature sequence.
[0044] Specifically, knowledge attention and text self-attention are weighted and fused to obtain fused attention that takes into account both text context semantics and knowledge graph entity association information. Then, the fused attention is used to semantically enhance the basic context feature sequence, resulting in an enhanced feature sequence that integrates text semantics and domain knowledge.
[0045] Step S105: Perform sequence labeling based on the enhanced feature sequence to obtain the target entity label sequence; wherein, the target entity label sequence includes the entity label corresponding to each word.
[0046] Specifically, named entity recognition in the field of automotive faults is a core link connecting natural language questions and structured knowledge graphs. By automatically identifying entity labels of words from colloquial fault description text, named entities with domain-specific meanings such as faulty parts and fault phenomena are extracted based on the entity labels, providing structured input for subsequent entity alignment, knowledge reasoning and question answering generation.
[0047] The vehicle fault named entity recognition method provided in this embodiment preprocesses vehicle fault information to obtain a standard text sequence and extracts a word vector sequence that integrates semantic and word order information. Through context feature sequence extraction and text self-attention calculation, the semantic relationships within the context feature sequence are mined. Simultaneously, entity matching is performed using a pre-defined knowledge graph to obtain candidate entity sequences. Knowledge attention is generated based on the entity relationship information of the candidate entity sequences in the pre-defined knowledge graph, integrating prior domain knowledge. Then, the context feature sequence is enhanced by fusing knowledge attention and text self-attention, constructing an enhanced feature sequence that combines text semantics and domain knowledge. Finally, sequence labeling is performed based on the enhanced feature sequence to obtain the target entity label sequence. Thus, by integrating text context semantics and prior fault domain knowledge, the accuracy and robustness of vehicle fault named entity recognition are significantly improved.
[0048] This embodiment provides a vehicle fault named entity recognition method, which can be used in devices for vehicle fault question answering, such as mobile phones and in-vehicle terminals. Figure 2 This is a flowchart of a vehicle fault named entity recognition method according to an embodiment of the present invention, such as... Figure 2 As shown, the process includes the following steps: Step S201: Preprocess the vehicle fault information input by the user to obtain a standard text sequence, and extract the embedding vector of each word in the standard text sequence to obtain a word vector sequence; wherein, the embedding vector is used to represent the fusion feature of semantic information and word order position information of the words.
[0049] In some optional implementations, step S201 above includes: Step a1: Preprocess the vehicle fault information input by the user to obtain a standard text sequence.
[0050] Specifically, as Figure 3 shown, convert the vehicle fault information into text information, and use a preset stop word list and a preset word segmentation tool to segment the text information, split the text information into independent lexical units, and remove the stop words without actual semantics (such as "de, le") to obtain a standard text sequence. Among them, the preset stop word list can be the Harbin Institute of Technology stop word list, and the preset word segmentation tool can choose the jieba word segmentation tool, which can be adjusted according to actual needs.
[0051] Exemplarily, the vehicle fault information input by the user is "There is an abnormal noise in the engine of the car", and after word segmentation, the standard text sequence "[CLS] car engine abnormal noise [SEP]" is obtained, where [CLS] is the sequence start marker and [SEP] is the sequence end marker.
[0052] Step a2: Map the one-hot vector of each word in the standard text sequence to a dense vector, perform a non-linear transformation and normalization on the dense vector to obtain the word embedding vector corresponding to each word; among them, the word embedding vector is used to represent the semantic information corresponding to the word.
[0053] Specifically, convert each word w in the standard text sequence into a one-hot vector d. For each word, use the word embedding matrix to map the one-hot vector d corresponding to the word w to the dense vector space to obtain the dense vector corresponding to the word . Among them, the dense vector The calculation formula is:
[0054] Among them, is the word embedding matrix, is the vocabulary size, D is the embedding dimension; the dimension of the one-hot vector d is 1× , the index position corresponding to the word w is 1, and the rest are 0.
[0055] Furthermore, to enhance the semantic level and non-linear features of the dense vector, introduce a hidden layer mapping matrix to perform a non-linear transformation on the dense vector of each word to obtain the hidden layer vector :
[0056] Among them, is the hidden layer mapping matrix, and H is the hidden layer dimension.
[0057] Even further, to stabilize the training and accelerate the convergence, introduce a layer normalization operation to normalize the hidden layer vector corresponding to each word Normalized to word embedding vector :
[0058] in, It is the mean of the hidden layer vectors of all words. It is the standard deviation of the hidden layer vectors of all words. It is the scaling factor. It is the offset coefficient. and It is a trainable scalar.
[0059] Step a3: Determine the position embedding vector corresponding to each word, and superimpose the word embedding vector and position embedding vector corresponding to each word to construct the embedding vector of each word, thereby obtaining the word vector sequence; wherein, the position embedding vector is used to represent the word order position information corresponding to the word.
[0060] Specifically, considering the high dependence of named entity recognition tasks on word order and position information, a position embedding matrix is introduced. Based on the position embedding matrix Determine the position embedding vector corresponding to each word. The embedding vector at this position This is used to represent the word order position information of corresponding words in a standard text sequence. Among them, the position embedding matrix... It is a trainable two-dimensional matrix, where L represents the maximum sequence length. Each row of the position embedding matrix P corresponds to an absolute position index of a word (i.e., a position embedding vector), and each row is a learnable vector of length H.
[0061] Furthermore, for each word, the position embedding vector corresponding to that word is generated. With word embedding vectors By combining these elements, an embedding vector with a sequence structure for the word is formed:
[0062] in, Let w represent the embedding vector corresponding to word w. Then, based on the embedding vectors corresponding to all words, we obtain the word vector sequence. , where n is the length of the word vector sequence.
[0063] This invention maps the one-hot vector of each word in a standard text sequence to a dense vector, performs nonlinear transformation and normalization to obtain word embedding vectors, representing the deep semantic information of the words. Then, positional embedding vectors are superimposed to incorporate word order position information, constructing a word vector sequence that integrates semantic and word order position information. This transforms the standard text sequence into a high-dimensional word vector sequence, ensuring that the word vector sequence not only contains semantic information but also integrates word order position information. This provides data support for subsequent contextual feature extraction, improving the accuracy and robustness of named entity recognition for automotive faults.
[0064] In some embodiments, word embedding vectors can be extracted using a lightweight BERT model (A Lite BERT, ALBERT). However, in named entity recognition within the automotive fault domain, the corpus contains a large number of industry terms and abbreviations with strong contextual semantic relationships. Traditional word embedding methods lack general semantic representation and struggle to capture the domain-specific fine-grained semantic relationships. For example... Figure 4 As shown, the ALBERT model is used as the core encoder of the word embedding layer. The ALBERT model extracts word vectors, sentence vectors, and position vectors from the input standard text sequence, and then superimposes these vectors to output a word vector sequence. Furthermore, the ALBERT model introduces a pre-training mechanism with parameter compression and structure optimization, which improves semantic modeling capabilities and sensitivity to terminology semantics under resource-constrained domain corpora. Its lightweight structure also makes training more efficient, thus better adapting to the practical needs of few-shot learning.
[0065] Step S202: Extract contextual semantic features from the word vector sequence to obtain a contextual feature sequence, and obtain text self-attention based on the contextual feature sequence.
[0066] Specifically, step S202 includes: Step S2021: Extract contextual semantic features from the word vector sequence in order from beginning to end to obtain the positive hidden state sequence, and extract contextual semantic features from the word vector sequence in order from end to beginning to obtain the reverse hidden state sequence.
[0067] Specifically, such as Figure 5 As shown, for the word vector sequence output by the word embedding layer BiLSTM iteratively updates the word vectors using two LSTM branches running in opposite directions. In the forward LSTM, the initial hidden state and cell state are initialized to zero vectors. Starting from time step t=1 (each time step corresponds to one word), the input word vector sequence first passes through the forget gate. Determine the cell state at the previous time step. The parts that need to be retained, next, the input gate. Combine candidate cell state The new information introduced at the current time step is determined. The cell state is updated by combining the result of the forget gate and the update value of the input gate. Finally, the result is passed through the output gate. By combining the updated cell state, the hidden state at the current time step is obtained, thereby capturing the semantic dependencies of the preceding text. For details, please refer to the description of the relevant technology, which will not be elaborated here.
[0068] The computation process of inverse LSTM is similar to that of forward LSTM, except that forward LSTM processes the input word vector sequence from beginning to end, while inverse LSTM processes the input word vector sequence from end to beginning. The input vector passes through the forget gate, input gate, candidate cell state, and output gate to progressively update the hidden state and cell state, thereby capturing subsequent semantic dependencies. Its processing is consistent with that of forward LSTM, only the input time step direction is reversed.
[0069] Finally, the forward hidden state sequence output by the forward LSTM is: The reverse hidden state sequence output by the inverse LSTM is .
[0070] Step S2022: Obtain the context feature sequence based on the forward hidden state sequence and the reverse hidden state sequence.
[0071] Specifically, the forward hidden state sequence and the reverse hidden state sequence are concatenated at each time step to obtain the context feature sequence of the overall output of BiLSTM. The concatenated vector at time step t This concatenated vector takes into account the dual semantic dependencies of words in the context, preserving the deep semantics of word vectors while effectively denoising and reducing dimensionality with the gating mechanism of LSTM, thus providing a more compact and context-sensitive feature representation for subsequent stages.
[0072] See you again Figure 3 While word vector sequences can provide rich contextual semantic representations, they cannot directly remove noisy features and suffer from long-distance dependencies spanning multiple words. To address this, BiLSTM is introduced into the feature extraction layer. Through sequence-level recursive filtering and compression, redundant components in the embedded vectors are automatically removed, generating refined feature representations that take into account contextual dependencies while ensuring information integrity.
[0073] This invention extracts contextual semantic features from word vector sequences in two order: from beginning to end and from end to beginning. The extracted positive and negative hidden state sequences are then fused to obtain a contextual feature sequence, which can comprehensively capture the semantic relationships between words and enhance the global expressive power of contextual features.
[0074] Step S2023: Determine the query matrix, key matrix, and value matrix corresponding to the context feature sequence.
[0075] Specifically, three learnable linear transformation matrices are constructed: query projection matrix. Key projection matrix Value projection matrix The context feature sequence is multiplied by the linear transformation matrix mentioned above to obtain the query matrix Q, the key matrix K, and the value matrix V. For details, please refer to the description of the relevant technology.
[0076] Step S2024: Based on the query matrix and key matrix, obtain the semantic association weights, and weight the value matrix based on the semantic association weights to obtain text self-attention.
[0077] Specifically, semantic association weights are calculated based on the query matrix Q and the key matrix K. ,in, This is the scaling factor. Then, semantic association weights are used. Weight the value matrix V and calculate the text self-attention. :
[0078] in, This is the normalization function.
[0079] This invention determines the corresponding query matrix, key matrix, and value matrix for the context feature sequence, and calculates text self-attention based on the query matrix, key matrix, and value matrix. It can adaptively capture the deep semantic relationships between words within the fault text sequence, automatically focus on key fault features, weaken redundant semantic interference, and improve the expression accuracy and discrimination ability of features.
[0080] Step S203: Entity matching is performed based on the context feature sequence and the preset knowledge graph to obtain a candidate entity sequence, and the prior knowledge information of the candidate entity sequence in the preset knowledge graph is determined. Knowledge attention is obtained based on the prior knowledge information; wherein, the prior knowledge information is used to represent the entity association information related to the candidate entity sequence.
[0081] Specifically, step S203 includes: Step S2031: Entity matching is performed based on the context feature sequence and the preset knowledge graph to obtain a candidate entity sequence, and the prior knowledge information of the candidate entity sequence in the preset knowledge graph is determined.
[0082] Specifically, for context feature sequences The context feature vector at each position is matched with entity nodes in a predefined knowledge graph. By calculating the cosine similarity between the context feature vector and the entity embedding vector of each entity node, entity nodes with a cosine similarity greater than a cosine similarity threshold (e.g., 0.9) are selected as candidate entities corresponding to the current context feature vector. The candidate entities corresponding to each context feature vector are combined sequentially according to their positional order to obtain a candidate entity sequence with the same length as the context feature sequence.
[0083] Furthermore, prior knowledge information is extracted from a pre-defined knowledge graph based on the candidate entity sequence. This prior knowledge information includes entity node information and path association information between entity nodes. Specifically, the entity node information includes the entity type of the first entity in the pre-defined knowledge graph, the first occurrence count of the first entity in the pre-defined knowledge graph, and the second occurrence count of the entity pair consisting of the first and second entities in the pre-defined knowledge graph. The first and second entities are any two entities in the candidate entity sequence. The path association information includes the shortest path type and shortest path length of the shortest path between the first and second entities in the pre-defined knowledge graph.
[0084] In this embodiment, the entity node information is determined as follows: For any first entity in the candidate entity sequence, the predefined category label (e.g., faulty component, fault phenomenon, etc.) of the entity node in the preset knowledge graph is queried to obtain the entity type corresponding to the entity. The total frequency of the first entity as a subject or object in all triples of the preset knowledge graph is counted to obtain the first occurrence count. For an entity pair consisting of the first entity and any second entity in the candidate entity sequence, the frequency of the common association of the entity pair in all triples of the preset knowledge graph is counted to obtain the second occurrence count.
[0085] In this embodiment, the path association information is determined as follows: For the first entity and the second entity, a graph search algorithm (e.g., breadth-first search algorithm) is used to traverse the path network of the preset knowledge graph to retrieve all reachable paths between the first entity and the second entity. The path with the fewest edges is selected as the shortest path, and the number of edges contained in the shortest path is recorded as the shortest path length. The shortest path type is obtained by combining the relationship type on the shortest path and the shortest path length. If there is no reachable path between the first entity and the second entity, the shortest path length is set to a preset maximum value, and the shortest path type is marked as an unassociated type.
[0086] Step S2032: Construct a co-occurrence weight matrix based on the first occurrence count and the second occurrence count.
[0087] In some optional implementations, step S2032 above includes: Step b1: Calculate the co-occurrence weight of the first entity and the second entity based on the first occurrence count and the second occurrence count.
[0088] Specifically, the co-occurrence weight can be calculated using the following formula:
[0089] in, Represents the first entity Second Entity Co-occurrence weights It is the first entity The first occurrence of a word in a pre-defined knowledge graph. It is the first entity Second Entity The second occurrence frequency that co-occurs in the preset knowledge graph It is a smoothing parameter for the second occurrence count. Smoothing parameters for the first occurrence.
[0090] Step b2: Construct a co-occurrence weight matrix based on the co-occurrence weights of all entity pairs.
[0091] Specifically, all entity pairs are obtained by pairwise combining any two entities in the candidate entity sequence, and the co-occurrence weight of each entity pair is used as the basis for the calculation. Construct the co-occurrence weight matrix C.
[0092] This embodiment is based on an existing preset knowledge graph. During the dynamic association calculation stage of the preset knowledge graph, the co-occurrence weight of each entity pair is calculated by statistically analyzing the number of times the first entity appears alone and the number of times the first entity and the second entity co-occur. A co-occurrence weight matrix is constructed to highlight keywords in the sequence and improve the accuracy of named entity recognition.
[0093] Step S2033: Construct a path dependency weight matrix based on the shortest path type and the shortest path length.
[0094] In some optional implementations, step S2033 above includes: Step c1: Determine the semantic enhancement coefficient corresponding to the shortest path type.
[0095] In this embodiment, within the knowledge graph, path type refers to the pattern of the relation sequence traversed when two entities are connected via a path. Different types of paths carry different semantic meanings. The shortest path types include direct association paths and indirect association paths. Direct association paths represent a direct connection between the first and second entities through different semantic relationships, including synonymous and equivalence relationships. Indirect association paths represent an indirect connection between the first and second entities via other entities. The semantic enhancement coefficient corresponding to direct association paths is higher than that of indirect association paths.
[0096] For example, a direct association path is a path where there is a direct triple relationship between two entities, and its semantic reinforcement coefficient is relatively high (e.g., 1.0). Direct association paths can include synonymous paths and equivalence paths, meaning that two entities are connected by a "synonymous" or "equivalent" relationship, indicating that the two entities refer to the same thing. The semantic reinforcement coefficient for synonymous paths and equivalence paths can be 0.9. In addition to synonymous and equivalence relationships, the semantic association relationships corresponding to direct association paths can also be adjusted according to requirements. For example, semantic association relationships can also include causal relationships, subordinate relationships, maintenance relationships, etc.
[0097] For example, an indirect association path is a path connecting two entities through one or more intermediate entities, with a moderate semantic enhancement coefficient (e.g., 0.6-0.8). Specifically, for a two-step inference path connected by one intermediate entity, the semantic enhancement coefficient can be 0.8; for a cross-modal path connected by multiple intermediate entities of different types (e.g., faulty components, fault phenomena, fault solutions, etc.), the semantic enhancement coefficient can be 0.7. For indirect association paths with a path length greater than a preset path length (e.g., 4), the semantic enhancement coefficient can be 0.3-0.5; the longer the path, the weaker the semantic association.
[0098] Step c2: Based on the semantic enhancement coefficient and the shortest path length, obtain the path dependency weight between the first entity and the second entity, and construct the path dependency weight matrix based on the path dependency weights of all entity pairs.
[0099] Specifically, to further capture the depth of semantic structure, the path dependency weights of entity pairs are calculated by combining path association information in the pre-defined knowledge graph:
[0100] in, It is the first entity Second Entity The path dependency weight represents the strength of the association between two entities. It is the first entity Second Entity The shortest path length in the preset knowledge graph It is a semantic enhancement coefficient based on the shortest path type.
[0101] Furthermore, based on the path dependency weights of all entity pairs Construct the path dependency weight matrix S.
[0102] This invention distinguishes between direct and indirect association paths, matches corresponding semantic enhancement coefficients for different shortest path types, and calculates path dependency weights between entities by combining the shortest path type and shortest path length. This accurately represents the association strength between entities, so as to highlight key fault information based on path dependency weights, making features more consistent with the semantic logic of knowledge graphs and improving the accuracy of named entity recognition.
[0103] Step S2034: Construct the entity association matrix based on the co-occurrence weight matrix and the path dependency weight matrix.
[0104] Specifically, an entity association matrix is constructed by combining the co-occurrence weight matrix obtained based on the statistical regularity of entity co-occurrence and the path dependency weight matrix obtained based on semantic path logical constraints. :
[0105] in, These are learnable parameters that dynamically adjust the ratio of the co-occurrence weight matrix to the path dependency weight matrix. Based on the co-occurrence frequency and semantic path information between two entities perceived by the knowledge graph, an entity association matrix is constructed, thereby establishing a close logical connection between entities in the candidate entity sequence. This entity association matrix is then used as the core input for subsequent knowledge attention calculations, embedded in the attention calculation process to dynamically adjust the association strength between words in vehicle fault information and known semantic structures in the knowledge graph.
[0106] Step S2035: Construct an entity type weight matrix based on entity type, and calculate the knowledge attention based on the entity type weight matrix and the entity association matrix.
[0107] Specifically, different entity types correspond to different entity type weights. For example, different entity type weights can be assigned to faulty components, fault phenomena, and fault repair solutions, thereby constructing an entity type weight matrix based on the entity types of all entities in the candidate entity sequence. Then, the entity association matrix after semantic association is optimized using the entity type weight matrix. To obtain knowledge attention perceived by the knowledge graph:
[0108] in, For knowledge attention, It is an entity type matrix. It is the weight matrix of type embedding. This is the entity type weight matrix. As the first entity Second Entity Entity association weights.
[0109] This invention constructs a co-occurrence weight matrix based on the first occurrence count of an entity appearing alone and the second occurrence count of two entities appearing together, and constructs a path dependency weight matrix based on the shortest path type and shortest path length between two entities. Then, the co-occurrence weight matrix and the path dependency weight matrix are fused to obtain an entity association matrix, which is then combined with the entity type weight matrix to calculate knowledge attention. This approach characterizes entity association information in the knowledge graph from multiple aspects, including entity co-occurrence strength, path dependency relationship, and entity type, effectively improving the discrimination accuracy of knowledge attention. This facilitates targeted enhancement of contextual feature sequences, providing high-quality enhanced features for subsequent named entity recognition and improving the accuracy of entity recognition in complex faulty texts.
[0110] Step S204: Based on knowledge attention and text self-attention, the context feature sequence is enhanced to obtain the enhanced feature sequence.
[0111] Specifically, step S204 includes: Step S2041: Weighted fusion of knowledge attention and text self-attention is performed to obtain fused attention.
[0112] In the field of automotive fault diagnosis, terms often contain hidden logical sequences and semantic dependencies. Text self-attention alone often fails to capture the causal or relational relationships between faults, leading to ambiguity and fragmentation in entity recognition, resulting in inaccurate identification results. For example... Figure 6 As shown, this embodiment proposes a Knowledge Graph-guided Multimodal Attention Mechanism (KGMAM), which guides the attention distribution to focus on semantic key regions by explicitly introducing entity association information from the structured knowledge graph, thereby enhancing the model's reasoning and discrimination capabilities in complex language scenarios.
[0113] See you again Figure 6This multimodal attention mechanism includes text self-attention computation, dynamic association computation of the knowledge graph, multimodal attention fusion, and cross-modal feature enhancement, with each stage performing specific calculations and transformations. Through dynamic association computation of the knowledge graph, entity co-occurrence probabilities and semantic path associations are realized, constructing an entity association matrix between entities and fusing co-occurrence patterns and semantic relationships. In the multimodal attention fusion stage, text self-attention and knowledge attention are weighted and fused to dynamically adjust the contribution ratio of text and knowledge graph to features, enhancing type awareness and suppressing noise. Finally, cross-modal feature enhancement is applied by superimposing attention-enhanced features with the original input, preserving multimodal information and enhancing the model's feature representation capabilities.
[0114] To achieve a dynamic trade-off and synergistic representation between text self-attention and knowledge attention, this embodiment designs a gating fusion mechanism. A gating function controls the contribution of the two attention sources to the final representation, resulting in fused attention. The calculation formula is as follows:
[0115]
[0116] in, These are learnable gating parameters. It is a learnable gating weight matrix. It is the Sigmoid function.
[0117] Step S2042: Weight the value matrix corresponding to the context feature sequence based on fusion attention to obtain value-enhanced features. Superimpose the context feature sequence and the value-enhanced features to obtain the enhanced feature sequence.
[0118] Specifically, to ensure the robustness of the model representation and the preservation of multimodal information, cross-modal residual connections are introduced, and fused attention is incorporated. The value matrix V applied to the context feature sequence H yields value-enhanced features. and enhance the value feature The enhanced feature sequence is superimposed on the original input context feature sequence H to form the final enhanced feature sequence. :
[0119] LayerNorm is a layer normalization operation.
[0120] This invention obtains fused attention by weighted fusion of text self-attention and knowledge attention. It then uses this fused attention to weight the value matrix corresponding to the context feature sequence to obtain value-enhanced features, and superimposes them with the context feature sequence to generate an enhanced feature sequence. This effectively integrates text context semantic information with prior knowledge from the knowledge graph domain, achieving complementary enhancement of text semantic features and fault entity association knowledge. It preserves the contextual dependencies of the fault text while injecting domain knowledge of entity co-occurrence patterns, path associations, and entity types, improving the domain adaptability and discriminative ability of the features. This provides more distinctive enhanced features for subsequent named entity recognition, improving the accuracy and robustness of named entity recognition for automotive faults.
[0121] Step S205: Perform sequence labeling based on the enhanced feature sequence to obtain the target entity label sequence; wherein, the target entity label sequence includes the entity label corresponding to each word.
[0122] Specifically, sequence labeling is performed using a pre-defined sequence labeling algorithm, such as a Conditional Random Field (CRF). Figure 7 As shown, the CRF algorithm receives enhanced feature sequences. The target entity label sequence is predicted. .
[0123] In some optional implementations, step S205 above includes: Step d1 involves inputting the enhanced feature sequence into a preset sequence labeling algorithm to obtain multiple original entity label sequences; wherein, the original entity label sequence includes the original label of each word.
[0124] Specifically, the CRF algorithm uses linear transformation to perform label classification prediction on the enhanced features at each position in the enhanced feature sequence, outputting several sets of original entity label sequences conforming to the annotation format. Each set of original entity label sequences contains the original label corresponding to each word in the standard text sequence. The annotation format can be BIO, BIOES, BMES, etc. Taking the BIO annotation format as an example, the labels B-faulty component and B-faulty phenomenon represent the starting positions of the corresponding words as faulty component entities and faulty phenomenon entities, respectively; I-faulty component and I-faulty phenomenon represent the internal continuation positions of the corresponding words as faulty component entities and faulty phenomenon entities, respectively; and O indicates that the corresponding word is a non-entity word.
[0125] Step d2: Determine the label score and transition score corresponding to the original label of each word. Based on the label score and transition score, obtain the global score of each original entity label sequence. The label score is used to characterize the confidence of the original label, and the transition score is used to characterize the transition probability of adjacent labels.
[0126] Specifically, for each word's original label, a label score and a transition score are determined. For the augmented features at time step t... Corresponding tags Tag score The calculation formula is as follows:
[0127] in, It is the weight matrix of the state scores. It is the bias of the state score.
[0128] Specifically, the transfer score between labels It reflects the dependency relationship between adjacent labels, and its calculation formula is as follows:
[0129] in, It is the weight matrix of the transition score. The label is predicted for time step t-1.
[0130] Specifically, in global sequence prediction, the global score of the original entity label sequence is obtained by summing the label score and the transition score:
[0131] in, This represents the overall score.
[0132] Step d3: Based on the original entity label sequence with the highest global score, obtain the target entity label sequence.
[0133] Specifically, during the prediction process, CRF maximizes the global score and uses normalization to ensure that the score follows a conditional probability distribution. It then uses the Viterbi algorithm to find the label sequence with the highest label probability, thus determining the target entity label sequence.
[0134] in, The target entity label sequence.
[0135] This invention inputs an enhanced feature sequence that integrates textual context semantics and knowledge graph domain information into a pre-defined sequence labeling algorithm. Label inference is performed on each word in the sequence, generating multiple sets of original entity label sequences. Subsequently, the label score and transition score corresponding to each original label in each set of sequences are calculated. The global score of each set of original entity label sequences is obtained by accumulating the label score and transition score. Finally, the original entity label sequence with the highest global score is selected as the target entity label sequence with higher accuracy.
[0136] In some embodiments, during the parameter update phase of the preset sequence labeling algorithm, a negative log-likelihood loss function can be used as the optimization objective. The algorithm parameters are iteratively adjusted using a gradient descent algorithm, and the loss function... As shown in the following formula:
[0137] Among them, the normalization factor Used to ensure the set of all possible entity label sequences The sum of the probabilities is 1. .
[0138] In this embodiment, the aforementioned modules significantly enhance feature representation across three dimensions: semantic modeling, context tracking, and knowledge fusion. However, in sequence labeling, there are often clear transition rules and long-range dependencies between entity labels. For example, "B - faulty component" is more likely to be followed by "I - faulty component" rather than "O". To fully utilize this global structural information and resolve label conflicts arising from single-step classification, this invention introduces a conditional random field as a label decoder at the end of the model to maximize the joint probability of the entire label sequence, achieving a smooth transition from local recognition to global optimization. This not only explicitly models label transition dependencies at the global level but also, combined with enhanced feature sequences, achieves strict constraints on label consistency in complex fault representations.
[0139] To address the unique characteristics of questions about car malfunctions, this paper proposes a named entity recognition and recombination method under the entity constraints of existing knowledge graphs, achieving high-precision semantic mapping between user questions and graph nodes. Simultaneously, a knowledge graph-enhanced multimodal attention mechanism is proposed, which strengthens the model's ability to perceive domain terminology by injecting graph entity types and relation weights.
[0140] This invention addresses the complexity of terminology, semantic ambiguity, and contextual dependence of user questions in automotive fault Q&A scenarios, and achieves efficient processing of domain-specific tasks through the collaboration of multiple modules.
[0141] See you again Figure 3 In the text input layer, stop word removal and word segmentation are performed to ensure that subsequent encoding focuses on key entity fragments. After preprocessing, the ALBERT model is selected as the context semantic feature encoder. This not only utilizes its parameter sharing and hierarchical semantic pre-training strategy to alleviate the impact of scarce annotations on model generalization, but also reduces ambiguity of homonyms and low-frequency terms through dynamic context aggregation.
[0142] In the feature extraction layer, to further enhance the model's perception of long-distance dependencies, BiLSTM is used for contextual semantic interaction tracking to achieve fine-grained localization of entity boundaries. Furthermore, a knowledge graph multimodal attention mechanism is integrated into the feature extraction stage. Since pure text context cannot encompass the rich prior knowledge of the automotive fault domain, a fusion attention mechanism carrying knowledge graph entity node and path association information dynamically adjusts the representation weights of each word in the sequence. This allows the model to accurately reference known entity relationship patterns in the knowledge graph when determining fault terms, enhancing the model's sensitivity to industry terminology and effectively bridging the semantic gap between natural language input and structured graph knowledge.
[0143] In the feature classification layer, a conditional random field is introduced to establish a label transition constraint mechanism. The dependency relationship between adjacent labels is modeled through the state transition matrix, and the Viterbi algorithm is combined to decode the globally optimal sequence, so as to achieve the synergistic optimization of named entity recognition results between domain knowledge consistency and statistical optimality.
[0144] This embodiment also provides a vehicle fault named entity recognition device, which is used to implement the above embodiments and preferred embodiments; details already described will not be repeated. As used below, the term "module" can be a combination of software and / or hardware that implements a predetermined function. Although the device described in the following embodiments is preferably implemented in software, hardware implementation, or a combination of software and hardware, is also possible and contemplated.
[0145] This embodiment provides a vehicle fault named entity recognition device, such as... Figure 8 As shown, it includes: The first processing module 801 is used to preprocess the vehicle fault information input by the user to obtain a standard text sequence, and extract the embedding vector of each word in the standard text sequence to obtain a word vector sequence; wherein, the embedding vector is used to represent the fusion feature of semantic information and word order position information of the words. The second processing module 802 is used to extract contextual semantic features from the word vector sequence to obtain a contextual feature sequence, and to obtain text self-attention based on the contextual feature sequence. The third processing module 803 is used to perform entity matching based on context feature sequences and a preset knowledge graph to obtain candidate entity sequences, determine the prior knowledge information of the candidate entity sequences in the preset knowledge graph, and obtain knowledge attention based on the prior knowledge information; wherein, the prior knowledge information is used to represent the entity association information related to the candidate entity sequences. The fourth processing module 804 is used to enhance the context feature sequence based on knowledge attention and text self-attention to obtain an enhanced feature sequence; The fifth processing module 805 is used to perform sequence labeling based on the enhanced feature sequence to obtain the target entity label sequence; wherein, the target entity label sequence includes the entity label corresponding to each word.
[0146] In some optional implementations, the first processing module 801 is further configured to: The one-hot vector of each word in the standard text sequence is mapped to a dense vector. The dense vector is then subjected to nonlinear transformation and normalization to obtain the word embedding vector corresponding to each word. The word embedding vector is used to represent the semantic information corresponding to the word. Determine the position embedding vector corresponding to each word, and superimpose the word embedding vector and position embedding vector corresponding to each word to construct the embedding vector of each word, thus obtaining the word vector sequence; wherein, the position embedding vector is used to represent the word order position information corresponding to the word.
[0147] In some optional implementations, the second processing module 802 is further configured to: The word vector sequence is processed from beginning to end to extract contextual semantic features, resulting in a positive hidden state sequence. The word vector sequence is then processed from end to beginning to extract contextual semantic features, resulting in a negative hidden state sequence. The context feature sequence is obtained based on the forward hidden state sequence and the reverse hidden state sequence.
[0148] In some optional implementations, the second processing module 802 is further configured to: Determine the query matrix, key matrix, and value matrix corresponding to the context feature sequence; Based on the query matrix and key matrix, semantic association weights are obtained. The value matrix is then weighted according to the semantic association weights to obtain text self-attention.
[0149] In some optional implementations, the prior knowledge information includes entity node information and path association information between entity nodes. The entity node information includes the entity type of the first entity in the preset knowledge graph, the first occurrence count of the first entity in the preset knowledge graph, and the second occurrence count of the entity pair consisting of the first entity and the second entity in the preset knowledge graph. The first entity and the second entity are any two entities in the candidate entity sequence. The path association information includes the shortest path type and shortest path length of the shortest path between the first entity and the second entity in the preset knowledge graph. The third processing module 803 is further configured to: Construct a co-occurrence weight matrix based on the first and second occurrence counts; Construct a path dependency weight matrix based on the shortest path type and shortest path length; Construct an entity association matrix based on the co-occurrence weight matrix and the path dependency weight matrix; An entity type weight matrix is constructed based on entity type, and knowledge attention is calculated based on the entity type weight matrix and the entity association matrix.
[0150] In some optional implementations, the third processing module 803 is further configured to: Determine the semantic enhancement coefficient corresponding to the shortest path type; where the shortest path type includes direct association path and indirect association path. Direct association path is used to represent that the first entity and the second entity are directly connected through different semantic association relations, including synonym relation and equivalence relation. Indirect association path is used to represent that the first entity is indirectly connected to the second entity through other entities. Based on the semantic enhancement coefficient and the shortest path length, the path dependency weight between the first entity and the second entity is obtained. Based on the path dependency weights of all entity pairs, a path dependency weight matrix is constructed.
[0151] In some alternative implementations, the fourth processing module 804 is further configured to: We obtain fused attention by weighting and fusing knowledge attention and text self-attention; The value matrix corresponding to the context feature sequence is weighted based on fusion attention to obtain value-enhanced features. The context feature sequence and the value-enhanced features are then superimposed to obtain the enhanced feature sequence.
[0152] In some optional implementations, the fifth processing module 805 is further configured to: The enhanced feature sequence is input into a preset sequence labeling algorithm to obtain multiple original entity label sequences; the original entity label sequences include the original labels of each word; Determine the label score and transition score corresponding to the original label of each word, and obtain the global score of each original entity label sequence based on the label score and transition score; where the label score is used to characterize the confidence of the original label, and the transition score is used to characterize the transition probability of adjacent labels. The target entity label sequence is obtained based on the original entity label sequence with the highest global score.
[0153] The vehicle fault named entity recognition device provided in this embodiment of the invention can execute the vehicle fault named entity recognition method provided in any embodiment of the invention, and has the corresponding functional modules and beneficial effects of the method. Further functional descriptions of the above modules and units are the same as those in the corresponding embodiments described above, and will not be repeated here.
[0154] Figure 9 This is a schematic diagram of the structure of an electronic device provided in an embodiment of the present invention.
[0155] The following is a detailed reference. Figure 9This diagram illustrates a structural schematic suitable for implementing an electronic device according to embodiments of the present invention. The electronic device may include a processor (e.g., a central processing unit, graphics processor, etc.) 901, which can perform various appropriate actions and processes according to a program stored in read-only memory (ROM) 902 or a program loaded from memory 908 into random access memory (RAM) 903. The RAM 903 also stores various programs and data required for the operation of the electronic device. The processor 901, ROM 902, and RAM 903 are interconnected via a bus 904. An input / output (I / O) interface 905 is also connected to the bus 904.
[0156] Typically, the following devices can be connected to I / O interface 905: input devices 906 including, for example, touchscreens, touchpads, keyboards, mice, cameras, microphones, accelerometers, gyroscopes, etc.; output devices 907 including, for example, liquid crystal displays (LCDs), speakers, vibrators, etc.; memory devices 908 including, for example, magnetic tapes, hard disks, etc.; and communication devices 909. Communication device 909 allows electronic devices to exchange data via wireless or wired communication with other devices. Although Figure 9 Electronic devices with various devices are shown, but it should be understood that it is not required to implement or have all of the devices shown, and more or fewer devices may be implemented or have instead.
[0157] In particular, according to embodiments of the present invention, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, embodiments of the present invention include a computer program product comprising a computer program carried on a non-transitory computer-readable medium, the computer program containing program code for performing the methods shown in the flowcharts. In such embodiments, the computer program can be downloaded and installed from a network via a communication device 909, or installed from a memory 908, or installed from a ROM 902. When the computer program is executed by the processor 901, it performs the functions defined in the vehicle fault named entity recognition method of the embodiments of the present invention.
[0158] Figure 9 The electronic device shown is merely an example and should not be construed as limiting the functionality and scope of use of the embodiments of the present invention.
[0159] This invention also provides a computer-readable storage medium. The methods described above according to embodiments of the invention can be implemented in hardware or firmware, or implemented as computer code that can be recorded on a storage medium, or implemented as computer code downloaded via a network and originally stored on a remote storage medium or a non-transitory machine-readable storage medium and then stored on a local storage medium. Thus, the methods described herein can be processed by software stored on a storage medium using a general-purpose computer, a dedicated processor, or programmable or dedicated hardware. The storage medium can be a magnetic disk, optical disk, read-only memory, random access memory, flash memory, hard disk, or solid-state drive, etc.; further, the storage medium can also include combinations of the above types of memory. It is understood that computers, processors, microprocessor controllers, or programmable hardware include storage components capable of storing or receiving software or computer code. When the software or computer code is accessed and executed by the computer, processor, or hardware, the vehicle fault named entity recognition method shown in the above embodiments is implemented.
[0160] A portion of this invention can be applied as a computer program product, such as computer program instructions, which, when executed by a computer, can invoke or provide the methods and / or technical solutions according to the invention through the operation of the computer. Those skilled in the art will understand that the forms in which computer program instructions exist in a computer-readable medium include, but are not limited to, source files, executable files, installation package files, etc. Correspondingly, the ways in which computer program instructions are executed by a computer include, but are not limited to: the computer directly executing the instructions, or the computer compiling the instructions and then executing the corresponding compiled program, or the computer reading and executing the instructions, or the computer reading and installing the instructions and then executing the corresponding installed program. Here, the computer-readable medium can be any available computer-readable storage medium or communication medium accessible to a computer.
[0161] Although embodiments of the invention have been described in conjunction with the accompanying drawings, those skilled in the art can make various modifications and variations without departing from the spirit and scope of the invention, and such modifications and variations all fall within the scope defined by the appended claims.
Claims
1. A method for named entity recognition of vehicle faults, characterized in that, The method includes: The vehicle fault information input by the user is preprocessed to obtain a standard text sequence, and the embedding vector of each word in the standard text sequence is extracted to obtain a word vector sequence; wherein, the embedding vector is used to represent the fusion feature of the semantic information and word order position information of the word; Contextual semantic features are extracted from the word vector sequence to obtain a contextual feature sequence, and text self-attention is obtained based on the contextual feature sequence; Entity matching is performed based on the context feature sequence and a preset knowledge graph to obtain a candidate entity sequence. Prior knowledge information of the candidate entity sequence in the preset knowledge graph is then determined, and knowledge attention is obtained based on this prior knowledge information. The prior knowledge information characterizes entity association information related to the candidate entity sequence. This prior knowledge information includes entity node information and path association information between entity nodes. The entity node information includes the entity type of the first entity in the preset knowledge graph, the first occurrence count of the first entity in the preset knowledge graph, and the second occurrence count of the entity pair consisting of the first entity and the second entity in the preset knowledge graph. The first entity and the second entity are any two entities in the candidate entity sequence. The path association information includes the shortest path type and shortest path length of the shortest path between the first entity and the second entity in the preset knowledge graph. Based on the knowledge attention and the text self-attention, the context feature sequence is enhanced to obtain an enhanced feature sequence; Sequence labeling is performed based on the enhanced feature sequence to obtain the target entity label sequence; wherein, the target entity label sequence includes the entity label corresponding to each word.
2. The vehicle fault named entity recognition method according to claim 1, characterized in that, The step of obtaining knowledge attention based on the prior knowledge information includes: Construct a co-occurrence weight matrix based on the first occurrence count and the second occurrence count; Based on the shortest path type and the shortest path length, construct a path dependency weight matrix; Construct an entity association matrix based on the co-occurrence weight matrix and the path dependency weight matrix; An entity type weight matrix is constructed based on the entity type, and knowledge attention is calculated based on the entity type weight matrix and the entity association matrix.
3. The vehicle fault named entity recognition method according to claim 2, characterized in that, The construction of the path dependency weight matrix based on the shortest path type and the shortest path length includes: Determine the semantic enhancement coefficient corresponding to the shortest path type; wherein, the shortest path type includes direct association path and indirect association path, the direct association path is used to characterize the first entity and the second entity directly connected through different semantic association relations, the semantic association relations include synonym relations and equivalence relations, and the indirect association path is used to characterize the first entity indirectly connected to the second entity through other entities; Based on the semantic enhancement coefficient and the shortest path length, the path dependency weight between the first entity and the second entity is obtained, and a path dependency weight matrix is constructed based on the path dependency weights of all entity pairs.
4. The vehicle fault named entity recognition method according to claim 1, characterized in that, The step of obtaining text self-attention based on the context feature sequence includes: Determine the query matrix, key matrix, and value matrix corresponding to the context feature sequence; Based on the query matrix and the key matrix, semantic association weights are obtained. The value matrix is then weighted based on these semantic association weights to obtain text self-attention.
5. The vehicle fault named entity recognition method according to any one of claims 1-4, characterized in that, The enhancement of the context feature sequence based on the knowledge attention and the text self-attention to obtain the enhanced feature sequence includes: The knowledge attention and the text self-attention are weighted and fused to obtain fused attention; The value matrix corresponding to the context feature sequence is weighted based on the fusion attention to obtain value-enhanced features. The context feature sequence and the value-enhanced features are then superimposed to obtain an enhanced feature sequence.
6. The vehicle fault named entity recognition method according to any one of claims 1-4, characterized in that, The step of performing sequence labeling based on the enhanced feature sequence to obtain the target entity label sequence includes: The enhanced feature sequence is input into a preset sequence labeling algorithm to obtain multiple original entity label sequences; wherein, the original entity label sequence includes the original label of each word; Determine the label score and transition score corresponding to the original label of each word, and obtain the global score of each original entity label sequence based on the label score and the transition score; wherein, the label score is used to characterize the confidence of the original label, and the transition score is used to characterize the transition probability of adjacent labels; The target entity label sequence is obtained based on the original entity label sequence with the highest global score.
7. The vehicle fault named entity recognition method according to any one of claims 1-4, characterized in that, The step of extracting contextual semantic features from the word vector sequence to obtain a contextual feature sequence includes: The word vector sequence is subjected to contextual semantic feature extraction in order from beginning to end to obtain a positive hidden state sequence, and the word vector sequence is subjected to contextual semantic feature extraction in order from end to beginning to obtain a negative hidden state sequence. The context feature sequence is obtained based on the forward hidden state sequence and the reverse hidden state sequence.
8. The vehicle fault named entity recognition method according to any one of claims 1-4, characterized in that, The step of extracting the embedding vector of each word in the standard text sequence to obtain a word vector sequence includes: The one-hot vector of each word in the standard text sequence is mapped to a dense vector, and the dense vector is subjected to nonlinear transformation and normalization to obtain the word embedding vector corresponding to each word; wherein, the word embedding vector is used to represent the semantic information corresponding to the word; Determine the position embedding vector corresponding to each word, and superimpose the word embedding vector and position embedding vector corresponding to each word to construct the embedding vector of each word, thereby obtaining a word vector sequence; wherein, the position embedding vector is used to represent the word order position information corresponding to the word.
9. A vehicle fault named entity recognition device, characterized in that, The device includes: The first processing module is used to preprocess the vehicle fault information input by the user to obtain a standard text sequence, and extract the embedding vector of each word in the standard text sequence to obtain a word vector sequence; wherein, the embedding vector is used to represent the fusion feature of the semantic information and word order position information of the word; The second processing module is used to extract contextual semantic features from the word vector sequence to obtain a contextual feature sequence, and to obtain text self-attention based on the contextual feature sequence. The third processing module is used to perform entity matching based on the context feature sequence and the preset knowledge graph to obtain a candidate entity sequence, and to determine the prior knowledge information of the candidate entity sequence in the preset knowledge graph. Based on the prior knowledge information, a knowledge attention is obtained. The prior knowledge information is used to characterize entity association information related to the candidate entity sequence. The prior knowledge information includes entity node information and path association information between entity nodes. The entity node information includes the entity type of the first entity in the preset knowledge graph, the first occurrence count of the first entity in the preset knowledge graph, and the second occurrence count of the entity pair consisting of the first entity and the second entity in the preset knowledge graph. The first entity and the second entity are any two entities in the candidate entity sequence. The path association information includes the shortest path type and shortest path length of the shortest path between the first entity and the second entity in the preset knowledge graph. The fourth processing module is used to enhance the context feature sequence based on the knowledge attention and the text self-attention to obtain an enhanced feature sequence; The fifth processing module is used to perform sequence labeling based on the enhanced feature sequence to obtain a target entity label sequence; wherein the target entity label sequence includes entity labels corresponding to each word.
10. An electronic device, characterized in that, include: A memory and a processor are communicatively connected, the memory stores computer instructions, and the processor executes the vehicle fault named entity recognition method according to any one of claims 1 to 8 by executing the computer instructions.
11. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer instructions for causing the computer to perform the vehicle fault named entity recognition method according to any one of claims 1 to 8.
12. A computer program product, characterized in that, Includes computer instructions for causing a computer to perform the vehicle fault named entity recognition method according to any one of claims 1 to 8.
Citation Information
Patent Citations
Named entity identification method for automobile engine fault diagnosis
CN110705272A
Forest fire knowledge modeling method based on named entity recognition and relation extraction
CN121524352A