WO2021244424A1 - 中心词提取方法、装置、设备及存储介质 - Google Patents
中心词提取方法、装置、设备及存储介质 Download PDFInfo
- Publication number
- WO2021244424A1 WO2021244424A1 PCT/CN2021/096762 CN2021096762W WO2021244424A1 WO 2021244424 A1 WO2021244424 A1 WO 2021244424A1 CN 2021096762 W CN2021096762 W CN 2021096762W WO 2021244424 A1 WO2021244424 A1 WO 2021244424A1
- Authority
- WO
- WIPO (PCT)
- Prior art keywords
- word
- target sentence
- semantic feature
- sentence
- semantic
- Prior art date
Links
- 238000000605 extraction Methods 0.000 title claims abstract description 258
- 238000000034 method Methods 0.000 claims abstract description 101
- 230000011218 segmentation Effects 0.000 claims description 30
- 230000004927 fusion Effects 0.000 claims description 27
- 230000008569 process Effects 0.000 claims description 26
- 238000012549 training Methods 0.000 claims description 20
- 238000012545 processing Methods 0.000 claims description 14
- 238000013507 mapping Methods 0.000 claims description 13
- 239000000284 extract Substances 0.000 abstract description 16
- 238000010586 diagram Methods 0.000 description 15
- 230000006870 function Effects 0.000 description 12
- 230000009194 climbing Effects 0.000 description 6
- 238000010606 normalization Methods 0.000 description 6
- 230000002093 peripheral effect Effects 0.000 description 6
- 238000005516 engineering process Methods 0.000 description 5
- 230000004913 activation Effects 0.000 description 4
- 239000013598 vector Substances 0.000 description 4
- 238000013473 artificial intelligence Methods 0.000 description 3
- 238000004590 computer program Methods 0.000 description 3
- 238000013528 artificial neural network Methods 0.000 description 2
- 238000004891 communication Methods 0.000 description 2
- 238000011161 development Methods 0.000 description 2
- 230000018109 developmental process Effects 0.000 description 2
- 238000011176 pooling Methods 0.000 description 2
- 230000009471 action Effects 0.000 description 1
- 238000004458 analytical method Methods 0.000 description 1
- 230000006835 compression Effects 0.000 description 1
- 238000007906 compression Methods 0.000 description 1
- 238000013527 convolutional neural network Methods 0.000 description 1
- 238000007418 data mining Methods 0.000 description 1
- 230000006872 improvement Effects 0.000 description 1
- 238000010801 machine learning Methods 0.000 description 1
- 230000005055 memory storage Effects 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 238000003058 natural language processing Methods 0.000 description 1
- 230000003287 optical effect Effects 0.000 description 1
- 238000005457 optimization Methods 0.000 description 1
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F40/00—Handling natural language data
- G06F40/20—Natural language analysis
- G06F40/279—Recognition of textual entities
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F40/00—Handling natural language data
- G06F40/20—Natural language analysis
- G06F40/205—Parsing
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F40/00—Handling natural language data
- G06F40/20—Natural language analysis
- G06F40/205—Parsing
- G06F40/216—Parsing using statistical methods
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F40/00—Handling natural language data
- G06F40/20—Natural language analysis
- G06F40/279—Recognition of textual entities
- G06F40/284—Lexical analysis, e.g. tokenisation or collocates
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F40/00—Handling natural language data
- G06F40/20—Natural language analysis
- G06F40/279—Recognition of textual entities
- G06F40/289—Phrasal analysis, e.g. finite state techniques or chunking
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F40/00—Handling natural language data
- G06F40/30—Semantic analysis
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06N—COMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
- G06N3/00—Computing arrangements based on biological models
- G06N3/02—Neural networks
- G06N3/04—Architecture, e.g. interconnection topology
- G06N3/045—Combinations of networks
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06N—COMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
- G06N3/00—Computing arrangements based on biological models
- G06N3/02—Neural networks
- G06N3/04—Architecture, e.g. interconnection topology
- G06N3/0464—Convolutional networks [CNN, ConvNet]
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06N—COMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
- G06N3/00—Computing arrangements based on biological models
- G06N3/02—Neural networks
- G06N3/04—Architecture, e.g. interconnection topology
- G06N3/047—Probabilistic or stochastic networks
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06N—COMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
- G06N3/00—Computing arrangements based on biological models
- G06N3/02—Neural networks
- G06N3/08—Learning methods
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06N—COMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
- G06N3/00—Computing arrangements based on biological models
- G06N3/02—Neural networks
- G06N3/08—Learning methods
- G06N3/09—Supervised learning
-
- Y—GENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
- Y02—TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
- Y02D—CLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
- Y02D10/00—Energy efficient computing, e.g. low power processors, power management or thermal management
Definitions
- the embodiments of this application relate to the field of computer technology, and in particular to a method, device, equipment, and storage medium for extracting a central word.
- the central word that can accurately express the semantics of the sentence is extracted from the sentence, and the search is carried out according to the central word, so as to avoid the problem of fewer search results caused by searching according to the sentence.
- the embodiment of the application provides a method for extracting a central word, the method is executed by a computer device, and the method includes:
- the corresponding word with the greatest matching degree is determined as the central word of the target sentence.
- a central word extraction device is provided, the device is used in computer equipment, and the device includes:
- the feature extraction model is used to obtain the sentence features of the target sentence and the word features of each word in the target sentence;
- the semantic feature extraction module is used to perform semantic extraction on the sentence feature of the target sentence to obtain the semantic feature of the target sentence, and to separately perform semantic extraction on the word feature of each word to obtain the semantic feature of each word Semantic features, the semantic features of the target sentence are used to characterize the global semantics of the target sentence, and the semantic features of the words are used to characterize the local semantics of the words;
- the matching degree obtaining module is used to obtain the matching degree between the semantic feature of each word and the semantic feature of the target sentence respectively;
- the central word extraction module is used to determine the word with the greatest matching degree among the multiple words as the central word of the target sentence.
- a computer device in another aspect, includes a processor and a memory, and at least one instruction is stored in the memory, and the at least one instruction is loaded and executed by the processor, so as to realize the center The operation performed in the word extraction method.
- a computer-readable storage medium is provided, and at least one instruction is stored in the computer-readable storage medium, and the at least one instruction is loaded and executed by a processor to implement the method described in the above-mentioned central word extraction method. Action performed.
- a computer program is provided, and at least one instruction is stored in the computer program, and the at least one instruction is loaded and executed by a processor, so as to implement the operations performed in the above-mentioned central word extraction method.
- Fig. 1 is a flowchart of a method for extracting a central word provided by an embodiment of the present application
- FIG. 2 is a flowchart of another method for extracting central words according to an embodiment of the present application.
- FIG. 3 is a schematic diagram of a semantic feature extraction layer and a semantic feature matching layer provided by an embodiment of the present application;
- Fig. 4 is a schematic diagram of a central word extraction model provided by an embodiment of the present application.
- FIG. 5 is a schematic diagram of a central word extraction model provided by an embodiment of the present application.
- Fig. 6 is a flowchart of a model training method provided by an embodiment of the present application.
- FIG. 7 is a schematic diagram of a core word extraction model training and application framework provided by an embodiment of the present application.
- FIG. 8 is a flowchart of a method for extracting a central word provided by an embodiment of the present application.
- FIG. 9 is a schematic structural diagram of a central word extraction device provided by an embodiment of the present application.
- Figure 10 is a schematic structural diagram of another central word extraction device provided by an embodiment of the present application.
- FIG. 11 is a schematic structural diagram of a terminal provided by an embodiment of the present application.
- FIG. 12 is a schematic structural diagram of a server provided by an embodiment of the present application.
- each refers to each word in the 10 words
- any word refers to any word in the 10 words.
- Central word extraction Identify and extract the central word of the sentence based on multiple words in the sentence.
- a sentence contains one or more central words.
- the central word is the word in the sentence that accurately expresses the semantics of the sentence, for example, the central word It is the word with the greatest degree of relevance to the sentence, or the head word is the word whose relevance to the sentence is greater than a certain relevance threshold; for another example, the head word refers to the word that determines the grammatical category of the sentence and is the central part of the sentence.
- TF-IDF (Term Frequency-Inverse Document Frequency, term frequency-inverse document frequency algorithm): TF-IDF is a commonly used weighting technique for information retrieval and data mining. TF (Term Frequency, term frequency) means that a certain term The frequency of occurrence of a text, IDF (Inverse Document Frequency, inverse document frequency) represents the frequency of a word in multiple texts.
- IDF Inverse Document Frequency, inverse document frequency
- NER Named Entity Recognition, Named Entity Recognition: NER refers to identifying entities with specific meanings in the text, such as the names of people, places, organizations, and proper nouns in the text.
- the central word extraction method provided in the embodiments of this application involves artificial intelligence technology, natural language processing and other technologies of artificial intelligence. This application uses the following embodiments to illustrate the central word extraction method.
- the embodiment of the present application provides a method for extracting a central word
- the execution subject is a computer device.
- the computer device calls the central word extraction model to obtain the sentence characteristics of the target sentence and the word characteristics of multiple words in the target sentence, and respectively perform semantic extraction on the sentence characteristics of the target sentence and the word characteristics of each word to obtain the overall situation of the target sentence Semantic features and local semantic features of each word, respectively, match the local semantic features of each word with the global semantic features of the target sentence, and obtain the difference features between the local semantic features of each word and the global semantic features.
- the difference feature between the local semantic feature and the global semantic feature of a word, the score of each word is obtained, and the word corresponding to the largest score among multiple scores is extracted as the central word of the target sentence.
- the computer device obtains the sentence characteristics of the target sentence and the word characteristics of multiple words in the target sentence, performs semantic extraction on the sentence characteristics of the target sentence to obtain the semantic characteristics of the target sentence, and separately Semantic extraction is performed on the word features of words to obtain the semantic features of each word, and the matching degree between the semantic feature of each word and the semantic feature of the target sentence is obtained respectively, and the corresponding word with the highest matching degree among multiple words is determined Is the central word of the target sentence.
- the semantic features of the target sentence are used to represent the global semantics of the target sentence, and the semantic features of the target sentence are the global semantic features; the semantic features of the words are used to represent the local semantics of the words in the target sentence, and the semantic features of the words are the local Semantic features; the matching degree corresponding to the word is used to characterize the matching degree between the word and the target sentence, and the matching degree is the score.
- the computer device is a terminal
- the terminal can be a portable, pocket-sized, handheld, and other types of terminals, such as smart phones, tablet computers, notebook computers, desktop computers, smart speakers, smart watches, etc. .
- the computer device is a server.
- the server can be an independent physical server, a server cluster or a distributed system composed of multiple physical servers, or it can provide cloud services, cloud databases, and cloud services.
- Cloud servers for basic cloud computing services such as computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, CDN (Content Delivery Network), and big data and artificial intelligence platforms .
- terminal and the server can be directly or indirectly connected through wired or wireless communication, which is not limited in this application.
- the method for extracting the central word provided in the embodiments of the present application can be applied in a variety of scenarios.
- the method provided in the embodiment of the present application can be applied to any scenario where the central word needs to be extracted from a sentence.
- the computer device obtains the sentence input by the user, uses the central word extraction method provided in the embodiment of the present application, extracts the central word of the sentence, searches based on the central word, and avoids searching based on the sentence and resulting in fewer search results problem.
- the search scene can be a variety of search scenes such as an article search scene or a news search scene.
- the computer device obtains the historical items in the user's historical purchase records, and uses the central word extraction method provided in the embodiment of this application to extract the central word of the item title corresponding to the historical item.
- the query includes The item corresponding to the item title of the central word is recommended to the user.
- the computer equipment scans and recognizes the target item, finds the corresponding item image according to the scanned image obtained by scanning, determines the corresponding item title according to the found item image, and uses the central word extraction provided by the embodiment of this application Method, extract the central word of the item title, thereby determine the target item according to the central word, and obtain the item name of the target item.
- Fig. 1 is a flowchart of a method for extracting a central word provided by an embodiment of the present application.
- the execution subject of the embodiment of the present application is a computer device. Referring to FIG. 1, the method includes:
- the computer device calls the feature acquisition layer of the central word extraction model to acquire the sentence characteristics of the target sentence and the word characteristics of multiple words in the target sentence.
- the computer device obtains the target sentence for which the central word needs to be extracted, calls the central word extraction model, and obtains the score of each word in the target sentence, thereby extracting the central word of the target sentence according to the score of each word. That is, the computer device obtains the matching degree corresponding to each word in the target sentence, so as to extract the central word of the target sentence according to the matching degree corresponding to each word.
- the embodiment of the present application only takes the target sentence as an example for description, and the method of extracting the central word of other sentences is similar to that of the target sentence, which will not be repeated in the embodiment of the present application.
- the target sentence is any sentence.
- the target sentence in a search scenario, is a search sentence entered by the user; in an item recognition scenario or an item recommendation scenario, the target sentence is an item title; in other scenarios, the target sentence is a sentence in an article or other sentences.
- the computer device uses any word segmentation method to segment the target sentence to obtain multiple words in the target sentence, for example, segmentation according to part of speech, word segmentation according to known words, or word segmentation according to other methods. This embodiment of the application does not limit this .
- the computer device in order to facilitate subsequent processing of the target sentence and multiple words in the target sentence, the computer device converts the target sentence and multiple words of the target sentence into an expression form that can be recognized by the computer device, and the computer device calls the feature extraction Layer, get the sentence characteristics of the target sentence and the word characteristics of each word in the target sentence.
- the form of sentence features and the form of word features can be feature sequences, feature vectors or other forms.
- the computer device calls the semantic feature extraction layer of the central word extraction model to separately perform semantic extraction on the sentence features of the target sentence and the word features of each word to obtain the global semantic features of the target sentence and the local semantic features of each word.
- the computer device obtains the sentence features of the target sentence and the word characteristics of multiple words in the target sentence; performs semantic extraction on the sentence characteristics of the target sentence to obtain the semantic characteristics of the target sentence, and separately analyzes each word The semantic feature of each word is extracted to obtain the semantic feature of each word.
- the step of extracting the semantic feature of the target sentence and the step of extracting the semantic feature of the word by the computer device are executed sequentially or in parallel.
- the semantic feature extraction layer is used to obtain the semantic feature of the target sentence according to the sentence feature of the target sentence, and obtain the semantic feature of the word according to the word feature of the word, so as to extract the feature that can express the semantics of the sentence or the word semantics.
- the semantic feature of the target sentence is used to represent the semantics of the target sentence
- the semantic feature of each word is used to represent the semantics of the word
- the semantic feature of the word of the center word is the semantic feature closest to the semantic feature of the target sentence. That is, the matching degree between the semantic feature of the head word and the semantic feature of the target sentence is the largest.
- the computer device uses the same semantic extraction method to extract the semantic features of the target sentence and the semantic features of each word.
- the computer device adopts different semantic extraction methods to extract the semantic feature of the target sentence and the semantic feature of each word.
- the semantic extraction method used by the computer device to extract the semantic features of the target sentence may be different from the semantic extraction method used to extract the semantic features of each word.
- the expression form of the semantic feature of the target sentence is consistent with the expression form of the semantic feature of the word.
- the semantic feature of the target sentence is a feature sequence
- the semantic feature of the word is also a feature sequence
- the semantic feature of the target sentence is a feature vector
- the semantic features of words are also feature vectors.
- the computer device obtains the semantic feature of the target sentence and the semantic feature of each word, and can accurately understand the semantics of each word. For example, if a word has different semantics in different sentences, if the semantics of the word in the target sentence cannot be determined only based on the word characteristics of the word, then it cannot be determined whether the word is the central word of the target sentence, and the semantics of the word can be obtained.
- the semantics of the word in the target sentence can be determined according to the semantic characteristics of the word, so as to determine whether the word is the central word of the target sentence.
- the computer equipment calls the semantic feature matching layer of the central word extraction model to match the local semantic feature of each word with the global semantic feature of the target sentence, and obtain the difference between the local semantic feature and the global semantic feature of each word feature.
- matching the semantic feature of each word with the semantic feature of the target sentence refers to matching the semantic feature of each word with the semantic feature of the target sentence.
- the target sentence contains 3 words, namely word 1, word 2, and word 3.
- the computer device matches the semantic characteristics of word 1 with the semantic characteristics of the target sentence to obtain the semantic characteristics of word 1 and the semantic characteristics of the target sentence Similarly, the computer device obtains the difference feature 2 between the semantic feature of the word 2 and the semantic feature of the target sentence, and the difference feature 3 between the semantic feature of the word 3 and the semantic feature of the target sentence.
- the difference feature matching layer is used to obtain the difference feature between the semantic feature of the word and the semantic feature of the target sentence.
- the difference feature is used to characterize the degree of matching between the target sentence and the word. The greater the difference, the smaller the matching degree between the target sentence and the word, and the smaller the difference represented by the difference feature, the greater the matching degree between the target sentence and the word.
- the manifestation of the difference feature is consistent with the semantic feature of the target sentence or the semantic feature of the word.
- the computer device calls the output layer of the central word extraction model, and obtains the score of each word according to the difference between the local semantic feature and the global semantic feature of each word.
- the output layer is used to obtain the score of each word, that is, the computer device obtains the degree of matching between the semantic feature of each word and the semantic feature of the target sentence.
- the score has a negative correlation with the difference feature, that is, the greater the difference between the semantic feature of the word and the semantic feature of the target sentence, the smaller the score, the less likely the semantics of the word can reflect the semantics of the target sentence ;
- the computer device calls the semantic feature matching layer and the output layer to obtain the degree of matching between the semantic feature of each word in the input sentence and the semantic feature of the input sentence.
- the input sentence is the target sentence in this application.
- the computer device extracts the word corresponding to the largest score among the multiple scores as the central word of the target sentence.
- the computer device extracts the word corresponding to the largest score among the multiple scores as the central word of the target sentence according to the multiple scores obtained. That is, the computer device determines the corresponding word with the greatest matching degree among the multiple words as the central word of the target sentence.
- the item title of an item is composed of multiple words, and the item title includes synonyms, such as running shoes, sports Shoes, board shoes, etc.; also include ambiguous words, such as brackets, elevated racks, frames, etc.; also include brand words.
- the method when the TF-IDF method is used to extract the head word from the article title, the method only counts the words and determines whether it is the head word according to the frequency of the word occurrence. If a word appears frequently, but the word The semantics in the target sentence are different from those in other sentences. At this time, it is inaccurate if the word is used as the central word of the target sentence. Moreover, for synonyms, ambiguous words, and brand words, the TF-IDF method cannot distinguish the semantics of each word, so that the head word cannot be accurately extracted.
- the central word extraction model used by this method can only extract the central word of the sentence from multiple preset words. If the central word of the sentence is not a preset word, However, the NER method can only be used to extract the central word from the preset multiple words bluntly, resulting in insufficient accuracy of the extracted central word.
- the method provided by the embodiment of this application calls the feature acquisition layer of the central word extraction model to acquire the sentence characteristics of the target sentence and the word characteristics of multiple words in the target sentence, and call the semantic feature extraction layer to perform the analysis on the sentence characteristics and the word characteristics. Further extraction, the semantic features reflecting the semantics of the target sentence and the semantic features reflecting the semantics of the words are extracted, the semantic feature matching layer is called, and the semantics of the target sentence and the words in the target sentence are fully understood on the basis of each The semantic feature of each word is matched with the semantic feature of the target sentence, and the difference feature corresponding to each word is obtained.
- the difference feature can reflect the matching degree between the semantic feature of each word and the semantic feature of the target sentence.
- the output layer is called, According to the difference characteristics of each word, the score of each word is obtained, and the word with the highest score is selected from the target sentence according to the score as the central word, and the extraction method in this application is not limited to The central word of the sentence is extracted from the known multiple words, so it has higher scalability, and thus the accuracy of extracting the central word is improved.
- the method provided in the embodiments of the present application can accurately recognize words such as synonyms, ambiguous words, and brand words in a sentence, accurately understand the semantics of the sentence and multiple words of the sentence, and improve the accuracy of the central word extraction.
- Fig. 2 is a flowchart of another method for extracting a central word provided by an embodiment of the present application.
- the execution subject of the embodiment of the present application is a computer device. Referring to FIG. 2, the method includes:
- the computer device calls the word segmentation layer of the central word extraction model to perform word segmentation processing on the target sentence to obtain multiple words included in the target sentence.
- the computer device obtains the target sentence of the central word to be extracted, inputs the target sentence to the central word extraction model, and calls the word segmentation layer of the central word extraction model to perform word segmentation processing on the target sentence to obtain multiple words included in the target sentence . That is, the computer device performs word segmentation processing on the target sentence to obtain multiple words included in the target sentence.
- the word segmentation layer includes a plurality of known words
- the computer device performs word segmentation on the target sentence according to the plurality of known words.
- the computer device can modify the plurality of known words at any time, add new words in the word segmentation layer, or delete one or more words in the plurality of known words.
- the word segmentation layer is a word segmenter based on a probability dictionary, that is, a word segmenter based on Jieba.
- the tokenizer includes precise mode, full mode and search engine mode. Among them, the precise mode splits the target sentence into multiple words according to multiple known words, and the full mode splits all the words that can be formed in the target sentence according to multiple known words to form multiple words, the search engine The model further splits longer words on the basis of the precise model.
- the embodiment of the application adopts any mode to perform word segmentation processing on the target sentence, which is not limited by the embodiment of the application.
- the embodiment of the present application only takes the word segmentation layer as a word segmenter based on a probability dictionary as an example for description.
- the word segmentation layer can also be other types of word segmentation; for example, the word segmentation layer is based on Statistical tokenizers (such as tokenizers based on language models or tokenizers based on statistical machine learning), or tokenizers based on neural networks, etc.
- the computer device determines the word identifier of each word, and the word identifier is used to indicate the position of the corresponding word in the target sentence.
- the computer device calls the feature acquisition layer of the central word extraction model to acquire the sentence characteristics of the target sentence and the word characteristics of multiple words in the target sentence.
- the computer device calls the feature extraction layer of the central word extraction model, and queries the word characteristics corresponding to each word in the target sentence according to the mapping relationship.
- the mapping relationship includes words and corresponding word features.
- the word characteristics of the multiple words are combined according to the sequence of the multiple words in the target sentence to obtain the sentence characteristics of the target sentence. That is, the computer device combines the acquired multiple word features according to the sequence of multiple words in the target sentence to obtain the sentence feature.
- the target sentence includes three words.
- the order of the three words is word 1, word 2, and word 3.
- the feature acquisition layer is an embedded encoder
- the embedded encoder respectively maps each input word to a corresponding word feature, and combines the multiple words in the target sentence in the order of arrangement to obtain The sentence characteristics of the target sentence.
- the embedded encoder can use the Word2Vector algorithm or other algorithms. For example, if the word feature of each word is a 200-dimensional feature sequence, and the target sentence includes n words, the sentence feature of the target sentence is an n*200-dimensional feature sequence.
- the above word feature can also be implemented as a 200-dimensional feature vector.
- the embodiment of the present application only takes the feature acquisition layer as an embedded encoder as an example for description.
- the feature acquisition layer can also use other methods to acquire the sentence features of the target sentence and the information of each word. Word characteristics.
- the computer device deletes words and corresponding word features from the mapping relationship at any time, or adds words and corresponding word features to the mapping relationship at any time.
- step 202 In addition, for other descriptions of this step 202, refer to the above step 101, which will not be repeated here.
- the computer device calls the semantic feature extraction layer of the central word extraction model to separately perform semantic extraction on the sentence features of the target sentence and the word features of each word to obtain the global semantic features of the target sentence and the local semantic features of each word.
- the semantic feature extraction layer includes a word semantic extraction unit and a sentence semantic extraction unit.
- the computer device calls the word semantic extraction unit of the semantic feature extraction layer to process the word characteristics of each word separately to obtain each Semantic characteristics of words.
- the computer device calls the sentence semantic extraction unit of the semantic feature extraction layer to process the sentence features of the target sentence to obtain the semantic features of the target sentence.
- the word semantic extraction unit is used to extract the word features of the word
- the sentence semantic extraction unit is used to extract the sentence feature of the sentence.
- the computer device obtains the word feature of each word in the target sentence, inputs multiple word features to the word semantic extraction unit in turn, and obtains the semantic feature of each word in turn; or simultaneously inputs multiple word features to the word semantic extraction unit, Get the semantic characteristics of each word.
- the semantic feature of the word is obtained by the word semantic extraction unit, and the semantic feature of the target sentence is extracted by the sentence semantic extraction unit.
- the extracted semantic features are more accurate. That is to say, in the embodiment of the present application, the computer device performs semantic feature extraction on the words and sentences through different semantic extraction units according to the different characteristics of the words and sentences, thereby improving the accuracy of semantic feature extraction.
- the network structure is a network structure obtained by improving the residual convolutional neural network, the network structure includes a semantic feature extraction layer, and the network structure includes Trunk path and residual path.
- the trunk path is the word semantic extraction unit, which is used to extract the semantic feature of each word to obtain the semantic feature of each word, that is, the trunk path is used for extraction The semantic feature of each word in the target sentence;
- the residual path is the sentence semantic extraction unit, which is used to extract the semantic feature of the target sentence to obtain the semantic feature of the target sentence, that is, the residual path is used to extract the semantic feature of the target sentence .
- the backbone path includes two 1*1 convolutional layers; or, the backbone path includes a k*k deep convolution layer 301 and a 1*1 convolution layer 302.
- k is a positive integer
- each convolutional layer is followed by a corresponding Batch Normalization (BN) layer
- BN Batch Normalization
- the residual path includes a global average pooling layer 303 and a 1*1 convolutional layer 304.
- the global tie pooling layer can effectively extract the semantic features of the target sentence.
- step 203 refers to the foregoing step 102 for details, and will not be repeated here.
- the computer equipment calls the semantic feature matching layer of the central word extraction model to match the local semantic features of each word with the global semantic features of the target sentence, and obtain the difference between the local semantic feature and the global semantic feature of each word feature.
- the computer device respectively matches the semantic feature of each word with the semantic feature of the target sentence to obtain the difference semantic feature corresponding to each word, and the difference semantic feature is the difference feature.
- the difference feature between the semantic feature of each word and the semantic feature of the target sentence is the difference semantic feature corresponding to the word.
- the computer device calls the semantic feature matching layer of the central word extraction model to add the semantic feature of each word and the semantic feature of the target sentence to obtain the semantic feature of each word and the target sentence.
- the difference between the semantic features of the semantic features; or, the computer equipment calls the semantic feature matching layer of the central word extraction model to subtract the semantic features of each word from the semantic feature of the target sentence to obtain the semantic feature of each word
- the difference feature with the semantic feature of the target sentence is to match the semantic feature of the word with the semantic feature of the target sentence, so as to obtain the difference feature between the semantic feature of the word and the semantic feature of the target sentence.
- the computer device subtracts the semantic feature of each word from the semantic feature of the target sentence to obtain the difference semantic feature corresponding to each word; or the computer device separately compares the semantic feature of each word with the semantic feature of the target sentence.
- the semantic features are added together to obtain the fusion semantic feature corresponding to each word.
- the fusion semantic feature is the difference feature, and the fusion semantic feature is further split and processed to obtain the semantic feature of the word and the semantics of the target sentence The difference between features.
- the fused semantic feature also contains the semantic feature of the word And the semantic features of the target sentence, it can indirectly indicate the difference between the semantic feature of the word and the semantic feature of the target sentence, that is, indirectly reflect the degree of matching between the semantic feature of the word and the semantic feature of the target sentence; the follow-up central word
- the output layer of the extraction model can use the difference indirectly indicated by the fusion semantic feature to obtain the matching degree corresponding to each word, that is, the output layer is called to process the fusion semantic feature, and the fusion semantic feature is split first to obtain the fusion semantic feature.
- the semantic feature of the word and the semantic feature of the target sentence are then determined, and then the difference between the semantic feature of the word and the semantic feature of the target sentence is determined, and the degree of matching is determined according to the determined difference.
- the difference semantic feature can directly indicate the semantics of the word
- the difference between the feature and the semantic feature of the target sentence directly reflects the matching degree between the semantic feature of the word and the semantic feature of the target sentence; the output layer of the subsequent central word extraction model directly indicates the difference through the semantic feature of the difference, Obtain the matching degree corresponding to each word, that is, call the output layer to process the difference semantic features, and directly obtain the matching degree.
- the network structure further includes a semantic feature matching layer 305.
- an activation function 306 is also included, and the semantic feature matching layer is obtained Through the activation function, each difference feature of, get the final output difference feature.
- the activation function is ReLU (Rectified Linear Unit), Swish, GELU (Gaussian Error Linear Units, Gaussian Error Linear Unit) or other activation functions.
- step 204 refers to the above step 103 for details, and will not be repeated here.
- the computer equipment calls each feature extraction network of the central word extraction model to adjust the difference features obtained in the upper layer to obtain the adjusted difference features.
- the computer device adjusts the difference semantic feature corresponding to each word to obtain the adjusted difference semantic feature, and then, according to the adjusted difference semantic feature corresponding to each word, obtains the difference semantic feature corresponding to each word Matching degree; or computer equipment adjusts the fusion semantic feature corresponding to each word to obtain the adjusted fusion semantic feature, and then obtains the matching degree corresponding to each word according to the adjusted fusion semantic feature corresponding to each word .
- the central word extraction model further includes at least one feature extraction network, and the feature extraction network is used to adjust the acquired differential semantic features to obtain more accurate differential semantic features.
- the structure of the feature extraction network is similar to the network structure shown in FIG. 3. That is, the network structure of the feature extraction network is the same as the network structure shown in FIG. 3 (the network parameters may be different), or the network structure of the feature extraction network is different from the network structure shown in FIG. 3.
- each network layer in the central word extraction model has a connection relationship.
- the output of the former network layer is the input of the latter network layer.
- the upper layer is the semantic feature matching layer; for feature extraction networks other than the first feature extraction network among multiple feature extraction networks, its The upper layer is the network layer in the previous feature extraction network that has a connection relationship with it.
- the feature extraction network includes a semantic feature extraction layer and a semantic feature matching layer.
- the computer device calls the semantic feature extraction layer of the feature extraction network to match the upper layer respectively.
- the semantic feature of the difference between the semantic feature of each word and the semantic feature of the target sentence obtained in the first layer is semantically extracted, and the semantic feature of the adjusted target sentence and the semantic feature of each word after adjustment are obtained; the feature extraction network is called The semantic feature matching layer respectively matches the adjusted semantic feature of each word with the adjusted semantic feature of the target sentence to obtain the adjusted difference feature.
- the computer device when it adjusts the semantic feature of the difference obtained in the previous layer, it calls the semantic feature extraction layer of the feature extraction network to separately compare the semantic feature of each word obtained in the previous layer and the semantic feature of the target sentence. Semantic extraction of the different semantic features of the adjusted target sentence and the semantic features of each word after adjustment are obtained; the semantic feature matching layer of the feature extraction network is called to separately compare the semantic features of each word after adjustment with The adjusted semantic features of the target sentence are matched, and the adjusted difference semantic features are obtained.
- the computer device when it calls the semantic feature extraction layer of the feature extraction network to separately fusion between the semantic features of each word obtained in the upper layer and the semantic features of the target sentence Semantic feature extraction is performed to obtain the adjusted semantic feature of the target sentence and the semantic feature of each word after adjustment; call the semantic feature matching layer of the feature extraction network to separately adjust the semantic feature of each word after adjustment and the adjusted semantic feature The semantic features of the target sentence are matched to obtain the adjusted fused semantic features.
- the difference feature is a difference semantic feature
- the semantic feature of each word can be extracted from the different semantic features corresponding to the multiple words, and the semantic feature of each word can be further extracted through the semantic feature extraction layer, so that the adjusted value of each word can be obtained.
- Semantic features For the target sentence, the different semantic features corresponding to multiple words are fused to obtain the semantic features of the target sentence, and the semantic features of the target sentence are further extracted through the semantic feature extraction layer, so that the adjusted target sentence can be obtained Semantic features.
- the structure of the semantic feature extraction layer of the feature extraction network is similar to the structure of the semantic feature extraction layer of the central word extraction model in step 203, and the implementation of semantic feature extraction is similar to the implementation in step 203; the semantics of the feature extraction network
- the structure of the feature matching layer is similar to the structure of the semantic feature matching layer of the central word extraction model in step 204, and the implementation of matching semantic features is similar to the implementation in step 204, and will not be repeated here.
- the difference feature is a fusion semantic feature
- the central word extraction model includes multiple feature extraction networks. Any one of the feature extraction networks obtains the fusion semantic feature obtained in the previous layer, and compares the fusion semantic feature obtained in the previous layer. Make further adjustments.
- the computer device extracts the semantic feature of each word from the fusion semantic feature corresponding to the word, and fuses the semantic feature of each extracted word to obtain the adjusted semantic feature of the target sentence.
- For the fusion semantic feature corresponding to each word first go through the feature extraction network for further semantic feature extraction, and then adopt a similar method to the semantic feature matching layer to correspond to the adjusted semantic feature of the target sentence and each word after semantic extraction
- the fusion semantic features of, and the matching process is performed to obtain the adjusted fusion semantic features.
- the central word extraction model includes a word segmentation layer 401, a feature acquisition layer 402, a semantic feature extraction layer 403, a semantic feature matching layer 404, and two Feature extraction network 405 and output layer 406.
- multiple feature extraction networks are provided, and the multiple feature extraction networks perform further semantic extraction of different features, thereby realizing multi-level extraction of semantic features and improving acquisition
- the accuracy of semantic features improves the accuracy of different features and further improves the accuracy of extracting the central word.
- the semantic feature extraction layer 403 of the central word extraction model in FIG. 4 when the structure of the semantic feature extraction layer 403 of the central word extraction model in FIG. 4 is similar to the structure of the semantic feature extraction layer in the feature extraction network 405, and the structure of the semantic feature matching layer 404 is similar to that of the feature extraction network 405 When the structure of the feature matching layer is similar, the semantic feature extraction layer 403 and the semantic feature matching layer 404 may constitute a basic structural unit similar to the feature extraction network 405.
- the central word extraction model includes a word segmentation layer 501, a feature acquisition layer 502, three basic structural units 503, and an output layer 504. Among them, the network structure of the three basic structural units 503 is similar to the network structure shown in FIG. 3.
- the embodiment of the present application only takes as an example that the network structure of the feature extraction network is similar to the network structure of the semantic feature extraction layer and the semantic feature matching layer of the central word extraction model.
- the feature The network structure of the extraction network may be in other forms, and the embodiment of the present application does not limit the network structure of the feature extraction network.
- the computer device calls the output layer of the central word extraction model, and obtains the score of each word according to the difference feature obtained by the last feature extraction network.
- the last feature extraction network mentioned above is the last called feature extraction network among multiple feature extraction networks.
- the two feature extraction networks have a connection relationship.
- the last feature extraction network mentioned above refers to the latter feature of the two feature extraction networks that have a connection relationship. Extract the network.
- the computer device calls the output layer, and the output layer obtains the score of each word according to the difference feature obtained by the last feature extraction layer, and the score is used to reflect the matching degree between the word and the target sentence.
- the output layer includes a 1*1 convolutional layer. That is, the computer device obtains the matching degree corresponding to each word according to the adjusted difference characteristics.
- the computer device normalizes the scores corresponding to multiple words to obtain the probability corresponding to each score.
- the computer device extracts the word corresponding to the highest probability among the multiple probabilities as the central word of the target sentence.
- the computer device after obtaining the matching degree corresponding to each word, performs normalization processing on the matching degree corresponding to the multiple words to obtain the probability corresponding to each matching degree.
- the probability is used to express the probability that the corresponding word is the central word of the target sentence, and the word with the highest probability is extracted as the central word of the target sentence. The greater the probability, the greater the probability that the word is the central word, and the smaller the probability of the word, the less likely the word is the central word.
- the computer device uses a softmax function to perform normalization operations; or, the computer device uses a weighted average or weighted sum method to normalize scores corresponding to multiple words.
- the target sentence is "I went hiking with my friends today" and the target sentence includes words: "I”, “Today”, “He”, “Friends”, “Go together”, “Climbing” and "Lai "The focus of this sentence is "climbing a mountain.”
- the target sentence is extracted using the above-mentioned implementation method, and the matching degrees corresponding to "I”, “today”, “he”, “friends”, “to go together”, “climbing” and “le” are obtained respectively.
- the order is "20, 10, 5, 20, 3, 80, 1", among which "climbing” corresponds to the greatest matching degree, then "climbing" is extracted from the target sentence, and "climbing" is taken as the target sentence "I am today and The central word of "My friends went hiking together”.
- the method provided by the embodiment of this application calls the semantic feature extraction layer to further extract the acquired sentence features and word features, extract the semantic features reflecting the semantics of the target sentence, and the semantic features reflecting the semantics of the words, and call the semantic feature matching Layer, on the basis of fully understanding the semantics of the target sentence and the words in the target sentence, the semantic characteristics of each word and the semantic characteristics of the target sentence are matched respectively to obtain the difference characteristics corresponding to each word.
- the difference characteristics can be Reflect the matching degree between the semantic feature of each word and the semantic feature of the target sentence, call the output layer, obtain the score of each word according to the difference feature corresponding to each word, and extract the score from the target sentence according to the score.
- the corresponding word with the highest score is selected as the central word, and the extraction method in this application is not limited to extracting the central word of the sentence from a plurality of known words, so it has a higher scalability, thereby improving the extraction of the central word The accuracy rate.
- the central word extraction model can accurately obtain the information of any word Word features, so that the central word extraction model can accurately extract the central word in the target sentence, which improves the scalability of central word extraction.
- multiple feature extraction networks are provided, and the multiple feature extraction networks perform further semantic extraction of the difference features, thereby realizing the multi-level extraction of semantic features.
- the accuracy rate of the acquired semantic features is improved, thereby the accuracy rate of the difference feature is improved, and the accuracy rate of the extraction of the central word is further improved.
- the improved residual neural network can quickly process word features or sentence features, and improve the efficiency of central word extraction. For example, comparing an article title composed of multiple words, it takes no more than 1ms to extract the central word in the article title.
- the central word extraction model Before calling the central word extraction model, the central word extraction model needs to be trained.
- the training process is detailed in the following embodiments.
- Fig. 6 is a flowchart of a model training method provided by an embodiment of the present application.
- the execution subject of the embodiment of the present application is a computer device. Referring to FIG. 6, the method includes:
- the computer device obtains a sample sentence and sample probabilities corresponding to multiple sample words in the sample sentence.
- the sample sentence is any sentence, and the sample probability corresponding to the sample word is used to indicate the probability that the corresponding sample word is the central word of the sample sentence.
- Obtaining the sample probabilities corresponding to multiple sample words means to obtain the corresponding sample words separately. Sample probability. For example, the sample probability of the head word of the sample sentence is 1, and the sample probability of words other than the head word is 0.
- the sample sentences are segmented to obtain multiple sample words in the sample sentence, so as to avoid the set multiple sample words and the multiple words obtained by calling the central word extraction model.
- the sample words are inconsistent.
- the computer device first uses the word segmentation layer in the above-mentioned central word extraction model to segment the sample sentences and output the word segmentation results.
- the word segmentation results contain the above-mentioned multiple sample words, and then set the above-mentioned multiple words according to the central word marked by the developer. The sample probability corresponding to each sample word.
- the computer device calls the central word extraction model to process the sample sentences to obtain the predicted probability corresponding to each sample word.
- the computer device calls the central word extraction model to process the sample sentences to obtain the predicted score corresponding to each sample word; normalize the predicted scores corresponding to multiple sample words to obtain The predicted probability corresponding to each sample word, so that the sum of the predicted probabilities corresponding to multiple sample words is 1. That is, the computer device calls the central word extraction model to process the sample sentences to obtain the predicted matching degree corresponding to each word, and normalize the predicted matching degree corresponding to multiple sample words to obtain the corresponding word of each sample. The predicted probability of, so that the sum of the predicted probabilities corresponding to multiple sample words is 1.
- x refers to the prediction score output by the central word extraction model
- p refers to the predicted probability after normalization
- i indicates the order of the sample words in the sample sentence
- j indicates that the sample sentence includes a total of j sample words, i, j is a positive integer, and i is not greater than j
- x i refers to the prediction score of the i-th sample word in the sample sentence
- p i refers to the predicted probability of the i-th sample word in the sample sentence.
- a corresponding sample word identifier is set for each sample word in the sample sentence to indicate the position of the sample word in the sample sentence.
- the computer device calls the central word extraction model to process the sample sentences to obtain the predicted probability corresponding to each sample word, which is the same as the process of obtaining multiple words in the target sentence in the embodiment shown in FIG. 2
- the process of the corresponding probability is similar (corresponding to the above steps 201 to 207), and will not be repeated here.
- the computer device trains the central word extraction model according to the sample probability corresponding to each sample word and the corresponding predicted probability.
- the computer device obtains the product of the sample probability corresponding to each sample word and the logarithm of the corresponding predicted probability; taking the sum of the products corresponding to multiple sample words as the loss value corresponding to the sample sentence; According to the loss value, the central word extraction model is trained.
- L represents the loss value
- m represents the order of the central word in the sample sentence
- y m is the sample probability of the central word
- p m is the predicted probability of the central word.
- the computer device After the computer device obtains the loss value, it adjusts the model parameters of the central word extraction model according to the size of the loss value, so that the adjusted central word extraction model obtains a reduced loss value until the loss value is gradually reduced As small as the minimum value, the training of the central word extraction model is completed.
- the minimum value is 0.
- the embodiment of the present application only takes the loss function as the cross entropy as an example for description. In another embodiment, other loss functions may also be used to determine the loss value.
- the embodiment of the present application only takes the above-mentioned list-based sorting training method as an example for description.
- the computer device may also use other training methods to train the central word extraction model. For example, according to the difference between the sample probability and the predicted probability of each word, the parameters of the central word extraction model are adjusted so that the difference between the sample probability and the predicted probability is gradually reduced to a minimum.
- the method provided by the embodiment of this application obtains the sample sentences and the sample probabilities corresponding to multiple sample words in the sample sentences, calls the central word extraction model, processes the sample sentences, and obtains the predicted probability corresponding to each sample word.
- the sample probabilities corresponding to the sample words and the corresponding predicted probabilities are used to train the central word extraction model.
- the embodiment of the present application provides a method for training the central word extraction model. The method trains the central word extraction model according to the predicted probability and the sample probability, and improves the accuracy of the central word extraction model.
- the sample probabilities of multiple sample words in the sample sentence are set, and there is no need to consider which word is selected as a negative sample, which avoids the problem of selecting negative samples. , Which reduces the difficulty of model training.
- the computer device that calls the central word extraction model to extract the central word from the target sentence in the embodiment shown in FIG. 2 is the same as the computer device that trains the central word extraction model in the embodiment shown in FIG. 6, It is the same computer equipment, or different computer equipment.
- the computer device in the embodiment shown in FIG. 2 is a server or a user's terminal
- the computer device in the embodiment shown in FIG. 6 is a developer's terminal or server.
- the computer device in the embodiment shown in FIG. 2 and the computer device in the embodiment shown in FIG. 6 are the same server.
- FIG. 7 is a central word extraction provided by the embodiment of this application.
- the developer deploys the central word extraction module 711 to be trained in the terminal 701, and sets a training data set 7021, which contains sample sentences and pre-labeled sample sentences The sample probability corresponding to each sample word in the terminal 701; the terminal 701 calls the central word extraction module 711 to process the sample sentences in the training data set 7021 to obtain the predicted probability 731 corresponding to each sample word; then, based on the predicted probability 731, and the training data
- the loss value 741 is calculated for the sample probability in the set 7021, and then the central word extraction module 711 is trained according to the loss value 741. The above process is repeated until the central word extraction module 711 converges, and the trained central word extraction module 712 is obtained.
- the extraction module 712 can be deployed to the server 702.
- the aforementioned server 702 is a server corresponding to a search engine in a search scenario, or a server corresponding to an application program with an item recommendation or an item recognition function in an item recommendation scenario or an item recognition scenario.
- the server 702 can receive/acquire the target sentence 722, and input the target sentence 722 into the central word extraction module 712. After the central word extraction module 712 is processed, the probability value 732 corresponding to each word in the target sentence 722 is output. , And based on the probability value 732 corresponding to each word, the central word 742 in the target sentence is determined, and subsequent applications are performed based on the central word 742, such as searching, item recommendation, or item recognition based on the central word 742.
- FIG. 1 and FIG. 2 are only described by using the central word extraction model to extract the central word as an example.
- the computer device may not call the central word extraction model to extract the central word.
- the process of extracting the central word without invoking the central word extraction model will be described in detail through the embodiment shown in FIG. 8 below.
- Fig. 8 is a flowchart of a method for extracting a central word provided by an embodiment of the present application.
- the main body of execution of the method is computer equipment, referring to Fig. 8, the method includes:
- the computer device obtains the sentence characteristics of the target sentence and the word characteristics of each word in the target sentence.
- the computer device performs semantic extraction on the sentence feature of the target sentence to obtain the semantic feature of the target sentence, and separately performs semantic extraction on the word feature of each word to obtain the semantic feature of each word.
- the computer device separately obtains the degree of matching between the semantic feature of each word and the semantic feature of the target sentence.
- the computer device matches the semantic feature of each word with the semantic feature of the target sentence to obtain the difference semantic feature corresponding to each word; according to the difference semantic feature corresponding to each word, determine The matching degree for each word.
- the computer device performs subtraction processing on the semantic feature of each word and the semantic feature of the target sentence to obtain the difference semantic feature corresponding to each word.
- the computer device adjusts the difference semantic feature corresponding to each word to obtain the adjusted difference semantic feature; and obtains the matching degree corresponding to each word according to the difference semantic feature corresponding to each word obtained after adjustment.
- the computer device separately adds the semantic feature of each word and the semantic feature of the target sentence to obtain the fusion semantic feature corresponding to each word; according to the fusion semantic feature corresponding to each word, Determine the matching degree for each word.
- the computer device adjusts the fusion semantic feature corresponding to each word to obtain the adjusted fusion semantic feature; and obtains the matching degree corresponding to each word according to the fusion semantic feature corresponding to each word obtained after adjustment.
- the computer device determines, among the multiple words of the target sentence, the corresponding word with the greatest matching degree as the central word of the target sentence.
- the computer device After the computer device obtains the matching degree corresponding to each word, it normalizes the matching degree corresponding to multiple words to obtain the probability corresponding to each matching degree, so that the corresponding The sum of the probabilities is 1, and the word corresponding to the highest probability among multiple probabilities is determined as the central word of the target sentence.
- the method provided by the embodiment of the present application obtains the semantic features reflecting the semantics of the target sentence and the semantic features reflecting the semantics of the words by performing semantic extraction on the extracted sentence features of the target sentence and the word features of each word, which is fully understood
- the degree of matching between the acquired semantic feature of each word and the semantic feature of the target sentence can accurately indicate whether the word matches the target sentence, so as to determine whether the word matches the target sentence according to the matching degree.
- the corresponding words with the highest matching degree are selected as the central word in the sentence, which improves the accuracy of extracting the central word.
- Fig. 9 is a schematic structural diagram of a central word extraction device provided by an embodiment of the present application. Referring to Figure 9, the device includes:
- the feature extraction model 901 is used to obtain the sentence features of the target sentence and the word features of each word in the target sentence;
- the semantic feature extraction module 902 is used to perform semantic extraction on the sentence features of the target sentence to obtain the semantic features of the target sentence, and to separately perform semantic extraction on the word features of each word to obtain the semantic characteristics of each word and the semantics of the target sentence Features are used to represent the global semantics of the target sentence, and the semantic features of words are used to represent the local semantics of the words;
- the matching degree obtaining module 903 is used to obtain the matching degree between the semantic feature of each word and the semantic feature of the target sentence respectively;
- the central word extraction module 904 is used to determine the corresponding word with the greatest matching degree among the multiple words of the target sentence as the central word of the target sentence.
- the device provided by the embodiment of the present application obtains the semantic features reflecting the semantics of the target sentence and the semantic features reflecting the semantics of the words by performing semantic extraction on the sentence features of the extracted target sentence and the word features of each word, which is fully understood
- the degree of matching between the acquired semantic feature of each word and the semantic feature of the target sentence can accurately indicate the degree of matching between the word and the target sentence, and thus according to the match
- the degree selects the corresponding word with the highest matching degree from the target sentence as the head word, which improves the accuracy of extracting the head word.
- the device further includes:
- the difference feature acquisition module 905 is configured to subtract the semantic feature of each word from the semantic feature of the target sentence to obtain the difference semantic feature corresponding to each word;
- the matching degree obtaining module 903 is configured to determine the matching degree corresponding to each word according to the difference semantic feature corresponding to each word.
- the matching degree obtaining module 903 is also used for:
- the matching degree corresponding to each word is determined.
- the apparatus further includes:
- Difference feature adjustment module 95, used to adjust the difference semantic feature corresponding to each word to obtain the adjusted difference semantic feature
- the matching degree obtaining module 903 is further configured to obtain the matching degree corresponding to each word according to the difference semantic feature corresponding to each word obtained after adjustment.
- the feature acquisition module 901 includes:
- the word feature acquiring unit 9011 is configured to query the word feature corresponding to each word according to the mapping relationship, and the mapping relationship includes the word and the corresponding word feature;
- the sentence feature acquiring unit 9012 is configured to combine the multiple query features according to the sequence of multiple words in the target sentence to obtain the sentence feature of the target sentence.
- the central word extraction module 904 is used to determine the word corresponding to the highest probability among multiple probabilities as the central word of the target sentence.
- the central word extraction model includes a residual path, a main path, a semantic feature matching layer, and an output layer.
- the residual path is used to extract the semantic features of the input sentence
- the main path is used to extract the input.
- the semantic feature of each word in the sentence, the semantic feature matching layer and the output layer are used to obtain the degree of matching between the semantic feature of each word in the input sentence and the semantic feature of the input sentence.
- the device further includes:
- the sample acquisition module 906 is used to acquire the sample sentence and the sample probability corresponding to each sample word in the sample sentence, and the sample probability is used to indicate the probability that the corresponding sample word is the central word of the sample sentence;
- the prediction probability acquisition module 907 is used to call the central word extraction model to process the sample sentences to obtain the predicted matching degree corresponding to each sample word;
- the prediction probability acquisition module 907 is also used to normalize the predicted matching degrees corresponding to multiple sample words to obtain the predicted probability corresponding to each sample word, so that the sum of the predicted probabilities corresponding to the multiple sample words is 1.
- the model training module 908 is used to train the central word extraction model according to the sample probability corresponding to each sample word and the corresponding predicted probability.
- model training module 908 is used to:
- the central word extraction model is trained.
- the central word extraction module 904 is used to:
- the matching degree corresponding to multiple words is normalized to obtain the probability corresponding to each matching degree, so that the sum of the probabilities corresponding to multiple words is 1, and the probability is used to indicate that the corresponding word is the central word of the target sentence Probability
- the word corresponding to the highest probability among multiple probabilities is determined as the central word of the target sentence.
- the device further includes:
- the word segmentation module 909 is used to perform word segmentation processing on the target sentence to obtain multiple words included in the target sentence.
- the central word extraction device when the central word extraction device provided in the above embodiment extracts the central word, only the division of the above functional modules is used as an example. In practical applications, the above functions can be allocated by different functional modules according to needs. , That is, divide the internal structure of the computer equipment into different functional modules to complete all or part of the functions described above.
- the central word extraction device provided in the foregoing embodiment and the central word extraction method embodiment belong to the same concept, and the specific implementation process is detailed in the method embodiment, and will not be repeated here.
- FIG. 11 shows a schematic structural diagram of a terminal 1100 provided by an exemplary embodiment of the present application.
- the terminal 1100 includes a processor 1101 and a memory 1102.
- the processor 1101 may include one or more processing cores, such as a 4-core processor, an 8-core processor, and so on.
- the processor 1101 can adopt at least one hardware form among DSP (Digital Signal Processing), FPGA (Field-Programmable Gate Array), and PLA (Programmable Logic Array, Programmable Logic Array). accomplish.
- the memory 1102 may include one or more computer-readable storage media, which may be non-transitory.
- the memory 1102 may also include high-speed random access memory and non-volatile memory, such as one or more magnetic disk storage devices and flash memory storage devices.
- the non-transitory computer-readable storage medium in the memory 1102 is used to store at least one instruction, and the at least one instruction is used by the processor 1101 to implement the central word provided in the method embodiment of the present application. method of extraction.
- the terminal 1100 may optionally further include: a peripheral device interface 1103 and at least one peripheral device.
- the processor 1101, the memory 1102, and the peripheral device interface 1103 may be connected by a bus or a signal line.
- Each peripheral device can be connected to the peripheral device interface 1103 through a bus, a signal line, or a circuit board.
- the peripheral device includes: at least one of a display screen 1104, a camera assembly 1105, an audio circuit 1106, and a power supply 1107.
- FIG. 11 does not constitute a limitation on the terminal 1100, and may include more or fewer components than shown in the figure, or combine certain components, or adopt different component arrangements.
- FIG. 12 is a schematic structural diagram of a server provided by an embodiment of the present application.
- the server 1200 may have relatively large differences due to different configurations or performance, and may include one or more processors (Central Processing Units, CPU) 1201 and one Or more than one memory 1202, where at least one instruction is stored in the memory 1202, and the at least one instruction is loaded and executed by the processor 1201 to implement the methods provided by the foregoing method embodiments.
- the server may also have components such as a wired or wireless network interface, a keyboard, an input and output interface for input and output, and the server may also include other components for implementing device functions, which will not be described in detail here.
- the server 1200 may be used to execute the steps performed by the server in the above-mentioned method for extracting central words.
- An embodiment of the present application also provides a computer device that includes a processor and a memory, and at least one instruction is stored in the memory, and the at least one instruction is loaded by the processor and performs the following operations:
- Semantic extraction is performed on the sentence features of the target sentence to obtain the semantic features of the target sentence, and the semantic features of each word are respectively extracted to obtain the semantic characteristics of each word.
- the semantic features of the target sentence are used to represent the global of the target sentence Semantics, the semantic features of words are used to represent the local semantics of words;
- the corresponding word with the highest matching degree is determined as the central word of the target sentence.
- the at least one instruction is loaded by the processor and performs the following operations:
- the matching degree corresponding to each word is determined.
- the at least one instruction is loaded by the processor and performs the following operations:
- the matching degree corresponding to each word is determined.
- the at least one instruction is loaded by the processor and performs the following operations:
- the matching degree corresponding to each word is obtained.
- the at least one instruction is loaded by the processor and performs the following operations:
- mapping relationship query the word feature of each word, the mapping relationship includes the word and the corresponding word feature;
- the multiple word characteristics found are combined to obtain the sentence characteristics of the target sentence.
- the method is executed based on the central word extraction model.
- the central word extraction model includes a residual path, a backbone path, a semantic feature matching layer, and an output layer.
- the residual path is used to extract the semantic features of the input sentence
- the main path is used to extract the semantic feature of each word in the input sentence
- the semantic feature matching layer and the output layer are used to obtain the degree of matching between the semantic feature of each word in the input sentence and the semantic feature of the input sentence.
- the at least one instruction is loaded by the processor and performs the following operations:
- sample sentence and the sample probability corresponding to each sample word in the sample sentence and the sample probability is used to indicate the probability that the corresponding sample word is the central word of the sample sentence;
- the central word extraction model is trained.
- the at least one instruction is loaded by the processor and performs the following operations:
- the central word extraction model is trained.
- the at least one instruction is loaded by the processor and performs the following operations:
- the word corresponding to the highest probability among multiple probabilities is determined as the central word of the target sentence.
- the at least one instruction is loaded by the processor and performs the following operations:
- the embodiment of the present application also provides a computer-readable storage medium, the computer-readable storage medium stores at least one instruction, and the at least one instruction is loaded by a processor and performs the following operations:
- Semantic extraction is performed on the sentence features of the target sentence to obtain the semantic features of the target sentence, and the semantic features of each word are respectively extracted to obtain the semantic characteristics of each word.
- the semantic features of the target sentence are used to represent the global of the target sentence Semantics, the semantic features of words are used to represent the local semantics of words;
- the corresponding word with the highest matching degree is determined as the head word of the target sentence.
- the at least one instruction is loaded by the processor and performs the following operations:
- the matching degree corresponding to each word is determined.
- the at least one instruction is loaded by the processor and performs the following operations:
- the matching degree corresponding to each word is determined.
- the at least one instruction is loaded by the processor and performs the following operations:
- the matching degree corresponding to each word is obtained.
- the at least one instruction is loaded by the processor and performs the following operations:
- mapping relationship query the word feature of each word, the mapping relationship includes the word and the corresponding word feature;
- the multiple word features found are combined to obtain the sentence characteristics of the target sentence.
- the method is executed based on the central word extraction model.
- the central word extraction model includes a residual path, a backbone path, a semantic feature matching layer, and an output layer.
- the residual path is used to extract the semantic features of the input sentence
- the main path is used to extract the semantic feature of each word in the input sentence
- the semantic feature matching layer and the output layer are used to obtain the degree of matching between the semantic feature of each word in the input sentence and the semantic feature of the input sentence.
- the at least one instruction is loaded by the processor and performs the following operations:
- sample sentence and the sample probability corresponding to each sample word in the sample sentence and the sample probability is used to indicate the probability that the corresponding sample word is the central word of the sample sentence;
- the central word extraction model is trained.
- the at least one instruction is loaded by the processor and performs the following operations:
- the central word extraction model is trained.
- the at least one instruction is loaded by the processor and performs the following operations:
- the matching degree corresponding to multiple words is normalized to obtain the probability corresponding to each matching degree, so that the sum of the probabilities corresponding to multiple words is 1, and the probability is used to indicate that the corresponding word is the central word of the target sentence Probability
- the word corresponding to the highest probability among multiple probabilities is determined as the central word of the target sentence.
- the at least one instruction is loaded by the processor and performs the following operations:
- An embodiment of the present application also provides a computer program, in which at least one instruction is stored, and the at least one instruction is loaded and executed by a processor to implement the operations performed in the central word extraction method of the above-mentioned embodiment.
- the program can be stored in a computer-readable storage medium, as mentioned above.
- the storage medium can be read-only memory, magnetic disk or optical disk, etc.
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- General Health & Medical Sciences (AREA)
- Artificial Intelligence (AREA)
- Health & Medical Sciences (AREA)
- Computational Linguistics (AREA)
- General Engineering & Computer Science (AREA)
- Audiology, Speech & Language Pathology (AREA)
- Molecular Biology (AREA)
- Evolutionary Computation (AREA)
- Life Sciences & Earth Sciences (AREA)
- Computing Systems (AREA)
- Data Mining & Analysis (AREA)
- Biophysics (AREA)
- Mathematical Physics (AREA)
- Software Systems (AREA)
- Biomedical Technology (AREA)
- Probability & Statistics with Applications (AREA)
- Machine Translation (AREA)
Abstract
一种中心词提取方法、装置、设备及存储介质,属于计算机技术领域。包括:获取目标语句的语句特征,以及目标语句中每个词语的词语特征(801);对目标语句的语句特征进行语义提取,得到目标语句的语义特征,以及对每个词语的词语特征进行语义提取,得到每个词语的语义特征(802);分别获取每个词语的语义特征与目标语句的语义特征之间的匹配度(803);将目标语句的多个词语中,对应的匹配度最大的词语确定为目标语句的中心词(804)。方法通过提取目标语句的语义特征和词语的语义特征,根据对目标语句和词语的语义的理解,从目标语句中提取中心词,提高了提取中心词的准确率。
Description
本申请要求于2020年06月01日提交的申请号为202010486516.7、发明名称为“中心词提取方法、装置、设备及存储介质”的中国专利申请的优先权,其内容通过引用结合在本申请中。
本申请实施例涉及计算机技术领域,特别涉及一种中心词提取方法、装置、设备及存储介质。
随着计算机技术的发展和搜索引擎的广泛应用,用户对搜索准确率的要求也越来越高。为了提高搜索准确率,在根据用户输入的语句进行搜索时,从该语句中提取能准确表达语句语义的中心词,根据中心词进行搜索,避免根据语句进行搜索而导致搜索结果较少的问题。
发明内容
本申请实施例提供了一种中心词提取方法,所述方法由计算机设备执行,所述方法包括:
获取目标语句的语句特征,以及所述目标语句中每个词语的词语特征;
对所述目标语句的语句特征进行语义提取,得到所述目标语句的语义特征,以及分别对所述每个词语的词语特征进行语义提取,得到所述每个词语的语义特征,所述目标语句的语义特征用于表征所述目标语句的全局语义,所述词语的语义特征用于表征所述词语的局部语义;
分别获取所述每个词语的语义特征与所述目标语句的语义特征之间的匹配度;
将所述目标语句的多个词语中,对应的匹配度最大的词语确定为所述目标语句的中心词。
另一方面,提供了一种中心词提取装置,所述装置用于计算机设备,所述装置包括:
特征提取模型,用于获取目标语句的语句特征,以及所述目标语句中每个词语的词语特征;
语义特征提取模块,用于对所述目标语句的语句特征进行语义提取,得到所述目标语句的语义特征,以及分别对所述每个词语的词语特征进行语义提取,得到所述每个词语的语义特征,所述目标语句的语义特征用于表征所述目标语句的全局语义,所述词语的语义特征用于表征所述词语的局部语义;
匹配度获取模块,用于分别获取所述每个词语的语义特征与所述目标语句的语义特征之间的匹配度;
中心词提取模块,用于将所述多个词语中,对应的匹配度最大的词语确定为所述目标语句的中心词。
另一方面,提供了一种计算机设备,所述计算机设备包括处理器和存储器,所述存储器中存储有至少一条指令,所述至少一条指令由所述处理器加载并执行,以实现如上述中心词提取方法中所执行的操作。
另一方面,提供了一种计算机可读存储介质,所述计算机可读存储介质中存储有至少一条指令,所述至少一条指令由处理器加载并执行,以实现如上述中心词提取方法中所执行的操作。
另一方面,提供了一种计算机程序,该计算机程序中存储有至少一条指令,该至少一条指令由处理器加载并执行,以实现如上述中心词提取方法中所执行的操作。
下面将对实施例描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本申请实施例的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。
图1是本申请实施例提供的一种中心词提取方法的流程图;
图2是本申请实施例提供的另一种中心词提取方法的流程图;
图3是本申请实施例提供的一种语义特征提取层和语义特征匹配层的示意图;
图4是本申请实施例提供的一种中心词提取模型的示意图;
图5是本申请实施例提供的一种中心词提取模型的示意图;
图6是本申请实施例提供的一种模型训练方法的流程图;
图7是本申请实施例提供的一种中心词提取模型训练及应用框架示意图;
图8是本申请实施例提供的一种中心词提取方法的流程图;
图9是本申请实施例提供的一种中心词提取装置的结构示意图;
图10是本申请实施例提供的另一种中心词提取装置的结构示意图;
图11是本申请实施例提供的一种终端的结构示意图;
图12是本申请实施例提供的一种服务器的结构示意图。
为使本申请实施例的目的、技术方案和优点更加清楚,下面将结合附图对本申请实施方式作进一步地详细描述。
可以理解,本申请所使用的术语“每个”、“多个”及“任一”等,多个包括两个或两个以上,每个是指对应的多个中的每一个,任一是指对应的多个中的任意一个。举例来说,多个词语包括10个词语,而每个词语是指这10个词语中的每一个词语,任一词语是指10个词语中的任意一个词语。
中心词提取:根据语句中的多个词语,识别并提取出语句的中心词,一个语句中包含一个或者多个中心词,中心词为语句中准确表达该语句的语义的词语,例如,中心词为与语句相关度最大的词语,或者中心词为与语句相关度大于某一相关度阈值的词语;又例如,中心词是指决定语句的语法范畴的词语,是语句的中心部分。
TF-IDF(Term Frequency–Inverse Document Frequency,词频-逆文档频率算法):TF-IDF是一种用于信息检索与数据挖掘的常用加权技术,TF(Term Frequency,词频)表示某一词语在某一文本中出现的频率,IDF(Inverse Document Frequency,逆向文件频率)表示某一词语在多个文本中出现的频率。
NER(Named Entity Recognition,命名实体识别):NER是指识别文本中具有特定意义的实体,例如文本中的人名、地名、机构名及专有名词等词语。
本申请实施例提供的中心词提取方法涉及人工智能的人工智能技术、自然语言处理等技术,本申请通过下述实施例对中心词提取方法进行说明。
本申请实施例提供了一种中心词提取方法,执行主体为计算机设备。该计算机设备调用中心词提取模型,获取目标语句的语句特征及目标语句中的多个词语的词语特征,分别对目标语句的语句特征及每个词语的词语特征进行语义提取,得到目标语句的全局语义特征及每个词语的局部语义特征,分别对每个词语的局部语义特征与目标语句的全局语义特征进行匹配,得到每个词语的局部语义特征与全局语义特征之间的差异特征,根据每个词语的局部语义特征与全局语义特征之间的差异特征,获取每个词语的分值,提取多个分值中最大的分值对应的词语,作为目标语句的中心词。
在另一实施例中,计算机设备获取目标语句的语句特征,以及目标语句中的多个词语的词语特征,对目标语句的语句特征进行语义提取,得到目标语句的语义特征,以及分别对每个词语的词语特征进行语义提取,得到每个词语的语义特征,分别获取每个词语的语义特征与目标语句的语义特征之间的匹配度,将多个词语中,对应的匹配度最大的词语确定为目标语句的中心词。其中,目标语句的语义特征用于表征目标语句的全局语义,目标语句的语义特征即为全局语义特征;词语的语义特征用于表征词语在目标语句中的局部语义,词语的语义特征即为局部语义特征;词语对应的匹配度用于表征词语与目标语句之间的匹配程度,该 匹配度即为分值。
在一种可能实现方式中,该计算机设备为终端,终端可以为便携式、袖珍式、手持式等多种类型的终端,如智能手机、平板电脑、笔记本电脑、台式计算机、智能音箱、智能手表等。
在另一种可能实现方式中,该计算机设备为服务器,服务器可以是独立的物理服务器,也可以是多个物理服务器构成的服务器集群或者分布式***,还可以是提供云服务、云数据库、云计算、云函数、云存储、网络服务、云通信、中间件服务、域名服务、安全服务、CDN(Content Delivery Network,内容分发网络)、以及大数据和人工智能平台等基础云计算服务的云服务器。
另外,终端和服务器可以通过有线或无线通信方式进行直接或间接地连接,本申请在此不做限制。
本申请实施例提供的中心词提取方法可以应用于多种场景下。比如,本申请实施例提供的方法可应用于任意需要从语句中提取出中心词的场景。
例如,应用于搜索场景下。
在搜索场景下,计算机设备获取用户输入的语句,采用本申请实施例提供的中心词提取方法,提取出语句的中心词,根据中心词进行搜索,避免根据语句进行搜索而导致搜索结果较少的问题。另外,该搜索场景可以为物品搜索场景或新闻搜索场景等多种搜索场景。
又例如,应用于物品推荐场景下。
在物品推荐场景下,计算机设备获取用户的历史购买记录中的历史物品,采用本申请实施例提供的中心词提取方法,提取出历史物品对应的物品标题的中心词,根据该中心词,查询包括该中心词的物品标题对应的物品,将查询到的物品推荐给用户。
又例如,应用于物品识别场景下。
在物品识别场景下,计算机设备对目标物品进行扫描识别,根据扫描得到的扫描图像查询到对应的物品图像,根据查询到的物品图像确定对应的物品标题,采用本申请实施例提供的中心词提取方法,提取物品标题的中心词,从而根据中心词确定目标物品,得到目标物品的物品名称。
图1是本申请实施例提供的一种中心词提取方法的流程图。本申请实施例的执行主体为计算机设备,参见图1,该方法包括:
101、计算机设备调用中心词提取模型的特征获取层,获取目标语句的语句特征及目标语句中的多个词语的词语特征。
本申请实施例中,计算机设备获取需要提取中心词的目标语句,调用中心词提取模型,获取目标语句中的每个词语的分值,从而根据每个词语的分值提取目标语句的中心词。也即是,计算机设备获取目标语句中每个词语对应的匹配度,从而根据每个词语对应的匹配度提取目标语句的中心词。本申请实施例仅是以目标语句为例进行说明,其他语句的提取中心词的方式与目标语句类似,本申请实施例不再赘述。
其中,目标语句为任一语句。例如,在搜索场景下,目标语句为用户输入的搜索语句;在物品识别场景下或物品推荐场景下,目标语句为物品标题;在其他的场景下,目标语句为文章中的语句或者其他语句。
计算机设备采用任一分词方式,对目标语句进行分词,得到目标语句中的多个词语,例如,按照词性分词、按照已知的词语分词或者按照其他方式分词,本申请实施例对此不做限制。
本申请实施例中,计算机设备为了便于后续对目标语句及目标语句中的多个词语进行处理,将目标语句及目标语句的多个词语转换为计算机设备能够识别的表现形式,计算机设备调用特征提取层,获取目标语句的语句特征和目标语句中每个词语的词语特征。其中,语句特征的形式和词语特征的形式可以为特征序列、特征向量或者其他形式。
102、计算机设备调用中心词提取模型的语义特征提取层,分别对目标语句的语句特征及每个词语的词语特征进行语义提取,得到目标语句的全局语义特征及每个词语的局部语义特征。
本申请实施例中,计算机设备获取目标语句的语句特征,以及目标语句中的多个词语的词语特征;对目标语句的语句特征进行语义提取,得到目标语句的语义特征,以及分别对每个词语的词语特征进行语义提取,得到每个词语的语义特征。可选地,计算机设备提取目标语句的语义特征的步骤和提取词语的语义特征的步骤,依次执行,或者并行执行。
其中,语义特征提取层用于根据目标语句的语句特征得到目标语句的语义特征,根据词语的词语特征得到词语的语义特征,从而提取出能够表达语句语义或词语语义的特征。其中,目标语句的语义特征用于表示目标语句的语义,每个词语的语义特征用于表示该词语的语义,而中心词的词语的语义特征为与目标语句的语义特征最接近的语义特征,即中心词的词语的语义特征与目标语句的语义特征之间的匹配度最大。
在一种可能实现方式中,计算机设备采用相同的语义提取方式,提取目标语句的语义特征和每个词语的语义特征。
在另一种可能实现方式中,由于目标语句和目标语句中的多个词语不同,计算机设备采用不同的语义提取方式,提取出目标语句的语义特征以及每个词语的语义特征。也就是说,计算机设备提取目标语句的语义特征所使用的语义提取方式,与提取每个词语的语义特征所使用的语义提取方式可以是不同的。
另外,目标语句的语义特征的表现形式与词语的语义特征的表现形式一致,例如,目标语句的语义特征为特征序列,则词语的语义特征也为特征序列;目标语句的语义特征为特征向量,则词语的语义特征也为特征向量。
本申请实施例中,计算机设备获取目标语句的语义特征和每个词语的语义特征,可以准确理解每个词语的语义。例如,一个词语在不同的语句中语义不同,如果仅是根据词语的词语特征无法确定该词语在目标语句中的语义,则无法确定该词语是否是目标语句的中心词,而获取该词语的语义特征,可根据该词语的语义特征确定该词语在目标语句中的语义,从而确定词语是否是目标语句的中心词。
103、计算机设备调用中心词提取模型的语义特征匹配层,分别对每个词语的局部语义特征与目标语句的全局语义特征进行匹配,得到每个词语的局部语义特征与全局语义特征之间的差异特征。
其中,分别对每个词语的语义特征与目标语句的语义特征进行匹配,是指将每个词语的语义特征,分别与目标语句的语义特征进行匹配。例如,目标语句中包含3个词语,分别为词语1、词语2和词语3,计算机设备将词语1的语义特征与目标语句的语义特征进行匹配,得到词语1的语义特征与目标语句的语义特征之间的差异特征1,同理,计算机设备得到词语2的语义特征与目标语句的语义特征之间的差异特征2,以及词语3的语义特征与目标语句的语义特征之间的差异特征3。
本申请实施例中,差异特征匹配层用于获取词语的语义特征与目标语句的语义特征之间的差异特征,该差异特征用于表征目标语句与词语之间的匹配度,该差异特征表示的差异越大,则表示目标语句与词语之间的匹配度越小,该差异特征表示的差异越小,则表示目标语句与词语之间的匹配度越大。
其中,差异特征的表现形式与目标语句的语义特征或词语的语义特征的表现形式一致。
104、计算机设备调用中心词提取模型的输出层,根据每个词语的局部语义特征与全局语义特征之间的差异特征,获取每个词语的分值。
本申请实施例中,输出层用于获取每个词语的分值,也即是计算机设备获取每个词语的语义特征与目标语句的语义特征之间的匹配度。其中,分值与差异特征呈负相关关系,即词语的语义特征与目标语句的语义特征之间的差异越大,分值越小,该词语的语义能够反映目 标语句的语义的可能性越小;词语的语义特征与目标语句的语义特征之间的差异越小,分值越大,该词语的语义能够反映目标语句的语义的可能性越大。
上述步骤103和104中,计算机设备调用语义特征匹配层和输出层来获取输入语句中每个词语的语义特征与输入语句的语义特征之间的匹配度。其中,输入语句即为本申请中的目标语句。
105、计算机设备提取多个分值中最大的分值对应的词语,作为目标语句的中心词。
本申请实施例中,计算机设备根据获取的多个分值,提取多个分值中最大的分值对应的词语,作为目标语句的中心词。也即是,计算机设备将多个词语中,对应的匹配度最大的词语确定为目标语句的中心词。
例如,对于物品识别场景或者物品推荐场景,随着SEO(Search Engine Optimization,搜索引擎优化)的发展,物品的物品标题由多个词语组合而成,该物品标题中包括近义词,如跑步鞋、运动鞋、板鞋等;还包括歧义词,如支架、增高架、框架等;还包括品牌词。
相关技术中,在采用TF-IDF方法从物品标题中提取中心词时,该方法仅是对词语进行统计,根据词语出现的频率确定是否是中心词,如果一个词语出现频率很高,但是该词语在目标语句中的语义与在其他语句中的语义不同,此时如果将该词语作为目标语句的中心词则是不准确的。并且,对于近义词、歧义词和品牌词,该TF-IDF方法无法分辨每个词语的语义,从而无法准确提取中心词。
或者,在采用NER方法从物品标题中提取中心词时,该方法使用的中心词提取模型仅能够从预设的多个词语中提取语句的中心词,如果语句的中心词不是预设的词语,则采用NER方法只能生硬的从预设的多个词语中提取中心词,导致提取的中心词不够准确。
而本申请实施例提供的方法,调用中心词提取模型的特征获取层,获取目标语句的语句特征及目标语句中的多个词语的词语特征,调用语义特征提取层,对语句特征和词语特征进行进一步提取,提取出反映目标语句的语义的语义特征,以及反映词语的语义的语义特征,调用语义特征匹配层,在充分理解了目标语句和目标语句中的词语的语义的基础上,分别对每个词语的语义特征与目标语句的语义特征进行匹配,得到每个词语对应的差异特征,该差异特征能够反映每个词语的语义特征与目标语句的语义特征之间的匹配度,调用输出层,根据每个词语对应的差异特征,获取每个词语的分值,提从而根据该分值从目标语句中选取出对应的分值最大的词语作为中心词,且本申请中的提取方式不限于从已知的多个词语中提取语句的中心词,因而具有较高的扩展性,进而提高了提取中心词的准确率。
并且,本申请实施例提供的方法,可准确识别语句中的近义词、歧义词以及品牌词等词语,准确理解语句及语句的多个词语的语义,提高了中心词提取的准确率。
图2是本申请实施例提供的另一种中心词提取方法的流程图。本申请实施例的执行主体为计算机设备,参见图2,该方法包括:
201、计算机设备调用中心词提取模型的分词层,对目标语句进行分词处理,得到目标语句包括的多个词语。
本申请实施例中,计算机设备获取待提取中心词的目标语句,将目标语句输入至中心词提取模型,调用中心词提取模型的分词层对目标语句进行分词处理,得到目标语句包括的多个词语。也即是,计算机设备对目标语句进行分词处理,得到目标语句包括的多个词语。
其中,分词层中包括多个已知的词语,计算机设备按照多个已知的词语对目标语句进行分词。另外,计算机设备可在任意时间修改该多个已知的词语,在分词层中添加新的词语,或者,删减多个已知的词语中的一个或多个词语。
在一种可能实现方式中,该分词层为基于概率词典的分词器,即基于Jieba的分词器。该分词器包括精确模式、全模式以及搜索引擎模式。其中,精确模式按照多个已知的词语将目标语句拆分为多个词语,全模式按照多个已知的词语将目标语句中可成词的词语全部拆分,形成多个词语,搜索引擎模式在精确模式的基础上,将较长的词语进一步进行拆分。本申请 实施例采用任一模式对目标语句进行分词处理,本申请实施例对此不做限制。
需要说明的是,本申请实施例仅是以分词层为基于概率词典的分词器为例进行说明,在另一实施例中,分词层还可以是其他类型的分词器;例如,分词层是基于统计的分词器(比如基于语言模型的分词器或者基于统计机器学习分词器),或者是基于神经网络的分词器等。
在一种可能实现方式中,计算机设备得到目标语句包括的多个词语之后,确定每个词语的词语标识,该词语标识用于表示对应的词语在目标语句中的位置。
202、计算机设备调用中心词提取模型的特征获取层,获取目标语句的语句特征及目标语句中的多个词语的词语特征。
在一种可能实现方式中,计算机设备调用中心词提取模型的特征提取层,按照映射关系,查询目标语句中的每个词语对应的词语特征。其中,映射关系包括词语及对应的词语特征。
计算机设备获取每个词语的词语特征之后,将多个词语的词语特征按照多个词语在目标语句中的排列顺序进行组合,得到目标语句的语句特征。即计算机设备按照多个词语在目标语句中的排列顺序,对获取到的多个词语特征进行组合,得到语句特征。例如,目标语句中包括三个词语,这三个词语的排列顺序为词语1、词语2和词语3,按照词语1的词语特征、词语2的词语特征和词语3的词语特征的顺序对三个词语特征进行组合,得到语句特征。
在一种可能实现方式中,特征获取层为嵌入编码器,该嵌入编码器分别将输入的每个词语映射为对应的词语特征,并按照多个词语在目标语句中的排列顺序进行组合,得到目标语句的语句特征。其中,该嵌入编码器可以采用Word2Vector算法或者其他算法。例如,每个词语的词语特征为一个200维的特征序列,目标语句中包括n个词语,则目标语句的语句特征则为n*200维的特征序列。其中,上述词语特征也可以实现为200维的特征向量。
需要说明的是,本申请实施例仅是以特征获取层为嵌入编码器为例进行说明,在另一实施例中,特征获取层还可采用其他方式获取目标语句的语句特征及每个词语的词语特征。
可选地,计算机设备在任意时间从映射关系中删减词语及对应的词语特征,或者在任意时间在映射关系中添加词语及对应的词语特征。
另外,该步骤202的其他说明详见上述步骤101,在此不再赘述。
203、计算机设备调用中心词提取模型的语义特征提取层,分别对目标语句的语句特征及每个词语的词语特征进行语义提取,得到目标语句的全局语义特征及每个词语的局部语义特征。
在一种可能实现方式中,语义特征提取层包括词语语义提取单元和语句语义提取单元,计算机设备调用语义特征提取层的词语语义提取单元,分别对每个词语的词语特征进行处理,得到每个词语的语义特征。计算机设备调用语义特征提取层的语句语义提取单元,对目标语句的语句特征进行处理,得到目标语句的语义特征。其中,词语语义提取单元用于对词语的词语特征进行提取,语句语义提取单元用于对语句的语句特征进行提取。
计算机设备获取目标语句中每个词语的词语特征,将多个词语特征依次输入至词语语义提取单元,依次得到每个词语的语义特征;或者,将多个词语特征同时输入至词语语义提取单元,得到每个词语的语义特征。
采用词语语义提取单元获取词语的语义特征,采用语句语义提取单元提取目标语句的语义特征,根据词语与语句的特点,提取的语义特征更加准确。也就是说,在本申请实施例中,计算机设备根据词语与语句的不同特点,通过不同的语义提取单元分别对词语和语句进行语义特征提取,从而提高了语义特征提取的准确性。
在一种可能实现方式中,参见图3所示的网络结构的示意图,该网络结构是对残差卷积神经网络进行改进得到的网络结构,该网络结构包括语义特征提取层,该网络结构包括主干(trunk)通路和残差(residual)通路,其中,主干通路即词语语义提取单元,用于对每个词语的词语特征进行语义提取,得到每个词语的语义特征,即主干通路用于提取目标语句中每个词语的语义特征;残差通路即语句语义提取单元,用于对目标语句的语句特征进行语义提 取,得到目标语句的语义特征,即残差通路用于提取目标语句的语义特征。
可选地,主干通路包括两个1*1的卷积层;或者,主干通路包括一个k*k的深度卷积层301和一个1*1的卷积层302。其中,k为正整数,每个卷积层之后有对应的批归一化(Batch Normalization,BN)层,深度卷积层可以实现对网络参数的压缩。
可选地,残差通路包括一个全局平均池化层303和一个1*1的卷积层304。其中,全局平局池化层可以有效提取目标语句的语义特征。
另外,该步骤203的其他说明详见上述步骤102,在此不再赘述。
204、计算机设备调用中心词提取模型的语义特征匹配层,分别对每个词语的局部语义特征与目标语句的全局语义特征进行匹配,得到每个词语的局部语义特征与全局语义特征之间的差异特征。
本申请实施例中,计算机设备分别对每个词语的语义特征与目标语句的语义特征进行匹配,得到每个词语对应的差异语义特征,该差异语义特征即为差异特征。其中,每个词语的语义特征与目标语句的语义特征之间的差异特征,即为词语对应的差异语义特征。
在一种可能实现方式中,计算机设备调用中心词提取模型的语义特征匹配层,分别对每个词语的语义特征与目标语句的语义特征进行相加处理,得到每个词语的语义特征与目标语句的语义特征之间的差异特征;或者,计算机设备调用中心词提取模型的语义特征匹配层,分别对每个词语的语义特征与目标语句的语义特征进行相减处理,得到每个词语的语义特征与目标语句的语义特征之间的差异特征。其中,相加处理或者相减处理均是为了将词语的语义特征与目标语句的语义特征进行匹配,以得到词语的语义特征和目标语句的语义特征之间的差异特征。
也即是,计算机设备分别对每个词语的语义特征与目标语句的语义特征进行相减处理,得到每个词语对应的差异语义特征;或者计算机设备分别对每个词语的语义特征与目标语句的语义特征进行相加处理,得到每个词语对应的融合语义特征,该融合语义特征即为差异特征,后续对该融合语义特征进行进一步拆分处理,即可得到词语的语义特征与目标语句的语义特征之间的差异。
当计算机设备调用语义特征匹配层,分别对每个词语的语义特征与目标语句的语义特征进行相加处理,得到每个词语对应的融合语义特征时,该融合语义特征中同时包含词语的语义特征与目标语句的语义特征,其可间接地指示词语的语义特征与目标语句的语义特征之间的差异,也就是间接反映词语的语义特征与目标语句的语义特征之间的匹配度;后续中心词提取模型的输出层可通过该融合语义特征间接指示的差异,得到各个词语对应的匹配度,即调用输出层对融合语义特征进行处理,先对融合语义特征进行拆分,得到融合语义特征中包含的词语的语义特征和目标语句的语义特征,然后再确定词语的语义特征和目标语句的语义特征之间的差异,根据确定的差异确定匹配度。
当计算机设备调用语义特征匹配层,分别对每个词语的语义特征与目标语句的语义特征进行相减处理,得到每个词语对应的差异语义特征时,该差异语义特征能够直接地指示词语的语义特征与目标语句的语义特征之间的差异,也就是直接反映词语的语义特征与目标语句的语义特征之间的匹配度;后续中心词提取模型的输出层通过该差异语义特征直接指示的差异,得到各个词语对应的匹配度,即调用输出层对差异语义特征进行处理,直接得到匹配度。
在一种可能实现方式中,基于上述步骤203中的可能实现方式,参见图3,网络结构还包括语义特征匹配层305,该语义特征匹配层之后还包括激活函数306,将语义特征匹配层得到的每个差异特征通过激活函数,得到最终输出的差异特征。其中,激活函数为ReLU(Rectified Linear Unit,线性整流函数)、Swish、GELU(Gaussian Error Linear Units,高斯误差线性单元)或其他激活函数。
另外,该步骤204的其他说明详见上述步骤103,在此不再赘述。
205、计算机设备调用中心词提取模型的每个特征提取网络,对上一层得到的差异特征进 行调整,得到调整后的差异特征。
本申请实施例中,计算机设备对每个词语对应的差异语义特征进行调整,得到调整后的差异语义特征,之后,根据调整后的、每个词语对应的差异语义特征,获取每个词语对应的匹配度;或者计算机设备对每个词语对应的融合语义特征进行调整,得到调整后的融合语义特征,之后,根据调整后的、每个词语对应的融合语义特征,获取每个词语对应的匹配度。
其中,中心词提取模型还包括至少一个特征提取网络,该特征提取网络用于对获取的差异语义特征进行调整,以得到更加准确的差异语义特征。其中,特征提取网络的结构与图3所示的网络结构类似。也就是说,特征提取网络的网络结构与图3所示的网络结构相同(网络参数可不同),或者,特征提取网络的网络结构与图3所示的网络结构不同。
其中,中心词提取模型中的各个网络层之间具有连接关系,其中,具有连接关系的两个网络层中,前一个网络层的输出,是后一个网络层的输入。例如,对于多个特征提取网络中的第一个特征提取网络,其上一层是语义特征匹配层;对于多个特征提取网络中除了第一个特征提取网络之外的其它特征提取网络,其上一层是前一个特征提取网络中,与其具有连接关系的网络层。
在一种可能实现方式中,特征提取网络包括语义特征提取层和语义特征匹配层,在对上一层得到的差异特征进行调整时,计算机设备调用特征提取网络的语义特征提取层,分别对上一层得到的每个词语的语义特征与目标语句的语义特征之间的差异特征进行语义提取,得到调整后的目标语句的语义特征及调整后的每个词语的语义特征;调用特征提取网络的语义特征匹配层,分别对调整后的每个词语的语义特征与调整后的目标语句的语义特征进行匹配,得到调整后的差异特征。
也即是,计算机设备对上一层得到的差异语义特征进行调整时,调用特征提取网络的语义特征提取层,分别对上一层得到的每个词语的语义特征与目标语句的语义特征之间的差异语义特征进行语义提取,得到调整后的目标语句的语义特征及调整后的每个词语的语义特征;调用特征提取网络的语义特征匹配层,分别对调整后的每个词语的语义特征与调整后的目标语句的语义特征进行匹配,得到调整后的差异语义特征。或者,计算机设备对上一层得到的融合语义特征进行调整时,调用特征提取网络的语义特征提取层,分别对上一层得到的每个词语的语义特征与目标语句的语义特征之间的融合语义特征进行语义提取,得到调整后的目标语句的语义特征及调整后的每个词语的语义特征;调用特征提取网络的语义特征匹配层,分别对调整后的每个词语的语义特征与调整后的目标语句的语义特征进行匹配,得到调整后的融合语义特征。
可选地,差异特征为差异语义特征时,由于每个词语的语义特征与目标语句的语义特征之间的差异语义特征包括除该词语之外的其他词语的语义特征,则对于多个词语来说,可从该多个词语对应的差异语义特征中提取出每个词语的语义特征,通过语义特征提取层对每个词语的语义特征进行进一步的提取,从而可得到调整后的每个词语的语义特征。对于目标语句来说,对多个词语对应的差异语义特征进行融合,以得到目标语句的语义特征,通过语义特征提取层对目标语句的语义特征进行进一步的提取,从而可得到调整后的目标语句的语义特征。
特征提取网络的语义特征提取层的结构与上述步骤203中的中心词提取模型的语义特征提取层的结构类似,提取语义特征的实施方式与上述步骤203中的实施方式类似;特征提取网络的语义特征匹配层的结构与上述步骤204中的中心词提取模型的语义特征匹配层的结构类似,匹配语义特征的实施方式与上述步骤204中的实施方式类似,在此不再赘述。
在一种可能实现方式中,差异特征为融合语义特征,中心词提取模型包括多个特征提取网络,任一个特征提取网络获取上一层得到的融合语义特征,对上一层得到的融合语义特征进行进一步的调整。计算机设备从每个词语对应的融合语义特征中提取该词语的语义特征,将提取出的每个词语的语义特征进行融合得到调整后的目标语句的语义特征。对于每个词语 对应的融合语义特征首先经过特征提取网络进行进一步的语义特征提取,然后采用与语义特征匹配层类似的方式,对调整后的目标语句的语义特征及语义提取后的每个词语对应的融合语义特征,进行匹配处理,得到调整后的融合语义特征。
在一种可能实现方式中,参见图4所示的中心词提取模型的示意图,该中心词提取模型包括分词层401、特征获取层402、语义特征提取层403、语义特征匹配层404、两个特征提取网络405及输出层406。
本申请实施例中,在语义特征匹配层之后,设置有多个特征提取网络,该多个特征提取网络对差异特征进行进一步的语义提取,实现了语义特征的多层次的提取,提高了获取的语义特征的准确率,从而提高了差异特征的准确率,进一步提高了中心词的提取准确率。
其中,当图4中的中心词提取模型的语义特征提取层403的结构与特征提取网络405中的语义特征提取层的结构类似,且语义特征匹配层404的结构与特征提取网络405中的语义特征匹配层的结构类似时,语义特征提取层403和语义特征匹配层404可以构成与特征提取网络405类似的基本结构单元。请参考图5所示的中心词提取模型的示意图,该中心词提取模型包括分词层501、特征获取层502、三个基本结构单元503、以及输出层504。其中,三个基本结构单元503的网络结构与图3所示的网络结构类似。
需要说明的是,本申请实施例仅是以特征提取网络的网络结构与中心词提取模型的语义特征提取层和语义特征匹配层的网络结构类似为例进行说明,在另一实施例中,特征提取网络的网络结构可以为其他形式,本申请实施例对特征提取网络的网络结构不做限制。
206、计算机设备调用中心词提取模型的输出层,根据最后一个特征提取网络得到的差异特征,获取每个词语的分值。
其中,上述最后一个特征提取网络,是多个特征提取网络中最后一个被调用的特征提取网络。比如,以图4所示的两个特征提取网络为例,这两个特征提取网络具有连接关系,上述的最后一个特征提取网络,是指具有连接关系的两个特征提取网络中的后一个特征提取网络。
计算机设备调用输出层,该输出层根据最后一个特征提取层得到的差异特征,获取每个词语的分值,该分值用于反映词语与目标语句之间的匹配度。其中,输出层包括一个1*1的卷积层。也即是,计算机设备根据调整后的差异特征,获取每个词语对应的匹配度。
207、计算机设备对多个词语对应的分值进行归一化处理,得到每个分值对应的概率。
208、计算机设备提取多个概率中最大的概率对应的词语,作为目标语句的中心词。
本申请实施例中,计算机设备得到每个词语对应的匹配度后,对多个词语对应的匹配度进行归一化处理,得到每个匹配度对应的概率。其中,归一化处理后的多个词语对应的概率之和为1,概率用于表示对应的词语为目标语句的中心词的概率,提取最大的概率对应的词语作为目标语句的中心词,词语的概率越大表示该词语为中心词的可能性越大,词语的概率越小表示该词语为中心词的可能性越小。
在一种可能实现方式中,计算机设备采用softmax函数进行归一化操作;或者,计算机设备采用加权平均或加权求和的方式对多个词语对应的分值进行归一化处理。
例如,目标语句为“我今天和朋友一起去爬山了”,该目标语句中包括词语:“我”、“今天”、“和”、“朋友”、“一起去”、“爬山”和“了”,这句话中的重点在“爬山”。对该目标语句采用上述实施方式进行中心词提取,分别获取“我”、“今天”、“和”、“朋友”、“一起去”、“爬山”和“了”对应的匹配度,匹配度依次为“20、10、5、20、3、80、1”,其中“爬山”对应的匹配度最大,则从目标语句中提取出“爬山”,将“爬山”作为目标语句“我今天和朋友一起去爬山了”的中心词。
本申请实施例提供的方法,调用语义特征提取层,对获取的语句特征和词语特征进行进一步提取,提取出反映目标语句的语义的语义特征,以及反映词语的语义的语义特征,调用语义特征匹配层,在充分理解了目标语句和目标语句中的词语的语义的基础上,分别对每个 词语的语义特征与目标语句的语义特征进行匹配,得到每个词语对应的差异特征,该差异特征能够反映每个词语的语义特征与目标语句的语义特征之间的匹配度,调用输出层,根据每个词语对应的差异特征,获取每个词语的分值,提从而根据该分值从目标语句中选取出对应的分值最大的词语作为中心词,且本申请中的提取方式不限于从已知的多个词语中提取语句的中心词,因而具有较高的扩展性,进而提高了提取中心词的准确率。
并且,本申请实施例提供的方法,由于分词层中的多个已知的词语及特征获取层中的映射关系中的词语可在任意时间进行修改,则中心词提取模型可准确获取任意词语的词语特征,从而该中心词提取模型可准确提取目标语句中的中心词,提高了中心词提取的扩展性。
并且,本申请实施例提供的方法,在语义特征匹配层之后,设置有多个特征提取网络,该多个特征提取网络对差异特征进行进一步的语义提取,实现了语义特征的多层次的提取,提高了获取的语义特征的准确率,从而提高了差异特征的准确率,进一步提高了中心词的提取准确率。
并且,本申请实施例提供的方法,由于网络结构的特点,改进的残差神经网络可以快速对词语特征或语句特征进行处理,提高了中心词提取的效率。例如,对比一个由多个词语组成的物品标题,提取该物品标题中的中心词时需要的时间不超过1ms。
在调用中心词提取模型之前,需要先对中心词提取模型进行训练,训练过程详见下述实施例。
图6是本申请实施例提供的一种模型训练方法的流程图。本申请实施例的执行主体为计算机设备,参见图6,该方法包括:
601、计算机设备获取样本语句及样本语句中的多个样本词语对应的样本概率。
其中,样本语句为任一语句,样本词语对应的样本概率用于表示对应的样本词语为样本语句的中心词的概率,获取多个样本词语对应的样本概率即为分别获取每个样本词语对应的样本概率。例如,样本语句的中心词的样本概率为1,除中心词之外的其他词语的样本概率为0。
另外,采用与中心词提取模型中的分词方式一致的方式,对样本语句进行分词,得到样本语句中的多个样本词语,以避免设置的多个样本词语与调用中心词提取模型得到的多个样本词语不一致。例如,计算机设备首先通过上述中心词提取模型中的分词层,对样本语句进行分词,输出分词结果,分词结果中包含上述多个样本词语,然后根据开发人员标注出的中心词,设置上述多个样本词语各自对应的样本概率。
602、计算机设备调用中心词提取模型,对样本语句进行处理,得到每个样本词语对应的预测概率。
在一种可能实现方式中,计算机设备调用中心词提取模型,对样本语句进行处理,得到每个样本词语对应的预测分值;对多个样本词语对应的预测分值进行归一化处理,得到每个样本词语对应的预测概率,以使多个样本词语对应的预测概率之和为1。也即是,计算机设备调用中心词提取模型,对样本语句进行处理,得到每个词语对应的预测匹配度,对多个样本词语对应的预测匹配度进行归一化处理,得到每个样本词语对应的预测概率,以使多个样本词语对应的预测概率之和为1。
例如,采用下述公式进行归一化处理:
其中,x是指中心词提取模型输出的预测分值,p是指归一化之后的预测概率,i表示样本词语在样本语句中的顺序,j表示样本语句中共包括j个样本词语,i、j为正整数,且i不大于j,x
i是指样本语句中第i个样本词语的预测分值,p
i是指样本语句中第i个样本词语的 预测概率。
可选地,为样本语句中的每个样本词语设置对应的样本词语标识,以表示样本词语在样本语句中的位置。
在本申请实施例中,计算机设备调用中心词提取模型,对样本语句进行处理,得到每个样本词语对应的预测概率的过程,与上述图2所示实施例中获取目标语句中的多个词语对应的概率的过程类似(对应上述步骤201至步骤207),此处不再赘述。
603、计算机设备根据每个样本词语对应的样本概率及对应的预测概率,训练中心词提取模型。
在一种可能实现方式中,计算机设备获取每个样本词语对应的样本概率与对应的预测概率的对数之间的乘积;将多个样本词语对应的乘积之和作为样本语句对应的损失值;根据损失值,训练中心词提取模型。
例如,采用下述交叉熵损失确定样本语句对应的损失值:
L=y
mlog(p
m)+(1-y
m)log(1-p
m);
其中,L表示损失值,m表示中心词在样本语句中的顺序,y
m为中心词的样本概率,p
m为中心词的预测概率。
在一种可能实现方式中,计算机设备获取损失值之后,根据该损失值的大小调整中心词提取模型的模型参数,以使调整后的中心词提取模型得到损失值减小,直至损失值逐渐减小至最小值,完成对中心词提取模型的训练。其中,最小值为0。
需要说明的一点是,本申请实施例仅是以损失函数为交叉熵为例进行说明,在另一实施例中,还可以采用其他损失函数,确定损失值。
需要说明的另一点是,本申请实施例仅是以上述基于列表式排序的训练方式为例进行说明,在另一实施例中,计算机设备还可以采用其他的训练方式训练中心词提取模型。例如,根据每个词语的样本概率与预测概率之间的差异,调整中心词提取模型的参数,以使样本概率与预测概率之间差异逐渐减小至最小值。
本申请实施例提供的方法,获取样本语句及样本语句中的多个样本词语对应的样本概率,调用中心词提取模型,对样本语句进行处理,得到每个样本词语对应的预测概率,根据每个样本词语对应的样本概率及对应的预测概率,训练中心词提取模型。本申请实施例提供了一种中心词提取模型的训练方式,该方法根据预测概率和样本概率训练中心词提取模型,提高了中心词提取模型的准确率。
并且,本申请实施例中,在训练中心词提取模型的过程中,设置样本语句中的多个样本词语的样本概率,不需要考虑选取哪一个词语为负样本,避免了对负样本的选择问题,降低了模型训练的难度。
需要说明的是,上述图2所示的实施例中调用中心词提取模型,从目标语句中提取中心词的计算机设备,与图6所示实施例中对中心词提取模型进行训练的计算机设备,是同一个计算机设备,或者是不同的计算机设备。
例如,上述图2所示实施例中的计算机设备为服务器或用户的终端,上述图6所示实施例中的计算机设备为开发人员的终端或服务器。或者,上述图2所示实施例中的计算机设备和图6所示实施例中的计算机设备是同一个服务器。
以图2所示实施例中的计算机设备是服务器,图6所示实施例中的计算机设备是开发人员的终端为例,请参考图7,其是本申请实施例提供的一种中心词提取模型训练及应用框架示意图。
如图7所示,在训练阶段,开发人员在终端701中部署待训练的中心词提取模块711,并设置训练数据集7021,该训练数据集7021中包含样本语句,以及预先标注的该样本语句中的各个样本词语对应的样本概率;终端701调用中心词提取模块711对训练数据集7021中 的样本语句进行处理,得到各个样本词语对应的预测概率731;然后,基于预测概率731,以及训练数据集7021中的样本概率计算损失值741,再根据损失值741对中心词提取模块711进行训练,重复上述过程,直至中心词提取模块711收敛,得到训练完成的中心词提取模块712,该中心词提取模块712可以被部署到服务器702中。
其中,上述服务器702是搜索场景下的搜索引擎对应的服务器,或者,是物品推荐场景或者物品识别场景下,具有物品推荐或者物品识别功能的应用程序对应的服务器。
在应用阶段,上述服务器702可以接收/获取目标语句722,并将目标语句722输入中心词提取模块712,经过中心词提取模块712的处理后,输出目标语句722中的各个词语对应的概率值732,并基于各个词语对应的概率值732,确定目标语句中的中心词742,并基于中心词742进行后续应用,比如,基于中心词742进行搜索、物品推荐、或者物品识别。
上述图1和图2所示的实施例仅是以调用中心词提取模型提取中心词为例进行说明,在另一实施例中,计算机设备可不调用中心词提取模型提取中心词。通过下述图8所示的实施例对不调用中心词提取模型提取中心词的过程进行详细说明。
图8是本申请实施例提供的一种中心词提取方法的流程图。该方法的执行主体为计算机设备,参见图8,该方法包括:
801、计算机设备获取目标语句的语句特征,以及目标语句中每个词语的词语特征。
802、计算机设备对目标语句的语句特征进行语义提取,得到目标语句的语义特征,以及分别对每个词语的词语特征进行语义提取,得到每个词语的语义特征。
803、计算机设备分别获取每个词语的语义特征与目标语句的语义特征之间的匹配度。
在一种可能实现方式中,计算机设备分别对每个词语的语义特征与所述目标语句的语义特征进行匹配,得到每个词语对应的差异语义特征;根据每个词语对应的差异语义特征,确定每个词语对应的匹配度。可选地,计算机设备分别对每个词语的语义特征与目标语句的语义特征进行相减处理,得到每个词语对应的所述差异语义特征。
可选地,计算机设备对每个词语对应的差异语义特征进行调整,得到调整后的差异语义特征;根据调整后得到的、每个词语对应的差异语义特征,获取每个词语对应的匹配度。
在另一种可能实现方式中,计算机设备分别对每个词语的语义特征与目标语句的语义特征进行相加处理,得到每个词语对应的融合语义特征;根据每个词语对应的融合语义特征,确定每个词语对应的匹配度。
可选地,计算机设备对每个词语对应的融合语义特征进行调整,得到调整后的融合语义特征;根据调整后得到的、每个词语对应的融合语义特征,获取每个词语对应的匹配度。
804、计算机设备将目标语句的多个词语中,对应的匹配度最大的词语确定为目标语句的中心词。
在一种可能实现方式中,计算机设备得到每个词语对应的匹配度之后,对多个词语对应的匹配度进行归一化处理,得到每个匹配度对应的概率,以使多个词语对应的概率之和为1,将多个概率中最大的概率对应的词语,确定为目标语句的中心词。
本申请实施例提供的方法,通过对提取的目标语句的语句特征和每个词语的词语特征进行语义提取,得到反映目标语句的语义的语义特征和反映词语的语义的语义特征,在充分理解了目标语句和目标语句中的词语的语义的基础上,获取的每个词语的语义特征与目标语句的语义特征之间的匹配度能够准确表示词语是否与目标语句匹配,从而根据该匹配度从目标语句中选取出对应的匹配度最大的词语作为中心词,提高了提取中心词的准确率。
图9是本申请实施例提供的一种中心词提取装置的结构示意图。参见图9,该装置包括:
特征提取模型901,用于获取目标语句的语句特征,以及目标语句中每个词语的词语特征;
语义特征提取模块902,用于对目标语句的语句特征进行语义提取,得到目标语句的语义特征,以及分别对每个词语的词语特征进行语义提取,得到每个词语的语义特征,目标语 句的语义特征用于表征目标语句的全局语义,词语的语义特征用于表征词语的局部语义;
匹配度获取模块903,用于分别获取每个词语的语义特征与目标语句的语义特征之间的匹配度;
中心词提取模块904,用于将目标语句的多个词语中,对应的匹配度最大的词语确定为目标语句的中心词。
本申请实施例提供的装置,通过对提取的目标语句的语句特征和每个词语的词语特征进行语义提取,得到反映目标语句的语义的语义特征和反映词语的语义的语义特征,在充分理解了目标语句和目标语句中的词语的语义的基础上,获取的每个词语的语义特征与目标语句的语义特征之间的匹配度能够准确表示词语与目标语句之间的匹配程度,从而根据该匹配度从目标语句中选取出对应的匹配度最大的词语作为中心词,提高了提取中心词的准确率。
在另一种可能实现方式中,参见图10,该装置还包括:
差异特征获取模块905,用于分别对每个词语的语义特征与目标语句的语义特征进行相减处理,得到每个词语对应的差异语义特征;
匹配度获取模块903,用于根据每个词语对应的差异语义特征,确定每个词语对应的匹配度。
在另一种可能实现方式中,匹配度获取模块903,还用于:
分别对每个词语的语义特征与目标语句的语义特征进行相加处理,得到每个词语对应的融合语义特征;
根据每个词语对应的融合语义特征,确定每个词语对应的匹配度。
在另一种可能实现方式中,参见图10,装置还包括:
差异特征调整模块,95,用于对每个词语对应的差异语义特征进行调整,得到调整后的差异语义特征;
匹配度获取模块903,还用于根据调整后得到的、每个词语对应的差异语义特征,获取每个词语对应的匹配度。
在另一种可能实现方式中,特征获取模块901,包括:
词语特征获取单元9011,用于按照映射关系,查询每个词语对应的词语特征,映射关系包括词语及对应的词语特征;
语句特征获取单元9012,用于按照多个词语在目标语句中的排列顺序,将查询到的多个词语特征进行组合,得到目标语句的语句特征。
中心词提取模块904,用于将多个概率中最大的概率对应的词语,确定为目标语句的中心词。
在另一种可能实现方式中,中心词提取模型中包含残差通路、主干通路、语义特征匹配层和输出层,其中,残差通路用于提取输入语句的语义特征,主干通路用于提取输入语句中每个词语的语义特征,语义特征匹配层和输出层用于获取输入语句中每个词语的语义特征与输入语句的语义特征之间的匹配度。
在另一种可能实现方式中,参见图10,该装置还包括:
样本获取模块906,用于获取样本语句及样本语句中每个样本词语对应的样本概率,样本概率用于表示对应的样本词语为样本语句的中心词的概率;
预测概率获取模块907,用于调用中心词提取模型,对样本语句进行处理,得到每个样本词语对应的预测匹配度;
预测概率获取模块907,还用于对多个样本词语对应的预测匹配度进行归一化处理,得到每个样本词语对应的预测概率,以使多个样本词语对应的预测概率之和为1;
模型训练模块908,用于根据每个样本词语对应的样本概率及对应的预测概率,训练中心词提取模型。
在另一种可能实现方式中,参见图10,模型训练模块908,用于:
获取每个样本词语对应的样本概率,与对应的预测概率的对数之间的乘积;
将多个样本词语对应的乘积之和作为样本语句对应的损失值;
根据损失值,训练中心词提取模型。
在另一种可能实现方式中,中心词提取模块904,用于:
对多个词语对应的匹配度进行归一化处理,得到每个匹配度对应的概率,以使多个词语对应的概率之和为1,概率用于表示对应的词语为目标语句的中心词的概率;
将多个概率中最大的概率对应的词语,确定为目标语句的中心词。
在另一种可能实现方式中,参见图10,该装置还包括:
分词模块909,用于对目标语句进行分词处理,得到目标语句包括的多个词语。
上述所有可选技术方案,可以采用任意结合形成本申请的可选实施例,在此不再一一赘述。
需要说明的是:上述实施例提供的中心词提取装置在提取中心词时,仅以上述各功能模块的划分进行举例说明,实际应用中,可以根据需要而将上述功能分配由不同的功能模块完成,即将计算机设备的内部结构划分成不同的功能模块,以完成以上描述的全部或者部分功能。另外,上述实施例提供的中心词提取装置与中心词提取方法实施例属于同一构思,其具体实现过程详见方法实施例,这里不再赘述。
下面以计算机设备为终端为例进行说明。图11示出了本申请一个示例性实施例提供的终端1100的结构示意图。终端1100包括有:处理器1101和存储器1102。
处理器1101可以包括一个或多个处理核心,比如4核心处理器、8核心处理器等。处理器1101可以采用DSP(Digital Signal Processing,数字信号处理)、FPGA(Field-Programmable Gate Array,现场可编程门阵列)、PLA(Programmable Logic Array,可编程逻辑阵列)中的至少一种硬件形式来实现。
存储器1102可以包括一个或多个计算机可读存储介质,该计算机可读存储介质可以是非暂态的。存储器1102还可包括高速随机存取存储器,以及非易失性存储器,比如一个或多个磁盘存储设备、闪存存储设备。在一些实施例中,存储器1102中的非暂态的计算机可读存储介质用于存储至少一个指令,该至少一个指令用于被处理器1101所具有以实现本申请中方法实施例提供的中心词提取方法。
在一些实施例中,终端1100还可选包括有:***设备接口1103和至少一个***设备。处理器1101、存储器1102和***设备接口1103之间可以通过总线或信号线相连。各个***设备可以通过总线、信号线或电路板与***设备接口1103相连。具体地,***设备包括:显示屏1104、摄像头组件1105、音频电路1106和电源1107中的至少一种。
本领域技术人员可以理解,图11中示出的结构并不构成对终端1100的限定,可以包括比图示更多或更少的组件,或者组合某些组件,或者采用不同的组件布置。
图12是本申请实施例提供的一种服务器的结构示意图,该服务器1200可因配置或性能不同而产生比较大的差异,可以包括一个或一个以上处理器(Central Processing Units,CPU)1201和一个或一个以上的存储器1202,其中,存储器1202中存储有至少一条指令,该至少一条指令由处理器1201加载并执行以实现上述各个方法实施例提供的方法。当然,该服务器还可以具有有线或无线网络接口、键盘以及输入输出接口等部件,以便进行输入输出,该服务器还可以包括其他用于实现设备功能的部件,在此不做赘述。
服务器1200可以用于执行上述中心词提取方法中服务器所执行的步骤。
本申请实施例还提供了一种计算机设备,该计算机设备包括处理器和存储器,存储器中存储有至少一条指令,该至少一条指令由处理器加载并执行如下操作:
获取目标语句的语句特征,以及目标语句中每个词语的词语特征;
对目标语句的语句特征进行语义提取,得到目标语句的语义特征,以及分别对每个词语的词语特征进行语义提取,得到每个词语的语义特征,目标语句的语义特征用于表征目标语 句的全局语义,词语的语义特征用于表征词语的局部语义;
分别获取每个词语的语义特征与目标语句的语义特征之间的匹配度;
将目标语句的多个词语中,对应的匹配度最大的词语确定为目标语句的中心词。
在一种可能实现方式中,该至少一条指令由处理器加载并执行如下操作:
分别对每个词语的语义特征与目标语句的语义特征进行相减处理,得到每个词语对应的差异语义特征;
根据每个词语对应的差异语义特征,确定每个词语对应的匹配度。
在一种可能实现方式中,该至少一条指令由处理器加载并执行如下操作:
分别对每个词语的语义特征与目标语句的语义特征进行相加处理,得到每个词语对应的融合语义特征;
根据每个词语对应的融合语义特征,确定每个词语对应的匹配度。
在一种可能实现方式中,该至少一条指令由处理器加载并执行如下操作:
对每个词语对应的差异语义特征进行调整,得到调整后的差异语义特征;
根据调整后得到的、每个词语对应的差异语义特征,获取每个词语对应的匹配度。
在一种可能实现方式中,该至少一条指令由处理器加载并执行如下操作:
按照映射关系,查询每个词语的词语特征,映射关系包括词语及对应的词语特征;
按照多个词语在目标语句中的排列顺序,对查询到的多个词语特征进行组合,得到目标语句的语句特征。
在一种可能实现方式中,方法基于中心词提取模型执行,中心词提取模型中包含残差通路、主干通路、语义特征匹配层和输出层,其中,残差通路用于提取输入语句的语义特征,主干通路用于提取输入语句中每个词语的语义特征,语义特征匹配层和输出层用于获取输入语句中每个词语的语义特征与输入语句的语义特征之间的匹配度。
在一种可能实现方式中,该至少一条指令由处理器加载并执行如下操作:
获取样本语句及样本语句中每个样本词语对应的样本概率,样本概率用于表示对应的样本词语为样本语句的中心词的概率;
调用中心词提取模型,对样本语句进行处理,得到每个样本词语对应的预测匹配度;
对多个样本词语对应的预测匹配度进行归一化处理,得到每个样本词语对应的预测概率,以使多个样本词语对应的预测概率之和为1;
根据每个样本词语对应的样本概率及对应的预测概率,训练中心词提取模型。
在一种可能实现方式中,该至少一条指令由处理器加载并执行如下操作:
获取每个样本词语对应的样本概率与对应的预测概率的对数之间的乘积;
将多个样本词语对应的乘积之和作为样本语句对应的损失值;
根据损失值,训练中心词提取模型。
在一种可能实现方式中,该至少一条指令由处理器加载并执行如下操作:
对多个词语对应的匹配度进行归一化处理,得到每个匹配度对应的概率,以使多个词语对应的概率之和为1,概率用于表示对应的词语为目标语句的中心词的概率;
将多个概率中最大的概率对应的词语,确定为目标语句的中心词。
在一种可能实现方式中,该至少一条指令由处理器加载并执行如下操作:
对目标语句进行分词处理,得到目标语句包括的多个词语。
本申请实施例还提供了一种计算机可读存储介质,该计算机可读存储介质中存储有至少一条指令,该至少一条指令由处理器加载并执行如下操作:
获取目标语句的语句特征,以及目标语句中每个词语的词语特征;
对目标语句的语句特征进行语义提取,得到目标语句的语义特征,以及分别对每个词语的词语特征进行语义提取,得到每个词语的语义特征,目标语句的语义特征用于表征目标语句的全局语义,词语的语义特征用于表征词语的局部语义;
分别获取每个词语的语义特征与目标语句的语义特征之间的匹配度;
将目标语句多个词语中,对应的匹配度最大的词语确定为目标语句的中心词。
在一种可能实现方式中,该至少一条指令由处理器加载并执行如下操作:
分别对每个词语的语义特征与目标语句的语义特征进行相减处理,得到每个词语对应的差异语义特征;
根据每个词语对应的差异语义特征,确定每个词语对应的匹配度。
在一种可能实现方式中,该至少一条指令由处理器加载并执行如下操作:
分别对每个词语的语义特征与目标语句的语义特征进行相加处理,得到每个词语对应的融合语义特征;
根据每个词语对应的融合语义特征,确定每个词语对应的匹配度。
在一种可能实现方式中,该至少一条指令由处理器加载并执行如下操作:
对每个词语对应的差异语义特征进行调整,得到调整后的差异语义特征;
根据调整后得到的、每个词语对应的差异语义特征,获取每个词语对应的匹配度。
在一种可能实现方式中,该至少一条指令由处理器加载并执行如下操作:
按照映射关系,查询每个词语的词语特征,映射关系包括词语及对应的词语特征;
按照多个词语在目标语句中的排列顺序,对查询到的多个词语特征进行组合,得到目标语句的语句特征。
在一种可能实现方式中,方法基于中心词提取模型执行,中心词提取模型中包含残差通路、主干通路、语义特征匹配层和输出层,其中,残差通路用于提取输入语句的语义特征,主干通路用于提取输入语句中每个词语的语义特征,语义特征匹配层和输出层用于获取输入语句中每个词语的语义特征与输入语句的语义特征之间的匹配度。
在一种可能实现方式中,该至少一条指令由处理器加载并执行如下操作:
获取样本语句及样本语句中每个样本词语对应的样本概率,样本概率用于表示对应的样本词语为样本语句的中心词的概率;
调用中心词提取模型,对样本语句进行处理,得到每个样本词语对应的预测匹配度;
对多个样本词语对应的预测匹配度进行归一化处理,得到每个样本词语对应的预测概率,以使多个样本词语对应的预测概率之和为1;
根据每个样本词语对应的样本概率及对应的预测概率,训练中心词提取模型。
在一种可能实现方式中,该至少一条指令由处理器加载并执行如下操作:
获取每个样本词语对应的样本概率与对应的预测概率的对数之间的乘积;
将多个样本词语对应的乘积之和作为样本语句对应的损失值;
根据损失值,训练中心词提取模型。
在一种可能实现方式中,该至少一条指令由处理器加载并执行如下操作:
对多个词语对应的匹配度进行归一化处理,得到每个匹配度对应的概率,以使多个词语对应的概率之和为1,概率用于表示对应的词语为目标语句的中心词的概率;
将多个概率中最大的概率对应的词语,确定为目标语句的中心词。
在一种可能实现方式中,该至少一条指令由处理器加载并执行如下操作:
对目标语句进行分词处理,得到目标语句包括的多个词语。
本申请实施例还提供了一种计算机程序,该计算机程序中存储有至少一条指令,该至少一条指令由处理器加载并执行,以实现上述实施例的中心词提取方法中所执行的操作。
本领域普通技术人员可以理解实现上述实施例的全部或部分步骤可以通过硬件来完成,也可以通过程序来指令相关的硬件完成,该程序可以存储于一种计算机可读存储介质中,上述提到的存储介质可以是只读存储器,磁盘或光盘等。
以上仅为本申请实施例的可选实施例,并不用以限制本申请实施例,凡在本申请实施例的精神和原则之内,所作的任何修改、等同替换、改进等,均应包含在本申请的保护范围之 内。
Claims (13)
- 一种中心词提取方法,所述方法由计算机设备执行,所述方法包括:获取目标语句的语句特征,以及所述目标语句中每个词语的词语特征;对所述目标语句的语句特征进行语义提取,得到所述目标语句的语义特征,以及分别对所述每个词语的词语特征进行语义提取,得到所述每个词语的语义特征,所述目标语句的语义特征用于表征所述目标语句的全局语义,所述词语的语义特征用于表征所述词语的局部语义;分别获取所述每个词语的语义特征与所述目标语句的语义特征之间的匹配度;将所述目标语句的多个词语中,对应的匹配度最大的词语确定为所述目标语句的中心词。
- 根据权利要求1所述的方法,其特征在于,所述分别获取所述每个词语的语义特征与所述目标语句的语义特征之间的匹配度,包括:分别对所述每个词语的语义特征与所述目标语句的语义特征进行相减处理,得到所述每个词语对应的差异语义特征;根据所述每个词语对应的差异语义特征,确定所述每个词语对应的匹配度。
- 根据权利要求1所述的方法,其特征在于,所述分别获取所述每个词语的语义特征与所述目标语句的语义特征之间的匹配度,包括:分别对所述每个词语的语义特征与所述目标语句的语义特征进行相加处理,得到所述每个词语对应的融合语义特征;根据所述每个词语对应的融合语义特征,确定所述每个词语对应的匹配度。
- 根据权利要求2所述的方法,其特征在于,所述分别对所述每个词语的语义特征与所述目标语句的语义特征进行相减处理,得到所述每个词语对应的差异语义特征之后,所述方法还包括:对所述每个词语对应的差异语义特征进行调整,得到调整后的差异语义特征;所述根据所述每个词语对应的差异语义特征,确定所述每个词语对应的匹配度,包括:根据调整后得到的、所述每个词语对应的差异语义特征,获取所述每个词语对应的匹配度。
- 根据权利要求1所述的方法,其特征在于,所述获取目标语句的语句特征,以及所述目标语句中的多个词语的词语特征,包括:按照映射关系,查询所述每个词语的词语特征,所述映射关系包括词语及对应的词语特征;按照所述多个词语在所述目标语句中的排列顺序,对查询到的多个词语特征进行组合,得到所述目标语句的语句特征。
- 根据权利要求1所述的方法,其特征在于,所述方法基于中心词提取模型执行,所述中心词提取模型中包含残差通路、主干通路、语义特征匹配层和输出层,其中,所述残差通路用于提取输入语句的语义特征,所述主干通路用于提取输入语句中每个词语的语义特征,所述语义特征匹配层和所述输出层用于获取输入语句中每个词语的语义特征与所述输入语句的语义特征之间的匹配度。
- 根据权利要求6所述的方法,其特征在于,所述中心词提取模型的训练过程包括:获取样本语句及所述样本语句中的每个样本词语对应的样本概率,所述样本概率用于表示对应的样本词语为所述样本语句的中心词的概率;调用所述中心词提取模型,对所述样本语句进行处理,得到所述每个样本词语对应的预测匹配度;对所述多个样本词语对应的预测匹配度进行归一化处理,得到所述每个样本词语对应的预测概率,以使所述多个样本词语对应的预测概率之和为1;根据所述每个样本词语对应的样本概率及对应的预测概率,训练所述中心词提取模型。
- 根据权利要求7所述的方法,其特征在于,所述根据所述每个样本词语对应的样本概率及对应的预测概率,训练所述中心词提取模型,包括:获取所述每个样本词语对应的样本概率与对应的预测概率的对数之间的乘积;将多个样本词语对应的乘积之和作为所述样本语句对应的损失值;根据所述损失值,训练所述中心词提取模型。
- 根据权利要求1所述的方法,其特征在于,所述将所述目标语句的多个词语中,对应的匹配度最大的词语确定为所述目标语句的中心词,包括:对所述多个词语对应的匹配度进行归一化处理,得到每个匹配度对应的概率,以使所述多个词语对应的概率之和为1,所述概率用于表示对应的词语为所述目标语句的中心词的概率;将多个概率中最大的概率对应的词语,确定为所述目标语句的中心词。
- 根据权利要求1所述的方法,其特征在于,所述获取目标语句的语句特征,以及所述目标语句中每个词语的词语特征之前,所述方法还包括:对所述目标语句进行分词处理,得到所述目标语句包括的多个词语。
- 一种中心词提取装置,其特征在于,所述装置包括:特征获取模块,用于获取目标语句的语句特征,以及所述目标语句中每个词语的词语特征;语义特征提取模块,用于对所述目标语句的语句特征进行语义提取,得到所述目标语句的语义特征,以及分别对所述每个词语的词语特征进行语义提取,得到所述每个词语的语义特征,所述目标语句的语义特征用于表征所述目标语句的全局语义,所述词语的语义特征用于表征所述词语的局部语义;匹配度获取模块,用于分别获取所述每个词语的语义特征与所述目标语句的语义特征之间的匹配度;中心词提取模块,用于将所述目标语句的多个词语中,对应的匹配度最大的词语确定为所述目标语句的中心词。
- 一种计算机设备,其特征在于,所述计算机设备包括处理器和存储器,所述存储器中存储有至少一条指令,所述至少一条指令由所述处理器加载并执行,以实现如权利要求1至10任一权利要求所述的中心词提取方法中所执行的操作。
- 一种计算机可读存储介质,其特征在于,所述计算机可读存储介质中存储有至少一条指令,所述至少一条指令由处理器加载并执行,以实现如权利要求1至10任一权利要求所述的中心词提取方法中所执行的操作。
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
US17/857,841 US20220343074A1 (en) | 2020-06-01 | 2022-07-05 | Headword extraction method and apparatus, device, and storage medium |
Applications Claiming Priority (2)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202010486516.7A CN111597823B (zh) | 2020-06-01 | 2020-06-01 | 中心词提取方法、装置、设备及存储介质 |
CN202010486516.7 | 2020-06-01 |
Related Child Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
US17/857,841 Continuation US20220343074A1 (en) | 2020-06-01 | 2022-07-05 | Headword extraction method and apparatus, device, and storage medium |
Publications (1)
Publication Number | Publication Date |
---|---|
WO2021244424A1 true WO2021244424A1 (zh) | 2021-12-09 |
Family
ID=72181713
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
PCT/CN2021/096762 WO2021244424A1 (zh) | 2020-06-01 | 2021-05-28 | 中心词提取方法、装置、设备及存储介质 |
Country Status (3)
Country | Link |
---|---|
US (1) | US20220343074A1 (zh) |
CN (1) | CN111597823B (zh) |
WO (1) | WO2021244424A1 (zh) |
Families Citing this family (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN111597823B (zh) * | 2020-06-01 | 2023-08-15 | 腾讯科技(深圳)有限公司 | 中心词提取方法、装置、设备及存储介质 |
Citations (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN105260359A (zh) * | 2015-10-16 | 2016-01-20 | 晶赞广告(上海)有限公司 | 语义关键词提取方法及装置 |
US20170228461A1 (en) * | 2016-02-04 | 2017-08-10 | Gartner, Inc. | Methods and systems for finding and ranking entities in a domain specific system |
CN110008401A (zh) * | 2019-02-21 | 2019-07-12 | 北京达佳互联信息技术有限公司 | 关键词提取方法、关键词提取装置和计算机可读存储介质 |
CN110633398A (zh) * | 2018-05-31 | 2019-12-31 | 阿里巴巴集团控股有限公司 | 中心词的确认方法、搜索方法、装置和存储介质 |
CN110795613A (zh) * | 2018-07-17 | 2020-02-14 | 阿里巴巴集团控股有限公司 | 商品搜索方法、装置、***及电子设备 |
CN111062210A (zh) * | 2019-12-25 | 2020-04-24 | 贵州大学 | 一种基于神经网络的谓语中心词识别方法 |
CN111597823A (zh) * | 2020-06-01 | 2020-08-28 | 腾讯科技(深圳)有限公司 | 中心词提取方法、装置、设备及存储介质 |
Family Cites Families (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20040122661A1 (en) * | 2002-12-23 | 2004-06-24 | Gensym Corporation | Method, system, and computer program product for storing, managing and using knowledge expressible as, and organized in accordance with, a natural language |
CN111125424B (zh) * | 2019-12-26 | 2024-01-09 | 腾讯音乐娱乐科技(深圳)有限公司 | 提取歌曲核心歌词的方法、装置、设备及存储介质 |
-
2020
- 2020-06-01 CN CN202010486516.7A patent/CN111597823B/zh active Active
-
2021
- 2021-05-28 WO PCT/CN2021/096762 patent/WO2021244424A1/zh active Application Filing
-
2022
- 2022-07-05 US US17/857,841 patent/US20220343074A1/en active Pending
Patent Citations (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN105260359A (zh) * | 2015-10-16 | 2016-01-20 | 晶赞广告(上海)有限公司 | 语义关键词提取方法及装置 |
US20170228461A1 (en) * | 2016-02-04 | 2017-08-10 | Gartner, Inc. | Methods and systems for finding and ranking entities in a domain specific system |
CN110633398A (zh) * | 2018-05-31 | 2019-12-31 | 阿里巴巴集团控股有限公司 | 中心词的确认方法、搜索方法、装置和存储介质 |
CN110795613A (zh) * | 2018-07-17 | 2020-02-14 | 阿里巴巴集团控股有限公司 | 商品搜索方法、装置、***及电子设备 |
CN110008401A (zh) * | 2019-02-21 | 2019-07-12 | 北京达佳互联信息技术有限公司 | 关键词提取方法、关键词提取装置和计算机可读存储介质 |
CN111062210A (zh) * | 2019-12-25 | 2020-04-24 | 贵州大学 | 一种基于神经网络的谓语中心词识别方法 |
CN111597823A (zh) * | 2020-06-01 | 2020-08-28 | 腾讯科技(深圳)有限公司 | 中心词提取方法、装置、设备及存储介质 |
Also Published As
Publication number | Publication date |
---|---|
CN111597823B (zh) | 2023-08-15 |
CN111597823A (zh) | 2020-08-28 |
US20220343074A1 (en) | 2022-10-27 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
WO2020082560A1 (zh) | 文本关键词提取方法、装置、设备及计算机可读存储介质 | |
WO2019136993A1 (zh) | 文本相似度计算方法、装置、计算机设备和存储介质 | |
CN107436875B (zh) | 文本分类方法及装置 | |
WO2020220539A1 (zh) | 数据增量方法、装置、计算机设备及存储介质 | |
CN109670163B (zh) | 信息识别方法、信息推荐方法、模板构建方法及计算设备 | |
KR20210104571A (ko) | 멀티 모달리티를 기반으로 하는 주제 분류 방법, 장치, 기기 및 저장 매체 | |
CN110008401B (zh) | 关键词提取方法、关键词提取装置和计算机可读存储介质 | |
WO2020140373A1 (zh) | 一种意图识别方法、识别设备及计算机可读存储介质 | |
CN114612759B (zh) | 视频处理方法、查询视频的方法和模型训练方法、装置 | |
US10474747B2 (en) | Adjusting time dependent terminology in a question and answer system | |
CN109815396B (zh) | 搜索词权重确定方法及装置 | |
KR20210091076A (ko) | 비디오를 처리하기 위한 방법, 장치, 전자기기, 매체 및 컴퓨터 프로그램 | |
US20210200802A1 (en) | Method and apparatus for video searches and index construction | |
US11120214B2 (en) | Corpus generating method and apparatus, and human-machine interaction processing method and apparatus | |
CN111639228B (zh) | 视频检索方法、装置、设备及存储介质 | |
CN114861889B (zh) | 深度学习模型的训练方法、目标对象检测方法和装置 | |
US20230154172A1 (en) | Emotion recognition in multimedia videos using multi-modal fusion-based deep neural network | |
US20230086735A1 (en) | Systems and methods for retrieving videos using natural language description | |
CN112434533B (zh) | 实体消歧方法、装置、电子设备及计算机可读存储介质 | |
CN108628911B (zh) | 针对用户输入的表情预测 | |
WO2021244424A1 (zh) | 中心词提取方法、装置、设备及存储介质 | |
CN111222316A (zh) | 文本检测方法、装置及存储介质 | |
CN111078884A (zh) | 一种关键词提取方法、装置及介质 | |
CN111126084A (zh) | 数据处理方法、装置、电子设备和存储介质 | |
US9715490B2 (en) | Automating multilingual indexing |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
121 | Ep: the epo has been informed by wipo that ep was designated in this application |
Ref document number: 21817827 Country of ref document: EP Kind code of ref document: A1 |
|
NENP | Non-entry into the national phase |
Ref country code: DE |
|
32PN | Ep: public notification in the ep bulletin as address of the adressee cannot be established |
Free format text: NOTING OF LOSS OF RIGHTS PURSUANT TO RULE 112(1) EPC (EPO FORM 1205A DATED 110423) |
|
122 | Ep: pct application non-entry in european phase |
Ref document number: 21817827 Country of ref document: EP Kind code of ref document: A1 |