WO2023246558A1 - 语义理解方法、装置、介质及设备 - Google Patents

语义理解方法、装置、介质及设备 Download PDF

Info

Publication number
WO2023246558A1
WO2023246558A1 PCT/CN2023/099842 CN2023099842W WO2023246558A1 WO 2023246558 A1 WO2023246558 A1 WO 2023246558A1 CN 2023099842 W CN2023099842 W CN 2023099842W WO 2023246558 A1 WO2023246558 A1 WO 2023246558A1
Authority
WO
WIPO (PCT)
Prior art keywords
event
processed
result
template
preset
Prior art date
Application number
PCT/CN2023/099842
Other languages
English (en)
French (fr)
Inventor
荣希
杜智敏
范炜彬
Original Assignee
深圳Tcl新技术有限公司
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 深圳Tcl新技术有限公司 filed Critical 深圳Tcl新技术有限公司
Publication of WO2023246558A1 publication Critical patent/WO2023246558A1/zh

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/30Semantic analysis
    • G06F40/35Discourse or dialogue representation
    • 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/33Querying
    • G06F16/332Query formulation
    • G06F16/3329Natural language query formulation or dialogue systems
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/20Natural language analysis
    • G06F40/237Lexical tools
    • G06F40/242Dictionaries

Definitions

  • This application relates to a semantic understanding method, device, medium and equipment.
  • Embodiments of the present application provide a semantic understanding method, device, medium and equipment that can quickly generate a large number of similar sentences for speech generalization and improve the dialogue system's recognition of user intentions when the current corpus is not sufficient to identify user intentions. capabilities, thereby improving the voice interaction experience.
  • the first matching degree and the second matching degree are calculated according to preset rules to obtain the first result and the second result respectively, including:
  • the first matching degree and the second matching degree are weighted and calculated respectively to obtain the first result and the second result.
  • the preset event template corresponding to the larger of the first result and the second result is taken as the target event template to process the event to be processed.
  • the method also includes:
  • the method further includes:
  • the target template file is input into the response engine to perform an event retrieval operation, and a target answer corresponding to the event to be processed is output.
  • the method further includes:
  • the method further includes:
  • the embodiment of the present application also provides a semantic understanding device, including:
  • the event acquisition module is used to preprocess the acquired events to be processed, and perform matching calculations between the preprocessed events to be processed and the preset event template to obtain the first matching degree;
  • a semantic enhancement module used to input the event to be processed into a pre-trained semantic enhancement model for sentence expansion, and obtain similar events to the event to be processed;
  • a matching calculation module configured to perform matching calculations on the similar events or the to-be-processed events and the preset event template to obtain a second matching degree
  • a target selection module configured to calculate the first matching degree and the second matching degree according to preset rules, obtain the first result and the second result respectively, and take the greater of the first result and the second result.
  • the preset event template corresponding to the larger one is used as the target event template to perform semantic understanding of the event to be processed.
  • another aspect of the embodiment of the present application also provides a terminal device, including a processor and a memory, the memory stores a plurality of instructions, and the processor loads the instructions to execute the above semantic understanding method.
  • Embodiments of the present application provide a semantic understanding method, device, medium and equipment.
  • the method preprocesses the acquired events to be processed, and performs matching calculations on the preprocessed events to be processed with a preset event template.
  • the preset event template corresponding to the larger of the second results is used as the target event template to perform semantic understanding of the event to be processed.
  • the embodiments of the present application can quickly generate a large number of similar sentences for speech generalization when the current corpus is not sufficient to identify the user's intention, thereby improving the dialogue system's ability to identify the user'
  • Figure 1 is a schematic flowchart of a semantic understanding method provided by an embodiment of the present application.
  • Figure 5 is a schematic structural diagram of a terminal device provided by an embodiment of the present application.
  • the embodiments of this application provide a semantic understanding method, which can be applied to terminals in the device.
  • the terminal device may be a smart phone, computer or other devices.
  • Figure 1 is a schematic flowchart of a semantic understanding method provided by an embodiment of the present application.
  • Figure 2 is another schematic flowchart of a semantic understanding method provided by an embodiment of the present application.
  • the semantic understanding method is applied to terminal devices. The method may include the following steps:
  • the user can input a piece of voice data to a voice input device, or input a piece of text data to a text input device (such as a physical keyboard or a virtual keyboard) to trigger an event to be processed.
  • a voice input device such as a physical keyboard or a virtual keyboard
  • this solution can also connect intelligent devices through voice input devices, such as intelligent voice assistants, to control intelligent devices (such as air conditioners) to turn on and off through voice commands or to respond to specific instructions.
  • the preprocessed event to be processed is matched with the preset event template prestored in the database to calculate the first matching degree, because the preset event template determines the database according to the first matching degree. Whether there is a target event template that matches the event to be processed, and then determine the user intention of the event to be processed based on the matched target event template.
  • the first matching degree may be calculated by calculating the similarity value between the event to be processed and the preset event template. get. It should be understood that the algorithm for similarity values is a mature technology in this field and does not belong to the improvement invention of this solution, so it will not be described again here.
  • this solution inputs the to-be-processed events into the pre-trained semantic enhancement model to perform sentence expansion operations, and obtains similar events based on the expansion of the to-be-processed events. For example, if the event to be processed is expressed as a piece of text "Turn down the brightness", several similar events can be generated after the semantic expansion operation.
  • the semantic enhancement model can be trained based on other Chinese pre-training models such as bert or simbert.
  • the semantic enhancement model specifically includes a sentence generator and a sentence discriminator, where the sentence generator is used to generate similar events based on training samples, and the sentence discriminator is used to determine the authenticity of labels corresponding to the similar events.
  • Step 103 Match the similar event or the event to be processed with the preset event template to obtain a second matching degree.
  • the event to be processed or a similar event is matched with a preset event template, and the second matching degree is calculated. Determine whether there is a target event template matching the similar event in the database according to the second matching degree, then determine the user intention of the similar event based on the matched target event template, and then infer the intention corresponding to the current question and answer request made by the user through the similar event.
  • the second matching degree can be calculated by calculating the similarity value between a similar event and a preset event template. It should be understood that the algorithm for the similarity value is a mature technology in the field and does not belong to the improvement invention of this solution, so no further description will be given.
  • Step 104 Calculate the first matching degree and the second matching degree according to preset rules to obtain the first result and the second result respectively, and obtain the larger of the first result and the second result.
  • the preset event template is used as the target event template to semantically understand the event to be processed.
  • the first matching degree and the second matching degree are weighted and calculated respectively according to different weight values pre-assigned to similar events and to-be-processed events, so that the above-mentioned first result and second result can be obtained.
  • the weight value of similar events is 0.8
  • the weight value of pending events is 0.2.
  • the distribution of the above weight values can be set according to actual business conditions and is not limited here.
  • the first matching degree and the second matching degree are comprehensively evaluated to avoid that under normal circumstances, the second matching degree corresponding to similar events will be significantly greater than that corresponding to the event to be processed.
  • the first degree of matching results in low credibility of the recognition results. That is, by setting the weight value, the error caused by predicting similar events can be reduced.
  • each word dictionary in the target event template has its corresponding word tag, assuming that the matched target word template happens to contain the word dictionary of the three keywords "today”, “Shenzhen” and “weather”, at this time, according to the matched
  • the word labels corresponding to the word dictionary are "time”, “location” and “intention”, indicating that the user intention corresponding to the pending event is to ask about today's weather conditions in Shenzhen.
  • the embodiments of the present application can quickly generate a large number of similar sentences for generalization of speech when the current corpus does not meet the requirements for identifying user intentions, improve the dialogue system's ability to identify users' intentions, and thus be able to adapt to the needs of different users.
  • Expression habits do not require users to make requests according to specific templates, so they can accurately identify user intentions and avoid problems with poor interactive experience due to misunderstanding or failure to understand user intentions.
  • the training is iterated and the model is updated continuously by using data as a closed loop on a weekly or monthly basis.
  • the semantic enhancement model is updated weekly or monthly to ensure the stability of online services while continuing to iteratively improve the effect.
  • the similar events obtained by the statement expansion operation are converted into new ones based on the Lexparser syntax analysis tool.
  • Added preset event templates are stored in the database used to store preset event templates to update the database and improve matching accuracy.
  • the Lexparser syntax analysis tool is an event structure analysis based on rule derivation.
  • a type of query expressed by the user i.e., the pending events mentioned in the article
  • queries with the same pattern are summarized into a template form.
  • templates to describe user needs has strong controllability and high accuracy. It is a commonly used rule-based query analysis method. Since the purpose of the Lexparser syntax analysis tool is to convert similar events obtained by statement expansion operations into new preset event templates, we will not go into details here.
  • the method of extracting keywords belongs to the conventional technical means in this field, for example, through the TF-IDF algorithm (Term Frequency-Inverse Document Frequency, Term Frequency-Inverse Document Frequency algorithm) from the events to be processed that have been converted into text format in advance. extract.
  • TF-IDF algorithm Term Frequency-Inverse Document Frequency, Term Frequency-Inverse Document Frequency algorithm
  • the response engine can quickly locate the corresponding database according to the word tags corresponding to each keyword in the target template file, and obtain the corresponding target answer from the database according to each keyword, thereby improving the user's request response speed. It should be noted that the response engine can be implemented based on a third-party response engine, which will not be described in detail here.
  • the target answer can also be fed back to the user in a preset display form, for example Feedback the target answer to the user in the form of voice, expanding the scope of application of the solution and increasing the user's options.
  • the present application is not limited by the execution order of each described step. Certain steps may also be performed in other orders or at the same time if no conflict occurs.
  • the preset event template corresponding to the larger one is used as the target event template to perform semantic understanding of the event to be processed.
  • the embodiments of this application can quickly generate a large number of similar sentences for generalization of speech skills, and improve the dialogue system's ability to identify user intentions when the current corpus is not satisfied.
  • the ability to identify user intentions can adapt to the expression habits of different users. It does not require users to make requests according to specific templates. It can accurately identify user intentions and avoid interactive experiences caused by misunderstanding or failure to understand user intentions. Problems with poor perception occur.
  • the semantic understanding device 30 may include:
  • the event acquisition module 31 is used to preprocess the acquired events to be processed, and perform matching calculations between the preprocessed events to be processed and the preset event template to obtain the first matching degree;
  • the matching calculation module 33 is used to perform matching calculations on the similar events or the to-be-processed events and the preset event template to obtain a second matching degree;
  • the device further includes a new module for storing similar events corresponding to the larger of the first result and the second result into the sample database of the semantic enhancement model as a new additional training samples.
  • the device further includes a feedback module for feeding back the target answer to the user in a preset display form.
  • each of the above modules can be implemented as an independent entity, or can be combined in any way and implemented as the same or several entities.
  • the semantic understanding device 30 pre-processes the acquired events to be processed through the event acquisition module 31, and performs matching calculations on the pre-processed events to be processed and the preset event template to obtain The first matching degree;
  • the semantic enhancement module 32 inputs the event to be processed into the pre-trained semantic enhancement model for sentence expansion to obtain similar events of the event to be processed;
  • the matching calculation module 33 adds the similar event or the The event to be processed and the preset event template are matched and calculated to obtain the second matching degree;
  • the target selection module 34 calculates the first matching degree and the second matching degree according to the preset rules to obtain the first results respectively. and the second result, taking the preset event template corresponding to the larger of the first result and the second result as the target event template to perform semantic understanding of the event to be processed.
  • Memory 120 may be used to store applications and data.
  • the application programs stored in the memory 120 include executable codes. Applications can be composed of various functional modules.
  • the processor 180 executes various functional applications and data processing by running application programs stored in the memory 120 .
  • the memory 120 may include high-speed random access memory, and may also include non-volatile memory, such as at least one magnetic disk storage device, flash memory device, or other volatile solid-state storage device. Accordingly, the memory 120 may also include a memory controller to provide the processor 180 with access to the memory 120 .
  • the processor 180 will follow the following instructions to load the executable code corresponding to the process of one or more application programs into the memory 120, and the processor 180 will run the executable code stored in the memory 120. application to achieve various functions:
  • the event acquisition module 31 is used to preprocess the acquired events to be processed, and perform matching calculations between the preprocessed events to be processed and the preset event template to obtain the first matching degree;
  • the device further includes a new module for storing similar events corresponding to the larger of the first result and the second result into the sample database of the semantic enhancement model as a new additional training samples.
  • the device further includes an update module for converting similar events obtained by statement expansion operations into new preset event templates based on the Lexparser syntax analysis tool, and storing the new preset event templates. into a database for storing preset event templates to update the database.
  • the semantic enhancement model includes a sentence generator and a sentence discriminator, wherein the sentence generator is used to generate similar events based on training samples, and the sentence discriminator is used to determine the authenticity of labels corresponding to the similar events. .
  • the preset event template includes at least two word dictionaries and word slots corresponding to each word dictionary, and each word dictionary has a corresponding word tag in the preset event template. Tags are used to indicate word attributes of the word dictionary.
  • the device further includes a response module for filling at least two keywords contained in the event to be processed into corresponding word slots of the target event template to obtain a target template file;
  • the target template file is input into the response engine to perform an event retrieval operation, and a target answer corresponding to the event to be processed is output.
  • the device further includes a recording module configured to record the first order of the at least two keywords in the event to be processed.
  • the device further includes a feedback module for feeding back the target answer to the user in a preset display form.
  • Figure 5 shows a schematic structural diagram of a terminal device provided by an embodiment of the present application.
  • the terminal device can be used to implement the semantic understanding method provided in the above embodiment.
  • the terminal device 1200 can be a smart phone or a tablet computer.
  • the terminal device 1200 may include an RF (Radio Frequency, radio frequency) circuit 110 and a storage device including one or more (only one is shown in the figure) computer-readable storage media.
  • RF Radio Frequency, radio frequency
  • the structure of the terminal device 1200 shown in Figure 5 does not constitute a limitation on the terminal device 1200, and may include more or less components than shown in the figure, or combine certain components, or different components. layout. in:
  • the RF circuit 110 is used to receive and send electromagnetic waves, realize mutual conversion of electromagnetic waves and electrical signals, and thereby communicate with communication networks or other devices.
  • the RF circuit 110 may include a variety of existing circuit elements for performing these functions, such as antennas, radio frequency transceivers, digital signal processors, encryption/decryption chips, Subscriber Identity Module (SIM) cards, memory, and the like.
  • the RF circuit 110 can communicate with various networks such as the Internet, an intranet, a wireless network, or communicate with other devices through a wireless network.
  • the memory 120 can be used to store software programs and modules, such as the program instructions/modules corresponding to the semantic understanding method in the above embodiments.
  • the processor 180 executes various functional applications and data processing by running the software programs and modules stored in the memory 120 , the vibration reminder mode can be automatically selected for semantic understanding according to the current scene in which the terminal device is located, which can not only ensure that meetings and other scenes are not disturbed, but also ensure that users can sense incoming calls, improving the intelligence of the terminal device.
  • Memory 120 may include high-speed random access memory, and may also include non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory.
  • the memory 120 may further include memory located remotely relative to the processor 180, and these remote memories may be connected to the terminal device 1200 through a network.
  • Examples of the above-mentioned networks include but are not limited to the Internet, intranets, local area networks, mobile communication networks and combinations thereof.
  • the input unit 130 may be used to receive input numeric or character information, and to generate keyboard, mouse, joystick, optical or trackball signal input related to user settings and function control.
  • the input unit 130 may include a touch-sensitive surface 131 and other input devices 132 .
  • the touch-sensitive surface 131 also called a touch display or a touchpad, can collect the user's touch operations on or near it (for example, the user uses a finger, stylus, or any other suitable object or accessory on the touch-sensitive surface 131 or operations near the touch-sensitive surface 131), and drive the corresponding connection device according to the preset program.
  • the touch-sensitive surface 131 may include two parts: a touch detection device and a touch controller.
  • the touch detection device detects the user's touch direction, detects the signal brought by the touch operation, and transmits the signal to the touch controller;
  • the control controller receives the touch information from the touch detection device, converts it into touch point coordinates, and then sends it to the processor 180, and can receive commands from the processor 180 and execute them.
  • touch-sensitive surfaces 131 can be implemented using various types such as resistive, capacitive, infrared, and surface acoustic waves.
  • the input unit 130 may also include other input devices 132.
  • other input devices 132 may include, but are not limited to, one or more of a physical keyboard, function keys (such as volume control keys, switch keys, etc.), trackball, mouse, joystick, etc.
  • the display unit 140 may be used to display information input by the user or information provided to the user as well as various graphical user interfaces of the terminal device 1200. These graphical user interfaces may be composed of graphics, text, icons, videos, and any combination thereof.
  • the display unit 140 may include a display panel 141.
  • the display panel 141 may be configured in the form of LCD (Liquid Crystal Display), OLED (Organic Light-Emitting Diode, organic light-emitting diode), etc.
  • the touch-sensitive surface 131 can cover the display panel 141. When the touch-sensitive surface 131 detects a touch operation on or near it, it is sent to the processor 180 to determine the type of touch event, and then the processor 180 determines the type of the touch event according to the touch.
  • the type of control event provides corresponding visual output on the display panel 141.
  • the touch-sensitive surface 131 and the display panel 141 are used as two independent components to implement input and output functions, in some embodiments, the touch-sensitive surface 131 and the display panel 141 can be integrated to implement input. and output functions.
  • the terminal device 1200 may also include at least one sensor 150, such as a light sensor, a motion sensor, and other sensors.
  • the light sensor may include an ambient light sensor and a proximity sensor.
  • the ambient light sensor may adjust the brightness of the display panel 141 according to the brightness of the ambient light.
  • the proximity sensor may close the display panel 141 when the terminal device 1200 moves to the ear. and/or backlight.
  • the gravity acceleration sensor can detect the magnitude of acceleration in various directions (usually three axes). It can detect the magnitude and direction of gravity when stationary.
  • the terminal device 1200 can be used to identify applications of mobile phone posture (such as horizontal and vertical screen switching, related games, magnetometer attitude calibration), vibration recognition related functions (such as pedometer, knock), etc.; as for the terminal device 1200, it can also be configured with other sensors such as gyroscope, barometer, hygrometer, thermometer, infrared sensor, etc., here No longer.
  • sensors such as gyroscope, barometer, hygrometer, thermometer, infrared sensor, etc., here No longer.
  • the audio circuit 160, the speaker 161, and the microphone 162 can provide an audio interface between the user and the terminal device 1200.
  • the audio circuit 160 can transmit the electrical signal converted from the received audio data to the speaker 161, and the speaker 161 converts it into a sound signal and outputs it; on the other hand, the microphone 162 collects The sound signal is converted into an electrical signal, which is received by the audio circuit 160 and converted into audio data. After being processed by the audio data output processor 180, it is sent to, for example, another terminal through the RF circuit 110, or the audio data is output to the memory 120. for further processing.
  • Audio circuitry 160 may also include an earphone jack to provide communication of peripheral earphones with terminal device 1200 .
  • the terminal device 1200 can help users send and receive emails, browse web pages, access streaming media, etc. through the transmission module 170 (such as a Wi-Fi module), which provides users with wireless broadband Internet access.
  • the transmission module 170 such as a Wi-Fi module
  • FIG. 5 shows the transmission module 170, it can be understood that it is not a necessary component of the terminal device 1200 and can be omitted as needed within the scope of not changing the essence of the invention.
  • the processor 180 is the control center of the terminal device 1200, using various interfaces and lines to connect various parts of the entire mobile phone, by running or executing software programs and/or modules stored in the memory 120, and calling data stored in the memory 120 , execute various functions of the terminal device 1200 and process data, thereby overall monitoring the mobile phone.
  • the processor 180 may include one or more processing cores; in some embodiments, the processor 180 may integrate an application processor and a modem processor, where the application processor mainly processes the operating system, user interface and applications, etc., the modem processor primarily handles wireless communications. It can be understood that the above modem processor may not be integrated into the processor 180 .
  • the terminal device 1200 also includes a power supply 190 that supplies power to various components.
  • the power supply can be logically connected to the processor 180 through a power management system, thereby realizing functions such as discharge management and power consumption management through the power management system.
  • the power supply 190 may also include one or more DC or AC power supplies, recharging systems, power failure detection circuits, power converters or inverters, power status indicators, and other arbitrary components.
  • the terminal device 1200 may also include a camera (such as a front camera, a rear camera), a Bluetooth module, etc., which will not be described again here.
  • the display unit 140 of the terminal device 1200 is a touch screen display.
  • the terminal device 1200 also includes a memory 120 and one or more programs, where one or more programs are stored in the memory 120, and One or more programs configured to be executed by one or more processors 180 include instructions for:
  • the event acquisition instruction is used to preprocess the acquired events to be processed, and match and calculate the preprocessed events to be processed with the preset event template to obtain the first matching degree;
  • Semantic enhancement instructions used to input the event to be processed into a pre-trained semantic enhancement model for sentence expansion to obtain similar events to the event to be processed;
  • Matching calculation instructions used to perform matching calculations on the similar events or the to-be-processed events and the preset event template to obtain a second matching degree
  • Target selection instructions are used to calculate the first matching degree and the second matching degree according to preset rules, obtain the first result and the second result respectively, and take the greater of the first result and the second result.
  • the preset event template corresponding to the larger one is used as the target event template to perform semantic understanding of the event to be processed.
  • the target selection instruction is used to perform weighted calculations on the first matching degree and the second matching degree respectively according to different weight values pre-assigned to the similar events and to-be-processed events to obtain the first matching degree. results and secondary results.
  • the program further includes a new instruction for storing similar events corresponding to the larger of the first result and the second result into the sample database of the semantic enhancement model as a new additional training samples.
  • the program further includes an update instruction for converting similar events obtained by statement expansion operations into new preset event templates based on the Lexparser syntax analysis tool, and storing the new preset event templates. into a database for storing preset event templates to update the database.
  • the semantic enhancement model includes a sentence generator and a sentence discriminator, wherein the sentence generator is used to generate similar events based on training samples, and the sentence discriminator is used to determine the authenticity of labels corresponding to the similar events. .
  • the program further includes a feedback instruction for feeding back the target answer to the user in a preset display form.
  • the terminal device 1200 performs the following steps:
  • Embodiments of the present application also provide a storage medium in which a computer program is stored.
  • the computer program When the computer program is run on a computer, the computer executes the semantic understanding method described in any of the above embodiments.

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • Computational Linguistics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Artificial Intelligence (AREA)
  • Audiology, Speech & Language Pathology (AREA)
  • General Health & Medical Sciences (AREA)
  • Health & Medical Sciences (AREA)
  • Mathematical Physics (AREA)
  • Human Computer Interaction (AREA)
  • Data Mining & Analysis (AREA)
  • Databases & Information Systems (AREA)
  • Machine Translation (AREA)

Abstract

本申请实施例提供一种语义理解方法、装置、介质及设备,该方法包括:计算待处理事件与预设事件模板的第一匹配度;对待处理事件进行语句扩充得到相似事件;计算相似事件与预设事件模板的第二匹配度;根据第一匹配度和第二匹配度得到第一结果和第二结果,取较大者的预设事件模板进行语义理解。本申请能提升对话系统识别能力。

Description

语义理解方法、装置、介质及设备
本申请要求于2022年06月23日提交中国专利局、申请号为202210717359.5、发明名称为“语义理解方法、装置、介质及设备”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。
技术领域
本申请涉及一种语义理解方法、装置、介质及设备。
背景技术
随着人工智能技术的发展,智能语音交互因其最符合人类的交流习惯而被认为是最自然的交互方式。用户可以通过语音输入请求,装载了语音识别功能的设备首先将用户的语音输入信号转换成文字,再通过后续的一系列自然语言处理流程分析用户的意图,最后根据理解的用户意图响应相应的功能。
如何让机器正确理解用户意图成为了语音交互系统中的一大难点。由于用户有着自己的表达习惯,同样地请求有可能存在好几种表达方式,而语音交互系统由于语料库有限使其无法做到精准识别用户意图,造成误解用户意图或不理解用户意图,导致交互体验感差。
申请内容
本申请实施例提供一种语义理解方法、装置、介质及设备,能够在当前语料库不满足以识别用户意图的情况下,快速生成大量相似语句用于话术泛化,提升对话系统对用户意图的识别能力,进而提升语音交互体验。
本申请实施例一方面提供了一种语义理解方法,包括:
对获取到的待处理事件进行预处理,并将预处理后的待处理事件与预设事件模板进行匹配计算,得到第一匹配度;
将所述待处理事件输入至预训练好的语义增强模型进行语句扩充,得到所述待处理事件的相似事件;
将所述相似事件或所述待处理事件与所述预设事件模板进行匹配计算,得到第二匹配度;
根据预设规则对所述第一匹配度和所述第二匹配度进行计算,分别得到第一结果和第二结果,取所述第一结果与第二结果中的较大者对应的预设事件模板作为目标事件模板,以对所述待处理事件进行语义理解。
在本申请实施例所述的语义理解方法中,所述根据预设规则对所述第一匹配度和所述第二匹配度进行计算,分别得到第一结果和第二结果,包括:
根据所述相似事件及待处理事件预先分配的不同权重值,分别对所述第一匹配度与第二匹配度进行加权计算,得到第一结果和第二结果。
在本申请实施例所述的语义理解方法中,在所述取所述第一结果与第二结果中的较大者对应的预设事件模板作为目标事件模板,以对所述待处理事件进行语义理解之后,所述方法还包括:
将所述第一结果与第二结果中的较大者对应的相似事件存入所述语义增强模型的样本数据库中,作为新增的训练样本。
在本申请实施例所述的语义理解方法中,在所述取所述第一结果与第二结果中的较大者对应的预设事件模板作为目标事件模板对所述待处理事件进行语义理解之后,所述方法还包括:
基于Lexparser句法分析工具将语句扩充操作得到的相似事件转换为新增的预设事件模板,将所述新增的预设事件模板存入用于存储预设事件模板的数据库中,以更新所述数据库。
在本申请实施例所述的语义理解方法中,所述语义增强模型包括语句生成器及语句判别器,其中所述语句生成器用于基于训练样本生成相似事件,所述语句判别器用于判别所述相似事件对应的标签真伪。
在本申请实施例所述的语义理解方法中,所述预设事件模板包含至少两个词语字典及与各个词语字典对应的词槽,且每个词语字典在所述预设事件模板中有对应的词语标签,所述词语标签用于指示所述词语字典的词语属性。
在本申请实施例所述的语义理解方法中,所述方法还包括:
将所述待处理事件中包含的至少两个关键词填充至所述目标事件模板的对应词槽,得到目标模板文件;
将所述目标模板文件输入至应答引擎中进行事件检索操作,输出与所述待处理事件对应的目标答案。
在本申请实施例所述的语义理解方法中,在所述得到所述待处理事件包含的至少两个关键词之后,所述方法还包括:
记录所述至少两个关键词在所述待处理事件中的第一排列顺序。
在本申请实施例所述的语义理解方法中,所述预设事件模板中的至少两个 词语字典按照预设的第二排列顺序进行排序;所述将预处理后的待处理事件与预设事件模板进行匹配计算,得到第一匹配度,包括:
获取所述待处理事件的第一文本特征向量,及所述预设事件模板的第二文本特征向量;
根据所述第一文本特征向量与第二文本特征向量,计算所述待处理事件与预设事件模板的文本特征相似度值;
根据所述第一排列顺序获取所述待处理事件的第一时序特征向量,根据所述第二排列顺序获取所述预设事件模板的第二时序特征向量;
根据所述第一时序特征向量及第二时序特征向量,计算所述待处理事件与预设事件模板的时序特征相似度值;
将所述文本特征相似度值与时序特征相似度值相加得到所述第一匹配度。
在本申请实施例所述的语义理解方法中,在所述输出与所述待处理事件对应的目标答案之后,所述方法还包括:
将所述目标答案以预设的展示形式反馈给用户。
相应的,本申请实施例另一方面还提供了一种语义理解装置,包括:
事件获取模块,用于对获取到的待处理事件进行预处理,并将预处理后的待处理事件与预设事件模板进行匹配计算,得到第一匹配度;
语义增强模块,用于将所述待处理事件输入至预训练好的语义增强模型进行语句扩充,得到所述待处理事件的相似事件;
匹配计算模块,用于将所述相似事件或所述待处理事件与所述预设事件模板进行匹配计算,得到第二匹配度;
目标选择模块,用于根据预设规则对所述第一匹配度和所述第二匹配度进行计算,分别得到第一结果和第二结果,取所述第一结果与第二结果中的较大者对应的预设事件模板作为目标事件模板,以对所述待处理事件进行语义理解。
相应的,本申请实施例另一方面还提供了一种存储介质,所述存储介质存储有多条指令,所述指令适于处理器进行加载,以执行如上所述的语义理解方法。
相应的,本申请实施例另一方面还提供了一种终端设备,包括处理器和存储器,所述存储器存储有多条指令,所述处理器加载所述指令以执行如上所述 的语义理解方法。
本申请实施例提供了一种语义理解方法、装置、介质及设备,该方法通过对获取到的待处理事件进行预处理,并将预处理后的待处理事件与预设事件模板进行匹配计算,得到第一匹配度;将所述待处理事件输入至预训练好的语义增强模型进行语句扩充,得到所述待处理事件的相似事件;将所述相似事件或所述待处理事件与所述预设事件模板进行匹配计算,得到第二匹配度;根据预设规则对所述第一匹配度和所述第二匹配度进行计算,分别得到第一结果和第二结果,取所述第一结果与第二结果中的较大者对应的预设事件模板作为目标事件模板,以对所述待处理事件进行语义理解。本申请实施例能够在当前语料库不满足以识别用户意图的情况下,快速生成大量相似语句用于话术泛化,提升对话系统对用户意图的识别能力,进而提升语音交互体验。
附图说明
为了更清楚地说明本申请实施例中的技术方案,下面将对实施例描述中所需要使用的附图作简单地介绍。显而易见地,下面描述中的附图仅仅是本申请的一些实施例,对于本领域技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。
图1为本申请实施例提供的语义理解方法的流程示意图。
图2为本申请实施例提供的语义理解方法的另一流程示意图。
图3为本申请实施例提供的语义理解装置的结构示意图。
图4为本申请实施例提供的语义理解装置的另一结构示意图。
图5为本申请实施例提供的终端设备的结构示意图。
具体实施方式
下面将结合本申请实施例中的附图,对本申请实施例中的技术方案进行清楚、完整地描述。显然,所描述的实施例仅仅是本申请一部分实施例,而不是全部的实施例。基于本申请中的实施例,本领域技术人员在没有付出创造性劳动前提下所获得的所有其他实施例,都属于本申请的保护范围。
本申请实施例提供一种语义理解方法,所述语义理解方法可以应用于终端 设备中。所述终端设备可以是智能手机、电脑等设备。
需要解释的是,由于用户有着自己的表达习惯,同样地请求有可能存在好几种表达方式,而语音交互系统由于语料库有限使其无法做到精准识别用户意图,造成误解用户意图或不理解用户意图,导致交互体验感差。
为了解决上述技术问题,本申请实施例提供一种语义理解方法。利用本申请实施例提供的语义理解方法,能够在当前语料库不满足以识别用户意图的情况下,快速生成大量相似语句用于话术泛化,提升对话系统对用户意图的识别能力,进而提升语音交互体验。
实施例1
请参阅图1-图2,图1为本申请实施例提供的语义理解方法的流程示意图。图2为本申请实施例提供的语义理解方法的另一流程示意图。所述语义理解方法,应用于终端设备中,所述方法可以包括以下步骤:
步骤101,对获取到的待处理事件进行预处理,并将预处理后的待处理事件与预设事件模板进行匹配计算,得到第一匹配度。
在本实施例中,用户可以向语音输入设备输入一段语音数据,或者向文字输入设备(例如物理键盘或者虚拟键盘)输入一段文字数据来触发待处理事件。可以理解的是,本方案还可以通过语音输入设备,例如通过智能语音助手连接智能化设备,实现通过语音指令控制智能化设备(例如空调)开启关闭或者根据具体指令做出响应操作。
需要解释的是,上述待处理事件具体指一段语音数据或者一段文字数据。由于实际应用中,待处理事件通常不可避免地包含影响语义理解的干扰词语,如“你好”、“请问”等词语,为了避免干扰词语对语义理解的影响,在本实施例中通过对待处理事件进行一系列的预处理操作,例如分词,pos词性标注,去除停用词等,在此不做限定。
在得到预处理后的待处理事件后,将预处理后的待处理事件与预存在数据库中的预设事件模板进行匹配计算得到第一匹配度,由于预设事件模板根据第一匹配度判断数据库中是否存在与待处理事件匹配的目标事件模板,进而根据匹配得到的目标事件模板判断待处理事件的用户意图。在一些实施例中,第一匹配度的计算方式可以通过计算待处理事件与预设事件模板之间的相似度值 得到。应当理解的是,针对于相似度值的算法属于本领域成熟的技术,并且不属于本方案的改进发明点,因此在此不做赘述。
需要解释的是,上述预设事件模板是预存在数据库中的多个模板文件,用于识别待处理事件所反映的用户意图。预设事件模板包含至少两个词语字典及与各个词语字典对应的词槽,且每个词语字典在预设事件模板中有对应的词语标签,词语标签用于指示词语字典的词语属性(例如位置、时间、意图等)。
示例性地,词语字典A在预设词语字典中以词语标签a进行显示,a可以是“location(位置)”、“time(时间)”和“intent(意图)”等,并且词语字典A在预设时间模板中作为词语标签a的词语集合,其中包含了例如“深圳”、“珠海”等地理位置词语。
通过设置多个包含词语字典及词语属性的预设事件模板,每个预设事件模板中的词语字典及词语属性按照特定规则进行排布,且每个预设事件模板都是唯一的。当待处理事件为“今天深圳天气”时,首先将该文字数据拆分为“今天”、“深圳”和“天气”三个关键词,然后将拆分后的三个关键词分别与数据库中的预设时间模板中的词语字典进行匹配,选出相似度值超过预设阈值的目标事件模板,由于目标事件模板中各个词语字典都有其对应的词语标签,假设匹配到的目标词语模板恰好包含了“今天”、“深圳”和“天气”三个关键词的词语字典,此时根据匹配到的词语字典对应的词语标签分别是“时间”、“位置”和“意图”,说明该待处理事件对应的用户意图是询问深圳今天的天气情况,并且该用户意图同时确定了多个维度,根据待处理事件得到的用户意图便可有针对性地找到与之匹配度最高的目标答案。相比较于现有技术通过收集大量数据构建语料库,在此基础上用有监督的机器学习方法训练深度学习模型用于分析用户意图的方式,本方案不仅专注于文字特征的重合度,还关注了词语的词语属性,能够更好地分析出用户的用户意图。
步骤102,将所述待处理事件输入至预训练好的语义增强模型进行语句扩充,得到所述待处理事件的相似事件。
在本实施例中,由于数据库中的预设事件模板是人为设定的,始终无法做到包含所有可能性,从而造成当用户输入的待处理事件无法被识别到与之相匹配的目标事件模板时,将会导致用户提出的问答请求(即待处理事件)变成无 效请求,影响用户的体验感。因此,为了解决该问题,本方案通过将待处理事件输入至预训练好的语义增强模型进行语句扩充操作,得到基于待处理事件扩充的相似事件。示例性地,若待处理事件表示为一段文字“亮度调低”,则在经过语义扩充操作后可生成若干个相似事件,例如“屏幕亮度调低一些”、“调低屏幕亮度”等能够被系统识别并匹配到目标词语模板的相似事件,从而弥补数据库中原始的预设事件模板的数量有限的不足,进而提升系统对用户意图的识别准确度。
需要说明的是,语义增强模型可以基于bert或simbert等其他中文预训练模型进行训练得到。语义增强模型具体包括语句生成器及语句判别器,其中语句生成器用于基于训练样本生成相似事件,语句判别器用于判别所述相似事件对应的标签真伪。
步骤103,将所述相似事件或所述待处理事件与所述预设事件模板进行匹配计算,得到第二匹配度。
在本实施例中,通过将待处理事件或相似事件与预设事件模板进行匹配操作,并计算得到第二匹配度。根据第二匹配度判断数据库中是否存在与相似事件匹配的目标事件模板,进而根据匹配得到的目标事件模板判断相似事件的用户意图,进而通过相似事件推断用户当前提出的问答请求对应的意图。在一些实施例中,第二匹配度的计算方式可以通过计算相似事件与预设事件模板之间的相似度值得到。应当理解的是,关于相似度值的算法属于本领域成熟的技术,并且不属于本方案的改进发明点,因此不做赘述。
步骤104,根据预设规则对所述第一匹配度和所述第二匹配度进行计算,分别得到第一结果和第二结果,取所述第一结果与第二结果中的较大者对应的预设事件模板作为目标事件模板,以对所述待处理事件进行语义理解。
在本申请提供的一种实施例中取第一匹配度和第二匹配度中的较大者对应的预设事件模板作为目标事件模板。在本申请提供的另一种实施例中,考虑到第二匹配度是通过预测得到,无法确保其真实性,存在不能完全代替用户的真实意图的情况,由相似事件从数据库中匹配得到的预设事件模板的准确性不一定会大于由待处理事件匹配得到的预设事件模板。为了减少预测带来的误差,本方案通过设置预设规则对第一匹配度与第二匹配度进行处理,得到第一 结果与第二结果,取第一结果与第二结果中的较大者对应的预设事件模板作为目标事件模板。上述预设规则可以根据实际业务情况进行设置,在此不做限定。
进一步地,根据相似事件及待处理事件预先分配的不同权重值,分别对第一匹配度与第二匹配度进行加权计算,便可得到上述第一结果和第二结果。示例性地,相似事件的权重值是0.8,待处理事件的权重值是0.2。上述权重值的分配可以根据实际业务情况进行设置,在此不做限定。
通过给相似事件及待处理事件分配不同的权重值,以综合评估第一匹配度与第二匹配度的大小,避免由于正常情况下相似事件对应的第二匹配度会明显大于待处理事件对应的第一匹配度,造成识别结果可信性不高。即通过设定权重值能够减少通过预测相似事件的方式所带来的误差。
进一步地,在得到上述目标事件模板后,编可以对用户输出的待处理事件进行语义理解。由于目标事件模板中各个词语字典都有其对应的词语标签,假设匹配到的目标词语模板恰好包含了“今天”、“深圳”和“天气”三个关键词的词语字典,此时根据匹配到的词语字典对应的词语标签分别是“时间”、“位置”和“意图”,说明该待处理事件对应的用户意图是询问深圳今天的天气情况。
综上所述,本申请实施例能够在当前语料库不满足识别用户意图的情况下,快速生成大量相似语句用于话术泛化,提升对话系统对用户的意图识别能力,进而能够顺应不同用户的表达习惯,不需要求用户必须按照特定模板来发出请求,便可以做到精准识别用户意图,避免由于误解用户意图或不理解用户意图,导致交互体验感差的问题发生。
实施例2
本申请实施例提供的语义理解方法还包括以下步骤:
在所述取第一结果与第二结果中的较大者对应的预设事件模板作为目标事件模板对待处理事件进行语义理解之后,将第一结果与第二结果中的较大者对应的相似事件存入语义增强模型的样本数据库中,作为新增的训练样本。
基于此实施例,语义增强模型训练好之后,通过以周或月为单位,以数据为闭环,不断训练迭代并更新模型。例如语义增强模型的更新频率为每周或每月一次,在保证线上服务稳定的同时持续迭代提升效果。
实施例3
本申请实施例提供的语义理解方法还包括以下步骤:
在所述取第一结果与第二结果中的较大者对应的预设事件模板作为目标事件模板对待处理事件进行语义理解之后,基于Lexparser句法分析工具将语句扩充操作得到的相似事件转换为新增的预设事件模板,将新增的预设事件模板存入用于存储预设事件模板的数据库中,以更新数据库,提升匹配准确性。
需要说明的是,用于存储预设事件模板的数据库更新频率可以是按照每月或每周一周,也可以是其他自定义方式,使得在保证线上服务稳定的同时持续迭代提升效果。
需要解释的是,Lexparser句法分析工具是基于规则推导的事件结构分析。用户表达的一类query(即文中提到的待处理事件)通常符合某种模式,把具有相同模式的query归纳起来变成一种模板的形式。使用模板来描述用户需求具有较强的可控性且准确率较高,属于一种比较使用的基于规则的query分析方法。由于Lexparser句法分析工具目的在于将语句扩充操作得到的相似事件转换为新增的预设事件模板,在此不做赘述。
实施例4
本申请实施例提供的语义理解方法还包括以下步骤:
将所述待处理事件中包含的至少两个关键词填充至所述目标事件模板的对应词槽,得到目标模板文件。应当理解的是,关键词的提取方式属于本领域常规技术手段,例如通过TF-IDF算法(Term Frequency-Inverse Document Frequency,词频-逆文档频次算法)从预先转化为文本格式的待处理事件中进行提取。
将目标模板文件输入至应答引擎中进行事件检索操作,输出与待处理事件对应的目标答案。
在本实施例中,应答引擎可以根据在目标模板文件中各个关键词对应的词语标签快速定位到对应的数据库,并根据各个关键词从数据库中获取对应的目标答案,提升用户的请求响应速度。需要说明的是,应答引擎可以基于第三方应答引擎实现,在此不做赘述。
在另一实施例中,还可以将目标答案以预设的展示形式反馈给用户,例如 将目标答案以语音的形式反馈给用户,扩大方案的适用范围和增加用户的可选方案。
实施例5
本申请实施例提供的语义理解方法还包括以下步骤:
在所述得到所述待处理事件包含的至少两个关键词之后,记录所述至少两个关键词在所述待处理事件中的第一排列顺序。
由于同一词语在句子中的位置顺序不同可能会造成整个句子表达的意思不同,因此,基于本实施例,通过区分关键词在待处理事件中的第一排列顺序,能够进一步地提升用户的用户意图。
具体地,通过获取待处理事件的第一文本特征向量,及预设事件模板的第二文本特征向量;根据第一文本特征向量与第二文本特征向量,计算待处理事件与预设事件模板的文本特征相似度值;根据第一排列顺序获取待处理事件的第一时序特征向量,根据第二排列顺序获取预设事件模板的第二时序特征向量;根据第一时序特征向量及第二时序特征向量,计算待处理事件与预设事件模板的时序特征相似度值;将文本特征相似度值与时序特征相似度值相加得到第一匹配度。
上述所有可选技术方案,可以采用任意结合形成本申请的可选实施例,在此不再一一赘述。
具体实施时,本申请不受所描述的各个步骤的执行顺序的限制,在不产生冲突的情况下,某些步骤还可以采用其它顺序进行或者同时进行。
由上可知,本申请实施例提供的语义理解方法通过对获取到的待处理事件进行预处理,并将预处理后的待处理事件与预设事件模板进行匹配计算,得到第一匹配度;将所述待处理事件输入至预训练好的语义增强模型进行语句扩充,得到所述待处理事件的相似事件;将所述待处理事件输入至预训练好的语义增强模型进行语句扩充,得到所述待处理事件的相似事件;根据预设规则对所述第一匹配度和所述第二匹配度进行计算,分别得到第一结果和第二结果,取所述第一结果与第二结果中的较大者对应的预设事件模板作为目标事件模板对所述待处理事件进行语义理解。本申请实施例能够在当前语料库不满足识别用户意图的情况下,快速生成大量相似语句用于话术泛化,提升对话系统对 用户意图的识别能力,进而能够顺应不同用户的表达习惯,不需要求用户必须按照特定模板来发出请求,便可以做到精准识别用户意图,避免由于误解用户意图或不理解用户意图,导致交互体验感差的问题发生。
本申请实施例还提供一种语义理解装置,所述语义理解装置可以集成在终端设备中。所述终端设备可以是智能手机、平板电脑等设备。
请参阅图3,图3为本申请实施例提供的语义理解装置的结构示意图。语义理解装置30可以包括:
事件获取模块31,用于对获取到的待处理事件进行预处理,并将预处理后的待处理事件与预设事件模板进行匹配计算,得到第一匹配度;
语义增强模块32,用于将所述待处理事件输入至预训练好的语义增强模型进行语句扩充,得到所述待处理事件的相似事件;
匹配计算模块33,用于将所述相似事件或所述待处理事件与所述预设事件模板进行匹配计算,得到第二匹配度;
目标选择模块34,用于根据预设规则对所述第一匹配度和所述第二匹配度进行计算,分别得到第一结果和第二结果,取所述第一结果与第二结果中的较大者对应的预设事件模板作为目标事件模板对所述待处理事件进行语义理解。
在一些实施例中,所述目标选择模块34,用于根据所述相似事件及待处理事件预先分配的不同权重值,分别对所述第一匹配度与第二匹配度进行加权计算,得到第一结果和第二结果。
在一些实施例中,所述装置还包括新增模块,用于将所述第一结果与第二结果中的较大者对应的相似事件存入所述语义增强模型的样本数据库中,作为新增的训练样本。
在一些实施例中,所述装置还包括更新模块,用于基于Lexparser句法分析工具将语句扩充操作得到的相似事件转换为新增的预设事件模板,将所述新增的预设事件模板存入用于存储预设事件模板的数据库中,以更新所述数据库。
在一些实施例中,所述语义增强模型包括语句生成器及语句判别器,其中所述语句生成器用于基于训练样本生成相似事件,所述语句判别器用于判别所 述相似事件对应的标签真伪。
在一些实施例中,所述预设事件模板包含至少两个词语字典及与各个词语字典对应的词槽,且每个词语字典在所述预设事件模板中有对应的词语标签,所述词语标签用于指示所述词语字典的词语属性。
在一些实施例中,所述装置还包括应答模块,用于将所述待处理事件中包含的至少两个关键词填充至所述目标事件模板的对应词槽,得到目标模板文件;
将所述目标模板文件输入至应答引擎中进行事件检索操作,输出与所述待处理事件对应的目标答案。
在一些实施例中,所述装置还包括记录模块,用于记录所述至少两个关键词在所述待处理事件中的第一排列顺序。
在一些实施例中,所述装置还包括反馈模块,用于将所述目标答案以预设的展示形式反馈给用户。
具体实施时,以上各个模块可以作为独立的实体来实现,也可以进行任意组合,作为同一或若干个实体来实现。
由上可知,本申请实施例提供的语义理解装置30,通过事件获取模块31对获取到的待处理事件进行预处理,并将预处理后的待处理事件与预设事件模板进行匹配计算,得到第一匹配度;语义增强模块32将所述待处理事件输入至预训练好的语义增强模型进行语句扩充,得到所述待处理事件的相似事件;匹配计算模块33将所述相似事件或所述待处理事件与所述预设事件模板进行匹配计算,得到第二匹配度;目标选择模块34根据预设规则对所述第一匹配度和所述第二匹配度进行计算,分别得到第一结果和第二结果,取所述第一结果与第二结果中的较大者对应的预设事件模板作为目标事件模板对所述待处理事件进行语义理解。
请参阅图4,图4为本申请实施例提供的语义理解装置的另一结构示意图,语义理解装置30包括存储器120、一个或多个处理器180、以及一个或多个应用程序,其中该一个或多个应用程序被存储于该存储器120中,并配置为由该处理器180执行;该处理器180可以包括事件获取模块31、语义增强模块32,匹配计算模块33以及目标选择模块34。例如,以上各个部件的结构和连接关 系可以如下:
存储器120可用于存储应用程序和数据。存储器120存储的应用程序中包含有可执行代码。应用程序可以组成各种功能模块。处理器180通过运行存储在存储器120的应用程序,从而执行各种功能应用以及数据处理。此外,存储器120可以包括高速随机存取存储器,还可以包括非易失性存储器,例如至少一个磁盘存储器件、闪存器件、或其他易失性固态存储器件。相应地,存储器120还可以包括存储器控制器,以提供处理器180对存储器120的访问。
处理器180是装置的控制中心,利用各种接口和线路连接整个终端的各个部分,通过运行或执行存储在存储器120内的应用程序,以及调用存储在存储器120内的数据,执行装置的各种功能和处理数据,从而对装置进行整体监控。可选的,处理器180可包括一个或多个处理核心;优选的,处理器180可集成应用处理器和调制解调处理器,其中,应用处理器主要处理操作系统、用户界面和应用程序等。
具体在本实施例中,处理器180会按照如下的指令,将一个或一个以上的应用程序的进程对应的可执行代码加载到存储器120中,并由处理器180来运行存储在存储器120中的应用程序,从而实现各种功能:
事件获取模块31,用于对获取到的待处理事件进行预处理,并将预处理后的待处理事件与预设事件模板进行匹配计算,得到第一匹配度;
语义增强模块32,用于将所述待处理事件输入至预训练好的语义增强模型进行语句扩充,得到所述待处理事件的相似事件;
匹配计算模块33,用于将所述相似事件或所述待处理事件与所述预设事件模板进行匹配计算,得到第二匹配度;
目标选择模块34,用于根据预设规则对所述第一匹配度和所述第二匹配度进行计算,分别得到第一结果和第二结果,取所述第一结果与第二结果中的较大者对应的预设事件模板作为目标事件模板对所述待处理事件进行语义理解。
在一些实施例中,所述目标选择模块34,用于根据所述相似事件及待处理事件预先分配的不同权重值,分别对所述第一匹配度与第二匹配度进行加权计算,得到第一结果和第二结果。
在一些实施例中,所述装置还包括新增模块,用于将所述第一结果与第二结果中的较大者对应的相似事件存入所述语义增强模型的样本数据库中,作为新增的训练样本。
在一些实施例中,所述装置还包括更新模块,用于基于Lexparser句法分析工具将语句扩充操作得到的相似事件转换为新增的预设事件模板,将所述新增的预设事件模板存入用于存储预设事件模板的数据库中,以更新所述数据库。
在一些实施例中,所述语义增强模型包括语句生成器及语句判别器,其中所述语句生成器用于基于训练样本生成相似事件,所述语句判别器用于判别所述相似事件对应的标签真伪。
在一些实施例中,所述预设事件模板包含至少两个词语字典及与各个词语字典对应的词槽,且每个词语字典在所述预设事件模板中有对应的词语标签,所述词语标签用于指示所述词语字典的词语属性。
在一些实施例中,所述装置还包括应答模块,用于将所述待处理事件中包含的至少两个关键词填充至所述目标事件模板的对应词槽,得到目标模板文件;
将所述目标模板文件输入至应答引擎中进行事件检索操作,输出与所述待处理事件对应的目标答案。
在一些实施例中,所述装置还包括记录模块,用于记录所述至少两个关键词在所述待处理事件中的第一排列顺序。
在一些实施例中,所述装置还包括反馈模块,用于将所述目标答案以预设的展示形式反馈给用户。
本申请实施例还提供一种终端设备。所述终端设备可以是智能手机、电脑、平板电脑等设备。
请参阅图5,图5示出了本申请实施例提供的终端设备的结构示意图,该终端设备可以用于实施上述实施例中提供的语义理解方法。该终端设备1200可以为智能手机或平板电脑。
如图5所示,终端设备1200可以包括RF(Radio Frequency,射频)电路110、包括有一个或一个以上(图中仅示出一个)计算机可读存储介质的存储 器120、输入单元130、显示单元140、传感器150、音频电路160、传输模块170、包括有一个或者一个以上(图中仅示出一个)处理核心的处理器180以及电源190等部件。本领域技术人员可以理解,图5中示出的终端设备1200结构并不构成对终端设备1200的限定,可以包括比图示更多或更少的部件,或者组合某些部件,或者不同的部件布置。其中:
RF电路110用于接收以及发送电磁波,实现电磁波与电信号的相互转换,从而与通讯网络或者其他设备进行通讯。RF电路110可包括各种现有的用于执行这些功能的电路元件,例如,天线、射频收发器、数字信号处理器、加密/解密芯片、用户身份模块(SIM)卡、存储器等等。RF电路110可与各种网络如互联网、企业内部网、无线网络进行通讯或者通过无线网络与其他设备进行通讯。
存储器120可用于存储软件程序以及模块,如上述实施例中语义理解方法对应的程序指令/模块,处理器180通过运行存储在存储器120内的软件程序以及模块,从而执行各种功能应用以及数据处理,可以根据终端设备所处的当前场景来自动选择振动提醒模式来进行语义理解,既能够保证会议等场景不被打扰,又能保证用户可以感知来电,提升了终端设备的智能性。存储器120可包括高速随机存储器,还可包括非易失性存储器,如一个或者多个磁性存储装置、闪存、或者其他非易失性固态存储器。在一些实例中,存储器120可进一步包括相对于处理器180远程设置的存储器,这些远程存储器可以通过网络连接至终端设备1200。上述网络的实例包括但不限于互联网、企业内部网、局域网、移动通信网及其组合。
输入单元130可用于接收输入的数字或字符信息,以及产生与用户设置以及功能控制有关的键盘、鼠标、操作杆、光学或者轨迹球信号输入。具体地,输入单元130可包括触敏表面131以及其他输入设备132。触敏表面131,也称为触控显示屏或者触控板,可收集用户在其上或附近的触控操作(比如用户使用手指、触笔等任何适合的物体或附件在触敏表面131上或在触敏表面131附近的操作),并根据预先设定的程式驱动相应的连接装置。可选的,触敏表面131可包括触控检测装置和触控控制器两个部分。其中,触控检测装置检测用户的触控方位,并检测触控操作带来的信号,将信号传送给触控控制器;触 控控制器从触控检测装置上接收触控信息,并将它转换成触点坐标,再送给处理器180,并能接收处理器180发来的命令并加以执行。此外,可以采用电阻式、电容式、红外线以及表面声波等多种类型实现触敏表面131。除了触敏表面131,输入单元130还可以包括其他输入设备132。具体地,其他输入设备132可以包括但不限于物理键盘、功能键(比如音量控制按键、开关按键等)、轨迹球、鼠标、操作杆等中的一种或多种。
显示单元140可用于显示由用户输入的信息或提供给用户的信息以及终端设备1200的各种图形用户接口,这些图形用户接口可以由图形、文本、图标、视频和其任意组合来构成。显示单元140可包括显示面板141,可选的,可以采用LCD(Liquid Crystal Display,液晶显示器)、OLED(Organic Light-Emitting Diode,有机发光二极管)等形式来配置显示面板141。进一步的,触敏表面131可覆盖显示面板141,当触敏表面131检测到在其上或附近的触控操作后,传送给处理器180以确定触控事件的类型,随后处理器180根据触控事件的类型在显示面板141上提供相应的视觉输出。虽然在图5中,触敏表面131与显示面板141是作为两个独立的部件来实现输入和输出功能,但是在某些实施例中,可以将触敏表面131与显示面板141集成而实现输入和输出功能。
终端设备1200还可包括至少一种传感器150,比如光传感器、运动传感器以及其他传感器。具体地,光传感器可包括环境光传感器及接近传感器,其中,环境光传感器可根据环境光线的明暗来调节显示面板141的亮度,接近传感器可在终端设备1200移动到耳边时,关闭显示面板141和/或背光。作为运动传感器的一种,重力加速度传感器可检测各个方向上(一般为三轴)加速度的大小,静止时可检测出重力的大小及方向,可用于识别手机姿态的应用(比如横竖屏切换、相关游戏、磁力计姿态校准)、振动识别相关功能(比如计步器、敲击)等;至于终端设备1200还可配置的陀螺仪、气压计、湿度计、温度计、红外线传感器等其他传感器,在此不再赘述。
音频电路160、扬声器161,传声器162可提供用户与终端设备1200之间的音频接口。音频电路160可将接收到的音频数据转换后的电信号,传输到扬声器161,由扬声器161转换为声音信号输出;另一方面,传声器162将收集 的声音信号转换为电信号,由音频电路160接收后转换为音频数据,再将音频数据输出处理器180处理后,经RF电路110以发送给比如另一终端,或者将音频数据输出至存储器120以便进一步处理。音频电路160还可能包括耳塞插孔,以提供外设耳机与终端设备1200的通信。
终端设备1200通过传输模块170(例如Wi-Fi模块)可以帮助用户收发电子邮件、浏览网页和访问流式媒体等,它为用户提供了无线的宽带互联网访问。虽然图5示出了传输模块170,但是可以理解的是,其并不属于终端设备1200的必须构成,完全可以根据需要在不改变发明的本质的范围内而省略。
处理器180是终端设备1200的控制中心,利用各种接口和线路连接整个手机的各个部分,通过运行或执行存储在存储器120内的软件程序和/或模块,以及调用存储在存储器120内的数据,执行终端设备1200的各种功能和处理数据,从而对手机进行整体监控。可选的,处理器180可包括一个或多个处理核心;在一些实施例中,处理器180可集成应用处理器和调制解调处理器,其中,应用处理器主要处理操作系统、用户界面和应用程序等,调制解调处理器主要处理无线通信。可以理解的是,上述调制解调处理器也可以不集成到处理器180中。
终端设备1200还包括给各个部件供电的电源190,在一些实施例中,电源可以通过电源管理系统与处理器180逻辑相连,从而通过电源管理系统实现管理放电、以及功耗管理等功能。电源190还可以包括一个或一个以上的直流或交流电源、再充电系统、电源故障检测电路、电源转换器或者逆变器、电源状态指示器等任意组件。
尽管未示出,终端设备1200还可以包括摄像头(如前置摄像头、后置摄像头)、蓝牙模块等,在此不再赘述。具体在本实施例中,终端设备1200的显示单元140是触控屏显示器,终端设备1200还包括有存储器120,以及一个或者一个以上的程序,其中一个或者一个以上程序存储于存储器120中,且经配置以由一个或者一个以上处理器180执行一个或者一个以上程序包含用于进行以下操作的指令:
事件获取指令,用于对获取到的待处理事件进行预处理,并将预处理后的待处理事件与预设事件模板进行匹配计算,得到第一匹配度;
语义增强指令,用于将所述待处理事件输入至预训练好的语义增强模型进行语句扩充,得到所述待处理事件的相似事件;
匹配计算指令,用于将所述相似事件或所述待处理事件与所述预设事件模板进行匹配计算,得到第二匹配度;
目标选择指令,用于根据预设规则对所述第一匹配度和所述第二匹配度进行计算,分别得到第一结果和第二结果,取所述第一结果与第二结果中的较大者对应的预设事件模板作为目标事件模板对所述待处理事件进行语义理解。
在一些实施例中,所述目标选择指令,用于根据所述相似事件及待处理事件预先分配的不同权重值,分别对所述第一匹配度与第二匹配度进行加权计算,得到第一结果和第二结果。
在一些实施例中,所述程序还包括新增指令,用于将所述第一结果与第二结果中的较大者对应的相似事件存入所述语义增强模型的样本数据库中,作为新增的训练样本。
在一些实施例中,所述程序还包括更新指令,用于基于Lexparser句法分析工具将语句扩充操作得到的相似事件转换为新增的预设事件模板,将所述新增的预设事件模板存入用于存储预设事件模板的数据库中,以更新所述数据库。
在一些实施例中,所述语义增强模型包括语句生成器及语句判别器,其中所述语句生成器用于基于训练样本生成相似事件,所述语句判别器用于判别所述相似事件对应的标签真伪。
在一些实施例中,所述预设事件模板包含至少两个词语字典及与各个词语字典对应的词槽,且每个词语字典在所述预设事件模板中有对应的词语标签,所述词语标签用于指示所述词语字典的词语属性。
在一些实施例中,所述程序还包括应答指令,用于将所述待处理事件中包含的至少两个关键词填充至所述目标事件模板的对应词槽,得到目标模板文件;
将所述目标模板文件输入至应答引擎中进行事件检索操作,输出与所述待处理事件对应的目标答案。
在一些实施例中,所述程序还包括记录指令,用于记录所述至少两个关键 词在所述待处理事件中的第一排列顺序。
在一些实施例中,所述程序还包括反馈指令,用于将所述目标答案以预设的展示形式反馈给用户。
本申请实施例还提供一种终端设备。所述终端设备可以是智能手机、电脑等设备。
由上可知,本申请实施例提供了一种终端设备1200,所述终端设备1200执行以下步骤:
本申请实施例还提供一种存储介质,所述存储介质中存储有计算机程序,当所述计算机程序在计算机上运行时,所述计算机执行上述任一实施例所述的语义理解方法。
需要说明的是,对本申请所述语义理解方法而言,本领域普通测试人员可以理解实现本申请实施例所述语义理解方法的全部或部分流程,是可以通过计算机程序来控制相关的硬件来完成,所述计算机程序可存储于一计算机可读存储介质中,如存储在终端设备的存储器中,并被该终端设备内的至少一个处理器执行,在执行过程中可包括如所述语义理解方法的实施例的流程。其中,所述存储介质可为磁碟、光盘、只读存储器(ROM,Read Only Memory)、随机存取记忆体(RAM,Random Access Memory)等。
对本申请实施例的所述语义理解装置而言,其各功能模块可以集成在一个处理芯片中,也可以是各个模块单独物理存在,也可以两个或两个以上模块集成在一个模块中。上述集成的模块既可以采用硬件的形式实现,也可以采用软件功能模块的形式实现。所述集成的模块如果以软件功能模块的形式实现并作为独立的产品销售或使用时,也可以存储在一个计算机可读存储介质中,所述存储介质譬如为只读存储器,磁盘或光盘等。
以上对本申请实施例所提供的语义理解方法、装置、介质及设备进行了详细介绍。本文中应用了具体个例对本申请的原理及实施方式进行了阐述,以上实施例的说明只是用于帮助理解本申请的方法及其核心思想;同时,对于本领域的技术人员,依据本申请的思想,在具体实施方式及应用范围上均会有改变之处,综上所述,本说明书内容不应理解为对本申请的限制。

Claims (20)

  1. 一种语义理解方法,其中,包括:
    对获取到的待处理事件进行预处理,并将预处理后的待处理事件与预设事件模板进行匹配计算,得到第一匹配度;
    将所述待处理事件输入至预训练好的语义增强模型进行语句扩充,得到所述待处理事件的相似事件;
    将所述相似事件或所述待处理事件与所述预设事件模板进行匹配计算,得到第二匹配度;
    根据预设规则对所述第一匹配度和所述第二匹配度进行计算,分别得到第一结果和第二结果,取所述第一结果与第二结果中的较大者对应的预设事件模板作为目标事件模板,以对所述待处理事件进行语义理解。
  2. 如权利要求1所述的语义理解方法,其中,所述根据预设规则对所述第一匹配度和所述第二匹配度进行计算,分别得到第一结果和第二结果,包括:
    根据所述相似事件及待处理事件预先分配的不同权重值,分别对所述第一匹配度与第二匹配度进行加权计算,得到第一结果和第二结果。
  3. 如权利要求1所述的语义理解方法,其中,所述相似事件的权重大于所述待处理事件的权重值。
  4. 如权利要求2所述的语义理解方法,其中,在所述取所述第一结果与第二结果中的较大者对应的预设事件模板作为目标事件模板对所述待处理事件进行语义理解之后,所述方法还包括:
    将所述第一结果与第二结果中的较大者对应的相似事件存入所述语义增强模型的样本数据库中,作为新增的训练样本。
  5. 如权利要求1所述的语义理解方法,其中,在所述取所述第一结果与第二结果中的较大者对应的预设事件模板作为目标事件模板对所述待处理事件进行语义理解之后,所述方法还包括:
    基于Lexparser句法分析工具将语句扩充操作得到的相似事件转换为新增的预设事件模板,将所述新增的预设事件模板存入用于存储预设事件模板的数据库中,以更新所述数据库。
  6. 如权利要求5所述的语义理解方法,其中,所述语义增强模型包括语句生成器及语句判别器。
  7. 如权利要求6所述的语义理解方法,其中,所述语句生成器用于基于训练样本生成相似事件,所述语句判别器用于判别所述相似事件对应的标签真伪。
  8. 如权利要求1所述的语义理解方法,其中,所述预设事件模板包含至少两个词语字典及与各个词语字典对应的词槽,且每个词语字典在所述预设事件模板中有对应的词语标签,所述词语标签用于指示所述词语字典的词语属性。
  9. 如权利要求8所述的语义理解方法,其中,所述方法还包括:
    将所述待处理事件中包含的至少两个关键词填充至所述目标事件模板的对应词槽,得到目标模板文件;
    将所述目标模板文件输入至应答引擎中进行事件检索操作,输出与所述待处理事件对应的目标答案。
  10. 如权利要求9所述的语义理解方法,其中,所述关键词通过TF-IDF算法从预先转化为文本格式的待处理事件中进行提取。
  11. 如权利要求9所述的语义理解方法,其中,所述将所述目标模板文件输入至应答引擎中进行事件检索操作,输出与所述待处理事件对应的目标答案,包括:
    将所述目标模板文件输入至应答引擎中,所述应答引擎根据在目标模板文件中各个关键词对应的词语标签定位到对应的数据库,并根据各个关键词从数据库中获取对应的目标答案。
  12. 如权利要求11所述的语义理解方法,其中,在所述得到所述待处理事件包含的至少两个关键词之后,所述方法还包括:
    记录所述至少两个关键词在所述待处理事件中的第一排列顺序。
  13. 如权利要求12所述的语义理解方法,其中,所述预设事件模板中的至少两个词语字典按照预设的第二排列顺序进行排序。
  14. 如权利要求13所述的语义理解方法,其中,所述将预处理后的待处理事件与预设事件模板进行匹配计算,得到第一匹配度,包括:
    获取所述待处理事件的第一文本特征向量,及所述预设事件模板的第二文本特征向量;
    根据所述第一文本特征向量与第二文本特征向量,计算所述待处理事件与 预设事件模板的文本特征相似度值;
    根据所述第一排列顺序获取所述待处理事件的第一时序特征向量,根据所述第二排列顺序获取所述预设事件模板的第二时序特征向量;
    根据所述第一时序特征向量及第二时序特征向量,计算所述待处理事件与预设事件模板的时序特征相似度值;
    将所述文本特征相似度值与时序特征相似度值相加得到所述第一匹配度。
  15. 如权利要求1所述的语义理解方法,其中,在所述输出与所述待处理事件对应的目标答案之后,所述方法还包括:
    将所述目标答案以预设的展示形式反馈给用户。
  16. 一种语义理解装置,其中,包括:
    事件获取模块,用于对获取到的待处理事件进行预处理,并将预处理后的待处理事件与预设事件模板进行匹配计算,得到第一匹配度;
    语义增强模块,用于将所述待处理事件输入至预训练好的语义增强模型进行语句扩充,得到所述待处理事件的相似事件;
    匹配计算模块,用于将所述相似事件或所述待处理事件与所述预设事件模板进行匹配计算,得到第二匹配度;
    目标选择模块,用于根据预设规则对所述第一匹配度和所述第二匹配度进行计算,分别得到第一结果和第二结果,取所述第一结果与第二结果中的较大者对应的预设事件模板作为目标事件模板对所述待处理事件进行语义理解。
  17. 如权利要求16所述的语义理解装置,其中,所述目标选择模块,用于根据所述相似事件及待处理事件预先分配的不同权重值,分别对所述第一匹配度与第二匹配度进行加权计算,得到第一结果和第二结果。
  18. 如权利要求17所述的语义理解装置,其中,所述装置还包括新增模块,用于将所述第一结果与第二结果中的较大者对应的相似事件存入所述语义增强模型的样本数据库中,作为新增的训练样本。
  19. 一种计算机可读存储介质,其中,所述计算机可读存储介质存储有多条指令,所述指令适于处理器进行加载,以执行权利要求1至15任一项所述的语义理解方法。
  20. 一种终端设备,其中,包括处理器和存储器,所述存储器存储有多条指令,所述处理器加载所述指令以执行权利要求1至15任一项所述的语义理 解方法。
PCT/CN2023/099842 2022-06-23 2023-06-13 语义理解方法、装置、介质及设备 WO2023246558A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202210717359.5 2022-06-23
CN202210717359.5A CN114970562A (zh) 2022-06-23 2022-06-23 语义理解方法、装置、介质及设备

Publications (1)

Publication Number Publication Date
WO2023246558A1 true WO2023246558A1 (zh) 2023-12-28

Family

ID=82965278

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2023/099842 WO2023246558A1 (zh) 2022-06-23 2023-06-13 语义理解方法、装置、介质及设备

Country Status (2)

Country Link
CN (1) CN114970562A (zh)
WO (1) WO2023246558A1 (zh)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114970562A (zh) * 2022-06-23 2022-08-30 深圳Tcl新技术有限公司 语义理解方法、装置、介质及设备

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20070288419A1 (en) * 2006-06-07 2007-12-13 Motorola, Inc. Method and apparatus for augmenting data and actions with semantic information to facilitate the autonomic operations of components and systems
CN110222250A (zh) * 2019-05-16 2019-09-10 中国人民公安大学 一种面向微博的突发事件触发词识别方法
CN113312478A (zh) * 2021-04-25 2021-08-27 国家计算机网络与信息安全管理中心 基于阅读理解的观点挖掘方法及装置
CN114004210A (zh) * 2021-11-03 2022-02-01 昭通亮风台信息科技有限公司 基于神经网络的应急预案生成方法、系统、设备及介质
CN114970562A (zh) * 2022-06-23 2022-08-30 深圳Tcl新技术有限公司 语义理解方法、装置、介质及设备

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20070288419A1 (en) * 2006-06-07 2007-12-13 Motorola, Inc. Method and apparatus for augmenting data and actions with semantic information to facilitate the autonomic operations of components and systems
CN110222250A (zh) * 2019-05-16 2019-09-10 中国人民公安大学 一种面向微博的突发事件触发词识别方法
CN113312478A (zh) * 2021-04-25 2021-08-27 国家计算机网络与信息安全管理中心 基于阅读理解的观点挖掘方法及装置
CN114004210A (zh) * 2021-11-03 2022-02-01 昭通亮风台信息科技有限公司 基于神经网络的应急预案生成方法、系统、设备及介质
CN114970562A (zh) * 2022-06-23 2022-08-30 深圳Tcl新技术有限公司 语义理解方法、装置、介质及设备

Also Published As

Publication number Publication date
CN114970562A (zh) 2022-08-30

Similar Documents

Publication Publication Date Title
CN107943860B (zh) 模型的训练方法、文本意图的识别方法及装置
KR102360659B1 (ko) 기계번역 방법, 장치, 컴퓨터 기기 및 기억매체
US20220044463A1 (en) Speech-driven animation method and apparatus based on artificial intelligence
EP3183728B1 (en) Orphaned utterance detection system and method
CN111046227B (zh) 一种视频查重方法及装置
US11830482B2 (en) Method and apparatus for speech interaction, and computer storage medium
WO2018045646A1 (zh) 基于人工智能的人机交互方法和装置
WO2021159877A1 (zh) 问答方法及装置
CN112735418B (zh) 一种语音交互的处理方法、装置、终端及存储介质
CN111597804B (zh) 一种实体识别模型训练的方法以及相关装置
US20220164071A1 (en) Method and device for providing user-selection-based information
US20200051559A1 (en) Electronic device and method for providing one or more items in response to user speech
WO2023246558A1 (zh) 语义理解方法、装置、介质及设备
CN109543014B (zh) 人机对话方法、装置、终端及服务器
CN111159338A (zh) 一种恶意文本的检测方法、装置、电子设备及存储介质
WO2022227507A1 (zh) 唤醒程度识别模型训练方法及语音唤醒程度获取方法
CN114357278A (zh) 一种话题推荐方法、装置及设备
CN110196833A (zh) 应用程序的搜索方法、装置、终端及存储介质
US9158759B2 (en) Engine for human language comprehension of intent and command execution
US20230081558A1 (en) Electronic device and operation method thereof
CN113678119A (zh) 用于生成自然语言响应的电子装置及其方法
CN111553163A (zh) 文本相关度的确定方法、装置、存储介质及电子设备
CN115116434A (zh) 应用实现方法、装置、存储介质及电子设备
CN111723783B (zh) 一种内容识别方法和相关装置
CN113569043A (zh) 一种文本类别确定方法和相关装置

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: 23826207

Country of ref document: EP

Kind code of ref document: A1