Semantic recognition method and device and storage medium
By segmenting the text to be recognized into words and matching character features, the problems of accuracy and resource consumption in semantic recognition of AI models are solved, and efficient semantic recognition is achieved on low-capability terminals.
Patent Information
- Application Number
- CN202410667280.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-05-27
- Publication Date
- 2025-11-28
AI Technical Summary
Existing AI models are affected by the input text sequence during semantic recognition, resulting in decreased accuracy of output results and insufficient applicability to low-capability terminals.
By segmenting the text to be recognized into words, identifying the character features of words, and matching the same target words in the preset words, the semantics of the text to be recognized is determined based on the preset semantic recognition results of the target words, thus avoiding the model training process and saving resources.
It improves the accuracy and universality of semantic recognition, reduces processing resources and deployment costs, and makes semantic recognition methods applicable to low-capability terminals.
Smart Images

Figure CN121031603A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present disclosure relates to the technical field of computer, and particularly relates to a semantic recognition method and device and a storage medium. BACKGROUND
[0002] With the development of terminal technology and artificial intelligence (AI) technology, terminals carrying AI technology are gradually used in more and more applications, such as mobile phones loaded with dialogue assistants, smart cars, etc. And users also experience more AI services through terminals, such as dialogue with AI customer service in some clients.
[0003] In the related art, the semantic of the input text of the user is usually recognized based on an AI model, and the intention of the user is determined based on the recognition result, and then intelligent interaction with the user can be realized.
[0004] However, the AI model will be affected by the input text sequence in the actual application process, and then the accuracy of the final output result will be affected. SUMMARY
[0005] To overcome the problems in the related art, the present disclosure provides a semantic recognition method, device and storage medium.
[0006] According to a first aspect of an embodiment of the present disclosure, a semantic recognition method is provided, including performing word segmentation processing on a to-be-recognized text to obtain N to-be-recognized words of the to-be-recognized text and a word order between the N to-be-recognized words, wherein the N is an integer greater than or equal to 1; recognizing character features of each to-be-recognized word in the N to-be-recognized words, and determining N target words same as the N to-be-recognized words from a plurality of preset words based on the word order and the character features, wherein the N to-be-recognized words and the N target words correspond one-to-one, and the target words have a corresponding relationship with a preset semantic recognition result; determining a preset semantic recognition result corresponding to the N target words based on the N target words, and taking the preset semantic recognition result as a semantic recognition result of the to-be-recognized text.
[0007] In an implementation manner, determining the N target words same as the N to-be-recognized words from the plurality of preset words based on the word order and the character features includes: determining a preset word same as the character features of a to-be-recognized word as a same-character word; determining whether each same-character word and each corresponding to-be-recognized word are same, and if same, determining the same-character word as a target word of the to-be-recognized word.
[0008] In another implementation, the determining whether each homograph word is identical to each corresponding to-be-recognized word comprises: if the to-be-recognized word and the homograph word are of the same data type, and the character features of the to-be-recognized word set and the homograph word set are identical, the homograph word is identical to the corresponding to-be-recognized word; if the to-be-recognized word and the homograph word are of different data types, and / or the character features of the to-be-recognized word set and the homograph word set are different, the homograph word is different from the corresponding to-be-recognized word; wherein the data type comprises a text type or a parameter type, the to-be-recognized word set comprises an Nth to-be-recognized word and an (N+1)th to-be-recognized word, the homograph word set comprises a homograph word corresponding to the Nth to-be-recognized word and a next adjacent preset word of the homograph word.
[0009] In yet another implementation, in response to the to-be-recognized word and the target word being of different data types, and / or the character features of the to-be-recognized word set and the target word set being different, the method further comprises: establishing a new preset word based on the to-be-recognized word, and determining a preset semantic recognition result corresponding to the new preset word.
[0010] In yet another implementation, the method further comprises: determining whether the character features of the Nth to-be-recognized word and the character features of an Mth to-be-recognized word are identical, wherein M is an integer greater than 0 and less than N; if the character features of the Nth to-be-recognized word and the character features of the Mth to-be-recognized word are identical, a target word corresponding to the Mth to-be-recognized word is taken as a target word corresponding to the Nth to-be-recognized word.
[0011] According to a second aspect of the embodiments of the present disclosure, a semantic recognition device is provided, which comprises: a processing unit configured to perform a word segmentation processing on to-be-recognized text to obtain N to-be-recognized words of the to-be-recognized text and a word order between the N to-be-recognized words; recognize character features of each to-be-recognized word in the N to-be-recognized words, and determine N target words identical to the N to-be-recognized words from a plurality of preset words based on the word order and the character features; and determine a preset semantic recognition result corresponding to the N target words based on the N target words, and take the preset semantic recognition result as a semantic recognition result of the to-be-recognized text; wherein the N is an integer greater than or equal to 1, the N to-be-recognized words and the N target words correspond to each other, and the target word has a corresponding relationship with the preset semantic recognition result.
[0012] In an embodiment, the processing unit determines the N target words from the N to-be-recognized words from the plurality of preset words based on the word order and the character features in the following manner: determining a preset word with the same character features as a to-be-recognized word as a same-character word; and determining whether each same-character word is the same as each corresponding to-be-recognized word, and if so, determining the same-character word as the target word of the to-be-recognized word.
[0013] In another embodiment, the processing unit determines whether each same-character word is the same as each corresponding to-be-recognized word in the following manner: in a case where the data type of the to-be-recognized word is the same as that of the same-character word, and the character features of the to-be-recognized word set and the same-character word set are the same, the same-character word is the same as the corresponding to-be-recognized word; and in a case where the data type of the to-be-recognized word is different from that of the same-character word, and / or the character features of the to-be-recognized word set and the same-character word set are different, the same-character word is different from the corresponding to-be-recognized word; wherein the data type includes a text type or a parameter type, the to-be-recognized word set includes an Nth to-be-recognized word and an (N+1)th to-be-recognized word, the same-character word set includes the same-character word corresponding to the Nth to-be-recognized word and a next adjacent preset word of the same-character word.
[0014] In yet another embodiment, the processing unit is further configured to: establish a new preset word based on the to-be-recognized word, and determine a preset semantic recognition result corresponding to the new preset word.
[0015] In yet another embodiment, the processing unit is further configured to: determine whether the character features of the Nth to-be-recognized word are the same as those of an Mth to-be-recognized word, where M is an integer greater than 0 and less than N; and in a case where the character features of the Nth to-be-recognized word are the same as those of the Mth to-be-recognized word, determine the target word corresponding to the Mth to-be-recognized word as the target word corresponding to the Nth to-be-recognized word.
[0016] According to a third aspect of the embodiments of the present disclosure, an electronic device is provided, including: a processor; a memory for storing processor-executable instructions; wherein the processor is configured to execute the semantic recognition method in the first aspect or any one of the embodiments of the first aspect.
[0017] According to a fourth aspect of the embodiments of the present disclosure, a storage medium is provided, and the storage medium stores instructions, when the instructions in the storage medium are executed by a processor of a terminal, the terminal is enabled to execute the semantic recognition method in the first aspect or any one of the embodiments of the first aspect.
[0018] The technical scheme provided by the embodiment of the present disclosure can include the following beneficial effects: by performing word segmentation processing on the to-be-recognized text, the words of the to-be-recognized text and the word order between the segmented words are obtained, and based on the word order and the matching between the character features corresponding to the segmented words and the preset words, the target word corresponding to the word of the to-be-recognized text is determined, and the semantics of the word of the to-be-recognized text is determined based on the corresponding relationship between the target word and the preset semantic recognition result, and then the semantics of the to-be-recognized text is determined. Since the semantics is not involved in the process related to the model, the semantic recognition process can occupy less processing resources and deployment costs compared to the semantic recognition based on the model. Moreover, since the semantic recognition result of the to-be-recognized text is determined based on the semantic recognition result corresponding to the segmented words after the word segmentation processing on the to-be-recognized text, the accuracy of the semantic recognition result of the to-be-recognized text will not be affected by the sequence length of the to-be-recognized text, so that the semantic recognition method provided by the embodiment of the present disclosure has better universality.
[0019] It should be understood that the above general description and the following detailed description are only exemplary and explanatory, and cannot limit the present disclosure. BRIEF DESCRIPTION OF DRAWINGS
[0020] The accompanying drawings, which are incorporated into and form part of the specification, illustrate an embodiment consistent with the present disclosure and, together with the specification, serve to explain the principles of the present disclosure.
[0021] Figure 1 is a flowchart of a semantic recognition method according to an exemplary embodiment.
[0022] Figure 2 is a flowchart of a method for determining a target word according to an exemplary embodiment.
[0023] Figure 3 is a flowchart of a method for determining a target word according to an exemplary embodiment.
[0024] Figure 4 is a flowchart of a semantic recognition method according to an exemplary embodiment.
[0025] Figure 5 is a flowchart of a semantic recognition method according to an exemplary embodiment.
[0026] Figure 6 is a flowchart of a semantic recognition method according to an exemplary embodiment.
[0027] Figure 7 is an example diagram of a semantic recognition method according to an exemplary embodiment.
[0028] Figure 8is a block diagram of a semantic recognition device according to an exemplary embodiment.
[0029] Figure 9 is a block diagram of a device for semantic recognition according to an exemplary embodiment.
[0030] Figure 10 is a block diagram of a device for semantic recognition according to an exemplary embodiment. DETAILED DESCRIPTION
[0031] The exemplary embodiments will be described in detail herein with reference to the attached drawings. In the following description, the same numbers refer to the same elements throughout the drawings. The following exemplary embodiments are not intended to represent all embodiments in accordance with the present disclosure.
[0032] With the development of terminal technology and artificial intelligence (AI) technology, terminals carrying AI technology are gradually used in more and more applications, such as mobile phones loaded with dialogue assistants, smart cars, etc. And users also feel more AI services through terminals, such as dialogue with AI customer service in some clients.
[0033] It can be understood that in the above AI technology application scenarios, AI technology is usually used to understand the user's needs and provide corresponding feedback based on the user's needs. For the above scenarios, intent recognition technology is usually used. In related technologies, for intent recognition, it can be implemented based on the following -1) or -2) two ways.
[0034] -1) based on recurrent neural network (RNN, RNN) implementation.
[0035] -2) based on convolutional neural network (CNN) implementation.
[0036] For -1), the implementation process may, for example, include the following steps (-1-1~-1-7):
[0037] In step -1-1), the input text sequence is preprocessed. For example, converting the text sequence into a form acceptable to the neural network involves mapping each word to a vector representation, which can be a pre-trained word embedding or a model learned parameter.
[0038] In step-1-2), the context information of the input text sequence is determined. For example, a recurrent neural network has an internal loop structure that can capture sequence information. One major advantage of RNN is that it can propagate back in time, enabling the network to take into account the context information of previous inputs.
[0039] In step-1-3), the input text sequence is processed in time steps to pass context information. For example, for each time step, i.e. each input word or token, the RNN receives the current input and the hidden state of the previous time step, and outputs the hidden state of the current time step. This hidden state contains information of all previous time steps, thus passing context information in the sequence.
[0040] In step-1-4), the output performs intent classification. For example, after the sequence processing is completed, the final hidden state can be input to a fully connected layer, and the final output layer is used to perform intent classification. This output layer usually uses a softmax activation function to output a probability distribution for each possible intent.
[0041] In step-1-5), the difference between the output and the actual is determined. For example, a suitable loss function is selected, usually cross-entropy loss, to measure the difference between the model output and the actual intent label.
[0042] In step-1-6), backpropagation is performed. For example, a training set with labeled data is used for training. Through optimization algorithms such as backpropagation and gradient descent, the parameters of the model are adjusted to minimize the loss function.
[0043] In step-1-7), the neural network model after backpropagation is tested and inferred. For example, in the test phase, by providing new text sequences to the model, the already trained model can be used for intent recognition inference. The model will output a probability distribution, and then select the intent with the highest probability as the final prediction.
[0044] RNN is very sensitive to the length of the input sequence, and when the sequence is very long, the model may not be able to capture key context information, resulting in performance degradation.
[0045] For-2), its implementation process may include the following steps (-1-1~ -1-7):
[0046] In step-2-1), the input text sequence is preprocessed. For example: convert the text sequence into a computer processable form. For example, it can be mapped to a vector representation (similar to the method in RNN). These vectors can be pre-trained word embeddings or model learned parameters.
[0047] In step-2-2), local features are detected. For example, CNN uses convolutional layers to detect local features of different sizes. For text, the convolution operation can be seen as sliding a convolution kernel over the input text, thereby capturing local syntactic and semantic features. The size of the convolution kernel determines the range of context captured.
[0048] In step-2-3), the features are reduced in dimension. For example, after convolution, a pooling layer is often used to reduce the dimensionality of the representation. Max-pooling is a common choice that selects the maximum value from the output of each convolution operation to retain the most salient features.
[0049] In step-2-4), intent classification is determined. For example, after a series of convolution and pooling layers, the output can be passed to a fully connected layer, which is ultimately used to perform intent classification. Similar to the approach in RNN, this layer can use a softmax activation function to output a probability distribution over each possible intent.
[0050] In step-2-5), the difference between the output and the actual is determined. For example, a suitable loss function, usually cross-entropy loss, is chosen to measure the difference between the model's output and the actual intent label.
[0051] In step-2-6), backpropagation is performed. For example, a training set with labeled data is used for training. Through optimization algorithms such as backpropagation and gradient descent, the parameters of the model are adjusted to minimize the loss function.
[0052] In step-2-7), the neural network model after backpropagation is tested and inferred. For example, in the testing phase, by providing new text sequences to the model, the already trained model can be used for intent recognition inference. The model will output a probability distribution, and then select the intent with the highest probability as the final prediction.
[0053] And it can be understood that multi-channel convolution can also be used to capture features of different ranges with different size convolution kernels to help the model better understand language structures at different levels.
[0054] And it can be known that, for both -1) or -2), both can achieve semantic recognition, which depends on the training results of the model. Therefore, both have a large dependence on training information. Therefore, a large amount of training cost may be invested in actual application. And for the above -1) or -2), both are implemented by using the corresponding training model, which requires a large amount of processing resources or network resources of the terminal. Thus, it is not suitable for some low-capability terminals (such as RedCap type terminals, or terminals used as Internet of Things devices).
[0055] To address the aforementioned technical problems, this disclosure proposes a semantic recognition method. This method involves identifying the corresponding character features of the segmented text obtained after word segmentation and comparing them with preset target words. Based on the semantic recognition results corresponding to the target words, the processing result of the word to be recognized is determined. Because this semantic recognition method directly compares the text to be recognized with preset target words, it saves on training costs, processing resources, and network resources compared to the model training process in related technologies. This allows the semantic recognition method provided by this disclosure to be applicable to some low-capacity terminals.
[0056] Figure 1 This is a flowchart illustrating a semantic recognition method according to an exemplary embodiment, such as... Figure 1 As shown, the semantic recognition method used in the terminal includes the following steps.
[0057] In step S11, the text to be identified is segmented to obtain N words to be identified and the word order among the N words.
[0058] In step S12, the character features of each of the N words to be identified are identified, and based on the word order and character features, N target words that are the same as the N words to be identified are determined from a number of preset words.
[0059] In step S13, based on N target words, the preset semantic recognition results corresponding to the N target words are determined, and the preset semantic recognition results are used as the semantic recognition results of the text to be recognized.
[0060] In some embodiments, N is an integer greater than or equal to 1.
[0061] In some embodiments, N words to be identified correspond one-to-one with N target words.
[0062] In this embodiment, the text to be identified is segmented to obtain the words and their word order. Based on the word order and the character features corresponding to the identified words, a match is made with preset words to determine the target words corresponding to the words in the text to be identified. The semantics of the words in the text to be identified are then determined based on the correspondence between the target words and the preset semantic recognition results, thereby determining the semantics of the text to be identified. Since the semantics process does not involve any related models, it consumes fewer processing resources and has lower deployment costs compared to model-based semantic recognition. Furthermore, because the semantic recognition result of the text to be identified is determined by the semantic recognition results corresponding to the segmented words after segmentation, the accuracy of the semantic recognition result is not affected by the length of the text sequence, making the semantic recognition method provided in this embodiment more universal.
[0063] In some embodiments, word segmentation is performed on the text to be recognized, and different word segmentation rules can be applied in different application scenarios.
[0064] For example, word segmentation rule (1) can be to segment the text to be recognized into words, and the resulting words can be a single Chinese character. Taking the text to be recognized as "I want to eat an apple" as an example, after word segmentation, the following words can be obtained: "I", "want", "eat", "one", "a", "apple", "fruit".
[0065] For example, in different scenarios, word segmentation rule (ii) can be determined based on high-frequency words (or preset words). Continuing with the text to be identified in the above embodiments, after word segmentation, the following words can be obtained: "I want", "eat", "one", "a", "apple". Among them, "I want" and "apple" are the determined high-frequency words.
[0066] It is clear that segmenting words based on preset words can reduce the number of words to be segmented to a certain extent, thereby reducing the resource consumption of subsequent semantic recognition while ensuring the accuracy of semantic recognition results.
[0067] In this way, by performing different word segmentation processes on the text to be recognized in different scenarios, corresponding words can be obtained, and the semantic recognition result of the text to be recognized can be determined based on the obtained word segmentation in the subsequent process.
[0068] It should be noted that, in the embodiments of this disclosure, the acquisition of the text to be recognized can be based on the acquisition of information containing the text to be recognized from the input terminal (e.g., text information or voice information from the input terminal. If it is voice information, the terminal can extract the voice content based on the voice information to obtain the text to be recognized), or the terminal can acquire the text to be recognized itself (e.g., the terminal scans the object to be scanned based on a corresponding scanning device to obtain the text to be recognized corresponding to the scanned object).
[0069] It should also be noted that the text to be identified can be, for example, Chinese text, or text other than Chinese (e.g., English text, Japanese text, etc.). However, for ease of understanding, this disclosure uses Chinese text as an example for illustration.
[0070] In some embodiments, the character features of a word can be understood as features used to characterize word segmentation properties. These features can be the pronunciation features of the word or other features of the word.
[0071] Optionally, the character features can be user-defined character features.
[0072] For example, the pronunciation features of a word, such as the word's pinyin (if the word is in Chinese, it is pinyin; if the word is in Japanese, it is the 50 sounds; if the word is in English, it is phonetic symbols, etc.).
[0073] For example, continuing with the text to be identified as "I want to eat an apple", the words to be identified after segmentation using word segmentation rule (1) can have pronunciation features that can be pinyin strings, specifically as follows (the pronunciation features of the words are in parentheses):
[0074] “I”, “want”, “eat”, “one”, “a”, “apple”, “fruit”.
[0075] Similarly, it is understandable that if the text to be identified is Japanese, the words to be identified after segmentation using segmentation rule (1) can have pronunciation features that are Japanese syllabary strings. Detailed examples will not be repeated here.
[0076] For example, other features of a word can be understood as features of word segmentation other than pronunciation features. Other features may include the word's ASCII code value, or other defined feature values, etc.
[0077] In this embodiment of the disclosure, by identifying the character features corresponding to the word to be identified, the text to be identified can be converted into character features that the terminal can recognize, and subsequent comparison between the character features and the word to be identified and preset words can be realized.
[0078] In some embodiments, when performing word segmentation on the text to be recognized, it can be based on the word order of the text to be recognized.
[0079] For example, continuing with the above text to be recognized "I want to eat an apple" as an example, based on word segmentation rule (1) or word segmentation rule (2), the word order between the words obtained after word segmentation is the same as the word order of the text to be recognized. That is, this word segmentation process is based on the word order of the text to be recognized.
[0080] In this way, during the process of sequentially matching target words for the segmented words, the word order of the words in the original text to be recognized can be ensured, so that the word order of the matched target words is consistent with the word order of each word in the original text to be recognized, improving the accuracy of semantic recognition.
[0081] However, in some embodiments, after word segmentation of the text to be recognized, the word order of the words can also be adjusted, then the corresponding character features are recognized based on the segmented words with adjusted word order, and based on the adjusted word order and character features, the target word identical to the word to be recognized is determined among multiple segmented words.
[0082] For example, the text to be recognized is "I want an apple to eat". After word segmentation based on word segmentation rule (1), the segmented words should be as follows: "I", "want", "one", "a", "apple", "eat". The terminal can perform corresponding reasoning or comparison based on the word order of the segmented words after splitting (for example, call the corresponding word order reasoning model to perform reasoning on the correct word order based on semantics, or compare with the preset word order of the segmented words, etc.), and re-adjust the word order of the segmented words based on the reasoning or comparison, obtaining the segmented words with adjusted word order "I", "want", "eat", "one", "a", "apple". And determine the corresponding character features "I(wo)", "want(xiang)", "eat(chi)", "one(yi)", "a(ge)", "apple(ping)" based on the adjusted segmented words.
[0083] In some embodiments, it can also be to first adjust the word order of the text to be recognized, then perform word segmentation on the text to be recognized with adjusted word order to obtain the word to be recognized with adjusted word order, and then determine the target word identical to the word to be recognized among multiple words based on the character features of the word to be recognized and the adjusted word order.
[0084] For example, the text to be recognized is "I want an apple to eat". The terminal performs semantic recognition on it. After recognition, it is considered that the semantic meaning the text to be recognized wants to express is "I want to eat an apple". Then, the word order of the text to be recognized is adjusted. "I want an apple to eat" is adjusted to "I want to eat an apple". And the adjusted "I want to eat an apple" is segmented, and the words obtained are as follows: "I", "want", "eat", "one", "piece", "apple", "fruit". And the character features corresponding to the segmented words are determined as "I(wo)", "want(xiang)", "eat(chi)", "one(yi)", "piece(ge)", "apple(ping)", "fruit(guo)".
[0085] It can be understood that by adjusting the word order of the words to be recognized after segmenting the text to be recognized, or the words after adjusting the word order of the text to be recognized, it is possible to correct the text to be recognized with grammar errors or unclear semantic expressions, so that the final semantic recognition result is more accurate.
[0086] In some embodiments, for the preset words, they can be preset words set before the terminal leaves the factory and imported into the terminal before the terminal leaves the factory.
[0087] For the preset words, for example, they can be preset words independently set for different application scenarios. And different application scenarios can be, for example, the application scenarios where users use different types of application programs.
[0088] Exemplarily, different application scenarios can be at least one of the following 1 to 3:
[0089] 1: The scenario where the terminal performs semantic recognition on the user when the user uses a shopping application program (for example, A Cat, B Dong, or C Duo Duo, etc.).
[0090] 2: The scenario where the terminal performs semantic recognition on the user when the user uses a life application program (for example, D Group or E Eats, etc.).
[0091] 3: The scenario where the terminal performs semantic recognition on the user when the user uses a system operation application program (for example, F Guard or G Assistant, etc.).
[0092] It can be understood that, for some word segments, their intended semantics may be different even when their character features are the same. Taking the preset word "book a table" as an example, in application scenario 2, the understood semantics of this word segment may be "book a dining seat during a visit through D Group". And in application scenario 1, the understood semantics of this word may be "order a table in a furniture mall through A Cat". Therefore, for different application scenarios, it is necessary to separately set the preset words and the corresponding semantic recognition results of the preset words in that scenario. That is, in different application scenarios, the correspondence between the preset words and the preset semantic recognition results may be different, and the correspondence between the preset words and the preset semantic recognition results needs to be set separately.
[0093] Based on this, in some embodiments, before determining N target words that are the same as N words to be recognized among multiple preset words, the application scenario corresponding to the text to be recognized can also be determined. For example, determine the application scenario corresponding to the text to be recognized through the application program enabled by the terminal, or determine the application scenario corresponding to the text to be recognized based on the context semantic association of the user's conversation. After determining the application scenario corresponding to the text to be recognized, determine the target words corresponding to the words of the text to be recognized in that application scenario based on the preset words corresponding to the application scenario.
[0094] In this way, semantic recognition of the text to be recognized combined with the application scenario can be achieved, further improving the accuracy of the semantic recognition result.
[0095] In some embodiments, determining N target words that are the same as N words to be recognized among multiple preset words can be, for example, by way of screening, select N preset words in multiple preset words that have the same word order and character features as the N words to be recognized, and determine them as target words, where there is a correspondence between the preset words and the preset semantic results.
[0096] For example, in the above scenario 3, the pinyin features corresponding to the word segment of the text to be recognized are "dian" "ji", then screen the preset words with pinyin features "dian" "ji" among multiple preset words, assuming the found preset word is "click", whose corresponding pinyin features are the same as those of the words in the text to be recognized, then determine "click" as the target word, and "click" will correspond to a preset semantic result.
[0097] It can be understood that the correspondence between each preset word and the preset semantic result can be a relationship where multiple preset words correspond to one preset semantic recognition result.
[0098] For example, continuing from the above embodiments, in scenario 1, if the word segmentation is "buy" and "purchase", the semantic results they express can be the same, both indicating that through A-cat, B-JD, or C-Pinduoduo, the user's resources (e.g., coins, points, etc.) are exchanged for the merchant's resources (e.g., objects, targets, etc.). For example, in scenario 3, if the word is "dot" and the word is "click", the semantics they express can also be the same, both indicating that through F-Guard or G-Assistant, a certain object (e.g., an application icon, or a display interface button, etc.) is touched.
[0099] It is understandable that since the target words are obtained by filtering from the preset words, the target words and the preset semantic recognition results will also have the above relationship. That is, multiple target words correspond to one preset semantic recognition result. Therefore, it is possible to determine the corresponding preset semantic recognition result through the target words.
[0100] For example, in scenario 3 of the above embodiment, the preset semantic recognition results corresponding to the target word "click" and the target word "point" are the same.
[0101] In some embodiments, using the preset semantic recognition result as the semantic recognition result of the text to be recognized can be achieved by directly using the preset semantic recognition result corresponding to the target word as the preset semantic recognition result of the text to be recognized, or by splicing and fusing the preset semantic recognition results corresponding to multiple target words, etc., to obtain the semantic recognition result of the text to be recognized.
[0102] For example, if the input text sequence to be recognized is short enough, such as only being segmented into one word, then the preset semantic recognition result corresponding to the target word is the semantic recognition result of the text to be recognized. If the input text sequence to be recognized is long enough, such as being segmented into multiple words (more than one word), then each of the multiple words to be recognized will correspond to a target word. Each target word will also correspond to a preset semantic recognition result, meaning multiple target words will correspond to multiple preset semantic recognition results. Therefore, the semantic recognition result of the text to be recognized is the fusion result of the semantic recognition results corresponding to multiple target words.
[0103] For example, if the target word pair is only "purchase", and the preset semantic recognition result for "purchase" is "pay to purchase", then the semantic recognition result for the corresponding text to be recognized is "pay to purchase". If the target words are "purchase", "one", and "table", and the preset semantic recognition result for "purchase" is "pay to purchase", the preset semantic recognition result for "one" is "one", and the preset semantic recognition result for "table" is "home table", then the semantic recognition result for the corresponding text to be recognized can be the fusion result of the semantic recognition results corresponding to multiple target words, that is, "pay to purchase one home table".
[0104] In this embodiment, for multiple target words corresponding to preset semantic recognition results, the preset semantic recognition results can be fused and used as the semantic recognition result of the text to be recognized, thereby achieving semantic recognition of long text sequences. Furthermore, no related training model is used in the semantic recognition process of long text sequences, thus reducing the consumption of terminal processing resources and the overhead of semantic training.
[0105] The semantic recognition method disclosed in this embodiment may include at least one of steps S11 to S13. For example, step S11 may be implemented as an independent embodiment, step S12 may be implemented as an independent embodiment, step S13 may be implemented as an independent embodiment, and step S11+step S12+step S13 may be implemented as an independent embodiment, but is not limited thereto.
[0106] In some embodiments, steps S11 and S12 are optional, and one or more of these steps may be omitted or substituted in different embodiments.
[0107] In some embodiments, steps S11 and S13 are optional, and one or more of these steps may be omitted or substituted in different embodiments.
[0108] In some embodiments, steps S12 and S13 are optional, and one or more of these steps may be omitted or substituted in different embodiments.
[0109] Understandably, after segmenting the text to be recognized into N words, the question arises as to how to determine the N target words corresponding to these N words. This can be achieved using methods such as... Figure 2 This is achieved through this method.
[0110] Figure 2 This is a flowchart illustrating a method for determining target words according to an exemplary embodiment, such as... Figure 2 As shown, the semantic recognition method includes the following steps.
[0111] In step S21, preset words with the same character features as the word to be identified are identified as words with the same characters.
[0112] In step S22, it is determined whether each word with the same character is the same as each word to be identified. If they are the same, the word with the same character is identified as the target word of the word to be identified.
[0113] In this embodiment of the disclosure, if the character features of the word to be identified are found to be the same as those of a preset word, it is further determined whether the word with the same character is the same as the word to be identified, thereby determining the target word corresponding to the word to be identified.
[0114] In some embodiments, the word to be identified can be compared with the character features of preset words one by one in word order.
[0115] Understandably, as mentioned above Figure 1 As described in the relevant embodiments, preset words can be set independently in different application scenarios. In the same application scenario, preset words may have the same character feature corresponding to different preset words.
[0116] For example, taking application scenario 3 above as an example, in this scenario, there may be related words such as "click" or "power". Therefore, the preset words may include "dot" and "electricity". It is understandable that for "dot" and "electricity", the corresponding character features (in this example, the character features are pinyin features) are the same, both being "dian". When the character feature corresponding to the word to be identified is also "dian", then "dot" in the preset word can be regarded as a word with the same character relative to the word to be identified, and "electricity" in the preset word can also be regarded as a word with the same character relative to the word to be identified. Therefore, when the character features are the same, it is necessary to further determine whether the word with the same character is the same as the word to be identified. That is, when the character feature is "electricity", the word with the same character is "electricity", that is, the two are the same, and it can be identified as the target word; the word with the same character is "dot", that is, the two are different, and "dot" cannot be identified as the target word.
[0117] In some embodiments, if the word with the same character is different from the target word of the word to be identified, the semantic recognition of subsequent words can be terminated.
[0118] Understandably, if it is determined that the current word with the same character is different from the word to be identified, it can be assumed that there is a high probability that no word segment matching the word to be identified has been found in the preset words. In this case, subsequent recognition can be paused to avoid matching the wrong semantic recognition result.
[0119] In some embodiments, if the word with the same character is different from the target word of the word to be identified, the word with the same character can be skipped in the preset words for the current word to be identified, and the target word can be further determined.
[0120] Understandably, if it is determined that the current word with the same character is different from the word to be identified, it can be considered that there is a high probability that no matching word has been found in the current preset words. Continuing the above embodiment, for example, if the preset words include both "dot" and "electricity", and the word to be identified is "electricity", the word to be identified is identified one by one in the preset words. Only "dot" is identified to a limited extent, but the two are not the same. In this case, "dot" can be skipped, and "electricity" can be further identified in the preset words until the same preset word is identified, or all preset words have been identified.
[0121] This avoids the problem of the word to be identified matching the wrong target word, which would lead to errors in semantic recognition. It also prevents the recognition process from being paused due to incomplete recognition, thus affecting the accuracy of the semantic recognition results.
[0122] The semantic recognition method disclosed in this embodiment may include at least one of steps S21 to S22. For example, step S21 may be implemented as a separate embodiment, step S22 may be implemented as a separate embodiment, or step S21 + step S22 may be implemented as a separate embodiment, but is not limited thereto.
[0123] In some embodiments, step S21 is optional, and one or more of these steps may be omitted or substituted in different embodiments.
[0124] In some embodiments, step S22 is optional, and one or more of these steps may be omitted or substituted in different embodiments.
[0125] Understandably, to determine whether a word with the same characters is the same as the word to be identified, one could use methods such as... Figure 3 This is achieved through this method. Figure 3 This is a flowchart illustrating a method for determining target words according to an exemplary embodiment, such as... Figure 3 As shown, the semantic recognition method includes the following steps.
[0126] In step S31, it is determined whether the data types of the word to be identified are the same as those of the word with the same character, and whether the character features of the set of words to be identified are the same as those of the set of words with the same character.
[0127] In step S32, if the word to be identified has the same data type as the word with the same character, and the set of words to be identified has the same character features as the set of words with the same character, then the word with the same character is the same as the corresponding word to be identified.
[0128] In step S33, if the data type of the word to be recognized is different from that of the same-character word, and / or the character features of the word set to be recognized are different from those of the same-character word set, then the same-character word is different from the corresponding word to be recognized.
[0129] In some embodiments, the data type includes a text type or a parameter type.
[0130] In some embodiments, the word set to be recognized includes the Nth word to be recognized and the (N + 1)th word to be recognized, and the same-character word set includes the same-character word corresponding to the Nth word to be recognized and the next adjacent preset word of the same-character word.
[0131] In the embodiments of the present disclosure, by comparing the types of the word to be recognized and the same-character word and combining the context before and after the word to be recognized for comparison, it can be determined whether the same-character word is the same as the word to be recognized, thereby improving the semantic recognition accuracy of the text to be recognized.
[0132] It should be noted that for the parameter type, for example, it can be a number used to describe the numerical size. In the text to be recognized, there is usually a situation where numerical text and non-numerical text coexist. For example, "buy a piece of clothing". The "one" in it can be understood as the data of the above parameter type, while "buy", "piece", "clothes", and "dress" can be understood as the data of the text type. In the text to be recognized, there may be a situation where the character features of the parameter type data and the text type data are the same. Therefore, it is necessary to distinguish them.
[0133] Then, regarding how to recognize the parameter type data and the text type data in the word to be recognized.
[0134] In some embodiments, it can be understood that usually, the number of words of the parameter type data in the word to be recognized is relatively small compared to the number of words of the text type data. Therefore, for the words of the parameter type data, they are usually surrounded by the text type data before and after.
[0135] It can also be understood that for parameter types, they may appear with certain patterns in different application scenarios. For example, in the above application scenario 1, the parameter type may appear twice. Then, the words following the parameter type may be "piece", "unit", "set", etc. And before the parameter type in application scenario 1, there may be preset words such as "buy" and "order". Therefore, in the preset words, relevant descriptive phrases can be set for the words of the parameter type, such as "buy a set", "order a piece", etc. In this way, in application scenario 1, when "buy" and "order" are recognized, if the character feature of the recognized character is "yi", it can be preliminarily determined that "yi" is data of the parameter type, such as "one". Further, when the character features of the words to be recognized after "yi" correspond to "tao" and "jian" etc. (based on the character features, the corresponding preset words can be determined as "set" and "piece" respectively), and there is a preset word "buy a set" or "order a piece" in the preset words, it can be determined that the word corresponding to the same character as "yi" is "one" rather than "clothes" (because there will be no "clothes set" or "clothes piece" in the preset words). Therefore, by performing character feature recognition on the sequence of words to be recognized in combination with the context, it can be determined whether a certain word to be recognized in the sequence of words to be recognized is a word of the parameter type.
[0136] Therefore, in the above embodiment, when the word to be recognized in the segmented words is recognized as "one", the determined word corresponding to the same character "one" has the same data type as the word to be recognized "one", both being of the parameter type.
[0137] For another example, when the text to be recognized is "buy a set of clothes", if it is necessary to determine the data type of "clothes", in the case of recognizing its corresponding character feature "yi", it can be compared in combination with the word order context. The preset word corresponding to the word order above "yi" is "set", the character feature of the word to be recognized corresponding to the word order below "yi" is "fu", and there is a preset word "clothes" in the preset words, then it can be determined that the preset word corresponding to "yi" is "clothes". Therefore, when the word to be recognized is recognized as "clothes", if the word corresponding to the same character as "yi" is recognized as "one", their data types are different.
[0138] It can be understood that in the above embodiment, for the determination of the type of the word to be recognized, it is achieved by combining the context of the word to be recognized. For the context of the word to be recognized, it can be jointly determined with the word to be recognized as a set of words to be recognized.
[0139] In some embodiments, the set of words to be recognized includes at least one of the following: the word to be recognized and the segmented words above the word order of the word to be recognized; the word to be recognized and the segmented words below the word order of the word to be recognized.
[0140] For example, when the word to be recognized is the Nth word to be recognized, the set of words to be recognized includes at least one of the following: the Nth word to be recognized and the (N - 1)th word to be recognized; the Nth word to be recognized and the (N + 1)th word to be recognized, where N is an integer greater than or equal to 1.
[0141] Continuing with the above embodiment, taking a text to be recognized "buy a set of clothes" as an example, if the Nth word to be recognized is "a", then the (N - 1)th word to be recognized is "buy", and the (N + 1)th word to be recognized is "set".
[0142] It can be understood that, based on the description of the preset words in the above embodiment, there is also a sequential word order association relationship for some preset words. For example, when the preset word is "clothes", "fu" is the preset word adjacent to the later word order of "yi" (that is, the next adjacent preset word). When "yi" is determined to be a same - character word, due to the existence of the preset word "clothes" in the preset words, "fu" can be used as the next adjacent preset word of the same - character word "yi". And it can be understood that the previous adjacent preset word of the same - character word can be determined based on the same principle, which will not be elaborated here one by one.
[0143] In some embodiments, the set of same - character words includes at least one of the following: the same - character word corresponding to the word to be recognized and the word segmentation of the upper word order of this same - character word; the same - character word corresponding to the word to be recognized and the word segmentation of the lower word order of this same - character word.
[0144] For example, when the word to be recognized is the Nth word to be recognized, the set of same - character words includes at least one of the following: the same - character word corresponding to the Nth word to be recognized, and the previous adjacent preset word of the same - character word; the same - character word corresponding to the Nth word to be recognized, and the next adjacent preset word of the same - character word.
[0145] In this way, by determining the type of the same - character and based on the matching between the context of the word to be recognized and the context of the preset word, it can be determined whether the word to be recognized is correctly matched to the corresponding target character, thereby improving the semantic recognition result.
[0146] The semantic recognition method involved in the embodiments of the present disclosure may include at least one of steps S31 to S33. For example, step S31 can be implemented as an independent embodiment, step S32 can be implemented as an independent embodiment, step S33 can be implemented as an independent embodiment, and step S31 + step S32 + step S33 can be implemented as an independent embodiment, but not limited thereto.
[0147] In some embodiments, steps S31 and S32 are optional, and one or more of these steps may be omitted or substituted in different embodiments.
[0148] In some embodiments, steps S31 and S33 are optional, and one or more of these steps may be omitted or substituted in different embodiments.
[0149] In some embodiments, steps S32 and S33 are optional, and one or more of these steps may be omitted or substituted in different embodiments.
[0150] It is understandable that in some embodiments, if the data types of the word to be identified and the target word are different, and / or the character features of the word set to be identified and the target word set are different, the word may not exist in the currently preset word list. In such cases, if the data types of the word to be identified and the target word are different, and / or the character features of the word set to be identified and the target word set are different, the preset word list can be updated in the following way.
[0151] Figure 4 This is a flowchart illustrating a semantic recognition method according to an exemplary embodiment, such as... Figure 4 As shown, the semantic recognition method includes the following steps.
[0152] In step S41, a new preset word is created based on the word to be identified.
[0153] In step S42, the preset semantic recognition result corresponding to the new preset word is determined.
[0154] In this embodiment of the disclosure, the preset words and the preset semantic recognition results are updated by creating new preset words based on words to be identified that cannot be matched with preset words, and determining the semantic recognition results corresponding to the new preset words.
[0155] In some embodiments, a new preset word is created based on the word to be identified. For example, when the word to be identified is matched with a preset word but the target word corresponding to the word to be identified cannot be determined, the word to be identified is updated as a new preset word to the original multiple preset words.
[0156] In some embodiments, for a new preset word, a relationship between the semantic recognition results corresponding to the preset word can be established so that the new preset word has a corresponding semantic recognition result.
[0157] Understandably, determining the semantic recognition result corresponding to a new preset word can be achieved by establishing a correspondence between the new preset word and existing preset semantic recognition results, thereby determining the semantic recognition result corresponding to the new preset word. Alternatively, a new preset semantic recognition result can be created for the new preset word, and a connection can be established between the new preset word and the new semantic recognition result, thereby determining the semantic recognition result corresponding to the new preset word.
[0158] The semantic recognition method disclosed in this embodiment may include at least one of steps S41 to S42. For example, step S41 may be implemented as a standalone embodiment, step S42 may be implemented as a standalone embodiment, or step S41 + step S42 may be implemented as a standalone embodiment, but is not limited thereto.
[0159] In some embodiments, step S41 is optional, and one or more of these steps may be omitted or substituted in different embodiments.
[0160] In some embodiments, step S42 is optional, and one or more of these steps may be omitted or substituted in different embodiments.
[0161] Understandably, there may be multiple repeated words to be identified in the text to be identified. When the target word is determined sequentially based on the word order, the semantic recognition results of the earlier words to be identified can be archived (that is, the historical correspondence between the words to be identified and the target word is saved). If the character features of the later words to be identified are the same as the character features of the earlier words to be identified, then the later words to be identified can determine their own target word based on the target word corresponding to the earlier words to be identified.
[0162] Figure 5 This is a flowchart illustrating a semantic recognition method according to an exemplary embodiment, such as... Figure 5 As shown, the semantic recognition method includes the following steps.
[0163] In step S51, it is determined whether the character features of the Nth word to be identified are the same as the character features of the Mth word to be identified.
[0164] In step S52, if the character features of the Nth word to be identified are the same as those of the Mth word to be identified, then the target word corresponding to the Mth word to be identified is taken as the target word corresponding to the Nth word to be identified.
[0165] In some embodiments, M is an integer greater than 0 and less than N.
[0166] In an embodiment of the present disclosure, by comparing the currently to-be-recognized word with the historical to-be-recognized words, and determining the target word corresponding to the currently to-be-recognized word based on the target words corresponding to the historical to-be-recognized words. This can save the comparison processing time of the currently to-be-recognized word and improve the comparison processing efficiency.
[0167] It can be understood that using the target word corresponding to the historical to-be-recognized word with the same character features as the target word corresponding to the currently to-be-recognized word may result in a matching error (that is, the target word actually corresponding to the currently to-be-recognized word is not the target word corresponding to the historical to-be-recognized word). For example, if the character features of the currently to-be-recognized word are "yi", it may correspond to "one" or "clothes", and the historical to-be-recognized word is recognized to have a corresponding target word of "one", then if the historical to-be-recognized word is used as the target word of the currently to-be-recognized word, a matching error may occur.
[0168] Therefore, after the matching, it can be determined whether the matched target word is the target word corresponding to the to-be-recognized word through the context association of the currently to-be-recognized word.
[0169] It can also be understood that for the same character features, there may be multiple historical to-be-recognized words, and the multiple historical to-be-recognized words may correspond to multiple target words. In this case, the currently to-be-recognized word can be matched with the multiple historical to-be-recognized words one by one based on a preset order until the correct target word is matched.
[0170] If the target words corresponding to the historical to-be-recognized words are not the target words corresponding to the currently to-be-recognized word, then the currently to-be-recognized word is matched with the preset words one by one.
[0171] In this way, it can be ensured the correctness of the matching of the to-be-recognized word while achieving a quick matching and confirmation of the target word between the currently to-be-recognized word and the historical to-be-recognized words.
[0172] The semantic recognition method involved in the embodiments of the present disclosure may include at least one of steps S51 to step S52. For example, step S51 can be implemented as an independent embodiment, step S52 can be implemented as an independent embodiment, and step S5 + step S52 can be implemented as an independent embodiment, but not limited thereto.
[0173] The embodiments of the present disclosure also propose a semantic recognition method, which can complete accurate intent recognition through simple words, and can save the processing resources and processing time used for intent recognition.
[0174] Figure 6 is a flowchart of a semantic recognition method shown according to an exemplary embodiment, as Figure 6As shown, the semantic recognition method includes the following steps.
[0175] In step S61, a search tree based on semantic context is constructed.
[0176] In step S62, the natural language input is processed and parsed, and the intent and parameters therein are identified and corrected.
[0177] In some embodiments, for step S61, for example, a tree structure can be constructed based on the input sentence and word order information, and the tree can be organized and updated according to specific rules (e.g., language, pinyin, context, etc.).
[0178] In some embodiments, code checking is performed on the input text to be recognized (i.e., natural language input) to confirm whether the input sample is valid. For example, if any of the sample, sample sentence, or sample semantic result is missing or invalid, the test will terminate and return a failure result (e.g., return value false).
[0179] In some embodiments, the root node needs to be initialized before processing the text to be recognized. For example, if the root node of the current search tree does not exist, a new root node needs to be created to process the text to be recognized, and the new root node is given the attribute "root" and an empty array of children.
[0180] In some embodiments, processing the input text to be recognized may involve word segmentation. If the length of the returned word array is 0, the words in the text to be recognized are considered to have failed.
[0181] In some embodiments, after segmenting the text to be identified, the method further includes iterating through and processing the words.
[0182] For example, steps a through f may be included:
[0183] a: Initialize a variable current as the root node.
[0184] b: Iterate through each word (assuming each word is an object with attributes such as language, pinyin, and word).
[0185] c: For each word, it first obtains the pinyin (if the language is Chinese) and the word itself.
[0186] d: If the language of a word is of type param and has contextual information, then add the context to the dependency set.
[0187] e: Then, it iterates through all child nodes of the current node, searching for a node that shares the same language and pinyin as the current word. If found, it checks if the node's type is text (word). If so, it adds the word to the node's word set and updates the current node to the found node. If the node's type is param, it checks if the context matches. If it does, it updates the current node to the found node. If the context does not match or there is no context information, no action is taken.
[0188] f: If no matching node is found during the traversal, a new node is created and added to the child nodes of the current node. The type of the new node is determined by the language of the word; if it is a parameter type, the type is 'param', otherwise the type is 'word'. For text type nodes, a new word set is created and the word is added to it. For 'param' type nodes, the sorting attribute is set and the context information is copied (if it exists). Then the current node is updated to the newly created node.
[0189] In some embodiments, the final traversal result can be determined after the traversal is complete. If all word segmentation traversals are completed and the matches are correct, then the text to be recognized has been successfully processed.
[0190] For ease of understanding, the following embodiments will be implemented using... Figure 7 Provide a relevant description. Figure 7 This is an example diagram illustrating a semantic recognition method according to an exemplary embodiment.
[0191] like Figure 7 As shown, taking the input text to be recognized as "Help me click the 3rd one" as an example, the process begins by obtaining the text to be recognized, i.e., the sentence "Help me click the 3rd one". Then, the text is segmented into words, resulting in multiple word segments and their corresponding nodes. Further, the nodes for these words are initialized to enable subsequent processing. Simultaneously, a series of configuration options are defined, and their activation or use is determined based on the input scenario parameters.
[0192] After node initialization, multiple word segments can be identified and matched by calling a third helper function. For example, the third helper function could be the `findMatch` function, which performs identification and matching based on the index (character features), the node, and the context. This third helper function is recursive, used to find the corresponding match at a given word index position and on the corresponding node, and then update the matching result.
[0193] The third auxiliary function matches multiple word segments. For example, it can first identify the data types (word type or param type) corresponding to multiple word segments within the dashed box. Here, "%1%" indicates that the data type corresponding to the text "3" is identified as a parameter type. It is clear that the identification method for the data types corresponding to multiple word segments can be found in the relevant embodiments described above, and will not be repeated here.
[0194] After identifying the data types corresponding to multiple word segments, matching is performed within the solid-lined boxes. It is clear that the matching methods for multiple word segments and preset words can be found in the descriptions of the relevant embodiments above, and will not be repeated here.
[0195] In some embodiments, after node initialization and before calling the third auxiliary function for processing, the method further includes: calling the first auxiliary function for corresponding processing and calling the second auxiliary function for corresponding processing.
[0196] For example, the first auxiliary function could be a compute result function, which accepts a list as a parameter and returns an object containing the processed result. This function primarily processes the words and parameters, and performs corresponding inference and correction. It should be noted that the inference and correction processes are described in the relevant embodiments above, and will not be repeated here.
[0197] The second auxiliary function, for example, could be an update function (update result), used to update the inferred and corrected results. It should be noted that the relevant descriptions of the update process can be found in the related embodiments described above, and will not be repeated here.
[0198] Based on the same concept, embodiments of this disclosure also provide a semantic recognition device.
[0199] It is understood that the semantic recognition device provided in this disclosure includes hardware structures and / or software modules corresponding to each function in order to achieve the above-mentioned functions. In conjunction with the units and algorithm steps of the various examples disclosed in this disclosure, this disclosure can be implemented in hardware or a combination of hardware and computer software. Whether a function is executed by hardware or by computer software driving hardware depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of the technical solutions of this disclosure.
[0200] Figure 8 This is a block diagram illustrating a semantic recognition device 100 according to an exemplary embodiment. (Refer to...) Figure 8The device includes a detection and processing unit 101.
[0201] The processing unit 101 is used to perform word segmentation on the text to be recognized, to obtain N words to be recognized and the word order among the N words; to identify the character features of each of the N words to be recognized, and based on the word order and character features, to determine N target words that are the same as the N words to be recognized from a plurality of preset words; and to determine the preset semantic recognition results corresponding to the N target words based on the N target words, and to use the preset semantic recognition results as the semantic recognition results of the text to be recognized; wherein, N is an integer greater than or equal to 1, the N words to be recognized correspond one-to-one with the N target words, and the target words have a correspondence with the preset semantic recognition results.
[0202] In some embodiments, the processing unit 101 determines N target words that are the same as N words to be identified from a plurality of preset words based on word order and the character features as follows: preset words that are the same as the words to be identified are determined as words with the same character features; it is determined whether each word with the same character features is the same as each corresponding word to be identified, and if they are the same, the word with the same character features is determined as the target word of the word to be identified.
[0203] In some embodiments, the processing unit 101 determines whether each word with the same character is the same as each corresponding word to be identified in the following manner: if the word to be identified and the word with the same character have the same data type, and the word set to be identified and the word set with the same character have the same character features, then the word with the same character is the same as the corresponding word to be identified; if the word to be identified and the word with the same character have different data types, and / or the word set to be identified and the word set with the same character have different character features, then the word with the same character is different from the corresponding word to be identified; wherein, the data type includes text type or parameter type, the word set to be identified includes the Nth word to be identified and the (N+1)th word to be identified, and the word set with the same character includes the word with the same character corresponding to the Nth word to be identified, and the next adjacent preset word of the word with the same character.
[0204] In some embodiments, the processing unit 101 is further configured to: establish a new preset word based on the word to be identified, and determine the preset semantic recognition result corresponding to the new preset word.
[0205] In some embodiments, the processing unit 101 is further configured to: determine whether the character features of the Nth word to be identified are the same as the character features of the Mth word to be identified, where M is an integer greater than 0 and less than N; if the character features of the Nth word to be identified are the same as the character features of the Mth word to be identified, then take the target word corresponding to the Mth word to be identified as the target word corresponding to the Nth word to be identified.
[0206] Regarding the apparatus in the above embodiments, the specific manner in which each module performs its operation has been described in detail in the embodiments related to the method, and will not be elaborated upon here.
[0207] Figure 9 This is a block diagram illustrating an apparatus 200 for semantic recognition according to an exemplary embodiment. For example, apparatus 200 may be a mobile phone, computer, digital broadcasting terminal, messaging device, game console, tablet device, medical device, fitness equipment, personal digital assistant, etc.
[0208] Reference Figure 9 The semantic recognition device 200 may include one or more of the following components: processing component 202, memory 204, power component 206, multimedia component 208, audio component 210, input / output (I / O) interface 212, sensor component 214, and communication component 216.
[0209] Processing component 202 typically controls the overall operation of device 200, such as operations associated with display, telephone calls, data communication, camera operation, and recording. Processing component 202 may include one or more processors 220 to execute instructions to perform all or part of the steps of the methods described above. Furthermore, processing component 202 may include one or more modules to facilitate interaction between processing component 202 and other components. For example, processing component 202 may include a multimedia module to facilitate interaction between multimedia component 208 and processing component 202.
[0210] Memory 204 is configured to store various types of data to support the operation of device 200. Examples of such data include instructions for any application or method operating on device 200, contact data, phonebook data, messages, pictures, videos, etc. Memory 204 can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic storage, flash memory, magnetic disk, or optical disk.
[0211] The power supply component 206 provides power to the various components of the device 200. The power supply component 206 may include a power management system, one or more power sources, and other components associated with generating, managing, and distributing power to the device 200.
[0212] Multimedia component 208 includes a screen that provides an output interface between the device 200 and the user. In some embodiments, the screen may include a liquid crystal display (LCD) and a touch panel (TP). If the screen includes a touch panel, the screen may be implemented as a touchscreen to receive input signals from the user. The touch panel includes one or more touch sensors to sense touches, swipes, and gestures on the touch panel. The touch sensors may sense not only the boundaries of the touch or swipe action but also the duration and pressure associated with the touch or swipe operation. In some embodiments, multimedia component 208 includes a front-facing camera and / or a rear-facing camera. When the device 200 is in an operating mode, such as a shooting mode or a video mode, the front-facing camera and / or the rear-facing camera may receive external multimedia data. Each front-facing camera and rear-facing camera may be a fixed optical lens system or have focal length and optical zoom capabilities.
[0213] Audio component 210 is configured to output and / or input audio signals. For example, audio component 210 includes a microphone (MIC) configured to receive external audio signals when device 200 is in an operating mode, such as call mode, recording mode, and voice recognition mode. The received audio signals may be further stored in memory 204 or transmitted via communication component 216. In some embodiments, audio component 210 also includes a speaker for outputting audio signals.
[0214] I / O interface 212 provides an interface between processing component 202 and peripheral interface modules, such as keyboards, click wheels, buttons, etc. These buttons may include, but are not limited to, home buttons, volume buttons, power buttons, and lock buttons.
[0215] Sensor assembly 214 includes one or more sensors for providing status assessments of various aspects of device 200. For example, sensor assembly 214 may detect the on / off state of device 200, the relative positioning of components such as the display and keypad of device 200, changes in the position of device 200 or a component of device 200, the presence or absence of user contact with device 200, the orientation or acceleration / deceleration of device 200, and temperature changes of device 200. Sensor assembly 214 may include a proximity sensor configured to detect the presence of nearby objects without any physical contact. Sensor assembly 214 may also include a light sensor, such as a CMOS or CCD image sensor, for use in imaging applications. In some embodiments, sensor assembly 214 may also include an accelerometer, a gyroscope, a magnetometer, a pressure sensor, or a temperature sensor.
[0216] Communication component 216 is configured to facilitate wired or wireless communication between device 200 and other devices. Device 200 can access wireless networks based on communication standards, such as WiFi, 2G, or 3G, or combinations thereof. In one exemplary embodiment, communication component 216 receives broadcast signals or broadcast-related information from an external broadcast management system via a broadcast channel. In one exemplary embodiment, communication component 216 also includes a near-field communication (NFC) module to facilitate short-range communication. For example, the NFC module may be implemented based on radio frequency identification (RFID) technology, Infrared Data Association (IrDA) technology, ultra-wideband (UWB) technology, Bluetooth (BT) technology, and other technologies.
[0217] In an exemplary embodiment, the apparatus 200 may be implemented by one or more application-specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DSPDs), programmable logic devices (PLDs), field-programmable gate arrays (FPGAs), controllers, microcontrollers, microprocessors, or other electronic components to perform the methods described above.
[0218] In an exemplary embodiment, a non-transitory computer-readable storage medium including instructions is also provided, such as a memory 204 including instructions, which can be executed by a processor 220 of the device 200 to perform the above-described method. For example, the non-transitory computer-readable storage medium may be a ROM, random access memory (RAM), CD-ROM, magnetic tape, floppy disk, and optical data storage device, etc.
[0219] Figure 10 This is a block diagram illustrating an apparatus 300 for semantic recognition according to an exemplary embodiment. For example, apparatus 300 may be provided as a server. (Refer to...) Figure 10 The device 300 includes a processing component 322, which further includes one or more processors, and memory resources represented by memory 332 for storing instructions, such as application programs, that can be executed by the processing component 322. The application programs stored in memory 332 may include one or more modules, each corresponding to a set of instructions. Furthermore, the processing component 322 is configured to execute instructions to perform the aforementioned semantic recognition method.
[0220] Device 300 may also include a power supply component 326 configured to perform power management of device 300, a wired or wireless network interface 350 configured to connect device 300 to a network, and an input / output (I / O) interface 358. Device 300 may operate on an operating system stored in memory 332, such as Windows Server™, Mac OS X™, Unix™, Linux™, FreeBSD™, or similar.
[0221] It is understood that in this disclosure, "multiple" refers to two or more, and other quantifiers are similar. "And / or" describes the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A alone, A and B simultaneously, and B alone. The character " / " generally indicates that the preceding and following related objects are in an "or" relationship. The singular forms "a," "the," and "the" are also intended to include the plural forms unless the context clearly indicates otherwise.
[0222] It is further understood that the terms "first," "second," etc., are used to describe various types of information, but this information should not be limited to these terms. These terms are only used to distinguish information of the same type from one another, and do not indicate a specific order or degree of importance. In fact, the expressions "first," "second," etc., are completely interchangeable. For example, without departing from the scope of this disclosure, first information can also be referred to as second information, and similarly, second information can also be referred to as first information.
[0223] It is further understood that the terms “center,” “longitudinal,” “lateral,” “front,” “rear,” “up,” “down,” “left,” “right,” “vertical,” “horizontal,” “top,” “bottom,” “inner,” and “outer,” etc., indicate the orientation or positional relationship based on the orientation or positional relationship shown in the accompanying drawings. They are only for the convenience of describing this embodiment and simplifying the description, and do not indicate or imply that the device or element referred to must have a specific orientation, or be constructed and operated in a specific orientation.
[0224] It can be further understood that, unless otherwise specified, "connection" includes both direct connections where no other components exist between the two parties and indirect connections where other components exist between them.
[0225] It is further understood that although operations are described in a specific order in the accompanying drawings in the embodiments of this disclosure, this should not be construed as requiring these operations to be performed in the specific order or serial order shown, or requiring all of the shown operations to be performed to obtain the desired result. In certain environments, multitasking and parallel processing may be advantageous.
[0226] Other embodiments of this disclosure will readily occur to those skilled in the art upon consideration of the specification and practice of the invention disclosed herein. This application is intended to cover any variations, uses, or adaptations of this disclosure that follow the general principles of this disclosure and include common knowledge or customary techniques in the art not disclosed herein.
Claims
1. A semantic recognition method, characterized in that, include: The text to be identified is segmented to obtain N words to be identified and the word order among the N words, where N is an integer greater than or equal to 1; The character features of each of the N words to be identified are identified, and based on the word order and the character features, N target words that are the same as the N words to be identified are determined from a plurality of preset words, wherein the N words to be identified correspond one-to-one with the N target words, and the target words have a correspondence with the preset semantic recognition results; Based on the N target words, a preset semantic recognition result corresponding to the N target words is determined, and the preset semantic recognition result is used as the semantic recognition result of the text to be recognized.
2. The method according to claim 1, characterized in that, The step of determining N target words that are identical to the N words to be identified from a plurality of preset words based on the word order and the character features includes: Preset words with the same character features as the word to be identified are identified as words with the same characters; Determine whether each word with the same character is the same as each word to be identified. If they are the same, then the word with the same character is identified as the target word of the word to be identified.
3. The method according to claim 2, characterized in that, The step of determining whether each word with the same character is the same as each corresponding word to be identified includes: If the word to be identified has the same data type as the word with the same character, and the set of words to be identified has the same character features as the set of words with the same character, then the word with the same character is the same as the corresponding word to be identified. If the data type of the word to be identified is different from that of the word with the same character, and / or the character features of the set of words to be identified are different from those of the set of words with the same character, then the word with the same character is different from the corresponding word to be identified. The data type includes text type or parameter type; the set of words to be identified includes the Nth word to be identified and the (N+1)th word to be identified; the set of words with the same character includes the word with the same character corresponding to the Nth word to be identified, and the next adjacent preset word of the word with the same character.
4. The method according to claim 3, characterized in that, In response to the fact that the data types of the words to be identified and the target words are different, and / or the character features of the word set to be identified and the target word set are different, the method further includes: A new preset word is created based on the word to be identified, and the preset semantic recognition result corresponding to the new preset word is determined.
5. The method according to claim 2, characterized in that, The method further includes: Determine whether the character features of the Nth word to be identified are the same as those of the Mth word to be identified, where M is an integer greater than 0 and less than N; If the character features of the Nth word to be identified are the same as those of the Mth word to be identified, then the target word corresponding to the Mth word to be identified is taken as the target word corresponding to the Nth word to be identified.
6. A semantic recognition device, characterized in that, The device includes: The processing unit is configured to perform word segmentation on the text to be identified, obtaining N words to be identified and the word order among the N words; identify the character features of each of the N words to be identified, and based on the word order and the character features, determine N target words that are the same as the N words to be identified from a plurality of preset words; and determine the preset semantic recognition results corresponding to the N target words based on the N target words, and use the preset semantic recognition results as the semantic recognition results of the text to be identified. Wherein, N is an integer greater than or equal to 1, the N words to be identified correspond one-to-one with the N target words, and the target words have a corresponding relationship with the preset semantic recognition results.
7. The apparatus according to claim 6, characterized in that, The processing unit determines N target words that are identical to the N words to be identified from a plurality of preset words, based on the word order and the character features, in the following manner: Preset words with the same character features as the word to be identified are identified as words with the same characters; Determine whether each word with the same character is the same as each word to be identified. If they are the same, then the word with the same character is identified as the target word of the word to be identified.
8. The apparatus according to claim 7, characterized in that, The processing unit determines whether each word with the same character is the same as each corresponding word to be identified in the following way: If the data type of the word to be identified is the same as that of the word with the same character, and the character features of the set of words to be identified are the same as those of the set of words with the same character, then the word with the same character is the same as the corresponding word to be identified. If the data types of the word to be identified are different from those of the word with the same character, and / or if the character features of the set of words to be identified are different from those of the set of words with the same character, then the word with the same character is different from the corresponding word to be identified. The data type includes text type or parameter type; the set of words to be identified includes the Nth word to be identified and the (N+1)th word to be identified; the set of words with the same character includes the word with the same character corresponding to the Nth word to be identified, and the next adjacent preset word of the word with the same character.
9. The apparatus according to claim 8, characterized in that, The processing unit is also used for: A new preset word is created based on the word to be identified, and the preset semantic recognition result corresponding to the new preset word is determined.
10. The apparatus according to claim 7, characterized in that, The processing unit is also used for: Determine whether the character features of the Nth word to be identified are the same as those of the Mth word to be identified, where M is an integer greater than 0 and less than N; If the character features of the Nth word to be identified are the same as those of the Mth word to be identified, then the target word corresponding to the Mth word to be identified is taken as the target word corresponding to the Nth word to be identified.
11. An electronic device, characterized in that, include: processor; Memory used to store processor-executable instructions; The processor is configured to execute the semantic recognition method according to any one of claims 1 to 5.
12. A storage medium, characterized in that, The storage medium stores instructions that, when executed by the terminal's processor, enable the terminal to perform the semantic recognition method according to any one of claims 1 to 5.
