CN114861678A - Method and apparatus for determining time information, storage medium, and electronic apparatus - Google Patents
Method and apparatus for determining time information, storage medium, and electronic apparatus Download PDFInfo
- Publication number
- CN114861678A CN114861678A CN202210327295.8A CN202210327295A CN114861678A CN 114861678 A CN114861678 A CN 114861678A CN 202210327295 A CN202210327295 A CN 202210327295A CN 114861678 A CN114861678 A CN 114861678A
- Authority
- CN
- China
- Prior art keywords
- time
- information
- phrase
- determining
- operator
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
- 238000000034 method Methods 0.000 title claims abstract description 47
- 230000014509 gene expression Effects 0.000 claims abstract description 51
- 238000013507 mapping Methods 0.000 claims abstract description 47
- 230000003993 interaction Effects 0.000 claims abstract description 17
- 238000000605 extraction Methods 0.000 claims description 14
- 230000002123 temporal effect Effects 0.000 claims description 11
- 238000004590 computer program Methods 0.000 claims description 9
- 230000009471 action Effects 0.000 claims description 8
- 238000010586 diagram Methods 0.000 description 6
- 238000012423 maintenance Methods 0.000 description 6
- 238000005516 engineering process Methods 0.000 description 5
- 230000008569 process Effects 0.000 description 3
- 230000005540 biological transmission Effects 0.000 description 2
- 238000012986 modification Methods 0.000 description 2
- 230000004048 modification Effects 0.000 description 2
- 230000003287 optical effect Effects 0.000 description 2
- 238000005406 washing Methods 0.000 description 2
- XLYOFNOQVPJJNP-UHFFFAOYSA-N water Substances O XLYOFNOQVPJJNP-UHFFFAOYSA-N 0.000 description 2
- RZVAJINKPMORJF-UHFFFAOYSA-N Acetaminophen Chemical compound CC(=O)NC1=CC=C(O)C=C1 RZVAJINKPMORJF-UHFFFAOYSA-N 0.000 description 1
- 238000004887 air purification Methods 0.000 description 1
- 235000019504 cigarettes Nutrition 0.000 description 1
- 238000013500 data storage Methods 0.000 description 1
- 230000006870 function Effects 0.000 description 1
- 238000010408 sweeping Methods 0.000 description 1
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F40/00—Handling natural language data
- G06F40/30—Semantic analysis
- G06F40/35—Discourse or dialogue representation
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/30—Information retrieval; Database structures therefor; File system structures therefor of unstructured textual data
- G06F16/33—Querying
- G06F16/3331—Query processing
- G06F16/334—Query execution
- G06F16/3344—Query execution using natural language analysis
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F40/00—Handling natural language data
- G06F40/20—Natural language analysis
- G06F40/279—Recognition of textual entities
- G06F40/289—Phrasal analysis, e.g. finite state techniques or chunking
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- Computational Linguistics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Artificial Intelligence (AREA)
- Audiology, Speech & Language Pathology (AREA)
- General Health & Medical Sciences (AREA)
- Health & Medical Sciences (AREA)
- Data Mining & Analysis (AREA)
- Databases & Information Systems (AREA)
- Management, Administration, Business Operations System, And Electronic Commerce (AREA)
Abstract
The application discloses a method and a device for determining time information, a storage medium and an electronic device, which relate to the technical field of smart families, and the method comprises the following steps: acquiring first voice information through a voice interaction device, and acquiring first text information matched with the first voice information; extracting a time phrase in the first text information through a first regular expression; determining a first time operator corresponding to the time phrase in a time operator configuration file, and mapping the time phrase to the first time operator, wherein the time operator configuration file comprises: a plurality of time operators; and determining standard time information corresponding to the time phrase according to the current time and the first time operator mapped with the time phrase.
Description
Technical Field
The present invention relates to the field of communications, and in particular, to a method and an apparatus for determining time information, a storage medium, and an electronic apparatus.
Background
The extraction of time entities has been an essential component of dialog systems, however this task is difficult because of the diversity and liberty of spoken language expressions. In a general system implementation, the extraction of time phrases is enriched with a large amount of logical judgment code and is very difficult to maintain.
In a dialogue system, the extraction of a time entity is generally divided into two parts, and in the first step, the extraction of a time phrase can be extracted through a ner model or a regular expression. In the second step, the time phrases are mapped to standard protocols. But because the expression of temporal phrases is varied and includes context inference and disambiguation, such as: "four points in five minutes" and "eight am after three days", the general implementation scheme is realized by writing the rule code by enumerating various conditions, but the current implementation mode of writing the rule code is very difficult to maintain, and in a system developed by multiple persons at the same time, the consistency of the code style is difficult to maintain, and finally, the readability and the robustness of the rule code are extremely poor.
Aiming at the problems that in the related technology, the time phrases are mapped to the standard protocol through the realization of writing the rule codes at present, the maintenance is very difficult, the consistency of the code style is difficult to keep in a system developed by a plurality of persons at the same time, and finally the readability, the robustness and the like of the rule codes are extremely poor, and an effective solution is not provided yet.
Disclosure of Invention
The embodiment of the invention provides a method and a device for determining time information, a storage medium and an electronic device, which are used for at least solving the problems that in the related technology, the current implementation of writing rule codes maps time phrases to standard protocols, so that the maintenance is very difficult, and in a system developed by multiple persons at the same time, the consistency of code styles is difficult to maintain, and finally, the readability and robustness of the rule codes are extremely poor.
According to an embodiment of the present invention, there is provided a method for determining time information, including: acquiring first voice information through a voice interaction device, and acquiring first text information matched with the first voice information; extracting a time phrase in the first text information through a first regular expression; determining a first time operator corresponding to the time phrase in a time operator configuration file, and mapping the time phrase to the first time operator, wherein the time operator configuration file comprises: a plurality of temporal operators; and determining standard time information corresponding to the time phrase according to the current time and the first time operator mapped with the time phrase.
In an exemplary embodiment, before extracting the time phrase in the first text information through the first regular expression, the method further comprises: acquiring first key information of the first text information through a keyword extraction model; determining a first mapping relation corresponding to the first key information according to a pre-established mapping relation table, wherein the mapping relation table is used for indicating the mapping relation between the key information and a regular expression; determining the first regular expression in a regular expression set according to the first mapping relation.
In an exemplary embodiment, determining a first time operator corresponding to the time phrase in a time operator profile and mapping the time phrase to the first time operator comprises: segmenting the time phrases to obtain a plurality of sub-time phrases, wherein one sub-time phrase is used for indicating time information of one time unit; determining a plurality of sub first time operators corresponding to the plurality of sub time phrases in a time operator configuration file, and mapping the plurality of sub time phrases to the plurality of sub first time operators respectively.
In an exemplary embodiment, the determining the standard time information corresponding to the time phrase according to the current time and the first time operator includes at least one of: under the condition that the first time operator is used for indicating the set date information, determining standard date information corresponding to the time phrase according to the current time and the first time operator; and under the condition that the first time operator is used for indicating to set clock information, determining standard clock information corresponding to the time phrase according to the current time and the first time operator.
In an exemplary embodiment, after determining the standard time information corresponding to the time phrase according to the current time and the first time operator, the method further includes: determining the travel information of the target object according to the first text information; and sending prompt information to a target object according to the standard time information and the travel information, wherein the prompt information is used for prompting the target object to execute an action corresponding to the travel information.
In an exemplary embodiment, after determining the standard time information corresponding to the time phrase according to the current time and the first time operator, the method further includes: acquiring second voice information through a voice interaction device, and acquiring second text information matched with the second voice information; determining whether the first text information and the second text information are consistent; under the condition that the first text information is consistent with the second text information, respectively acquiring first characteristic information of the first voice information and second characteristic information of the second voice information; and determining whether to extract the time phrases in the second text information through a second regular expression according to whether the first characteristic information and the second characteristic information are consistent.
In an exemplary embodiment, determining whether to extract a time phrase in the second text information through a second regular expression according to whether the first feature information and the second feature information are consistent comprises: under the condition that the first characteristic information and the second characteristic information are consistent, extracting time phrases in the second text information without a second regular expression; and under the condition that the first characteristic information and the second characteristic information are inconsistent, extracting a time phrase in the second text information through a second regular expression.
According to another embodiment of the present invention, there is also provided a device for determining time information, including: the acquisition module is used for acquiring first voice information through a voice interaction device and acquiring first text information matched with the first voice information; the extraction module is used for extracting the time phrases in the first text information through a first regular expression; a mapping module, configured to determine a first time operator corresponding to the time phrase in a time operator configuration file, and map the time phrase to the first time operator, where the time operator configuration file includes: a plurality of time operators; and the determining module is used for determining the standard time information corresponding to the time phrase according to the current time and the first time operator mapped with the time phrase.
According to still another aspect of the embodiments of the present invention, there is also provided a computer-readable storage medium having a computer program stored therein, wherein the computer program is configured to execute the above-mentioned method for determining time information when running.
According to another aspect of the embodiments of the present invention, there is also provided an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the method for determining the time information through the computer program.
In the embodiment of the invention, first voice information is acquired through a voice interaction device, and first text information matched with the first voice information is acquired; extracting a time phrase in the first text information through a first regular expression; determining a first time operator corresponding to the time phrase in a time operator configuration file, and mapping the time phrase to the first time operator, wherein the time operator configuration file comprises: a plurality of time operators; determining standard time information corresponding to the time phrase according to the current time and a first time operator mapped with the time phrase; by adopting the technical scheme, the problems that the time phrases are mapped to the standard protocol by writing the rule codes at present, the maintenance is very difficult, the consistency of the code styles is difficult to keep in a system developed by multiple persons at the same time, and finally the readability and the robustness of the rule codes are extremely poor are solved.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and together with the description, serve to explain the principles of the application.
In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings needed to be used in the description of the embodiments or the prior art will be briefly described below, and it is obvious for those skilled in the art to obtain other drawings without inventive exercise.
FIG. 1 is a diagram illustrating a hardware environment for a method for determining time information according to an embodiment of the present application;
fig. 2 is a flowchart of a method of determining time information according to an embodiment of the present invention;
fig. 3 is a schematic diagram of a method of determining time information according to an embodiment of the present invention;
fig. 4 is a block diagram (one) of a time information determining apparatus according to an embodiment of the present invention;
fig. 5 is a block diagram (ii) of a time information determination apparatus according to an embodiment of the present invention.
Detailed Description
In order to make the technical solutions better understood by those skilled in the art, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are only partial embodiments of the present application, but not all 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 application.
It should be noted that the terms "first," "second," and the like in the description and claims of this application and in the drawings described above are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used is interchangeable under appropriate circumstances such that the embodiments of the application described herein are capable of operation in sequences other than those illustrated or described herein. Furthermore, the terms "comprises," "comprising," and "having," and any variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, system, article, or apparatus that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed, but may include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus.
According to an aspect of an embodiment of the present application, there is provided a method for determining time information. The method for determining the time information is widely applied to full-house intelligent digital control application scenes such as Smart homes (Smart Home), intelligent homes, intelligent household equipment ecology, intelligent house (Intellignee House) ecology and the like. Alternatively, in this embodiment, the above-described method for determining time information may be applied to a hardware environment formed by the terminal device 102 and the server 104 as shown in fig. 1. As shown in fig. 1, the server 104 is connected to the terminal device 102 through a network, and may be configured to provide a service (e.g., an application service) for the terminal or a client installed on the terminal, set a database on the server or independent of the server, and provide a data storage service for the server 104, and configure a cloud computing and/or edge computing service on the server or independent of the server, and provide a data operation service for the server 104.
The network may include, but is not limited to, at least one of: wired networks, wireless networks. The wired network may include, but is not limited to, at least one of: wide area networks, metropolitan area networks, local area networks, which may include, but are not limited to, at least one of the following: WIFI (Wireless Fidelity), bluetooth. Terminal equipment 102 can be but not limited to be PC, the cell-phone, the panel computer, intelligent air conditioner, intelligent cigarette machine, intelligent refrigerator, intelligent oven, intelligent kitchen range, intelligent washing machine, intelligent water heater, intelligent washing equipment, intelligent dish washer, intelligent projection equipment, intelligent TV, intelligent clothes hanger, intelligent (window) curtain, intelligence audio-visual, smart jack, intelligent stereo set, intelligent audio amplifier, intelligent new trend equipment, intelligent kitchen guarding equipment, intelligent bathroom equipment, intelligence robot of sweeping the floor, intelligence robot of wiping the window, intelligence robot of mopping the ground, intelligent air purification equipment, intelligent steam ager, intelligent microwave oven, intelligent kitchen is precious, intelligent clarifier, intelligent water dispenser, intelligent lock etc..
In this embodiment, a method for determining time information is provided, and is applied to the above-mentioned computer terminal, and fig. 2 is a flowchart of a method for determining time information according to an embodiment of the present invention, where the flowchart includes the following steps:
step S202, acquiring first voice information through a voice interaction device, and acquiring first text information matched with the first voice information;
step S204, extracting a time phrase in the first text message through a first regular expression;
step S206, determining a first time operator corresponding to the time phrase in a time operator configuration file, and mapping the time phrase to the first time operator, wherein the time operator configuration file comprises: a plurality of temporal operators;
step S208, determining standard time information corresponding to the time phrase according to the current time and the first time operator mapped with the time phrase.
Through the steps, first voice information is obtained through a voice interaction device, and first text information matched with the first voice information is obtained; extracting time phrases in the first text information through a first regular expression; determining a first time operator corresponding to the time phrase in a time operator configuration file, and mapping the time phrase to the first time operator, wherein the time operator configuration file comprises: a plurality of temporal operators; the method and the device for extracting the time phrase from the time extraction system determine the standard time information corresponding to the time phrase according to the current time and the first time operator mapped with the time phrase, solve the problems that in the related technology, the time phrase is mapped to a standard protocol through the realization of writing a rule code at present, the maintenance is very difficult, and the consistency of the code style is difficult to maintain in a system developed by multiple persons at the same time, and finally the readability, the robustness and the like of the rule code are extremely poor.
It should be noted that, the preset definition time operator configuration file is as follows:
in an exemplary embodiment, before extracting a time phrase in the first text information through a first regular expression, first key information of the first text information is obtained through a keyword extraction model; determining a first mapping relation corresponding to the first key information according to a pre-established mapping relation table, wherein the mapping relation table is used for indicating the mapping relation between the key information and a regular expression; determining the first regular expression in a regular expression set according to the first mapping relationship.
That is, the server stores a mapping relation table of mapping relations between the key information and the regular expressions, determines type information of the first text information (that is, the key information) when the first text information corresponding to the first voice information is acquired, and determines the corresponding regular expression according to the type information of the first text information.
In an exemplary embodiment, determining a first time operator corresponding to the time phrase in a time operator profile and mapping the time phrase to the first time operator comprises: segmenting the time phrases to obtain a plurality of sub-time phrases, wherein one sub-time phrase is used for indicating time information of one time unit; and determining a plurality of sub first time operators corresponding to the plurality of sub time phrases in a time operator configuration file, and mapping the plurality of sub time phrases to the plurality of sub first time operators respectively.
That is, the obtained time phrases are segmented such that each sub-time phrase is only used to indicate time information of one time unit, for example, the time phrase "eight points fifty" is segmented to obtain two sub-time phrases "eight" time and "fifty" minute, and we can map the two sub-time phrases "eight" time and "fifty" minute to two time operators setHours and setMinutes, respectively.
In an exemplary embodiment, the determining the standard time information corresponding to the time phrase according to the current time and the first time operator includes at least one of: under the condition that the first time operator is used for indicating the set date information, determining standard date information corresponding to the time phrase according to the current time and the first time operator; and under the condition that the first time operator is used for indicating to set clock information, determining standard clock information corresponding to the time phrase according to the current time and the first time operator.
For example, when the first text information is "go to date six afternoon after three days", the time phrase "go to date six afternoon after three days" is segmented to obtain three sub-time phrases "three days later", "afternoon" and "six hours", and then we can map two sub-time phrases "three days later", "afternoon" and "six hours" to three time operators shiftDays, setporioofday and setHours, respectively, and determine "six afternoon after three days" as "18: 00 at 1 month 2022" according to the three time operators and the current time (e.g. 1 day 1 month 1 year 2022).
In an exemplary embodiment, after determining the standard time information corresponding to the time phrase according to the current time and the first time operator, determining the travel information of the target object according to the first text information; and sending prompt information to a target object according to the standard time information and the travel information, wherein the prompt information is used for prompting the target object to execute an action corresponding to the travel information.
That is to say, the travel information of the target object is determined according to the first text information, and when the target object needs to execute the action in the travel information, the target object is reminded to execute the action corresponding to the travel information at a preset time before the travel information.
In an exemplary embodiment, after determining standard time information corresponding to the time phrase according to the current time and the first time operator, acquiring second voice information through a voice interaction device, and acquiring second text information matched with the second voice information; determining whether the first text information is consistent with the second text information; under the condition that the first text information is consistent with the second text information, respectively acquiring first characteristic information of the first voice information and second characteristic information of the second voice information; and determining whether to extract the time phrases in the second text information through a second regular expression according to whether the first characteristic information and the second characteristic information are consistent.
That is to say, under the condition that the second voice information is acquired, whether the first voice information is consistent with the second voice information is determined, under the condition that the first voice information is consistent with the second voice information, whether the first voice information and the second voice information are voices uttered by the same target object is determined according to the first feature information and the second feature information, and under the condition that the first voice information is not the voices uttered by the same target object, the time phrase in the second text information is extracted through a second regular expression.
Specifically, under the condition that the first characteristic information is consistent with the second characteristic information, the time phrase in the second text information is not extracted through a second regular expression; and under the condition that the first characteristic information and the second characteristic information are inconsistent, extracting a time phrase in the second text information through a second regular expression.
In order to better understand the process of the method for determining time information, the following describes a flow of a method for implementing the determination of time information with reference to an optional embodiment, but the flow is not limited to the technical solution of the embodiment of the present invention.
In this embodiment, a method for determining time information is provided, which includes:
step S301: defining operators, as shown in table 1 below;
TABLE 1
Step S302: mapping the temporal phrases to operators;
the embodiment of the invention carries out segmented mapping on the time phrases extracted by the ner to the operator through the regular expression, and takes the time phrases extracted by the ner to be 3 hours and 25 minutes later as an example, the embodiment of the invention defines the following rules:
by the rule, the 'after 3 hours and 25 minutes' can be mapped to shiftHours and shiftMinutes operators.
Step S303: and (5) merging operators.
Sometimes, the operators extracted according to the rule will mutually include each other in the whole time phrase, and the embodiment of the invention combines according to the longest matching principle. The extraction process is shown in fig. 3.
The embodiment of the invention obtains first voice information through a voice interaction device and obtains first text information matched with the first voice information; extracting a time phrase in the first text information through a first regular expression; determining a first time operator corresponding to the time phrase in a time operator configuration file, and mapping the time phrase to the first time operator, wherein the time operator configuration file comprises: a plurality of time operators; the method and the device for extracting the time of the time phrase in the time extraction system have the advantages that the standard time information corresponding to the time phrase is determined according to the current time and the first time operator mapped with the time phrase, the problems that in the related technology, the time phrase is mapped to a standard protocol through the implementation of writing a rule code at present, maintenance is very difficult, the code style is difficult to keep consistent in a system developed by multiple persons at the same time, and finally the readability and the robustness of the rule code are extremely poor are solved.
Through the above description of the embodiments, those skilled in the art can clearly understand that the method according to the above embodiments can be implemented by software plus a necessary general hardware platform, and certainly can also be implemented by hardware, but the former is a better implementation mode in many cases. Based on such understanding, the technical solutions of the present invention may be embodied in the form of a software product, which is stored in a storage medium (such as ROM/RAM, magnetic disk, optical disk) and includes instructions for enabling a terminal device (such as a mobile phone, a computer, a server, or a network device) to execute the method according to the embodiments of the present invention.
In this embodiment, a device for determining time information is further provided, and the device for determining time information is used to implement the foregoing embodiments and preferred embodiments, and details are not repeated after the description is given. As used below, the term "module" may be a combination of software and/or hardware that implements a predetermined function. Although the means described in the embodiments below are preferably implemented in software, an implementation in hardware, or a combination of software and hardware is also possible and contemplated.
Fig. 4 is a block diagram (one) of the structure of a time information determination apparatus according to an embodiment of the present invention; as shown in fig. 4, includes:
the acquiring module 42 is configured to acquire first voice information through a voice interaction device, and acquire first text information matched with the first voice information;
an extracting module 44, configured to extract a time phrase in the first text information through a first regular expression;
a mapping module 46, configured to determine a first time operator corresponding to the time phrase in a time operator configuration file, and map the time phrase to the first time operator, where the time operator configuration file includes: a plurality of time operators;
and the determining module 48 is configured to determine standard time information corresponding to the time phrase according to the current time and the first time operator mapped with the time phrase.
By the device, first voice information is obtained through a voice interaction device, and first text information matched with the first voice information is obtained; extracting a time phrase in the first text information through a first regular expression; determining a first time operator corresponding to the time phrase in a time operator configuration file, and mapping the time phrase to the first time operator, wherein the time operator configuration file comprises: a plurality of time operators; the method and the device for extracting the time of the time phrase in the time extraction system have the advantages that the standard time information corresponding to the time phrase is determined according to the current time and the first time operator mapped with the time phrase, the problems that in the related technology, the time phrase is mapped to a standard protocol through the implementation of writing a rule code at present, maintenance is very difficult, the code style is difficult to keep consistent in a system developed by multiple persons at the same time, and finally the readability and the robustness of the rule code are extremely poor are solved.
In an exemplary embodiment, the determining module is further configured to obtain first key information of the first text information through a keyword extraction model; determining a first mapping relation corresponding to the first key information according to a pre-established mapping relation table, wherein the mapping relation table is used for indicating the mapping relation between the key information and a regular expression; determining the first regular expression in a regular expression set according to the first mapping relationship.
That is, the server stores a mapping relation table of mapping relations between the key information and the regular expressions, determines type information of the first text information (that is, the key information) when the first text information corresponding to the first voice information is acquired, and determines the corresponding regular expression according to the type information of the first text information.
In an exemplary embodiment, the mapping module is further configured to segment the time phrases to obtain a plurality of sub-time phrases, where one of the sub-time phrases is used to indicate time information of one time unit; and determining a plurality of sub first time operators corresponding to the plurality of sub time phrases in a time operator configuration file, and mapping the plurality of sub time phrases to the plurality of sub first time operators respectively.
That is, the obtained time phrases are segmented such that each sub-time phrase is only used to indicate time information of one time unit, for example, the time phrase "eight points fifty" is segmented to obtain two sub-time phrases "eight" time and "fifty" minute, and we can map the two sub-time phrases "eight" time and "fifty" minute to two time operators setHours and setMinutes, respectively.
In an exemplary embodiment, the determining module is further configured to one of: under the condition that the first time operator is used for indicating the set date information, determining standard date information corresponding to the time phrase according to the current time and the first time operator; and under the condition that the first time operator is used for indicating to set clock information, determining standard clock information corresponding to the time phrase according to the current time and the first time operator.
For example, when the first text information is "go to date six afternoon after three days", the time phrase "go to date six afternoon after three days" is segmented to obtain three sub-time phrases "three days later", "afternoon" and "six hours", and then we can map two sub-time phrases "three days later", "afternoon" and "six hours" to three time operators shiftDays, setporioofday and setHours, respectively, and determine "six afternoon after three days" as "18: 00 at 1 month 2022" according to the three time operators and the current time (e.g. 1 day 1 month 1 year 2022).
In an exemplary embodiment, fig. 5 is a block diagram of a structure of a time information determining apparatus according to an embodiment of the present invention (ii); as shown in fig. 5, the above apparatus further includes: the sending module 52 is configured to determine the travel information of the target object according to the first text information; and sending prompt information to a target object according to the standard time information and the travel information, wherein the prompt information is used for prompting the target object to execute an action corresponding to the travel information.
That is to say, the travel information of the target object is determined according to the first text information, and when the target object needs to execute the action in the travel information, the target object is reminded to execute the action corresponding to the travel information at a preset time before the travel information.
In an exemplary embodiment, the determining module is further configured to acquire second voice information through the voice interaction device, and acquire second text information matched with the second voice information; determining whether the first text information is consistent with the second text information; under the condition that the first text information is consistent with the second text information, respectively acquiring first characteristic information of the first voice information and second characteristic information of the second voice information; and determining whether to extract the time phrases in the second text information through a second regular expression according to whether the first characteristic information and the second characteristic information are consistent.
In an exemplary embodiment, the extracting module is further configured to, in a case that the first feature information and the second feature information are consistent, not extract a time phrase in the second text information through a second regular expression; and under the condition that the first characteristic information and the second characteristic information are inconsistent, extracting a time phrase in the second text information through a second regular expression.
An embodiment of the present invention further provides a storage medium including a stored program, wherein the program executes any one of the methods described above.
Alternatively, in the present embodiment, the storage medium may be configured to store program codes for performing the following steps:
s1, acquiring first voice information through a voice interaction device, and acquiring first text information matched with the first voice information;
s2, extracting time phrases in the first text information through a first regular expression;
s3, determining a first time operator corresponding to the time phrase in a time operator configuration file, and mapping the time phrase to the first time operator, wherein the time operator configuration file comprises: a plurality of time operators;
s4, determining standard time information corresponding to the time phrase according to the current time and the first time operator mapped with the time phrase.
Embodiments of the present invention further provide an electronic device, comprising a memory in which a computer program is stored and a processor configured to execute the computer program to perform the steps in any of the above method embodiments.
Optionally, the electronic apparatus may further include a transmission device and an input/output device, wherein the transmission device is connected to the processor, and the input/output device is connected to the processor.
Optionally, in this embodiment, the processor may be configured to execute the following steps by a computer program:
s1, acquiring first voice information through a voice interaction device, and acquiring first text information matched with the first voice information;
s2, extracting time phrases in the first text information through a first regular expression;
s3, determining a first time operator corresponding to the time phrase in a time operator configuration file, and mapping the time phrase to the first time operator, wherein the time operator configuration file comprises: a plurality of time operators;
s4, determining standard time information corresponding to the time phrase according to the current time and the first time operator mapped with the time phrase.
Optionally, in this embodiment, the storage medium may include, but is not limited to: various media capable of storing program codes, such as a usb disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a removable hard disk, a magnetic disk, or an optical disk.
Optionally, the specific examples in this embodiment may refer to the examples described in the above embodiments and optional implementation manners, and this embodiment is not described herein again.
It will be apparent to those skilled in the art that the modules or steps of the present invention described above may be implemented by a general purpose computing device, they may be centralized on a single computing device or distributed across a network of multiple computing devices, and alternatively, they may be implemented by program code executable by a computing device, such that they may be stored in a storage device and executed by a computing device, and in some cases, the steps shown or described may be performed in an order different than that described herein, or they may be separately fabricated into individual integrated circuit modules, or multiple ones of them may be fabricated into a single integrated circuit module. Thus, the present invention is not limited to any specific combination of hardware and software.
The foregoing is only a preferred embodiment of the present application and it should be noted that those skilled in the art can make several improvements and modifications without departing from the principle of the present application, and these improvements and modifications should also be considered as the protection scope of the present application.
Claims (10)
1. A method for determining time information, comprising:
acquiring first voice information through a voice interaction device, and acquiring first text information matched with the first voice information;
extracting a time phrase in the first text information through a first regular expression;
determining a first time operator corresponding to the time phrase in a time operator configuration file, and mapping the time phrase to the first time operator, wherein the time operator configuration file comprises: a plurality of time operators;
and determining standard time information corresponding to the time phrase according to the current time and the first time operator mapped with the time phrase.
2. The method of claim 1, wherein before extracting the temporal phrase in the first textual information by a first regular expression, the method further comprises:
acquiring first key information of the first text information through a keyword extraction model;
determining a first mapping relation corresponding to the first key information according to a pre-established mapping relation table, wherein the mapping relation table is used for indicating the mapping relation between the key information and a regular expression;
determining the first regular expression in a regular expression set according to the first mapping relationship.
3. The method of claim 1, wherein determining a first time operator in a time operator profile corresponding to the temporal phrase and mapping the temporal phrase to the first time operator comprises:
segmenting the time phrases to obtain a plurality of sub-time phrases, wherein one sub-time phrase is used for indicating time information of one time unit;
determining a plurality of sub first time operators corresponding to the plurality of sub time phrases in a time operator configuration file, and mapping the plurality of sub time phrases to the plurality of sub first time operators respectively.
4. The method according to any one of claims 1-3, wherein determining the standard temporal information corresponding to the temporal phrase according to the current time and the first temporal operator comprises at least one of:
under the condition that the first time operator is used for indicating the set date information, determining standard date information corresponding to the time phrase according to the current time and the first time operator;
and under the condition that the first time operator is used for indicating to set clock information, determining standard clock information corresponding to the time phrase according to the current time and the first time operator.
5. The method of claim 4, wherein after determining the standard time information corresponding to the time phrase according to the current time and the first time operator, the method further comprises:
determining the travel information of the target object according to the first text information;
and sending prompt information to a target object according to the standard time information and the travel information, wherein the prompt information is used for prompting the target object to execute an action corresponding to the travel information.
6. The method according to any one of claims 1-5, wherein after determining the standard time information corresponding to the time phrase according to the current time and the first time operator, the method further comprises:
acquiring second voice information through a voice interaction device, and acquiring second text information matched with the second voice information;
determining whether the first text information is consistent with the second text information;
under the condition that the first text information is consistent with the second text information, respectively acquiring first characteristic information of the first voice information and second characteristic information of the second voice information;
and determining whether to extract the time phrases in the second text information through a second regular expression according to whether the first characteristic information and the second characteristic information are consistent.
7. The method of claim 6, wherein determining whether to extract the time phrase in the second text information through a second regular expression according to whether the first feature information and the second feature information are consistent comprises:
under the condition that the first characteristic information and the second characteristic information are consistent, extracting time phrases in the second text information without a second regular expression;
and under the condition that the first characteristic information and the second characteristic information are inconsistent, extracting a time phrase in the second text information through a second regular expression.
8. An apparatus for determining time information, comprising:
the acquisition module is used for acquiring first voice information through a voice interaction device and acquiring first text information matched with the first voice information;
the extraction module is used for extracting the time phrases in the first text information through a first regular expression;
a mapping module, configured to determine a first time operator corresponding to the time phrase in a time operator configuration file, and map the time phrase to the first time operator, where the time operator configuration file includes: a plurality of time operators;
and the determining module is used for determining the standard time information corresponding to the time phrase according to the current time and the first time operator mapped with the time phrase.
9. A computer-readable storage medium, comprising a stored program, wherein the program is operable to perform the method of any one of claims 1 to 7.
10. An electronic device comprising a memory and a processor, characterized in that the memory has stored therein a computer program, the processor being arranged to execute the method of any of claims 1 to 7 by means of the computer program.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202210327295.8A CN114861678A (en) | 2022-03-30 | 2022-03-30 | Method and apparatus for determining time information, storage medium, and electronic apparatus |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202210327295.8A CN114861678A (en) | 2022-03-30 | 2022-03-30 | Method and apparatus for determining time information, storage medium, and electronic apparatus |
Publications (1)
Publication Number | Publication Date |
---|---|
CN114861678A true CN114861678A (en) | 2022-08-05 |
Family
ID=82628704
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202210327295.8A Pending CN114861678A (en) | 2022-03-30 | 2022-03-30 | Method and apparatus for determining time information, storage medium, and electronic apparatus |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN114861678A (en) |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN117725908A (en) * | 2024-02-07 | 2024-03-19 | 青岛海尔科技有限公司 | Time analysis method, device and equipment in natural language processing |
-
2022
- 2022-03-30 CN CN202210327295.8A patent/CN114861678A/en active Pending
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN117725908A (en) * | 2024-02-07 | 2024-03-19 | 青岛海尔科技有限公司 | Time analysis method, device and equipment in natural language processing |
CN117725908B (en) * | 2024-02-07 | 2024-05-24 | 青岛海尔科技有限公司 | Time analysis method, device and equipment in natural language processing |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN109658953A (en) | A kind of vagitus recognition methods, device and equipment | |
CN105550361B (en) | Log processing method and device and question and answer information processing method and device | |
CN115358395A (en) | Knowledge graph updating method and device, storage medium and electronic device | |
CN114676689A (en) | Sentence text recognition method and device, storage medium and electronic device | |
CN114861678A (en) | Method and apparatus for determining time information, storage medium, and electronic apparatus | |
CN115877726A (en) | Control method of intelligent household equipment, computer equipment and storage medium | |
CN114697150A (en) | Command issuing method and device, storage medium and electronic device | |
CN117573320A (en) | Task node execution method and device, storage medium and electronic device | |
CN114915514B (en) | Method and device for processing intention, storage medium and electronic device | |
CN115291793A (en) | Attribute data conversion method and device, storage medium and electronic device | |
CN114924908A (en) | Data backup method and device, storage medium and electronic device | |
CN114500140B (en) | Method, device, platform device and storage medium for waking up voice device | |
CN110704414A (en) | Log data cleaning method and device, electronic equipment and storage medium | |
CN115587587A (en) | Standard field library construction method and device and storage medium | |
CN111103805A (en) | Method, system and device for controlling household appliance and household appliance | |
CN115269926A (en) | Family map determination method and device, storage medium and electronic device | |
CN115481626A (en) | Behavior similarity determination method and device, storage medium and electronic device | |
CN117667560A (en) | Data processing method and device, storage medium and electronic equipment | |
CN114999494A (en) | Voice interaction function testing method and device, storage medium and electronic device | |
CN115481317A (en) | Recommendation method for workbench scene, storage medium and electronic device | |
CN116301511A (en) | Equipment interaction method and device, storage medium and electronic device | |
CN115497453A (en) | Identification model evaluation method and device, storage medium and electronic device | |
CN114866802A (en) | Video stream transmission method and device, storage medium and electronic device | |
CN115097738A (en) | Digital twin-based device control method and apparatus, storage medium, and electronic apparatus | |
CN114676676A (en) | Template generation method, storage medium and electronic device |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination |