Feature fusion method and device, computer device and storage medium
By integrating word features, phrase features, and sentence features in sentence parsing, multi-level fused features are generated, which solves the problem of insufficient information in existing technologies and improves the accuracy of sentence parsing.
Patent Information
- Application Number
- CN202110104577.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-01-26
- Publication Date
- 2025-11-04
- Estimated Expiration
- 2041-01-26
AI Technical Summary
In existing technologies, the fusion features of sentence parsing only refer to word features, which contain less information and result in lower accuracy.
By acquiring word features and phrase features from the target sentence and fusing them separately to obtain the first fused feature, and then fusing it with the sentence features to generate the second fused feature, the semantic features at the word level, phrase level and sentence level are represented.
It improves the accuracy of fused features, fully represents the semantic features of the target statement, and realizes the fusion of multi-level features.
Smart Images

Figure CN113569576B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] Embodiments of the present application relate to the technical field of computer, in particular to a feature fusion method and device, computer equipment and storage medium. BACKGROUND
[0002] With the continuous development of computer technology, in various fields, various functions can be realized through sentence parsing, such as developing an intelligent customer service system of a shopping website based on sentence parsing, or intelligently classifying articles based on sentence parsing. Among them, sentence parsing refers to feature extraction of a sentence to obtain features that can represent the semantics of the sentence.
[0003] In related technologies, a computer device extracts features of multiple words in a sentence to obtain word features corresponding to each word, weights and fuses the word features corresponding to each word to obtain a fusion feature, and uses the fusion feature to represent the semantics of the sentence. However, since the fusion feature only refers to the word features corresponding to the words, the amount of information referred to is small, and thus the accuracy is low. SUMMARY
[0004] Embodiments of the present application provide a feature fusion method, device, computer equipment and storage medium, which can improve the accuracy of the fusion feature of a sentence. The technical solution is as follows:
[0005] In one aspect, a feature fusion method is provided, which includes:
[0006] Obtaining word features and phrase features corresponding to each word in a target sentence, the phrase features corresponding to the word being features of the word in the case that the word belongs to a phrase in the target sentence;
[0007] Fusing the word features and phrase features corresponding to each word respectively to obtain first fusion features corresponding to each word;
[0008] Obtaining a sentence feature corresponding to the target sentence;
[0009] Fusing the first fusion features corresponding to each word and the sentence feature to obtain a second fusion feature corresponding to the target sentence.
[0010] Optionally, the first target parameter in different rounds is different, and the weighting and fusing of the first target parameter and the word features to obtain the intermediate word features corresponding to the word includes:
[0011] Weighting and fusing the first target parameter of the current round and the word features to obtain the intermediate word features corresponding to the word in the current round.
[0012] Optionally, the method further comprises:
[0013] After obtaining the plurality of rounds of second fusion features, the plurality of second fusion features are spliced to obtain spliced features.
[0014] Optionally, the obtaining of the phrase feature and the word feature corresponding to each word in the target sentence comprises:
[0015] The word vector of each word is subjected to feature extraction to obtain the word feature corresponding to each word.
[0016] Optionally, before the calling of the feature fusion model to fuse the word feature and the phrase feature corresponding to each word to obtain the first fusion feature corresponding to each word, the method further comprises:
[0017] Obtaining sample word features and sample phrase features corresponding to each word in a sample sentence, and a sample sentence feature corresponding to the sample sentence;
[0018] Calling the feature fusion model to fuse the sample word feature and the sample phrase feature corresponding to each word to obtain a first sample fusion feature corresponding to each word;
[0019] Calling the feature fusion model to fuse the first sample fusion feature corresponding to each word with the sample sentence feature to obtain a second sample fusion feature corresponding to the sample sentence;
[0020] Based on the sample word feature, the sample phrase feature, the sample sentence feature, the second sample fusion feature, and model parameters of the feature fusion model, a likelihood function is constructed;
[0021] The model parameters of the feature fusion model are adjusted to maximize the output value of the likelihood function.
[0022] Optionally, after the fusing of the first fusion feature corresponding to each word with the sentence feature to obtain the second fusion feature corresponding to the target sentence, the method further comprises:
[0023] Based on the second fusion feature corresponding to the target sentence, the target sentence is classified; or,
[0024] Based on the second fusion feature corresponding to the target sentence, a reply sentence corresponding to the target sentence is generated.
[0025] In another aspect, a feature fusion device is provided, and the device comprises:
[0026] The first feature acquisition module is configured to acquire a word feature corresponding to each word in a target sentence and a phrase feature corresponding to the word, the phrase feature corresponding to the word being a feature of the word in a case where the word belongs to a phrase in the target sentence.
[0027] The first feature fusion module is configured to fuse the word feature and the phrase feature corresponding to each word respectively to obtain a first fusion feature corresponding to each word.
[0028] The second feature acquisition module is configured to acquire a sentence feature corresponding to the target sentence.
[0029] The second feature fusion module is configured to fuse the first fusion feature corresponding to each word and the sentence feature to obtain a second fusion feature corresponding to the target sentence.
[0030] Optionally, the first feature fusion module comprises:
[0031] The target weight determination unit is configured to determine, for each word, a target weight of a phrase feature corresponding to the word based on the word feature and the phrase feature corresponding to the word.
[0032] The first feature fusion unit is configured to perform weighted processing on the phrase feature based on the target weight, and determine a feature obtained by the weighted processing as the first fusion feature corresponding to the word; or
[0033] The first feature fusion unit is configured to perform weighted processing on the phrase feature based on the target weight, and determine a feature obtained by the weighted processing as an intermediate phrase feature corresponding to the word, perform weighted fusion on the intermediate phrase feature and a word vector of the word, and determine a feature obtained by the weighted fusion as the first fusion feature corresponding to the word.
[0034] Optionally, the target weight determination unit is configured to:
[0035] perform weighted fusion on a first target parameter and the word feature corresponding to the word to obtain an intermediate word feature corresponding to the word;
[0036] in a case where the word corresponds to a plurality of phrase features, determine a product of each phrase feature and the intermediate word feature;
[0037] for each phrase feature, determine a target weight of the phrase feature based on a difference between the product corresponding to the phrase feature and products corresponding to other phrase features.
[0038] Optionally, the first target parameter in different rounds is different, and the target weight determination unit is configured to:
[0039] The first target parameter of the current round is weighted and fused with the word feature to obtain an intermediate word feature corresponding to the word in the current round.
[0040] Optionally, the second feature fusion module comprises:
[0041] The first feature enhancement unit is configured to perform feature enhancement on the first fusion feature corresponding to each word based on a first enhancement parameter corresponding to the word, to obtain a first enhanced feature corresponding to the word.
[0042] The second feature enhancement unit is configured to perform feature enhancement on the sentence feature based on a second enhancement parameter corresponding to the target sentence, to obtain a second enhanced feature corresponding to the target sentence.
[0043] The second feature fusion unit is configured to determine the second fusion feature based on the first enhanced feature corresponding to each word and the first enhancement parameter, and the second enhanced feature corresponding to the target sentence and the second enhancement parameter.
[0044] Optionally, the apparatus further comprises:
[0045] The enhancement parameter determination module is configured to determine the first enhancement parameter corresponding to each word based on a second target parameter and the first fusion feature corresponding to the word, respectively, the first enhancement parameter being positively correlated with the second target parameter, and the first enhancement parameter being positively correlated with the first fusion feature.
[0046] Optionally, the enhancement parameter determination module is further configured to determine the second enhancement parameter corresponding to the target sentence based on the second target parameter and the sentence feature, the second enhancement parameter being positively correlated with the second target parameter, and the second enhancement parameter being positively correlated with the sentence feature.
[0047] Optionally, the second target parameter is different in different rounds, and the enhancement parameter determination module comprises:
[0048] The enhancement parameter determination unit is configured to determine the first enhancement parameter corresponding to each word in the current round based on the second target parameter of the current round and the first fusion feature corresponding to the word.
[0049] Optionally, the target sentence corresponds to a plurality of sentence features belonging to different rounds, and the second feature enhancement unit is configured to:
[0050] perform feature enhancement on the sentence feature in the current round based on a second enhancement parameter corresponding to the target sentence in the current round, to obtain a second enhanced feature corresponding to the target sentence in the current round;
[0051] The second feature fusion unit is configured to:
[0052] Determine a second fusion feature of the current round based on the first enhanced feature corresponding to each word and the first enhanced parameter in the current round, and the second enhanced feature corresponding to the target sentence and the second enhanced parameter in the current round.
[0053] Optionally, the apparatus further comprises:
[0054] A feature splicing module configured to splice the second fusion features of multiple rounds after the second fusion features of the multiple rounds are obtained, to obtain spliced features.
[0055] Optionally, the second feature fusion unit is configured to:
[0056] Sum the first enhanced feature corresponding to each word and the second enhanced feature to obtain a merged feature;
[0057] Sum the first enhanced parameter corresponding to each word and the second enhanced parameter to obtain a merged parameter;
[0058] Determine the ratio between the merged feature and the merged parameter as the second fusion feature.
[0059] Optionally, the first feature acquisition module comprises at least one of the following:
[0060] A part-of-speech feature acquisition unit configured to determine one phrase feature corresponding to each word based on the part-of-speech of each word in a phrase;
[0061] A syntactic component feature acquisition unit configured to determine one phrase feature corresponding to each word based on the syntactic component of each word in a phrase;
[0062] An entity type feature acquisition unit configured to determine one phrase feature corresponding to each word based on the entity type to which each word belongs in a phrase.
[0063] Optionally, the first feature acquisition module comprises:
[0064] A word feature acquisition unit configured to perform feature extraction on the word vector of each word to obtain a word feature corresponding to each word.
[0065] Optionally, the second feature acquisition module comprises:
[0066] A sentence type acquisition unit configured to acquire multiple sentence types, each sentence type including multiple entity types arranged in sequence;
[0067] The entity type determination unit is configured to determine an entity type to which each word in the target sentence belongs;
[0068] The sentence pattern determination unit is configured to determine a sentence pattern matched with the target sentence according to the arrangement order of the entity types to which the words belong.
[0069] The sentence feature determination unit is configured to determine a feature label corresponding to the determined sentence pattern as a sentence feature of the target sentence.
[0070] Optionally, the first feature fusion module comprises:
[0071] The first model calling unit is configured to call the feature fusion model to fuse the word feature and the phrase feature corresponding to each word respectively to obtain a first fusion feature corresponding to each word.
[0072] The second feature fusion module comprises:
[0073] The second model calling unit is configured to call the feature fusion model to fuse the first fusion feature corresponding to each word and the sentence feature to obtain a second fusion feature corresponding to the target sentence.
[0074] Optionally, the apparatus further comprises:
[0075] The sample acquisition module is configured to acquire a sample word feature and a sample phrase feature corresponding to each word in a sample sentence, and a sample sentence feature corresponding to the sample sentence.
[0076] The model calling module is configured to call the feature fusion model to fuse the sample word feature and the sample phrase feature corresponding to each word respectively to obtain a first sample fusion feature corresponding to each word.
[0077] The model calling module is further configured to call the feature fusion model to fuse the first sample fusion feature corresponding to each word and the sample sentence feature to obtain a second sample fusion feature corresponding to the sample sentence.
[0078] The likelihood function construction module is configured to construct a likelihood function based on the sample word feature, the sample phrase feature, the sample sentence feature, the second sample fusion feature, and model parameters of the feature fusion model.
[0079] The model parameter adjustment module is configured to adjust the model parameters of the feature fusion model to make an output value of the likelihood function a maximum value.
[0080] In another aspect, a computer device is provided, which includes a processor and a memory, the memory having stored therein at least one computer program, the at least one computer program being loaded and executed by the processor to implement operations performed in the feature fusion method as described in the above aspects.
[0081] In another aspect, a computer readable storage medium is provided, which has stored therein at least one computer program, the at least one computer program being loaded and executed by a processor to implement operations performed in the feature fusion method as described in the above aspects.
[0082] In another aspect, a computer program product or computer program is provided, which includes computer program code stored in a computer readable storage medium, the computer program code being read by a processor of a computer device from the computer readable storage medium, the processor executing the computer program code to cause the computer device to implement operations performed in the feature fusion method as described in the above aspects.
[0083] In the method, the apparatus, the computer device and the storage medium provided by the embodiments of the present application, the first fused feature is obtained by fusing the word feature and the phrase feature, and thus the first fused feature can represent the semantic feature at the word level and the semantic feature at the phrase level. The second fused feature is obtained by fusing the first fused feature and the sentence feature, and thus the second fused feature can represent the semantic feature at the word level, the semantic feature at the phrase level and the semantic feature at the sentence level of the target sentence. The three levels of features are fused, and thus the second fused feature obtained refers to multiple information and can fully represent the semantic feature of the target sentence, improving the accuracy of the fused feature. BRIEF DESCRIPTION OF DRAWINGS
[0084] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings needed in the embodiment description will be briefly introduced. Obviously, the drawings in the following description are only some embodiments of the present application, and other drawings can be obtained by those skilled in the art without creative effort.
[0085] Figure 1 is a flowchart of a feature fusion method provided by the embodiments of the present application.
[0086] Figure 2 is a flowchart of another feature fusion method provided by the embodiments of the present application.
[0087] Figure 3 is a flowchart of another feature fusion method provided by the embodiments of the present application.
[0088] Figure 4 is a schematic diagram of a feature fusion method provided by an embodiment of the present application.
[0089] Figure 5 is a flowchart of a model training method provided by an embodiment of the present application.
[0090] Figure 6 is a structural schematic diagram of a feature fusion device provided by an embodiment of the present application.
[0091] Figure 7 is a structural schematic diagram of another feature fusion device provided by an embodiment of the present application.
[0092] Figure 8 is a structural schematic diagram of a terminal provided by an embodiment of the present application.
[0093] Figure 9 is a structural schematic diagram of a server provided by an embodiment of the present application. DETAILED DESCRIPTION
[0094] In order to make the purpose, technical scheme and advantages of the embodiments of the present application clearer, the embodiments of the present application will be further described in detail below with reference to the drawings.
[0095] It can be understood that the terms "first", "second", and the like used in the present application can be used herein to describe various concepts, but unless specifically stated, these concepts are not limited by these terms. These terms are only used to distinguish one concept from another concept. For example, without departing from the scope of the present application, the first fusion feature can be referred to as the second fusion feature, and similarly, the second fusion feature can be referred to as the first fusion feature.
[0096] Wherein, at least one refers to one or more than one, for example, at least one phrase feature can be one phrase feature, two phrase features, three phrase features, or any integer greater than or equal to one phrase feature. A plurality of refers to two or more than two, for example, a plurality of phrase features can be two phrase features, three phrase features, or any integer greater than or equal to two phrase features. Each refers to each of at least one, for example, each phrase feature refers to each of the plurality of phrase features, if the plurality of phrase features is 3 phrase features, each phrase feature refers to each of the 3 phrase features.
[0097] Artificial Intelligence (AI) is the theory, method, technology and application system of using digital computer or digital computer controlled machine to simulate, extend and expand human intelligence, perceive environment, acquire knowledge and use knowledge to obtain the best results. In other words, artificial intelligence is a comprehensive technology of computer science, which attempts to understand the essence of intelligence and produce a new intelligent machine that can react in a similar way to human intelligence. Artificial intelligence is to study the design principles and implementation methods of various intelligent machines, so that machines have the functions of perception, reasoning and decision-making.
[0098] Artificial intelligence technology is a comprehensive discipline, involving a wide range of fields, both hardware and software level technology. Artificial intelligence basic technology generally includes technologies such as sensors, special artificial intelligence chips, cloud computing, distributed storage, big data processing technology, operation / interaction system, mechatronics, etc. Artificial intelligence software technology includes natural language processing technology and machine learning.
[0099] Machine Learning (ML) is a multi-disciplinary subject, involving probability theory, statistics, approximation theory, convex analysis, algorithm complexity theory and other disciplines. It is a branch of computer science that studies how computers simulate or implement human learning behavior to acquire new knowledge or skills, reorganize existing knowledge structure to continuously improve their performance. Machine learning is the core of artificial intelligence and the fundamental approach to making computers intelligent, and its applications are widespread in various fields of artificial intelligence. Machine learning and deep learning include artificial neural networks, belief networks, reinforcement learning, transfer learning, inductive learning, and teaching learning.
[0100] Nature Language Processing (NLP) is an important direction in the field of computer science and artificial intelligence. It studies various theories and methods that can realize effective communication between people and computers using natural language. Natural language processing is a science that integrates linguistics, computer science and mathematics. Therefore, the research in this field will involve natural language, i.e. the language used in daily life, so it is closely related to the study of linguistics. Natural language processing technology usually includes text processing, semantic understanding, machine translation, robot question and answer, knowledge graph and other technologies.
[0101] The following will be based on artificial intelligence technology to explain the feature fusion method provided by the embodiments of the present application.
[0102] The feature fusion method provided in the embodiments of the present application has a computer device as an execution subject. In a possible implementation manner, the computer device is a terminal, which can be a smart phone, a tablet computer, a notebook computer, a desktop computer, a smart speaker, a smart watch, or the like. In another possible implementation manner, the computer device is a server, which can be a physical server, a server cluster composed of multiple physical servers, or a distributed system, and can also be a cloud server providing basic cloud computing services such as cloud service, cloud database, cloud computing, cloud function, cloud storage, network service, cloud communication, middleware service, domain name service, security service, CDN (Content Delivery Network), and big data and artificial intelligence platform.
[0103] In another possible implementation manner, the computer device includes a terminal and a server, and the terminal and the server can be directly or indirectly connected through wired or wireless communication. The server is configured to train a feature fusion model, and provide the feature fusion model to the terminal, so that the terminal invokes the feature fusion model to fuse the word features, phrase features, and sentence features of a sentence.
[0104] The feature fusion method provided in the embodiments of the present application can be applied to any scenario of sentence analysis.
[0105] For example, in the task of identifying sensitive sentences, it is necessary to determine the features of the sentences first, and then classify the sentences based on the features of the sentences. In this case, the method provided in the embodiments of the present application can be used first to obtain the word features and phrase features corresponding to each word in the sentence, and the sentence features corresponding to the sentence, then fuse the word features, phrase features, and sentence features corresponding to each word to obtain the fusion features corresponding to the sentence, and then classify based on the fusion features to determine whether the sentence is a sensitive sentence.
[0106] Figure 1 is a flowchart of a feature fusion method provided in the embodiments of the present application. The execution subject of the embodiments of the present application is a computer device, which is described in detail with reference to Figure 1 The method includes the following steps.
[0107] 101. The computer device obtains word features and phrase features corresponding to each word in a target sentence.
[0108] The computer device obtains a target sentence to be processed, determines a plurality of words included in the target sentence, and a plurality of phrases included in the target sentence, each of which includes a plurality of words.
[0109] The computer device extracts features of each word to obtain word features corresponding to each word, and the word features are used to represent semantic features at the word level. For each word, the computer device determines a phrase to which the word belongs in the target sentence, and determines phrase features corresponding to the word in the phrase according to the phrase to which the word belongs, respectively, to determine phrase features corresponding to each word, that is, features of the word in the case where the word belongs to a phrase in the target sentence. The phrase features are used to represent semantic features at the phrase level.
[0110] 102. The computer device fuses the word features and the phrase features corresponding to each word respectively to obtain first fusion features corresponding to each word.
[0111] For each word in the target sentence, the computer device fuses the word features corresponding to the word and the phrase features corresponding to the word to obtain first fusion features corresponding to the word, thereby obtaining first fusion features corresponding to each word. Since the first fusion features are fused from the word features and the phrase features, the first fusion features can represent semantic features at the word level and semantic features at the phrase level.
[0112] 103. The computer device obtains sentence features corresponding to the target sentence.
[0113] The computer device extracts features of the target sentence to obtain sentence features corresponding to the target sentence, and the sentence features are used to represent semantic features at the sentence level.
[0114] 104. The computer device fuses the first fusion features corresponding to each word and the sentence features to obtain second fusion features corresponding to the target sentence.
[0115] After the computer device obtains the sentence features and the first fusion features corresponding to each word, the computer device fuses the first fusion features corresponding to each word and the sentence features to obtain second fusion features corresponding to the target sentence. Since the first fusion features can represent semantic features at the word level and semantic features at the phrase level, and the second fusion features are fused from the first fusion features and the sentence features, the second fusion features can represent semantic features at the word level, semantic features at the phrase level, and semantic features at the sentence level of the target sentence, and the second fusion features can fully represent semantic features of the target sentence.
[0116] In the method provided in the embodiments of the present application, the first fused feature is obtained by fusing the word feature and the phrase feature, and thus the first fused feature can represent the semantic feature at the word level and the semantic feature at the phrase level. The second fused feature is obtained by fusing the first fused feature and the sentence feature, and thus the second fused feature can represent the semantic feature at the word level, the semantic feature at the phrase level and the semantic feature at the sentence level of the target sentence. The fusion of the features at the three levels is realized, and thus the second fused feature obtained refers to multiple information and can fully represent the semantic feature of the target sentence, improving the accuracy of the fused feature.
[0117] Figure 2 is a flowchart of a feature fusion method provided in the embodiments of the present application. The execution subject of the embodiments of the present application is a computer device, and the method comprises the following steps. Figure 2
[0118] 201. The computer device obtains the word feature and the phrase feature corresponding to each word in the target sentence.
[0119] The computer device obtains a target sentence to be processed, determines a plurality of words included in the target sentence, and determines a plurality of phrases included in the target sentence, wherein one phrase includes a plurality of words. Optionally, the target sentence is a sentence input by a user or a sentence stored in the computer device, which is not limited in the embodiments of the present application.
[0120] The computer device extracts features of each word to obtain a word feature corresponding to each word, and the word feature is used to represent the semantic feature at the word level. For each word, the computer device determines the phrase to which the word belongs in the target sentence, and respectively determines the phrase feature of the word in the phrase according to the phrase to which the word belongs, so as to determine the phrase feature corresponding to each word. The phrase feature corresponding to the word is the feature of the word in the case that the word belongs to the phrase in the target sentence, and the phrase feature is used to represent the semantic feature at the phrase level.
[0121] In a possible implementation manner, each word in the target sentence belongs to a plurality of phrases, and the computer device determines a plurality of phrase features corresponding to each word for each word. For example, the target sentence is "Xiaowang comes to decorate the newly bought house", the target sentence includes the words "decorate", "newly bought" and "house", and the target sentence includes the phrases "newly bought house" and "decorate newly bought house". The word "house" belongs to both the phrase "newly bought house" and the phrase "decorate newly bought house".
[0122] In another possible implementation, the computer device performs word segmentation on the target sentence to obtain a plurality of words in the target sentence. The computer device obtains the parts of speech and the syntactic components of the plurality of words, determines a phrase to which each word belongs according to the part of speech and the syntactic component of each word, and each phrase includes a plurality of words. The part of speech of a word includes a verb, a noun, an adjective, a quantity word, a pronoun, and the like, and the syntactic component of a word includes a subject, a predicate, an object, an attribute, an adverbial, a complement, and the like. The computer device divides a plurality of phrases in the target sentence according to the dependency relationship of the syntax according to the part of speech and the syntactic component of the word.
[0123] In another possible implementation, the computer device obtains a phrase feature corresponding to each word, including at least one of the following:
[0124] First, the computer device determines one phrase feature corresponding to each word based on the part of speech of each word in the phrase. One word can include multiple parts of speech, for example, the word "design" is both a verb and a noun, so the part of speech of one word can be different in different phrases. For each word, the computer device determines the phrase to which the word belongs, determines the part of speech of the word in the phrase, and takes the feature label corresponding to the part of speech of the word in the phrase as the phrase feature corresponding to the word, so that the phrase feature can represent the part of speech of the word in the phrase. Optionally, the computer device uses a part-of-speech gender tool to identify the part of speech of the word in the phrase.
[0125] Second, the computer device determines one phrase feature corresponding to each word based on the syntactic component of each word in the phrase. The syntactic component of one word can be different in different phrases, so for each word, the computer device determines the phrase to which the word belongs, determines the syntactic component of the word in the phrase, and takes the feature label corresponding to the syntactic component of the word in the phrase as the phrase feature corresponding to the word, so that the phrase feature can represent the syntactic component of the word in the phrase.
[0126] Thirdly, the computer device determines one phrase feature corresponding to each word based on an entity type to which the word belongs in the phrase. The entity type refers to a type of the entity represented by the word, for example, the entity type includes occupation, place name, person name, etc. The entity type of a word in different phrases can be different, therefore, for each word, the computer device determines the phrase to which the word belongs, determines the entity type of the word in the phrase, and takes the feature label corresponding to the entity type of the word in the phrase as the phrase feature corresponding to the word, so that the phrase feature can represent the entity type of the word in the phrase. Optionally, the computer device uses an entity recognition tool to identify the entity type of the word in the phrase, and the phrase feature is an Entity Embedding obtained by performing entity recognition.
[0127] Optionally, for each word, the computer device determines the phrase feature of the word in the phrase based on the part of speech, syntactic component and entity type of the word in the phrase, so that the phrase feature can represent the part of speech, syntactic component and entity type of the word in the phrase.
[0128] In another possible implementation, the computer device performs feature extraction on the word vector of each word to obtain the word feature corresponding to each word. Optionally, the word vector of the word is a Word Embedding, and the computer device generates the Word Embedding of the word by using Word2vec (a related model used to generate word vectors). Optionally, the computer device calls a feature extraction model to perform feature extraction on the word vector of each word to obtain the word feature corresponding to each word. The feature extraction model includes RNN (Recurrent Neural Network), BERT (Bidirectional Encoder Representations from Transformers) or other flat text processing models, etc., which are not limited in the embodiments of the present application. The word feature obtained by performing feature extraction on the word vector of the word is the hidden state of the word, which can represent the deep semantic of the word.
[0129] 202. The computer device determines a target weight of the phrase feature for each word based on the word feature and the phrase feature corresponding to the word.
[0130] After the computer device obtains the word feature and the phrase feature corresponding to each word, the computer device determines a target weight of at least one phrase feature corresponding to each word based on the word feature and the phrase feature corresponding to the word. The target weight is used to adjust the phrase feature of the word.
[0131] In a possible implementation, the computer device obtains a first target parameter, performs weighted fusion on the phrase features corresponding to the word based on the first target parameter, to obtain intermediate phrase features corresponding to the word, and determines the product of each phrase feature and the intermediate phrase features in the case where the word corresponds to multiple phrase features; for each phrase feature, determines the target weight of the phrase feature based on the difference between the product corresponding to the phrase feature and the products corresponding to other phrase features.
[0132] Optionally, the computer device obtains multiple target weights in multiple rounds, and the first target parameter is different in different rounds. The computer device performs weighted fusion on the phrase features corresponding to the word based on the first target parameter in the current round, to obtain intermediate phrase features corresponding to the word in the current round. In the case where the word corresponds to multiple phrase features, the product of each phrase feature and the intermediate phrase features in the current round is determined; for each phrase feature, the target weight of the phrase feature in the current round is determined based on the difference between the product corresponding to the phrase feature and the products corresponding to other phrase features in the current round.
[0133] For example, the computer device determines the target weight corresponding to each phrase feature by using the following formula:
[0134]
[0135] wherein γ jl(i) denotes the target weight of the lth phrase feature corresponding to the jth word in the ith round, k i denotes the first target parameter in the ith round, a denotes a weighting coefficient, h j denotes the phrase feature corresponding to the jth word, t jl denotes the lth phrase feature corresponding to the jth word. k i + a h j denotes the intermediate phrase feature corresponding to the jth word in the ith round, exp(·) denotes an exponential function with a natural constant e as a base, and ∑ t exp((k i + a h j )t j denotes: in the ith round, for each phrase feature corresponding to the jth word, an exponential function with e as a base and the product corresponding to the phrase feature as an index is determined, and the sum of the exponential functions corresponding to each phrase feature is added.
[0136] 203. The computer device performs weighted processing on the phrase features based on the target weights, and determines the obtained features as the first fused features corresponding to the word.
[0137] The computer device determines a target weight of the phrase feature corresponding to each word, and then performs weighting processing on the phrase feature based on the target weight of the phrase feature, and determines a first fusion feature corresponding to the word as the obtained feature. The first fusion feature is obtained by fusing the word feature and the phrase feature, and thus the first fusion feature can represent the word-level semantic feature and the phrase-level semantic feature in the target sentence.
[0138] In a possible implementation, the step 203 is replaced by the following steps: the computer device performs weighting processing on the phrase feature based on the target weight, and determines an intermediate phrase feature corresponding to the word as the obtained feature, and then performs weighted fusion on the intermediate phrase feature and the word vector of the word, and determines the first fusion feature corresponding to the word as the obtained feature. The word vector of the word is the same as the word vector in the step 201, and thus is not described herein again.
[0139] Optionally, the computer device performs a plurality of rounds to obtain a plurality of first fusion features corresponding to each word, and a plurality of phrase features corresponding to the word, and then in the step 202, after the computer device obtains the target weight of the current round, the computer device performs weighted fusion on the plurality of phrase features based on the target weight of the current round, and determines an intermediate phrase feature corresponding to the word as the obtained feature, and then performs weighted fusion on the intermediate phrase feature and the word vector of the word, and determines the first fusion feature corresponding to the word in the current round as the obtained feature. The above step is performed for each round, so as to obtain the first fusion feature corresponding to each word in the plurality of rounds.
[0140] For example, the computer device determines the first fusion feature by using the following formula:
[0141]
[0142] w' j(i) = w j + β · t' j(i) ;
[0143] wherein t' j(i) denotes the intermediate phrase feature corresponding to the jth word in the ith round, γ jl(i) denotes the target weight of the lth phrase feature corresponding to the jth word in the ith round, t jl denotes the lth phrase feature corresponding to the jth word. denotes: for each phrase feature corresponding to the jth word, determining a product of the phrase feature and the target weight of the phrase feature, and adding the products corresponding to each phrase feature. Wherein w' j(i) denotes the first fusion feature corresponding to the jth word in the ith round, w j denotes the word vector of the jth word, and β denotes a weighting coefficient.
[0144] It should be noted that the above steps 202-203 only illustrate the process of determining the target weight of the phrase feature based on the word feature and the phrase feature corresponding to the word, and then performing weighted summation on the phrase feature based on the target weight to obtain the first fusion feature, which realizes the fusion of the word feature and the phrase feature corresponding to each word to obtain the first fusion feature corresponding to each word. In another embodiment, the word feature and the phrase feature can also be fused in other ways to obtain the first fusion feature.
[0145] 204, the computer device obtains the sentence feature corresponding to the target sentence.
[0146] The computer device performs feature extraction on the target sentence to obtain the sentence feature corresponding to the target sentence, and the sentence feature is used to represent the semantic feature at the sentence level.
[0147] In a possible implementation manner, the computer device obtains a plurality of sentence pattern types, each of which includes a plurality of entity types arranged in sequence, determines the entity types to which the plurality of words arranged in sequence in the target sentence belong, determines the sentence pattern type matched with the target sentence according to the arrangement order of the entity types to which the plurality of words belong, and takes the feature label corresponding to the determined sentence pattern type as the sentence feature of the target sentence.
[0148] Each of the sentence pattern types includes a plurality of entity types arranged in sequence. For example, the sentence pattern type is “[artist]’s [song]”, and [artist] and [song] are different entity types. If the entity types to which the plurality of words arranged in sequence in the target sentence belong are the same as the plurality of entity types arranged in sequence in the sentence pattern type, the target sentence matches the sentence pattern type, and the computer device takes the feature label corresponding to the determined sentence pattern type as the sentence feature of the target sentence, so that the sentence feature can represent the sentence pattern type matched with the target sentence.
[0149] Optionally, the computer device matches the target sentence with the sentence pattern type according to the arrangement order of the entity types to which the plurality of words belong, and obtains a plurality of sentence pattern types matched with the target sentence, and the computer device takes the feature labels corresponding to the plurality of determined sentence pattern types as a plurality of sentence features of the target sentence. Optionally, the sentence feature corresponding to the target sentence is the Pattern Embedding (pattern embedding vector) obtained by the computer device in the sentence pattern matching.
[0150] 205, the computer device respectively performs feature enhancement on the first fusion feature corresponding to each word based on the first enhancement parameter corresponding to each word to obtain the first enhanced feature corresponding to each word.
[0151] After the computer device obtains the sentence features corresponding to the target sentence and the first fusion features corresponding to each word, the computer device determines the first enhancement parameter corresponding to each word, performs feature enhancement on the first fusion features corresponding to each word based on the determined first enhancement parameter corresponding to each word, and obtains the first enhancement features corresponding to each word. The first enhancement features can more significantly represent the word-level semantic features and the phrase-level semantic features of the target sentence than the first fusion features.
[0152] In a possible implementation, the computer device obtains a second target parameter, and determines the first enhancement parameter corresponding to each word based on the second target parameter and the first fusion features corresponding to each word respectively. The second target parameter is a parameter set by the computer device and used for adjusting the first fusion features. The first enhancement parameter is positively correlated with the second target parameter, that is, the first enhancement parameter increases with the increase of the second target parameter, and the first enhancement parameter is positively correlated with the first fusion features, that is, the first enhancement parameter increases with the increase of the first fusion features.
[0153] Optionally, the computer device obtains a plurality of first enhancement features in a plurality of rounds, the second target parameter in different rounds is different, and the computer device determines the first enhancement parameter corresponding to each word in the current round based on the second target parameter in the current round and the first fusion features corresponding to each word. Then, the computer device performs feature enhancement on the first fusion features corresponding to each word based on the first enhancement parameter corresponding to each word in the current round, and obtains the first enhancement features corresponding to each word in the current round.
[0154] For example, the computer device obtains the first enhancement features by using the following formula:
[0155] W j(i) =w' j(i) ·exp(c i ·w' j(i) );
[0156] wherein W j(i) denotes the first enhancement features corresponding to the jth word in the ith round, c i denotes the second target parameter in the ith round, w' j(i) denotes the first fusion features corresponding to the jth word in the ith round, exp(c i ·w' j(i) ) denotes the first enhancement parameter corresponding to the jth word in the ith round, and exp(·) denotes an exponential function with a natural constant e as a base number.
[0157] 206、The computer device performs feature enhancement on the sentence features based on the second enhancement parameter corresponding to the target sentence, and obtains the second enhancement features corresponding to the target sentence.
[0158] The computer device determines a second enhancement parameter corresponding to the target sentence, and performs feature enhancement on the sentence feature based on the second enhancement parameter corresponding to the target sentence, to obtain a second enhanced feature corresponding to the target sentence. The second enhanced feature can more significantly represent the sentence-level semantic feature of the target sentence than the sentence feature.
[0159] In a possible implementation, the computer device obtains a second target parameter, and determines the second enhancement parameter corresponding to the target sentence based on the second target parameter and the sentence feature. Optionally, the second target parameter in step 206 is the same as the second target parameter in step 205. The second enhancement parameter is positively correlated with the second target parameter, that is, the second enhancement parameter increases with the increase of the second target parameter, and the second enhancement parameter is positively correlated with the sentence feature, that is, the second enhancement parameter increases with the increase of the sentence feature.
[0160] Optionally, the target sentence corresponds to a plurality of sentence features, and the computer device determines a second enhancement parameter corresponding to the target sentence based on the second target parameter and each sentence feature, to obtain a plurality of second enhancement parameters. That is, each sentence feature corresponds to a second enhancement parameter. For each sentence feature, the computer device performs feature enhancement on the sentence feature based on the second enhancement parameter corresponding to the sentence feature, to obtain a second enhanced feature corresponding to the target sentence, and thus a plurality of second enhanced features are obtained.
[0161] Optionally, the computer device performs a plurality of rounds to obtain a plurality of second enhanced features. The target sentence corresponds to a plurality of sentence features belonging to different rounds, the second target parameter in different rounds is different, and the computer device determines a second enhancement parameter corresponding to the target sentence in a current round based on the second target parameter in the current round and the sentence feature. Then, the computer device performs feature enhancement on the sentence feature in the current round based on the second enhancement parameter corresponding to the target sentence in the current round, to obtain a second enhanced feature corresponding to the target sentence in the current round. The sentence feature in each round can be the same or different. For example, the sentence feature in each round is extracted by processing the target sentence in different manners.
[0162] For example, the computer device obtains the second enhanced feature by using the following formula:
[0163] L i =s·exp(c i ·s),s∈S i ;
[0164] wherein L i represents the second enhanced feature corresponding to the target sentence in the i th round, c irepresents the second target parameter in the i-th round, s represents the sentence feature corresponding to the target sentence, S i represents the set of multiple sentence features corresponding to the target sentence in the i-th round, and s belongs to S i represents any one of the sentence features in S, exp(c i represents the second enhancement parameter corresponding to the target sentence, and exp(·) represents the exponential function with the natural constant e as the base.
[0165] 207、The computer device determines the second fusion feature based on the first enhancement feature and the first enhancement parameter corresponding to each word, and the second enhancement feature and the second enhancement parameter corresponding to the target sentence.
[0166] After the computer device determines the first enhancement feature corresponding to each word and the second enhancement feature corresponding to the target sentence, the computer device determines the second fusion feature based on the first enhancement feature and the first enhancement parameter corresponding to each word, and the second enhancement feature and the second enhancement parameter corresponding to the target sentence. Since the first fusion feature can represent the semantic features at the word level and the semantic features at the phrase level, and the second fusion feature is obtained by fusing the first fusion feature and the sentence feature, the second fusion feature can represent the semantic features at the word level, the semantic features at the phrase level, and the semantic features at the sentence level of the target sentence. The second fusion feature refers to multiple types of information and can fully represent the semantic features of the target sentence.
[0167] In a possible implementation, the computer device performs multiple rounds to obtain multiple second fusion features. Then, the computer device obtains the first enhancement feature and the first enhancement parameter corresponding to each word in the current round, and the second enhancement feature and the second enhancement parameter corresponding to the target sentence in the current round, and determines the second fusion feature of the current round based on the first enhancement feature and the first enhancement parameter, and the second enhancement feature and the second enhancement parameter in the current round. The above steps are performed in each round to obtain the second fusion features of multiple rounds.
[0168] Optionally, after obtaining the second fusion features of multiple rounds, the computer device splices the multiple second fusion features to obtain spliced features. Since the spliced features refer to the execution results of multiple rounds, compared with the second fusion features of a single round, the spliced features can accurately and fully represent the semantic features of the target sentence.
[0169] In another possible implementation, the computer device sums the first enhanced feature corresponding to each word and the second enhanced feature to obtain a merged feature; sums the first enhanced parameter corresponding to each word and the second enhanced parameter to obtain a merged parameter; and determines the ratio between the merged feature and the merged parameter as the second fusion feature. Since the first enhanced feature can represent the semantic feature at the word level and the semantic feature at the phrase level, and the second enhanced feature can represent the semantic feature at the sentence level, the merged feature can represent the semantic feature at the word level, the semantic feature at the phrase level, and the semantic feature at the sentence level, and represents the semantic feature after enhancement.
[0170] Optionally, the target sentence corresponds to a plurality of second enhanced features and a plurality of second enhanced parameters, the computer device sums the first enhanced feature corresponding to each word and each second enhanced feature corresponding to the target sentence to obtain a merged feature; sums the first enhanced parameter corresponding to each word and each second enhanced parameter corresponding to the target sentence to obtain a merged parameter; and determines the ratio between the merged feature and the merged parameter as the second fusion feature.
[0171] Optionally, the computer device determines the second fusion feature by using the following formula:
[0172] M i = exp(c i ·w' j(i) );
[0173] N i = exp(c i ·s);
[0174]
[0175] wherein M i represents the first enhanced parameter corresponding to the jth word in the ith round, c i represents the second target parameter in the ith round, w′ j(i) represents the first fusion feature corresponding to the jth word in the ith round, N i represents the second enhanced parameter in the ith round, and s represents the sentence feature corresponding to the target sentence in the ith round, the s belongs to any one of S i , S i represents a plurality of sentence features corresponding to the target sentence in the ith round, and exp(·) represents an exponential function with a natural constant e as a base number.
[0176] wherein x i represents the second fusion feature in the ith round, W j(i) represents the first enhanced feature corresponding to the jth word in the ith round, and ∑j W j(i) denotes adding the first enhanced feature corresponding to each word, i denotes the second enhanced feature corresponding to the target sentence in the i-th round, denotes adding the multiple second enhanced features corresponding to the target sentence in the i-th round, j M i denotes adding the first enhanced parameter corresponding to each word, denotes adding the multiple second enhanced parameters corresponding to the target sentence in the i-th round. denotes merging the features, denotes merging the parameters. denotes the ratio between the merged features and the merged parameters.
[0177] In another possible implementation, the computer device obtains a reference feature of the target sentence, adds the reference feature and the second fused feature to obtain an added feature, and uses the added feature to represent the semantic feature of the target sentence. Optionally, the reference feature is a mean value or a sum value of a word vector of each word in the target word, etc. Optionally, the reference feature is a feature label corresponding to a type of the target sentence. For example, when a user inputs the target sentence, the user also inputs the type of the target sentence, and the computer device takes the feature label corresponding to the type of the target sentence as the reference feature of the target sentence.
[0178] It should be noted that the above steps 205-207 only illustrate the process of determining the second fused feature based on the first enhanced parameter, the second enhanced parameter, the first enhanced feature, and the second enhanced feature, which realizes the fusion of the first fused feature corresponding to each word and the sentence feature to obtain the second fused feature corresponding to the target sentence. In another embodiment, the first fused feature and the sentence feature can also be fused in other manners to obtain the second fused feature corresponding to the target sentence.
[0179] It should be noted that after the computer device obtains the second fused feature corresponding to the target sentence, the computer device can perform other tasks on the target sentence based on the second fused feature. Optionally, the computer device classifies the target sentence based on the second fused feature corresponding to the target sentence. For example, the computer device determines the field to which the target sentence belongs, whether the target sentence is a sensitive sentence, the emotion expressed by the target sentence, etc. based on the second fused feature. Optionally, the computer device generates a reply sentence corresponding to the target sentence based on the second fused feature corresponding to the target sentence. For example, in an intelligent customer service system of a shopping website, the target sentence is a question input by a buyer, and a reply sentence corresponding to the target sentence is generated based on the second fused feature to automatically answer the question of the buyer. In addition to this, the second fused feature corresponding to the target sentence can also be applied to other scenarios, which are not limited by the embodiments of the present application.
[0180] In the method provided by the embodiments of the present application, the first fused feature is obtained by fusing the word feature and the phrase feature, and thus the first fused feature can represent the semantic features at the word level and the phrase level. The second fused feature is obtained by fusing the first fused feature and the sentence feature, and thus the second fused feature can represent the semantic features at the word level, the phrase level and the sentence level of the target sentence. The three levels of features are fused, and thus the second fused feature obtained refers to multiple types of information and can fully represent the semantic features of the target sentence, improving the accuracy of the fused feature.
[0181] In addition, the computer device obtains multiple second fused features in multiple rounds, and splices the multiple second fused features to obtain a spliced feature. Since the spliced feature refers to the execution results of multiple rounds, the semantic features of the target sentence can be accurately and fully represented compared with the second fused feature of a single round.
[0182] In another feature fusion method provided by the embodiments of the present application, the computer device fuses the word feature, the phrase feature and the sentence feature in multiple rounds to obtain the second fused feature corresponding to the target sentence. The method comprises:
[0183] In the first round, the computer device obtains the first target parameter and the second target parameter in the first round. The first target parameter is fused with the word feature by weighting to obtain an intermediate word feature, and the product of each phrase feature and the intermediate word feature is determined. For each phrase feature, the target weight of the phrase feature is determined based on the difference between the product corresponding to the phrase feature and the products corresponding to other phrase features. The computer device performs weighting processing on the phrase feature based on the target weight, and determines the first fused feature corresponding to the word as the obtained feature. The computer device determines the first enhancement parameter corresponding to each word based on the second target parameter and the first fused feature corresponding to each word, and performs feature enhancement on the first fused feature based on the first enhancement parameter to obtain the first enhanced feature corresponding to each word. The computer device determines the second enhancement parameter corresponding to the target sentence based on the second target parameter and the sentence feature. The sentence feature is enhanced based on the second enhancement parameter to obtain the second enhanced feature corresponding to the target sentence. The computer device determines the second fused feature corresponding to the target sentence in the first round based on the first enhanced feature corresponding to each word and the first enhancement parameter, and the second enhanced feature corresponding to the target sentence and the second enhancement parameter.
[0184] In the second round, the computer device obtains the first target parameter and the second target parameter in the second round, and re-executes the above steps to determine the second fused feature vector corresponding to the target sentence in the second round.
[0185] For each round, the computer device performs the above steps, after performing m rounds, the computer device obtains m second fusion features, and then the computer device can splice the m second fusion features to obtain spliced features to represent the semantic features of the target sentence.
[0186] Figure 3 is a flowchart of a feature fusion method provided in the embodiment of the present application. The execution subject of the embodiment of the present application is a computer device, and the computer device stores a feature fusion model, which is used to fuse word features, phrase features and sentence features. Referring to Figure 3 , the method comprises:
[0187] 301. The computer device obtains word features and phrase features corresponding to each word in the target sentence, and a sentence feature corresponding to the target sentence.
[0188] The step 301 is the same as the steps 201 and 204 described above, and will not be repeated here.
[0189] 302. The computer device calls the feature fusion model to fuse the word features and the phrase features corresponding to each word respectively, to obtain first fusion features corresponding to each word.
[0190] In a possible implementation, the computer device calls the feature fusion model to determine a target weight of the phrase feature based on the word features and the phrase features corresponding to the word, and performs weighted processing on the phrase feature based on the target weight, and determines the obtained feature as the first fusion feature corresponding to the word.
[0191] Optionally, the feature fusion model includes a first target parameter, and the computer device calls the feature fusion model to perform weighted fusion on the first target parameter and the word features corresponding to the word to obtain intermediate word features, and in the case that there are multiple phrase features corresponding to the word, determines the product of each phrase feature and the intermediate word features; for each phrase feature, determines a target weight of the phrase feature based on the difference between the product corresponding to the phrase feature and the products corresponding to the other phrase features.
[0192] Optionally, the feature fusion model includes m feature fusion networks, and each feature fusion network includes 1 first target parameter, where m is a positive integer not less than 1. Then the computer device calls the m feature fusion networks respectively to determine the target weight of the phrase feature. That is, the m feature fusion networks obtain 1 target weight respectively, and then perform weighted processing on the phrase feature based on the m target weights respectively, and determine the obtained feature as the first fusion feature corresponding to the word, thereby obtaining m first fusion features.
[0193] 303、The computer device calls the feature fusion model to fuse the first fusion feature corresponding to each word and the sentence feature to obtain the second fusion feature corresponding to the target sentence.
[0194] In a possible implementation, the computer device calls the feature fusion model to perform feature enhancement on the first fusion feature corresponding to each word based on the first enhancement parameter corresponding to each word respectively to obtain the first enhancement feature corresponding to each word, performs feature enhancement on the sentence feature based on the second enhancement parameter corresponding to the target sentence to obtain the second enhancement feature corresponding to the target sentence, and determines the second fusion feature based on the first enhancement feature corresponding to each word and the first enhancement parameter, and the second enhancement feature corresponding to the target sentence and the second enhancement parameter.
[0195] Optionally, the computer device obtains a reference feature of the target sentence, calls the feature fusion model to add the reference feature and the second fusion feature to obtain an added feature, and uses the added feature to represent the semantic feature of the target sentence. Optionally, the reference feature is a mean value or a sum value of the word vector of each word in the target word, and the like. Optionally, the reference feature is a feature label of the target sentence, for example, a type of the target sentence input by a user, and the computer device takes the feature label corresponding to the type of the target sentence as the reference feature of the target sentence.
[0196] Optionally, the feature fusion model includes a second target parameter, the computer device calls the feature fusion model to determine the first enhancement parameter corresponding to each word based on the second target parameter and the first fusion feature corresponding to each word respectively. The computer device calls the feature fusion model to determine the second enhancement parameter corresponding to the target sentence based on the second target parameter and the sentence feature.
[0197] Optionally, the feature fusion model includes m feature fusion networks, and each feature fusion network includes one second target parameter, the computer device calls the m feature fusion networks respectively to determine the first enhancement parameter and the second enhancement parameter. That is, the m feature fusion networks obtain m groups of first enhancement parameters and second enhancement parameters respectively, and then obtain m second fusion features corresponding to the target sentence based on the m groups of first enhancement parameters and second enhancement parameters respectively.
[0198] Optionally, the computer device splices the m second fusion features to obtain a spliced feature. Since the spliced feature refers to the execution results of multiple rounds, compared with the second fusion feature of a single round, the spliced feature can accurately and sufficiently represent the semantic feature of the target sentence. For example, the computer device fuses the m second fusion features into one feature through a group of nonlinear neural networks, the nonlinear neural networks include a generalization processing function, a feature extraction layer, a nonlinear function, and the like, and the output of the nonlinear neural networks is:
[0199] x' = f ([x1, x2,... x m ]);
[0200] wherein x1 represents the second fusion feature output by the first feature fusion network, x2 represents the second fusion feature output by the second feature fusion network, and xm represents the second fusion feature output by the mth feature fusion network, and f ([·]) represents the operation of splicing each other between features. m
[0201] Figure 4 is a schematic diagram of a feature fusion method provided by an embodiment of the present application. Referring to Figure 4 , the computer device invokes a feature extraction model 401 to perform feature extraction on the word vectors of each word in the target sentence, to obtain word features 403. The computer device takes the mean of the word vectors of the plurality of words in the target sentence as a reference feature 406. The computer device obtains phrase features 404 corresponding to each word and sentence features 405 corresponding to the target sentence.
[0202] The feature fusion model 402 is composed of a plurality of feature fusion networks. The computer device inputs the word features 403, the phrase features 404, the sentence features 405, and the reference feature 406 into the feature fusion model 402. After processing by the feature fusion model 402, each feature fusion network outputs a second fusion feature 407. The computer device splices the plurality of second fusion features 407 to obtain spliced features 408. The computer device performs a corresponding task based on the spliced features 408, such as an intelligent question answering task, an article classification task, etc.
[0203] In another embodiment, as shown in Figure 5 , the training method of the feature fusion model includes the following steps:
[0204] 501. The computer device obtains sample word features and sample phrase features corresponding to each word in a sample sentence, and sample sentence features corresponding to the sample sentence.
[0205] 502. The computer device invokes a feature fusion model to fuse the sample word features and the sample phrase features corresponding to each word, respectively, to obtain first sample fusion features corresponding to each word.
[0206] 503. The computer device invokes a feature fusion model to fuse the first sample fusion features corresponding to each word and the sample sentence features, to obtain second sample fusion features corresponding to the sample sentence.
[0207] The processes of steps 501-503 above are the same as those of steps 301-303 above, and will not be repeated here.
[0208] 504、The computer device constructs a likelihood function based on the sample word features, the sample phrase features, the sample sentence features, the second sample fusion features, and the model parameters of the feature fusion model, adjusts the model parameters of the feature fusion model to maximize the output value of the likelihood function.
[0209] The input of the feature fusion model is the sample word features, the sample phrase features, and the sample sentence features, and the output of the feature fusion model is the second sample fusion features. The computer device constructs a likelihood function with the model parameters as the independent variable based on the input and the output of the feature fusion model and the model parameters of the feature fusion model, then adjusts the model parameters in the likelihood function to maximize the output value of the likelihood function by using the gradient descent method, and takes the model parameters when the output value of the likelihood function is the maximum as the model parameters of the feature fusion model, thereby completing the training of the feature fusion model.
[0210] Figure 6 is a structural schematic diagram of a feature fusion device provided by an embodiment of the present application. Referring to Figure 6 The device comprises:
[0211] The first feature acquisition module 601 is configured to acquire the word features and the phrase features corresponding to each word in the target sentence. The phrase features corresponding to a word are features of the word in the case where the word belongs to a phrase in the target sentence.
[0212] The first feature fusion module 602 is configured to fuse the word features and the phrase features corresponding to each word respectively to obtain the first fusion features corresponding to each word.
[0213] The second feature acquisition module 603 is configured to acquire the sentence features corresponding to the target sentence.
[0214] The second feature fusion module 604 is configured to fuse the first fusion features corresponding to each word and the sentence features to obtain the second fusion features corresponding to the target sentence.
[0215] In the feature fusion device provided by the embodiment of the present application, the first fusion features are obtained by fusing the word features and the phrase features, and thus the first fusion features can represent the semantic features at the word level and the semantic features at the phrase level. The second fusion features are obtained by fusing the first fusion features and the sentence features, and thus the second fusion features can represent the semantic features at the word level, the semantic features at the phrase level, and the semantic features at the sentence level of the target sentence, and the fusion of the features at the three levels is realized. Therefore, the second fusion features refer to multiple information and can fully represent the semantic features of the target sentence, and the accuracy of the fusion features is improved.
[0216] Optionally, referring to Figure 7, the first feature fusion module 602 comprises:
[0217] The target weight determination unit 6021 is configured to determine, for each word, a target weight of the phrase feature based on the word feature and the phrase feature corresponding to the word.
[0218] The first feature fusion unit 6022 is configured to perform weighted processing on the phrase feature based on the target weight, and determine the obtained feature as the first fusion feature corresponding to the word.
[0219] The first feature fusion unit 6022 is configured to perform weighted processing on the phrase feature based on the target weight, and determine the obtained feature as the first fusion feature corresponding to the word.
[0220] Optionally, referring to Figure 7 The target weight determination unit 6021 is configured to:
[0221] The first target parameter and the word feature corresponding to the word are weighted and fused to obtain the intermediate word feature corresponding to the word.
[0222] In the case that the word corresponds to a plurality of phrase features, the product of each phrase feature and the intermediate word feature is determined.
[0223] For each phrase feature, the target weight of the phrase feature is determined based on the difference between the product corresponding to the phrase feature and the products corresponding to the other phrase features.
[0224] Optionally, referring to Figure 7 The target weight determination unit 6021 is configured to:
[0225] The first target parameter of the current round and the word feature are weighted and fused to obtain the intermediate word feature corresponding to the word in the current round.
[0226] Optionally, referring to Figure 7 The second feature fusion module 604 comprises:
[0227] The first feature enhancement unit 6041 is configured to perform feature enhancement on the first fusion feature corresponding to each word based on the first enhancement parameter corresponding to each word, respectively, to obtain the first enhancement feature corresponding to each word.
[0228] The second feature enhancement unit 6042 is configured to perform feature enhancement on the sentence feature based on the second enhancement parameter corresponding to the target sentence, to obtain the second enhancement feature corresponding to the target sentence.
[0229] The second feature fusion unit 6043 is configured to determine a second fusion feature based on the first enhanced feature corresponding to each word and the first enhanced parameter, and the second enhanced feature corresponding to the target sentence and the second enhanced parameter.
[0230] Optionally, referring to Figure 7 , the apparatus further includes:
[0231] The enhanced parameter determination module 605 is configured to determine the first enhanced parameter corresponding to each word based on the second target parameter and the first fusion feature corresponding to each word respectively, the first enhanced parameter being positively correlated with the second target parameter, and the first enhanced parameter being positively correlated with the first fusion feature.
[0232] Optionally, referring to Figure 7 , the enhanced parameter determination module 605 is further configured to determine the second enhanced parameter corresponding to the target sentence based on the second target parameter and the sentence feature, the second enhanced parameter being positively correlated with the second target parameter, and the second enhanced parameter being positively correlated with the sentence feature.
[0233] Optionally, referring to Figure 7 , the second target parameter in different rounds is different, and the enhanced parameter determination module 605 includes:
[0234] The enhanced parameter determination unit 6051 is configured to determine the first enhanced parameter corresponding to each word in the current round based on the second target parameter in the current round and the first fusion feature corresponding to each word respectively.
[0235] Optionally, referring to Figure 7 , the target sentence corresponds to a plurality of sentence features belonging to different rounds, and the second feature enhancement unit 6042 is configured to:
[0236] perform feature enhancement on the sentence feature in the current round based on the second enhanced parameter corresponding to the target sentence in the current round, to obtain the second enhanced feature corresponding to the target sentence in the current round;
[0237] The second feature fusion unit 6043 is configured to:
[0238] determine the second fusion feature of the current round based on the first enhanced feature corresponding to each word in the current round and the first enhanced parameter, and the second enhanced feature corresponding to the target sentence in the current round and the second enhanced parameter.
[0239] Optionally, referring to Figure 7 , the apparatus further includes:
[0240] The feature splicing module 606 is configured to splice the plurality of second fusion features to obtain spliced features after the plurality of second fusion features are obtained.
[0241] Optionally, referring toFigure 7 the second feature fusion unit 6043 is configured to:
[0242] sum the first enhanced feature and the second enhanced feature corresponding to each word to obtain a merged feature;
[0243] sum the first enhanced parameter and the second enhanced parameter corresponding to each word to obtain a merged parameter;
[0244] determine the ratio between the determined merged feature and the merged parameter as a second fusion feature.
[0245] Optionally, referring to Figure 7 the first feature acquisition module 601 includes at least one of the following:
[0246] the part-of-speech feature acquisition unit 6011 is configured to determine one phrase feature corresponding to each word based on the part-of-speech of each word in the phrase;
[0247] the syntactic component feature acquisition unit 6012 is configured to determine one phrase feature corresponding to each word based on the syntactic component of each word in the phrase;
[0248] the entity type feature acquisition unit 6013 is configured to determine one phrase feature corresponding to each word based on the entity type to which each word in the phrase belongs.
[0249] Optionally, referring to Figure 7 the first feature acquisition module 601 includes:
[0250] the word feature acquisition unit 6014 is configured to perform feature extraction on the word vector of each word to obtain a word feature corresponding to each word.
[0251] Optionally, referring to Figure 7 the second feature acquisition module 603 includes:
[0252] the sentence pattern type acquisition unit 6031 is configured to acquire a plurality of sentence pattern types, each of which includes a plurality of entity types arranged in sequence;
[0253] the entity type determination unit 6032 is configured to determine the entity types to which the plurality of words arranged in sequence in the target sentence belong;
[0254] the sentence pattern type determination unit 6033 is configured to determine a sentence pattern type matching the target sentence according to the arrangement order of the entity types to which the plurality of words belong;
[0255] the sentence feature determination unit 6034 is configured to determine a feature label corresponding to the determined sentence pattern type as the sentence feature of the target sentence.
[0256] Optionally, referring toFigure 8 The first feature fusion module 602 comprises:
[0257] The first model calling unit 6023 is configured to call a feature fusion model, and fuse the phrase feature corresponding to each word with the word feature corresponding to the word respectively to obtain the first fusion feature corresponding to each word.
[0258] The second feature fusion module 604 comprises:
[0259] The second model calling unit 6044 is configured to call a feature fusion model, and fuse the first fusion feature corresponding to each word with the sentence feature to obtain the second fusion feature corresponding to the target sentence.
[0260] Optionally, referring to Figure 8 The apparatus further comprises:
[0261] The sample acquisition module 607 is configured to acquire the sample phrase feature and the sample sentence feature corresponding to each word in the sample sentence, and the sample sentence feature corresponding to the sample sentence.
[0262] The model calling module 608 is configured to call a feature fusion model, and fuse the sample phrase feature corresponding to each word with the sample sentence feature to obtain the second sample fusion feature corresponding to the sample sentence.
[0263] The model calling module 608 is further configured to call a feature fusion model, and fuse the first sample fusion feature corresponding to each word with the sample sentence feature to obtain the second sample fusion feature corresponding to the sample sentence.
[0264] The likelihood function construction module 609 is configured to construct a likelihood function based on the sample word feature, the sample phrase feature, the sample sentence feature, the second sample fusion feature, and the model parameter of the feature fusion model.
[0265] The model parameter adjustment module 610 is configured to adjust the model parameter of the feature fusion model, so that the output value of the likelihood function is the maximum value.
[0266] It should be noted that: the feature fusion apparatus provided in the above embodiment only takes the division of the above functional modules as an example for illustration, and in actual application, the above functions can be completed by different functional modules according to needs, that is, the internal structure of the computer device is divided into different functional modules to complete all or part of the functions described above. In addition, the feature fusion apparatus and the feature fusion method provided in the above embodiment belong to the same concept, and the specific implementation process is described in detail in the method embodiment, which will not be repeated here.
[0267] The embodiment of the present application further provides a computer device, comprising a processor and a memory, and the memory stores at least one computer program, which is loaded and executed by the processor to realize the operation performed in the feature fusion method provided by the above embodiment.
[0268] Optionally, the computer device is provided as a terminal. Figure 9 A structure diagram of a terminal 800 provided by an example embodiment of the present application is shown.
[0269] The terminal 800 comprises a processor 801 and a memory 802.
[0270] The processor 801 can comprise one or more processing cores, such as a 4-core processor, an 8-core processor, etc. The processor 801 can be implemented in the form of at least one of a DSP (Digital Signal Processing), an FPGA (Field Programmable Gate Array), and a PLA (Programmable Logic Array). The processor 801 can also comprise a main processor and a coprocessor. The main processor is a processor for processing data in an awake state, also referred to as a CPU (Central Processing Unit). The coprocessor is a low-power processor for processing data in a standby state. In some embodiments, the processor 801 can be integrated with a GPU (Graphics Processing Unit) for rendering and drawing the content to be displayed by the display screen. In some embodiments, the processor 801 can further comprise an AI (Artificial Intelligence) processor for processing machine learning-related computing operations.
[0271] The memory 802 can comprise one or more computer-readable storage media, which can be non-transitory. The memory 802 can further comprise a high-speed random access memory, and a nonvolatile memory such as one or more disk storage devices, flash storage devices. In some embodiments, the non-transitory computer-readable storage medium in the memory 802 is used to store at least one computer program for being executed by the processor 801 to realize the feature fusion method provided by the method embodiment of the present application.
[0272] In some embodiments, terminal 800 can further optionally include a peripheral device interface 803 and at least one peripheral device. Processor 801, memory 802 and peripheral device interface 803 can be connected through a bus or signal line. Each peripheral device can be connected to peripheral device interface 803 through a bus, signal line or circuit board. Optionally, the peripheral devices include at least one of radio frequency circuit 804, display screen 805 and power supply 806.
[0273] Peripheral device interface 803 can be used to connect at least one peripheral device related to I / O (Input / Output) to processor 801 and memory 802. In some embodiments, processor 801, memory 802 and peripheral device interface 803 are integrated on the same chip or circuit board; in some other embodiments, any one or two of processor 801, memory 802 and peripheral device interface 803 can be implemented on a separate chip or circuit board, and the present embodiments are not limited in this regard.
[0274] Radio frequency circuit 804 is used to receive and transmit RF (Radio Frequency) signals, also known as electromagnetic signals. Radio frequency circuit 804 communicates with communication networks and other communication devices through electromagnetic signals. Radio frequency circuit 804 converts electrical signals into electromagnetic signals for transmission, or converts received electromagnetic signals into electrical signals. Optionally, radio frequency circuit 804 includes an antenna system, an RF transceiver, one or more amplifiers, a tuner, an oscillator, a digital signal processor, a codec chipset, a subscriber identity module card, and the like. Radio frequency circuit 804 can communicate with other devices through at least one wireless communication protocol. The wireless communication protocol includes but is not limited to metropolitan area networks, various generations of mobile communication networks (2G, 3G, 4G and 5G), wireless local area networks and / or WiFi (Wireless Fidelity) networks. In some embodiments, radio frequency circuit 804 can also include NFC (Near Field Communication) related circuitry, and the present application is not limited in this regard.
[0275] Display screen 805 is used to display a UI (User Interface). This UI may include graphics, text, icons, videos, and any combination thereof. When display screen 805 is a touch display screen, it also has the ability to collect touch signals on or above its surface. These touch signals can be input as control signals to processor 801 for processing. In this case, display screen 805 can also be used to provide virtual buttons and / or a virtual keyboard, also known as soft buttons and / or a soft keyboard. In some embodiments, there may be one display screen 805, disposed on the front panel of terminal 800; in other embodiments, there may be at least two display screens, disposed on different surfaces of terminal 800 or in a folded design; in other embodiments, display screen 805 may be a flexible display screen, disposed on a curved or folded surface of terminal 800. Furthermore, display screen 805 may be configured as a non-rectangular irregular shape, i.e., a non-rectangular screen. Display screen 805 may be made of materials such as LCD (Liquid Crystal Display) or OLED (Organic Light-Emitting Diode).
[0276] Power supply 806 is used to power the various components in terminal 800. Power supply 806 can be AC power, DC power, a disposable battery, or a rechargeable battery. When power supply 806 includes a rechargeable battery, the rechargeable battery can support wired or wireless charging. The rechargeable battery can also be used to support fast charging technology.
[0277] Those skilled in the art will understand that The structure shown does not constitute a limitation on terminal 800 and may include more or fewer components than shown, or combine certain components, or use different component arrangements.
[0278] Optionally, the computer device is provided as a server. This is a schematic diagram of a server structure provided in an embodiment of this application. The server 900 can vary significantly due to different configurations or performance. It may include one or more Central Processing Units (CPUs) 901 and one or more memories 902. The memories 902 store at least one computer program, which is loaded and executed by the processor 901 to implement the methods provided in the various method embodiments described above. Of course, the server may also have wired or wireless network interfaces, a keyboard, and input / output interfaces for input and output. The server may also include other components for implementing device functions, which will not be elaborated upon here.
[0279] The embodiment of the present application further provides a computer readable storage medium, and the computer readable storage medium stores at least one computer program, the at least one computer program is loaded and executed by a processor to realize the operation performed in the feature fusion method of the above-mentioned embodiment.
[0280] The embodiment of the present application further provides a computer program product or a computer program, the computer program product or the computer program includes computer program code, the computer program code is stored in a computer readable storage medium, a processor of a computer device reads the computer program code from the computer readable storage medium, and the processor executes the computer program code, so that the computer device realizes the operation performed in the feature fusion method of the above-mentioned embodiment.
[0281] Those skilled in the art can understand that all or part of the steps of the above-mentioned embodiments can be completed by hardware, or by a program instructing relevant hardware to complete, and the program can be stored in a computer readable storage medium. The storage medium mentioned above can be a read-only memory, a magnetic disk or an optical disk.
[0282] The above-mentioned is only optional embodiment of the present application, and does not limit the present application, and any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application should be included in the protection scope of the present application.
Claims
1. A feature fusion method, characterized in that, The method comprises: determining a plurality of words in a target sentence and a plurality of phrases to which each word in the target sentence belongs; for each word, obtaining a word feature corresponding to the word, determining a plurality of phrase features corresponding to the word according to the plurality of phrases to which the word belongs, the phrase feature corresponding to the word being a feature of the word in the case that the word belongs to a phrase in the target sentence, performing weighted fusion on a first target parameter and the word feature corresponding to the word to obtain an intermediate word feature corresponding to the word, determining a product of each phrase feature corresponding to the word and the intermediate word feature, determining a target weight of each phrase feature based on the difference between the product corresponding to each phrase feature and the product corresponding to other phrase features, and performing weighted processing on each phrase feature based on the target weight of each phrase feature to determine a first fusion feature corresponding to the word based on the feature obtained by the weighted processing; obtaining a sentence feature corresponding to the target sentence; performing fusion on the first fusion feature corresponding to each word and the sentence feature to obtain a second fusion feature corresponding to the target sentence.
2. The method of claim 1, wherein, The weighted processing of each phrase feature based on the target weight, and the determination of the first fusion feature corresponding to the word based on the feature obtained by the weighted processing, comprise: performing weighted processing on the phrase feature based on the target weight, and determining the feature obtained by the weighted processing as the first fusion feature corresponding to the word; or performing weighted processing on the phrase feature based on the target weight, determining the feature obtained by the weighted processing as an intermediate phrase feature corresponding to the word, and performing weighted fusion on the intermediate phrase feature and the word vector of the word to determine the feature obtained by the weighted fusion as the first fusion feature corresponding to the word.
3. The method of claim 1, wherein, The fusion of the first fusion feature corresponding to each word and the sentence feature to obtain the second fusion feature corresponding to the target sentence comprises: performing feature enhancement on the first fusion feature corresponding to each word based on the first enhancement parameter corresponding to each word to obtain a first enhanced feature corresponding to each word; performing feature enhancement on the sentence feature based on the second enhancement parameter corresponding to the target sentence to obtain a second enhanced feature corresponding to the target sentence; determining the second fusion feature based on the first enhanced feature corresponding to each word and the first enhancement parameter, and the second enhanced feature corresponding to the target sentence and the second enhancement parameter.
4. The method of claim 3, wherein, Before the feature enhancement on the first fusion feature corresponding to each word based on the first enhancement parameter corresponding to each word to obtain the first enhanced feature corresponding to each word, the method further comprises: determining the first enhancement parameter corresponding to each word based on the second target parameter and the first fusion feature corresponding to each word, wherein the first enhancement parameter is positively correlated with the second target parameter, and the first enhancement parameter is positively correlated with the first fusion feature.
5. The method of claim 4, wherein, Before the feature enhancement of the sentence feature based on the second enhancement parameter corresponding to the target sentence, the method further comprises: determining the second enhancement parameter corresponding to the target sentence based on the second target parameter and the sentence feature, wherein the second enhancement parameter is positively correlated with the second target parameter, and the second enhancement parameter is positively correlated with the sentence feature.
6. The method of claim 4, wherein, The second target parameter in different rounds is different, and the determination of the first enhancement parameter corresponding to each word based on the second target parameter and the first fusion feature corresponding to each word comprises: determining the first enhancement parameter corresponding to each word in the current round based on the second target parameter in the current round and the first fusion feature corresponding to each word.
7. The method of claim 6, wherein, The target sentence corresponds to a plurality of sentence features belonging to different rounds, and the feature enhancement of the sentence feature based on the second enhancement parameter corresponding to the target sentence comprises: performing feature enhancement on the sentence feature in the current round based on the second enhancement parameter corresponding to the target sentence in the current round, to obtain the second enhancement feature corresponding to the target sentence in the current round; The determination of the second fusion feature based on the first enhancement feature and the first enhancement parameter corresponding to each word, and the second enhancement feature and the second enhancement parameter corresponding to the target sentence comprises: determining the second fusion feature in the current round based on the first enhancement feature and the first enhancement parameter corresponding to each word in the current round, and the second enhancement feature and the second enhancement parameter corresponding to the target sentence in the current round.
8. The method of claim 3, wherein, The determination of the second fusion feature based on the first enhancement feature and the first enhancement parameter corresponding to each word, and the second enhancement feature and the second enhancement parameter corresponding to the target sentence comprises: summing the first enhancement feature and the second enhancement feature corresponding to each word to obtain a merged feature; summing the first enhancement parameter and the second enhancement parameter corresponding to each word to obtain a merged parameter; determining the ratio between the merged feature and the merged parameter as the second fusion feature.
9. The method of claim 1, wherein, The determination of a plurality of phrase features corresponding to the word based on a plurality of phrases to which the word belongs comprises at least one of the following: determining one phrase feature corresponding to the word based on the part of speech of the word in the phrase; determining one phrase feature corresponding to the word based on the syntactic component of the word in the phrase; determining one phrase feature corresponding to the word based on the entity type to which the word belongs in the phrase.
10. The method of claim 1, wherein, The acquisition of the sentence feature corresponding to the target sentence comprises: acquiring a plurality of sentence pattern types, each sentence pattern type comprising a plurality of entity types arranged in sequence; determining the entity types to which the plurality of words arranged in sequence in the target sentence belong; determining the sentence pattern type matched with the target sentence according to the arrangement order of the entity types to which the plurality of words belong; The feature label corresponding to the determined sentence type is taken as a sentence feature of the target sentence.
11. The method of claim 1, wherein, The method further includes: The feature fusion model is invoked to fuse the phrase feature and the word feature corresponding to each word to obtain a first fusion feature corresponding to each word. The first fusion feature corresponding to each word and the sentence feature are fused to obtain a second fusion feature corresponding to the target sentence. The feature fusion model is invoked to fuse the first fusion feature corresponding to each word and the sentence feature to obtain a second fusion feature corresponding to the target sentence.
12. A feature fusion device, characterized by, The device includes: A first feature acquisition module is configured to determine a plurality of words in a target sentence and a plurality of phrases to which each word in the target sentence belongs; The first feature acquisition module is further configured to, for each word, acquire a word feature corresponding to the word, and determine a plurality of phrase features corresponding to the word according to the plurality of phrases to which the word belongs, wherein the phrase feature corresponding to the word is a feature of the word in the case where the word belongs to a phrase in the target sentence; A first feature fusion module is configured to, for each word, perform weighted fusion on a first target parameter and the word feature corresponding to the word to obtain an intermediate word feature corresponding to the word, determine a product of each phrase feature corresponding to the word and the intermediate word feature, determine a target weight of each phrase feature based on a difference between the product corresponding to each phrase feature and products corresponding to other phrase features, perform weighted processing on each phrase feature based on the target weight of each phrase feature, and determine a first fusion feature corresponding to the word based on the feature obtained through the weighted processing; A second feature acquisition module is configured to acquire a sentence feature corresponding to the target sentence; A second feature fusion module is configured to fuse the first fusion feature corresponding to each word and the sentence feature to obtain a second fusion feature corresponding to the target sentence.
13. The apparatus of claim 12, wherein, The first feature fusion module is configured to: perform weighted processing on the phrase feature based on the target weight, determine the feature obtained through the weighted processing as the first fusion feature corresponding to the word, or perform weighted processing on the phrase feature based on the target weight, determine the feature obtained through the weighted processing as an intermediate phrase feature corresponding to the word, perform weighted fusion on the intermediate phrase feature and a word vector of the word, and determine the feature obtained through the weighted fusion as the first fusion feature corresponding to the word.
14. The apparatus of claim 12, wherein, The second feature fusion module includes: A first feature enhancement unit is configured to perform feature enhancement on the first fusion feature corresponding to each word based on a first enhancement parameter corresponding to each word to obtain a first enhancement feature corresponding to each word; A second feature enhancement unit is configured to perform feature enhancement on the sentence feature based on a second enhancement parameter corresponding to the target sentence to obtain a second enhancement feature corresponding to the target sentence; and The second feature fusion unit is configured to determine the second fusion feature based on the first enhanced feature and the first enhanced parameter corresponding to each word, and the second enhanced feature and the second enhanced parameter corresponding to the target sentence.
15. The apparatus of claim 14, wherein, The apparatus further includes: The enhancement parameter determination module is configured to determine the first enhanced parameter corresponding to each word based on the second target parameter and the first fusion feature corresponding to each word respectively, the first enhanced parameter is positively correlated with the second target parameter, and the first enhanced parameter is positively correlated with the first fusion feature.
16. The apparatus of claim 15, wherein, The enhancement parameter determination module is further configured to: determine the second enhanced parameter corresponding to the target sentence based on the second target parameter and the sentence feature, the second enhanced parameter is positively correlated with the second target parameter, and the second enhanced parameter is positively correlated with the sentence feature.
17. The apparatus of claim 15, wherein, The second target parameter is different in different rounds, and the enhancement parameter determination module includes: The enhancement parameter determination unit is configured to determine the first enhanced parameter corresponding to each word in the current round based on the second target parameter in the current round and the first fusion feature corresponding to each word respectively.
18. The apparatus of claim 17, wherein, The target sentence corresponds to a plurality of sentence features belonging to different rounds, and the second feature enhancement unit is configured to: perform feature enhancement on the sentence feature in the current round based on the second enhanced parameter corresponding to the target sentence in the current round, to obtain the second enhanced feature corresponding to the target sentence in the current round; The second feature fusion unit is configured to: determine the second fusion feature in the current round based on the first enhanced feature and the first enhanced parameter corresponding to each word in the current round, and the second enhanced feature and the second enhanced parameter corresponding to the target sentence in the current round.
19. The apparatus of claim 14, wherein, The second feature fusion unit is configured to: perform summation on the first enhanced feature and the second enhanced feature corresponding to each word to obtain a merged feature; perform summation on the first enhanced parameter and the second enhanced parameter corresponding to each word to obtain a merged parameter; determine the ratio between the merged feature and the merged parameter as the second fusion feature.
20. The apparatus of claim 12, wherein, The first feature acquisition module includes at least one of: The part-of-speech feature acquisition unit is configured to determine one phrase feature corresponding to the word based on the part of speech of the word in the phrase. The syntactic component feature acquisition unit is configured to determine one phrase feature corresponding to the word based on the syntactic component of the word in the phrase. The entity type feature acquisition unit is configured to determine one phrase feature corresponding to the word based on the entity type to which the word belongs in the phrase.
21. The apparatus of claim 12, wherein, The second feature acquisition module includes: The sentence pattern type acquisition unit is configured to acquire a plurality of sentence pattern types, each sentence pattern type including a plurality of entity types arranged in sequence. The entity type determination unit is configured to determine the entity type to which the plurality of words arranged in sequence in the target sentence belongs. The sentence pattern type determination unit is configured to determine the sentence pattern type matching the target sentence according to the arrangement order of the entity types to which the plurality of words belongs. The sentence feature determination unit is configured to determine a feature label corresponding to the determined sentence type as a sentence feature of the target sentence.
22. The apparatus of claim 12, wherein, The first feature fusion module comprises: The first model calling unit is configured to call a feature fusion model to fuse the phrase feature and the word feature corresponding to each word to obtain a first fused feature corresponding to each word. The second feature fusion module comprises: The second model calling unit is configured to call the feature fusion model to fuse the first fused feature corresponding to each word and the sentence feature to obtain a second fused feature corresponding to the target sentence.
23. A computer device, comprising: The computer device comprises a processor and a memory, and the memory stores at least one computer program, which is loaded and executed by the processor to implement the operations performed in the feature fusion method according to any one of claims 1 to 11.
24. A computer-readable storage medium, characterized in that, The computer readable storage medium stores at least one computer program, which is loaded and executed by the processor to implement the operations performed in the feature fusion method according to any one of claims 1 to 11.
25. A computer program product, characterised in that, The computer program product comprises computer program code stored in a computer readable storage medium, and the processor of the computer device reads the computer program code from the computer readable storage medium, and executes the computer program code, so that the computer device implements the operations performed in the feature fusion method according to any one of claims 1 to 11.
Citation Information
Patent Citations
Intent recognition method, equipment and device, and storage medium
CN108763510A