Time identification method and device and related equipment

文档序号:1253139 发布日期:2020-08-21 浏览:17次 中文

阅读说明:本技术 时间识别方法、装置以及相关设备 (Time identification method and device and related equipment ) 是由 杨森 于 2019-01-29 设计创作,主要内容包括:本发明实施例公开了一种时间识别方法、装置以及相关设备,方法包括:获取目标文本,并获取至少一个时间模式;每个时间模式包括:时间文本模式和时间配置模式;选择与目标文本中的至少一个目标子文本相匹配的时间文本模式,将匹配的时间文本模式所属的时间模式确定为目标时间模式;根据目标时间模式中的时间配置模式确定基准时间信息;根据基准时间信息、目标时间模式中的时间配置模式,生成与目标文本相匹配的目标时间信息。采用本发明,可以提高识别文本中的中文时间信息的准确率。(The embodiment of the invention discloses a time identification method, a time identification device and related equipment, wherein the method comprises the following steps: acquiring a target text and acquiring at least one time mode; each temporal pattern includes: a temporal text mode and a temporal configuration mode; selecting a time text mode matched with at least one target subfile in the target text, and determining the time mode to which the matched time text mode belongs as a target time mode; determining reference time information according to a time configuration mode in the target time mode; and generating target time information matched with the target text according to the reference time information and the time configuration mode in the target time mode. By adopting the method and the device, the accuracy of identifying the Chinese time information in the text can be improved.)

1. A method of time identification, comprising:

acquiring a target text and acquiring at least one time mode; each temporal pattern includes: a temporal text mode and a temporal configuration mode;

selecting a time text mode matched with at least one target subfile in the target text, and determining the time mode to which the matched time text mode belongs as a target time mode;

determining reference time information according to a time configuration mode in the target time mode;

and generating target time information matched with the target text according to the reference time information and a time configuration mode in the target time mode.

2. The method of claim 1, wherein selecting a temporal text pattern that matches at least one target sub-text in the target text comprises:

converting a first character sequence belonging to a first numerical type in the target text into a second character sequence belonging to a second numerical type to obtain a text to be matched; numerical value information corresponding to the first character sequence is the same as numerical value information corresponding to the second character sequence;

and searching at least one character sequence matched with a time text mode in the text to be matched, taking the searched character sequence as the target sub-text, and taking the searched time text mode as the time text mode matched with the target sub-text.

3. The method of claim 1, wherein determining reference time information according to a time profile pattern in the target time pattern comprises:

extracting a plurality of original parameters contained in a time configuration mode in the target time mode;

among the plurality of original parameters, the original parameter belonging to the time unit attribute is used as an auxiliary parameter;

if the time type of the auxiliary parameter comprises a relative time type, acquiring system time information, and determining the system time information as the reference time information;

and if the time types of the auxiliary parameters are all accurate time types, determining the original time information which is a null value as the reference time information.

4. The method according to claim 3, wherein the generating target time information matching the target text according to the reference time information and a time configuration pattern in the target time patterns comprises:

generating a plurality of target parameters according to the target text and the plurality of original parameters;

and carrying out offset processing on the reference time information according to the target parameters to obtain target time information.

5. The method of claim 4, wherein generating a plurality of target parameters from the target text and the plurality of original parameters comprises:

if the time text mode in the target time mode does not contain numerical wildcards, determining the original parameters as the target parameters;

if the time text mode in the target time mode contains the numerical wildcards, obtaining numerical information corresponding to the numerical wildcards from a target sub-text in the target text, extracting original parameters corresponding to the numerical wildcards from the plurality of original parameters, replacing the extracted original parameters with the numerical information obtained from the target sub-text, and generating the plurality of target parameters according to the replaced plurality of original parameters.

6. The method of claim 4, wherein the offsetting the reference time information according to the target parameters to obtain target time information comprises:

among the plurality of target parameters, the target parameter belonging to the time unit attribute is taken as a first parameter;

respectively carrying out offset processing on the plurality of unit reference time information 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 a plurality of time units, respectively;

extracting target parameters belonging to a time range attribute from the plurality of target parameters, using the target parameters as second parameters, and generating end time information according to the second parameters and the start time information;

and combining the starting time information and the ending time information to obtain combined time information, and generating the target time information according to the combined time information.

7. The method according to claim 6, wherein the obtaining the start time information by performing offset processing on each of the plurality of unit reference time information according to the time unit corresponding to the first parameter comprises:

extracting any unit reference time information from the plurality of unit reference time information as target unit reference time information;

extracting a first sub-parameter having the same time unit as the target cell reference time information from the first parameter as a target first sub-parameter; the first parameter comprises a plurality of first sub-parameters;

generating unit starting 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 sequentially combined in time units into the start time information.

8. The method of claim 6, wherein the combining the start time information and the end time information to obtain combined time information comprises:

combining the start time information and the end time information into first time information;

extracting target parameters belonging to time conversion attributes from the plurality of target parameters to serve as third parameters, and determining conversion types corresponding to the third parameters;

if the conversion type belongs to a first conversion type, determining the first time information as the combined time information;

and if the conversion type belongs to a second conversion type, searching time information with the same date as the first time information in a calendar file as the combined time information.

9. The method of claim 6, wherein the combining the start time information and the end time information to obtain combined time information comprises:

combining the start time information and the end time information into second time information;

extracting target parameters belonging to the festival formatting attributes from the plurality of target parameters to serve as fourth parameters, and determining festival formatting types corresponding to the fourth parameters;

if the festival formatting type belongs to a first formatting type, determining the second time information as the combined time information;

if the festival formatting type belongs to a second formatting type, searching time information corresponding to a time text mode in the target time mode in the calendar file, updating the second time information according to the time information corresponding to the time text mode in the target time mode, and determining the updated second time information as the combined time information.

10. The method of claim 6, wherein the generating the target time information from the combined time information comprises:

when the number of the combination time information is multiple, taking the combination time information corresponding to the target sub-text adjacent to the target text in position as first combination time information and second combination time information; the combined time information includes unit times respectively corresponding to a plurality of time units;

extracting the time type of the target parameter belonging to the time unit attribute from a plurality of target parameters corresponding to the first combination time information, and extracting the time type of the target parameter belonging to the time unit attribute from a plurality of target parameters corresponding to the second combination time information;

according to the extracted time types, respectively determining the priority corresponding to each unit time in the first combination time information and the priority corresponding to each unit time in the second combination time information;

selecting a minimum time range from the time range corresponding to the first combination time information and the time range corresponding to the second combination time information as a target time range;

merging the first combination time information and the second combination time information into first statistical time information according to the priority and the target time range;

and determining the target time information according to the first statistical time information.

11. The method of claim 6, wherein the generating the target time information from the combined time information comprises:

when the number of the combined time information is multiple, extracting connection characters in the target text;

combining the combination time information corresponding to the target sub-texts adjacent to the connection characters in the target text into second statistical time information;

and determining the target time information according to the second statistical time information.

12. The method of claim 1, further comprising:

semantically identifying the target text to obtain target semantic information;

acquiring a target service interface corresponding to the target semantic information, and taking the target time information as an interface parameter of the target service interface;

and calling the application service corresponding to the target service interface based on the target service interface and the interface parameter.

13. A time identification device, comprising:

the acquisition module is used for acquiring a target text and acquiring at least one time mode; each temporal pattern includes: a temporal text mode and a temporal configuration mode;

the matching module is used for selecting a time text mode matched with at least one target subfile in the target text;

the acquisition module is further used for determining the time mode to which the matched time text mode belongs as a target time mode;

the determining module is used for determining reference time information according to a time configuration mode in the target time mode;

and the generating module is used for generating target time information matched with the target text according to the reference time information and a time configuration mode in the target time mode.

14. An electronic device, comprising: a processor and a memory;

the processor is coupled to a memory, wherein the memory is configured to store program code and the processor is configured to invoke the program code to perform the method of any of claims 1-12.

15. A computer storage medium, characterized in that the computer storage medium stores a computer program comprising program instructions which, when executed by a processor, perform the method according to any one of claims 1-12.

Technical Field

The present invention relates to the field of computer technologies, and in particular, to a time identification method, apparatus, and related device.

Background

Identifying time-related information in a text is an important part in a natural language understanding process and also is a basic support in the fields of information extraction, information retrieval, question and answer systems, topic discovery, text summarization and the like. It is possible to more accurately understand an event in a text or understand a user's intention by recognizing time, and thus it is important to precisely recognize time information in a text.

The existing specific process for identifying Chinese time information in a text is as follows: defining a plurality of pattern strings related to absolute time, performing regular matching on the text and the pattern strings, and if the pattern strings are matched, extracting time information in the corresponding text. For example, the text is: the mode string "(\ d +) year (\ d +) month (\ d +) number" can be successfully matched with the text, and then the time information in the text can be extracted: number 1 month 11, 2019.

The above method is effective only when the chinese time information in the text is absolute time, and if the chinese time information in the text is relative time (for example, "next month 5", "next year 3 month", 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.

Disclosure of Invention

The embodiment of the invention provides a time identification method, a time identification device and related equipment, which can improve the accuracy of identifying time information in a text.

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

acquiring a target text and acquiring at least one time mode; each temporal pattern includes: a temporal text mode and a temporal configuration mode;

selecting a time text mode matched with at least one target subfile in the target text, and determining the time mode to which the matched time text mode belongs as a target time mode;

determining reference time information according to a time configuration mode in the target time mode;

and generating target time information matched with the target text according to the reference time information and a time configuration mode in the target time mode.

Wherein the selecting a temporal text pattern matching at least one target sub-text in the target text comprises:

converting a first character sequence belonging to a first numerical type in the target text into a second character sequence belonging to a second numerical type to obtain a text to be matched; numerical value information corresponding to the first character sequence is the same as numerical value information corresponding to the second character sequence;

and searching at least one character sequence matched with a time text mode in the text to be matched, taking the searched character sequence as the target sub-text, and taking the searched time text mode as the time text mode matched with the target sub-text.

Wherein the determining reference time information according to the time configuration mode in the target time mode includes:

extracting a plurality of original parameters contained in a time configuration mode in the target time mode;

among the plurality of original parameters, the original parameter belonging to the time unit attribute is used as an auxiliary parameter;

if the time type of the auxiliary parameter comprises a relative time type, acquiring system time information, and determining the system time information as the reference time information;

and if the time types of the auxiliary parameters are all accurate time types, determining the original time information which is a null value as the reference time information.

Generating target time information matched with the target text according to the reference time information and a time configuration mode in the target time mode, wherein the generating of the target time information matched with the target text comprises:

generating a plurality of target parameters according to the target text and the plurality of original parameters;

and carrying out offset processing on the reference time information according to the target parameters to obtain target time information.

Wherein generating a plurality of target parameters according to the target text and the plurality of original parameters comprises:

if the time text mode in the target time mode does not contain numerical wildcards, determining the original parameters as the target parameters;

if the time text mode in the target time mode contains the numerical wildcards, obtaining numerical information corresponding to the numerical wildcards from a target sub-text in the target text, extracting original parameters corresponding to the numerical wildcards from the plurality of original parameters, replacing the extracted original parameters with the numerical information obtained from the target sub-text, and generating the plurality of target parameters according to the replaced plurality of original parameters.

Wherein, the performing offset processing on the reference time information according to the target parameters to obtain target time information includes:

among the plurality of target parameters, the target parameter belonging to the time unit attribute is taken as a first parameter;

respectively carrying out offset processing on the plurality of unit reference time information 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 a plurality of time units, respectively;

extracting target parameters belonging to a time range attribute from the plurality of target parameters, using the target parameters as second parameters, and generating end time information according to the second parameters and the start time information;

and combining the starting time information and the ending time information to obtain combined time information, and generating the target time information according to the combined time information.

Wherein, the shifting the plurality of unit reference time information according to the time unit corresponding to the first parameter to obtain the start time information includes:

extracting any unit reference time information from the plurality of unit reference time information as target unit reference time information;

extracting a first sub-parameter having the same time unit as the target cell reference time information from the first parameter as a target first sub-parameter; the first parameter comprises a plurality of first sub-parameters;

generating unit starting 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 sequentially combined in time units into the start time information.

Wherein, the combining 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 target parameters belonging to time conversion attributes from the plurality of target parameters to serve as third parameters, and determining conversion types corresponding to the third parameters;

if the conversion type belongs to a first conversion type, determining the first time information as the combined time information;

and if the conversion type belongs to a second conversion type, searching time information with the same date as the first time information in a calendar file as the combined time information.

Wherein, the combining 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 target parameters belonging to the festival formatting attributes from the plurality of target parameters to serve as fourth parameters, and determining festival formatting types corresponding to the fourth parameters;

if the festival formatting type belongs to a first formatting type, determining the second time information as the combined time information;

if the festival formatting type belongs to a second formatting type, searching time information corresponding to a time text mode in the target time mode in the calendar file, updating the second time information according to the time information corresponding to the time text mode in the target time mode, and determining the updated second time information as the combined time information.

Wherein the generating the target time information according to the combined time information includes:

when the number of the combination time information is multiple, taking the combination time information corresponding to the target sub-text adjacent to the target text in position as first combination time information and second combination time information; the combined time information includes unit times respectively corresponding to a plurality of time units;

extracting the time type of the target parameter belonging to the time unit attribute from a plurality of target parameters corresponding to the first combination time information, and extracting the time type of the target parameter belonging to the time unit attribute from a plurality of target parameters corresponding to the second combination time information;

according to the extracted time types, respectively determining the priority corresponding to each unit time in the first combination time information and the priority corresponding to each unit time in the second combination time information;

selecting a minimum time range from the time range corresponding to the first combination time information and the time range corresponding to the second combination time information as a target time range;

merging the first combination time information and the second combination time information into first statistical time information according to the priority and the target time range;

and determining the target time information according to the first statistical time information.

Wherein the generating the target time information according to the combined time information includes:

when the number of the combined time information is multiple, extracting connection characters in the target text;

combining the combination time information corresponding to the target sub-texts adjacent to the connection characters in the target text into second statistical time information;

and determining the target time information according to the second statistical time information.

Wherein, still include:

semantically identifying the target text to obtain target semantic information;

acquiring a target service interface corresponding to the target semantic information, and taking the target time information as an interface parameter of the target service interface;

and calling the application service corresponding to the target service interface based on the target service interface and the interface parameter.

Another aspect of an embodiment of the present invention provides a time identification apparatus, including:

the acquisition module is used for acquiring a target text and acquiring at least one time mode; each temporal pattern includes: a temporal text mode and a temporal configuration mode;

the matching module is used for selecting a time text mode matched with at least one target subfile in the target text;

the acquisition module is further used for determining the time mode to which the matched time text mode belongs as a target time mode;

the determining module is used for determining reference time information according to a time configuration mode in the target time mode;

and the generating module is used for generating target time information matched with the target text according to the reference time information and a time configuration mode in the target time mode.

Wherein the matching module comprises:

the conversion unit is used for converting a first character sequence belonging to a first numerical type in the target text into a second character sequence belonging to a second numerical type to obtain a text to be matched; numerical value information corresponding to the first character sequence is the same as numerical value information corresponding to the second character sequence;

and the searching unit is used for searching at least one character sequence matched with a time text pattern in the text to be matched, taking the searched character sequence as the target sub-text, and taking the searched time text pattern as the time text pattern matched with the target sub-text.

The determining module includes:

an extracting unit, configured to extract a plurality of original parameters included in a time configuration pattern in the target time pattern;

the extracting unit is further configured to use, as an auxiliary parameter, an original parameter belonging to a time unit attribute among the plurality of original parameters;

an obtaining unit, configured to obtain 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;

the obtaining unit is further configured to determine, if the time types of the auxiliary parameters are all accurate time types, original time information that is a null value as the reference time information.

Wherein the generating module comprises:

the first generating unit is used for generating a plurality of target parameters according to the target text and the plurality of original parameters;

and the second generating unit is used for carrying out offset processing on the reference time information according to the target parameters to obtain target time information.

Wherein the first generation unit includes:

an extracting subunit, configured to determine the multiple original parameters as the multiple target parameters if a time text pattern in the target time pattern does not include a numeric wildcard;

a replacing subunit, configured to, if a time text mode in the target time mode includes the numerical wildcard, obtain, in a target sub-text in the target text, numerical information corresponding to the numerical wildcard, extract, in the multiple original parameters, original parameters corresponding to the numerical wildcard, replace the extracted original parameters with the numerical information obtained in the target sub-text, and generate the multiple target parameters according to the replaced multiple original parameters.

Wherein the second generating unit includes:

a first determining subunit that takes, as a first parameter, a target parameter belonging to the time unit attribute, among the plurality of target parameters;

the second determining subunit is configured to perform offset processing on the plurality of unit reference time information according to the time unit corresponding to the first parameter, respectively, to obtain start time information; the reference time information includes unit reference time information corresponding to a plurality of time units, respectively;

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

the combination subunit is used for carrying out combination processing on the start time information and the end time information to obtain combination time information;

and the first generation subunit is used for generating the target time information according to the combined time information.

Wherein the second determining subunit includes:

an acquisition subunit, configured to extract any one unit reference time information from the plurality of unit reference time information as target unit reference time information;

the acquiring sub-unit is further configured to extract a first sub-parameter having the same time unit as the target unit reference time information from the first parameter, as a target first sub-parameter; the first parameter comprises a plurality of first sub-parameters;

a second generating sub-unit, configured to generate unit start time information according to the target first sub-parameter and the target unit reference time information;

the second generating subunit is further configured to combine, as the start time information, a plurality of unit start time information in order of time units when each unit reference time information is determined as the target unit reference time information.

Wherein the combination subunit comprises:

a first combining subunit, configured to combine the start time information and the end time information into first time information;

the first combining subunit is further configured to extract, from the multiple target parameters, a target parameter belonging to a time conversion attribute as a third parameter, and determine a conversion type corresponding to the third parameter;

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;

the first converting subunit is further configured to, if the conversion type belongs to a second conversion type, search, in a calendar file, time information having the same date as the first time information, as the combined time information.

Wherein the combination subunit comprises:

a second combining subunit, configured to combine the start time information and the end time information into second time information;

the second combination subunit is further configured to extract, from the multiple target parameters, a target parameter belonging to a festival formatting attribute as a fourth parameter, and determine a festival formatting type corresponding to the fourth parameter;

a second converting subunit, configured to determine the second time information as the combined time information if the holiday formatting type belongs to the first formatting type;

the second converting subunit is further configured to, if the holiday formatting type belongs to a second formatting type, search, in the calendar file, time information corresponding to a time text mode in the target time mode, update the second time information according to the time information corresponding to the time text mode in the target time mode, and determine the updated second time information as the combined time information.

Wherein the first generating subunit includes:

a third determining subunit, configured to, when the number of the combination time information is multiple, take combination time information corresponding to target sub-texts adjacent in position in the target text as the first combination time information and the second combination time information; the combined time information includes unit times respectively corresponding to a plurality of time units;

the third determining subunit is further configured to extract, from the multiple target parameters corresponding to the first combination time information, a time type of a target parameter belonging to a time unit attribute, and extract, from the multiple target parameters corresponding to the second combination time information, a time type of a target parameter belonging to a time unit attribute;

the third determining subunit is further configured to determine, according to the extracted time type, a priority corresponding to each unit time in the first combination time information, and a priority corresponding to each unit time in the second combination time information, respectively;

the third determining subunit is further configured to select a minimum time range from the time range corresponding to the first combination time information and the time range corresponding to the second combination time information, as a target time range;

a first combining subunit, configured to combine the first combination time information and the second combination time information into first statistical time information according to the priority and the target time range;

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

Wherein the first generating subunit includes:

a fourth determining subunit, configured to, when the number of the combination time information is multiple, extract a connection character in the target text;

a second merging subunit, configured to merge combination time information corresponding to a target sub-text adjacent to the join character in the target text into second statistical time information;

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

Wherein, still include:

the semantic recognition module is used for recognizing the target text semantically to obtain target semantic information;

the semantic recognition module is further configured to 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;

and the calling module is used for calling the application service corresponding to the target service interface based on the target service interface and the interface parameter.

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

the processor is connected to a memory, wherein the memory is used for storing program codes, and the processor is used for calling the program codes to execute the method in one aspect of the embodiment of the invention.

Another aspect of the embodiments of the present invention provides a computer storage medium storing a computer program, the computer program comprising program instructions that, when executed by a processor, perform a method as in one aspect of the embodiments of the present invention.

According to the embodiment of the invention, the time text mode matched with the target sub-text in the target text is selected, and the corresponding time configuration mode is determined. And determining reference time information according to the time configuration mode, and generating target time information according to the reference time information and the time configuration mode. Therefore, the reference time is determined through the time configuration mode and is adjusted on the basis of the reference time, so that the accurate time expressed in the text can be obtained after the reference time is adjusted no matter the Chinese time information in the text is relative time or absolute time, and the accuracy of identifying the Chinese time information in the text can be improved.

Drawings

In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, it is obvious that the drawings in the following description are only some embodiments of the present invention, and for those skilled in the art, other drawings can be obtained according to the drawings without creative efforts.

FIG. 1 is a diagram of a system architecture for time identification according to an embodiment of the present invention;

2 a-2 b are schematic diagrams of a time identification scenario provided by an embodiment of the present invention;

fig. 3 is a schematic flowchart of a time identification method according to an embodiment of the present invention;

FIG. 4 is a diagram of component architecture for time identification provided by an embodiment of the present invention;

fig. 5 is a schematic flowchart of determining target time information according to an embodiment of the present invention;

FIG. 6 is a flow chart illustrating another time identification method according to an embodiment of the present invention;

fig. 7 is a schematic structural diagram of a time identification apparatus according to an embodiment of the present invention;

fig. 8 is a schematic structural diagram of an electronic device according to an embodiment of the present invention.

Detailed Description

The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.

Fig. 1 is a system architecture diagram for time identification according to an embodiment of the present invention. The server 10f establishes a connection with a user terminal cluster through the switch 10e and the communication bus 10d, and the user terminal cluster may include: user terminal 10a, user terminal 10 b.

Taking the user terminal 10a as an example, when the user terminal 10a receives a text to be recognized containing Chinese time information, the user terminal 10a sends the text to be recognized to the server 10 f. The server 10f extracts a plurality of preset temporal text patterns (i.e., pattern strings related to the temporal information) from the database 10g, and determines a reference time by performing regular matching between the received text to be recognized and the plurality of temporal text patterns, and by searching for a temporal configuration pattern corresponding to a temporal text pattern successfully matched, thereby adjusting the reference time to accurately recognize the chinese temporal information in the text. The server 10f sends the identified time information to the user terminal 10a, and the subsequent user terminal 10a can call an application subsystem corresponding to the text to be identified, and transmit the time information as a parameter to the application subsystem, so that the application subsystem provides corresponding services. For example, a calendar service is displayed, a ticket lookup service, etc.

Of course, if the user terminal 10a has the function of accurately recognizing the chinese time information in the text, the user terminal 10a may also directly recognize the chinese time information in the text, and the recognized time information is also transmitted to the application subsystem as a parameter. The following description will be made specifically by taking an example of how the user terminal 10a accurately recognizes the chinese time information in the text.

The user terminal 10a, the user terminal 10b, the user terminal 10c, and the like shown in fig. 1 may include a mobile phone, a tablet computer, a notebook computer, a palm computer, a Mobile Internet Device (MID), a wearable device (e.g., a smart watch, a smart band, and the like), and the like.

Please refer to fig. 2 a-2 b, which are schematic views of a time recognition scenario according to an embodiment of the present invention. As shown in fig. 2a, the user inputs the following information into the user terminal 10a by voice or text: the third year, No. 3/month 5, beijing to shanghai, and clicks the "search" button. The user terminal 10a converts the information inputted by the user into a text 20a, and the user terminal 10a acquires a plurality of time text patterns preset in advance from the local file (hereinafter, taking the acquisition of 3 time text patterns as an example, the 3 time text patterns are (next | next) year, (\ d +) month (\\ d +) (day | number)), respectively. The user terminal 10a performs regular matching on the text 20a and the above-mentioned 3 temporal text patterns, respectively, the character sequence "next year" in the text 20a and the temporal text pattern "(next year under bright | are successfully matched, and the character sequence" number 3 month 5 "in the text 20a and the temporal text pattern" (\ d +) month (\\ d +) (number of day | are successfully matched, and hereinafter, two temporal text patterns and corresponding character sequences which are successfully matched are described, respectively.

For the character sequence "next year" and temporal text mode "(next year under bright | bright) the temporal configuration mode corresponding to the temporal text mode" (next year under bright | bright) is looked up in the mode configuration table 20b, called the original temporal configuration mode. It can be known that the original time configuration pattern includes a plurality of original parameters, each of which has an attribute corresponding to it, and the attributes include: whether gregorian calendar, year, month, day, hour, minute, second, and time range. Extracting original parameters corresponding to an attribute of 'year, month, day, hour, minute and second' from a plurality of original parameters, wherein the original parameters are all used as auxiliary parameters, and each auxiliary parameter also has a time type corresponding to the auxiliary parameter. From the parameter values of the auxiliary parameters, a time type for each auxiliary parameter may be determined, the time type comprising a relative time type and a precise time type. For the pattern configuration table 20b, an integer indicates that addition and subtraction are performed on the reference time, so if the parameter value of the auxiliary parameter is an integer (e.g., -1, 0, etc.), the time type corresponding to the auxiliary parameter is a relative time type; the time types of the remaining auxiliary parameters (e.g., x, e0) other than integers are all precise time types. Subsequently, the value of the original parameter (auxiliary parameter) corresponding to the attribute "year, month, day, hour, minute and second" may be updated, but the time type is fixed.

Since the time type of the auxiliary parameter corresponding to the temporal text mode "(next year,") includes 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.

Since the time text mode "(next year under Ming | does) does not include a numerical wildcard (the numerical wildcard is: \ d or \ d +), a plurality of original parameters in the original time configuration mode corresponding to the time text mode can be directly used as target parameters, i.e. a target parameter set 20c is obtained, and the time type of the original parameter corresponding to the attribute" year, month, hour, minute and second "determined in the foregoing is determined as the time type corresponding to the target parameter.

The process of adjusting the reference time by the target parameter corresponding to the attribute "year, month, day, hour, minute and 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 the target parameter is a relative time type, 1 is added on the basis of a year reference time, wherein the reference time includes a (year/month/day/hour/minute/second) reference time. For a plurality of target parameters "", which correspond to the attribute "month, day, hour, minute, second", the time type of the target parameter is any precise time type in the precise time types, and therefore, the reference time (month/day/hour/minute/second), etc. is set to the value 1 corresponding to the target parameter "", then the start time can be obtained: 2020/1/1/1:1:1. Reading a target parameter of the attribute "time range", based on which and the start time, the end time can be determined: 2021/1/1:1:1. Merging the start time and the end time into time information 20 e: (2020/1/1/1:1:1, 2021/1/1:1:1). Since the target parameters of the attribute "Gregorian calendar" in the target configuration information 20c are: y, and therefore, the time information 20e does not need to be subjected to the lunar calendar conversion. Thus, the time information 20e corresponding to the target configuration information 20c is determined.

For the character sequence "No. 3/month 5" and the time text pattern "(\ d +) month (\ d +) (ri | number)", similar to the foregoing, 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, time, minute and second" is determined, and the original parameter "+" belongs to any precise time type among the precise time types; the original parameters "x 1" and "x 2" belong to the variable precise time type in the precise time type; the original parameter "e 0" belongs to the absolute precise time type among the precise time types. It can be known that the time types of the original parameters corresponding to the attribute "year, month, day, hour, minute and second" are all accurate time types. Thus, the time information that is a null value can be: "______/__ and" _ as a reference time.

Since the time text mode "(\ d +) month (\ d +) (day | number)" includes a numerical wildcard, the target parameter set 20d can be obtained by extracting numerical values from the corresponding character sequence "No. 3/month 5", and replacing the original parameters "x 1" and "x 2" corresponding to the numerical wildcard in the original parameters with the extracted numerical values. And determining the time type of the original parameter corresponding to the attribute of year, month, day, hour, minute and second determined in the previous step as the time type of the corresponding target parameter.

The process of adjusting the reference time by the target parameter corresponding to the attribute "year, month, day, hour, minute and 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 types in the precise time types, 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 "e 0" corresponding to the attribute "hour, minute, and second", the target parameter belongs to the absolute precise time type among the precise time types, and thus the time base time, minute base time, and second base time are set to the value 0 corresponding to "e 0". Then the start time can be found: 1/3/5/0:0:0. Reading a target parameter of the attribute "time range", based on which 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 20 f: (1/3/5/0:0:0,1/3/6/0:0:0). Since the target parameters of the attribute "Gregorian calendar" in the target configuration information 20d are: y, and therefore, the time information 20f does not need to be subjected to the lunar calendar conversion. Thus, the time information 20f corresponding to the target configuration information 20d is determined.

The user terminal 20a then combines the time information 20e and the time information 20 f. First, a time type of the target parameter corresponding to the attribute "year, month, day, hour, minute and second" is determined among the plurality of target parameters corresponding to the time information 20e, and a time type of the target parameter corresponding to the attribute "year, month, day, hour, minute and second" is determined among the plurality of target parameters corresponding to the time information 20 f. The priority of each unit time in the time information 20e and the time information 20f is determined according to the time type, and the time information 20e and the time information 20f are combined by (year/month/day/hour/minute/second) unit time.

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

Wherein, the time range of the time information 20e is the target parameter corresponding to the attribute "time range" in the target parameter set 20 c; the time range of the time information 20f is the target parameter corresponding to the attribute "time range" in the target parameter set 20 d.

As shown in fig. 2b, the user terminal 10a recognizes the semantics of the text 20a, and determines the application service as the air ticket inquiry service according to the recognized semantics (as shown in an interface 20 h). The subsystem acquiring the service calls the subsystem and the system parameter to provide a corresponding air ticket inquiry service by taking the identified target time information 20g as a system parameter as shown in an interface 20 k.

Specific processes of acquiring a plurality of target parameters (such as the target parameters in the target parameter set 20c and the target parameter set 20d in the embodiment corresponding to fig. 2 a), determining the reference time, and generating the target time information (such as the target time information 20g in the embodiment corresponding to fig. 2 a) may be referred to in the embodiments corresponding to fig. 3 to fig. 6 below.

Fig. 3 is a schematic flow chart of a time identification method according to an embodiment of the present invention. As shown in fig. 3, the time identification method may include:

step S101, acquiring a target text and acquiring at least one time mode; each temporal pattern includes: a temporal text mode and a temporal configuration mode.

Specifically, the terminal (e.g., the user terminal 10a in the embodiment corresponding to fig. 2 a) acquires a text containing chinese time information, which is referred to as a target text (e.g., the text 20a in the embodiment corresponding to fig. 2 a), and acquires a plurality of time patterns, wherein each time pattern includes a time text pattern and a time allocation pattern. The temporal text Pattern is a Pattern string related to time, the temporal text Pattern describes a Pattern (Pattern) for matching character strings, each temporal text Pattern is also a Regular Expression (Regular Expression), the temporal text Pattern can be used for detecting whether a string (text) contains a certain sub-string, and subsequently, the sub-string meeting a certain condition can be extracted from the text. The time configuration mode includes a plurality of parameters having different condition attributes, which may include: a time unit attribute, a time range attribute, a time conversion attribute, a holiday formatting attribute, and the like.

For example, the temporal text mode may be (next under | bright), year (previous | before), (\ d +) month (\ d +) (sun | number), etc., and it is known that the temporal text mode may include a general character or a meta character (which may also be referred to as a special character). Letters, numbers, characters, etc. are common characters; a meta character is a character with a special meaning, for example, the meta character "\ d" has the meaning of matching a numeric character; the meta character "\ d +" means matching one or more numeric characters; the meaning of the meta character "\\ r" is to match a carriage return symbol, wherein the meta character "\ d +" can also be called a numeric wildcard, i.e., to wildcard all numeric values.

Step S102, selecting a time text mode matched with at least one target subfile in the target text, and determining the time mode to which the matched time text mode belongs as a target time mode.

Specifically, since the value in the chinese time information to be recognized in the target text may be a chinese value, for example, the chinese time information is: in order to match the value wildcard characters in the temporal text mode, the terminal first needs to convert the chinese value into ASCII value, i.e. into arabic value. The specific process is as follows: the terminal firstly identifies a first character sequence belonging to a first type in a target text, converts the first character sequence belonging to the first type into a second character sequence belonging to a second type, numerical information corresponding to the converted second character sequence is the same as numerical information of the first character sequence before conversion, and determines the converted target text as a text to be matched. The character string corresponding to the Chinese numerical value is a first character sequence belonging to a first type, and the character string corresponding to the ASCII numerical value is a second character sequence belonging to a second type.

For example, the target text is: the first character sequences belonging to the first type are respectively as follows: two zero, five, twelve, converting the first character sequence into a second character sequence: 2020. 5, 12, converting to obtain a text to be matched, wherein the text to be matched is as follows: year 2020, 5, 12.

The terminal carries out regular matching on the text to be matched and the time text patterns respectively, namely, according to the reading sequence, character sequences matched with the time text patterns are searched in the text to be matched, the matched character sequences searched in the text to be matched are determined as target sub-texts, and the time text patterns matched with the target sub-texts are determined as the time text patterns matched with the target sub-texts. And after the terminal is successfully matched each time, the successfully matched position in the text to be matched can be recorded, and when the next matching is carried out, the regular matching is carried out with all time text patterns again from the recorded position until all characters in the text to be matched are regularly matched. It can be known that the text to be matched may be successfully matched with a plurality of temporal text patterns, and each matching temporal text pattern has a corresponding target sub-text.

And determining the time pattern to which the matching successful time text pattern belongs as a target time pattern in the plurality of time patterns.

Step S103, determining reference time information according to the time configuration mode in the target time mode.

Specifically, the following description will be given with respect to one target time pattern. The terminal extracts a plurality of parameters included in the time configuration pattern in the target time pattern, which are called original parameters. Each original parameter has a conditional attribute, which may include: a time unit attribute, a time range attribute, a time conversion attribute, a holiday formatting attribute, and the like. The original parameters corresponding to the time unit attributes also have time types.

In order to determine the time type of the 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, wherein the time type comprises a relative time type and an accurate time type. Subsequently, the parameter value of the original parameter may be updated, but the corresponding time type and condition attribute are all fixed and unchanged.

For the auxiliary parameter belonging to the time unit attribute, when the operation definition corresponding to the parameter value of the auxiliary parameter is addition and subtraction operation 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 precise value, the time type of the auxiliary parameter is a precise time type. The relative time type includes a fixed relative time type and a variable relative time type, and the precise time type includes a variable precise time type, an arbitrary precise time type, and an absolute precise time type. Dividing time types into a relative time type and an accurate time type from a coarse dimension so as to determine reference time information; the relative time type and the precise time type are further subdivided from the fine dimension in order to accurately adjust the reference time information to obtain the target time information.

The above 5 time types are specifically illustrated by the following table 1:

TABLE 1

For table 1, "calendar" is a time conversion attribute, "duration of validity" is a time range attribute, and "holiday substring" is a holiday formatting attribute. "year", "month", "day", "hour", "minute", "second" and "day of the week" are all time unit attributes.

In the original parameters (i.e., auxiliary parameters) of "year, month, day, hour, minute, second and week number" (time unit attribute), 5 types of time are included, which are explained in detail below:

fixed relative time types (e.g., 1, -1, etc., for "year" time units): it is noted as an integer value, which may be a negative number, such as 1 indicating that a unit time field is added to the reference time, -1 indicating that a unit time field is pushed forward, and 0 indicating that the sub-field may take the threshold value of the current reference time.

Variable versus time type (e.g., d-1, d1 for "year" time units, etc.): and d is an integer value, and the first number extracted from the target text is subtracted on the basis of the reference time.

Variable precision time type (e.g., x1 for "year" time unit, etc.): and (4) recording as x { integer value }, and taking the first digit extracted from the target text as the value of the subdomain.

Any precise time type (e.g., 'month' time unit corresponds to, etc.): the value representing the value range is uncertain and can be any value within the value range of the value range.

Absolute precise time type (e.g., e0 for "month" time units, etc.): denoted e { integer value }, e.g., e0, indicates that the value of the subfield is a fixed value of 0.

The terminal may determine the time type of each auxiliary parameter through table 1, and detect the time type of the auxiliary parameter:

and if the time types corresponding to all the auxiliary parameters comprise relative time types, the terminal acquires the current time of the system as system time information and determines the system time information as reference time information. If all the time types corresponding to the auxiliary parameters are accurate time types, the terminal determines the original time information as reference time information, wherein the original time information is time information with a null value, and the original time information can be: the year, month, day, hour, minute, second, which is each unit time in the original time information, has no numerical value.

And step S104, generating target time information matched with the target text according to the reference time information and a time configuration mode in the target time mode.

Specifically, whether a time text mode in a target time mode contains a numerical wildcard character "\ d +", if the time text mode does not contain the numerical wildcard character "\ d +", each original parameter can be directly used as a target parameter, the condition attribute of each original parameter is also determined as the condition attribute corresponding to the target parameter, the time type of the original parameter (auxiliary parameter) corresponding to the time unit attribute is determined as the time type corresponding to the target parameter, and the target parameter and the original parameter are in one-to-one correspondence.

If the time text mode contains the numerical value wildcard character '\ d +', extracting numerical value information corresponding to the numerical value wildcard character from the target sub-text, extracting original parameters corresponding to the numerical value wildcard character from a plurality of original parameters, replacing the extracted original parameters with the numerical value information extracted from the target sub-text, respectively determining new original parameters after replacement and original parameters which are not updated as target parameters, and still enabling the consistent target parameters and the original parameters to be in one-to-one correspondence.

For example, the target sub-text is: year 2020, month 5, 13, the corresponding temporal text mode is: the year (d +) month (d +) (ri | number), the plurality of original parameters are: x1, x2, x3, e0, e0 and e0, wherein the original parameters x1, x2 and x3 represent the first numerical value, the second numerical value and the third numerical value in the extracted target sub-text. Because the time text mode contains numerical wildcards, the terminal extracts numerical information corresponding to the numerical wildcards in the target sub-text: 2020. 5, 13; extracting the original parameters corresponding to the numerical wildcards: x1, x2 and x3, replacing the original parameters with numerical information, and determining the original parameters after replacement and the original parameters which are not updated as target parameters, namely the target parameters are as follows: 2020. 5, 13, e0, e0, e 0.

And after the plurality of target parameters are determined, adjusting the reference time information according to the plurality of target parameters to obtain the target time information. The reference time information is a combination of unit reference time information corresponding to each of the plurality of time units.

For example, the reference time information is the unit reference time information corresponding to the unit of year time, which is 1 month, 1 day, 12 hours, 0 minutes, and 0 seconds in 2020: 2020; unit reference time information corresponding to a month time unit: 1 month; unit reference time information corresponding to a time of day unit: 1 day; unit reference time information corresponding to an hour time unit: 12 hours later; unit reference time information corresponding to minute time units: 0 minute; unit reference time information corresponding to the second time unit: 0 second.

Among the plurality of target parameters, a target parameter belonging to the time unit attribute is set as a first parameter. The plurality of pieces of unit reference time information are offset-processed according to the time type and the time unit of the first parameter, and the plurality of pieces of unit reference time information after offset processing are combined into the start time information in the order of time units (that is, in the order of time units from large to small). It can be known that the number of time units corresponding to the first parameter and the number of unit reference time information may be the same.

For example, the time units corresponding to the first parameter are respectively: year, month, day, hour, minute, second; the time unit corresponding to each of the plurality of unit reference time information is also: year, month, day, hour, minute, second.

Among the plurality of target parameters, a target parameter whose condition attribute is a time range attribute is extracted as a second parameter. And generating end time information according to the second parameter and the start time information.

And the terminal combines the start time information and the end time information to obtain combined time information. If the number of the combined time information is only one (that is, the number of the target sub-text, the target time pattern, etc. is only one), the terminal may directly determine the combined time information as the target time information (e.g., the target time information 20g in the embodiment corresponding to fig. 2 a); if the number of the combined time information is more than one, the terminal further needs to combine the plurality of combined time information according to the connection character or the time type of the target parameter of the plurality of combined time information, and generate the target time information according to the combined time information.

Fig. 4 is a diagram of a time-recognition component architecture according to an embodiment of the present invention. As shown in fig. 4, the numeric converter is used to convert chinese numeric values in the target text to arabic numeric values. The mode manager is used for extracting items matched with the target text from a plurality of items (time modes), and generating combined time information according to the time text mode and the time configuration mode in the extracted items, wherein the mode manager sets the plurality of items in advance, and each Item corresponds to one time text mode and one time configuration mode. There is also a festival formatting link for the Item of the festival, and the date and the processing mode of the corresponding festival are back-searched through the festival formatting link and the calendar file. For the combined time information needing the conversion of the lunar calendar and the combined time information with festival formatting links, the calendar manager updates the combined time information according to a calendar file, wherein the calendar file is a file in text format of < lunar calendar date, solar term, festival >. The time merger stores a plurality of connection characters in advance for merging the plurality of updated combination times to obtain target time information, and the time extractor maintains the target time information extracted from the target text.

Fig. 5 is a schematic flowchart illustrating a process of determining target time information according to an embodiment of the present invention. As shown in fig. 5, the specific process of determining the target time information includes the following steps S201 to S204, and the steps S201 to S204 are a specific embodiment of the step S104 in the embodiment corresponding to fig. 3:

step S201, generating a plurality of target parameters according to the target text and the plurality of original parameters.

Specifically, a plurality of target parameters are determined according to whether the time text mode in the target time mode contains numerical wildcards or not and the original parameters. The specific process of determining the plurality of target parameters may be step S104 in the embodiment corresponding to fig. 3.

Step S202, in a plurality of target parameters, using the target parameter belonging to the time unit attribute as a first parameter, and respectively carrying out offset processing on a plurality of unit reference time information 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 a plurality of time units, respectively.

Specifically, among the plurality of target parameters, a target parameter belonging to the time unit attribute is set as the first parameter. The first parameter includes a plurality of first sub-parameters, each corresponding to a time unit. The terminal extracts any one unit reference time information from the plurality of unit reference time information as target unit reference time information. The terminal extracts a first sub-parameter having the same time unit as the target unit reference time information as a target first sub-parameter from the plurality of first sub-parameters.

If the time type of the target first sub-parameter is a relative time type, the terminal may perform an addition operation or a subtraction operation on the target unit reference time information according to the first sub-parameter to obtain the unit start time information, and it may be known that a time unit of the unit start time information is the same as a time unit of the target first sub-parameter and the target unit reference time information. For example, if the target cell reference time information is 2019, the target first sub-parameter corresponding to the target cell reference time information is-3, and the time type of the first sub-parameter is a relative time type, then 3 may be subtracted from the target cell reference time information in 2019 to obtain 2016, and thus obtain the cell start time information as: 2016.

If the time type of the target first sub-parameter is any accurate time type in the accurate time types, the terminal acquires a numerical value corresponding to any accurate time type, sets the numerical value of the target unit time information as a numerical value corresponding to any accurate time type (the numerical value is set in advance, as long as the numerical values corresponding to the first sub-parameters belonging to any accurate time type are the same), and obtains unit start time information, wherein the time unit of the unit start time information is the same as the time units of the target first sub-parameter and the target unit reference time information. Wherein, 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 (such as the original parameter ". times" in table 1) in the precise time types.

For example, the target unit reference time information is 2019, and the target first sub-parameter corresponding to the target unit reference time information is: and the time type of the first sub-parameter is any precise time type, the terminal obtains a value 1 corresponding to the target first sub-parameter "", so that the terminal sets the value 2019 in the target cell reference time information to 1, that is, the cell start time information is: for 1 year.

If the time type of the target first sub-parameter is an absolute precise time type among the precise time types, the terminal determines a value corresponding to the absolute precise time type, sets the value of the target cell time information to a value corresponding to the absolute precise time type (the value is determined by the first sub-parameter, e.g., the first sub-parameter e1 belonging to the absolute precise time type, corresponding to a value of 1; the value is 10 corresponding to the first sub-parameter e10 belonging to the absolute precise time type), and obtains cell start time information, the time unit of which is the same as the time unit of the target first sub-parameter and the target cell reference time information. Wherein, 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 an absolute precise time type (such as the original parameter e0 in table 1).

For example, the target cell reference time information is 2019, the target first sub-parameter corresponding to the target cell reference time information is e5, and the time type of the first sub-parameter is an absolute precise time type, the terminal determines that the value corresponding to the above-mentioned target first sub-parameter "e 5" is 5, so the terminal sets the value 2019 in the target cell reference time information to 5, that is, the cell start time information is: and 5 years.

In the above manner, the offset processing may be performed on each unit reference time information to obtain a plurality of unit start time information, and the plurality of unit start time information may be combined into the start time information according to the order of time units, i.e., the order of time units from large to small.

Step S203, extracting a target parameter belonging to the 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.

Specifically, among the plurality of target parameters, a target parameter belonging to the time range attribute is extracted as a second parameter, and the second parameter may include: 1 year, 1 month, 1 day, etc. And generating end time information according to the time length corresponding to the second parameter and the start time information, wherein the time length between the start time information and the end time information is equal to the time length indicated by the second parameter. For example, if the start time information is: 12 hours 0 minutes 0 seconds of 1 month 1 day of 2020, and the second parameter is 1 day, then the end time information is: 0 minute and 0 second at 1 month, 2 days, 12 hours in 2020. In this way, based on the second parameter (i.e., the duration), the terminal can express accurate time information as a time range accurate to seconds.

Step S204, the start time information and the end time information are combined to obtain combined time information.

Specifically, the start time information and the end time information are combined into first time information, and one first time information will be described below. And extracting a target parameter with a condition attribute being a time conversion attribute from the plurality of target parameters, taking the target parameter as a third parameter, and determining a conversion type corresponding to the third parameter, wherein the third parameter is used for identifying whether the first time information needs to be converted from the lunar calendar to the lunar calendar. The conversion type includes a first conversion type and a second conversion type, for example, if the third parameter is 1 (i.e. it is not necessary to convert the first time information from the lunar calendar to the lunar calendar), it indicates that the corresponding conversion type is the first conversion type; if the third parameter is 0 (i.e. the first time information needs to be converted from the lunar calendar to the common calendar), it indicates that the corresponding conversion type is the second conversion type.

When the conversion type is the first conversion type, the terminal may directly use the first time information as the combined time information; when the conversion type is the second conversion type, the terminal searches time information having the same date as the first time information in the calendar file as combined time information. Wherein, the calendar file includes a plurality of time records, each time record includes: lunar calendar date, solar terms and holidays. Since the first time information includes two pieces of time information, when the first time information is converted, the terminal needs to convert the lunar calendar date to the gregorian calendar date respectively from two pieces of time in the first time information, and the converted time information is called combined time information. Further, since the minimum time unit involved in the conversion of the lunar calendar into the common calendar is day, if the first time information includes a time unit smaller than day, for example, hour, minute, second, or the like, the time information smaller than the time unit of day in the first time information may be kept unchanged.

For example, the first time information is: (2020/1/1/12:0:0, 2020/1/2/12:0:0), and the third parameter is of a second conversion type, looking up the gregorian calendar date in the calendar file corresponding to the lunar calendar date "2020/1/1" is: 2020/2/9, respectively; looking up the gregorian calendar date in the calendar file corresponding to the lunar calendar date "2020/1/2" is: 2020/2/10, the combined time information after conversion is therefore: (2020/2/9/12:0:0, 2020/2/10/12:0:0).

Alternatively, the above is to perform lunar calendar conversion on the start time information and the end time information, and the following describes how to perform holiday formatting processing on the start time information and the end time information. The start time information and the end time information are combined into second time information, and one second time information will be described below. And extracting the target parameter with the conditional attribute being the festival formatting attribute from the plurality of target parameters to serve as a fourth parameter, and determining the festival formatting type corresponding to the fourth parameter, wherein the fourth parameter is used for identifying whether the second time information needs to be subjected to festival formatting or not.

The festival formatting types include a first formatting type and a second formatting type, for example, if the fourth parameter is 1 (i.e. it is not necessary to perform festival formatting on the second time information), it indicates that the corresponding festival formatting type is the first formatting type; if the fourth parameter is 0 (i.e. the second time information needs to be festival formatted), it indicates that the corresponding festival formatting type is the second formatting type. When the festival formatting type belongs to the first formatting type, the terminal can directly take the second time information as combined time information; and when the festival formatting type belongs to a second formatting type, the terminal searches the calendar file for time information corresponding to the time text mode of the second time information, updates the second time information based on the searched time information, and determines the updated second time information as combined time information. It should be noted that, since the second time information includes two pieces of time information, the time information corresponding to the time text pattern found in the calendar file is also a time range including two pieces of time information.

For example, the temporal text mode is: in the festival of national celebration, the second time information corresponding to the time text mode is: (2019/10/1/0:0:0, 2019/10/2/0:0:0), if a date corresponding to the time text pattern "national day" is found in the calendar file to be 10 months 1 day to 10 months 7 days, the time information of the date can be expressed as: (10/1/0:0:0, 10/8/0:0:0), the combined time information obtained after updating the second time information is therefore: (2019/10/1/0:0:0, 2019/10/8/0:0:0).

Also for example, the temporal text mode is: and (3) the father node, because the father node is the 3 rd sunday of 6 months per year, the accurate date of the father node cannot be determined only through the target parameters, if the first parameter in the target parameters corresponding to the 'father node' is: a, e0, e0, e0 (in turn corresponding to year, month, day, hour, minute, second), and the time range is 1 day, so the second time information is: (1/1/1/0:0:0,1/1/2/0:0:0). In the calendar file, the time information of the "parent node" in the time text mode is searched, that is, the time information of all the parent nodes is searched in the calendar file, and if 100-year calendars are recorded in the calendar file, 100 parent nodes can be searched. If the combination time information of another target sub-text adjacent to the target sub-text "parent node" in the target text is: (2020/1/1/1:1:1, 2021/1/1/1:1:1), the first parameter of the target parameters corresponding to the second time information is: 1, (in turn for year, month, day, hour, minute, second), and the priority of any precise time type (i.e. "x") < priority of relative time type (i.e. "1"), so that the time information of parent nodes between 2020 and 2021, i.e. "parent nodes" between 2020 and 2021, can be selected from the time information corresponding to a plurality of "parent nodes" as: (6/21/0:0:0,6/22/0:0:0). Updating second time information corresponding to the parent node based on the selected time information, wherein the updated second time information (combined time information) is as follows: (1/6/21/0:0:0,1/6/22/0:0:0).

In the above example, if it is not possible to determine, from the plurality of pieces of time information of the "parent node", to select one piece of time information for updating the second time information of the "parent node" according to the combined time information of the adjacent target child texts (temporal text mode), the terminal may select according to the system time, and if the system time is 2019, the time information of the parent node in 2019 is selected for updating the second time information to obtain the combined time information.

It should be noted that, in addition to the above mentioned manner, the terminal may combine the start time information and the end time information into the first time information, and after the lunar calendar to the lunar calendar conversion is performed, further perform the holiday formatting process on the converted time information to obtain the combined time information; or the start time information and the end time information may be combined into second time information, and after the festival formatting process is performed, the formatted time information is further subjected to lunar calendar conversion to obtain combined time information. That is, the lunar calendar conversion and the festival formatting process may be separately and independently performed to obtain the combined time information, or may be sequentially performed to obtain the combined time information.

Step S205, generating the target time information according to the combined time information.

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

If the number of the combined time information is more than one, each combined time information corresponds to one target sub-text, a target time mode and a plurality of target parameters. The terminal also needs to combine a plurality of pieces of combined time information according to the information, and determines target time information according to the combined time information.

And the terminal respectively determines the combination time information corresponding to the target subfiles adjacent to each other in the target text as the first combination time information and the second combination time information. In the following description, a pair of first combination time information and second combination time information is described, and each of the combination time information similarly includes a unit time corresponding to each of a plurality of time units.

In the plurality of target parameters corresponding to the first combination time information, the time type of the target parameter (i.e., the first parameter in the foregoing) belonging to the time unit attribute is determined, and since each time unit corresponds to one target parameter, i.e., the time types of the target parameters corresponding to the plurality of time units are determined, the time type of the target parameter (i.e., the first parameter in the foregoing) belonging to the time unit attribute is determined in the plurality of target parameters corresponding to the second combination time information.

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 appreciated that the time types include a relative time type and a precise time type, the precise time type including: absolute precise time type, arbitrary precise time type, variable precise time type; further, the relative time type includes a fixed relative time type and a variable relative time type.

Wherein the operation definition of the target parameter belonging to the fixed relative time type is that addition and subtraction operations are performed on the basis of the reference time, and the value of the addition and subtraction budget is determined by the original parameters (such as original parameters 1, -1, etc. in table 1); the operation definition of the target parameters belonging to the variable relative time type is that addition and subtraction are performed on the basis of the reference time, and the numerical value of the addition and subtraction budget is determined from the target sub-text (such as parameters d-1, d1 and the like in table 1). The operation definition of the target parameter belonging to the variable precision time type is to set the value in the reference time information to the value extracted from the target sub-text (e.g., parameters x1, x2, etc. in table 1).

Wherein the priority of the variable relative time type ═ priority of the variable precise time type > priority of the fixed relative time type > priority of the absolute precise time type > priority of any precise time type.

The terminal may determine, according to the priority of the time type of the target parameter corresponding to the unit time, the priority corresponding to each unit time in the first combination time information, and the priority corresponding to each unit time in the second combination time information, respectively. It can be understood that, since the end time information in the first combination time information and the second combination 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.

Firstly, the start time information in the first combination time information and the second combination time information is merged, and the specific process is as follows: detecting two unit times with the same time unit (one unit time belongs to the starting time information in the first combination time information, and one unit time belongs to the starting time information in the second combination time information), if the time types of the two unit times have different priorities; or, if the time types of the two unit times are all any precise time types; or, if the time types of the two unit times are both absolute precise time types and the values of the two unit time information are the same, it indicates that the two unit times satisfy the merging condition. The two start time information can be merged only when all the unit times satisfy the merging condition. In the merging, the unit time with the higher priority is extracted from the two unit times as the auxiliary unit time, and in this way, a plurality of auxiliary unit times can be obtained and combined into merging start time information according to the time unit sequence.

Similarly to the merging start time information, it is also possible to extract a unit time with a higher priority from the priorities of the time units in the end time information, and combine a plurality of unit times with a higher priority into the auxiliary end time information.

And determining the minimum time range from the time range corresponding to the first combination time information and the time range corresponding to the second combination time information as a target time range. It can be known that, here, the time range corresponding to the first combination time information is the target parameter (i.e. the second parameter in the foregoing) belonging to the time range attribute, among the plurality of target parameters corresponding to the first combination time information; similarly, the time range corresponding to the second combination time information is the target parameter belonging to the time range attribute among the plurality of target parameters corresponding to the second combination time information.

If the time range between the merging start time information and the auxiliary end time information is less than or equal to the target time range, the terminal may directly determine the auxiliary end time information as the merging end time information; if the time range between the merging 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 merging end time information, so that the time range between the merging start time information and the merging end time information (adjusted auxiliary end time information) is equal to the target time range.

And the terminal combines the merging start time information and the merging end time information into first statistical time information. If there is still uncombined combination time information, the combination time information may be re-combined based on the first statistical time information and the uncombined combination time information, and new first statistical time information may be obtained again. The terminal takes the first statistic time information obtained by the final combination as target time information; or the terminal determines the first statistic time information obtained by the final combination and the combination time information with unsuccessful combination as the target time information.

For example, the target text is: in the festival of the national day of the next year, the target sub-text 1 is: the 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 combination time information (also referred to as first combination time information) is: (2020/1/1/1:1:1, 2021/1/1/1:1:1). Target sub-text 2 is: festival of 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 combination time information (also referred to as second combination 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 satisfies the merging condition, and therefore, the merging start time information can be obtained: 2020/10/1/0:0:0, auxiliary end time information: 2021/10/2/0:0:0. Since the time range (1 year) of the first combination time information is smaller than the time range (1 day) of the second combination time information, the target time range is 1 day. And the time range between the merging start time information '2020/10/1/0: 0: 0' and the supplementary end time information '2021/10/2/0: 0: 0' is 1 year, so that the supplementary end time information needs to be adjusted such that the time range between the adjusted time information and the merging start time information is 1 day, that is, the adjusted supplementary end time information is: 2020/10/2/0:0:0, i.e., the merge 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 target time information.

Optionally, the combining may be performed according to a priority of the time type, and a plurality of pieces of combination time information may be combined according to the connection character. And if the number of the combination time information is more than one and the target text has the connection character, extracting the connection character. The connection character may be: "to", "- -", etc. And combining two pieces of combined time information corresponding to the target sub-texts adjacent to the connection characters in the target text into one piece of time information, which is called second statistical time information. The terminal takes the second statistical time information obtained by combination as target time information; or the terminal determines the second statistical time information obtained by merging and the combination time information which can not be merged (namely, the target sub-text corresponding to the combination time information is not adjacent to the connection character) as the target time information.

For example, the target text is: from 1 month 10 in 2019 to 7 month 10 in 2019, two pieces of combined time information can be identified, which are respectively: (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 two pieces of combined time information may be combined into second statistical time information: (2019/10/1/0:0:0, 2020/10/8/0:0:0), and the second statistical time information is also target time information.

It should be noted that, except for the above mentioned target time information obtaining manner, the terminal may further merge a plurality of pieces of combination time information according to the priority, and then further merge the pieces of combination time information again according to the connection character to obtain the target time information; or merging a plurality of combination time information according to the connection characters, and then merging again according to the priority to obtain the target time information. That is, merging according to priority and merging according to the concatenated characters may be separately and independently performed to obtain the target time information, respectively, or may be performed sequentially to obtain the target time information.

Optionally, the target text is semantically identified to obtain semantic information, which is called target semantic information. The terminal acquires a service interface (called a target service interface) corresponding to the target semantic information, and takes the identified target time information as an interface parameter of the target service interface. And transferring the interface parameters to a target service interface, and calling the target service interface to enable the interface to provide the application service corresponding to the target service interface.

Fig. 6 is a schematic flow chart of another time identification method according to an embodiment of the present invention. The time identification method comprises the following steps:

step S301, a target text is obtained.

Step S302, the chinese numerical information in the target text is converted into ASCII numerical information.

Specifically, a target text to be recognized is obtained, and the chinese numerical information in the target text is converted into ASCII numerical information, that is, into an arabic numerical value.

In step S303, the pattern manager extracts time information in the target text as combination time information.

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

Step S3031, traversing all items.

Step S3032, whether there is an Item matching the target text.

Specifically, the mode manager traverses all items, searches for an Item matching the target text, and if an Item matching the target text exists, executes the following step S3033; if not, go to step S3039. The mode manager traverses all items, and the process of finding items matching the target text can refer to step S102 in the corresponding embodiment of fig. 3.

Step S3033, determining the starting time information according to the reference time information and the time configuration mode corresponding to the searched Item.

Step S3034, generating an end time according to the parameter corresponding to the time range attribute and the start time information.

Specifically, according to the found Item, a plurality of original parameters included in the time configuration mode corresponding to the Item are determined, and the reference time is determined by the plurality of original parameters. And determining a plurality of target parameters according to the plurality of original parameters and the target text. Determining a start time based on the plurality of target parameters and the reference time. And extracting target parameters belonging to the time range attribute, and determining the ending time according to the target parameters and the starting time. The specific process of determining the reference time, the start time, and the end time may refer to steps S103 to S104 in the corresponding embodiment of fig. 3.

Step S3035, whether the lunar calendar conversion is required.

In step S3036, the start time and the end time are converted, respectively.

Specifically, according to the found matched Item, determining whether the start time and the end time need the lunar calendar conversion, if the lunar calendar conversion is not needed, executing step S3037; if the lunar calendar conversion is needed, the start time and the end time are respectively converted according to the calendar file. The specific process of the conversion can be referred to step S204 in the corresponding embodiment of fig. 5.

Step 3037, whether festival formatting is required.

Step S3038 performs a holiday formatting process on the converted start time and end time, respectively.

Specifically, according to the found matched Item, whether the converted start time and end time need holiday formatting is determined, and if holiday formatting is not needed, step S3039 is executed; if the festival formatting process is needed, the festival formatting process is carried out on the converted starting time and ending time of the calendar file. The specific process of the festival formatting process can be referred to step S204 in the corresponding embodiment of fig. 5.

Step S3039, recording the target sub-text in the target text, and returning the result.

Specifically, the character sequence successfully matched in the target text and the position of the character sequence in the target text are recorded, and the identified time information and position are returned.

Step S304, whether the time information is successfully extracted is detected.

Specifically, it is detected whether the time information is successfully extracted, if not, step S307 is executed, and if so, step S305 is executed.

In step S305, it is detected whether there is any time that is not merged.

Step S306, the identified plurality of times are combined.

Specifically, whether time which is not combined exists is detected, and if the time which is not combined exists, combining of a plurality of times is tried; if not, executing step S303, the mode manager traverses all items again, finds an Item matching the target text, and extracts the next chinese time information in the target text again. The specific process of merging multiple times may refer to step S205 in the embodiment corresponding to fig. 5.

Step S307 returns the result.

And storing the time information identified from the target text, and transmitting the time information to the application system.

Therefore, the reference time is determined through the time configuration mode and is adjusted on the basis of the reference time, so that the accurate time expressed in the text can be obtained after the reference time is adjusted no matter the Chinese time information in the text is relative time or absolute time, and the accuracy of identifying the Chinese time information in the text can be improved.

Further, please refer to fig. 7, which is a schematic structural diagram of a time identification apparatus according to an embodiment of the present invention. As shown in fig. 7, the time identification apparatus 1 may be applied to the terminal in the corresponding embodiment of fig. 3 to 6, and the time identification apparatus 1 may include: the device comprises an acquisition module 11, a matching module 12, a determination module 13 and a generation module 14.

The acquisition module 11 is configured to acquire a target text and acquire at least one time mode; each temporal pattern includes: a temporal text mode and a temporal configuration mode;

a matching module 12, configured to select a temporal text pattern matching at least one target sub-text in the target text;

the obtaining module 11 is further configured to determine a time pattern to which the matched time text pattern belongs as a target time pattern;

a determining module 13, configured to determine reference time information according to a time configuration mode in the target time mode;

and a generating module 14, configured to generate target time information matched with the target text according to the reference time information and a time configuration mode in the target time mode.

For specific functional implementation manners of the obtaining module 11, the matching module 12, the determining module 13, and the generating module 14, reference may be made to steps S101 to S104 in the embodiment corresponding to fig. 3, which is not described herein again.

Referring to fig. 7, the matching module 12 may include: a conversion unit 121 and a search unit 122.

A conversion unit 121, configured to convert a first character sequence belonging to a first numerical type in the target text into a second character sequence belonging to a second numerical type, so as to obtain a text to be matched; numerical value information corresponding to the first character sequence is the same as numerical value information corresponding to the second character sequence;

the searching unit 122 is configured to search at least one character sequence matched with a temporal text pattern in the text to be matched, use the searched character sequence as the target sub-text, and use the searched temporal text pattern as the temporal text pattern matched with the target sub-text.

For specific functional implementation manners of the conversion unit 121 and the search unit 122, reference may be made to step S102 in the embodiment corresponding to fig. 3, which is not described herein again.

Referring to fig. 7, the determining module 13 may include: extraction unit 131, acquisition unit 132.

An extracting unit 131, configured to extract a plurality of original parameters included in a time configuration pattern in the target time pattern;

the extracting unit 131 is further configured to use, as an auxiliary parameter, an original parameter belonging to a time unit attribute among the plurality of original parameters;

an obtaining unit 132, configured to obtain 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;

the obtaining unit 132 is further configured to determine, if the time types of the auxiliary parameters are all accurate time types, original time information that is a null value as the reference time information.

For specific functional implementation manners of the extracting unit 131 and the obtaining unit 132, reference may be made to step S103 in the embodiment corresponding to fig. 3, which is not described herein again.

Referring to fig. 7, the generating module 14 may include: a first generating unit 141 and a second generating unit 142.

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

a second generating unit 142, configured to perform offset processing on the reference time information according to the multiple target parameters, so as to obtain target time information.

For specific functional implementation manners of the first generating unit 141 and the second generating unit 142, reference may be made to step S104 in the embodiment corresponding to fig. 3, which is not described herein again.

Referring to fig. 7, the first generating unit 141 may include: an extraction sub-unit 1411, a replacement sub-unit 1412.

An extracting subunit 1411, configured to determine the multiple original parameters as the multiple target parameters if a temporal text pattern in the target temporal pattern does not include a numeric wildcard;

a replacing subunit 1412, configured to, if a time text mode in the target time mode includes the numerical wildcard, obtain numerical information corresponding to the numerical wildcard in a target sub-text in the target text, extract an original parameter corresponding to the numerical wildcard from the multiple original parameters, replace the extracted original parameter with the numerical information obtained in the target sub-text, and generate the multiple target parameters according to the replaced multiple original parameters.

The specific functional implementation manners of the extracting sub-unit 1411 and the replacing sub-unit 1412 may refer to step S104 in the embodiment corresponding to fig. 3, which is not described herein again.

Referring to fig. 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.

A first determining subunit 1421 that determines, as a first parameter, a target parameter belonging to the time unit attribute, among the plurality of target parameters;

a second determining subunit 1422, configured to perform offset processing on the multiple unit reference time information according to the time unit corresponding to the first parameter, respectively, to obtain start time information; the reference time information includes unit reference time information corresponding to a plurality of time units, respectively;

the first determining subunit 1421 is further configured to extract, from the multiple target parameters, a target parameter that belongs to a time range attribute, as a second parameter, and generate end time information according to the second parameter and the start time information;

a combining subunit 1423, configured to perform combining processing on the start time information and the end time information to obtain combined time information;

a first generating subunit 1424, configured to generate the target time information according to the combined time information.

For specific functional implementation manners of the first determining subunit 1421, the second determining subunit 1422, the combining subunit 1423, and the first generating subunit 1424, reference may be made to steps S201 to S205 in the embodiment corresponding to fig. 5, which is not described herein again.

Referring to fig. 7, the second determining subunit 1422 may include: an acquisition subunit 14221 and a second generation subunit 14222.

An acquiring subunit 14221, configured to extract any unit reference time information from the multiple unit reference time information as target unit reference time information;

the obtaining sub-unit 14221 is further configured to extract, from the first parameters, first sub-parameters having the same time unit as the target unit reference time information, as target first sub-parameters; the first parameter comprises a plurality of first sub-parameters;

a second generating sub-unit 14222, configured to generate unit start time information according to the target first sub-parameter and the target unit reference time information;

the second generating sub-unit 14222 is further configured to, when each unit reference time information is determined as the target unit reference time information, sequentially combine a plurality of unit start time information into the start time information in a time unit.

For specific functional implementation manners of the obtaining subunit 14221 and the second generating subunit 14222, refer to step S202 in the embodiment corresponding to fig. 5, which is not described herein again.

Referring to fig. 7, the combining subunit 1423 may include: a first combining subunit 14231 and a first converting subunit 14232.

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

the first combining subunit 14231 is further configured to extract, from the multiple target parameters, a target parameter that belongs to a time conversion attribute, as a third parameter, and determine a conversion type corresponding to the third parameter;

a first converting subunit 14232, configured to determine, if the conversion type belongs to a first conversion type, the first time information as the combined time information;

the first converting subunit 14232 is further configured to, if the conversion type is the second conversion type, search, in a calendar file, time information having the same date as the first time information, as the combined time information.

For specific functional implementation manners of the first combining subunit 14231 and the first converting subunit 14232, refer to step S204 in the embodiment corresponding to fig. 5, which is not described herein again.

Referring to fig. 7, the combining subunit 1423 may include: a second combining subunit 14233 and a second converting subunit 14234.

A second combining subunit 14233, configured to combine the start time information and the end time information into second time information;

the second combining subunit 14233 is further configured to extract, from the multiple target parameters, a target parameter that belongs to a festival formatting attribute, as a fourth parameter, and determine a festival formatting type corresponding to the fourth parameter;

a second converting subunit 14234, configured to determine, if the holiday formatting type belongs to the first formatting type, that the second time information is the combined time information;

the second converting subunit 14234 is further configured to, if the holiday formatting type belongs to a second formatting type, search, in the calendar file, time information corresponding to a time text mode in the target time mode, update the second time information according to the time information corresponding to the time text mode in the target time mode, and determine the updated second time information as the combined time information.

For specific functional implementation manners of the second combining subunit 14233 and the second converting subunit 14234, refer to step S204 in the embodiment corresponding to fig. 5, which is not described herein again.

It should be understood that the terminal may determine the combination time information through the first combination subunit 14231, the first conversion subunit 14232; the combination time information may also be determined by the second combination subunit 14233 and the second conversion subunit 14234; the combination time information may also be determined by the first combining subunit 14231, the first converting subunit 14232, the second combining subunit 14233, and the second converting subunit 14234 together.

Referring to fig. 7, the first generating subunit 1424 may include: a third determining sub-unit 14241, a first merging sub-unit 14242.

A third determining subunit 14241, configured to, when the number of the combination time information is multiple, use the combination time information corresponding to the target sub-text that is adjacent in position in the target text as the first combination time information and the second combination time information; the combined time information includes unit times respectively corresponding to a plurality of time units;

the third determining subunit 14241 is further configured to extract, from the multiple target parameters corresponding to the first combination time information, a time type of a target parameter belonging to a time unit attribute, and extract, from the multiple target parameters corresponding to the second combination time information, a time type of a target parameter belonging to a time unit attribute;

the third determining subunit 14241 is further configured to determine, according to the extracted time type, a priority corresponding to each unit time in the first combination time information, and a priority corresponding to each unit time in the second combination time information;

the third determining subunit 14241 is further configured to select a minimum time range from the time range corresponding to the first combination time information and the time range corresponding to the second combination time information, as a target time range;

a first combining sub-unit 14242, configured to combine the first combination time information and the second combination time information into first statistical time information according to the priority and the target time range;

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

For specific functional implementation manners of the third determining sub-unit 14241 and the first combining sub-unit 14242, reference may be made to step S205 in the embodiment corresponding to fig. 5, which is not described herein again.

Referring to fig. 7, the first generating subunit 1424 may include: a fourth determining sub-unit 14243, a second merging sub-unit 14244.

A fourth determining subunit 14243, configured to, when the number of the combination time information is multiple, extract a connection character in the target text;

a second merging subunit 14244, configured to merge the combination time information corresponding to the target sub-text adjacent to the connection character in the target text into second statistical time information;

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

The specific functional implementation manners of the fourth determining subunit 14243 and the second merging subunit 14244 may refer to step S205 in the embodiment corresponding to fig. 5, which is not described herein again.

It is to be understood that the terminal may determine the target time information through the third determining sub-unit 14241, the first merging sub-unit 14242; the target time information may also be determined by the fourth determining sub-unit 14243, the second merging sub-unit 14244; the target time information may also be determined by the third determining sub-unit 14241, the first merging sub-unit 14242, and the fourth determining sub-unit 14243, the second merging sub-unit 14244 together.

Referring to fig. 7, the time recognition apparatus 1 may include: the device comprises an acquisition module 11, a matching module 12, a determination module 13 and a generation module 14; the method can also comprise the following steps: a semantic recognition module 15 and a calling module 16.

The semantic recognition module 15 is used for recognizing the target text semantically to obtain target semantic information;

the semantic recognition module 15 is further configured to 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;

and the calling module 16 is configured to call an application service corresponding to the target service interface based on the target service interface and the interface parameter.

The specific functional implementation manner of the semantic identifying module 15 and the invoking module 16 may refer to step S205 in the embodiment corresponding to fig. 5, which is not described herein again.

Further, please refer to fig. 8, which is a schematic structural diagram of an electronic device according to an embodiment of the present invention. The terminal in the embodiments corresponding to fig. 3 to fig. 6 may be an electronic device 1000, as shown in fig. 8, where the electronic device 1000 may include: a user interface 1002, a processor 1004, an encoder 1006, and a memory 1008. Signal receiver 1016 is used to receive or transmit data via cellular interface 1010, WIFI interface 1012. The encoder 1006 encodes the received data into a computer-processed data format. The memory 1008 has stored therein a computer program by which the processor 1004 is arranged to perform the steps of any of the method embodiments described above. The memory 1008 may include volatile memory (e.g., dynamic random access memory DRAM) and may also include non-volatile memory (e.g., one time programmable read only memory OTPROM). In some examples, the memory 1008 can further include memory located remotely from the processor 1004, which can be connected to the electronic device 1000 via a network. The user interface 1002 may include: a keyboard 1018, and a display 1020.

In the electronic device 1000 shown in fig. 8, the processor 1004 may be configured to call the memory 1008 to store a computer program to implement:

acquiring a target text and acquiring at least one time mode; each temporal pattern includes: a temporal text mode and a temporal configuration mode;

selecting a time text mode matched with at least one target subfile in the target text, and determining the time mode to which the matched time text mode belongs as a target time mode;

determining reference time information according to a time configuration mode in the target time mode;

and generating target time information matched with the target text according to the reference time information and a time configuration mode in the target time mode.

It should be understood that the electronic device 1000 described in the embodiment of the present invention may perform the description of the time identification method in the embodiment corresponding to fig. 3 to fig. 6, and may also perform the description of the time identification apparatus 1 in the embodiment corresponding to fig. 7, which is not described herein again. In addition, the beneficial effects of the same method are not described in detail.

Further, here, it is to be noted that: an embodiment of the present invention further provides a computer storage medium, where the computer storage medium stores the aforementioned computer program executed by the time identification apparatus 1, and the computer program includes program instructions, and when the processor executes the program instructions, the description of the time identification method in the embodiment corresponding to fig. 3 to fig. 6 can be performed, so that details are not repeated here. In addition, the beneficial effects of the same method are not described in detail. For technical details not disclosed in the embodiments of the computer storage medium to which the present invention relates, reference is made to the description of the method embodiments of the present invention.

It will be understood by those skilled in the art that all or part of the processes of the methods of the embodiments described above can be implemented by a computer program, which can be stored in a computer-readable storage medium, and when executed, can include the processes of the embodiments of the methods described above. The storage medium may be a magnetic disk, an optical disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), or the like.

The above disclosure is only for the purpose of illustrating the preferred embodiments of the present invention, and it is therefore to be understood that the invention is not limited by the scope of the appended claims.

38页详细技术资料下载
上一篇:一种医用注射器针头装配设备
下一篇:语境化文本描述

网友询问留言

已有0条留言

还没有人留言评论。精彩留言会获得点赞!

精彩留言,会给你点赞!