Time identification method, device and related equipment

By using the matching and offset processing technology of time patterns and configuration patterns in text recognition, the problem of inaccurate Chinese relative time recognition in the prior art is solved, and the recognition accuracy of Chinese time information is improved.

CN111563359BActive Publication Date: 2025-01-10TENCENT TECHNOLOGY (SHENZHEN) CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN201910085639.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2019-01-29
Publication Date
2025-01-10
Estimated Expiration
2039-04-28

AI Technical Summary

Technical Problem

The prior art is difficult to accurately identify Chinese relative time information in text, resulting in a decrease in the accuracy of Chinese time information recognition.

Method used

By obtaining the target text and time mode, selecting the matching time text mode, determining the reference time information, and generating the target time information according to the time configuration mode, supporting offset processing and formatting conversion of relative time.

Benefits of technology

It improves the accuracy of Chinese time information recognition in the text and can effectively process absolute and relative time information.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN111563359B_ABST
    Figure CN111563359B_ABST
Patent Text Reader

Abstract

The embodiment of the present invention discloses a time recognition method, device and related equipment, the method comprising: obtaining a target text and obtaining at least one time mode; each time mode comprises: a time text mode and a time configuration mode; selecting a time text mode matching at least one target subtext in the target text, determining the time mode to which the matched time text mode belongs as the target time mode; determining reference time information according to the time configuration mode in the target time mode; generating target time information matching the target text according to the reference time information and the time configuration mode in the target time mode. The present invention can improve the accuracy of recognizing Chinese time information in text.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of computer technology, and in particular to a time recognition method, device and related equipment. Background Art

[0002] Identifying time-related information in text is an important part of the natural language understanding process and is also the basis for information extraction, information retrieval, question-answering systems, topic discovery, and text summarization. By identifying time, we can more accurately understand the events in the text or understand the user's intentions, so accurately identifying time information in text is of great significance.

[0003] The specific process of identifying Chinese time information in existing texts is: define multiple pattern strings about absolute time, perform regular matching between the text and multiple pattern strings, and if the pattern strings are matched, the time information in the corresponding text can be extracted. For example, if the text is: "Attend the meeting on January 11, 2019", the pattern string "(\d+)year(\d+)month(\d+)date" can successfully match the above text, and then the time information in the text can be extracted: January 11, 2019.

[0004] The above method is only effective when the Chinese time information in the text is absolute time. If the Chinese time information in the text is relative time (for example, "the 5th of next month", "March next year", etc.), the existing method cannot recognize the Chinese time information in the text, thereby reducing the accuracy of recognizing the Chinese time information in the text. Summary of the invention

[0005] The embodiments of the present invention provide a time recognition method, an apparatus and related equipment, which can improve the accuracy of recognizing time information in text.

[0006] An embodiment of the present invention provides a time identification method, including:

[0007] Acquire the target text and acquire at least one time mode; each time mode includes: a time text mode and a time configuration mode;

[0008] Selecting a time text pattern that matches at least one target subtext in the target text, and determining the time pattern to which the matched time text pattern belongs as the target time pattern;

[0009] Determining reference time information according to a time configuration mode in the target time mode;

[0010] Target time information matching the target text is generated according to the reference time information and the time configuration mode in the target time mode.

[0011] The step of selecting a time text pattern that matches at least one target subtext in the target text includes:

[0012] Converting a first character sequence of a first numerical type in the target text into a second character sequence of a second numerical type to obtain a text to be matched; the numerical information corresponding to the first character sequence is the same as the numerical information corresponding to the second character sequence;

[0013] At least one character sequence matching the time text pattern is searched in the text to be matched, the found character sequence is used as the target sub-text, and the found time text pattern is used as the time text pattern matching the target sub-text.

[0014] Wherein, determining the reference time information according to the time configuration mode in the target time mode includes:

[0015] Extracting a plurality of original parameters included in the time configuration mode in the target time mode;

[0016] Among multiple original parameters, the original parameter belonging to the time unit attribute is used as an auxiliary parameter;

[0017] If the time type of the auxiliary parameter includes a relative time type, acquiring system time information, and determining the system time information as the reference time information;

[0018] If the time types of the auxiliary parameters are all precise time types, the original time information with a null value is determined as the reference time information.

[0019] The step of generating target time information matching the target text according to the reference time information and the time configuration mode in the target time mode includes:

[0020] Generate multiple target parameters according to the target text and the multiple original parameters;

[0021] The reference time information is offset according to the multiple target parameters to obtain target time information.

[0022] The step of generating a plurality of target parameters according to the target text and the plurality of original parameters includes:

[0023] If the time text pattern in the target time pattern does not contain a numeric wildcard, determining the multiple original parameters as the multiple target parameters;

[0024] If the time text pattern in the target time pattern contains the numerical wildcard, the numerical information corresponding to the numerical wildcard is obtained in the target sub-text in the target text, and the original parameters corresponding to the numerical wildcard are extracted from the multiple original parameters, and the extracted original parameters are replaced with the numerical information obtained in the target sub-text, and the multiple target parameters are generated based on the replaced multiple original parameters.

[0025] The step of performing offset processing on the reference time information according to the multiple target parameters to obtain the target time information includes:

[0026] Among the multiple target parameters, the target parameter belonging to the time unit attribute is used as the first parameter;

[0027] According to the time unit corresponding to the first parameter, offset processing is performed on multiple unit reference time information respectively to obtain start time information; the reference time information includes unit reference time information corresponding to the multiple time units respectively;

[0028] Extracting a target parameter belonging to a time range attribute from among the multiple target parameters as a second parameter, and generating end time information according to the second parameter and the start time information;

[0029] The start time information and the end time information are combined to obtain combined time information, and the target time information is generated according to the combined time information.

[0030] The step of performing offset processing on multiple unit reference time information respectively according to the time unit corresponding to the first parameter to obtain the start time information includes:

[0031] Extract any unit reference time information from the plurality of unit reference time information as target unit reference time information;

[0032] Extracting, from the first parameter, a first sub-parameter having the same time unit as the target unit reference time information as a target first sub-parameter; the first parameter includes a plurality of first sub-parameters;

[0033] generating unit start time information according to the target first sub-parameter and the target unit reference time information;

[0034] When each unit reference time information is determined as the target unit reference time information, a plurality of unit start time information are combined into the start time information in a time unit sequence.

[0035] The combining of the start time information and the end time information to obtain the combined time information includes:

[0036] Combining the start time information and the end time information into first time information;

[0037] Extracting a target parameter belonging to a time conversion attribute from among the multiple target parameters as a third parameter, and determining a conversion type corresponding to the third parameter;

[0038] If the conversion type belongs to the first conversion type, determining the first time information as the combined time information;

[0039] If the conversion type belongs to the second conversion type, time information having the same date as the first time information is searched in the calendar file as the combined time information.

[0040] The combining of the start time information and the end time information to obtain the combined time information includes:

[0041] Combining the start time information and the end time information into second time information;

[0042] Extracting a target parameter belonging to a holiday formatting attribute from among the multiple target parameters as a fourth parameter, and determining a holiday formatting type corresponding to the fourth parameter;

[0043] If the festival formatting type belongs to the first formatting type, determining the second time information as the combined time information;

[0044] If the holiday formatting type belongs to the second formatting type, time information corresponding to the time text pattern in the target time pattern is searched in the calendar file, the second time information is updated according to the time information corresponding to the time text pattern in the target time pattern, and the updated second time information is determined as the combined time information.

[0045] Wherein, generating the target time information according to the combined time information includes:

[0046] When there are multiple combined time information, the combined time information corresponding to the target subtexts located adjacently in the target text is used as the first combined time information and the second combined time information; the combined time information includes unit times corresponding to multiple time units respectively;

[0047] Extracting the time type of the target parameter belonging to the time unit attribute from among the multiple target parameters corresponding to the first combined time information, and extracting the time type of the target parameter belonging to the time unit attribute from among the multiple target parameters corresponding to the second combined time information;

[0048] Determine, according to the extracted time type, the priorities corresponding to the respective unit times in the first combined time information and the priorities corresponding to the respective unit times in the second combined time information;

[0049] Selecting a minimum time range from the time range corresponding to the first combined time information and the time range corresponding to the second combined time information as the target time range;

[0050] According to the priority and the target time range, combining the first combined time information and the second combined time information into first statistical time information;

[0051] The target time information is determined according to the first statistical time information.

[0052] Wherein, generating the target time information according to the combined time information includes:

[0053] When the number of the combined time information is multiple, extracting the connecting characters in the target text;

[0054] Merging the combined time information corresponding to the target subtexts adjacent to the connecting character in the target text into the second statistical time information;

[0055] The target time information is determined according to the second statistical time information.

[0056] Among them, it also includes:

[0057] Semantically identifying the target text to obtain target semantic information;

[0058] Acquire a target service interface corresponding to the target semantic information, and use the target time information as an interface parameter of the target service interface;

[0059] Based on the target service interface and the interface parameters, an application service corresponding to the target service interface is called.

[0060] Another aspect of the present invention provides a time identification device, including:

[0061] An acquisition module is used to acquire a target text and acquire at least one time mode; each time mode includes: a time text mode and a time configuration mode;

[0062] A matching module, used for selecting a temporal text pattern that matches at least one target subtext in the target text;

[0063] The acquisition module is further used to determine the time pattern to which the matched time text pattern belongs as the target time pattern;

[0064] A determination module, configured to determine reference time information according to a time configuration mode in the target time mode;

[0065] A generating module is used to generate target time information matching the target text according to the reference time information and the time configuration mode in the target time mode.

[0066] Wherein, the matching module includes:

[0067] a conversion unit, configured to convert a first character sequence of a first numerical type in the target text into a second character sequence of a second numerical type, to obtain a text to be matched; the numerical information corresponding to the first character sequence is the same as the numerical information corresponding to the second character sequence;

[0068] A search unit is used to search for at least one character sequence matching the time text pattern in the text to be matched, use the found character sequence as the target sub-text, and use the found time text pattern as the time text pattern matching the target sub-text.

[0069] The determining module comprises:

[0070] An extraction unit, used for extracting a plurality of original parameters included in the time configuration mode in the target time mode;

[0071] The extraction unit is further used to use the original parameter belonging to the time unit attribute among the multiple original parameters as the auxiliary parameter;

[0072] an acquiring unit, configured to acquire system time information if the time type of the auxiliary parameter includes a relative time type, and determine the system time information as the reference time information;

[0073] The acquisition unit is further configured to determine original time information with a null value as the reference time information if the time types of the auxiliary parameters are all precise time types.

[0074] Wherein, the generating module comprises:

[0075] A first generating unit, configured to generate a plurality of target parameters according to the target text and the plurality of original parameters;

[0076] The second generating unit is used to perform offset processing on the reference time information according to the multiple target parameters to obtain target time information.

[0077] Wherein, the first generating unit includes:

[0078] an extraction subunit, configured to determine the plurality of original parameters as the plurality of target parameters if the time text pattern in the target time pattern does not contain a numeric wildcard;

[0079] A replacement sub-unit is used for obtaining the numerical information corresponding to the numerical wildcard in the target sub-text in the target text if the time text pattern in the target time pattern contains the numerical wildcard, and extracting the original parameters corresponding to the numerical wildcard from the multiple original parameters, replacing the extracted original parameters with the numerical information obtained in the target sub-text, and generating the multiple target parameters based on the replaced multiple original parameters.

[0080] Wherein, the second generating unit includes:

[0081] The first determining subunit uses, among the multiple target parameters, a target parameter belonging to a time unit attribute as a first parameter;

[0082] A second determining subunit is used to perform offset processing on a plurality of unit reference time information respectively according to the time unit corresponding to the first parameter to obtain start time information; the reference time information includes unit reference time information respectively corresponding to the plurality of time units;

[0083] The first determining subunit is further configured to extract a target parameter belonging to a time range attribute from the plurality of target parameters as a second parameter, and generate end time information according to the second parameter and the start time information;

[0084] A combining subunit, used for combining the start time information and the end time information to obtain combined time information;

[0085] The first generating subunit is used to generate the target time information according to the combined time information.

[0086] Wherein, the second determining subunit includes:

[0087] An acquisition subunit is used to extract any unit reference time information from a plurality of unit reference time information as target unit reference time information;

[0088] The acquisition subunit is further used to extract, from the first parameter, a first subparameter having the same time unit as the target unit reference time information as a target first subparameter; the first parameter includes a plurality of first subparameters;

[0089] a second generating subunit, configured to generate unit start time information according to the target first subparameter and the target unit reference time information;

[0090] The second generating subunit is further configured to combine a plurality of unit start time information into the start time information in a time unit sequence when each unit reference time information is determined as the target unit reference time information.

[0091] Wherein, the combined subunit comprises:

[0092] A first combining subunit, used for combining the start time information and the end time information into first time information;

[0093] The first combining subunit is further configured to extract a target parameter belonging to a time conversion attribute from the plurality of target parameters as a third parameter, and determine a conversion type corresponding to the third parameter;

[0094] a first conversion subunit, configured to determine the first time information as the combined time information if the conversion type belongs to a first conversion type;

[0095] The first conversion subunit is further configured to search a calendar file for time information having the same date as the first time information as the combined time information if the conversion type belongs to the second conversion type.

[0096] Wherein, the combined subunit comprises:

[0097] A second combining subunit, used for combining the start time information and the end time information into second time information;

[0098] The second combining subunit is further configured to extract a target parameter belonging to a holiday formatting attribute from the plurality of target parameters as a fourth parameter, and determine a holiday formatting type corresponding to the fourth parameter;

[0099] a second conversion subunit, configured to determine the second time information as the combined time information if the festival formatting type belongs to the first formatting type;

[0100] The second conversion subunit is further used to search the calendar file for time information corresponding to the time text pattern in the target time pattern if the holiday formatting type belongs to the second formatting type, update the second time information according to the time information corresponding to the time text pattern in the target time pattern, and determine the updated second time information as the combined time information.

[0101] Wherein, the first generating subunit comprises:

[0102] A third determining subunit is used for, when there are multiple combined time information, using the combined time information corresponding to the target subtexts that are adjacent in position in the target text as the first combined time information and the second combined time information; the combined time information includes unit times corresponding to multiple time units respectively;

[0103] The third determining subunit is further configured to extract the time type of the target parameter belonging to the time unit attribute from the multiple target parameters corresponding to the first combined time information, and extract the time type of the target parameter belonging to the time unit attribute from the multiple target parameters corresponding to the second combined time information;

[0104] The third determining subunit is further used to determine the priorities corresponding to the respective unit times in the first combined time information and the priorities corresponding to the respective unit times in the second combined time information according to the extracted time types;

[0105] The third determining subunit is further configured to select a minimum time range from the time range corresponding to the first combined time information and the time range corresponding to the second combined time information as the target time range;

[0106] a first merging subunit, configured to merge the first combined time information and the second combined time information into first statistical time information according to the priority and the target time range;

[0107] The third determining subunit is further configured to determine the target time information according to the first statistical time information.

[0108] Wherein, the first generating subunit comprises:

[0109] A fourth determining subunit, configured to extract connecting characters in the target text when the number of the combined time information is multiple;

[0110] A second merging subunit is used to merge the combined time information corresponding to the target subtexts adjacent to the connecting character in the target text into the second statistical time information;

[0111] The fourth determining subunit is further configured to determine the target time information according to the second statistical time information.

[0112] Among them, it also includes:

[0113] A semantic recognition module, used for semantically recognizing the target text to obtain target semantic information;

[0114] The semantic recognition module is further used to obtain a target service interface corresponding to the target semantic information, and use the target time information as an interface parameter of the target service interface;

[0115] The calling module is used to call the application service corresponding to the target service interface based on the target service interface and the interface parameters.

[0116] Another aspect of an embodiment of the present invention provides an electronic device, including: a processor and a memory;

[0117] The processor is connected to a memory, wherein the memory is used to store program codes, and the processor is used to call the program codes to execute a method as in one aspect of an embodiment of the present invention.

[0118] Another aspect of an embodiment of the present invention provides a computer storage medium, wherein the computer storage medium stores a computer program, wherein the computer program includes program instructions, and when the program instructions are executed by a processor, the method in one aspect of an embodiment of the present invention is executed.

[0119] The embodiment of the present invention determines the time configuration mode corresponding to the target subtext by selecting the time text mode that matches the target subtext in the target text. The reference time information is determined by the time configuration mode, and the target time information is generated according to the reference time information and the time configuration mode. As can be seen from the above, the reference time is determined by the time configuration mode, and the adjustment is made based on the reference time. Therefore, no matter whether the Chinese time information in the text is relative time or absolute time, after adjusting the reference time, the accurate time expressed in the text can be obtained, which can improve the accuracy of recognizing the Chinese time information in the text. BRIEF DESCRIPTION OF THE DRAWINGS

[0120] In order to more clearly illustrate the embodiments of the present invention 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, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0121] Figure 1 is a system architecture diagram of time identification provided by an embodiment of the present invention;

[0122] Figure 2a-2b is a schematic diagram of a time recognition scenario provided by an embodiment of the present invention;

[0123] Figure 3 is a flow chart of a time identification method provided by an embodiment of the present invention;

[0124] Figure 4 It is a component architecture diagram of time identification provided by an embodiment of the present invention;

[0125] Figure 5 is a schematic diagram of a process for determining target time information provided by an embodiment of the present invention;

[0126] Figure 6 is a flow chart of another time identification method provided by an embodiment of the present invention;

[0127] Figure 7 is a schematic diagram of the structure of a time identification device provided by an embodiment of the present invention;

[0128] Figure 8 It is a structural schematic diagram of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0129] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0130] See also Figure 1 , is a system architecture diagram of time identification provided by an embodiment of the present invention. The server 10f establishes a connection with a user terminal cluster through a switch 10e and a communication bus 10d. The user terminal cluster may include: user terminal 10a, user terminal 10b, ..., user terminal 10c.

[0131] Taking user terminal 10a as an example, when user terminal 10a receives a text to be recognized containing Chinese time information, user terminal 10a sends the text to be recognized to server 10f. Server 10f extracts multiple preset time text patterns (that is, pattern strings related to time information) from database 10g, and determines the reference time by regular matching the received text to be recognized with multiple time text patterns, and by finding the time configuration pattern corresponding to the successfully matched time text pattern, and then adjusts the reference time to accurately recognize the Chinese time information in the text. Server 10f sends the recognized time information to user terminal 10a, and subsequently user terminal 10a can call the application subsystem corresponding to the text to be recognized, and pass the time information as a parameter to the application subsystem so that the application subsystem provides corresponding services. For example, display calendar services, find ticket services, etc.

[0132] Of course, if the user terminal 10a has the function of accurately identifying the Chinese time information in the text, the user terminal 10a can also directly identify the Chinese time information in the text, and also pass the identified time information as a parameter to the application subsystem. The following is a specific description of how the user terminal 10a accurately identifies the Chinese time information in the text.

[0133] in, Figure 1 The user terminals 10a, 10b, 10c, etc. shown may include mobile phones, tablet computers, laptop computers, PDAs, mobile Internet devices (MIDs), wearable devices (such as smart watches, smart bracelets, etc.), etc.

[0134] See also Figure 2a-2b , is a schematic diagram of a time recognition scenario provided by an embodiment of the present invention. Figure 2a As shown, the user inputs the following information into the user terminal 10a by voice or text: air tickets from Beijing to Shanghai on March 5 next year, and clicks the "Search" button. The user terminal 10a converts the information input by the user into text 20a, and the user terminal 10a obtains multiple pre-set time text patterns from the local file (taking the acquisition of three time text patterns as an example, the three time text patterns are: (next year|next year|next year), last year, (\d+) month (\d+)(day|number)). The user terminal 10a performs regular matching on the text 20a and the above three time text patterns respectively, and the character sequence "next year" in the text 20a successfully matches the time text pattern "(next year|next year|next year), and the character sequence "March 5" in the text 20a successfully matches the time text pattern "(\d+) month (\d+)(day|number)". The two successfully matched time text patterns and the corresponding character sequences are described below.

[0135] For the character sequence "next year" and the time text pattern "(next|next|next) year", the time configuration pattern corresponding to the time text pattern "(next|next|next) year" is searched in the pattern configuration table 20b, which is called the original time configuration pattern. It can be known that the original time configuration pattern includes multiple original parameters, each parameter has corresponding attributes, and the attributes include: whether it is the Gregorian calendar, year, month, day, hour, minute, second, and time range. From the multiple original parameters, the original parameters corresponding to the attributes "year, month, day, hour, minute, second" are extracted, all as auxiliary parameters, and each auxiliary parameter also has a corresponding time type. According to the parameter value of the auxiliary parameter, the time type of each auxiliary parameter can be determined, and the time type includes a relative time type and a precise time type. For the pattern configuration table 20b, an integer represents addition and subtraction operations on the reference time, so if the parameter value of the auxiliary parameter is an integer (for example, -1, 0, etc.), then the time type corresponding to the auxiliary parameter is a relative time type; the time types of the remaining auxiliary parameters other than integers (for example, *, e0) are all precise time types. Subsequently, the values ​​of the original parameters (auxiliary parameters) corresponding to the attributes "year-month-day-hour-minute-second" may be updated, but the time type remains fixed.

[0136] Since the time type of the auxiliary parameter corresponding to the time text pattern "(next|next|next) year" contains a relative time type (the time type of the original parameter corresponding to the attribute "year" is a relative time type), the current time of the user terminal 10a is read: 2019 / 1 / 12 / 20:0:0 as the reference time.

[0137] Since the time text pattern "(next|next|next) year" does not contain a numeric wildcard (the numeric wildcard is: \d or \d+), the multiple original parameters in the original time configuration pattern corresponding to the time text pattern can be directly used as target parameters, that is, the target parameter set 20c is obtained, and the time type of the original parameter corresponding to the attribute "year-month-day-hour-minute-second" determined above is determined as the time type of the corresponding target parameter.

[0138] The process of adjusting the reference time through the target parameter corresponding to the attribute "year, month, day, hour, minute, second" in the target parameter set 20c is as follows: For the target parameter "1" corresponding to the attribute "year", since the time type of this target parameter is the relative time type, 1 is added to the year reference time, where the reference time includes the (year / month / day / hour / minute / second) reference time. For the multiple target parameters "*" corresponding to the attribute "month, day, hour, minute, second", the time type of this target parameter is any precise time type in the precise time type. Therefore, the (month / day / hour / minute / second) reference times are all set to the value 1 corresponding to the target parameter "*", and then the start time can be obtained: 2020 / 1 / 1 / 1:1:1. Read the target parameter of the attribute "time range", and based on this target parameter and the start time, the end time can be determined: 2021 / 1 / 1:1:1. Combine the start time and the end time into the time information 20e: (2020 / 1 / 1 / 1:1:1, 2021 / 1 / 1:1:1). Since the target parameter of the attribute "is Gregorian calendar" in the target configuration information 20c is: Y, there is no need to perform the Gregorian and lunar calendar conversion on the time information 20e. Thus, the time information 20e corresponding to the target configuration information 20c is determined.

[0139] For the character sequence "March 5th" and the time text pattern "(\d+) month (\d+)(day|th)", similar to the above, in the pattern configuration table 20b, the corresponding original time configuration pattern is found, and the time type of the original parameter corresponding to the attribute "year, month, day, hour, minute, second" is determined. The original parameter "*" belongs to any precise time type in the precise time type; the original parameters "x1" and "x2" belong to the variable precise time type in the precise time type; the original parameter "e0" belongs to the absolute precise time type in the precise time type. It can be known that the time types of the original parameters corresponding to the attribute "year, month, day, hour, minute, second" are all precise time types. Therefore, the time information with null values: "_ / _ / _ / _:_:_ " can be used as the reference time.

[0140] For the time text pattern "(\d+) month (\d+)(day|th)", it contains numerical wildcards. Therefore, extract the numerical values from the corresponding character sequence "March 5th", and replace the original parameters "x1" and "x2" corresponding to the numerical wildcards in the original parameters with the extracted numerical values to obtain the target parameter set 20d. Determine the time type of the original parameter corresponding to the attribute "year, month, day, hour, minute, second" determined above as the time type of the corresponding target parameter.

[0141] The process of adjusting the reference time through the target parameter corresponding to the attribute "year, month, day, hour, minute, second" in the target parameter set 20d is as follows: for the target parameter "*" corresponding to the attribute "year", the year reference time is set to the value 1 corresponding to "*", and for the target parameters "3" and "5" corresponding to the attributes "month" and "day", the target parameters belong to the variable precise time type in the precise time type, so the month reference time is set to the value 3, and the day reference time is set to the value 5. For the target parameter "e0" corresponding to the attribute "hour, minute, second", the target parameter belongs to the absolute precise time type in the precise time type, so the hour reference time, minute reference time and second reference time are set to the value 0 corresponding to "e0". Then the start time can be obtained: 1 / 3 / 5 / 0:0:0. Read the target parameter of the attribute "time range", and based on the target parameter and the start time, the end time can be determined: 1 / 3 / 6 / 0:0:0. The start time and the end time are combined into time information 20f: (1 / 3 / 5 / 0:0:0, 1 / 3 / 6 / 0:0:0). Since the target parameter of the attribute "whether it is the Gregorian calendar" in the target configuration information 20d is: Y, it is not necessary to convert the time information 20f into the Gregorian calendar. At this point, the time information 20f corresponding to the target configuration information 20d is determined.

[0142] Next, the user terminal 20a merges the time information 20e and the time information 20f. First, among the multiple target parameters corresponding to the time information 20e, the time type of the target parameter corresponding to the attribute "year-month-day-hour-minute-second" is determined, and among the multiple target parameters corresponding to the time information 20f, the time type of the target parameter corresponding to the attribute "year-month-day-hour-minute-second" is determined. According to the time type, the priority of each unit time in the time information 20e and the time information 20f is determined. The time information 20e and the time information 20f are both composed of (year / month / day / hour / minute / second) unit time combinations.

[0143] Since the priority of the (month / day / hour / minute / second) unit in time information 20f is higher than the priority of the (month / day / hour / minute / second) unit in time information 20e, and the priority of the year unit time in time information 20e is higher than the priority of the year unit time in time information 20f, the start time information in the two time information can be merged first, that is, the new start time information is: 2020 / 3 / 5 / 0:0:0; and then the end time information in the two time information is merged, that is, the new end time information is: 2021 / 3 / 6 / 0:0:0. Since the minimum time range in the time range of time information 20f and the time range of time information 20e is 1 day, and the time range of the new start time information and the new end time information is 1 year, the new end time information needs to be adjusted to: 2020 / 3 / 6 / 0:0:0. The new start time information and the adjusted end time information are combined into target time information 20g: (2020 / 3 / 5 / 0:0:0, 2020 / 3 / 6 / 0:0:0).

[0144] Among them, the time range of time information 20e is the target parameter corresponding to the attribute "time range" in the target parameter set 20c; the time range of time information 20f is the target parameter corresponding to the attribute "time range" in the target parameter set 20d.

[0145] like Figure 2b As shown, the user terminal 10a recognizes the semantics of the text 20a, and determines the application service as the air ticket query service according to the recognized semantics (as shown in interface 20h). The subsystem of the service is obtained, and the recognized target time information 20g is used as a system parameter, as shown in interface 20k, and the subsystem and the system parameter are called to provide the corresponding air ticket query service.

[0146] Among them, obtain multiple target parameters (such as the above Figure 2a In the corresponding embodiment, the target parameter set 20c, the target parameter in the target parameter set 20d), determine the reference time, generate the target time information (as described above Figure 2a The specific process of the target time information 20g) in the corresponding embodiment can be seen below. Figures 3 to 6 The corresponding embodiment.

[0147] Please see Figure 3 FIG. 1 is a flow chart of a time identification method provided by an embodiment of the present invention. Figure 3 As shown, the time identification method may include:

[0148] Step S101, obtaining a target text and obtaining at least one time mode; each time mode includes: a time text mode and a time configuration mode.

[0149] Specifically, the terminal (as mentioned above Figure 2a The user terminal 10a in the corresponding embodiment obtains a text containing Chinese time information, which is called the target text (as mentioned above). Figure 2a The text 20a in the corresponding embodiment) is obtained, and multiple time patterns are obtained, each of which includes a time text pattern and a time configuration pattern. The time text pattern is a pattern string about time. The time text pattern describes a string matching pattern (Pattern). Each time text pattern is also a regular expression (Regular Expression). The time text pattern can be used to detect whether a string (text) contains a certain substring, and then the substring that meets certain conditions can be extracted from the text. The time configuration pattern includes multiple parameters with different conditional attributes, and the conditional attributes may include: time unit attribute, time range attribute, time conversion attribute, holiday formatting attribute, etc.

[0150] For example, the time text pattern can be (next|next|next) year, (\d+) year (before|before|before), (\d+) month (\d+)(day|number), etc. It can be seen that the time text pattern can contain ordinary characters and metacharacters (also called special characters). Letters, numbers, words, etc. are ordinary characters; metacharacters are characters with special meanings, for example, the metacharacter "\d" means matching a numeric character; the metacharacter "\d+" means matching one or more numeric characters; the metacharacter "\r" means matching a carriage return character, and the metacharacter "\d+" can also be called a numeric wildcard, that is, it matches all numeric values.

[0151] Step S102: Select a time text pattern that matches at least one target subtext in the target text, and determine the time pattern to which the matched time text pattern belongs as the target time pattern.

[0152] Specifically, since the numerical value in the Chinese time information to be identified in the target text may be a Chinese numerical value, for example, the Chinese time information is: May 12, 2020. In order to match the numerical wildcard in the time text pattern, the terminal first needs to convert the Chinese numerical value into an ASCII numerical value, that is, into an Arabic numerical value. The specific process is: the terminal first identifies the first character sequence of the first type in the target text, converts the first character sequence of the first type into a second character sequence of the second type, and the numerical information corresponding to the converted second character sequence is the same as the numerical information of the first character sequence before the conversion, and the terminal determines the converted target text as the text to be matched. The character string corresponding to the Chinese numerical value is the first character sequence of the first type, and the character string corresponding to the ASCII numerical value is the second character sequence of the second type.

[0153] For example, the target text is: May 12, 2020, and the first character sequences belonging to the first type are: 2020, 5, 12. The above first character sequence is converted into the second character sequence: 2020, 5, 12. The text to be matched after conversion is: May 12, 2020.

[0154] The terminal performs regular matching on the text to be matched and multiple time text patterns respectively, that is, in the reading order, the character sequence matching the time text pattern is searched in the text to be matched, the matching character sequence found in the text to be matched is determined as the target subtext, and the time text pattern matching the target subtext is determined as the time text pattern matching the target subtext. After each successful match, the terminal can record the position of the successful match in the text to be matched, and the next match starts from the recorded position and performs regular matching again with all the time text patterns until all the characters in the text to be matched are regularly matched. It can be known that the text to be matched may successfully match multiple time text patterns, and each successfully matched time text pattern has a corresponding target subtext.

[0155] Among multiple time patterns, the time pattern to which the successfully matched time text pattern belongs is determined as the target time pattern.

[0156] Step S103: determining reference time information according to the time configuration mode in the target time mode.

[0157] Specifically, the following is explained with a target time mode. The terminal extracts multiple parameters contained in the time configuration mode in the target time mode, which are called original parameters. Each original parameter has conditional attributes, which may include: time unit attribute, time range attribute, time conversion attribute, festival formatting attribute, etc. For the original parameter corresponding to the time unit attribute, it also has a time type.

[0158] In order to determine the time type of the above original parameters, the original parameters belonging to the time unit attribute can be used as auxiliary parameters. The terminal can determine the time type of each auxiliary parameter according to the parameter value of the auxiliary parameter and the operation definition corresponding to the parameter value. The time type includes a relative time type and an exact time type. Subsequently, the parameter value of the original parameter may be updated, but the corresponding time type and conditional attributes are fixed.

[0159] For auxiliary parameters belonging to the time unit attribute, when the operation definition corresponding to the parameter value of the auxiliary parameter is to perform addition and subtraction operations on the basis of the reference time, the time type of the auxiliary parameter is a relative time type; when the operation definition corresponding to the parameter value of the auxiliary parameter is to set the reference time to a fixed and precise value, the time type of the auxiliary parameter is a precise time type. Relative time types include fixed relative time types and variable relative time types, and precise time types include variable precise time types, arbitrary precise time types, and absolutely precise time types. The purpose of dividing time types into relative time types and precise time types from a coarse dimension is to determine the reference time information; the purpose of further subdividing relative time types and precise time types from a fine dimension is to accurately adjust the reference time information to obtain the target time information.

[0160] The above five time types are described in detail in Table 1 below:

[0161] Table 1

[0162]

[0163] For Table 1, "Is it the Gregorian calendar" is the time conversion attribute, "Valid duration" is the time range attribute, and "Holiday substring" is the holiday formatting attribute. "Year", "Month", "Day", "Hour", "Minute", "Second", and "Day of the week" are all time unit attributes.

[0164] The original parameters (also known as auxiliary parameters) of "year, month, day, hour, minute, second, day of week" (time unit attribute) include five time types, which are described in detail below:

[0165] Fixed relative time type (for example, 1, -1, etc. corresponding to the "year" time unit): recorded as an integer value, which can be a negative number, such as 1 means adding a unit time domain to the base time, -1 means moving the time domain forward by one unit, and 0 means that the subdomain can take the threshold of the current base time.

[0166] Variable relative time type (for example, d-1, d1, etc. corresponding to the "year" time unit): recorded as d{integer value}, which will subtract the first number extracted from the target subtext from the base time.

[0167] The precise time type of the variable (for example, x1 corresponding to the time unit of "year") is recorded as x{integer value}, and the first number extracted from the target subtext is used as the value of the subdomain.

[0168] Any precise time type (for example, * for the "month" time unit, etc.): denoted as *, indicating that the value of the value domain is uncertain and can be any value within the value range of the value domain.

[0169] Absolutely precise time type (for example, e0 corresponding to the "month" time unit, etc.): recorded as e{integer value}, for example e0, indicating that the value of this subfield is a fixed value 0.

[0170] The terminal can determine the time type of each auxiliary parameter through Table 1 and detect the time type of the auxiliary parameter:

[0171] If the time types corresponding to all auxiliary parameters include relative time types, the terminal obtains the current time of the system as the system time information, and determines the system time information as the reference time information. If the time types corresponding to all auxiliary parameters are all precise time types, the terminal determines the original time information as the reference time information, where the original time information is the time information with an empty value, and the original time information can be: _year_month_day_hour_minute_second, that is, each unit time in the original time information does not have a value.

[0172] Step S104: generating target time information matching the target text according to the reference time information and the time configuration mode in the target time mode.

[0173] Specifically, detect whether the time text pattern in the target time pattern contains the numeric wildcard "\d+". If the time text pattern does not contain the numeric wildcard "\d+", each original parameter can be directly used as the target parameter, and the conditional attribute of each original parameter is also determined as the conditional attribute of the corresponding target parameter. The time type of the original parameter (auxiliary parameter) corresponding to the time unit attribute is determined as the time type of the corresponding target parameter. The target parameter and the original parameter are one-to-one corresponding.

[0174] If the time text pattern contains a numeric wildcard "\d+", the numeric information corresponding to the numeric wildcard is extracted from the target sub-text, and the original parameters corresponding to the numeric wildcard are extracted from multiple original parameters, and the extracted original parameters are replaced with the numeric information extracted from the target sub-text, and the replaced new original parameters and the unupdated original parameters are respectively determined as target parameters, and the aforementioned consistent target parameters and original parameters are still one-to-one corresponding.

[0175] For example, the target subtext is: May 13, 2020, and the corresponding time text pattern is: (\d+)year(\d+)month(\d+)(day|number), and the multiple original parameters are: x1, x2, x3, e0, e0, e0, where the original parameters x1, x2, and x3 represent the first, second, and third values ​​extracted from the target subtext. Since the time text pattern contains numeric wildcards, the terminal extracts the numeric information corresponding to the numeric wildcards in the target subtext: 2020, 5, 13; extracts the original parameters corresponding to the numeric wildcards: x1, x2, x3, and replaces the original parameters with the numeric information. The replaced original parameters and the unupdated original parameters are determined as target parameters, that is, the multiple target parameters are: 2020, 5, 13, e0, e0, e0.

[0176] After determining a plurality of target parameters, the reference time information is adjusted according to the plurality of target parameters to obtain the target time information, wherein the reference time information is composed of unit reference time information corresponding to a plurality of time units.

[0177] For example, the benchmark time information is 12:0:00 on January 1, 2020. The benchmark time information is composed of the unit benchmark time information corresponding to the year time unit: 2020; the unit benchmark time information corresponding to the month time unit: January; the unit benchmark time information corresponding to the day time unit: the 1st; the unit benchmark time information corresponding to the hour time unit: 12 o'clock; the unit benchmark time information corresponding to the minute time unit: 0 minutes; and the unit benchmark time information corresponding to the second time unit: 0 seconds.

[0178] Among the multiple target parameters, the target parameter belonging to the time unit attribute is used as the first parameter. According to the time type and time unit of the first parameter, the multiple unit base time information are offset respectively, and according to the time unit sequence (that is, the order of the time unit from large to small), the multiple unit base time information after the offset processing are combined into the start time information. It can be known that the number of time units corresponding to the first parameter and the number of unit base time information can be the same.

[0179] For example, the time units corresponding to the first parameter are: year, month, day, hour, minute, and second; the time units corresponding to the multiple unit reference time information are also: year, month, day, hour, minute, and second.

[0180] Among the multiple target parameters, the target parameter whose condition attribute is the time range attribute is extracted as the second parameter. The end time information is generated according to the second parameter and the start time information.

[0181] The terminal combines the start time information and the end time information to obtain the combined time information. If there is only one combined time information (that is, there is only one target subtext, target time mode, etc.), the terminal can directly determine the combined time information as the target time information (as described above). Figure 2a The corresponding embodiment of the target time information 20g); if the number of combined time information is more than one, the terminal also needs to merge multiple combined time information according to the connection character, or the time type of the target parameter of multiple combined time information, and generate the target time information according to the merged time information.

[0182] Please also see Figure 4 , is a component architecture diagram of time recognition provided by an embodiment of the present invention. Figure 4 As shown, the numerical converter is used to convert the Chinese numerical value in the target text into the Arabic numerical value. The pattern manager is used to extract the Item that matches the target text from multiple Items (time patterns), and generate the combined time information according to the time text pattern and time configuration pattern in the extracted Item, wherein the pattern manager sets multiple Items in advance, and each Item corresponds to a time text pattern and a time configuration pattern. There is also a festival formatting link for the festival Item, and the date and processing method of the corresponding festival can be reversed through the festival formatting link and the calendar file. For the combined time information that needs to be converted between the Gregorian and lunar calendars and the combined time information with festival formatting links, the calendar manager updates the combined time information according to the calendar file, and the calendar file is a file in the text format of <Lunar calendar date, Gregorian calendar date, solar term, festival>. The time merger stores multiple connection characters in advance, which are used to merge multiple updated combined times to obtain the target time information, and the time extractor is used to maintain the target time information extracted from the target text.

[0183] See also Figure 5 , is a schematic diagram of a process for determining target time information provided by an embodiment of the present invention. Figure 5 As shown, the specific process of determining the target time information includes the following steps S201-step S204, and steps S201-step S204 are Figure 3 A specific embodiment of step S104 in the corresponding embodiment:

[0184] Step S201, generating multiple target parameters according to the target text and the multiple original parameters.

[0185] Specifically, multiple target parameters are determined according to whether the time text pattern in the target time pattern contains a numeric wildcard and the original parameter. The specific process of determining multiple target parameters can be described in the above-mentioned Figure 3 This corresponds to step S104 in the embodiment.

[0186] Step S202: Among multiple target parameters, a target parameter belonging to a time unit attribute is taken as a first parameter; and multiple unit reference time information are offset according to the time unit corresponding to the first parameter to obtain start time information; the reference time information includes unit reference time information corresponding to multiple time units respectively.

[0187] Specifically, among the multiple target parameters, the target parameter belonging to the time unit attribute is used as the first parameter. The first parameter includes multiple first sub-parameters, each of which corresponds to a time unit. The terminal extracts any unit reference time information from the multiple unit reference time information as the target unit reference time information. The terminal extracts the first sub-parameter having the same time unit as the target unit reference time information from the multiple first sub-parameters as the target first sub-parameter.

[0188] If the time type of the target first sub-parameter is a relative time type, the terminal can perform addition or subtraction operations on the target unit reference time information according to the first sub-parameter to obtain the unit start time information. It can be known that the time unit of the unit start time information is the same as the time unit of the target first sub-parameter and the target unit reference time information. For example, if the target unit reference time information is 2019, the target first sub-parameter corresponding to the target unit reference time information is -3, and the time type of the first sub-parameter is a relative time type, then 3 can be subtracted from 2019 to obtain 2016, so the unit start time information is: 2016.

[0189] If the time type of the target first sub-parameter is any precise time type in the precise time type, the terminal obtains the value corresponding to the any precise time type, sets the value of the target unit time information to the value corresponding to the any precise time type (the value is set in advance, as long as the value corresponding to the first sub-parameter belonging to any precise time type is the same), and obtains the unit start time information, and the time unit of the unit start time information is the same as the time unit of the target first sub-parameter and the target unit reference time information. Among them, when the operation definition of the parameter value of the first sub-parameter is to set the value of the unit reference time information to an arbitrary value, the time type of the first sub-parameter belongs to any precise time type in the precise time type (such as the original parameter "*" in Table 1).

[0190] For example, the target unit benchmark time information is 2019, and the target first sub-parameter corresponding to the target unit benchmark time information is: *, and the time type of the first sub-parameter is any precise time type. The terminal obtains the value 1 corresponding to the above target first sub-parameter "*", so the terminal sets the value 2019 in the target unit benchmark time information to 1, that is, the unit start time information is: 1 year.

[0191] If the time type of the target first sub-parameter is an absolutely precise time type among the precise time types, the terminal determines the value corresponding to the absolutely precise time type, sets the value of the target unit time information to the value corresponding to the absolutely precise time type (the value is determined by the first sub-parameter, for example, the first sub-parameter e1 belonging to the absolutely precise time type has a corresponding value of 1; the first sub-parameter e10 belonging to the absolutely precise time type has a corresponding value of 10), and obtains the unit start time information, and the time unit of the unit start time information is the same as the time unit of the target first sub-parameter and the target unit reference time information. Among them, when the operation definition of the parameter value of the first sub-parameter is to set the value of the unit reference time information to a fixed value corresponding to the first sub-parameter, the time type of the first sub-parameter belongs to the absolutely precise time type among the precise time types (such as the original parameter e0 in Table 1, etc.).

[0192] For example, the target unit benchmark time information is 2019, the target first sub-parameter corresponding to the target unit benchmark time information is e5, and the time type of the first sub-parameter is an absolutely precise time type. The terminal determines that the value corresponding to the above target first sub-parameter "e5" is 5, so the terminal sets the value 2019 in the target unit benchmark time information to 5, that is, the unit start time information is: 5 years.

[0193] In the above manner, each unit base time information may be offset respectively to obtain multiple unit start time information, and the multiple unit start time information may be combined into start time information in the order of time units, that is, in the order from large to small.

[0194] Step S203: extracting a target parameter belonging to a time range attribute from the plurality of target parameters as a second parameter, and generating end time information according to the second parameter and the start time information.

[0195] Specifically, among multiple target parameters, a target parameter belonging to a time range attribute is extracted as a second parameter, and the second parameter may include: 1 year, 1 month, 1 day, etc. The end time information is generated according to the duration corresponding to the second parameter and the start time information, wherein the duration between the start time information and the end time information is equal to the duration indicated by the second parameter. For example, if the start time information is: 12:0:00 on January 1, 2020, and the second parameter is 1 day, then the end time information is: 12:0:00 on January 2, 2020. In this way, based on the second parameter (that is, the duration), the terminal can represent the precise time information as a time range accurate to seconds.

[0196] Step S204: Combine the start time information and the end time information to obtain combined time information.

[0197] Specifically, the start time information and the end time information are combined into the first time information. The first time information is described below. Among multiple target parameters, the target parameter whose conditional attribute is the time conversion attribute is extracted as the third parameter, and the conversion type corresponding to the third parameter is determined. The third parameter is used to identify whether it is necessary to convert the first time information from the lunar calendar to the Gregorian calendar. The conversion type includes a first conversion type and a second conversion type. For example, if the third parameter is 1 (that is, the first time information does not need to be converted from the lunar calendar to the Gregorian calendar), it indicates that the corresponding conversion type is the first conversion type; if the third parameter is 0 (that is, the first time information needs to be converted from the lunar calendar to the Gregorian calendar), it indicates that the corresponding conversion type is the second conversion type.

[0198] When the conversion type is the first conversion type, the terminal can directly use the first time information as the combined time information; when the conversion type is the second conversion type, the terminal searches the calendar file for time information with the same date as the first time information as the combined time information. The calendar file includes multiple time records, each of which includes: lunar calendar date, Gregorian calendar date, solar term and festival. Since the first time information contains two time information, when converting the first time information, the terminal needs to convert the two times in the first time information from the lunar calendar date to the Gregorian calendar date respectively, and the converted time information is called the combined time information. It should also be noted that since the minimum time unit involved in the conversion from the lunar calendar to the Gregorian calendar is day, if the first time information contains time units smaller than day, such as hours, minutes, seconds, etc., the time information smaller than the time unit of day in the above-mentioned first time information can remain unchanged.

[0199] For example, the first time information is: (2020 / 1 / 1 / 12:0:0, 2020 / 1 / 2 / 12:0:0), and the third parameter belongs to the second conversion type. The Gregorian date corresponding to the lunar date "2020 / 1 / 1" in the calendar file is: 2020 / 2 / 9; the Gregorian date corresponding to the lunar date "2020 / 1 / 2" in the calendar file is: 2020 / 2 / 10, so the converted combined time information is: (2020 / 2 / 9 / 12:0:0, 2020 / 2 / 10 / 12:0:0).

[0200] Optionally, the above is to convert the start time information and the end time information into the Gregorian and lunar calendars, and the following describes the festival formatting of the start time information and the end time information. The start time information and the end time information are combined into the second time information, and the following describes a second time information. Among multiple target parameters, the target parameter whose conditional attribute is the festival formatting attribute is extracted as the fourth parameter, and the festival formatting type corresponding to the fourth parameter is determined. The fourth parameter is used to identify whether the second time information needs to be formatted for the festival.

[0201] The holiday formatting type includes a first formatting type and a second formatting type. For example, if the fourth parameter is 1 (i.e., the second time information does not need to be formatted for a holiday), it indicates that the corresponding holiday formatting type is the first formatting type; if the fourth parameter is 0 (i.e., the second time information needs to be formatted for a holiday), it indicates that the corresponding holiday formatting type is the second formatting type. When the holiday formatting type belongs to the first formatting type, the terminal can directly use the second time information as the combined time information; when the holiday formatting type belongs to the second formatting type, the terminal searches for the time information corresponding to the time text pattern of the second time information in the calendar file, and updates the second time information based on the found time information, and determines the updated second time information as the combined time information. It should be noted that since the second time information contains two time information, the time information corresponding to the time text pattern found in the calendar file is also a time range containing two time information.

[0202] For example, the time text pattern is: National Day, and the second time information corresponding to the time text pattern is: (2019 / 10 / 1 / 0:0:0, 2019 / 10 / 2 / 0:0:0). If the date corresponding to the time text pattern "National Day" is found in the calendar file, it is October 1st to October 7th. Therefore, the time information of the above dates can be expressed as: (10 / 1 / 0:0:0, 10 / 8 / 0:0:0). Therefore, the combined time information obtained after updating the second time information is: (2019 / 10 / 1 / 0:0:0, 2019 / 10 / 8 / 0:0:0).

[0203] For example, the time text pattern is: Father's Day. Since Father's Day is the third Sunday of June every year, the exact date of Father's Day cannot be determined by only using the target parameters. If the first parameter in the target parameter corresponding to "Father's Day" is: *, *, e0, e0, e0 (corresponding to year, month, day, hour, minute, second in sequence), and the time range is 1 day, the second time information is: (1 / 1 / 1 / 0:0:0, 1 / 1 / 2 / 0:0:0). In the calendar file, searching for the time information of the time text pattern "Father's Day" is to search for the time information of all Father's Days in the calendar file. If the calendar file records 100 years of calendars, then 100 Father's Days can be found. If the combined time information of another target subtext adjacent to the target subtext "Father's Day" in the target text is: (2020 / 1 / 1 / 1:1:1, 2021 / 1 / 1 / 1:1:1), the first parameter in the target parameter corresponding to the second time information is: 1, *, *, *, * (corresponding to year, month, day, hour, minute, second, respectively), and the priority of any precise time type (that is, "*") < the priority of the relative time type (that is, "1"), so Father's Day between 2020 and 2021 can be selected from the time information corresponding to multiple "Father's Days", that is, the time information of "Father's Day" from 2020 to 2021 is: (6 / 21 / 0:0:0, 6 / 22 / 0:0:0). Based on the selected time information, the second time information corresponding to "Father's Day" is updated, and the updated second time information (combined time information) is: (1 / 6 / 21 / 0:0:0, 1 / 6 / 22 / 0:0:0).

[0204] In the above example, if the combined time information of the adjacent target sub-text (time text mode) cannot determine which time information to select from the multiple time information of "Father's Day" to use to update the second time information of "Father's Day", then the terminal can make a selection based on the system time. If the system time is 2019, then the time information of Father's Day in 2019 is selected to update the second time information to obtain the combined time information.

[0205] It should be noted that, in addition to obtaining the combined time information in the above manner, the terminal can also combine the start time information and the end time information into the first time information, and after converting the lunar calendar to the Gregorian calendar, further perform festival formatting on the converted time information to obtain the combined time information; or combine the start time information and the end time information into the second time information, and after performing festival formatting, further perform the lunar calendar to the Gregorian calendar conversion on the formatted time information to obtain the combined time information. In other words, the Gregorian and lunar calendar conversion and the festival formatting can be performed separately to obtain the combined time information respectively, or they can be performed successively to obtain the combined time information.

[0206] Step S205: generating the target time information according to the combined time information.

[0207] Specifically, if the number of combined time information is only one, the terminal may directly determine the combined time information as the target time information.

[0208] If there are more than one combined time information, each combined time information must correspond to a target subtext, a target time mode and multiple target parameters. The terminal also needs to merge multiple combined time information according to the above information and determine the target time information according to the merged time information.

[0209] The terminal determines the combined time information corresponding to the adjacent target subtexts in the target text as the first combined time information and the second combined time information. The following is explained with a pair of the first combined time information and the second combined time information. Similarly, each combined time information includes unit times corresponding to multiple time units.

[0210] Among the multiple target parameters corresponding to the first combined time information, determine the time type of the target parameter belonging to the time unit attribute (that is, the first parameter mentioned above). Since each time unit must correspond to a target parameter, it is necessary to determine the time types of the target parameters corresponding to the multiple time units respectively. Similarly, among the multiple target parameters corresponding to the second combined time information, determine the time type of the target parameter belonging to the time unit attribute (that is, the first parameter mentioned above).

[0211] The time type of each target parameter is determined by the operation definition corresponding to the parameter value of the target parameter; it can be seen that the time type includes relative time type and precise time type, and the precise time type includes: absolutely precise time type, arbitrary precise time type, and variable precise time type; further, the relative time type includes fixed relative time type and variable relative time type.

[0212] The operation definition of the target parameter belonging to the fixed relative time type is that the addition and subtraction operations are performed on the basis of the reference time, and the values ​​of the addition and subtraction budget are determined by the original parameters (such as the original parameters 1, -1, etc. in Table 1); the operation definition of the target parameter belonging to the variable relative time type is that the addition and subtraction operations are performed on the basis of the reference time, and the values ​​of the addition and subtraction budget are determined from the target subtext (such as the parameters d-1, d1, etc. in Table 1). The operation definition of the target parameter belonging to the variable precise time type is that the value in the reference time information is set to the value extracted from the target subtext (such as the parameters x1, x2, etc. in Table 1).

[0213] Among them, the priority of variable relative time type = priority of variable precise time type > fixed relative time type > priority of absolute precise time type > priority of arbitrary precise time type.

[0214] The terminal can determine the priorities of each unit time in the first combined time information and the priorities of each unit time in the second combined time information according to the priorities of the time types of the target parameters corresponding to the unit time. It can be understood that since the end time information in the first combined time information and the second combined time information is determined by the start time information and the time range parameter, the priority of each unit time in the end time information is the same as the priority of each unit time in the corresponding start time information.

[0215] First, the start time information in the first combined time information and the second combined time information is merged. The specific process is: detect two unit times with the same time unit (one unit time belongs to the start time information in the first combined time information, and one unit time belongs to the start time information in the second combined time information). If the time types of the above two unit times have different priorities; or, if the time types of the above two unit times are all arbitrary precise time types; or, if the time types of the above two unit times are all absolutely precise time types, and the values ​​of the above two unit time information are the same, it means that the above two unit times meet the merging conditions. Only when all unit times meet the merging conditions can the two start time information be merged. When merging, extract the unit time with a larger priority from the two unit times as the auxiliary unit time. In this way, multiple auxiliary unit times can be obtained, and the multiple auxiliary unit times are combined into the merged start time information in the order of time units.

[0216] Similar to merging the start time information, it is also possible to extract a unit time with a greater priority according to the priority of each time unit in the end time information, and combine multiple unit times with a greater priority into auxiliary end time information.

[0217] From the time range corresponding to the first combined time information and the time range corresponding to the second combined time information, determine the minimum time range as the target time range. It can be known that the time range corresponding to the first combined time information here is the target parameter belonging to the time range attribute among the multiple target parameters corresponding to the first combined time information (that is, the second parameter mentioned above); similarly, the time range corresponding to the second combined time information is the target parameter belonging to the time range attribute among the multiple target parameters corresponding to the second combined time information.

[0218] If the time range between the above-mentioned merged start time information and the auxiliary end time information is less than or equal to the target time range, the terminal can directly determine the above-mentioned auxiliary end time information as the merged end time information; if the time range between the above-mentioned merged start time information and the auxiliary end time information is greater than the target time range, the auxiliary end time information is adjusted to obtain the merged end time information, so that the time range between the merged start time information and the merged end time information (adjusted auxiliary end time information) is equal to the target time range.

[0219] The terminal combines the merge start time information and the merge end time information into the first statistical time information. If there is still unmerged combined time information, it can be merged again based on the first statistical time information and the unmerged combined time information to obtain new first statistical time information. The terminal uses the first statistical time information obtained by the last merge as the target time information; or the terminal determines the first statistical time information obtained by the last merge and the combined time information that was not successfully merged as the target time information.

[0220] For example, the target text is: National Day next year, and the target subtext 1 is: next year; the target parameters belonging to the time unit attribute are: 1, *, *, * (corresponding to year, month, day, hour, minute, second respectively), the time range is 1 year, and the combined time information (also called the first combined time information) is: (2020 / 1 / 1 / 1:1:1, 2021 / 1 / 1 / 1:1:1). The target subtext 2 is: National Day; the target parameters belonging to the time unit attribute are: *, 10, 1, e0, e0, e0 (corresponding to year, month, day, hour, minute, second respectively), the time range is 1 day, and the combined time information (also called the second combined time information) is: (1 / 10 / 1 / 0:0:0, 1 / 10 / 2 / 0:0:0). For the start time information in the two combined time information, each unit time meets the merging condition, so the combined start time information can be obtained: 2020 / 10 / 1 / 0:0:0, and the auxiliary end time information can be obtained: 2021 / 10 / 2 / 0:0:0. Since the time range (1 year) of the first combined time information is smaller than the time range (1 day) of the second combined time information, the target time range is 1 day. The time range between the combined start time information "2020 / 10 / 1 / 0:0:0" and the auxiliary end time information "2021 / 10 / 2 / 0:0:0" is 1 year, so the auxiliary end time information needs to be adjusted so that the time range between the adjusted time information and the combined start time information is 1 day, that is, the adjusted auxiliary end time information is: 2020 / 10 / 2 / 0:0:0, that is, the combined end time information is: 2020 / 10 / 2 / 0:0:0. The first statistical time information is: (2020 / 10 / 1 / 0:0:0, 2020 / 10 / 2 / 0:0:0), and the first statistical time information is also the target time information.

[0221] Optionally, the above is merged according to the priority of the time type, and multiple combined time information can also be merged according to the connecting character. If the number of combined time information is more than one, and there is a connecting character in the target text, the connecting character is extracted. The connecting character can be: "to", "to", "--", etc. The two combined time information corresponding to the target sub-text adjacent to the connecting character in the target text are merged into one time information, which is called the second statistical time information. The terminal uses the merged second statistical time information as the target time information; or the terminal determines the merged second statistical time information and the combined time information that cannot be merged (that is, the target sub-text corresponding to the combined time information is not adjacent to the connecting character) as the target time information.

[0222] For example, the target text is: October 1, 2019 to October 7, 2019. Two combined time information can be identified, namely: (2019 / 10 / 1 / 0:0:0, 2020 / 10 / 2 / 0:0:0) and (2020 / 10 / 7 / 0:0:0, 2020 / 10 / 8 / 0:0:0). The above two combined time information can be merged into the second statistical time information: (2019 / 10 / 1 / 0:0:0, 2020 / 10 / 8 / 0:0:0), and the second statistical time information is also the target time information.

[0223] It should be noted that, in addition to the above-mentioned method of obtaining the target time information, the terminal can also merge multiple combined time information according to the priority, and then further merge them again according to the connecting character to obtain the target time information; or merge multiple combined time information according to the connecting character, and then merge them again according to the priority to obtain the target time information. In other words, merging according to the priority and merging according to the connecting character can be performed separately to obtain the target time information respectively, or they can be performed successively to obtain the target time information.

[0224] Optionally, semantically identify the target text to obtain semantic information, referred to as target semantic information. The terminal obtains a service interface corresponding to the target semantic information (referred to as a target service interface), and uses the target time information identified in the foregoing as an interface parameter of the target service interface. The interface parameter is passed to the target service interface, and the target service interface is called so that the interface provides an application service corresponding to the target service interface.

[0225] See also Figure 6 , is a flow chart of another time identification method provided by an embodiment of the present invention. The time identification method comprises the following steps:

[0226] Step S301, obtaining target text.

[0227] Step S302: convert the Chinese numerical information in the target text into ASCII numerical information.

[0228] Specifically, a target text to be recognized is obtained, and Chinese numerical information in the target text is converted into ASCII numerical information, that is, converted into Arabic numerical information.

[0229] Step S303: the pattern manager extracts time information from the target text as combined time information.

[0230] Specifically, the pattern manager extracts Chinese time information in the target text as combined time information. Step S303 includes steps S3031 to S3039.

[0231] Step S3031, traverse all Items.

[0232] Step S3032: whether there is an Item that matches the target text.

[0233] Specifically, the pattern manager traverses all items to find an item that matches the target text. If there is an item that matches the target text, the following step S3033 is executed; if not, step S3039 is executed. The process of the pattern manager traversing all items to find an item that matches the target text can be referred to above. Figure 3 This corresponds to step S102 in the embodiment.

[0234] Step S3033, determining the start time information according to the reference time information and the time configuration mode corresponding to the found Item.

[0235] Step S3034, generating an end time according to the parameters corresponding to the time range attribute and the start time information.

[0236] Specifically, according to the found Item, determine the multiple original parameters contained in the time configuration mode corresponding to the Item, and determine the base time based on the multiple original parameters. Determine multiple target parameters based on the multiple original parameters and the target text. Determine the start time based on the multiple target parameters and the base time. Extract the target parameter belonging to the time range attribute, and determine the end time based on the target parameter and the start time. The specific process of determining the base time, start time, and end time can be found in the above Figure 3 Corresponding to step S103-step S104 in the embodiment.

[0237] Step S3035: whether the Gregorian calendar to lunar calendar conversion is required.

[0238] Step S3036, convert the start time and end time respectively.

[0239] Specifically, according to the matching Item found, determine whether the start time and end time need to be converted to the Gregorian and lunar calendars. If not, execute step S3037; if necessary, convert the start time and end time according to the calendar file. The specific process of conversion can be found in the above Figure 5 This corresponds to step S204 in the embodiment.

[0240] Step S3037: whether holiday formatting is required.

[0241] Step S3038, formatting the converted start time and end time according to festival conditions.

[0242] Specifically, according to the matching Item found, determine whether the converted start time and end time need holiday formatting processing. If not, execute step S3039; if necessary, perform holiday formatting processing on the calendar file for the converted start time and end time. The specific process of holiday formatting processing can be found in the above Figure 5 This corresponds to step S204 in the embodiment.

[0243] Step S3039, record the target subtext in the target text and return the result.

[0244] Specifically, the successfully matched character sequence in the target text and the position of the character sequence in the target text are recorded, and the recognized time information and position are returned.

[0245] Step S304, detecting whether the time information is extracted successfully.

[0246] Specifically, it is detected whether the extraction of time information is successful. If unsuccessful, step S307 is executed; if successful, step S305 is executed.

[0247] Step S305, detecting whether there is any unmerged time.

[0248] Step S306, combining the identified multiple times.

[0249] Specifically, it is detected whether there is any time that has not been merged. If so, it is attempted to merge multiple times. If not, step S303 is executed, and the pattern manager traverses all items again, searches for items that match the target text, and extracts the next Chinese time information in the target text again. The specific process of merging multiple times can be found in the above Figure 5 This corresponds to step S205 in the embodiment.

[0250] Step S307, return the result.

[0251] The time information recognized from the target text is stored and sent to the application system.

[0252] As can be seen from the above, the reference time is determined by the time configuration mode, and adjustments are made based on the reference time. Therefore, no matter whether the Chinese time information in the text is relative time or absolute time, after adjusting the reference time, the precise time expressed in the text can be obtained, which can improve the accuracy of recognizing Chinese time information in the text.

[0253] For further information, see Figure 7 , is a schematic diagram of the structure of a time recognition device provided by an embodiment of the present invention. Figure 7As shown, the time recognition device 1 can be applied to the above Figure 3-Figure 6 Corresponding to the terminal in the embodiment, the time identification device 1 may include: an acquisition module 11 , a matching module 12 , a determination module 13 , and a generation module 14 .

[0254] The acquisition module 11 is used to acquire the target text and acquire at least one time mode; each time mode includes: a time text mode and a time configuration mode;

[0255] A matching module 12, configured to select a temporal text pattern that matches at least one target subtext in the target text;

[0256] The acquisition module 11 is further used to determine the time pattern to which the matched time text pattern belongs as the target time pattern;

[0257] A determination module 13, configured to determine reference time information according to a time configuration mode in the target time mode;

[0258] The generating module 14 is used to generate target time information matching the target text according to the reference time information and the time configuration mode in the target time mode.

[0259] The specific functional implementation of the acquisition module 11, the matching module 12, the determination module 13, and the generation module 14 can be found in the above Figure 3 Steps S101 to S104 in the corresponding embodiment will not be described in detail here.

[0260] See also Figure 7 The matching module 12 may include: a conversion unit 121 and a search unit 122 .

[0261] A conversion unit 121 is used to convert a first character sequence of a first numerical type in the target text into a second character sequence of a second numerical type to obtain a text to be matched; the numerical information corresponding to the first character sequence is the same as the numerical information corresponding to the second character sequence;

[0262] The search unit 122 is used to search for at least one character sequence matching the time text pattern in the text to be matched, use the found character sequence as the target sub-text, and use the found time text pattern as the time text pattern matching the target sub-text.

[0263] The specific functional implementation of the conversion unit 121 and the search unit 122 can be found in the above Figure 3 The step S102 in the corresponding embodiment will not be described in detail here.

[0264] See also Figure 7The determination module 13 may include: an extraction unit 131 and an acquisition unit 132 .

[0265] An extraction unit 131, configured to extract a plurality of original parameters included in the time configuration mode in the target time mode;

[0266] The extraction unit 131 is further used to use the original parameter belonging to the time unit attribute as an auxiliary parameter among the multiple original parameters;

[0267] an acquiring unit 132, configured to acquire system time information if the time type of the auxiliary parameter includes a relative time type, and determine the system time information as the reference time information;

[0268] The acquisition unit 132 is further configured to determine original time information with a null value as the reference time information if the time types of the auxiliary parameters are all precise time types.

[0269] The specific functional implementation of the extraction unit 131 and the acquisition unit 132 can be found in the above Figure 3 The step S103 in the corresponding embodiment will not be described in detail here.

[0270] See also Figure 7 The generation module 14 may include: a first generation unit 141 and a second generation unit 142.

[0271] A first generating unit 141, configured to generate a plurality of target parameters according to the target text and the plurality of original parameters;

[0272] The second generating unit 142 is configured to perform an offset process on the reference time information according to the multiple target parameters to obtain target time information.

[0273] The specific functional implementation of the first generation unit 141 and the second generation unit 142 can be found in the above Figure 3 The step S104 in the corresponding embodiment will not be described in detail here.

[0274] See also Figure 7 The first generating unit 141 may include: an extracting subunit 1411 and a replacing subunit 1412 .

[0275] The extraction subunit 1411 is configured to determine the multiple original parameters as the multiple target parameters if the time text pattern in the target time pattern does not contain a numeric wildcard;

[0276] The replacement sub-unit 1412 is used to obtain the numerical information corresponding to the numerical wildcard in the target sub-text in the target text if the time text pattern in the target time pattern contains the numerical wildcard, and extract the original parameters corresponding to the numerical wildcard from the multiple original parameters, replace the extracted original parameters with the numerical information obtained in the target sub-text, and generate the multiple target parameters based on the replaced multiple original parameters.

[0277] The specific functional implementation of the extraction subunit 1411 and the replacement subunit 1412 can be found in the above Figure 3 The step S104 in the corresponding embodiment will not be described in detail here.

[0278] See also Figure 7 The second generating unit 142 may include: a first determining subunit 1421 , a second determining subunit 1422 , a combining subunit 1423 , and a first generating subunit 1424 .

[0279] The first determining subunit 1421 uses a target parameter belonging to a time unit attribute as a first parameter among multiple target parameters;

[0280] The second determining subunit 1422 is used to perform offset processing on multiple unit reference time information respectively according to the time unit corresponding to the first parameter to obtain start time information; the reference time information includes unit reference time information corresponding to the multiple time units respectively;

[0281] The first determining subunit 1421 is further configured to extract a target parameter belonging to a time range attribute from the plurality of target parameters as a second parameter, and generate end time information according to the second parameter and the start time information;

[0282] A combining subunit 1423, configured to combine the start time information and the end time information to obtain combined time information;

[0283] The first generating subunit 1424 is configured to generate the target time information according to the combined time information.

[0284] The specific functional implementation of the first determining subunit 1421, the second determining subunit 1422, the combining subunit 1423, and the first generating subunit 1424 can be referred to above. Figure 5 Steps S201 to S205 in the corresponding embodiment are not described in detail here.

[0285] See also Figure 7 The second determining subunit 1422 may include: an acquiring subunit 14221 and a second generating subunit 14222.

[0286] The acquisition subunit 14221 is used to extract any unit reference time information from the plurality of unit reference time information as the target unit reference time information;

[0287] The acquisition subunit 14221 is further used to extract, from the first parameter, a first subparameter having the same time unit as the target unit reference time information as a target first subparameter; the first parameter includes a plurality of first subparameters;

[0288] The second generating subunit 14222 is used to generate unit start time information according to the target first subparameter and the target unit reference time information;

[0289] The second generating subunit 14222 is further configured to combine a plurality of unit start time information into the start time information in a time unit sequence when each unit reference time information is determined as the target unit reference time information.

[0290] The specific functional implementation of the acquisition subunit 14221 and the second generation subunit 14222 can be found in the above Figure 5 The step S202 in the corresponding embodiment will not be described in detail here.

[0291] See also Figure 7 The combining subunit 1423 may include: a first combining subunit 14231 and a first converting subunit 14232 .

[0292] A first combining subunit 14231, configured to combine the start time information and the end time information into first time information;

[0293] The first combining subunit 14231 is further configured to extract a target parameter belonging to a time conversion attribute from the plurality of target parameters as a third parameter, and determine a conversion type corresponding to the third parameter;

[0294] A first conversion subunit 14232, configured to determine the first time information as the combined time information if the conversion type belongs to the first conversion type;

[0295] The first conversion subunit 14232 is further configured to search the calendar file for time information having the same date as the first time information as the combined time information if the conversion type belongs to the second conversion type.

[0296] The specific functional implementation of the first combination subunit 14231 and the first conversion subunit 14232 can be found in the above Figure 5 The step S204 in the corresponding embodiment will not be described in detail here.

[0297] See also Figure 7 The combining subunit 1423 may include: a second combining subunit 14233 and a second converting subunit 14234.

[0298] The second combining subunit 14233 is used to combine the start time information and the end time information into second time information;

[0299] The second combining subunit 14233 is further configured to extract a target parameter belonging to a holiday formatting attribute from the multiple target parameters as a fourth parameter, and determine a holiday formatting type corresponding to the fourth parameter;

[0300] A second conversion subunit 14234 is configured to determine the second time information as the combined time information if the festival formatting type belongs to the first formatting type;

[0301] The second conversion sub-unit 14234 is also used to search the calendar file for time information corresponding to the time text pattern in the target time pattern if the holiday formatting type belongs to the second formatting type, update the second time information according to the time information corresponding to the time text pattern in the target time pattern, and determine the updated second time information as the combined time information.

[0302] The specific functional implementation of the second combining subunit 14233 and the second converting subunit 14234 can be found in the above Figure 5 The step S204 in the corresponding embodiment will not be described in detail here.

[0303] It should be understood that the terminal can determine the combined time information through the first combining subunit 14231 and the first conversion subunit 14232; it can also determine the combined time information through the second combining subunit 14233 and the second conversion subunit 14234; it can also determine the combined time information jointly through the first combining subunit 14231, the first conversion subunit 14232 and the second combining subunit 14233 and the second conversion subunit 14234.

[0304] See also Figure 7 The first generating subunit 1424 may include: a third determining subunit 14241 and a first merging subunit 14242 .

[0305] The third determining subunit 14241 is used for, when there are multiple combined time information, using the combined time information corresponding to the target subtexts located adjacently in the target text as the first combined time information and the second combined time information; the combined time information includes unit times corresponding to multiple time units respectively;

[0306] The third determining subunit 14241 is further configured to extract the time type of the target parameter belonging to the time unit attribute from among the multiple target parameters corresponding to the first combined time information, and to extract the time type of the target parameter belonging to the time unit attribute from among the multiple target parameters corresponding to the second combined time information;

[0307] The third determining subunit 14241 is further used to determine the priorities corresponding to the respective unit times in the first combined time information and the priorities corresponding to the respective unit times in the second combined time information according to the extracted time types;

[0308] The third determining subunit 14241 is further configured to select a minimum time range from the time range corresponding to the first combined time information and the time range corresponding to the second combined time information as the target time range;

[0309] A first merging subunit 14242 is configured to merge the first combined time information and the second combined time information into first statistical time information according to the priority and the target time range;

[0310] The third determining subunit 14241 is further configured to determine the target time information according to the first statistical time information.

[0311] The specific functional implementation of the third determining subunit 14241 and the first merging subunit 14242 can be found in the above Figure 5 The step S205 in the corresponding embodiment will not be described in detail here.

[0312] See also Figure 7 , the first generating subunit 1424 may include: a fourth determining subunit 14243 and a second merging subunit 14244.

[0313] The fourth determining subunit 14243 is used to extract the connecting characters in the target text when the number of the combined time information is multiple;

[0314] The second merging subunit 14244 is used to merge the combined time information corresponding to the target subtexts adjacent to the connecting character in the target text into the second statistical time information;

[0315] The fourth determining subunit 14243 is further configured to determine the target time information according to the second statistical time information.

[0316] The specific functional implementation of the fourth determining subunit 14243 and the second merging subunit 14244 can be found in the above Figure 5The step S205 in the corresponding embodiment will not be described in detail here.

[0317] It should be understood that the terminal can determine the target time information through the third determination subunit 14241 and the first merging subunit 14242; it can also determine the target time information through the fourth determination subunit 14243 and the second merging subunit 14244; it can also determine the target time information jointly through the third determination subunit 14241, the first merging subunit 14242 and the fourth determination subunit 14243 and the second merging subunit 14244.

[0318] See also Figure 7 The time recognition device 1 may include: an acquisition module 11, a matching module 12, a determination module 13, and a generation module 14; it may also include: a semantic recognition module 15 and a calling module 16.

[0319] Semantic recognition module 15, used for semantic recognition of the target text to obtain target semantic information;

[0320] The semantic recognition module 15 is further used to obtain a target service interface corresponding to the target semantic information, and use the target time information as an interface parameter of the target service interface;

[0321] The calling module 16 is used to call the application service corresponding to the target service interface based on the target service interface and the interface parameters.

[0322] The specific functional implementation of the semantic recognition module 15 and the calling module 16 can be found in the above Figure 5 The step S205 in the corresponding embodiment will not be described in detail here.

[0323] For further information, see Figure 8 , is a schematic diagram of the structure of an electronic device provided by an embodiment of the present invention. Figure 3-Figure 6 The terminal in the corresponding embodiment may be an electronic device 1000, such as Figure 8As shown, the electronic device 1000 may include: a user interface 1002, a processor 1004, an encoder 1006 and a memory 1008. The signal receiver 1016 is used to receive or send data via a cellular interface 1010, a WIFI interface 1012, ..., or an NFC interface 1014. The encoder 1006 encodes the received data into a data format for computer processing. A computer program is stored in the memory 1008, and the processor 1004 is configured to perform the steps in any of the above method embodiments through the computer program. The memory 1008 may include a volatile memory (e.g., a dynamic random access memory DRAM), and may also include a non-volatile memory (e.g., a one-time programmable read-only memory OTPROM). In some instances, the memory 1008 may further include a memory remotely arranged relative to the processor 1004, and these remote memories may be connected to the electronic device 1000 via a network. The user interface 1002 may include: a keyboard 1018 and a display 1020.

[0324] exist Figure 8 In the electronic device 1000 shown, the processor 1004 may be used to call a computer program stored in the memory 1008 to implement:

[0325] Obtaining a target text and obtaining at least one time mode; each time mode includes: a time text mode and a time configuration mode;

[0326] Selecting a time text pattern that matches at least one target subtext in the target text, and determining the time pattern to which the matched time text pattern belongs as the target time pattern;

[0327] Determining reference time information according to a time configuration mode in the target time mode;

[0328] Target time information matching the target text is generated according to the reference time information and the time configuration mode in the target time mode.

[0329] It should be understood that the electronic device 1000 described in the embodiment of the present invention can execute the above Figures 3 to 6 The description of the time identification method in the corresponding embodiment can also be performed as described above. Figure 7 The description of the time identification device 1 in the corresponding embodiment will not be repeated here. In addition, the description of the beneficial effects of the same method will not be repeated here either.

[0330] In addition, it should be pointed out that: the embodiment of the present invention further provides a computer storage medium, and the computer storage medium stores a computer program executed by the time recognition device 1 mentioned above, and the computer program includes program instructions. When the processor executes the program instructions, it can execute the above-mentioned Figures 3 to 6 The description of the time identification method in the corresponding embodiment will not be repeated here. In addition, the description of the beneficial effects of the same method will not be repeated. For technical details not disclosed in the computer storage medium embodiment involved in the present invention, please refer to the description of the method embodiment of the present invention.

[0331] A person skilled in the art can understand that all or part of the processes in the above-mentioned embodiments can be implemented by instructing the relevant hardware through a computer program, and the program can be stored in a computer-readable storage medium, and when the program is executed, it can include the processes of the embodiments of the above-mentioned methods. The storage medium can be a disk, an optical disk, a read-only memory (ROM) or a random access memory (RAM), etc.

[0332] The above disclosure is only the preferred embodiment of the present invention, which certainly cannot be used to limit the scope of the present invention. Therefore, equivalent changes made according to the claims of the present invention are still within the scope of the present invention.

Claims

1. A time recognition method, characterized in that: include: Obtain a target text and at least one time pattern; each time pattern includes: a time text pattern and a time configuration pattern; the time text pattern is a pattern string about time, used to detect and extract subtexts in the text that match the time text pattern; the time configuration pattern includes a plurality of parameters with different conditional attributes, the conditional attributes include a time unit attribute, a time range attribute, a time conversion attribute and a holiday formatting attribute; the time text pattern corresponds to the time configuration pattern; Selecting a time text pattern that matches at least one target subtext in the target text, and determining the time pattern to which the matched time text pattern belongs as the target time pattern; Determining the reference time information according to the time configuration mode in the target time mode; comprising: extracting a plurality of original parameters contained in the time configuration mode in the target time mode; using the original parameters belonging to the time unit attribute among the plurality of original parameters as auxiliary parameters; if the time type of the auxiliary parameters includes a relative time type, obtaining system time information, and determining the system time information as the reference time information; if the time type of the auxiliary parameters is an accurate time type, determining the original time information with a null value as the reference time information; Generating target time information matching the target text according to the reference time information and the time configuration mode in the target time mode, including: generating multiple target parameters according to the target text and the multiple original parameters; performing offset processing on the reference time information according to the multiple target parameters to obtain the target time information; The generating of multiple target parameters according to the target text and the multiple original parameters includes: if the time text pattern in the target time pattern does not contain a numerical wildcard, determining the multiple original parameters as the multiple target parameters; if the time text pattern in the target time pattern contains the numerical wildcard, acquiring numerical information corresponding to the numerical wildcard in a target subtext in the target text, extracting the original parameters corresponding to the numerical wildcard from the multiple original parameters, replacing the extracted original parameters with the numerical information acquired in the target subtext, and generating the multiple target parameters according to the replaced multiple original parameters; The method of offsetting the reference time information according to the multiple target parameters to obtain the target time information includes: among the multiple target parameters, taking the target parameter belonging to the time unit attribute as the first parameter; according to the time unit corresponding to the first parameter, offsetting the multiple unit reference time information respectively to obtain the start time information; the reference time information includes the unit reference time information corresponding to the multiple time units respectively; among the multiple target parameters, extracting the target parameter belonging to the time range attribute as the second parameter, generating the end time information according to the second parameter and the start time information; combining the start time information and the end time information to obtain the combined time information, and generating the target time information according to the combined time information.

2. The method according to claim 1, characterized in that The selecting a temporal text pattern matching at least one target subtext in the target text comprises: Converting a first character sequence of a first numerical type in the target text into a second character sequence of a second numerical type to obtain a text to be matched; the numerical information corresponding to the first character sequence is the same as the numerical information corresponding to the second character sequence; At least one character sequence matching the time text pattern is searched in the text to be matched, the found character sequence is used as the target sub-text, and the found time text pattern is used as the time text pattern matching the target sub-text.

3. The method according to claim 1, characterized in that The step of performing offset processing on the plurality of unit reference time information respectively according to the time unit corresponding to the first parameter to obtain the start time information includes: Extract any unit reference time information from the plurality of unit reference time information as target unit reference time information; Extracting, from the first parameter, a first sub-parameter having the same time unit as the target unit reference time information as a target first sub-parameter; the first parameter includes a plurality of first sub-parameters; generating unit start time information according to the target first sub-parameter and the target unit reference time information; When each unit reference time information is determined as the target unit reference time information, a plurality of unit start time information are combined into the start time information in a time unit sequence.

4. The method according to claim 1, characterized in that: The combining and processing the start time information and the end time information to obtain the combined time information includes: Combining the start time information and the end time information into first time information; Extracting a target parameter belonging to a time conversion attribute from among the multiple target parameters as a third parameter, and determining a conversion type corresponding to the third parameter; If the conversion type belongs to the first conversion type, determining the first time information as the combined time information; If the conversion type belongs to the second conversion type, time information having the same date as the first time information is searched in the calendar file as the combined time information.

5. The method according to claim 1, characterized in that The combining and processing the start time information and the end time information to obtain the combined time information includes: Combining the start time information and the end time information into second time information; Extracting a target parameter belonging to a holiday formatting attribute from among the multiple target parameters as a fourth parameter, and determining a holiday formatting type corresponding to the fourth parameter; If the festival formatting type belongs to the first formatting type, determining the second time information as the combined time information; If the holiday formatting type belongs to the second formatting type, the time information corresponding to the time text pattern in the target time pattern is searched in the calendar file, the second time information is updated according to the time information corresponding to the time text pattern in the target time pattern, and the updated second time information is determined as the combined time information.

6. The method according to claim 1, characterized in that The generating the target time information according to the combined time information comprises: When there are multiple combined time information, the combined time information corresponding to the target subtexts located adjacently in the target text is used as the first combined time information and the second combined time information; the combined time information includes unit times corresponding to multiple time units respectively; Extracting the time type of the target parameter belonging to the time unit attribute from among the multiple target parameters corresponding to the first combined time information, and extracting the time type of the target parameter belonging to the time unit attribute from among the multiple target parameters corresponding to the second combined time information; Determine, according to the extracted time type, the priorities corresponding to the respective unit times in the first combined time information and the priorities corresponding to the respective unit times in the second combined time information; Selecting a minimum time range from the time range corresponding to the first combined time information and the time range corresponding to the second combined time information as the target time range; According to the priority and the target time range, combining the first combined time information and the second combined time information into first statistical time information; The target time information is determined according to the first statistical time information.

7. The method according to claim 1, characterized in that The generating the target time information according to the combined time information comprises: When the number of the combined time information is multiple, extracting the connecting characters in the target text; Merging the combined time information corresponding to the target subtexts adjacent to the connecting character in the target text into the second statistical time information; The target time information is determined according to the second statistical time information.

8. The method according to claim 1, characterized in that Also includes: Semantically identifying the target text to obtain target semantic information; Acquire a target service interface corresponding to the target semantic information, and use the target time information as an interface parameter of the target service interface; Based on the target service interface and the interface parameters, an application service corresponding to the target service interface is called.

9. A time recognition device, characterized in that: include: An acquisition module is used to acquire a target text and acquire at least one time pattern; each time pattern includes: a time text pattern and a time configuration pattern; the time text pattern is a pattern string about time, and is used to detect and extract subtexts in the text that match the time text pattern; the time configuration pattern includes a plurality of parameters with different conditional attributes, and the conditional attributes include a time unit attribute, a time range attribute, a time conversion attribute, and a holiday formatting attribute; the time text pattern corresponds to the time configuration pattern; A matching module, used for selecting a temporal text pattern that matches at least one target subtext in the target text; The acquisition module is further used to determine the time pattern to which the matched time text pattern belongs as the target time pattern; A determination module, for determining the reference time information according to the time configuration mode in the target time mode; comprising: extracting a plurality of original parameters contained in the time configuration mode in the target time mode; among the plurality of original parameters, using the original parameters belonging to the time unit attribute as auxiliary parameters; if the time type of the auxiliary parameter includes a relative time type, obtaining system time information, and determining the system time information as the reference time information; if the time type of the auxiliary parameter is a precise time type, determining the original time information with a null value as the reference time information; A generating module, for generating target time information matching the target text according to the reference time information and the time configuration mode in the target time mode, comprising: generating multiple target parameters according to the target text and the multiple original parameters; performing offset processing on the reference time information according to the multiple target parameters to obtain the target time information; The generating of multiple target parameters according to the target text and the multiple original parameters includes: if the time text pattern in the target time pattern does not contain a numerical wildcard, determining the multiple original parameters as the multiple target parameters; if the time text pattern in the target time pattern contains the numerical wildcard, acquiring numerical information corresponding to the numerical wildcard in a target subtext in the target text, extracting the original parameters corresponding to the numerical wildcard from the multiple original parameters, replacing the extracted original parameters with the numerical information acquired in the target subtext, and generating the multiple target parameters according to the replaced multiple original parameters; The method of offsetting the reference time information according to the multiple target parameters to obtain the target time information includes: among the multiple target parameters, taking the target parameter belonging to the time unit attribute as the first parameter; according to the time unit corresponding to the first parameter, offsetting the multiple unit reference time information respectively to obtain the start time information; the reference time information includes the unit reference time information corresponding to the multiple time units respectively; among the multiple target parameters, extracting the target parameter belonging to the time range attribute as the second parameter, generating the end time information according to the second parameter and the start time information; combining the start time information and the end time information to obtain the combined time information, and generating the target time information according to the combined time information.

10. An electronic device, characterized in that: include: Processor and memory; The processor is connected to a memory, wherein the memory is used to store program codes, and the processor is used to call the program codes to execute the method according to any one of claims 1-8.

11. A computer storage medium, characterized in that: The computer storage medium stores a computer program, wherein the computer program includes program instructions, and when the program instructions are executed by a processor, the method according to any one of claims 1 to 8 is executed.