Time identification method, system, device and medium

By using multi-level template configuration and expression extraction and normalization processing in time recognition technology, the problems of poor flexibility and strong data dependence in the existing technology are solved, and the recognition and time normalization of complex time expressions are realized. ization, which improves the recognition effect and scalability.

CN114861644BActive Publication Date: 2024-09-17SHENZHEN ZHUIYI TECH CO LTD
View PDF 5 Cites 0 Cited by

Patent Information

Application Number
CN202210383487.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-04-12
Publication Date
2024-09-17
Estimated Expiration
2042-04-12

AI Technical Summary

Technical Problem

Existing time recognition technology has poor flexibility when processing complex time expressions and cannot identify different time expressions. Moreover, methods based on deep learning are highly dependent on data and cannot perform time normalization, which affects subsequent processing processes.

Method used

By obtaining user input information and performing expression extraction and normalization processing based on the preset time template configuration information, the time expression information is identified and converted into standardized time recognition results. Multi-level template configuration is supported to identify complex time expression.

Benefits of technology

It improves the flexibility and scalability of time recognition, can identify time information corresponding to different time expressions, meets different time expression needs, and simplifies subsequent time processing processes.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114861644B
    Figure CN114861644B
Patent Text Reader

Abstract

The present application relates to a time recognition method, system, device and medium, and to the field of computer technology. The time recognition method comprises: obtaining user input information; extracting expressions from the user input information according to preset time template configuration information to obtain time expression information; performing normalization processing on the time expression information and target data in the user input information to obtain a target time recognition result, thereby improving the flexibility of time recognition, being able to recognize the time represented by different complex expressions, and improving the accuracy of time recognition.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer technology, and in particular to a time identification method, system, device and medium. Background Art

[0002] At present, time recognition is mainly carried out by template matching or sequence labeling. Among them, the common template matching method mainly configures some fixed single-level templates for string matching recognition. For example, when the user configures single-level templates of "today" and "morning", string matching through single-level templates can only recognize the time expressions of "today" and "morning", and cannot recognize time combination expressions such as "this morning", and has poor scalability; the sequence labeling method mainly uses deep learning models and some pre-labeled data for model training, and uses the trained model to recognize time expressions. However, the sequence labeling method is highly dependent on data, cannot be manually intervened, has poor flexibility, and is specific. Generally speaking, the sequence labeling method based on deep learning requires users to label a large amount of data for training, and once the deep learning model is trained, it is a black box logic. It is impossible to specifically analyze and determine why the time expression cannot be recognized. When recognition fails, it can only add a large amount of sample data containing the unrecognized time expression for retraining. For example, when "today" cannot be recognized, it can only add a large amount of sample data containing "today" for retraining, which takes a long time and cannot guarantee the recognition effect. In addition, it cannot normalize the time and cannot normalize the time expression to a specific date, which affects the subsequent time processing process and has poor scalability. Summary of the invention

[0003] In view of this, the present application provides a time identification method, system, device and medium to enhance the flexibility of time identification and strong scalability.

[0004] In a first aspect, an embodiment of the present application provides a time identification method, including:

[0005] Get user input information;

[0006] According to the preset time template configuration information, the expression of the user input information is extracted to obtain the time expression information;

[0007] Normalization processing is performed based on the time expression information and the target data in the user input information to obtain a target time recognition result.

[0008] Optionally, the expression extraction is performed on the user input information based on the preset time template configuration information to obtain the time expression information, including: performing word segmentation processing on the user input information to obtain at least two word segmentation processing results; if the word segmentation processing result contains target data corresponding to the time template configuration information, then based on the time template configuration information, converting the target data to obtain the time expression information.

[0009] Optionally, based on the time template configuration information, the target data is converted to obtain the time expression information, including: if the target data contains time identification data corresponding to the first-level template in the time template configuration information, then according to the time expression of the first-level template, the time identification data is converted into a string to obtain the first time expression information; if the target data contains time expression data corresponding to the second-level template in the time template configuration information, then according to the time type identifier of the second-level template, the time expression data is replaced and processed to obtain the second time expression information; according to the time format corresponding to the third-level template in the time template configuration information, the second time expression information and / or the first time expression information are combined and checked to obtain a time combination check result; if the check result identifier in the time combination check result is a check pass identifier, based on the check pass identifier, the time combination information in the time combination check result is used to determine the time expression information.

[0010] Optionally, the time combination information in the time combination verification result is used to determine the time expression information, including: if the time combination information contains date information and moment information, then according to the time format corresponding to the fourth-level template in the time template configuration information, the date information and the moment information are identified and converted to obtain date and time expression information; and the date and time expression information is determined as the time expression information.

[0011] Optionally, the time combination information in the time combination verification result is used to determine the time expression information, including: if the time combination information includes a time period identifier, identifying the first time information and the second time information corresponding to the time period identifier from the time combination information; converting the first time information and the second time information according to the time period format corresponding to the fifth-level template in the time template configuration information to obtain time period expression information; and determining the time period expression information as the time expression information.

[0012] Optionally, normalization processing is performed on the target data in the time expression information and the user input information to obtain a target time recognition result, including: based on the target data, initial normalization processing is performed on the time parameters in the time expression information to obtain an initial normalization result; if the initial normalization result contains the time period identifier, then identification normalization processing is performed on the initial normalization result with respect to the time period identifier to obtain a target time recognition result; if the initial normalization result does not contain the time period identifier, then the initial normalization result is used as the target time recognition result.

[0013] Optionally, the time recognition method further includes: displaying the time expression information and the target time recognition result.

[0014] In a second aspect, an embodiment of the present application provides a time identification system, including:

[0015] An input information acquisition module is used to obtain user input information;

[0016] An expression extraction module, used to extract the expression of the user input information according to the preset time template configuration information to obtain the time expression information;

[0017] The normalization processing module is used to perform normalization processing based on the time expression information and the target data in the user input information to obtain a target time recognition result.

[0018] In a third aspect, an embodiment of the present application provides an electronic device, comprising a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory communicate with each other via the communication bus; the memory is used to store computer programs; and the processor is used to implement the steps of the time identification method as described in any one of the first aspects when executing the program stored in the memory.

[0019] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium having a computer program stored thereon, and when the computer program is executed by a processor, the steps of the time identification method as described in any one of the first aspects are implemented.

[0020] After obtaining user input information, the embodiment of the present application extracts expressions from the user input information based on preset time template configuration information to obtain time expression information, and then performs normalization processing based on the time expression information and the target data in the user input information, thereby achieving time normalization and obtaining a target time recognition result, so that subsequent time processing procedures can be performed based on the target time recognition result, thereby improving the flexibility of time recognition, thereby solving the problems caused by the need to annotate data or match fixed single-level template strings in the prior art, being able to identify time information corresponding to different time expressions, and being able to meet different time expression requirements, and having strong scalability. BRIEF DESCRIPTION OF THE DRAWINGS

[0021] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.

[0022] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.

[0023] Figure 1 is a flowchart of a time identification method provided by an embodiment of the present application;

[0024] Figure 2 A flowchart of a time identification method provided for an optional embodiment of the present application;

[0025] Figure 3 A structural block diagram of a time identification system provided in an embodiment of the present application. DETAILED DESCRIPTION

[0026] In order to make the purpose, technical solution and advantages of the embodiments of the present application clearer, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of this application.

[0027] Reference Figure 1 , shows a flowchart of the steps of a time identification method provided by an embodiment of the present application. Specifically, a time identification method provided by the present application may include the following steps:

[0028] Step 110, obtaining user input information;

[0029] Among them, the user input information may include various information input by the user during the human-computer interaction process, such as voice information and text information input by the user during the conversation with the robot, etc., and the embodiments of the present application do not impose specific restrictions on this.

[0030] Step 120, extracting the expression of the user input information according to the preset time template configuration information to obtain time expression information;

[0031] The time template configuration information may include template data pre-configured for different time templates, and may be used to extract time expressions according to the template data configured for different time templates, so as to extract time expression information corresponding to different time templates. Specifically, after obtaining user input information, the embodiment of the present application may extract the time expression of the user input information according to the template data in the time template configuration information, thereby determining the extracted time expression as the time expression information.

[0032] For example, two or more word segmentation results can be obtained by performing word segmentation processing on the user input information, and then judging whether each word segmentation result contains the target data corresponding to the time template configuration information based on the time template configuration information, so as to determine whether each word segmentation result contains the time expression corresponding to the preset time template. When a word segmentation result contains the target data, it is determined that the word segmentation result contains the time expression corresponding to the time template, and the time expression information corresponding to the time template can be obtained by converting the target data, so that normalization processing can be performed according to the time expression information later, so as to realize time normalization processing.

[0033] It should be noted that the target data may refer to the data information used to express time contained in the user input information, which may specifically include time string data information, time point data information, time period data information, time period data information, etc. This example does not impose any specific restrictions on this. Among them, the time string data information may refer to the number or string used to express time, such as strings such as "day", "day", "Sunday", "Sunday", etc.; the time point data information may refer to the data information used to express the time point, which may specifically be used to determine a specific time point rather than a time range; the time period data information may refer to the data information used to express the time period, which may specifically be used to determine a time interval, such as "the next 3 days", etc. This example does not impose any specific restrictions on this.

[0034] Step 130, performing normalization processing based on the time expression information and the target data in the user input information to obtain a target time recognition result.

[0035] Specifically, after obtaining the time expression information, the embodiment of the present application can perform normalization processing based on the time expression information and the target data in the user input information. For example, based on the time expression information, the target data in the user input information can be normalized to normalize the target data in the user input information into a target time recognition result, thereby obtaining a normalized target time result, so that the target time recognition result can be used for subsequent time processing processes. The scalability is strong, so that users can input different time expressions as needed, meet the user's input requirements for different times, and improve user experience.

[0036] It can be seen that after obtaining the user input information, the embodiment of the present application extracts the expression of the user input information according to the preset time template configuration information to obtain the time expression information, and then performs normalization processing based on the time expression information and the target data in the user input information, thereby realizing the normalization of time, so that the subsequent time processing flow can be performed based on the target time recognition result, thereby improving the flexibility of time recognition, thereby solving the problems in the prior art caused by using a fixed-configuration single-level template or using a model trained based on labeled data for time recognition, and can perform time recognition with complex expressions, and can identify the time information corresponding to different time expressions, meet different time expression requirements, and have strong scalability.

[0037] In actual processing, after obtaining the user input information, the embodiment of the present application can perform word segmentation processing on the user input information, so that expression extraction can be performed for each word segmentation processing result later, so that one or more different time expression information can be extracted. Further, the embodiment of the present application extracts the expression of the user input information according to the preset time template configuration information to obtain the time expression information, which can specifically include: performing word segmentation processing on the user input information to obtain at least two word segmentation processing results, if the word segmentation processing result contains the target data corresponding to the time template configuration information, then based on the time template configuration information, the target data is converted and processed to obtain the time expression information. If a certain word segmentation processing result does not contain the target data corresponding to the time template configuration information, it can be determined that the word segmentation processing result does not contain the time expression corresponding to the time template, and then the expression extraction of the word segmentation processing result can be omitted, such as ignoring the word segmentation processing result, not performing data conversion processing on the word segmentation processing result, etc. The embodiment of the present application does not impose specific restrictions on this.

[0038] In a specific implementation, the time template configuration information may include configuration information of at least two levels of templates, such as configuration information of a five-level template, and the configuration information of each level of template may be used to determine the template data corresponding to the template at that level, so that the time expression can be subsequently extracted according to the template data corresponding to the multi-level templates, thereby solving the problem of poor scalability of the time identification scheme caused by the prior art of performing string matching by configuring a fixed single-level template.

[0039] As an example of the present application, when the preset time template configuration information includes the configuration information of the 5-level template, the first template can be configured through the configuration information of the first-level template to be mainly used for the replacement of some time strings and the extraction of numbers, so as to convert the identified time strings and / or extracted numbers into the time expression information corresponding to the first-level template; and the second template can be configured through the configuration information of the second-level template to be used for the replacement of some time strings and the extraction of numbers. The second-level template can be used to identify some operations involving previous and subsequent time, so as to replace the identified time expression data operations with the second time expression information corresponding to the second-level template; and, the third-level template can be configured through the configuration information of the third-level template to be used for the legitimacy verification of some specific time combinations. The legitimacy verification of the time combination may include the legitimacy verification of specific time points and time periods, such as when you get 2021, Determine whether there is 2021, and when December is obtained, it can be determined whether there is December. For example, when the 14th is obtained, it can be determined whether there is the 14th based on the previous months, etc. This example does not make specific restrictions on this; through the configuration information of the fourth-level template, the fourth-level template can be configured as a higher-level combination based on the third-level template, such as it can be specifically used for the combination of date (DATE) and time (TIME), and after the combination, time expression information such as date and time, before date and time can be obtained, among which the time format of the date and time can be DATE_TIME(DATE,TIME), and the time format before the date and time can be REP_DATE_TIME(DATE,TIME), etc. This example does not make specific restrictions on this; through the configuration information of the fifth-level template, configuring the fifth-level template is a higher-level recognition than the fourth-level template, such as it can be used for the recognition of interval segments. It can be seen that this example can extract relevant time expressions in user input information according to the multi-level template. For example, the time expression related to the query information input by the user can be extracted and recognized according to the multi-level template, thereby solving the problem that the prior art cannot recognize complex expressions by configuring a fixed single-level template for string matching recognition. At the same time, it solves the problem that the prior art needs to rely on labeled data for recognition by training the model through sequence labeling, resulting in poor flexibility, thereby improving the flexibility of time recognition and strong scalability.

[0040] Further, on the basis of the above-mentioned embodiments, the embodiments of the present application convert the target data based on the time template configuration information to obtain the time expression information, which may specifically include: if the target data contains the time identification data corresponding to the first-level template in the time template configuration information, then according to the time expression of the first-level template, the time identification data is converted into a string to obtain the first time expression information; if the target data contains the time expression data corresponding to the second-level template in the time template configuration information, then according to the time type identifier of the second-level template, the time expression data is replaced and processed to obtain the second time expression information; according to the time format corresponding to the third-level template in the time template configuration information, the second time expression information and / or the first time expression information are combined and checked to obtain the time combination check result; if the check result identifier in the time combination check result is a check pass identifier, then based on the check pass identifier, the time combination information in the time combination check result is used to determine the time expression information.

[0041] Among them, the time identification data may include some time strings and numbers, and the time strings and numbers can be used to express time. Specifically, after obtaining the user input information, the embodiment of the present application can identify whether the target data in the user input information contains some strings and for expressing time, so that when it is identified that the target data contains some strings for expressing time, the strings with the same meaning can be converted into the time expression information of the first-level template by string replacement according to the time expression of the first-level template, and then the time expression information of the first-level template can be used as the first time expression information, such as replacing the strings representing Sunday, Sunday and Sunday with the time expression information "week 7" of the first-level template as the first time expression information; when it is identified that the target data contains some numbers for expressing time, the same type of numbers can be extracted and replaced with the same symbols to express, that is, converted into the first time expression information for subsequent processing, such as when the target data in the user input information is: 3:30, the 3 in 3 o'clock can be replaced with digital:hour, and the 30 in 30 minutes can be replaced with digital:minute. The specific replacement method can refer to the following table:

[0042]

[0043] In actual processing, programming languages ​​such as C++ / Java can be used to implement string replacement functions. For example, when the user inputs "3 o'clock", "3 o'clock" can be used as the user input information. Through the configuration information of the first-level template, the "3" in the user input information "3 days" can be matched to the number digital, and the "day" in the user input information "3 days" can be matched to day, so that the final result becomes digital:day, which is used as the first time expression information.

[0044] The time type identifier can be used to identify the time type involved in the calculation of the previous and next time. For example, the time type involved in the calculation of the previous and next time can be divided into three categories: time point, time period and specific time. The time expression data may include various time information involved in the calculation of the previous and next time, such as specific time information, time point information and time period information, etc., which is not specifically limited in the embodiments of the present application.

[0045] Among them, specific time information may refer to a specific time, that is, a time that can be directly obtained without any calculation; such specific time information may be based on the configuration information corresponding to the second-level template, and may be directly replaced with the time expression information of the second-level template according to the time type identifier of the second-level template, as the second time expression information, such as the specific time "2021" may be directly replaced with YEAR (digital: year), the specific time "December" may be directly replaced with MONTH (digital: month), the specific time "12th" may be replaced with DAY (digital: day), and other specific times such as hours, minutes, and seconds may be similar.

[0046] The time point information may refer to a specific time point rather than a range, such as 3 days ago. This type of time point information may be processed by replacement operation according to the time type identifier of the second-level template to be replaced with the time expression information of the second-level template as the second time expression information. For example, the time point information "3 days ago" will be replaced with REL_P_DAY (digital: day), and the year and month are similar. The prefixes can all be expressed as REL_P_X. It should be noted that the "X" in the prefix "REL_P_X" can represent the time point type corresponding to the time point information, such as the time point type corresponding to the year is "YEAR", the time point type corresponding to the month is "MONTH", etc. The embodiments of the present application do not impose specific restrictions on this.

[0047] The time period information may refer to a time period, that is, a time interval. For example, when the time period information is "the next 3 days", based on the configuration information corresponding to the second-level template and according to the time type identifier of the second-level template, the time period information of "the next 3 days" may be replaced with the time expression information REL_PP_DAY (digital: day) of the second-level template as the second time expression information; the year and month may also be similar, and the prefixes may be expressed as REL_PP_X. It should be noted that the "X" in the prefix "REL_PP_X" may indicate the time point type corresponding to the time period information, such as the time period type corresponding to the year is "YEAR", the time period type corresponding to the month is "MONTH", etc. The embodiment of the present application does not impose any specific restrictions on this.

[0048] Further, after obtaining the second time expression information and / or the first time expression information, the embodiment of the present application can perform a combination check on the second time expression information and / or the first time expression information according to the time format corresponding to the third-level template in the time template configuration information to obtain a time combination check result; then the check result identifier can be obtained from the time combination check result to determine whether the check result identifier is a check pass identifier. If the check result identifier in the time combination check result is a check pass identifier, then based on the check pass identifier, the time combination information in the time combination check result is used to determine the time expression information of the third-level template as the third time expression information.

[0049] As an optional example, taking the user input information "December 14, 2021" as an example, the data format of the first time expression information corresponding to the first-level template is configured as: digital:year yeardigital:month monthdigital:day day, the data format of the second time expression information corresponding to the second-level template is configured as: YEAR(digital:year)MONTH(digital:month)DAY(digital:day), and the data format of the third time expression information corresponding to the third-level template is configured as: DATE(digital:year,digital:month,digital:day), the data format of the third time expression information DATE(digital:year,digital:month,digital:day) can be used as the time format corresponding to the third-level template. After the previous first-level template and second-level template are replaced to obtain [YEAR(digital:year)], [MONTH(digital:month)], and [DAY(digital:day)], the data format of the third time expression information DATE(digital:year ,digital:month,digital:day), through similar combination forms, the obtained [YEAR(digital:year)], [MONTH(digital:month)], [DAY(digital:day)] can be replaced with a specific date and time DATE(digital:year,MONTH(digital:month),DAY(digital:day)) as time combination information, and the corresponding date time period expression can be replaced with P_DATE, the moment involving hours, minutes and seconds can be replaced with TIME(), and the time period involving hours, minutes and seconds can be replaced with P_TIME(), and then the legality verification can be performed based on the time combination information, such as judging whether there is 2021 when 2021 is obtained, judging whether there is December when December is obtained, and judging whether there is 14th according to the previous month when the 14th is obtained, and the corresponding time combination verification result is generated, and then when the time combination verification result is verification passed, that is, when the verification result identifier in the time combination verification result is a verification pass identifier, based on the verification pass identifier, the time combination information in the time combination verification result is determined as the time expression information of the third-level template as the third time expression information;When the time combination verification result is a verification failure result, when the verification result identifier in the time combination verification result is a verification failure identifier, it is determined that the time combination information in the time combination verification result is illegal time combination information, and the time combination information in the time combination verification result can be ignored, and the time combination information in the time combination verification result is not determined as the third time expression information, such as the time combination information in the time combination verification result can be deleted, etc. This example does not make specific restrictions on this. ;

[0050] In actual processing, the fourth-level template can be a combination of a higher level based on the third-level template, such as by combining DATE and TIME to obtain the combined date and time expression information, such as the data format of the combined date and time expression information can include DATE_TIME (DATE, TIME) and REP_DATE_TIME (DATE, TIME). Further, based on the above-mentioned embodiment, the embodiment of the present application uses the time combination information in the time combination verification result to determine that the time expression information can specifically include: if the time combination information includes date information and moment information, then according to the time format corresponding to the fourth-level template in the time template configuration information, the date information and the moment information are identified and converted to obtain the date and time expression information, and the date and time expression information is determined as the time expression information.

[0051] For example, when the fourth-level template is a combination of DATE and TIME, and the configuration information of the fourth-level template is "(DATE(digital:year,digital:month,digital:day)TIME(digital:hour,digital:minute,digital:second)->DATE_TIME(digital:year,digital:month,digital:day,digital:hour,digital:minute,digital:second))", after the user input information "15:03:06, December 31, 2021" is verified by the combination of the third-level template, time combination information A can be obtained, and the time combination information A can include: the date information DATE(digital:year,digital:month,digital:day) corresponding to the target data "December 31, 2021" and the time information TIME(d The date information DATE(digital:year,digital:month,digital:day) and the time information TIME(digital:hour,digital:minute,digital:second) can be identified and converted according to the time format corresponding to the fourth-level template to obtain the date and time expression information DATE_TIME(digital:year,digital:month,digital:day,digital:hour,digital:minute,digital:second), so as to determine the identified date and time expression information DATE_TIME(digital:year,digital:month,digital:day,digital:hour,digital:minute,digital:second) as the time expression information.

[0052] It can be seen that when the embodiment of the present application performs a legitimacy check based on the third-level template, it can determine whether the second time expression information and / or the time combination information corresponding to the first time expression information contains date information and time information according to the time format corresponding to the third-level template. Therefore, when the time combination information contains date information and time information, the date information and time information can be identified and combined based on the time format of the fourth-level template to obtain the date and time expression information. Subsequently, the date and time information can be determined as the time expression information of the fourth-level template as the fourth time expression information.

[0053] Furthermore, after obtaining the time combination information based on the third template, the embodiment of the present application can determine whether the time combination information contains the time period information by judging whether the time combination information contains the preset time period identifier, so that when the time combination information contains the time period information, the fifth-level template can be used for a higher level of recognition, such as identifying the time expression information of the interval from December 10, 2021 to December 14, 2021 as the extracted fifth time expression information. Optionally, the embodiment of the present application uses the time combination information in the time combination verification result to determine the time expression information, which may specifically include: if the time combination information contains the time period identifier, identifying the first time information and the second time information corresponding to the time period identifier from the time combination information, and then converting the first time information and the second time information according to the time period format corresponding to the fifth-level template in the time template configuration information to obtain the time period expression information, and determining the time period expression information as the time expression information.

[0054] For example, in combination with the above example, the target data "December 10, 2021 to December 14, 2021" can be replaced by the time combination information "DATE(2021:year,(12:month),(10:day)) to DATE(2021:year,(12:month),(14:day)" after matching and identifying the previous first-level template, second-level template and third-level template. By judging the time combination information "DATE(2021:year,(12:month),(10:day)) to DATE(2021:year,(12:mo nth),(14:day)” contains the preset time period identifier “DATE() to DATE()”, it can be determined that the time combination information DATE(2021:year,(12:month),(10:day)) to DATE(2021:year,(12:month),(14:day)” contains the time period information, and then the “DATE(2021:y nth),(14:day)” in the time combination information “DATE(2021:year,(12:month),(10:day)) to DATE(2021:year,(12:month),(14:day)” can be ear,(12:month),(10:day))" is identified as the first time information, and the "DATE(2021:year,(12:month),(10:day)) to DATE(2021:year,(12:month),(14:day)" in the time combination information "DATE(2021:year,(12:month),(14:day)" is identified as the second time information, that is, the first DATE(digital:year,(digital:month),(digital:day)) in the time combination information The time information is identified as the first time information, and the second DATE(digital:year,(digital:month),(digital:day)) in the time combination information is identified as the second time information. Then, the first time information "DATE(2021:year,(12:month),(10:day))" and the second time information "DATE(2021:year,(12:month),(14:day)" can be converted according to the time period format corresponding to the fifth-level template to obtain the time period expression information DATE_TIME(DATE1,DATE2).It should be noted that DATE1 in the time period expression information DATE_TIME(DATE1,DATE2) can refer to DATA(2021,12,10), and DATE2 in the time period expression information DATE_TIME(DATE1,DATE2) can refer to DATA(2021,12,14), so that the time period expression information DATE_TIME(DATE1,DATE2) indicates that the time expression information matched by the fifth template is DATA(2021,12,14) to DATA(2021,12,16), so that the time period expression information DATE_TIME(DATE1,DATE2) can be used as the fifth time expression information, so that normalization processing can be performed based on the fifth expression information DATE_TIME(DATE1,DATE2) and the target data to obtain the target time recognition result.

[0055] It can be seen that after the legality check is performed based on the third-level template, the embodiment of the present application can determine whether the time combination information is time period information by judging whether the time combination information in the time combination check result contains a time period identifier. Therefore, when the time combination information contains the time period identifier, the first time information and the second time information corresponding to the time period identifier can be determined from the time combination information. Subsequently, the first time information and the second time information can be converted based on the time period format of the fifth-level template to obtain the time period expression information as the time expression information extracted according to the fifth-level template.

[0056] In a specific implementation, after the embodiment of the present application extracts the expression of the user input information according to the preset time template configuration information, it can perform normalization processing based on the extracted one or more time expression information and the target data in the user input information to obtain the target time recognition result. Among them, the normalization processing can be performed based on the extraction result of the time expression information. For example, when the extraction result of the above-mentioned time expression information is the final replacement result DATE(digital:year,MONTH(digital:month),DAY(digital:day)) and TIME, the specific time can be obtained through one normalization. For example, the time expression information DATA(2021,12,14) can be normalized to 20211214000000 through one normalization processing as the target time recognition result; and for The time expression information extracted by the fifth-level template can be processed by two-step normalization to obtain the target time recognition result. For example, when the time expression information extracted by the fifth-level template is "DATA(2021,12,14) to DATA(2021,12,16)", the time expression information "DATA(2021,12,14) to DATA(2021,12,16)" can be normalized to 20211214000000-20211216235959 through two-step normalization processing as the target time recognition result.

[0057] Furthermore, the embodiment of the present application performs normalization processing on the target data in the time expression information and the user input information to obtain a target time recognition result, which may specifically include: based on the target data, performing initial normalization processing on the time parameters in the time expression information to obtain an initial normalized result; if the initial normalized result includes a time period identifier, then performing identifier normalization processing on the initial normalized result based on the time period identifier to obtain a target time recognition result; if the initial normalized result does not include a time period identifier, then using the initial normalized result as the target time recognition result. Specifically, the normalization processing in the embodiment of the present application can normalize the time expression information extracted according to the time template to normalize it to a specific time. For example, for time expression information that does not contain an interval segment identifier, that is, time expression information that has not been processed by the fifth-level template, the time parameters in the time expression information can be initially normalized based on the target data in the user input information to obtain the target time recognition result; and for time expression information that contains an interval segment identifier, that is, time expression information that has been processed by the fifth-level template, after obtaining the initial normalization result corresponding to the time expression information based on the target data, the time period identifier can be further normalized, that is, the time period identifier in the initial normalization result can be normalized to obtain the target time recognition result. It can be seen that the embodiment of the present application can normalize the time expression information containing the time period identifier into the target time recognition result through two normalization processes, so that the recognized time expression information and the normalized result can be returned to the user through the target time recognition result later, so that the user can obtain the recognized time expression information and the normalized result, thereby improving the user experience.

[0058] Optionally, the time recognition method provided by the embodiment of the present application may also include: displaying the time expression information and the target time recognition result, so that the user can view the time expression information and the target time recognition result corresponding to his input information, thereby improving the user experience.

[0059] Reference Figure 2 , shows a flowchart of a time identification method provided by an optional embodiment of the present application. In actual processing, the time identification method provided by the embodiment of the present application may specifically include the following steps:

[0060] Step 201, obtaining user input information;

[0061] Step 202, performing word segmentation processing on the user input information and obtaining the word segmentation processing result;

[0062] Step 203: If the word segmentation processing result contains target data corresponding to the time template configuration information, then based on the time template configuration information, the target data is converted to obtain the time expression information;

[0063] Step 204, based on the target data, performing initial normalization processing on the time parameters in the time expression information to obtain an initial normalization result;

[0064] Step 205: If the initial normalization result includes the time period identifier, the initial normalization result is subjected to identifier normalization processing according to the time period identifier to obtain a target time recognition result;

[0065] Step 206: If the initial normalization result does not include the time period identifier, the initial normalization result is used as the target time recognition result;

[0066] Step 207, displaying the time expression information and the target time recognition result.

[0067] It can be seen that after obtaining the user input information, the embodiment of the present application can perform word segmentation processing on the user input information to obtain the word segmentation processing result, and then determine whether each word segmentation processing result contains the target data corresponding to the time template configuration information. Therefore, when the word segmentation processing result contains the target data corresponding to the time template configuration information, the target data can be converted based on the time template configuration information to obtain the time expression information.

[0068] Specifically, when a word segmentation processing result contains target data corresponding to time template configuration information, it can be determined whether the target data contained in the sub-item processing result contains time identification data corresponding to the first-level time template, so that when the target data contains time identification data, the first time expression information can be determined according to the first-level template, such as replacing the character string and extracting the number according to the first-level template to obtain the first time expression information; at the same time, it can be determined whether the target data contained in the sub-item processing result contains time expression data corresponding to the second-level time template, so that when the target data contains time expression data corresponding to the second-level time template, the second time expression information can be determined according to the second-level template, such as performing some operations on the before and after time according to the second-level template to obtain the second time expression information. For example, when a word segmentation result is "December 14, 2021", it can be determined that the target data "December 14, 2021" of the word segmentation result contains the time identification data "year", the time identification data "month" and the time identification data "day", and then the character string can be replaced and the number can be extracted according to the first-level template to convert the time format of the first-level template digital:year digital:month digital:day to obtain the first time expression information 2021:year 12:month 14:day; at the same time, the word segmentation result can be judged Whether the target data "December 14, 2021" contains the time expression data corresponding to the second-level template, it can be determined that the target data "December 14, 2021" contains the time expression data in the second-level template, and its type is specific time. Then, the replacement operation can be performed according to the time format YEAR (digital: year) MONTH (digital: month) DAY (digital: day) corresponding to the specific time in the second-level template to obtain the second expression information YEAR (2021: year) MONTH (12: month) DAY (14: day).

[0069] Subsequently, based on the first time expression information and / or the second time expression information, the legitimacy of the time combination can be checked according to the configuration information of the third-level template. For example, the first time expression information and / or the second time expression information can be combined and checked according to the time format of the third-level template to obtain a time combination verification result. Therefore, when the verification result in the time combination verification result is marked as a verification pass mark, based on the verification pass mark, the time combination information in the time combination verification result is used to determine the time expression information extracted by the third-level template; subsequently, based on the time expression information extracted from the third-level template, the date and time can be combined according to the configuration information of the fourth-level template. For example, when the verification result in the time combination verification result is marked as a verification pass mark, based on the verification pass mark, the time combination information in the time combination verification result is used to determine the time expression information extracted by the fourth-level template, and when the time combination information in the time combination verification result includes time period information, the first time information and the second time information corresponding to the time period mark can be determined from the time combination information according to the configuration information of the fifth-level template, and the first time information and the second time information are converted in the time period format based on the fifth-level template to obtain the time period expression information, so that the time period expression information can be used as the time expression information extracted according to the fifth-level template.

[0070] After extracting the time expression information according to the multi-level time template, the expression normalization can be performed based on the extracted time expression information and the target data in the user input information to obtain the target time recognition result. The time expression information and the target time recognition result can then be displayed on the display interface to return the recognized time expression and normalized result to the user.

[0071] In summary, after obtaining the user input information, the embodiment of the present application extracts the expression of the user input information according to the preset time template configuration information, and performs normalization processing based on the extracted time expression information and the target data in the user input information to obtain the target time recognition result, thereby realizing the time extraction and normalization of multi-level templates, solving the problems caused by the need to label data or match fixed single-level template strings in the prior art, being able to identify the time information corresponding to different time expressions, and being able to meet different time expression requirements, and having strong scalability.

[0072] It should be noted that, for the purpose of simple description, the method embodiments are expressed as a series of action combinations, but those skilled in the art should be aware that the embodiments of the present application are not limited to the described order of actions, because according to the embodiments of the present application, certain steps may be performed in other orders or simultaneously.

[0073] Reference Figure 3, showing a structural block diagram of a time identification system provided in an embodiment of the present application.

[0074] Specifically, the time identification system 300 provided in this application may include the following modules:

[0075] An input information acquisition module 310 is used to acquire user input information;

[0076] An expression extraction module 320 is used to extract the expression of the user input information according to the preset time template configuration information to obtain time expression information;

[0077] The normalization processing module 330 is used to perform normalization processing based on the time expression information and the target data in the user input information to obtain a target time recognition result.

[0078] Optionally, the expression extraction module 320 may include the following submodules:

[0079] A word segmentation processing submodule, used to perform word segmentation processing on the user input information to obtain at least two word segmentation processing results;

[0080] The target data conversion processing submodule is used to convert the target data based on the time template configuration information to obtain the time expression information when the word segmentation processing result contains the target data corresponding to the time template configuration information.

[0081] Optionally, the target data conversion processing module may include the following units:

[0082] A first-level template processing unit is used to, when the target data contains time identification data corresponding to the first-level template in the time template configuration information, perform character string conversion on the time identification data according to the time expression of the first-level template to obtain first time expression information;

[0083] A second-level template processing unit is used for, when the target data contains time expression data corresponding to the second-level template in the time template configuration information, performing a replacement operation on the time expression data according to the time type identifier of the second-level template to obtain second time expression information;

[0084] The third-level template processing unit is used to perform a combination check on the second time expression information and / or the first time expression information according to the date format corresponding to the third-level template in the time template configuration information to obtain a time combination check result; if the check result identifier in the time combination check result is a check pass identifier, then based on the check pass identifier, the time combination information in the time combination check result is used to determine the time expression information.

[0085] Optionally, the target data conversion processing module may further include the following units:

[0086] a fourth-level template processing unit, configured to, when the time combination information includes date information and time information, identify and convert the date information and the time information according to the time format corresponding to the fourth-level template in the time template configuration information, obtain date and time expression information, and determine the date and time expression information as the time expression information;

[0087] The fifth-level template processing unit is used to identify the first time information and the second time information corresponding to the time period identifier from the time combination information when the time combination information contains the time period identifier; and convert the first time information and the second time information according to the time period format corresponding to the fifth-level template in the time template configuration information to obtain the time period expression information; and determine the time period expression information as the time expression information.

[0088] Optionally, the normalization processing module 330 may include the following submodules:

[0089] An initial normalization submodule, used for performing initial normalization processing on the time parameters in the time expression information based on the target data to obtain an initial normalization result;

[0090] An identification normalization submodule, configured to perform identification normalization processing on the initial normalization result according to the time period identifier when the initial normalization result includes the time period identifier, so as to obtain a target time recognition result;

[0091] The target time identification result submodule is used to use the initial normalization result as the target time identification result when the initial normalization result does not contain the time period identifier.

[0092] Optionally, the time recognition system 300 may further include: a display module. The display module is used to display the time expression information and the target time recognition result.

[0093] It should be noted that the time recognition system provided above can execute a time recognition method provided by any embodiment of the present application, and has the corresponding functions and beneficial effects of the execution method.

[0094] Furthermore, an embodiment of the present application also provides an electronic device, including a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface, and the memory communicate with each other through the communication bus; the memory is used to store computer programs; and the processor is used to implement the steps of the time identification method described in any one of the above method embodiments when executing the program stored in the memory.

[0095] An embodiment of the present application further provides a computer-readable storage medium having a computer program stored thereon. When the computer program is executed by a processor, the time identification method steps described in any one of the above method embodiments are implemented.

[0096] It should be noted that each embodiment in this specification is described in a progressive manner, and each embodiment focuses on the differences from other embodiments, and the same or similar parts between the embodiments can be referred to each other. For the system, device, and storage medium embodiments, since they are basically similar to the method embodiments, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiments.

[0097] In this article, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "comprises", "comprising" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, an element defined by the statement "comprising a ..." does not exclude the presence of other identical elements in the process, method, article or device including the element.

[0098] The above description is only a specific implementation of the present application, so that those skilled in the art can understand or implement the present application. Various modifications to these embodiments will be apparent to those skilled in the art, and the general principles defined herein can be implemented in other embodiments without departing from the spirit or scope of the present application. Therefore, the present application will not be limited to the embodiments shown herein, but will conform to the widest range consistent with the principles and novel features applied for herein.

Claims

1. A time recognition method, characterized in that: include: Get user input information; According to the preset time template configuration information, the expression of the user input information is extracted to obtain the time expression information; Performing normalization processing according to the time expression information and the target data in the user input information to obtain a target time recognition result; The step of extracting the expression from the user input information based on the preset time template configuration information to obtain the time expression information includes: Performing word segmentation processing on the user input information to obtain at least two word segmentation processing results; If the word segmentation processing result includes the target data corresponding to the time template configuration information, then based on the time template configuration information, the target data is converted to obtain the time expression information; The converting process of the target data based on the time template configuration information to obtain the time expression information includes: If the target data includes time identification data corresponding to the first-level template in the time template configuration information, then converting the time identification data into a character string according to the time expression of the first-level template to obtain first time expression information; If the target data includes the time expression data corresponding to the second-level template in the time template configuration information, performing a replacement operation on the time expression data according to the time type identifier of the second-level template to obtain second time expression information; Performing a combination check on the second time expression information and / or the first time expression information according to the time format corresponding to the third-level template in the time template configuration information to obtain a time combination check result; If the verification result identifier in the time combination verification result is a verification pass identifier, then based on the verification pass identifier, the time combination information in the time combination verification result is used to determine the time expression information.

2. The time recognition method according to claim 1, characterized in that: The adopting the time combination information in the time combination verification result to determine the time expression information includes: If the time combination information includes date information and time information, the date information and the time information are identified and converted according to the time format corresponding to the fourth-level template in the time template configuration information to obtain date and time expression information; The date and time expression information is determined as the time expression information.

3. The time recognition method according to claim 1, characterized in that: The adopting the time combination information in the time combination verification result to determine the time expression information includes: If the time combination information includes a time period identifier, identifying the first time information and the second time information corresponding to the time period identifier from the time combination information; Convert the first time information and the second time information according to the time period format corresponding to the fifth level template in the time template configuration information to obtain time period expression information; The time period expression information is determined as the time expression information.

4. The time recognition method according to claim 1, characterized in that: Normalization is performed according to the time expression information and the target data in the user input information to obtain a target time recognition result, including: Based on the target data, performing initial normalization processing on the time parameters in the time expression information to obtain an initial normalization result; If the initial normalization result includes a time period identifier, the initial normalization result is subjected to identifier normalization processing according to the time period identifier to obtain a target time recognition result; If the initial normalization result does not include the time period identifier, the initial normalization result is used as the target time recognition result.

5. The time recognition method according to any one of claims 1 to 4, characterized in that: Also includes: The time expression information and the target time recognition result are displayed.

6. A time recognition system, characterized in that: include: An input information acquisition module is used to obtain user input information; An expression extraction module, used to extract the expression of the user input information according to the preset time template configuration information to obtain the time expression information; A normalization processing module, used for performing normalization processing according to the time expression information and the target data in the user input information to obtain a target time recognition result; The step of extracting the expression from the user input information based on the preset time template configuration information to obtain the time expression information includes: Performing word segmentation processing on the user input information to obtain at least two word segmentation processing results; If the word segmentation processing result includes the target data corresponding to the time template configuration information, then based on the time template configuration information, the target data is converted to obtain the time expression information; The converting process of the target data based on the time template configuration information to obtain the time expression information includes: If the target data includes time identification data corresponding to the first-level template in the time template configuration information, then converting the time identification data into a character string according to the time expression of the first-level template to obtain first time expression information; If the target data includes the time expression data corresponding to the second-level template in the time template configuration information, performing a replacement operation on the time expression data according to the time type identifier of the second-level template to obtain second time expression information; Performing a combination check on the second time expression information and / or the first time expression information according to the time format corresponding to the third-level template in the time template configuration information to obtain a time combination check result; If the verification result identifier in the time combination verification result is a verification pass identifier, then based on the verification pass identifier, the time combination information in the time combination verification result is used to determine the time expression information.

7. An electronic device, characterized in that: It includes a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory communicate with each other through the communication bus; Memory, used to store computer programs; A processor is used to implement the steps of the time identification method described in any one of claims 1-5 when executing a program stored in a memory.

8. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the time identification method according to any one of claims 1 to 5 are implemented.

Citation Information

Patent Citations

  • Question and answer response method and device, equipment and storage medium

    CN111506723A

  • Time data extraction method and device, and electronic equipment

    CN111639491A

  • Business scene interaction method and device, terminal equipment and storage medium

    CN112380853A

  • Text emotion recognition method and device, equipment and storage medium

    CN112966106A

  • Verification code recognition method and apparatus, computer device, and storage medium

    WO2019237549A1