WO2021243575A1 - Text information classification method, mobile terminal, and computer-readable storage medium - Google Patents

Text information classification method, mobile terminal, and computer-readable storage medium Download PDF

Info

Publication number
WO2021243575A1
WO2021243575A1 PCT/CN2020/093987 CN2020093987W WO2021243575A1 WO 2021243575 A1 WO2021243575 A1 WO 2021243575A1 CN 2020093987 W CN2020093987 W CN 2020093987W WO 2021243575 A1 WO2021243575 A1 WO 2021243575A1
Authority
WO
WIPO (PCT)
Prior art keywords
text information
intention
classification
model
vertical
Prior art date
Application number
PCT/CN2020/093987
Other languages
French (fr)
Chinese (zh)
Inventor
林浩智
Original Assignee
深圳市欢太科技有限公司
Oppo广东移动通信有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 深圳市欢太科技有限公司, Oppo广东移动通信有限公司 filed Critical 深圳市欢太科技有限公司
Priority to PCT/CN2020/093987 priority Critical patent/WO2021243575A1/en
Priority to CN202080098028.7A priority patent/CN115605861A/en
Publication of WO2021243575A1 publication Critical patent/WO2021243575A1/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/30Information retrieval; Database structures therefor; File system structures therefor of unstructured textual data
    • G06F16/35Clustering; Classification

Definitions

  • This application relates to the technical field of text classification, and in particular to a method for classifying text information, a mobile terminal, and a computer-readable storage medium.
  • text classification applications in online and offline industrial scenarios, such as: product evaluation polarity analysis in the field of e-commerce, automatic archiving and classification of data text, sensitive topic inspection of forums, online users of voice assistants Intent recognition, etc.
  • This application provides a method for classifying text information, a mobile terminal, and a computer-readable storage medium to solve the problem of relatively slow text information classification.
  • the first aspect of the embodiments of the present application provides a method for classifying text information, including: obtaining text information; determining the vertical domain intention of the text information; when the vertical domain intention of the text information meets the setting vertical domain intention, recalling the text information , And then classify the text information by intention; when the vertical domain intention of the text information does not meet the set vertical domain intention, the text information is rejected.
  • the second aspect of the embodiments of the present application provides a mobile terminal, including: an acquisition module for acquiring text information; a determining module for determining the vertical intention of the text information; a recall module, where the vertical intention of the text information satisfies When setting the vertical domain intention, it is used to recall text information; the intention classification module, after the recall module recalls the text information, is used to classify the text information; the rejection module is used when the vertical domain intention of the text information does not meet the setting In the case of vertical domain intention, the text message is rejected.
  • the third aspect of the embodiments of the present application provides a mobile terminal, including: a processor, a memory, and a computer program stored in the memory and running on the processor.
  • the processor is used to execute the computer program to implement the first embodiment of the present application.
  • the method provided by the aspect is used to execute the computer program to implement the first embodiment of the present application.
  • the fourth aspect of the embodiments of the present application provides a computer-readable storage medium that stores a computer program, and the computer program can be executed by a processor to implement the method provided in the first aspect of the embodiments of the present application.
  • this application first determines the vertical domain intention of the text information for text information with uncertain complexity; when the vertical domain intention of the text information satisfies the vertical domain intention, The text information is recalled, and the text information is classified by intention.
  • Different classification methods are used for the text information with uncertain complexity.
  • the different classification methods are simpler and faster because of the relatively complex model, which makes the text information with different recognition difficulties
  • the discrimination results can be quickly given in different levels of classification, thereby speeding up the intention classification. Therefore, through the above method, the waste of resources of the complex classification model can be effectively avoided and the classification of text information can be accelerated, so as to improve the classification and recognition speed of text information, and thereby reduce the resource occupation of the computer.
  • Fig. 1 is a schematic flowchart of a first embodiment of a text information classification method of the present application
  • FIG. 2 is a schematic flowchart of a specific implementation of step S12 shown in FIG. 1;
  • FIG. 3 is a schematic flowchart of a specific implementation of step S13 shown in FIG. 1;
  • FIG. 4 is a schematic flowchart of a specific implementation of step S33 shown in FIG. 3;
  • FIG. 5 is a schematic flowchart of another specific embodiment shown in FIG. 3;
  • Fig. 6 is a schematic flowchart of a second embodiment of a text information classification method of the present application.
  • FIG. 7 is a schematic block diagram of an embodiment of a mobile terminal of the present application.
  • FIG. 8 is a schematic block diagram of another embodiment of a mobile terminal of the present application.
  • Fig. 9 is a schematic block diagram of a circuit of an embodiment of a computer-readable storage medium of the present application.
  • FIG. 10 is a schematic structural composition diagram of an embodiment of a mobile terminal device of the present application.
  • the term “if” can be interpreted as “when” or “once” or “in response to determination” or “in response to detection” depending on the context .
  • the phrase “if determined” or “if detected [described condition or event]” can be interpreted as meaning “once determined” or “in response to determination” or “once detected [described condition or event]” depending on the context ]” or “in response to detection of [condition or event described]”.
  • FIG. 1 is a schematic flowchart of a first embodiment of a text information classification method of the present application. The method provided in this embodiment specifically includes the following steps:
  • Voice assistant applications include more complicated text classification operations and need to be able to interact with users in real time.
  • the mobile terminal starts the voice assistant application, the user's voice input can be obtained in real time, and the voice input is converted into the text information corresponding to the voice by the mobile terminal, so that the mobile terminal can obtain the text information in real time.
  • the voice jack can be plugged into a headset, and text information can be obtained by collecting sound from the headset. If voice input is performed through a wireless headset, text information can also be obtained by voice collection on the wireless headset. Of course, those skilled in the art can obtain text information in other ways known in the art.
  • the voice input is a single text information input, that is, the obtained text information is generally a single text information input, but due to the many functions supported by the voice assistant, there are actually multiple models of different vertical domains that are processed in parallel in the implementation.
  • the voice assistant For text information input, if there is a model that specializes in emotional question and answer, and a model that specializes in system operations, both models need to respond to the same text information input.
  • the above is an example of these two models. In fact, there may be dozens or hundreds of models processing one text information input at the same time, which consumes a lot of computing resources. Then, it is particularly important to be able to quickly and quickly determine which vertical domain the acquired text information belongs to, that is, to determine which vertical domain intention the text information belongs to.
  • step S13 is entered to quickly return the classification result, thereby greatly saving subsequent calculations. resource.
  • the mobile terminal is preset with a vertical domain setting intention, which is used to determine whether the vertical domain intention of the text information satisfies the vertical domain setting intention. Because the vertical domain intention setting module is more detailed, the vertical domain intention of the input text information can be directly classified into the specific intention within the vertical domain. Since the task of judging whether the vertical intention of text information meets the setting of vertical intention is more detailed, this module is more complicated than determining the vertical intention of text information. This module also has the rejection capability, that is, the text message that hits the rejection category is returned to the rejection intention.
  • the text information When the vertical domain intention of the text information satisfies the set vertical domain intention, the text information is recalled, and the text information is classified by intention. Further, after satisfying the intention of setting the vertical domain, a corresponding interrupt signal can be generated to notify the mobile terminal to perform a corresponding operation.
  • this application first determines the vertical intention of the text information for text information with uncertain complexity; when the vertical intention of the text information meets the vertical intention of the set vertical domain, the text information is recalled and the intention of the text information is determined.
  • Classification Different classification methods are used for text information with uncertain complexity. Different classification methods are simpler and faster in relatively complex models. Therefore, text information with different recognition difficulties can be quickly classified at different levels to give the discrimination results. , Thereby speeding up intent classification. Therefore, through the above method, the waste of resources of the complex classification model can be effectively avoided and the classification of text information can be accelerated, so as to improve the classification and recognition speed of text information, and thereby reduce the resource occupation of the computer.
  • FIG. 2 is a schematic flowchart of a specific implementation of step S12 shown in FIG. 1, which specifically includes the following steps:
  • S21 Perform keyword matching between the text information and multiple keyword groups to obtain multiple matching degrees; wherein, each keyword group corresponds to a vertical domain intention;
  • the rough recall module can be used to process the acquired text information. Since the mobile terminal presets a model formed by multiple skill groups, such as multiple keyword groups, where each keyword group corresponds to a vertical domain intention, and each keyword group is a regular expression formed by multiple keywords, then The expression can be used to roughly select the vertical intention of the obtained text information, for example, using a simpler regular expression. For simple regular expression usage scenarios, such as a certain skill group dedicated to processing tasks such as alarm clocks, countdowns, schedules, etc. For this type of tasks, the input text of "time" is an important element, so simple regular expressions can be used Mode.
  • this module will process all text information input, it has higher requirements for speed and computational complexity. Therefore, in this module, simple regular expressions are used to recall textual information.
  • simple regular expressions are used to recall textual information.
  • Each skill group preset by the mobile terminal processes the acquired text information at the same time to obtain multiple matching degrees, and the multiple matching degrees corresponding to the multiple keyword groups are sorted by relevance to obtain different rough screening results.
  • a vertical domain skill group has a rough recall module. Only matching keywords or using simple regular expression matching is greatly reduced compared to statistical models or deep learning models. By using the data of the real generation environment for testing, the average time and peak value are orders of magnitude higher than that of a single model.
  • the vertical domain intention corresponding to the keyword group with the highest matching degree can be obtained, so that the vertical domain intention of the text information can be determined.
  • FIG. 3 is a schematic flowchart of a specific implementation of step S13 shown in FIG. 1, which specifically includes the following steps:
  • step S31 a regular expression recall module, that is, a regular recall model, can be used.
  • This module and the coarse recall module also use regular expressions with fast calculation speed. The difference is that the coarse recall module only distinguishes whether the task belongs to the local task, while the regular recall model is more detailed and can directly classify the input text information into the local task.
  • the specific intent within the vertical domain is to set the vertical domain intention. Due to the more detailed tasks, the regular expressions used in this module are more complicated than the coarse recall module. However, this module also has the ability to reject, that is, it will hit the text message of the rejection category and return the rejection intention.
  • the vertical domain intention of the text information satisfies the vertical domain intention, it means that the text information belongs to the vertical domain intention, then the text information is recalled and the text information is classified for the first time.
  • the first intention classification includes at least At least one intention class and one rejection class to indicate that the first intention classification has the ability to reject.
  • the text information can be input into the regular recall model, so that the regular recall model classifies the text information for the first time, where the first intention classification includes at least one intention class and one rejection class.
  • the text information is serially matched with the regular database of the regular recall model, so that the regular recall model performs the first intention classification of the text information, and outputs the first intention classification result; wherein, the first intention classification result include at least one result of intent and one result of rejection.
  • the input text information will be assigned to the regular expression related to the alarm clock for serial matching; because the regular recall model is mainly for processing high frequency Simple text information and more complex text information that is difficult to use the model to classify, so there are not too many serial regular expressions. And using regular expression matching to classify high-frequency text information can save computing time and resources. Of course, the regular recall model also processes ordinary text information.
  • step S32 When the text information meets at least one intent class of the first intent classification result, go to step S32; when the text information does not meet the at least one intent class and rejection class of the first intent classification result, go to step S33; when the text information meets When the rejection category of the classification is intended for the first time, the text information is rejected.
  • users can add, delete, modify, and recall the regular expressions in the model according to business needs. This makes the regular expressions in the regular recall model convenient and controllable, and can be used to quickly repair and modify a small amount of specific text information, and quickly control the output results.
  • the text information When the text information satisfies one of the at least one intent class of the first intent classification, the text information is subjected to slot extraction.
  • the text information when the text information satisfies one of the high-frequency simple text information and the more complicated text information input that is difficult to use the model to classify, the text information is extracted from the slot, and the specific slot extraction can be based on business requirements To determine, such as the content of the text message, the name of the person, the amount, etc.
  • the mobile terminal For the filtering of the previous model, the text information obtained does not satisfy at least one intention category and rejection category of the first intention classification, then the mobile terminal considers the text information to belong to the second intention classification, that is, confirm that the input text information is The input that belongs to the vertical domain intention, this part of the proportion of all inputs is already small, so the deep neural network with greater complexity and better effect can be used for the second intention classification.
  • FIG. 4 is a schematic flowchart of a specific implementation of step S33 shown in FIG. 3, which specifically includes the following steps:
  • the second intent classification includes at least one intent class and one rejection class. Setting at least one intent class can be used to determine whether the second intent classification of the text information satisfies one of the at least one intent class in the second intent classification.
  • the second intention classification of text information includes:
  • the text information is input to the intent classification model, so that the intent classification model performs a second intent classification on the text information, and outputs a second intent classification result; wherein the second intent classification result includes at least one intent class and one rejection class.
  • the second intention classification module can use the Text Convolutional Neural Network (Text CNN) model, that is, the method of classifying text through the convolutional neural network, and the text information entering this module is N+
  • One category that is, N categories that belong to the task intent of the local vertical domain, and one category that does not belong to the local vertical domain, that is, rejection capability, where N represents a positive integer greater than or equal to 1.
  • Text CNN model performs better than rule matching. According to business needs, in addition to the Text CNN model, you can also use the Long Short-Term Memory (LSTM) model and the Gate Recurrent Unit (GRU) Model, Transformer (Transformer) model, Bidirectional Encoder Represenations from Transformers (BERT) model, Text-to-Text (Transfer Transformer, T5) model and other more complex models, Text CNN model is not a requirement The option of is just taking the Text CNN model as an actual use example; if the business situation can tolerate a longer response time, you can choose a more complex model.
  • LSTM Long Short-Term Memory
  • GRU Gate Recurrent Unit
  • Transformer Transformer
  • BERT Bidirectional Encoder Represenations from Transformers
  • T5 Text-to-Text
  • Text CNN model is not a requirement
  • the option of is just taking the Text CNN model as an actual use example; if the business situation can tolerate a longer response time, you can choose a more complex model.
  • step S42 is entered, and if the text information satisfies the rejection class in the second intention classification result, step S43 is entered.
  • the text information After the input text information has been processed by the above modules, it already has a higher classification accuracy and corresponding slot results.
  • the text information When the text information satisfies at least one intent category of the second intent classification result, the text information is subjected to slot extraction.
  • the slots for extracting the text information will be explained in detail below.
  • the text information meets the rejection category in the second intention classification result, it means that the text information belongs to the rejection category, and the rejection intention is returned, that is, the text information that is determined not to belong to the original domain intention is returned to the rejected classification result, thereby saving subsequent calculations resource.
  • FIG. 5 is a schematic flowchart of another specific embodiment shown in FIG. 3, which specifically includes the following steps:
  • This step S51 is similar to step S31 in FIG. 3, and the details will not be repeated here.
  • S52 Determine whether the first intention classification of the text information meets at least one intention class and one rejection class of the preset first intention classification
  • the mobile terminal can set a preset first intention classification, and the preset first intention classification is used to determine whether the first intention classification of the text information meets the preset first intention classification.
  • the preset first intention classification includes at least one intention class and one rejection class. If it is judged whether the first intention classification of the text information meets at least one intention class and one rejection class of the preset first intention classification, then step S55 is entered, and if it is judged not satisfied, step S53 is entered.
  • Steps S52 and S55 are similar to step S32 in FIG. 3, and the details are not repeated here.
  • step S55 if the text information satisfies at least one intent category of the first intention classification, then step S55 is entered, and when the text information satisfies the rejection category of the first intention classification, the rejection classification can be directly returned. intention.
  • the vertical intention of the text information is determined again.
  • the intention recall model can be used. This model task is the same as the rough recall module, that is, the input text information is reclassified to determine whether the input text information belongs to the local task intent or does not belong to the local task intent. Due to the limited processing complexity of regular expressions, it is difficult to classify part of the text information in the first two modules. Therefore, the text information needs to be processed again with the help of an intention recall model with neural network generalization capabilities.
  • the text information is input to the intention recall model, so that the intention recall model determines the vertical intention of the text information; wherein, a confidence threshold can be set in the intention recall model, and the set confidence threshold can be used to distinguish the text information
  • the set confidence threshold is adjustable. By adjusting the set confidence threshold, the recall rate of text information can be increased (Recall rate), that is, the proportion of positive samples that are actually marked as positive samples are classified as positive samples.
  • the intention recall model can determine the vertical intention of the text information according to the set confidence threshold, including:
  • the text information is determined to be rejected.
  • the intention recall model can be a Fast Text neural network model, which is a method of learning word embedding and text classification. Therefore, the intention recall model uses the generalization ability of the Fast Text neural network model to enable the model to Process the input of text information that has not been acquired.
  • the computational complexity of the intention recall model is greater than that of regular expressions, but the accuracy rate is higher than that of regular expressions.
  • the intention recall model can also be a convolutional neural network (Convolutional Neural Network, CNN) model, which is a feedforward neural network model.
  • CNN convolutional Neural Network
  • the CNN model here mainly refers to the CNN model with fewer parameters and the CNN model with an attention module.
  • the attention module is similar.
  • the QKV in the attention module can be linearly projected to a low-dimensional such as 32-dimensional and then the attention calculation can be performed to reduce the computational complexity of colleagues who obtain part of the attention ability.
  • step S55 is similar to step S33 in FIG. 3, and the details will not be repeated here.
  • FIG. 6 is a schematic flowchart of a second embodiment of a text information classification method of the present application.
  • the method provided in this embodiment specifically includes the following steps:
  • steps S61, S62, S63, and S64 are respectively similar to S11, S12, S13, and S14 in FIG. 1, and the details are not repeated here.
  • step S63 whether the vertical domain intention of the text information meets the set vertical domain intention can be discriminated by means of judgment, and other methods may also be used, which is not specifically limited here.
  • the text information performs slot extraction
  • the text information is input to the slot extraction module, so that the slot extraction module performs slot extraction on the text information and outputs the slot extraction result.
  • the slot extraction module can be extracted by using the Bi-Long Short-Term Memory (Bi-LSTM) model and the Conditional Random Fields (CRF) model.
  • Bi-LSTM Bi-Long Short-Term Memory
  • CRF Conditional Random Fields
  • the Bi-LSTM model is A time recurrent neural network
  • CRF model is a conditional probability distribution model.
  • slot regular expression model can also be used to extract the slots of the text information.
  • the text information After the text information is extracted from the slots, it also includes: using the verification rule library to verify the text information.
  • the mobile terminal is preset with a verification rule library, and by using the verification rule library, the slot of the text information can be verified.
  • the verification module uses rules to verify specific keywords that are required or cannot be included under each intent and the corresponding slot results, and reject a very small number of text messages that pass the model but do not meet the definition or requirements. Among them, the verification module You can quickly modify and take effect by configuring the verification rules under different intents.
  • the verification rule library is artificially set by online actual problem cases, and the verification rules can be set with more detailed rules.
  • the input text information is "open the small alarm clock", which is classified as the intention of "open the alarm clock”.
  • "Small Alarm Clock” is a third-party app, you can set “Small Alarm Clock” as a rejection keyword for the intention of "open the alarm clock”.
  • Step S67 is similar to S15 in FIG. 1, and the details are not repeated here.
  • the coarse recall module can reject more than 90% of the input fields that do not belong to the task intent of the vertical domain, and at the same time, by adding keywords to ensure that the recall rate exceeds 99.9% ;
  • the regular expression module more than 30% of the high-frequency vertical field intention text information can be processed quickly and directly enter the slot extraction module.
  • the hierarchical framework proposed by this solution is compared with a single-layer or two-layer intention classification framework. Specifically, the actual online situation saves 0-50% time, and the average response is from >10ms to less than 10ms, so it can save more than 50% Computing time and computing resources.
  • this solution splits the complex model into multiple relatively simple models, and at the same time uses regular expressions with faster calculation speeds at different levels, so that text information with different recognition difficulties can be discriminated earlier at different levels, speeding up Intent classification. And by using more levels and inserting regular expression modules at different levels, the final result is more controllable, and the output result can be quickly modified by making a small amount of changes to the configuration file.
  • FIG. 7 is a schematic structural diagram of a mobile terminal according to an embodiment of the present application.
  • the embodiment of the present application provides a mobile terminal 7, including:
  • the obtaining module 71 is used to obtain text information
  • the determining module 72 is used to determine the vertical intention of the text information
  • the recall module 73 is used to recall the text information when the vertical domain intention of the text information meets the set vertical domain intention;
  • the intention classification module 74 after the text information is recalled by the recall module, is used to classify the text information by intention;
  • the rejection module 75 is used to reject the text information when the vertical intention of the text information does not meet the set vertical intention.
  • the determination module 72 first determines the vertical domain intention of the text information; when the vertical domain intention of the text information satisfies the set vertical domain intention, the recall module 73 recalls the text information,
  • the intention classification module 74 classifies text information by intention, and uses different classification methods for text information with uncertain complexity. Different classification methods are faster, so that text information with different recognition difficulties can be quickly classified in different levels. The result of the discrimination is obtained, thereby accelerating the classification of intentions. Therefore, through the above method, the waste of resources of the complex classification model can be effectively avoided and the classification of text information can be accelerated, so as to improve the classification and recognition speed of text information, and thereby reduce the resource occupation of the computer.
  • FIG. 8 is a schematic structural diagram of another mobile terminal according to an embodiment of the present application.
  • An embodiment of the present application provides a mobile terminal 8 including: a processor 81, a memory 82, and a computer program 821 stored in the memory and running on the processor.
  • the processor 81 is configured to execute the computer program 821 to implement the embodiment of the present application. The steps of the method provided in the first aspect will not be repeated here.
  • FIG. 9 is a schematic block diagram of a circuit of an embodiment of a computer-readable storage medium of the present application. If implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in the computer-readable storage medium 100. Based on this understanding, the technical solution of the present application essentially or the part that contributes to the existing technology or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a readable storage.
  • the medium includes a number of instructions (program data 101) to enable a computer device (which may be a personal computer, a server, or a network device, etc.) or a processor to execute all or part of the steps of the various implementation methods of the present application.
  • the aforementioned readable storage media include: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), magnetic disks or optical disks and other media, as well as various media with the above Computers, mobile phones, laptops, tablets, cameras and other electronic devices with readable storage media.
  • FIG. 10 is a schematic structural diagram of an embodiment of the mobile terminal device of the present invention.
  • the mobile terminal device may be a mobile phone, a tablet computer, or a notebook. Computers and wearable devices, etc., in this embodiment, a mobile phone is taken as an example.
  • the structure of the terminal device 900 may include a radio frequency (RF) circuit 910, a memory 920, an input unit 930, a display unit 940 (that is, the display screen assembly 600 in the foregoing embodiment), a sensor 950, an audio circuit 960, and WiFi ( wireless fidelity) module 970, processor 980, power supply 990, etc.
  • RF radio frequency
  • the RF circuit 910, the memory 920, the input unit 930, the display unit 940, the sensor 950, the audio circuit 960, and the WiFi module 970 are respectively connected to the processor 980; the power source 990 is used to provide power to the entire terminal device 900.
  • the RF circuit 910 is used for receiving and transmitting signals; the memory 920 is used for storing data instruction information; the input unit 930 is used for inputting information, which may specifically include a touch panel 931 and other input devices 932 such as operation buttons; and the display unit 940 It may include a display panel 941, etc.; the sensor 950 includes an infrared sensor, a laser sensor, etc., used to detect user proximity signals, distance signals, etc.; a speaker 961 and a microphone (or microphone) 962 are connected to the processor 980 through the audio circuit 960 for connection Sound signals are sent; the WiFi module 970 is used to receive and transmit WiFi signals, and the processor 980 is used to process data information of the mobile terminal device.

Abstract

A text information classification method, a mobile terminal, and a computer-readable storage medium. The classification method comprises: obtaining text information (S11); determining a vertical domain intention of the text information (S12); recalling the text information when the vertical domain intention of the text information meets a set vertical domain intention, and performing intention classification on the text information (S13); and refusing the text information when the vertical domain intention of the text information does not meet the set vertical domain intention (S14). By means of the method, the classification of the text information can be effectively accelerated, and computer occupied resources are reduced.

Description

文本信息的分类方法、移动终端及计算机可读存储介质Classification method of text information, mobile terminal and computer readable storage medium 技术领域Technical field
本申请涉及文本分类技术领域,特别是涉及一种文本信息的分类方法、移动终端及计算机可读存储介质。This application relates to the technical field of text classification, and in particular to a method for classifying text information, a mobile terminal, and a computer-readable storage medium.
背景技术Background technique
随着文本分类技术的发展,在线上线下的工业场景中,文本分类应用,如:电商领域的商品评价极性分析、资料文本的自动归档分类、论坛的敏感话题检验、语音助手的在线用户意图识别等。With the development of text classification technology, text classification applications in online and offline industrial scenarios, such as: product evaluation polarity analysis in the field of e-commerce, automatic archiving and classification of data text, sensitive topic inspection of forums, online users of voice assistants Intent recognition, etc.
其中在文本信息较为复杂时,对时效性的要求较高,往往需要在较短时间内使用较少的资源返回可靠的结果,对于这类应用,由于任务类别较多,涉及意图较为复杂且差异性较大,往往采用复杂的文本分类模型,以对复杂的文本信息进行统一处理。Among them, when the text information is more complex, the requirements for timeliness are higher, and it is often necessary to use fewer resources in a shorter time to return reliable results. For this type of application, due to the large number of task categories, the intent is more complicated and different. It is more flexible, and complex text classification models are often used to uniformly process complex text information.
目前,因为对于复杂的文本信息均采用复杂的文本分类模型,因此在输入的文本信息复杂程度不确定时,往往导致复杂分类模型的资源浪费和计算时间的延长,从而减慢了文本信息的分类识别速度,进而影响文本分类输出体验。At present, because complex text classification models are used for complex text information, when the complexity of the input text information is uncertain, it often leads to waste of resources and calculation time of the complex classification model, which slows down the classification of text information. The recognition speed, in turn, affects the text classification output experience.
发明内容Summary of the invention
本申请提供一种文本信息的分类方法、移动终端及计算机可读存储介质,以解决目前文本信息分类速度相对较慢的问题。This application provides a method for classifying text information, a mobile terminal, and a computer-readable storage medium to solve the problem of relatively slow text information classification.
本申请实施例的第一方面提供了一种文本信息的分类方法,包括:获取文本信息;确定文本信息的垂域意图;在文本信息的垂域意图满足设定垂域意图时,召回文本信息,再对文本信息进行意图分类;在文本信息的垂域意图不满足设定垂域意图时,拒绝文本信息。The first aspect of the embodiments of the present application provides a method for classifying text information, including: obtaining text information; determining the vertical domain intention of the text information; when the vertical domain intention of the text information meets the setting vertical domain intention, recalling the text information , And then classify the text information by intention; when the vertical domain intention of the text information does not meet the set vertical domain intention, the text information is rejected.
本申请实施例的第二方面提供了一种移动终端,包括:获取模块, 用于获取文本信息;确定模块,用于确定文本信息的垂域意图;召回模块,在文本信息的垂域意图满足设定垂域意图时,用于召回文本信息;意图分类模块,在召回模块召回文本信息后,用于对文本信息进行意图分类;拒绝模块,用于在文本信息的垂域意图不满足设定垂域意图时,拒绝文本信息。The second aspect of the embodiments of the present application provides a mobile terminal, including: an acquisition module for acquiring text information; a determining module for determining the vertical intention of the text information; a recall module, where the vertical intention of the text information satisfies When setting the vertical domain intention, it is used to recall text information; the intention classification module, after the recall module recalls the text information, is used to classify the text information; the rejection module is used when the vertical domain intention of the text information does not meet the setting In the case of vertical domain intention, the text message is rejected.
本申请实施例的第三方面提供了一种移动终端,包括:处理器、存储器以及存储在存储器中并在处理器上运行的计算机程序,处理器用于执行计算机程序以实现本申请实施例第一方面提供的方法。The third aspect of the embodiments of the present application provides a mobile terminal, including: a processor, a memory, and a computer program stored in the memory and running on the processor. The processor is used to execute the computer program to implement the first embodiment of the present application. The method provided by the aspect.
本申请实施例的第四方面提供了一种计算机可读存储介质,该计算机可读存储介质存储有计算机程序,计算机程序能够被处理器执行以实现本申请实施例第一方面提供的方法。The fourth aspect of the embodiments of the present application provides a computer-readable storage medium that stores a computer program, and the computer program can be executed by a processor to implement the method provided in the first aspect of the embodiments of the present application.
本申请的有益效果是:区别于现有技术的情况,本申请针对复杂程度不确定的文本信息,先确定文本信息的垂域意图;在文本信息的垂域意图满足设定垂域意图时,则召回文本信息,并对文本信息进行意图分类,对复杂程度不确定的文本信息采用不同分类方式,不同分类方式由于相对复杂模型更为简单,速度也更快,所以使得不同识别难度的文本信息可以在不同层级分类方式快速给出判别结果,从而加速意图分类。因此通过上述方式,能够有效地避免复杂分类模型的资源浪费并加速文本信息的分类,从而提升文本信息的分类识别速度,进而减小计算机占用资源。The beneficial effects of this application are: Different from the situation in the prior art, this application first determines the vertical domain intention of the text information for text information with uncertain complexity; when the vertical domain intention of the text information satisfies the vertical domain intention, The text information is recalled, and the text information is classified by intention. Different classification methods are used for the text information with uncertain complexity. The different classification methods are simpler and faster because of the relatively complex model, which makes the text information with different recognition difficulties The discrimination results can be quickly given in different levels of classification, thereby speeding up the intention classification. Therefore, through the above method, the waste of resources of the complex classification model can be effectively avoided and the classification of text information can be accelerated, so as to improve the classification and recognition speed of text information, and thereby reduce the resource occupation of the computer.
附图说明Description of the drawings
为了更清楚地说明本申请实施例中的技术方案,下面将对实施例描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本申请的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。In order to explain the technical solutions in the embodiments of the present application more clearly, the following will briefly introduce the drawings needed in the description of the embodiments. Obviously, the drawings in the following description are only some embodiments of the present application. For those of ordinary skill in the art, other drawings can be obtained based on these drawings without creative work.
图1是本申请的文本信息的分类方法第一实施例的流程示意图;Fig. 1 is a schematic flowchart of a first embodiment of a text information classification method of the present application;
图2是图1所示的步骤S12的一具体实施方式的流程示意图;FIG. 2 is a schematic flowchart of a specific implementation of step S12 shown in FIG. 1;
图3是图1所示的步骤S13的一具体实施方式的流程示意图;FIG. 3 is a schematic flowchart of a specific implementation of step S13 shown in FIG. 1;
图4是图3所示的步骤S33的一具体实施方式的流程示意图;FIG. 4 is a schematic flowchart of a specific implementation of step S33 shown in FIG. 3;
图5是图3所示的另一具体实施方式的流程示意图;FIG. 5 is a schematic flowchart of another specific embodiment shown in FIG. 3;
图6是本申请的文本信息的分类方法第二实施例的流程示意图;Fig. 6 is a schematic flowchart of a second embodiment of a text information classification method of the present application;
图7是本申请的移动终端一实施例的示意框图;FIG. 7 is a schematic block diagram of an embodiment of a mobile terminal of the present application;
图8是本申请的移动终端另一实施例的示意框图;FIG. 8 is a schematic block diagram of another embodiment of a mobile terminal of the present application;
图9是本申请计算机可读存储介质实施例的电路示意框图。Fig. 9 is a schematic block diagram of a circuit of an embodiment of a computer-readable storage medium of the present application.
图10是本申请的移动终端设备一实施例的结构组成示意图。FIG. 10 is a schematic structural composition diagram of an embodiment of a mobile terminal device of the present application.
具体实施方式detailed description
以下描述中,为了说明而不是为了限定,提出了诸如特定系统结构、技术之类的具体细节,以便透彻理解本申请实施例。然而,本领域的技术人员应当清楚,在没有这些具体细节的其它实施例中也可以实现本申请。在其它情况中,省略对众所周知的系统、装置、电路以及方法的详细说明,以免不必要的细节妨碍本申请的描述。In the following description, for the purpose of illustration rather than limitation, specific details such as a specific system structure and technology are proposed for a thorough understanding of the embodiments of the present application. However, it should be clear to those skilled in the art that the present application can also be implemented in other embodiments without these specific details. In other cases, detailed descriptions of well-known systems, devices, circuits, and methods are omitted to avoid unnecessary details from obstructing the description of this application.
应当理解,当在本说明书和所附权利要求书中使用时,术语“包括”指示所描述特征、整体、步骤、操作、元素和/或组件的存在,但并不排除一个或多个其它特征、整体、步骤、操作、元素、组件和/或其集合的存在或添加。It should be understood that when used in this specification and appended claims, the term "comprising" indicates the existence of the described features, wholes, steps, operations, elements and/or components, but does not exclude one or more other features The existence or addition of, whole, step, operation, element, component and/or its collection.
还应当理解,在此本申请说明书中所使用的术语仅仅是出于描述特定实施例的目的而并不意在限制本申请。如在本申请说明书和所附权利要求书中所使用的那样,除非上下文清楚地指明其它情况,否则单数形式的“一”、“一个”及“该”意在包括复数形式。It should also be understood that the terms used in the specification of this application are only for the purpose of describing specific embodiments and are not intended to limit the application. As used in the specification of this application and the appended claims, unless the context clearly indicates other circumstances, the singular forms "a", "an" and "the" are intended to include plural forms.
还应当进一步理解,在本申请说明书和所附权利要求书中使用的术语“和/或”是指相关联列出的项中的一个或多个的任何组合以及所有可能组合,并且包括这些组合。It should be further understood that the term "and/or" used in the specification and appended claims of this application refers to any combination of one or more of the items listed in the associated and all possible combinations, and includes these combinations .
如在本说明书和所附权利要求书中所使用的那样,术语“如果”可以依据上下文被解释为“当...时”或“一旦”或“响应于确定”或“响应于检测到”。类似地,短语“如果确定”或“如果检测到[所描述条件或事件]”可以依据上下文被解释为意指“一旦确定”或“响应于确定” 或“一旦检测到[所描述条件或事件]”或“响应于检测到[所描述条件或事件]”。As used in this specification and the appended claims, the term "if" can be interpreted as "when" or "once" or "in response to determination" or "in response to detection" depending on the context . Similarly, the phrase "if determined" or "if detected [described condition or event]" can be interpreted as meaning "once determined" or "in response to determination" or "once detected [described condition or event]" depending on the context ]" or "in response to detection of [condition or event described]".
为了说明本申请所述的技术方案,下面通过具体实施例来进行说明。In order to illustrate the technical solution described in the present application, specific embodiments are used for description below.
请参阅图1,图1是本申请的文本信息的分类方法第一实施例的流程示意图。本实施例提供的方法具体包括以下步骤:Please refer to FIG. 1. FIG. 1 is a schematic flowchart of a first embodiment of a text information classification method of the present application. The method provided in this embodiment specifically includes the following steps:
S11:获取文本信息;S11: Obtain text information;
一般来说,很多智能设备上设置有语音识别功能,语音助手成为人们日常的常见应用,语音助手类应用既包含较多复杂文本分类操作,也需要能够与用户实时交互。以移动终端为例,当移动终端开启语音助手应用时,可实时获取用户的语音输入,语音输入移动终端转换成该语音对应的文本信息,从而使得移动终端能够实时获取文本信息。Generally speaking, many smart devices are equipped with voice recognition functions, and voice assistants have become a common daily application for people. Voice assistant applications include more complicated text classification operations and need to be able to interact with users in real time. Taking a mobile terminal as an example, when the mobile terminal starts the voice assistant application, the user's voice input can be obtained in real time, and the voice input is converted into the text information corresponding to the voice by the mobile terminal, so that the mobile terminal can obtain the text information in real time.
此外,当移动终端设置有语音插孔,语音插孔可以插耳机,可以通过对耳机进行声音采集来获取文本信息。若通过无线耳机进行语音输入,也可以通过对无线耳机进行声音采集来获取文本信息。当然,本领域技术人员可以通过本领域公知的其他方式来获取文本信息。In addition, when the mobile terminal is provided with a voice jack, the voice jack can be plugged into a headset, and text information can be obtained by collecting sound from the headset. If voice input is performed through a wireless headset, text information can also be obtained by voice collection on the wireless headset. Of course, those skilled in the art can obtain text information in other ways known in the art.
S12:确定文本信息的垂域意图;S12: Determine the vertical intention of the text information;
通常,语音输入是单一文本信息输入,也即获取的文本信息也一般是单一文本信息输入,但是由于语音助手支持的功能繁多,实际在实现中有多个不同垂域的模型并行地处理这一条文本信息输入,如有一个模型专门处理情感问答,有一个模型专门处理系统操作,这两个模型都需要对这同一个文本信息输入作出响应。以上是以这两个模型进行举例,实际上可能有几十上百个模型同时处理一个文本信息输入,因此对计算资源的消耗较大。那么,能及时快速地确定获取的文本信息属于具体哪个垂域意图就显得尤为重要,也即确定文本信息属于哪个垂域的意图。Usually, the voice input is a single text information input, that is, the obtained text information is generally a single text information input, but due to the many functions supported by the voice assistant, there are actually multiple models of different vertical domains that are processed in parallel in the implementation. For text information input, if there is a model that specializes in emotional question and answer, and a model that specializes in system operations, both models need to respond to the same text information input. The above is an example of these two models. In fact, there may be dozens or hundreds of models processing one text information input at the same time, which consumes a lot of computing resources. Then, it is particularly important to be able to quickly and quickly determine which vertical domain the acquired text information belongs to, that is, to determine which vertical domain intention the text information belongs to.
因此,可以对获取的文本信息的垂域意图进行粗选,若确定文本信息的垂域意图属于某个大概的垂域意图,则进入步骤S13,从而快速返回分类结果,进而大大节省了后续计算资源。Therefore, the vertical intent of the obtained text information can be roughly selected. If it is determined that the vertical intent of the text information belongs to a certain approximate vertical intent, step S13 is entered to quickly return the classification result, thereby greatly saving subsequent calculations. resource.
S13:在文本信息的垂域意图满足设定垂域意图时,召回文本信息, 再对文本信息进行意图分类;S13: When the vertical domain intention of the text information satisfies the set vertical domain intention, recall the text information, and then classify the text information by intention;
移动终端预设有设定垂域意图,用于判别文本信息的垂域意图是否满足设定垂域意图。因为设定垂域意图模块更加细化,能够将输入的文本信息的垂域意图直接分类到本垂域内的具体意图。由于判别文本信息的垂域意图是否满足设定垂域意图的任务更为细致,本模块相对确定文本信息的垂域意图更加复杂。本模块同样具有拒绝能力,即将命中拒绝类别的文本信息返回拒绝意图。The mobile terminal is preset with a vertical domain setting intention, which is used to determine whether the vertical domain intention of the text information satisfies the vertical domain setting intention. Because the vertical domain intention setting module is more detailed, the vertical domain intention of the input text information can be directly classified into the specific intention within the vertical domain. Since the task of judging whether the vertical intention of text information meets the setting of vertical intention is more detailed, this module is more complicated than determining the vertical intention of text information. This module also has the rejection capability, that is, the text message that hits the rejection category is returned to the rejection intention.
对于垂域类任务的分类,只有部分文本信息会通过速度很快地确定垂域意图模块,并进行文本信息垂域意图是否满足设定垂域意图的判别。因为通过前面多个模型地筛选,已经有较大几率确认输入文本信息是属于设定垂域意图的文本信息输入。For the classification of vertical domain tasks, only part of the text information will quickly determine the vertical domain intention module, and judge whether the text information vertical domain intention meets the set vertical domain intention. Because through the screening of the previous multiple models, there is a greater chance of confirming that the input text information belongs to the text information input that is intended to set the vertical domain.
在文本信息的垂域意图满足设定垂域意图时,则召回文本信息,再对文本信息进行意图分类。进一步,在满足设定垂域意图后还可以产生相应的中断信号,以通知移动终端执行相应的操作。When the vertical domain intention of the text information satisfies the set vertical domain intention, the text information is recalled, and the text information is classified by intention. Further, after satisfying the intention of setting the vertical domain, a corresponding interrupt signal can be generated to notify the mobile terminal to perform a corresponding operation.
S14:在文本信息的垂域意图不满足设定垂域意图时,拒绝文本信息。S14: When the vertical domain intention of the text information does not satisfy the set vertical domain intention, the text information is rejected.
通过上述方式,本申请针对复杂程度不确定的文本信息,先确定文本信息的垂域意图;在文本信息的垂域意图满足设定垂域意图时,则召回文本信息,并对文本信息进行意图分类,对复杂程度不确定的文本信息采用不同分类方式,不同分类方式由于相对复杂模型更为简单,速度也更快,所以使得不同识别难度的文本信息可以在不同层级分类方式快速给出判别结果,从而加速意图分类。因此通过上述方式,能够有效地避免复杂分类模型的资源浪费并加速文本信息的分类,从而提升文本信息的分类识别速度,进而减小计算机占用资源。Through the above method, this application first determines the vertical intention of the text information for text information with uncertain complexity; when the vertical intention of the text information meets the vertical intention of the set vertical domain, the text information is recalled and the intention of the text information is determined. Classification. Different classification methods are used for text information with uncertain complexity. Different classification methods are simpler and faster in relatively complex models. Therefore, text information with different recognition difficulties can be quickly classified at different levels to give the discrimination results. , Thereby speeding up intent classification. Therefore, through the above method, the waste of resources of the complex classification model can be effectively avoided and the classification of text information can be accelerated, so as to improve the classification and recognition speed of text information, and thereby reduce the resource occupation of the computer.
请参阅图2,图2是图1所示的步骤S12的一具体实施方式的流程示意图,具体包括以下步骤:Please refer to FIG. 2. FIG. 2 is a schematic flowchart of a specific implementation of step S12 shown in FIG. 1, which specifically includes the following steps:
S21:将文本信息与多个关键词组进行关键词匹配,以得到多个匹配度;其中,每个关键词组对应一个垂域意图;S21: Perform keyword matching between the text information and multiple keyword groups to obtain multiple matching degrees; wherein, each keyword group corresponds to a vertical domain intention;
在本步骤主要用于粗选获取的文本信息,所以可以采用粗召回模块 对获取的文本信息进行处理。由于移动终端预设有多个技能组形成的模型,比如多个关键词组,其中,每个关键词组对应一个垂域意图,且每个关键词组为多个关键词形成的正则表达式,则正则表达式可以用于粗选获取的文本信息的垂域意图,比如采用较为简单的正则表达式。对于简单的正则表达式的使用场景,如某一技能组专门用于处理闹钟、倒计时、日程等任务,对于这一类任务,“时间”的输入文本是一个重要元素,因此可以使用简单正则表达式。如“{2,4}年{1,2}月{1,2}日”来检验输入中是否包含时间元素,如果输入文本包含时间元素,同时包含任务关键词如“闹钟”“计时”等,则可以被粗召回模块召回进入后续流程。In this step, it is mainly used for rough selection of the acquired text information, so the rough recall module can be used to process the acquired text information. Since the mobile terminal presets a model formed by multiple skill groups, such as multiple keyword groups, where each keyword group corresponds to a vertical domain intention, and each keyword group is a regular expression formed by multiple keywords, then The expression can be used to roughly select the vertical intention of the obtained text information, for example, using a simpler regular expression. For simple regular expression usage scenarios, such as a certain skill group dedicated to processing tasks such as alarm clocks, countdowns, schedules, etc. For this type of tasks, the input text of "time" is an important element, so simple regular expressions can be used Mode. Such as "{2,4}year{1,2}month{1,2}day" to check whether the input contains a time element, if the input text contains a time element, it also contains task keywords such as "alarm clock", "timing", etc. , It can be recalled by the coarse recall module and enter the follow-up process.
因为本模块会处理全部的文本信息输入,因此对速度和计算复杂度的要求较高。因此在此模块内,简单的正则表达式被用于召回文本信息。通过使用简单的正则表达式对文本信息的处理,使得移动终端能够快速筛选出属于本垂域意图的文本信息,而不属于本垂域意图的文本信息直接返回拒绝的分类结果,从而较大地节省了后续计算资源。Because this module will process all text information input, it has higher requirements for speed and computational complexity. Therefore, in this module, simple regular expressions are used to recall textual information. By using simple regular expressions to process the text information, the mobile terminal can quickly filter out the text information that belongs to the local domain intention, and the text information that does not belong to the local domain intention directly returns the rejected classification result, thereby greatly saving For subsequent computing resources.
S22:将对应多个关键词组的多个匹配度进行相关性排序;S22: Sort the multiple matching degrees corresponding to multiple keyword groups by relevance;
移动终端预的各个技能组同时处理获取的文本信息,以便得到多个匹配度,将多个关键词组对应的多个匹配度进行相关性排序,可以得到不同的粗筛选结果。Each skill group preset by the mobile terminal processes the acquired text information at the same time to obtain multiple matching degrees, and the multiple matching degrees corresponding to the multiple keyword groups are sorted by relevance to obtain different rough screening results.
再者,一个垂域技能组有一个粗召回模块。只匹配关键词或使用简单正则表达式匹配相比统计学模型或深度学习模型计算量大大减少。通过使用真实生成环境的数据进行测试,平均耗时和峰值都比单一模型有数量级的提升。Furthermore, a vertical domain skill group has a rough recall module. Only matching keywords or using simple regular expression matching is greatly reduced compared to statistical models or deep learning models. By using the data of the real generation environment for testing, the average time and peak value are orders of magnitude higher than that of a single model.
S23:将匹配度最高的一个关键词组所对应的垂域意图,作为文本信息的垂域意图。S23: Use the vertical intent corresponding to the keyword group with the highest matching degree as the vertical intent of the text information.
经过相关性排序获取的粗筛选结果,可以得到匹配度最高的一个关键词组所对应的垂域意图,从而可以确定文本信息的垂域意图。After the coarse screening results obtained by relevance sorting, the vertical domain intention corresponding to the keyword group with the highest matching degree can be obtained, so that the vertical domain intention of the text information can be determined.
当然,本领域技术人员在本申请的技术启示下完全可以想到根据实际需要设置其他的确定文本信息垂域方式。Of course, under the technical enlightenment of this application, those skilled in the art can completely think of setting other methods for determining the vertical domain of text information according to actual needs.
请参阅图3,图3是图1所示的步骤S13的一具体实施方式的流程示意图,具体包括以下步骤:Please refer to FIG. 3. FIG. 3 is a schematic flowchart of a specific implementation of step S13 shown in FIG. 1, which specifically includes the following steps:
S31:在文本信息的垂域意图满足设定垂域意图时,召回文本信息,并对文本信息进行第一次意图分类;其中,第一次意图分类至少包括至少一个意图类和一个拒绝类;S31: When the vertical domain intention of the text information satisfies the set vertical domain intention, recall the text information and perform the first intention classification of the text information; wherein the first intention classification includes at least one intention class and one rejection class;
对于垂域类任务的分类,只有部分文本信息会通过速度很快的粗召回模块,到达步骤S31,步骤S31可以采用正则表达式召回模块,也即正则召回模型。这一模块和粗召回模块同样使用了计算速度快的正则表达式,区别在于粗召回模块只区分任务是否属于本垂域任务,而正则召回模型则更加细致,能够将输入文本信息直接分类到本垂域内的具体意图,也即设定垂域意图。由于任务更为细致,本模块内使用的正则表达式相比粗召回模块更加复杂。不过,本模块同样具有拒绝能力,即将命中拒绝类别的文本信息,返回拒绝意图。For the classification of vertical tasks, only part of the text information will pass through the fast coarse recall module to step S31. In step S31, a regular expression recall module, that is, a regular recall model, can be used. This module and the coarse recall module also use regular expressions with fast calculation speed. The difference is that the coarse recall module only distinguishes whether the task belongs to the local task, while the regular recall model is more detailed and can directly classify the input text information into the local task. The specific intent within the vertical domain is to set the vertical domain intention. Due to the more detailed tasks, the regular expressions used in this module are more complicated than the coarse recall module. However, this module also has the ability to reject, that is, it will hit the text message of the rejection category and return the rejection intention.
在文本信息的垂域意图满足设定垂域意图时,表示文本信息属于设定垂域意图,则召回文本信息,并对文本信息进行第一次意图分类;其中,第一次意图分类至少包括至少一个意图类和一个拒绝类,以表示第一次意图分类有拒绝的能力。When the vertical domain intention of the text information satisfies the vertical domain intention, it means that the text information belongs to the vertical domain intention, then the text information is recalled and the text information is classified for the first time. Among them, the first intention classification includes at least At least one intention class and one rejection class to indicate that the first intention classification has the ability to reject.
并且针对召回的文本信息,可以将文本信息输入至正则召回模型,以使正则召回模型对文本信息进行第一次意图分类,其中,第一次意图分类至少包括至少一个意图类和一个拒绝类。And for the recalled text information, the text information can be input into the regular recall model, so that the regular recall model classifies the text information for the first time, where the first intention classification includes at least one intention class and one rejection class.
具体地,将文本信息,与正则召回模型的正则数据库,进行串行匹配,以使正则召回模型对文本信息进行第一次意图分类,并输出第一意图分类结果;其中,第一意图分类结果包括至少一个意图类结果和一个拒绝类结果。Specifically, the text information is serially matched with the regular database of the regular recall model, so that the regular recall model performs the first intention classification of the text information, and outputs the first intention classification result; wherein, the first intention classification result Include at least one result of intent and one result of rejection.
如粗召回模块中命中了关键词“闹钟”和关键文本“明天”,则会把输入的文本信息分配给闹钟相关的正则表达式进行串行的匹配;由于正则召回模型主要针对处理高频次简单的文本信息和较为复杂难以使用模型进行分类的文本信息,因此串行的正则表达式并不会太多。并且对高频文本信息使用正则表达式匹配来分类可以节省计算时间和资源。 当然,正则召回模型也对普通的文本信息进行处理。If the keyword "alarm clock" and the key text "tomorrow" are hit in the coarse recall module, the input text information will be assigned to the regular expression related to the alarm clock for serial matching; because the regular recall model is mainly for processing high frequency Simple text information and more complex text information that is difficult to use the model to classify, so there are not too many serial regular expressions. And using regular expression matching to classify high-frequency text information can save computing time and resources. Of course, the regular recall model also processes ordinary text information.
当文本信息满足第一意图分类结果的至少一个意图类时,则进入步骤S32;当文本信息不满足第一意图分类结果的至少一个意图类和拒绝类时,则进入步骤S33;当文本信息满足第一次意图分类的拒绝类时,则拒绝文本信息。When the text information meets at least one intent class of the first intent classification result, go to step S32; when the text information does not meet the at least one intent class and rejection class of the first intent classification result, go to step S33; when the text information meets When the rejection category of the classification is intended for the first time, the text information is rejected.
S32:在文本信息满足第一次意图分类的至少一个意图类中的一个时,对文本信息进行槽位提取;S32: When the text information satisfies one of the at least one intent class of the first intent classification, perform slot extraction on the text information;
通常,用户可以根据业务需求进行增添删改正则召回模型中的正则表达式。这使得正则召回模型中的正则表达式具备方便性以及可控性,可以用于快速修复以及修改少量特定文本信息,快速控制输出结果。Generally, users can add, delete, modify, and recall the regular expressions in the model according to business needs. This makes the regular expressions in the regular recall model convenient and controllable, and can be used to quickly repair and modify a small amount of specific text information, and quickly control the output results.
对于高频文本信息的处理,以举例进行说明,如在闹钟场景中,“设一个明天早上八点的闹钟”是较为高频的说法,如在一千万的输入文本信息中,这一条说法出现了十万次,则只需要设置一条正则表达式,就可以提早召回这十万条文本信息,使得文本信息满足第一次意图分类的至少一个意图类,从而节省了十万次深度模型的计算资源消耗;同时也提高较多文本信息的处理效率,收益较高。For the processing of high-frequency text information, take an example to illustrate. For example, in the alarm clock scene, "set an alarm clock at 8 o'clock tomorrow morning" is a relatively high-frequency statement, such as ten million input text information, this statement If there are one hundred thousand times, you only need to set a regular expression to recall these one hundred thousand pieces of text information early, so that the text information meets at least one intent class of the first intent classification, thus saving one hundred thousand times in the depth model. Computational resource consumption; at the same time, the processing efficiency of more text information is improved, and the benefits are higher.
在文本信息满足第一次意图分类的至少一个意图类中的一个时,则对文本信息进行槽位提取。When the text information satisfies one of the at least one intent class of the first intent classification, the text information is subjected to slot extraction.
具体地,当文本信息满足高频次的简单文本信息,以及较为复杂难以使用模型进行分类的文本信息输入中的一种时,对文本信息进行槽位提取,具体的槽位提取可以根据业务需求来确定,比如文本信息的内容、人名、金额等。Specifically, when the text information satisfies one of the high-frequency simple text information and the more complicated text information input that is difficult to use the model to classify, the text information is extracted from the slot, and the specific slot extraction can be based on business requirements To determine, such as the content of the text message, the name of the person, the amount, etc.
S33:在文本信息不满足第一次意图分类的至少一个意图类和拒绝类时,对文本信息进行第二次意图分类。S33: When the text information does not satisfy at least one of the intent class and the rejection class of the first intent classification, perform the second intent classification on the text information.
对于通过前面模型的筛选,得到文本信息不满足第一次意图分类的至少一个意图类和拒绝类,那么移动终端则认为文本信息是属于第二次意图分类的,也即确认输入的文本信息是属于本垂域意图的输入,这一部分在所有输入内的占比已经较小,因此可以使用复杂度较大,而效果更好的深度神经网络进行第二次意图分类。For the filtering of the previous model, the text information obtained does not satisfy at least one intention category and rejection category of the first intention classification, then the mobile terminal considers the text information to belong to the second intention classification, that is, confirm that the input text information is The input that belongs to the vertical domain intention, this part of the proportion of all inputs is already small, so the deep neural network with greater complexity and better effect can be used for the second intention classification.
请参阅图4,图4是图3所示的步骤S33的一具体实施方式的流程示意图,具体包括以下步骤:Please refer to FIG. 4. FIG. 4 is a schematic flowchart of a specific implementation of step S33 shown in FIG. 3, which specifically includes the following steps:
S41:判断文本信息的第二意图分类是否满足第二次意图分类的至少一个意图类;S41: Determine whether the second intent classification of the text information satisfies at least one intent class of the second intent classification;
第二次意图分类包括至少一个意图类和一个拒绝类,设置至少一个意图类,则可用于判别文本信息的第二次意图分类是否满足第二次意图分类的至少一个意图类中的一个。而对文本信息进行第二次意图分类,具体包括:The second intent classification includes at least one intent class and one rejection class. Setting at least one intent class can be used to determine whether the second intent classification of the text information satisfies one of the at least one intent class in the second intent classification. The second intention classification of text information includes:
将文本信息输入至意图分类模型,以使意图分类模型对文本信息进行第二次意图分类,并输出第二意图分类结果;其中,第二意图分类结果包括至少一个意图类和一个拒绝类。The text information is input to the intent classification model, so that the intent classification model performs a second intent classification on the text information, and outputs a second intent classification result; wherein the second intent classification result includes at least one intent class and one rejection class.
其中,第二次意图分类模块可以使用文本卷积神经网络(Text Convolutional Neural Network,Text CNN)模型,也即通过卷积神经网络对文本进行分类的方法,对进入此模块的文本信息进行N+1个分类,即N个属于本垂域任务意图的类别,以及一个不属于本垂域的类别,也即拒绝能力,其中,N表示大于或等于1的正整数。Among them, the second intention classification module can use the Text Convolutional Neural Network (Text CNN) model, that is, the method of classifying text through the convolutional neural network, and the text information entering this module is N+ One category, that is, N categories that belong to the task intent of the local vertical domain, and one category that does not belong to the local vertical domain, that is, rejection capability, where N represents a positive integer greater than or equal to 1.
Text CNN模型相比规则匹配,表现更好,根据业务需求,除了选用Text CNN模型,还可以选用长短期记忆(Long Short-Term Memory,LSTM)模型、门控循环单元(Gate Recurrent Unit,GRU)模型、转换器(Transformer)模型、双向编码表征(Bidirectional Encoder Represenations from Transformers,BERT)模型、文本到文本(Text-to-Text Transfer Transformer,T5)模型等更复杂的模型,Text CNN模型不是一个必需的选项,只是以Text CNN模型为实际使用示例;如果业务情况可以容忍更长的相应时间,可以选择更复杂的模型。The Text CNN model performs better than rule matching. According to business needs, in addition to the Text CNN model, you can also use the Long Short-Term Memory (LSTM) model and the Gate Recurrent Unit (GRU) Model, Transformer (Transformer) model, Bidirectional Encoder Represenations from Transformers (BERT) model, Text-to-Text (Transfer Transformer, T5) model and other more complex models, Text CNN model is not a requirement The option of is just taking the Text CNN model as an actual use example; if the business situation can tolerate a longer response time, you can choose a more complex model.
并且还可根据实际业务选择模型参数进行调优,可对比不同参数下的资源消耗和表现收益选取模型,具体此处不做限定。It can also be tuned according to actual business selection model parameters, and the resource consumption and performance gain selection models under different parameters can be compared. The specifics are not limited here.
若文本信息满足第二意图分类结果中的至少一个意图类,则进入步骤S42,若文本信息满足第二意图分类结果中的拒绝类,则进入步骤S43。If the text information satisfies at least one intent class in the second intention classification result, then step S42 is entered, and if the text information satisfies the rejection class in the second intention classification result, step S43 is entered.
S42:对文本信息进行槽位提取;S42: Perform slot extraction on text information;
输入文本信息在经过以上模块的处理之后,已经有较高的分类准确率,以及对应需求的槽位结果。在文本信息满足第二意图分类结果的至少一个意图类时,则对文本信息进行槽位提取,对于提取文本信息的槽位,在下文会进行详细解释。After the input text information has been processed by the above modules, it already has a higher classification accuracy and corresponding slot results. When the text information satisfies at least one intent category of the second intent classification result, the text information is subjected to slot extraction. The slots for extracting the text information will be explained in detail below.
S43:拒绝文本信息。S43: Reject the text message.
若文本信息满足第二意图分类结果中的拒绝类,则表示文本信息属于拒绝类,则返回拒绝意图,也即确定不属于本垂域意图的文本信息则返回拒绝的分类结果,从而节省后续计算资源。If the text information meets the rejection category in the second intention classification result, it means that the text information belongs to the rejection category, and the rejection intention is returned, that is, the text information that is determined not to belong to the original domain intention is returned to the rejected classification result, thereby saving subsequent calculations resource.
请参阅图5,图5是图3所示的另一具体实施方式的流程示意图,具体包括以下步骤:Please refer to FIG. 5. FIG. 5 is a schematic flowchart of another specific embodiment shown in FIG. 3, which specifically includes the following steps:
S51:在文本信息的垂域意图满足设定垂域意图时,召回文本信息,并对文本信息进行第一次意图分类;S51: When the vertical domain intention of the text information satisfies the vertical domain intention, the text information is recalled, and the text information is classified for the first time;
此步骤S51与图3中步骤S31相类似,具体此处不再赘述。This step S51 is similar to step S31 in FIG. 3, and the details will not be repeated here.
S52:判断文本信息的第一次意图分类是否满足预设的第一次意图分类的至少一个意图类和一个拒绝类;S52: Determine whether the first intention classification of the text information meets at least one intention class and one rejection class of the preset first intention classification;
具体地,通常移动终端可以设置预设的第一次意图分类,通过预设的第一次意图分类用于判别文本信息的第一次意图分类是否满足预设的第一次意图分类。在本实施例中,预设的第一次意图分类包括至少一个意图类和一个拒绝类。若判断到文本信息的第一次意图分类是否满足预设的第一次意图分类的至少一个意图类和一个拒绝类时,则进入步骤S55,若判断到不满足,则进入步骤S53。Specifically, usually the mobile terminal can set a preset first intention classification, and the preset first intention classification is used to determine whether the first intention classification of the text information meets the preset first intention classification. In this embodiment, the preset first intention classification includes at least one intention class and one rejection class. If it is judged whether the first intention classification of the text information meets at least one intention class and one rejection class of the preset first intention classification, then step S55 is entered, and if it is judged not satisfied, step S53 is entered.
其中步骤S52、S55与图3中步骤S32相类似,具体此处不再赘述。Steps S52 and S55 are similar to step S32 in FIG. 3, and the details are not repeated here.
在本实施例中,还可以是若文本信息满足第一次意图分类的至少一个意图类,则进入步骤S55,而当若文本信息满足第一次意图分类的拒绝类时,可以直接返回拒绝分类意图。In this embodiment, if the text information satisfies at least one intent category of the first intention classification, then step S55 is entered, and when the text information satisfies the rejection category of the first intention classification, the rejection classification can be directly returned. intention.
当然,本领域技术人员在本申请的技术启示下完全可以想到根据实际需要设置其他的方式以使文本信息的第一次意图分类满足预设的第一次意图分类条件。Of course, under the technical enlightenment of this application, those skilled in the art can completely conceive of setting other methods according to actual needs so that the first intent classification of text information meets the preset first intent classification condition.
S53:再次确定文本信息的垂域意图;S53: Re-determine the vertical intention of the text information;
经过前粗召回模型和正则召回模型这两个模块的过滤,只有部分的文本信息会再次确定文本信息的垂域意图。After filtering by the two modules of the former coarse recall model and the regular recall model, only part of the text information will determine the vertical domain intention of the text information again.
在对文本信息进行第二次意图分类之前,再次确定文本信息的垂域意图。对于再次确定文本信息的垂域意图,可以采用意图召回模型。此模型任务同粗召回模块相同,即对输入文本信息进行再次分类,以判别输入的文本信息属于本垂域任务意图或不属于本垂域任务意图。由于正则表达式能够处理的复杂度有限,部分文本信息难以在前两个模块完成分类,因此需要再次借助具备神经网络泛化能力的意图召回模型对文本信息进行处理。Before the second intention classification of the text information, the vertical intention of the text information is determined again. For re-determining the vertical intention of the text information, the intention recall model can be used. This model task is the same as the rough recall module, that is, the input text information is reclassified to determine whether the input text information belongs to the local task intent or does not belong to the local task intent. Due to the limited processing complexity of regular expressions, it is difficult to classify part of the text information in the first two modules. Therefore, the text information needs to be processed again with the help of an intention recall model with neural network generalization capabilities.
具体地,将文本信息输入至意图召回模型,以使意图召回模型确定文本信息的垂域意图;其中,意图召回模型中可以设定置信度阈值,该设定置信度阈值可以用来判别文本信息的垂域意图,设定置信度阈值是可调节的,通过调整设定置信度阈值,可以增加文本信息的召回率(Recall rate),也即将真实标注为正样本分类为正样本的比例。Specifically, the text information is input to the intention recall model, so that the intention recall model determines the vertical intention of the text information; wherein, a confidence threshold can be set in the intention recall model, and the set confidence threshold can be used to distinguish the text information For the vertical domain intention, the set confidence threshold is adjustable. By adjusting the set confidence threshold, the recall rate of text information can be increased (Recall rate), that is, the proportion of positive samples that are actually marked as positive samples are classified as positive samples.
其中,意图召回模型可以根据设定置信度阈值确定文本信息的垂域意图,包括:Among them, the intention recall model can determine the vertical intention of the text information according to the set confidence threshold, including:
判断文本信息的垂域意图是否满足设定置信度阈值;Determine whether the vertical domain intention of the text information meets the set confidence threshold;
若满足设定置信度阈值,则确定文本信息的垂域意图;If the set confidence threshold is met, the vertical intention of the text information is determined;
若不满足设定置信度阈值,则确定拒绝文本信息。If the set confidence threshold is not met, the text information is determined to be rejected.
根据业务需求,意图召回模型可以为快速文本(Fast Text)神经网络模型,也即一种学习词嵌入以及文本分类的方法,因此意图召回模型借助Fast Text神经网络模型的泛化能力,使得模型能够处理没有获取过的文本信息输入。意图召回模型的计算复杂度比正则表达式大,但准确率比正则表达式高。According to business requirements, the intention recall model can be a Fast Text neural network model, which is a method of learning word embedding and text classification. Therefore, the intention recall model uses the generalization ability of the Fast Text neural network model to enable the model to Process the input of text information that has not been acquired. The computational complexity of the intention recall model is greater than that of regular expressions, but the accuracy rate is higher than that of regular expressions.
另外,根据业务需求,意图召回模型还可以为还可以为卷积神经网络(Convolutional Neural Network,CNN)模型,CNN模型是一种前馈神经网络模型。值得注意的是,此处的CNN模型主要是指参数较少的CNN模型以及带有注意(attention)模块的CNN模型。比如,使用功能图(feature map)数量较少的Text CNN,如一般使用(2,256),(3,256), (4,256),而简化场景下可使用(2,32),(3,32),(4,32)减少计算复杂度,attention模块也类似,可以将attention模块中的QKV线性投影到低维如32维后进行attention计算,以此获取部分attention能力的同事减少计算复杂度。In addition, according to business requirements, the intention recall model can also be a convolutional neural network (Convolutional Neural Network, CNN) model, which is a feedforward neural network model. It is worth noting that the CNN model here mainly refers to the CNN model with fewer parameters and the CNN model with an attention module. For example, using Text CNN with a small number of feature maps, such as (2,256), (3,256), (4,256), and (2,32), (3,32), ( 4,32) Reduce the computational complexity, and the attention module is similar. The QKV in the attention module can be linearly projected to a low-dimensional such as 32-dimensional and then the attention calculation can be performed to reduce the computational complexity of colleagues who obtain part of the attention ability.
S55:在文本信息的垂域意图满足设定垂域意图时,执行对文本信息进行第二次意图分类的步骤。S55: When the vertical domain intention of the text information satisfies the set vertical domain intention, the step of performing the second intention classification of the text information is performed.
此步骤S55与图3中步骤S33相类似,具体此处不再赘述。This step S55 is similar to step S33 in FIG. 3, and the details will not be repeated here.
请参阅图6,图6是本申请的文本信息的分类方法第二实施例的流程示意图。本实施例提供的方法具体包括以下步骤:Please refer to FIG. 6. FIG. 6 is a schematic flowchart of a second embodiment of a text information classification method of the present application. The method provided in this embodiment specifically includes the following steps:
S61:获取文本信息;S61: Obtain text information;
S62:确定文本信息的垂域意图;S62: Determine the vertical intention of the text information;
S63:判断文本信息的垂域意图是否满足设定垂域意图;S63: Determine whether the vertical domain intention of the text information satisfies the set vertical domain intention;
S64:若文本信息的垂域意图满足设定垂域意图,召回文本信息,再对文本信息进行意图分类;S64: If the vertical domain intention of the text information satisfies the set vertical domain intention, the text information is recalled, and the text information is classified by intention;
其中,步骤S61、S62、S63、S64分别与图1中的S11、S12、S13、S14相类似,具体此处不再赘述。Among them, steps S61, S62, S63, and S64 are respectively similar to S11, S12, S13, and S14 in FIG. 1, and the details are not repeated here.
其中,步骤S63可以通过判断的方式对文本信息的垂域意图是否满足设定垂域意图进行辨别,也可以采用其他的方式,此处不做具体限定。Wherein, in step S63, whether the vertical domain intention of the text information meets the set vertical domain intention can be discriminated by means of judgment, and other methods may also be used, which is not specifically limited here.
另外,文本信息进行槽位提取,将文本信息输入至槽位提取模块,以使槽位提取模块对文本信息进行槽位提取,并输出槽位提取结果。In addition, the text information performs slot extraction, and the text information is input to the slot extraction module, so that the slot extraction module performs slot extraction on the text information and outputs the slot extraction result.
其中,槽位提取模块,可以采取双向长期记忆(Bi-Long Short-Term Memory,Bi-LSTM)模型和条件随机场(Conditional Random Fields,CRF)模型的方法来提取,其中,Bi-LSTM模型是一种时间递归神经网络;CRF模型是一种条件概率分布模型。Among them, the slot extraction module can be extracted by using the Bi-Long Short-Term Memory (Bi-LSTM) model and the Conditional Random Fields (CRF) model. Among them, the Bi-LSTM model is A time recurrent neural network; CRF model is a conditional probability distribution model.
此外,还可以采取槽位正则表达式模型来提取文本信息的槽位。In addition, the slot regular expression model can also be used to extract the slots of the text information.
S65:利用验证规则库,对文本信息的槽位进行验证。S65: Use the verification rule library to verify the slot of the text information.
对文本信息进行槽位提取之后,还包括:利用验证规则库,对文本信息进行验证。After the text information is extracted from the slots, it also includes: using the verification rule library to verify the text information.
具体地,移动终端预设有验证规则库,通过利用验证规则库,可以 对文本信息的槽位进行验证。验证模块通过使用规则,对各意图下特定所必须或不能包含的关键词以及对应槽位结果进行校验,对极少数通过模型而又不符合定义或者要求的文本信息进行拒绝,其中,验证模块可以通过配置不同意图下的验证规则快速修改以及生效。Specifically, the mobile terminal is preset with a verification rule library, and by using the verification rule library, the slot of the text information can be verified. The verification module uses rules to verify specific keywords that are required or cannot be included under each intent and the corresponding slot results, and reject a very small number of text messages that pass the model but do not meet the definition or requirements. Among them, the verification module You can quickly modify and take effect by configuring the verification rules under different intents.
比如验证规则库通过线上实际问题案件人为设定,验证规则可以设置更为细致的规则,如对于闹钟相关任务,输入的文本信息为“打开小闹钟”,被分类为“打开闹钟”意图,而实际上“小闹钟”是一款第三方app,则可以设置“小闹钟”为“打开闹钟”意图的拒绝关键词。For example, the verification rule library is artificially set by online actual problem cases, and the verification rules can be set with more detailed rules. For example, for alarm-related tasks, the input text information is "open the small alarm clock", which is classified as the intention of "open the alarm clock". In fact, "Small Alarm Clock" is a third-party app, you can set "Small Alarm Clock" as a rejection keyword for the intention of "open the alarm clock".
S66:拒绝文本信息。S66: Reject the text message.
步骤S67与图1中的S15相类似,具体此处不再赘述。Step S67 is similar to S15 in FIG. 1, and the details are not repeated here.
因此,本方案比如在Breeno语音助手的手机常用功能的实际使用中,在粗召回模块能够拒绝90%以上不属于本垂域任务意图的输入域,同时通过增加关键词以保证召回率超过99.9%;而在正则表达式模块,超过30%的高频垂域意图文本信息可以被快速处理,直接进入槽位提取模块。总体上,本方案提出的分层次框架比单层或双层的意图分类框架,具体地,线上实际情况节省0~50%时间,平均响应从>10ms到10ms以内,因此可以节省超过50%的计算时间以及计算资源。Therefore, this solution, for example, in the actual use of the common functions of the Breeno voice assistant's mobile phone, the coarse recall module can reject more than 90% of the input fields that do not belong to the task intent of the vertical domain, and at the same time, by adding keywords to ensure that the recall rate exceeds 99.9% ; In the regular expression module, more than 30% of the high-frequency vertical field intention text information can be processed quickly and directly enter the slot extraction module. In general, the hierarchical framework proposed by this solution is compared with a single-layer or two-layer intention classification framework. Specifically, the actual online situation saves 0-50% time, and the average response is from >10ms to less than 10ms, so it can save more than 50% Computing time and computing resources.
另外,在不同层次使用正则表达式使得本方案的可控性更高,重新训练模型的频次更少。而使用多个简单模型的设计使得在针对特定类别的输入重新训练模型时,可以尽量减少对其他意图识别结果的改变。这使得在对错误进行修复,或者对垂域任务意图分类定义进行修改时更加简单,避免频繁对复杂模型进行更新,节省了大量的人力以及计算资源。In addition, the use of regular expressions at different levels makes the solution more controllable, and the retraining of the model is less frequent. The design of using multiple simple models makes it possible to minimize changes to other intent recognition results when retraining the model for specific types of input. This makes it easier to repair errors or modify vertical task intent classification definitions, avoid frequent updates to complex models, and save a lot of manpower and computing resources.
因此,本方案通过将复杂模型拆分为多个相对简单的模型,同时在不同层级使用计算速度更快的正则表达式,使得不同识别难度的文本信息可以在不同层级提早给出判别结果,加速意图分类。并且通过使用更多层级,并且在不同层级插入正则表达式模块的做法,使得最终结果的可控性更高,可以通过对配置文件进行少量的改动达到快速修改输出结果的目的。Therefore, this solution splits the complex model into multiple relatively simple models, and at the same time uses regular expressions with faster calculation speeds at different levels, so that text information with different recognition difficulties can be discriminated earlier at different levels, speeding up Intent classification. And by using more levels and inserting regular expression modules at different levels, the final result is more controllable, and the output result can be quickly modified by making a small amount of changes to the configuration file.
请参见图7,图7是本申请实施例一种移动终端的结构示意图。本 申请实施例提供了一种移动终端7,包括:Please refer to FIG. 7, which is a schematic structural diagram of a mobile terminal according to an embodiment of the present application. The embodiment of the present application provides a mobile terminal 7, including:
获取模块71,用于获取文本信息;The obtaining module 71 is used to obtain text information;
确定模块72,用于确定文本信息的垂域意图;The determining module 72 is used to determine the vertical intention of the text information;
召回模块73,在文本信息的垂域意图满足设定垂域意图时,用于召回文本信息;The recall module 73 is used to recall the text information when the vertical domain intention of the text information meets the set vertical domain intention;
意图分类模块74,在召回模块召回文本信息后,用于对文本信息进行意图分类;The intention classification module 74, after the text information is recalled by the recall module, is used to classify the text information by intention;
拒绝模块75,用于在文本信息的垂域意图不满足设定垂域意图时,拒绝文本信息。The rejection module 75 is used to reject the text information when the vertical intention of the text information does not meet the set vertical intention.
通过上述方式,本申请针对复杂程度不确定的文本信息,确定模块72先确定文本信息的垂域意图;在文本信息的垂域意图满足设定垂域意图时,则召回模块73召回文本信息,并且意图分类模块74对文本信息进行意图分类,对复杂程度不确定的文本信息采用不同分类方式,不同分类方式由于速度也更快,所以使得不同识别难度的文本信息可以在不同层级分类方式快速给出判别结果,从而加速意图分类。因此通过上述方式,能够有效地避免复杂分类模型的资源浪费并加速文本信息的分类,从而提升文本信息的分类识别速度,进而减小计算机占用资源。In the above manner, for the text information with uncertain complexity, the determination module 72 first determines the vertical domain intention of the text information; when the vertical domain intention of the text information satisfies the set vertical domain intention, the recall module 73 recalls the text information, In addition, the intention classification module 74 classifies text information by intention, and uses different classification methods for text information with uncertain complexity. Different classification methods are faster, so that text information with different recognition difficulties can be quickly classified in different levels. The result of the discrimination is obtained, thereby accelerating the classification of intentions. Therefore, through the above method, the waste of resources of the complex classification model can be effectively avoided and the classification of text information can be accelerated, so as to improve the classification and recognition speed of text information, and thereby reduce the resource occupation of the computer.
进一步地,请参见图8,图8是本申请实施例另一种移动终端的结构示意图。本申请实施例提供一种移动终端8,包括:处理器81、存储器82以及存储在存储器中并在处理器上运行的计算机程序821,处理器81用于执行计算机程序821以实现本申请实施例第一方面提供的方法的步骤,在此不再赘述。Further, please refer to FIG. 8, which is a schematic structural diagram of another mobile terminal according to an embodiment of the present application. An embodiment of the present application provides a mobile terminal 8 including: a processor 81, a memory 82, and a computer program 821 stored in the memory and running on the processor. The processor 81 is configured to execute the computer program 821 to implement the embodiment of the present application. The steps of the method provided in the first aspect will not be repeated here.
参阅图9,图9是本申请计算机可读存储介质实施例的电路示意框图。如果以软件功能单元的形式实现并作为独立的产品销售或使用时,可以存储在计算机可读存储介质100中。基于这样的理解,本申请的技术方案本质上或者说对现有技术做出贡献的部分或者该技术方案的全部或部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个可读存储介质中,包括若干指令(程序数据101)用以使得一台计算机设备(可以是个人计算机,服务器,或者网络设备等)或处理器 (processor)执行本申请各个实施方式方法的全部或部分步骤。而前述的可读存储介质包括:U盘、移动硬盘、只读存储器(ROM,Read-Only Memory)、随机存取存储器(RAM,Random Access Memory)、磁碟或者光盘等各种介质以及具有上述可读存储介质的电脑、手机、笔记本电脑、平板电脑、相机等电子设备。Refer to FIG. 9, which is a schematic block diagram of a circuit of an embodiment of a computer-readable storage medium of the present application. If implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in the computer-readable storage medium 100. Based on this understanding, the technical solution of the present application essentially or the part that contributes to the existing technology or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a readable storage. The medium includes a number of instructions (program data 101) to enable a computer device (which may be a personal computer, a server, or a network device, etc.) or a processor to execute all or part of the steps of the various implementation methods of the present application. The aforementioned readable storage media include: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), magnetic disks or optical disks and other media, as well as various media with the above Computers, mobile phones, laptops, tablets, cameras and other electronic devices with readable storage media.
进一步地,本申请实施例还提供一种移动终端设备,请一并参阅图10,图10是本发明移动终端设备一实施例的结构组成示意图,该移动终端设备可以为手机、平板电脑、笔记本电脑以及可穿戴设备等,本实施例图示以手机为例。该终端设备900的结构可以包括射频(radio frequency,RF)电路910、存储器920、输入单元930、显示单元940(即上述实施例中的显示屏组件600)、传感器950、音频电路960、WiFi(wireless fidelity)模块970、处理器980以及电源990等。其中,RF电路910、存储器920、输入单元930、显示单元940、传感器950、音频电路960以及WiFi模块970分别与处理器980连接;电源990用于为整个终端设备900提供电能。Further, an embodiment of the present application also provides a mobile terminal device. Please refer to FIG. 10 together. FIG. 10 is a schematic structural diagram of an embodiment of the mobile terminal device of the present invention. The mobile terminal device may be a mobile phone, a tablet computer, or a notebook. Computers and wearable devices, etc., in this embodiment, a mobile phone is taken as an example. The structure of the terminal device 900 may include a radio frequency (RF) circuit 910, a memory 920, an input unit 930, a display unit 940 (that is, the display screen assembly 600 in the foregoing embodiment), a sensor 950, an audio circuit 960, and WiFi ( wireless fidelity) module 970, processor 980, power supply 990, etc. Among them, the RF circuit 910, the memory 920, the input unit 930, the display unit 940, the sensor 950, the audio circuit 960, and the WiFi module 970 are respectively connected to the processor 980; the power source 990 is used to provide power to the entire terminal device 900.
具体而言,RF电路910用于接发信号;存储器920用于存储数据指令信息;输入单元930用于输入信息,具体可以包括触控面板931以及操作按键等其他输入设备932;显示单元940则可以包括显示面板941等;传感器950包括红外传感器、激光传感器等,用于检测用户接近信号、距离信号等;扬声器961以及传声器(或者麦克风)962通过音频电路960与处理器980连接,用于接发声音信号;WiFi模块970则用于接收和发射WiFi信号,处理器980用于处理移动终端设备的数据信息。Specifically, the RF circuit 910 is used for receiving and transmitting signals; the memory 920 is used for storing data instruction information; the input unit 930 is used for inputting information, which may specifically include a touch panel 931 and other input devices 932 such as operation buttons; and the display unit 940 It may include a display panel 941, etc.; the sensor 950 includes an infrared sensor, a laser sensor, etc., used to detect user proximity signals, distance signals, etc.; a speaker 961 and a microphone (or microphone) 962 are connected to the processor 980 through the audio circuit 960 for connection Sound signals are sent; the WiFi module 970 is used to receive and transmit WiFi signals, and the processor 980 is used to process data information of the mobile terminal device.
关于具有存储功能的装置中的程序数据的执行过程的阐述可以参照上述本申请移动终端的文本信息分类方法实施例中阐述,在此不再赘述。For the description of the execution process of the program data in the device with the storage function, reference may be made to the description in the embodiment of the text information classification method of the mobile terminal of the present application, which is not repeated here.
以上所述仅为本申请的部分实施例,并非因此限制本申请的保护范围,凡是利用本申请说明书及附图内容所作的等效装置或等效流程变换,或直接或间接运用在其他相关的技术领域,均同理包括在本申请的专利保护范围内。The above are only part of the embodiments of this application, and do not limit the scope of protection of this application. Any equivalent device or equivalent process transformation made using the content of the description and drawings of this application, or directly or indirectly applied to other related The technical field is equally included in the scope of patent protection of this application.

Claims (20)

  1. 一种文本信息的分类方法,其特征在于,所述方法包括:A method for classifying text information, characterized in that the method includes:
    获取文本信息;Get text information;
    确定所述文本信息的垂域意图;Determine the vertical intention of the text information;
    在所述文本信息的垂域意图满足设定垂域意图时,召回所述文本信息,再对所述文本信息进行意图分类;When the vertical domain intention of the text information satisfies the vertical domain intention setting, recall the text information, and then classify the text information by intention;
    在所述文本信息的垂域意图不满足所述设定垂域意图时,拒绝所述文本信息。When the vertical domain intention of the text information does not satisfy the set vertical domain intention, the text information is rejected.
  2. 根据权利要求1所述的方法,其特征在于,The method of claim 1, wherein:
    所述确定所述文本信息的垂域意图,包括:The determining the vertical intention of the text information includes:
    将所述文本信息与多个关键词组进行关键词匹配,以得到多个匹配度;其中,每个关键词组对应一个垂域意图;Perform keyword matching on the text information with multiple keyword groups to obtain multiple matching degrees; wherein, each keyword group corresponds to a vertical domain intention;
    将匹配度最高的一个关键词组所对应的垂域意图,作为所述文本信息的垂域意图。The vertical intent corresponding to the keyword group with the highest matching degree is taken as the vertical intent of the text information.
  3. 根据权利要求2所述的方法,其特征在于,The method of claim 2, wherein:
    所述关键词组为多个关键词形成的正则表达式。The keyword group is a regular expression formed by multiple keywords.
  4. 根据权利要求1所述的方法,其特征在于,The method of claim 1, wherein:
    所述在所述文本信息的垂域意图满足设定垂域意图时,召回所述文本信息,并对所述文本信息进行意图分类,包括:The recalling the text information when the vertical domain intention of the text information satisfies the setting vertical domain intention and classifying the text information with intention includes:
    在所述文本信息的垂域意图满足设定垂域意图时,召回所述文本信息,并对所述文本信息进行第一次意图分类;其中,所述第一次意图分类包括至少一个意图类和一个拒绝类;When the vertical domain intention of the text information satisfies the vertical domain intention, the text information is recalled, and the first intention classification is performed on the text information; wherein, the first intention classification includes at least one intention category And a rejection class;
    在所述文本信息满足所述第一次意图分类的至少一个意图类中的一个时,对所述文本信息进行槽位提取;或When the text information satisfies one of the at least one intent class of the first intent classification, perform slot extraction on the text information; or
    在所述文本信息满足所述第一次意图分类的拒绝类时,则拒绝所述文本信息;或When the text information meets the rejection category of the first intention classification, reject the text information; or
    在所述文本信息不满足所述第一次意图分类的至少一个意图类和所述拒绝类时,对所述文本信息进行第二次意图分类。When the text information does not satisfy at least one intent class of the first intention classification and the rejection class, perform a second intention classification on the text information.
  5. 根据权利要求4所述的方法,其特征在于,The method of claim 4, wherein:
    所述对所述文本信息进行第一次意图分类,包括:The first intention classification of the text information includes:
    将所述文本信息输入至正则召回模型,以使所述正则召回模型对所述文本信息进行第一次意图分类,并输出第一意图分类结果;其中,所述第一意图分类结果包括至少一个意图类结果和一个拒绝类结果。The text information is input to the regular recall model, so that the regular recall model performs the first intention classification of the text information, and outputs a first intention classification result; wherein, the first intention classification result includes at least one An intent result and a rejection result.
  6. 根据权利要求5所述的方法,其特征在于,The method of claim 5, wherein:
    所述正则召回模型对所述文本信息进行第一次意图分类,包括:The regular recall model performs the first intention classification of the text information, including:
    将所述文本信息,与所述正则召回模型的正则数据库,进行串行匹配,以对所述文本信息进行第一次意图分类。The text information is serially matched with the regular database of the regular recall model to perform the first intention classification of the text information.
  7. 根据权利要求4所述的方法,其特征在于,The method of claim 4, wherein:
    所述对所述文本信息进行第二次意图分类,包括:The second intention classification of the text information includes:
    将所述文本信息输入至意图分类模型,以使所述意图分类模型对所述文本信息进行第二次意图分类,并输出第二意图分类结果;其中,所述第二意图分类结果包括至少一个意图类和一个拒绝类。The text information is input to the intent classification model, so that the intent classification model performs a second intent classification on the text information, and outputs a second intent classification result; wherein the second intent classification result includes at least one An intention class and a rejection class.
  8. 根据权利要求7所述的方法,其特征在于,所述意图分类模型包括Text CNN模型、LSTM模型、GRU模型、Transformer模型、Bert模型或T5模型中的一种。The method according to claim 7, wherein the intent classification model includes one of a Text CNN model, an LSTM model, a GRU model, a Transformer model, a Bert model, or a T5 model.
  9. 根据权利要求7所述的方法,其特征在于,The method according to claim 7, wherein:
    所述将所述文本信息输入至意图分类模型,以使所述意图分类模型对所述文本信息进行第二次意图分类,并输出第二意图分类结果,包括:The inputting the text information into the intent classification model so that the intent classification model performs a second intent classification on the text information and outputting the second intent classification result includes:
    在所述文本信息满足所述第二意图分类结果中的至少一个意图类时,对所述文本信息进行槽位提取;或When the text information satisfies at least one intent category in the second intent classification result, perform slot extraction on the text information; or
    在所述文本信息满足所述第二意图分类结果中的拒绝类时,则拒绝所述文本信息。When the text information satisfies the rejection category in the second intention classification result, the text information is rejected.
  10. 根据权利要求4所述的方法,其特征在于,The method of claim 4, wherein:
    所述在所述对所述文本信息进行第二次意图分类之前,还包括:Before the second intent classification is performed on the text information, the method further includes:
    再次确定所述文本信息的垂域意图;Determine the vertical intention of the text information again;
    在所述文本信息的垂域意图满足所述设定垂域意图时,执行所述对所述文本信息进行第二次意图分类的步骤。When the vertical domain intention of the text information satisfies the set vertical domain intention, the step of performing the second intention classification of the text information is performed.
  11. 根据权利要求10所述的方法,其特征在于,The method of claim 10, wherein:
    所述再次确定所述文本信息的垂域意图,包括:The re-determining the vertical intention of the text information includes:
    将所述文本信息输入至意图召回模型,以使所述意图召回模型确定所述文本信息的垂域意图;其中,所述意图召回模型根据设定置信度阈值确定所述文本信息的垂域意图,所述设定置信度阈值是可调节的。The text information is input to the intention recall model, so that the intention recall model determines the vertical intention of the text information; wherein the intention recall model determines the vertical intention of the text information according to a set confidence threshold , The set confidence threshold is adjustable.
  12. 根据权利要求11所述的方法,其特征在于,The method of claim 11, wherein:
    所述意图召回模型根据设定置信度阈值确定所述文本信息的垂域意图,包括:The intention recall model determines the vertical intention of the text information according to the set confidence threshold, including:
    若满足设定置信度阈值,则确定所述文本信息的垂域意图;If the set confidence threshold is satisfied, the vertical domain intention of the text information is determined;
    若不满足设定置信度阈值,则确定拒绝所述文本信息。If the set confidence threshold is not met, it is determined to reject the text information.
  13. 根据权利要求11所述的方法,其特征在于,所述意图召回模型为Fast Text神经网络模型或CNN模型。The method according to claim 11, wherein the intention recall model is a Fast Text neural network model or a CNN model.
  14. 根据权利要求1所述的方法,其特征在于,The method of claim 1, wherein:
    所述对所述文本信息进行意图分类之后,还包括:After the intention classification of the text information, the method further includes:
    利用验证规则库,对所述文本信息的槽位进行验证。The verification rule base is used to verify the slots of the text information.
  15. 根据权利要求4或9所述的方法,其特征在于,The method according to claim 4 or 9, characterized in that,
    所述对所述文本信息进行槽位提取,包括:The performing slot extraction on the text information includes:
    将所述文本信息输入至槽位提取模块,以使所述槽位提取模块对所述文本信息进行槽位提取,并输出槽位提取结果。The text information is input to the slot extraction module, so that the slot extraction module performs slot extraction on the text information, and outputs the slot extraction result.
  16. 根据权利要求15所述的方法,其特征在于,The method of claim 15, wherein:
    所述槽位提取模块包括Bi-LSTM模型和CRF模型。The slot extraction module includes a Bi-LSTM model and a CRF model.
  17. 根据权利要求15所述的方法,其特征在于,The method of claim 15, wherein:
    所述槽位提取模块为槽位正则表达式模型。The slot extraction module is a slot regular expression model.
  18. 一种移动终端,其特征在于,包括:A mobile terminal, characterized in that it comprises:
    获取模块,用于获取文本信息;Obtaining module for obtaining text information;
    确定模块,用于确定所述文本信息的垂域意图;The determination module is used to determine the vertical intention of the text information;
    召回模块,在所述文本信息的垂域意图满足设定垂域意图时,用于召回所述文本信息;The recall module is used to recall the text information when the vertical domain intention of the text information meets the set vertical domain intention;
    意图分类模块,在召回模块召回所述文本信息后,用于对所述文本 信息进行意图分类;The intention classification module is used to classify the text information by intention after the text information is recalled by the recall module;
    拒绝模块,用于在所述文本信息的垂域意图不满足所述设定垂域意图时,拒绝所述文本信息。The rejection module is used to reject the text information when the vertical intention of the text information does not satisfy the set vertical intention.
  19. 一种移动终端,其特征在于,包括:处理器和存储器,所述存储器中存储有计算机程序,所述处理器用于执行所述计算机程序以实现权利要求1-17中任一项所述的分类方法。A mobile terminal, comprising: a processor and a memory, wherein a computer program is stored in the memory, and the processor is configured to execute the computer program to implement the classification according to any one of claims 1-17 method.
  20. 一种计算机可读存储介质,其特征在于,所述计算机可读存储介质存储有计算机程序,所述计算机程序能够被处理器执行以实现如权利要求1-17中任一项所述的分类方法。A computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and the computer program can be executed by a processor to implement the classification method according to any one of claims 1-17 .
PCT/CN2020/093987 2020-06-02 2020-06-02 Text information classification method, mobile terminal, and computer-readable storage medium WO2021243575A1 (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
PCT/CN2020/093987 WO2021243575A1 (en) 2020-06-02 2020-06-02 Text information classification method, mobile terminal, and computer-readable storage medium
CN202080098028.7A CN115605861A (en) 2020-06-02 2020-06-02 Text information classification method, mobile terminal and computer readable storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
PCT/CN2020/093987 WO2021243575A1 (en) 2020-06-02 2020-06-02 Text information classification method, mobile terminal, and computer-readable storage medium

Publications (1)

Publication Number Publication Date
WO2021243575A1 true WO2021243575A1 (en) 2021-12-09

Family

ID=78831497

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2020/093987 WO2021243575A1 (en) 2020-06-02 2020-06-02 Text information classification method, mobile terminal, and computer-readable storage medium

Country Status (2)

Country Link
CN (1) CN115605861A (en)
WO (1) WO2021243575A1 (en)

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107766371A (en) * 2016-08-19 2018-03-06 中兴通讯股份有限公司 A kind of text message sorting technique and its device
CN109871543A (en) * 2019-03-12 2019-06-11 广东小天才科技有限公司 A kind of intention acquisition methods and system
CN109948017A (en) * 2018-04-26 2019-06-28 华为技术有限公司 A kind of information processing method and device
US20190236140A1 (en) * 2018-02-01 2019-08-01 International Business Machines Corporation Responding to an indirect utterance by a conversational system
CN110162633A (en) * 2019-05-21 2019-08-23 深圳市珍爱云信息技术有限公司 Voice data is intended to determine method, apparatus, computer equipment and storage medium

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107766371A (en) * 2016-08-19 2018-03-06 中兴通讯股份有限公司 A kind of text message sorting technique and its device
US20190236140A1 (en) * 2018-02-01 2019-08-01 International Business Machines Corporation Responding to an indirect utterance by a conversational system
CN109948017A (en) * 2018-04-26 2019-06-28 华为技术有限公司 A kind of information processing method and device
CN109871543A (en) * 2019-03-12 2019-06-11 广东小天才科技有限公司 A kind of intention acquisition methods and system
CN110162633A (en) * 2019-05-21 2019-08-23 深圳市珍爱云信息技术有限公司 Voice data is intended to determine method, apparatus, computer equipment and storage medium

Also Published As

Publication number Publication date
CN115605861A (en) 2023-01-13

Similar Documents

Publication Publication Date Title
CN109471938B (en) Text classification method and terminal
US20230222366A1 (en) Systems and methods for semantic analysis based on knowledge graph
CN109145299B (en) Text similarity determination method, device, equipment and storage medium
WO2021008015A1 (en) Intention recognition method, device and computer readable storage medium
CN107180084B (en) Word bank updating method and device
EP3115907A1 (en) Common data repository for improving transactional efficiencies of user interactions with a computing device
CN108920649B (en) Information recommendation method, device, equipment and medium
CN109271624B (en) Target word determination method, device and storage medium
CN111414471B (en) Method and device for outputting information
Song Sentiment analysis of Japanese text and vocabulary learning based on natural language processing and SVM
CN109101487A (en) Conversational character differentiating method, device, terminal device and storage medium
WO2021243575A1 (en) Text information classification method, mobile terminal, and computer-readable storage medium
CN110705282A (en) Keyword extraction method and device, storage medium and electronic equipment
CN116432664A (en) Dialogue intention classification method and system for high-quality data amplification
CN112966509B (en) Text quality evaluation method and device, storage medium and computer equipment
CN115329173A (en) Method and device for determining enterprise credit based on public opinion monitoring
CN112084780B (en) Coreference resolution method, device, equipment and medium in natural language processing
CN111625636B (en) Method, device, equipment and medium for rejecting man-machine conversation
CN114722832A (en) Abstract extraction method, device, equipment and storage medium
US20200073891A1 (en) Systems and methods for classifying data in high volume data streams
CN112712792A (en) Dialect recognition model training method, readable storage medium and terminal device
CN113239164B (en) Multi-round dialogue flow construction method and device, computer equipment and storage medium
Bei et al. Research on news text classification based on TextCNN
US11860919B2 (en) System and method for generating and obtaining remote classification of condensed large-scale text objects
CN112187768B (en) Method, device and equipment for detecting bad information website and readable storage medium

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 20939144

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

32PN Ep: public notification in the ep bulletin as address of the adressee cannot be established

Free format text: NOTING OF LOSS OF RIGHTS PURSUANT TO RULE 112(1) EPC (EPO FORM 1205 DATED 11/05/2023)

122 Ep: pct application non-entry in european phase

Ref document number: 20939144

Country of ref document: EP

Kind code of ref document: A1