Text processing method and device and storage medium

By receiving and processing text in natural language form, extracting and processing time text segments, the problem of low efficiency in existing technologies is solved, and efficient, accurate conversion and standardization of time information are achieved.

CN121859902APending Publication Date: 2026-04-14TRAVELSKY TECHNOLOGY LIMITED
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
TRAVELSKY TECHNOLOGY LIMITED
Filing Date
2025-12-26
Publication Date
2026-04-14

AI Technical Summary

Technical Problem

Existing technologies for processing time-based text are inefficient, especially when dealing with massive amounts of data and mixed input formats, making it difficult to meet the requirements of high efficiency, accuracy, and stability.

Method used

By receiving text in natural language form, extracting time text segments, determining their expression categories, and processing them according to the categories, including translation, named entity recognition, verification, splitting, conversion, and splicing, the final text is replaced with the target time text.

Benefits of technology

It achieves efficient processing of time text, improves processing efficiency and accuracy, and ensures the standardization of time information and its ease of computer understanding.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121859902A_ABST
    Figure CN121859902A_ABST
Patent Text Reader

Abstract

The invention discloses a text processing method and device and a storage medium. Relates to the technical field of civil aviation information, and comprises the following steps: receiving a to-be-processed first text in a natural language form, and extracting a time text segment in the first text, the time text segment comprising time information; determining a time expression category of the time text segment, the time expression category being a category of an expression mode of the time text segment for the time information; processing the time text segment according to the time expression category to obtain a target time text; and replacing the time text segment in the first text with the target time text to obtain a second text. Through the method and the device, the problem of relatively low efficiency of processing the time text in related technologies is solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of civil aviation information technology, and more specifically, to a text processing method, apparatus, and storage medium. Background Technology

[0002] In airline ticketing systems, the accurate understanding and conversion of time information is crucial for business processes such as flight inquiries, bookings, and settlements. When passengers interact with the ticketing system in more natural and flexible ways, such as using everyday colloquial expressions like "tomorrow" or "two months from now" to specify the departure date of their travel plans, these vague, colloquial time expressions need to be converted into standard time format text that computers can process.

[0003] However, processing time-based text involves manual conversion. First, each date term is analyzed individually, then converted into a time format. For example, if the current date is September 17th, the date a week later is September 24th, and the dates from Monday to Friday are September 15th to September 19th, 2025. While this method solves the problem to some extent, it suffers from drawbacks such as strong repetitiveness and low efficiency. Especially when dealing with massive amounts of data and mixed input formats, traditional methods struggle to meet the demands for efficient, accurate, and stable time-based text processing.

[0004] There is currently no effective solution to the problem of low efficiency in processing time-related texts in related technologies. Summary of the Invention

[0005] The main objective of this application is to provide a text processing method, apparatus, and storage medium to solve the problem of low efficiency in processing time-based text in related technologies.

[0006] To achieve the above objectives, according to one aspect of this application, a text processing method is provided. The method includes: receiving a first text in natural language form to be processed, and extracting a time text segment from the first text, wherein the time text segment includes time information; determining the time representation category of the time text segment, wherein the time representation category is the category of how the time text segment expresses the time information; processing the time text segment according to the time representation category to obtain a target time text; and replacing the time text segment in the first text with the target time text to obtain a second text.

[0007] Furthermore, before extracting the time text segment from the first text, the method also includes: obtaining the current language category of the first text; if the current language category is not the target language category, translating the first text to obtain the first text of the target language category.

[0008] Further, extracting the time text segment from the first text includes: performing named entity recognition on the first text to obtain the named entity recognition result; determining the initial time text in the first text based on the named entity recognition result; verifying the initial time text according to preset statement rules, and determining the initial time text as the time text segment if the verification result is successful.

[0009] Further, determining the time representation category of a time text segment includes: inputting the time text segment into a time representation classification model, using the time representation classification model to output a first category result; determining a second category result of the time text segment based on a preset representation rule library; and if the first category result and the second category result are the same, determining the first category result as the time representation category.

[0010] Furthermore, the time text segment is processed according to the time expression category to obtain the target time text, including: splitting the time text segment according to the time expression category to obtain multiple split time texts, wherein different split time texts correspond to different time dimensions; determining the reception time of the first text, and converting each split time text according to the reception time to obtain multiple converted split time texts; and concatenating the multiple converted split time texts to obtain the target time text.

[0011] Furthermore, after processing the time text segment according to the time representation category to obtain the target time text, the method further includes: obtaining the network address information of the sender of the first text, and determining the target time zone information of the sender's location based on the network address information; determining the time difference information based on the target time zone information and the preset time zone information; and correcting the target time text based on the time difference information to obtain the corrected target time text.

[0012] To achieve the above objectives, according to another aspect of this application, a text processing apparatus is provided. The apparatus includes: a text receiving unit for receiving a first text in natural language form to be processed and extracting a time text segment from the first text, wherein the time text segment includes time information; a category determining unit for determining the time representation category of the time text segment, wherein the time representation category is the category of how the time text segment expresses time information; a text processing unit for processing the time text segment according to the time representation category to obtain a target time text; and a text replacement unit for replacing the time text segment in the first text with the target time text to obtain a second text.

[0013] Furthermore, the device also includes: a language category acquisition unit, used to acquire the current language category of the first text before extracting the time text segment from the first text; and a text translation unit, used to translate the first text to obtain the first text of the target language category when the current language category is not the target language category.

[0014] Furthermore, the text receiving unit includes: an entity recognition module, used to perform named entity recognition on the first text to obtain the named entity recognition result; an initial time text determination module, used to determine the initial time text in the first text based on the named entity recognition result; and a verification module, used to verify the initial time text according to preset statement rules, and if the verification result is that the verification passes, to determine the initial time text as a time text segment.

[0015] Furthermore, the category determination unit includes: a first category module, used to input the time text segment into the time representation classification model and output the first category result using the time representation classification model; a second category module, used to determine the second category result of the time text segment based on a preset representation rule library; and a category determination module, used to determine the first category result as the time representation category if the first category result and the second category result are the same.

[0016] Furthermore, the text processing unit includes: a text splitting module, used to split the time text segment according to the time expression category to obtain multiple split time texts, wherein different split time texts correspond to different time dimensions; a text conversion module, used to determine the reception time of the first text and convert each split time text according to the reception time to obtain multiple converted split time texts; and a text splicing module, used to splice the multiple converted split time texts to obtain the target time text.

[0017] Furthermore, the device also includes: a time zone determination unit, used to process the time text segment according to the time expression category to obtain the target time text, obtain the network address information of the sender of the first text, and determine the target time zone information of the region where the sender is located based on the network address information; a time difference determination unit, used to determine the time difference information based on the target time zone information and the preset time zone information; and a text correction unit, used to correct the target time text based on the time difference information to obtain the corrected target time text.

[0018] According to another aspect of this application, a computer-readable storage medium is provided, which includes a stored program, wherein, when the program is executed, it controls the device on which the computer-readable storage medium is located to perform any text processing method.

[0019] According to another aspect of this application, an electronic device is provided, comprising: one or more processors, a memory, and one or more programs, wherein the one or more programs are stored in the memory and configured to be executed by the one or more processors, and the one or more programs include methods for performing any text processing method.

[0020] According to another aspect of this application, a computer program product is provided, including computer instructions that, when executed by a processor, implement the steps of the text processing method described above.

[0021] In this embodiment, by receiving a first text in natural language form to be processed and extracting a time text segment from the first text, wherein the time text segment includes time information; determining the time representation category of the time text segment, wherein the time representation category is the category of the way the time text segment expresses time information; processing the time text segment according to the time representation category to obtain a target time text; and replacing the time text segment in the first text with the target time text to obtain a second text, the technical problem of low efficiency in processing time text in the prior art is solved.

[0022] By extracting time text segments and determining the time expression category, the time text segments are processed according to the time expression category to obtain the target time text. Then, the second text is obtained by replacement, thus achieving efficient processing of time text and improving the efficiency of time text processing. Attached Figure Description

[0023] The accompanying drawings, which form part of this application, are used to provide a further understanding of this application. The illustrative embodiments and descriptions of this application are used to explain this application and do not constitute an undue limitation of this application. In the drawings:

[0024] Figure 1 A hardware structure block diagram of a computer terminal for implementing a text processing method is shown.

[0025] Figure 2 This is a flowchart of a text processing method provided according to an embodiment of this application;

[0026] Figure 3 This is a schematic diagram of a text processing apparatus provided according to an embodiment of this application;

[0027] Figure 4 This is a structural block diagram of an electronic device according to an embodiment of this application. Detailed Implementation

[0028] To enable those skilled in the art to better understand the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present application, and not all embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative effort should fall within the scope of protection of the present application.

[0029] It should be noted that the terms "first," "second," etc., in the specification, claims, and accompanying drawings of this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of this application described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.

[0030] It should be noted that the information collected in this application (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for display, data used for analysis, etc.) are information and data authorized by the user or fully authorized by all parties. Furthermore, the collection, storage, use, processing, transmission, provision, disclosure, and application of this data all comply with relevant laws, regulations, and standards, necessary confidentiality measures have been taken, and they do not violate public order and good morals. Corresponding operation entry points are provided for users to choose to authorize or refuse. For example, interfaces are set up between this system and relevant users or organizations, providing users with corresponding operation entry points for them to choose to agree to or refuse automated decision results; if the user chooses to refuse, the process proceeds to the expert decision-making stage.

[0031] Example 1

[0032] According to an embodiment of this application, a method embodiment for text processing is also provided. It should be noted that the steps shown in the flowchart in the accompanying drawings can be executed in a computer system such as a set of computer-executable instructions. Furthermore, although a logical order is shown in the flowchart, in some cases, the steps shown or described may be executed in a different order than that shown here.

[0033] The method embodiment provided in Embodiment 1 of this application can be executed on a mobile terminal, computer terminal, or similar computing device. Figure 1 A hardware structure block diagram of a computer terminal (or mobile device) for implementing a text processing method is shown. Figure 1 As shown, the computer terminal 10 (or mobile device) may include one or more processors 102 (shown as 102a, 102b, ..., 102n in the figure) 102 (processor 102 may include, but is not limited to, a microprocessor MCU or a programmable logic device FPGA, etc.), a memory 104 for storing data, and a transmission device 106 for communication functions. In addition, it may also include: a display, an input / output interface (I / O interface), a universal serial bus (USB) port (which may be included as one of the ports of a BUS bus), a network interface, a power supply, and / or a camera. Those skilled in the art will understand that... Figure 1 The structure shown is for illustrative purposes only and does not limit the structure of the aforementioned electronic device. For example, computer terminal 10 may also include... Figure 1 The more or fewer components shown, or having the same Figure 1 The different configurations shown.

[0034] It should be noted that the aforementioned one or more processors 102 and / or other data processing circuits are generally referred to herein as "data processing circuits". These data processing circuits may be embodied, in whole or in part, in software, hardware, firmware, or any other combination thereof. Furthermore, the data processing circuits may be a single, independent processing module, or may be integrated, in whole or in part, into any other element within the computer terminal 10 (or mobile device). As involved in the embodiments of this application, the data processing circuits serve as a processor control mechanism (e.g., selection of a variable resistor termination path connected to an interface).

[0035] The memory 104 can be used to store software programs and modules of application software, such as the program instructions / data storage device corresponding to the text processing method in this embodiment. The processor 102 executes various functional applications and data processing by running the software programs and modules stored in the memory 104, thereby implementing the above-mentioned text processing method. The memory 104 may include high-speed random access memory, and may also include non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some instances, the memory 104 may further include memory remotely located relative to the processor 102, and these remote memories can be connected to the computer terminal 10 via a network. Examples of such networks include, but are not limited to, the Internet, corporate intranets, local area networks, mobile communication networks, and combinations thereof.

[0036] The transmission device 106 is used to receive or send data via a network. Specific examples of the network described above may include a wireless network provided by the communication provider of the computer terminal 10. In one example, the transmission device 106 includes a Network Interface Controller (NIC), which can connect to other network devices via a base station to communicate with the Internet. In another example, the transmission device 106 may be a Radio Frequency (RF) module, used for wireless communication with the Internet.

[0037] The display can be, for example, a touchscreen liquid crystal display (LCD) that allows the user to interact with the user interface of the computer terminal 10 (or mobile device).

[0038] Under the aforementioned operating environment, this application provides the following: Figure 2 The text processing method shown. Figure 2 This is a flowchart of a text processing method according to Embodiment 1 of this application.

[0039] Step S201: Receive the first text in natural language form to be processed, and extract the time text segment from the first text, wherein the time text segment includes time information.

[0040] Optionally, the first text can be natural language text including time information input by the passenger. The time information in the first text is located in a time text segment, which is a colloquial expression. For example, the first text could be "I want to book a flight from Beijing to Shanghai two days from now," where the time text segment is "two days from now," which is a colloquial expression. The exact time cannot be determined directly from this time text segment in the booking system.

[0041] Step S202: Determine the time representation category of the time text segment, wherein the time representation category is the category of the way the time text segment expresses time information.

[0042] Optionally, the time representation category can include a fixed date category, a date-time category, and a time range category. The time representation category of a time text segment can be output through a time representation classification model. The fixed date category is used to represent the date of a fixed holiday, the date-time category is used to represent a single day (i.e., a single date), and the time range category is used to represent a time range of at least two days.

[0043] Step S203: Process the time text segment according to the time expression category to obtain the target time text.

[0044] Optionally, depending on the time representation category, the time text segment can be processed using a method corresponding to the time representation category to obtain the target time text. For example, if the time representation category is a fixed date category and the time text segment is "Labor Day", then the month-day information of the target time text is determined to be May 1st. The time text segment is then split into multiple split time texts, namely year information [empty information] and month-day information [May 1st]. Then, the receiving time of the first text is determined (e.g., March 1, 2025). Each split time text is converted according to the receiving time, that is, the year information of the target time is determined to be

[2025] according to the receiving time, thus converting the year information [empty information] to

[2025] . This is then concatenated with the month-day information [May 1st] of the other split time texts to obtain the target time text [May 1, 2025].

[0045] Step S204: Replace the time text segment in the first text with the target time text to obtain the second text.

[0046] For example, the first text might be "I want to book a flight from Beijing to Shanghai on Labor Day." Then, by replacing the "Labor Day" segment in the first text with the target time text "[May 1, 2025]", the second text becomes "I want to book a flight from Beijing to Shanghai on May 1, 2025". The second text obtained in this embodiment can be used as input data for other deep learning models. Because this embodiment achieves efficient processing of time text, the representation of time information in the second text is more standardized and easier for computers to understand, improving the accuracy of semantic understanding tasks based on the second text (e.g., ticket booking recognition).

[0047] In summary, by extracting time text segments and determining the time expression category, processing the time text segments according to the time expression category to obtain the target time text, and then obtaining the second text through replacement, efficient processing of time text is achieved, thus improving the efficiency of time text processing.

[0048] To improve the efficiency of processing time-based text, the method may optionally include, before extracting the time-based text segment from the first text, obtaining the current language category of the first text; and translating the first text to obtain the first text in the target language category if the current language category is not the target language category.

[0049] Optionally, the current language category of the first text can be determined using a language detection library of the Python programming language, and the first text can be converted into the target language type using a translation library of the Python programming language. The target language type is consistent with the language type of the training dataset of the time representation classification model. For example, the target language type can be Chinese.

[0050] In summary, by obtaining the current language category of the first text, and translating the first text to obtain the first text in the target language category when the current language category is not the target language category, a foundation is laid for subsequent identification of time representation categories, thus improving the efficiency of processing time texts.

[0051] To improve the efficiency of processing time text, optionally, extracting time text segments from the first text includes: performing named entity recognition on the first text to obtain the named entity recognition result; determining the initial time text in the first text based on the named entity recognition result; verifying the initial time text according to preset statement rules, and determining the initial time text as a time text segment if the verification result is successful.

[0052] Optionally, a preset named entity recognition model can be used to perform named entity recognition on the first text. This preset model can be obtained by training a bidirectional long short-term memory neural network-conditional random field model using a first training dataset. Multiple samples can be collected and labeled according to the BIOES annotation rule (a sample labeling rule) to obtain the first training dataset. For example, a sample might be "I want to check flight tickets from Beijing to Shanghai from next Monday to next Friday," which, according to the BIOES annotation rule, could be labeled as "OOOO B-Time I-Time I-Time I-Time I-Time I-Time E-Time O B-Location E-Location O B-Location E-Location O B-Ticket E-Ticket". Existing named entity recognition models identify scattered words and cannot recognize "next Monday to next Friday" as a whole. This embodiment uses a preset named entity recognition model to extract complete time-based text segments. The preset statement rules can be to check whether the initial text is a concatenation of the first word and a single time word (e.g., next-Monday). If so, the check passes and the initial text is determined to be a time statement; or whether it is a concatenation of "time statement-second word-time statement" (e.g., next Monday-to-next Friday), etc. If the check passes, the initial time text is determined to be a time text segment.

[0053] In summary, by using named entity recognition and pre-defined statement rules for verification, a complete time text segment was extracted from the first text, laying a data foundation for subsequent identification of time expression categories and improving the efficiency of processing time text.

[0054] To improve the efficiency of processing time text, optionally, determining the time representation category of a time text segment includes: inputting the time text segment into a time representation classification model, using the time representation classification model to output a first category result; determining a second category result of the time text segment based on a preset representation rule library; and if the first category result and the second category result are the same, determining the first category result as the time representation category.

[0055] Optionally, the time representation categories may include fixed date categories, time-date categories, and time range categories. The time representation classification model may be a three-class classification task model obtained by training a preset classification model using a time representation training dataset. Those skilled in the art, knowing the input and output data of the aforementioned time representation classification model, can collect and label samples as needed to construct a time representation training dataset. The preset classification model may include a feature extraction layer, an MLP (Multilayer Perceptron) layer, and a classification layer. The feature extraction layer is used to vectorize the input data, the MLP layer is used for non-linear feature mapping, and the classification layer is used to output the probability of each category (for example, the classification layer may be a fully connected layer with a softmax activation function). The preset expression rule base can include a first rule, a second rule, and a third rule. The first rule can determine the second category result as a fixed date if the time text segment belongs to a preset holiday dictionary (which includes multiple holidays, such as Labor Day, Double Ninth Festival, etc.). The second rule can determine the second category result as a time date if the length of the time text segment is less than a preset length and does not belong to the preset holiday dictionary. The third rule can determine the time range category if the time text segment includes a preset string and its length is greater than a preset length (for example, the preset string can be "to" or "to", and the preset length can be 4). When the first category result is the same as the second category result, the first category result is determined as the time expression category; otherwise, the time text segment is sent to a human for processing.

[0056] In summary, by inputting time text segments into the time representation classification model, the model outputs a first category result; a second category result is determined based on a preset representation rule library; and if the first and second category results are the same, the first category result is determined as the time representation category, thus improving the efficiency of processing time text.

[0057] To improve the efficiency of processing time text, optionally, the time text segment is processed according to the time expression category to obtain the target time text, including: splitting the time text segment according to the time expression category to obtain multiple split time texts, wherein different split time texts correspond to different time dimensions; determining the reception time of the first text, and converting each split time text according to the reception time to obtain multiple converted split time texts; and concatenating the multiple converted split time texts to obtain the target time text.

[0058] Optionally, the time representation category may include a fixed date category, a time-date category, and a time range category. When the time representation category is a fixed date category, multiple split time texts are year information [empty information] and month-day information [the month and date of the fixed date]. When the time representation category is a time-date category, multiple split time texts are year information [empty information], month information [pending information], week information [pending information], and day information [pending information]. The pending information can be determined based on the time text segment. For example, if the time text segment is next Monday, then the month and day information are [empty information], and the week information is [next week, Monday]. When the time representation category is a time range category, multiple split time texts are: year information [empty information], month information [pending information 1, pending information 2], week information [pending information 1, pending information 2], and day information [pending information 1, pending information 2]. Pending information 1 and pending information 2 can be determined based on the time text segment. For example, if the time text segment is "the 1st to the 5th of next month", then the month information is determined as [next month, next month], the day information is determined as [the 1st, the 5th], and the week information is determined as [empty information]. Each split time text is converted according to the receiving time. This can be done by using the receiving time as the time base and filling or calculating multiple split time texts to obtain multiple converted split time texts. For example, if the month and day information are [empty], the week information is [next week, Monday], and the receiving time is January 1, 2025 (Wednesday), then based on the week information [next week, Monday] and the receiving time, the month information is converted to [January], the day information is converted to [6th], and the year information is filled with

[2025] , resulting in the target time text "January 6, 2025".

[0059] In summary, by splitting the time text segment according to the time expression category, multiple split time texts are obtained, with different split time texts corresponding to different time dimensions; the reception time of the first text is determined, and each split time text is transformed according to the reception time to obtain multiple transformed split time texts; the multiple transformed split time texts are concatenated to obtain the target time text, thus improving the efficiency of time text processing.

[0060] To improve the efficiency of processing time text, optionally, after processing the time text segment according to the time expression category to obtain the target time text, the method further includes: obtaining the network address information of the sender of the first text, and determining the target time zone information of the sender's location based on the network address information; determining the time difference information based on the target time zone information and the preset time zone information; and correcting the target time text based on the time difference information to obtain the corrected target time text.

[0061] Optionally, the sender's network address information can be extracted by analyzing the metadata of the sender's request for the first text. The network address information reflects the sender's geographical location. The sender's location is determined through the network address information, and the target time zone information for the response is also determined. For example, it could be time zone A. The preset time zone information could be the location of the server running the text processing method in this embodiment, for example, time zone B. The time difference between time zones A and B is determined, and the target time text is corrected based on the time difference information to obtain the corrected target time text.

[0062] In summary, by obtaining the network address information of the sender of the first text and determining the target time zone information of the sender's location based on the network address information; determining the time difference information based on the target time zone information and the preset time zone information; and correcting the target time text based on the time difference information to obtain the corrected target time text, the efficiency of processing time text is improved.

[0063] It should be noted that the steps shown in the flowchart in the accompanying drawings can be executed in a computer system such as a set of computer-executable instructions, and although a logical order is shown in the flowchart, in some cases the steps shown or described may be executed in a different order than that shown here.

[0064] Example 2

[0065] This application also provides a text processing apparatus. It should be noted that the text processing apparatus of this application can be used to execute the text processing method provided in this application. The text processing apparatus provided in this application is described below.

[0066] According to embodiments of this application, an apparatus for implementing the above-described text processing method is also provided, such as... Figure 3 As shown, the device includes:

[0067] The text receiving unit 301 is used to receive the first text in natural language form to be processed and extract the time text segment from the first text, wherein the time text segment includes time information.

[0068] The category determination unit 302 is used to determine the time representation category of the time text segment, wherein the time representation category is the category of the way the time text segment expresses time information.

[0069] The text processing unit 303 is used to process the time text segment according to the time expression category to obtain the target time text.

[0070] The text replacement unit 304 is used to replace the time text segment in the first text with the target time text to obtain the second text.

[0071] The text processing apparatus provided in this application embodiment receives a first text in natural language form to be processed through a text receiving unit 301, and extracts a time text segment from the first text. The time text segment includes time information. A category determination unit 302 determines the time representation category of the time text segment, where the time representation category is the category of how the time text segment expresses the time information. A text processing unit 303 processes the time text segment according to the time representation category to obtain a target time text. A text replacement unit 304 replaces the time text segment in the first text with the target time text to obtain a second text. This solves the problem of low efficiency in processing time text in related technologies, thereby improving the efficiency of time text processing.

[0072] Optionally, in the text processing apparatus provided in the embodiments of this application, the apparatus further includes: a language category acquisition unit, configured to acquire the current language category of the first text before extracting the time text segment in the first text; and a text translation unit, configured to translate the first text to obtain the first text of the target language category when the current language category is not the target language category.

[0073] Optionally, in the text processing apparatus provided in this application embodiment, the text receiving unit 301 includes: an entity recognition module, used to perform named entity recognition on the first text to obtain a named entity recognition result; an initial time text determination module, used to determine the initial time text in the first text based on the named entity recognition result; and a verification module, used to verify the initial time text according to preset statement rules, and if the verification result is that the verification passes, determine the initial time text as a time text segment.

[0074] Optionally, in the text processing apparatus provided in the embodiments of this application, the category determination unit 302 includes: a first category module, used to input the time text segment into the time description classification model and output the first category result using the time description classification model; a second category module, used to determine the second category result of the time text segment according to a preset description rule library; and a category determination module, used to determine the first category result as the time description category if the first category result and the second category result are the same.

[0075] Optionally, in the text processing apparatus provided in this application embodiment, the text processing unit 303 includes: a text splitting module, used to split the time text segment according to the time expression category to obtain multiple split time texts, wherein different split time texts correspond to different time dimensions; a text conversion module, used to determine the reception time of the first text and convert each split time text according to the reception time to obtain multiple converted split time texts; and a text splicing module, used to splice the multiple converted split time texts to obtain the target time text.

[0076] Optionally, in the text processing apparatus provided in this application embodiment, the apparatus further includes: a time zone determination unit, used to process the time text segment according to the time expression category to obtain the target time text, then obtain the network address information of the sender of the first text, and determine the target time zone information of the region where the sender is located based on the network address information; a time difference determination unit, used to determine the time difference information based on the target time zone information and the preset time zone information; and a text correction unit, used to correct the target time text based on the time difference information to obtain the corrected target time text.

[0077] It should be noted that the text receiving unit 301, category determining unit 302, text processing unit 303, and text replacement unit 304 mentioned above correspond to steps S201 to S204 in Embodiment 1. The instances and application scenarios implemented by the units and corresponding steps are the same, but are not limited to the content disclosed in Embodiment 1. It should be noted that the above modules or units can be hardware or software components stored in memory (e.g., memory 104) and processed by one or more processors (e.g., processors 102a, 102b, ..., 102n). The above modules can also be part of the device and run in the computer terminal 10 provided in Embodiment 1.

[0078] Example 3

[0079] Embodiments of this application may provide an electronic device. Figure 4 This is a structural block diagram of an electronic device according to an embodiment of this application. Figure 4 As shown, the electronic device may include: one or more ( Figure 4(Only one is shown) processor 1002, memory 1004, memory controller, and peripheral interface, wherein the peripheral interface is connected to the radio frequency module, audio module and display.

[0080] The memory can be used to store software programs and modules, such as the program instructions / modules corresponding to the methods and apparatus in the embodiments of this application. The processor executes various functional applications and data processing by running the software programs and modules stored in the memory, thereby implementing the above-described methods. The memory may include high-speed random access memory, and may also include non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some instances, the memory may further include memory remotely located relative to the processor, and these remote memories can be connected to the terminal via a network. Examples of such networks include, but are not limited to, the Internet, corporate intranets, local area networks, mobile communication networks, and combinations thereof.

[0081] The processor can invoke information and application programs stored in memory through a transmission device to perform the following steps: receiving a first text in natural language form to be processed, and extracting a time text segment from the first text, wherein the time text segment includes time information; determining the time representation category of the time text segment, wherein the time representation category is the category of the way the time text segment expresses time information; processing the time text segment according to the time representation category to obtain the target time text; replacing the time text segment in the first text with the target time text to obtain the second text.

[0082] The processor can also call the information and application stored in the memory through the transmission device to perform the following steps: obtain the current language category of the first text; if the current language category is not the target language category, translate the first text to obtain the first text of the target language category.

[0083] The processor can also call the information and application stored in the memory through the transmission device to perform the following steps: perform named entity recognition on the first text to obtain the named entity recognition result; determine the initial time text in the first text based on the named entity recognition result; verify the initial time text according to the preset statement rules, and determine the initial time text as a time text segment if the verification result is successful.

[0084] The processor can also call the information and application stored in the memory through the transmission device to perform the following steps: inputting the time text segment into the time representation classification model, using the time representation classification model to output the first category result; determining the second category result of the time text segment according to the preset representation rule library; if the first category result and the second category result are the same, determining the first category result as the time representation category.

[0085] The processor can also call the information and application stored in the memory through the transmission device to perform the following steps: splitting the time text segment according to the time representation category to obtain multiple split time texts, wherein different split time texts correspond to different time dimensions; determining the reception time of the first text, and converting each split time text according to the reception time to obtain multiple converted split time texts; and concatenating the multiple converted split time texts to obtain the target time text.

[0086] The processor can also call the information and application program stored in the memory through the transmission device to perform the following steps: obtain the network address information of the sender of the first text, and determine the target time zone information of the region where the sender is located based on the network address information; determine the time difference information based on the target time zone information and the preset time zone information; and correct the target time text based on the time difference information to obtain the corrected target time text.

[0087] This application provides a text processing solution. It involves receiving a first text in natural language form and extracting a time text segment from the first text, where the time text segment includes time information; determining the time representation category of the time text segment, where the time representation category is the type of way the time text segment expresses the time information; processing the time text segment according to the time representation category to obtain a target time text; and replacing the time text segment in the first text with the target time text to obtain a second text. This solution addresses the technical problem of low efficiency in processing time text in the prior art.

[0088] Those skilled in the art will understand that Figure 4 The structure shown is for illustrative purposes only. Electronic devices can also be smartphones, tablets, handheld computers, mobile internet devices (MIDs), PADs, and other terminal devices. Figure 4 This does not limit the structure of the aforementioned electronic device. For example, electronic devices may also include components that are more... Figure 4 The more or fewer components shown (such as network interfaces, display devices, etc.), or having the same Figure 4 The different configurations shown.

[0089] Those skilled in the art will understand that all or part of the steps in the various methods of the above embodiments can be implemented by a program instructing the hardware related to the terminal device. The program can be stored in a computer-readable storage medium, which may include: flash drive, read-only memory (ROM), random access memory (RAM), disk or optical disk, etc.

[0090] Example 4

[0091] Embodiments of this application also provide a storage medium. Optionally, in this embodiment, the storage medium can be used to store the program code executed by the text processing method provided in Embodiment 1.

[0092] Optionally, in this embodiment, the storage medium may be located in any computer terminal in a group of computer terminals in a computer network, or in any mobile terminal in a group of mobile terminals.

[0093] Optionally, in this embodiment, the computer-readable storage medium is configured to store program code for performing the following steps: receiving a first text in natural language form to be processed, and extracting a time text segment from the first text, wherein the time text segment includes time information; determining the time representation category of the time text segment, wherein the time representation category is the category of the way the time text segment represents time information; processing the time text segment according to the time representation category to obtain a target time text; and replacing the time text segment in the first text with the target time text to obtain a second text.

[0094] Optionally, in this embodiment, the computer-readable storage medium is further configured to store program code for performing the following steps: obtaining the current language category of the first text; and translating the first text to obtain the first text of the target language category if the current language category is not the target language category.

[0095] Optionally, in this embodiment, the computer-readable storage medium is further configured to store program code for performing the following steps: performing named entity recognition on the first text to obtain a named entity recognition result; determining the initial time text in the first text based on the named entity recognition result; verifying the initial time text according to preset statement rules, and determining the initial time text as a time text segment if the verification result is a successful verification.

[0096] Optionally, in this embodiment, the computer-readable storage medium is further configured to store program code for performing the following steps: inputting a time text segment into a time representation classification model, and using the time representation classification model to output a first category result; determining a second category result of the time text segment based on a preset representation rule library; and determining the first category result as the time representation category if the first category result and the second category result are the same.

[0097] Optionally, in this embodiment, the computer-readable storage medium is further configured to store program code for performing the following steps: splitting the time text segment according to the time representation category to obtain multiple split time texts, wherein different split time texts correspond to different time dimensions; determining the reception time of the first text, and converting each split time text according to the reception time to obtain multiple converted split time texts; and concatenating the multiple converted split time texts to obtain the target time text.

[0098] Optionally, in this embodiment, the computer-readable storage medium is further configured to store program code for performing the following steps: obtaining the network address information of the sender of the first text, and determining the target time zone information of the region where the sender is located based on the network address information; determining the time difference information based on the target time zone information and the preset time zone information; and correcting the target time text based on the time difference information to obtain the corrected target time text.

[0099] Optionally, in this embodiment, the computer-readable storage medium is further configured to store program code for performing the following steps: parsing the text material information in the material information according to a preset parser to obtain a first text material; inputting the non-text material information in the material information into a visual language model, and determining the second text material corresponding to the non-text material information according to the visual language model; and determining the material text according to the first text material and the second text material.

[0100] This application also provides a computer program product that, when executed on a data processing device, is adapted to perform text processing method steps.

[0101] The sequence numbers of the embodiments in this application are for descriptive purposes only and do not represent the superiority or inferiority of the embodiments.

[0102] In the above embodiments of this application, the descriptions of each embodiment have different focuses. For parts not described in detail in a certain embodiment, please refer to the relevant descriptions of other embodiments.

[0103] In the several embodiments provided in this application, it should be understood that the disclosed technical content can be implemented in other ways. The device embodiments described above are merely illustrative; for example, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the displayed or discussed mutual coupling, direct coupling, or communication connection may be through some interfaces; the indirect coupling or communication connection between units or modules may be electrical or other forms.

[0104] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.

[0105] Furthermore, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.

[0106] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as a USB flash drive, read-only memory (ROM), random access memory (RAM), portable hard drive, magnetic disk, or optical disk.

[0107] The above description is only a preferred embodiment of this application. It should be noted that for those skilled in the art, several improvements and modifications can be made without departing from the principle of this application, and these improvements and modifications should also be considered within the scope of protection of this application.

Claims

1. A text processing method, characterized in that, include: Receive a first text in natural language form to be processed, and extract a time text segment from the first text, wherein the time text segment includes time information; Determine the time representation category of the time text segment, wherein the time representation category is the category of the way the time text segment represents the time information; The time text segment is processed according to the time representation category to obtain the target time text; The second text is obtained by replacing the time text segment in the first text with the target time text.

2. The method according to claim 1, characterized in that, Before extracting the time text segment from the first text, the method further includes: Get the current language category of the first text; If the current language category is not the target language category, the first text is translated to obtain the first text in the target language category.

3. The method according to claim 1, characterized in that, Extracting the time-related text segment from the first text includes: Named entity recognition is performed on the first text to obtain the named entity recognition result; The initial time text in the first text is determined based on the named entity recognition result; The initial time text is validated according to preset statement rules. If the validation result is successful, the initial time text is determined as the time text segment.

4. The method according to claim 1, characterized in that, Determining the time representation category of the time text segment includes: Input the time text segment into the time representation classification model, and use the time representation classification model to output the first category result; The second category result of the time text segment is determined based on a preset expression rule library; If the first category result is the same as the second category result, the first category result is determined as the time representation category.

5. The method according to claim 1, characterized in that, The time text segment is processed according to the time representation category to obtain the target time text, including: The time text segment is split according to the time representation category to obtain multiple split time texts, wherein different split time texts correspond to different time dimensions; Determine the reception time of the first text, and convert each of the split time texts according to the reception time to obtain multiple converted split time texts; The target time text is obtained by concatenating the multiple converted split time texts.

6. The method according to claim 1, characterized in that, After processing the time text segment according to the time representation category to obtain the target time text, the method further includes: Obtain the network address information of the sender of the first text, and determine the target time zone information of the region where the sender is located based on the network address information; The time difference information is determined based on the target time zone information and the preset time zone information; The target time text is corrected based on the time difference information to obtain the corrected target time text.

7. A text processing device, characterized in that, include: A text receiving unit is configured to receive a first text in natural language form to be processed, and extract a time text segment from the first text, wherein the time text segment includes time information; A category determination unit is used to determine the time representation category of the time text segment, wherein the time representation category is the category of the way the time text segment represents the time information; A text processing unit is used to process the time text segment according to the time representation category to obtain the target time text; A text replacement unit is used to replace the time text segment in the first text with the target time text to obtain the second text.

8. A computer-readable storage medium, characterized in that, The computer-readable storage medium includes a stored executable program, wherein, when the executable program is executed, it controls the device on which the computer-readable storage medium is located to perform the text processing method according to any one of claims 1 to 6.

9. An electronic device, characterized in that, include: Memory, which stores executable programs; A processor for running the program, wherein the program, when running, performs the text processing method according to any one of claims 1 to 6.

10. A computer program product comprising computer instructions, characterized in that, When the computer instructions are executed by the processor, they implement the steps of the text processing method according to any one of claims 1 to 6.