Text processing method and device, electronic equipment, computer readable storage medium and computer program product

By generating query statements carrying time constraints and performing graph convolution processing, the problem that traditional question-and-answer systems are difficult to provide accurate answers when processing complex queries is solved, and the effect of improving answer accuracy is achieved.

CN119692462APending Publication Date: 2025-03-25MASHANG CONSUMER FINANCE CO LTD
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202411625780.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-11-13
Publication Date
2025-03-25

AI Technical Summary

Technical Problem

Traditional question-and-answer systems are difficult to provide accurate answers when dealing with complex queries, especially problems involving multiple entities, multiple relationships, and time series.

Method used

By generating a query statement carrying time constraints and performing graph convolution processing on it, the characteristics of entities and time are obtained, and answer reasoning is performed to obtain answers that meet the time constraints.

Benefits of technology

Improve the accuracy of answers, and by increasing the information dimensions and quantity, the accuracy of answer reasoning is enhanced.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119692462A_ABST
    Figure CN119692462A_ABST
Patent Text Reader

Abstract

The invention provides a text processing method and device, electronic equipment, a computer readable storage medium and a computer program product. The method comprises the steps of generating a query statement of a first text based on the first text carrying a time constraint condition; performing graph convolution processing on the query statement to obtain a first feature corresponding to an entity of the query statement and a second feature corresponding to time of the query statement; and based on the first feature and the second feature, performing answer reasoning on the first text to obtain a second text meeting a time constraint condition. According to the invention, the accuracy of the obtained answers can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to computer technology, and in particular to a text processing method, device, electronic device, computer-readable storage medium and computer program product. Background Art

[0002] With the development of information technology, more and more users will acquire knowledge online. In order to meet users' needs for knowledge acquisition, the platform has pre-configured a question-and-answer system. When users ask questions, they can input the questions into the question-and-answer system, and the question-and-answer system will output the answers to the questions. Summary of the invention

[0003] The embodiments of the present application provide a text processing method, device, electronic device, computer-readable storage medium and computer program product, which can improve the accuracy of the answers obtained.

[0004] The technical solution of the embodiment of the present application is implemented as follows:

[0005] The present application provides a text processing method, the method comprising:

[0006] Based on the first text carrying the time constraint condition, generating a query statement of the first text;

[0007] Performing graph convolution processing on the query statement to obtain a first feature corresponding to the entity of the query statement and a second feature corresponding to the time of the query statement;

[0008] Based on the first feature and the second feature, answer reasoning is performed on the first text to obtain a second text that meets the time constraint condition.

[0009] The present application provides a text processing device, including:

[0010] A statement generation module, used to generate a query statement of the first text based on the first text carrying the time constraint condition;

[0011] A graph convolution module, used to perform graph convolution processing on the query statement to obtain a first feature corresponding to the entity of the query statement and a second feature corresponding to the time of the query statement;

[0012] An answer reasoning module is used to perform answer reasoning on the first text based on the first feature and the second feature to obtain a second text that meets the time constraint condition.

[0013] An embodiment of the present application provides an electronic device, the electronic device comprising:

[0014] A memory for storing computer executable instructions or computer programs;

[0015] The processor is used to implement the method provided in the embodiment of the present application when executing the computer executable instructions or computer program stored in the memory.

[0016] An embodiment of the present application provides a computer-readable storage medium storing a computer program or computer-executable instructions for implementing the text processing method provided in the embodiment of the present application when executed by a processor.

[0017] An embodiment of the present application provides a computer program product, including a computer program or computer executable instructions. When the computer program or computer executable instructions are executed by a processor, the text processing method provided by the embodiment of the present application is implemented.

[0018] The embodiments of the present application have the following beneficial effects:

[0019] Based on the first text that carries the time constraint, a query statement of the first text is generated. The first text is the text of the consulting question. By generating a standard query statement, the accuracy of the query statement of the first text can be improved, thereby improving the accuracy of the answer obtained by subsequent queries. The query statement is processed by graph convolution to obtain a first feature corresponding to the entity of the query statement and a second feature corresponding to the time of the query statement. Based on the first feature and the second feature, the answer is inferred for the first text to obtain a second text that meets the time constraint. The second text is the text that answers the consulting question. By means of graph convolution, the information corresponding to the entity and the information corresponding to the time in the query statement can be obtained at the same time, which increases the dimension of the obtained information, that is, increases the amount of information used to infer the answer to the first text. Inference of the answer based on multi-dimensional and rich information can improve the accuracy of the inferred answer. BRIEF DESCRIPTION OF THE DRAWINGS

[0020] Figure 1 is a schematic diagram of the architecture of a text processing system 100 provided in an embodiment of the present application;

[0021] Figure 2 is a schematic diagram of the structure of an electronic device 500 provided in an embodiment of the present application;

[0022] Figure 3A It is a first flow chart of the text processing method provided in the embodiment of the present application;

[0023] Figure 3B is a second flow chart of the text processing method provided in an embodiment of the present application;

[0024] Figure 3C is a third flow chart of the text processing method provided in the embodiment of the present application;

[0025] Figure 4 A schematic diagram of a query statement provided in an embodiment of the present application;

[0026] Figure 5 It is an overall implementation flow chart of the text processing method provided in the embodiment of the present application;

[0027] Figure 6 It is a detailed implementation flow chart of the text processing method provided in the embodiment of the present application.

[0028] It should be pointed out that the above-mentioned "first" and "second" are only used to distinguish different solutions, and do not represent the degree of superiority or inferiority of the solutions or the priority in the implementation process. DETAILED DESCRIPTION

[0029] In order to make the purpose, technical solutions and advantages of the present application clearer, the present application will be further described in detail below in conjunction with the accompanying drawings. The described embodiments should not be regarded as limiting the present application. All other embodiments obtained by ordinary technicians in the field without making creative work are within the scope of protection of this application.

[0030] In the following description, reference is made to “some embodiments”, which describe a subset of all possible embodiments, but it will be understood that “some embodiments” may be the same subset or different subsets of all possible embodiments and may be combined with each other without conflict.

[0031] In the following description, the terms "first\second\third" involved are merely used to distinguish similar objects and do not represent a specific ordering of the objects. It can be understood that "first\second\third" can be interchanged with a specific order or sequence where permitted, so that the embodiments of the present application described herein can be implemented in an order other than that illustrated or described herein.

[0032] In the embodiments of the present application, the term "module" or "unit" refers to a computer program or a part of a computer program with a predetermined function, and works together with other related parts to achieve a predetermined goal, and can be implemented in whole or in part by using software, hardware (such as processing circuits or memories) or a combination thereof. Similarly, a processor (or multiple processors or memories) can be used to implement one or more modules or units. In addition, each module or unit can be part of an overall module or unit that includes the function of the module or unit.

[0033] Unless otherwise defined, all technical and scientific terms used in the embodiments of the present application have the same meanings as those commonly understood by those skilled in the art. The terms used in the embodiments of the present application are only for the purpose of describing the embodiments of the present application and are not intended to limit the present application.

[0034] The relevant data collection and processing in the embodiments of this application should be strictly in accordance with the requirements of relevant laws and regulations when applied in examples, obtain the informed consent or separate consent of the personal information subject, and carry out subsequent data use and processing within the scope of authorization of laws and regulations and the personal information subject.

[0035] Before further describing the embodiments of the present application in detail, the nouns and terms involved in the embodiments of the present application are explained. The nouns and terms involved in the embodiments of the present application are subject to the following interpretations.

[0036] 1) Temporal Knowledge Graph (TKG) is a special type of knowledge graph that not only contains entities and relationships between entities, but also introduces time attributes, so that entities and relationships in the knowledge graph have clear time labels (or timestamps), which enables TKG to express the dynamic changes of entities and their relationships, and provides strong support for processing time-sensitive data and analyzing the evolution of entities over time. In TKG, each entity and relationship can be associated with one or more time points, such as creation time, update time, effective time, etc. The addition of this time series information greatly broadens the scope of application of knowledge graphs, especially in areas that need to process time series data, dynamic data analysis, and historical data queries. For example, scenarios such as social network analysis, financial market monitoring, urban traffic management, and medical health record analysis can all use TKG to better model and analyze data.

[0037] 2) Graph Neural Networks (GNNs) are a learning algorithm that specializes in processing graph-structured data. In many real-world applications, data appears in the form of graphs, such as social networks, recommendation systems, protein interaction networks in bioinformatics, and traffic networks. By applying neural networks to graph structures, GNNs can effectively capture the dependencies between nodes and the structural information of the graph. The basic idea of ​​GNN is to use the relationship between nodes to propagate information. In each round of iteration, GNN updates the representation (features) of each node, and this update process depends on the representation of the node's neighbor nodes.

[0038] 3) Time constraints: Time constraints in a statement usually refer to specific restrictions on the time when an action or event occurs. These constraints may involve the starting point, end point, duration, frequency of occurrence, and time relationship with other events. In different contexts, the expression of time constraints may be different. Among them, the expression of time constraints can be as follows: 1. Time point constraints, specifying an exact time point, such as "the meeting will start at 9 am." 2. Time range constraints: defining a time range, such as "business hours are from 10 am to 8 pm." 3. Duration constraints: describing the duration of an activity or process, such as "the homework needs to be completed in 30 minutes." 4. Periodic time constraints: specifying that an activity or event occurs according to a fixed period, such as "basketball training every Tuesday and Friday." 5. Relative time constraints: defining time based on other events, such as "review the report the day after it is submitted." 6. Priority time constraints: determining the priority order of different tasks or events, such as "complete urgent task A before starting task B." 7. Concurrent time constraints: describe situations where two or more events occur at the same time, such as "during the holiday season, stores are open and discounts are held at the same time." 8. Time limit constraints: set a deadline for an activity, such as "please submit the project report by the end of the month."

[0039] In modern society, the rapid development of information technology has brought about the emergence of massive amounts of data, and users' demand for knowledge acquisition is also growing. On this basis, the role of question-answering systems that can help users acquire knowledge has become particularly important. However, with the continuous improvement of user needs and the increasing complexity of query questions, the limitations of traditional question-answering systems have gradually become apparent. Traditional question-answering systems are mostly based on keyword matching and static knowledge bases. Although this method can handle simple queries, it often fails to get accurate answers for complex queries, especially those involving multiple entities, multiple relationships, and time series. For example, when users ask complex questions about how historical events evolve step by step, how a technological product is iteratively upgraded, or how the epidemic trend of a disease changes, traditional question-answering systems often find it difficult to provide satisfactory answers.

[0040] The embodiments of the present application provide a text processing method, apparatus, device, computer-readable storage medium, and computer program product, which can improve the accuracy of the answers obtained. The following describes an exemplary application of the text processing device provided by the embodiments of the present application. The device provided by the embodiments of the present application can be implemented as various types of terminals such as laptops, tablet computers, desktop computers, set-top boxes, smart phones, smart speakers, smart watches, smart TVs, and vehicle-mounted terminals, and can also be implemented as servers. Below, an exemplary application when the device is implemented as a server will be described.

[0041] See also Figure 1 , Figure 1 It is a schematic diagram of the architecture of the text processing system 100 provided in an embodiment of the present application. To support a text processing application, the terminal 400 is connected to the server 200 via the network 300. The network 300 can be a wide area network or a local area network, or a combination of the two.

[0042] The terminal 400 is used for, in response to a question input by a user, transmitting the question as a first text to the server 200 via the network 300 .

[0043] The server 200 is used to receive the first text transmitted by the terminal 400 through the network 300, generate a query statement of the first text based on the first text carrying the time constraint, perform graph convolution processing on the query statement, obtain a first feature corresponding to the entity of the query statement and a second feature corresponding to the time of the query statement, perform answer reasoning on the first text based on the first feature and the second feature, and obtain an answer that satisfies the time constraint. The answer that satisfies the time constraint is then transmitted to the terminal 400 through the network 300, so that the terminal 400 presents the answer that satisfies the time constraint to the user.

[0044] In some embodiments, the server 200 may be an independent physical server, or a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, content delivery networks (CDN), and big data and artificial intelligence platforms. The terminal and the server may be directly or indirectly connected via wired or wireless communication, which is not limited in the embodiments of the present application.

[0045] See also Figure 2 , Figure 2 is a schematic diagram of the structure of an electronic device 500 provided in an embodiment of the present application, Figure 2 The electronic device 500 shown includes: at least one processor 510, a memory 550, at least one network interface 520 and a user interface 530. The various components in the electronic device 500 are coupled together via a bus system 540. It is understood that the bus system 540 is used to achieve connection and communication between these components. In addition to the data bus, the bus system 540 also includes a power bus, a control bus and a status signal bus. However, for the sake of clarity, the bus system 540 is not described in detail. Figure 2 Various buses are labeled as bus system 540 .

[0046] The processor 510 can be an integrated circuit chip with signal processing capabilities, such as a general-purpose processor, a digital signal processor (DSP), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc., where the general-purpose processor can be a microprocessor or any conventional processor, etc.

[0047] The user interface 530 includes one or more output devices 531 that enable presentation of media content, including one or more speakers and / or one or more visual display screens. The user interface 530 also includes one or more input devices 532, including user interface components that facilitate user input, such as a keyboard, mouse, microphone, touch screen display, camera, other input buttons and controls.

[0048] The memory 550 may be removable, non-removable, or a combination thereof. Exemplary hardware devices include solid-state memory, hard drives, optical drives, etc. The memory 550 may optionally include one or more storage devices that are physically remote from the processor 510.

[0049] The memory 550 includes a volatile memory or a non-volatile memory, and may also include both volatile and non-volatile memories. The non-volatile memory may be a read-only memory (ROM), and the volatile memory may be a random access memory (RAM). The memory 550 described in the embodiments of the present application is intended to include any suitable type of memory.

[0050] In some embodiments, the memory 550 can store data to support various operations, examples of which include programs, modules, and data structures, or a subset or superset thereof, as exemplarily described below.

[0051] Operating system 551, including system programs for processing various basic system services and performing hardware-related tasks, such as framework layer, core library layer, driver layer, etc., for implementing various basic services and processing hardware-based tasks;

[0052] A network communication module 552, used to reach other electronic devices via one or more (wired or wireless) network interfaces 520, exemplary network interfaces 520 include: Bluetooth, Wireless Compatibility Certification (WiFi), and Universal Serial Bus (USB), etc.;

[0053] a presentation module 553 for enabling presentation of information via one or more output devices 531 (e.g., display screen, speaker, etc.) associated with the user interface 530 (e.g., a user interface for operating peripherals and displaying content and information);

[0054] The input processing module 554 is used to detect one or more user inputs or interactions from one of the one or more input devices 532 and translate the detected inputs or interactions.

[0055] In some embodiments, the device provided in the embodiments of the present application can be implemented in software. Figure 2 The text processing device 555 stored in the memory 550 is shown, which can be software in the form of a program and a plug-in, etc., including the following software modules: a sentence construction module 5551, a graph convolution module 5552 and an answer reasoning module 5553. These modules are logical, so they can be arbitrarily combined or further split according to the functions implemented. The functions of each module will be explained below.

[0056] In other embodiments, the device provided in the embodiments of the present application can be implemented in hardware. As an example, the device provided in the embodiments of the present application can be a processor in the form of a hardware decoding processor, which is programmed to execute the text processing method provided in the embodiments of the present application. For example, the processor in the form of a hardware decoding processor can adopt one or more application specific integrated circuits (Application Specific Integrated Circuit, ASIC), digital signal processors (Digital Signal Processor, DSP), programmable logic devices (Programmable Logic Device, PLD), complex programmable logic devices (Complex Programmable Logic Device, CPLD), field programmable gate arrays (Field-Programmable Gate Array, FPGA) or other electronic components.

[0057] The following describes the text processing method provided by the embodiment of the present application. As mentioned above, the electronic device implementing the text processing method of the embodiment of the present application can be a terminal, a server, or a combination of the two. Therefore, the execution subject of each step will not be repeatedly described below.

[0058] See also Figure 3A , Figure 3A is a first flow chart of the text processing method provided in the embodiment of the present application, which will be combined with Figure 3A Steps 101 to 103 are shown for explanation.

[0059] In step 101, a query statement of the first text is generated based on the first text carrying a time constraint condition.

[0060] As an example, the first text may be the text of the consultation question, the first text may be the question entered by the user in the area where the user fills in the question in the terminal, that is, the question to be answered, and the type of the question entered by the user may be text type, voice type, image type, video type, etc. For example, the user may enter the question the user wants to ask in the text input area, or may trigger the audio acquisition device in the terminal to enter the question the user wants to ask by voice, or may upload an image or video after the terminal obtains the user's authorization. It should be noted that the question entered by the user may be one of the above types, or a combination of multiple types, for example, the user enters an image of a flower and enters the text content "What flower is this".

[0061] As an example, the time constraint can be a time constraint in a sentence, which usually refers to a specific restriction on the time of occurrence of a certain action or event. These constraints may involve the starting point, end point, duration, frequency of occurrence, and time relationship with other events of the time. In different contexts, the expression of the time constraint may be different. For example, the first text proposed by the user is "How many earthquakes occurred in place A in 2020?" The time constraint in this question can be 2020.

[0062] As an example, if the answer to the question is obtained from the Temporal Knowledge Graph (TKG), the generated query statement can be the query statement corresponding to the Temporal Knowledge Graph. The query statement of the Temporal Knowledge Graph usually needs to specify the time range, entities, relationships and corresponding conditions of the query. Since the time attribute is introduced in TKG, the query statement must not only describe what is being queried, but also describe the time range within which the query is being made. Figure 4 As shown, Figure 4 A schematic diagram of a query statement provided in an embodiment of the present application.

[0063] If you want to query the president of country A in 1955, you can generate Figure 4 The query statement shown. Figure 4 In the <hastitle>"President of A"" selects the president entity and gives the president's position attributes. <hastermstart>"start" is the starting time of the president's term. <hastermend>"end" is the end time of the term of office of the selected president. "FILTER(start<="1955-01-01"^^xsd:date&&end>="1955-12-31"^^xsd:date)" is the filtering condition, which only selects all presidents whose term of office starts on or before January 1, 1955, and ends on or after December 31, 1955.

[0064] In some embodiments, the query statement for generating the first text based on the first text carrying the time constraint condition in step 101 can be as follows: Figure 3B Steps 1011 to 1012 are implemented as shown.

[0065] In step 1011, feature extraction is performed on the first text carrying the time constraint condition to obtain a third feature.

[0066] In some embodiments, the feature extraction of the first text carrying the time constraint to obtain the third feature in step 1011 can be achieved by the following technical solution: performing word segmentation processing on the first text carrying the time constraint to obtain the word segments corresponding to the first text; performing feature extraction on the word segments to obtain the word segmentation features corresponding to the word segmentation; performing feature fusion processing on the word segmentation features corresponding to the word segmentation to obtain the third feature corresponding to the first text.

[0067] As an example, the process of performing feature extraction processing on the first text can be implemented by a bidirectional encoder (BERT model), the first text is input into the BERT model, and the BERT model performs word segmentation processing on the first text carrying the time constraint condition to obtain the word segmentation corresponding to the first text, wherein the word segmentation corresponding to the first text can be multiple. For example, if the first text is "Who was the president of country A in 1955?", the corresponding multiple word segmentations may include "1955", "of", "country A", "president" and "who is".

[0068] Afterwards, the BERT model can perform feature extraction on multiple word segments respectively, and then obtain word segmentation features corresponding to the multiple word segments. The process of extracting features from word segments can be implemented by the Transformer encoder in the BERT model. Specifically, please refer to the following formula (1):

[0069] h=E(q) (1)

[0070] In formula (1), q is the word segmentation of the question raised by the user (i.e., the word segmentation of the first text), E is the encoder of the BERT model, and the encoder receives the text as input. h is the vectorized representation of the question q after being encoded by the BERT model, i.e., the word segmentation feature mentioned above.

[0071] After obtaining the word segmentation features corresponding to each word segmentation, each word segmentation feature can be fused to obtain the third feature. The process of fusion of word segmentation features can be implemented through the BERT model. The internal working mechanism of the BERT model involves first converting the input text into an embedding vector sequence (a sequence composed of the word segmentation features of the above multiple word segmentations), and then processing the embedding vector sequence through a multi-layer Transformer structure, and finally outputting the context-related embedding vector corresponding to each word. For question q, the output extracted by BERT is usually the vector corresponding to the CLS token, which is considered to be a summary representation of the entire input sequence. For details, please refer to the following formula (2):

[0072] hCLS=BERTCLS(q) (2)

[0073] In formula (2), hCLS is the third feature that contains the context information of all word segmentations in the question, and BERTCLS(q) is a feature sequence composed of multiple word segmentation features.

[0074] Through the above manner, the third feature of the accurate first text can be obtained, which is beneficial to improving the accuracy of the query statement determined subsequently.

[0075] In step 1012, a sentence is constructed based on the third feature to obtain a query sentence of the first text.

[0076] In some embodiments, the sentence construction based on the third feature in step 1012 to obtain the query sentence of the first text can be implemented by the following technical solution: decoding the third feature to obtain the query structure and keywords of the first text, the keywords include entities and time; adding the time constraint range indicated by the time to the time object of the query structure, and adding the entity to the entity object of the query structure to obtain the query sentence of the first text.

[0077] As an example, the query structure can be the statement structure of a query statement. If the query statement finally obtained is a TKG query statement, the query structure of the TKG query statement can be a selection clause (SELECT clause), a source clause (FROM clause) and a location clause (WHERE clause), wherein the SELECT clause defines the data type to be queried, usually one or more variables, which will be used to store the query results. The FROM clause specifies the knowledge graph data source for the query, that is, the graph containing the entities of the query. The WHERE clause contains the conditions for the query, based on which the data in the graph will be filtered. These conditions may involve the attributes of entities, the relationships between entities, time constraints, etc.

[0078] As an example, the keywords of the first text may be entities (i.e., entity keywords) and time (i.e., time keywords) included in the first text. For example, the first text is "Who was the president of country A in 1955", where "country A" and "president" may be entity keywords, and "1955" may be a time keyword.

[0079] As an example, by determining the keywords, the time constraint range and the entity to be queried can be determined. Continuing with the above example, when "Country A" and "President" are entity keywords and "1955" is the time keyword, the corresponding time constraint range can be January 1, 1955 to December 31, 1955, and the entity to be queried can be the President of Country A.

[0080] As an example, according to the query format of the TKG query statement, fill in the time constraint range and the entity to be queried into the corresponding positions of the query format to obtain the query statement. Continuing with the above example, the corresponding query statement can be as follows: SELECTentity WHERE{

[0081] / / Select the president entity and give the president's position attributes

[0082] entity <hastitle>"President of A".

[0083] / / Select the start time of the president's term

[0084] entity <hastermstart>start.

[0085] / / Select the end time of the president's term

[0086] entity <hastermend>end.

[0087] / / Filter condition, only select those whose term of office started on or before January 1, 1955,

[0088] / / All presidents whose terms ended on or after December 31, 1955

[0089] FILTER(start<="1955-01-01"^^xsd:date&&end>="1955-12-31"^^xsd:date)

[0090] }

[0091] Through the above method, an accurate query statement can be generated, thereby improving the accuracy of the answer corresponding to the query statement obtained.

[0092] In step 102, graph convolution processing is performed on the query statement to obtain a first feature corresponding to the entity of the query statement and a second feature corresponding to the time of the query statement.

[0093] In some embodiments, performing graph convolution processing on the query statement in step 102 to obtain a first feature corresponding to the entity of the query statement and a second feature corresponding to the time of the query statement can be implemented by the following technical solution.

[0094] The query statement is parsed to obtain the entity and time constraint range indicated by the query statement; based on the time series knowledge graph, the entity and time constraint range are converted into a graph to obtain the query time series graph corresponding to the query statement. The time series knowledge graph includes multiple nodes, one node corresponds to one entity, and an edge is used to represent the logical relationship between the entities corresponding to the two connected nodes. The nodes are attached with timestamps; the query time series graph is convolved to obtain the first feature corresponding to the entity of the query statement and the second feature corresponding to the time of the query statement.

[0095] As an example, the first feature may be an entity feature corresponding to an entity in the query statement, and the second feature may be a time feature corresponding to a time in the query statement. For example, the query statement is "Who was the president of country A in 1955?", the entities included are "country A" and "president", and the time is "1955". The features of "country A" and "president" may be the first feature, and the feature corresponding to "1955" may be the time feature.

[0096] As an example, a special type of knowledge graph not only contains entities and relationships between entities, but also introduces time attributes, so that entities and relationships in the knowledge graph have clear time labels (i.e. timestamps). This enables TKG to express the dynamic changes of entities and their relationships, providing strong support for processing time-sensitive data and analyzing the evolution of entities over time. In TKG, each entity and relationship can be associated with one or more time points, such as creation time, update time, effective time, etc.

[0097] As an example, a query time-series graph that satisfies the query conditions represented by the query statement can be found in the time-series knowledge graph through a query statement, that is, the query time-series graph can be a subgraph composed of entities in the time-series knowledge graph that satisfies the query conditions.

[0098] As an example, by performing graph convolution on the query time series graph, the corresponding first feature and second feature are obtained. The specific graph convolution process can be seen in the following formula (3):

[0099]

[0100] In formula (3), H (l) is the node feature of the lth layer (for l = 0, H (0) is the initial feature of the node), is the normalized adjacency matrix with self-connection added, W (l) is the weight matrix of the lth layer, and σ is a nonlinear activation function, such as ReLU. The features finally obtained by graph convolution are taken as the first feature and the second feature.

[0101] Through the above method, the second feature of the entity can be integrated in the subsequent answer reasoning process, which is conducive to improving the accuracy of the answer obtained by subsequent inference.

[0102] In step 103, based on the first feature and the second feature, answer inference is performed on the first text to obtain a second text that meets the time constraint condition.

[0103] As an example, the second text is a text that answers a consulting question. When the first text is a text of a consulting question, the second text may be a text that answers the consulting text of the first text, for example, the first text is "how is the weather today", and the second text may be "the weather is fine today".

[0104] In some embodiments, the answer reasoning of the first text based on the first feature and the second feature in step 103 to obtain the second text satisfying the time constraint condition can be performed as follows: Figure 3C Steps 1031 to 1033 are implemented as shown.

[0105] In step 1031, the nodes in the temporal knowledge graph are queried based on the first feature to obtain entities matching the first feature and third text associated with the entity.

[0106] As an example, after obtaining the first feature, an entity matching the first feature can be found in the time series knowledge graph as the third text, that is, the third text can be used as a candidate answer to the consulting question corresponding to the first text. For example, if the first feature is the feature corresponding to the entity "President", all nodes corresponding to the entity "President" in the time series knowledge graph can be used as the third text.

[0107] In step 1032, based on the second feature, the timestamp of the third text in the temporal knowledge graph is queried to obtain a fourth text corresponding to the timestamp that matches the second feature.

[0108] As an example, the queried entity whose timestamp is within the time constraint range corresponding to the second feature can be taken as the fourth text, that is, the fourth text is the third text within the time constraint range. For example, the time constraint range corresponding to the second feature is from January 1955 to December 1955, then the third text whose timestamp is between January 1955 and December 1955 can be taken as the fourth text.

[0109] In step 1033, based on the fourth text, a second text satisfying the time constraint condition is determined.

[0110] In some embodiments, determining the answer that satisfies the time constraint based on the fourth text in step 1033 can be achieved through the following technical solution: when there are multiple fourth texts, scoring the multiple fourth texts based on the scoring influence factor of each fourth text to obtain the score of the fourth text; from the multiple fourth texts, screening out the fourth texts whose scores exceed the score threshold, and using the screened out fourth text as the second text that satisfies the time constraint.

[0111] As an example, scoring influencing factors may include the confidence of the answer, time relevance, and other contextual factors. Among them, the confidence of the answer may be the confidence of the answer annotation. In the process of annotating the confidence, the confidence of the answer may be annotated with reference to factors such as the source of the answer and the storage time of the answer. For example, if the answer comes from an official announcement, the corresponding confidence is higher. If the answer comes from a comment in an online forum, the confidence of the answer is lower. Time relevance can be reflected in the dynamic changes of entities and relationships over time. For example, the position of an entity (such as a person) may change at a specific point in time, or the relationship between two entities (such as friendship) may develop or terminate over time. The above information may be entity, relationship, and time information that affects the answer within a specific time range. For example, relationship types: various types of relationships between entities, which may help explain the answer; time attributes: time attributes of entities or events, such as start time, end time, duration, frequency of occurrence, etc.; causal relationships: causal relationships between entities or events, which help understand why certain events follow other events; event sequence: the order in which events occur, which helps understand the logical relationship between events.

[0112] As an example, since the scoring influence factor of each answer is different, each fourth text can be scored. The fourth text can be scored by inputting each fourth text and the scoring influence factor corresponding to each fourth text into the scoring model, and the scoring model outputs the score of each fourth text.

[0113] As an example, in order to ensure the correctness of the answer, the fourth text with a score higher than the score threshold may be used as the answer finally obtained, or the fourth text with the highest score may be used as the answer finally obtained.

[0114] Through the above method, candidate answers with scores lower than the score threshold (i.e., "inferior answers") can be eliminated from the candidate answers, and candidate answers with scores higher than the score threshold can be used as the final answers, thereby improving the accuracy of the obtained answers.

[0115] In some embodiments, in step 103, the answer reasoning of the first text based on the first feature and the second feature to obtain an answer that satisfies the time constraint can be achieved by the following technical solution: based on the second feature, query the timestamp in the temporal knowledge graph to obtain a fifth text corresponding to the timestamp that matches the second feature; perform feature extraction on the entity associated with the fifth text to obtain a fourth feature; match the fourth feature with the first feature, and when the fourth feature matches the first feature, use the fifth text as the second text that satisfies the time constraint.

[0116] As an example, after obtaining the first feature and the second feature, the entity whose timestamp is within the time constraint range corresponding to the second feature can be taken as the fifth text. For example, if the time constraint range corresponding to the second feature is from January 1955 to December 1955, the entity whose timestamp is between January 1955 and December 1955 can be taken as the fifth text.

[0117] As an example, feature extraction can then be performed on the query time corresponding to the fifth text to obtain the fourth feature. The process of feature extraction on the fifth text can be to input the fifth text into the BERT model respectively, and the BERT model outputs the fourth feature corresponding to each fifth text.

[0118] As an example, the matching degree between the first feature and each fourth feature can be determined by a preset matching function (cosine similarity, Euclidean distance and other formulas). When the matching degree is higher than the matching degree threshold, the fifth text corresponding to the fourth feature can be used as the answer that meets the time constraint.

[0119] In some embodiments, in step 103, the answer inference is performed on the first text based on the first feature and the second feature to obtain an answer that satisfies the time constraint condition, which can be achieved by the following technical scheme: the first feature and the second feature are fused to obtain a fused feature; the answer inference is performed on the first text based on the fused feature to obtain a sixth text; based on the time comparison function in the time reasoning network, the fused feature and the second feature are time-compared to obtain a comparison result, wherein the comparison result indicates the probability that the sixth text satisfies the time constraint condition; when the comparison result indicates that the probability is greater than the probability threshold, the sixth text is used as the second text that satisfies the time constraint condition.

[0120] As an example, the process of fusing the first feature and the second feature can refer to the following formula (4):

[0121] h e,t =f(h e ,h t ) (4)

[0122] In formula (4), h e,t is the fusion feature, h e is the first feature, h t is the second feature, and f() is the time reasoning function. The time reasoning function can be vector addition, as shown in formula (5):

[0123] h e,t =h e +h t (5)

[0124] In formula (5), h e,t is the fusion feature, h e is the first feature, h t The second feature.

[0125] As an example, the process of inferring the answer to the first text based on the fused features can be as follows: through a preset matching function (cosine similarity, Euclidean distance and other formulas), the similarity between the entity features corresponding to each entity in the temporal knowledge graph and the fused features is determined, and the entities corresponding to the entity features above the similarity threshold are taken as the sixth text, that is, the sixth text is the text in the temporal knowledge graph with a higher similarity to the first text, and the sixth text can be taken as a candidate answer to the consulting question of the first text.

[0126] As an example, the fused feature and the second feature can then be compared in time based on the time comparison function to obtain a comparison result. The time comparison function can be a function that represents the same time point, a function that represents the target event occurring before the target time point, a function that represents the target event occurring after the target time point, or a function that represents the target event occurring between time point A and time point B. The function that represents the target event occurring before the target time point is used as an example for explanation. For details, please refer to the following formula (6).

[0127] isBefore(e, t) = g(h e,t ,h t ) (6)

[0128] In formula (6), isBefore(e, t) is the comparison result, h e,t is the fusion feature, h t is the second feature. g() is a comparison function used to output the probability of the target event occurring before time point t.

[0129] As an example, after the obtained comparison result indicates that the probability is greater than the probability threshold, the sixth text may be used as the second text that meets the time constraint condition.

[0130] In some embodiments, after executing step 103 to obtain the second text that meets the time constraint, the following technical solution can also be executed: interpret and generate the second text to obtain the interpretation content of the second text; use the second text and the interpretation content as the answer content of the first text, and output the answer content.

[0131] As an example, after obtaining the second text, the explanation content corresponding to the second text can be generated by the explanation generation model. For example, if the first text is who was the president of country A in 1955, and the corresponding second text is name B, the following content can be generated: "Name B was sworn in on January 20, 1953, becoming the 34th president of country A. The term of office of the president of country A is four years, usually starting on January 20 and ending at the inauguration ceremony of the next president. 1955 was during name B's first term, so he was the president of country A in 1955."

[0132] As an example, the second text and the explanation content may be presented to the user as text, or may be produced as images and videos and presented to the user, or may be produced as audio and presented to the user.

[0133] Through the above method, accurate answers can be obtained, and the explanation content of the answers provided at the same time improves the user experience.

[0134] The following is an explanation of an exemplary application of the embodiments of the present application in a practical application scenario.

[0135] See also Figure 5 , Figure 5 It is an overall implementation flow chart of the text processing method provided in the embodiment of the present application.

[0136] In step 501, the user interface: provides an interactive interface, receives natural language questions (to be answered with time constraints), and displays answers and reasoning paths.

[0137] User interface,Users ask questions in natural language through a friendly user interface.

[0138] In step 502, the natural language processing module parses the entities, relationships and time information in the question and constructs a query statement for the temporal knowledge graph.

[0139] The natural language processing module, after receiving the user's question, first performs linguistic analysis on the question to extract key entities, relationships, and time information. Then, this information is converted into a structured graph query format (query statement) to query the time series knowledge graph.

[0140] In step 503, the temporal knowledge graph construction module collects data, constructs the relationship between entities and time annotations, and forms a temporal knowledge graph.

[0141] The temporal knowledge graph construction module is responsible for collecting and organizing entities and their relationship data that change over time, building and maintaining the temporal knowledge graph. Each edge in the graph carries a timestamp, indicating the effective time or occurrence time of the information.

[0142] In step 504, the graph neural network module: learns the deep features of the temporal knowledge graph, processes the dynamics of the graph, and performs temporal reasoning.

[0143] The structured graph query will be fed into the graph neural network module. The graph neural network module is responsible for learning the deep features of entities and relationships in the temporal knowledge graph, especially how they change over time. The graph neural network embeds the nodes and edges of the graph to capture the impact of temporal changes on entities and relationships, thereby supporting temporal reasoning.

[0144] In step 505, the reasoning and sorting module performs logical reasoning based on the time sequence information and sorts the candidate answers.

[0145] In the reasoning and sorting module, the output of the graph neural network module will be used in the reasoning process. This module combines the temporal information to perform logical reasoning on possible answers and sorts all candidate answers according to certain criteria (such as confidence, time correlation, etc.).

[0146] In step 506, the answer generation and explanation module: selects the best answer, generates a natural language answer, and provides reasoning explanation.

[0147] The answer generation and explanation module selects the best answer from the ranked answer list and converts it into a natural language format understandable to users. In addition, if necessary, an explanation of the reasoning is generated, including the reasoning path and relevant time information, to increase the credibility and transparency of the answer.

[0148] In step 507, the user interface: displays the clear answer and necessary reasoning path and time information

[0149] User Interface Finally, the processed and formatted answers are presented to the user through the user interface, where the user can see the clear answers as well as the reasoning explanations and relevant time information provided by the system.

[0150] This process not only reflects the interaction between the user and the system, but also depicts the data flow and processing steps between the various modules within the system. It ensures that each step from receiving questions to providing answers is carefully handled, and the system is designed to handle complex time series data queries.

[0151] Combine the following Figure 6 , Figure 6 The detailed implementation flowchart of the text processing method provided in the embodiment of the present application is used for explanation.

[0152] In step 601, a question (ie, the first text carrying the time constraint condition) is input.

[0153] In a question-answering system, when a user asks a question through the front-end interface, such as "Who was the president of A in 1955?"

[0154] In step 602, the natural language understanding module parses the question and extracts key information (ie, the third feature mentioned above).

[0155] In this module, question q is input into a pre-trained language model such as BERT.

[0156] The BERT model converts natural language text into a vectorized representation in a high-dimensional space through its encoder E. This process can be shown in the following formula (7):

[0157] h=E(q) (7)

[0158] In formula (7), q is the question asked by the user, i.e., "Who was the president of Ain 1955?", E is the encoder of the BERT model, which receives text as input. h is the vectorized representation of question q after being encoded by the BERT model.

[0159] The internal working mechanism of the BERT model involves first converting the input text into a sequence of embedding vectors, then processing these vectors through a multi-layer transformer structure, and finally outputting the context-related embedding vector corresponding to each word. For question q, the output extracted by BERT is usually the vector corresponding to the CLS token, which is considered to be a summary representation of the entire input sequence. For details, see the following formula (8):

[0160] hCLS=BERTCLS(q) (8)

[0161] In formula (8), hCLS is the third feature that contains the contextual information of all word segmentations in the question, and BERTCLS(q) is a feature sequence composed of multiple word segmentation features.

[0162] In step 603, the query generation module converts the parsed information (third feature) into a graph query.

[0163] The query generation module takes over and converts the output of the natural language understanding module into the corresponding temporal knowledge graph query. This conversion process can be achieved through a sequence-to-sequence (Seq2Seq) model, which can process variable-length input sequences and generate variable-length output sequences.

[0164] Assume that we already have a vectorized representation hCLS of question q after processing by the natural language understanding module. The query generation model Q accepts hCLS as input and generates a query statement q′, as shown in the following formula (9):

[0165] q′=Q(h CLS ) (9)

[0166] In formula (9), Q() is the query generation model, which is usually a Seq2Seq model, such as an encoder-decoder architecture, where the encoder part processes the vectorized representation of the input and the decoder part generates the output query statement. CLS is the vectorized representation of the question obtained from the BERT model. q′ is the generated query statement, which is a query used to retrieve relevant information in TKG, usually in the form of a SPARQL query statement. Through such a conversion, the query generation module provides precise query instructions to the TKG access module, enabling it to retrieve information related to the user's question from the temporal knowledge graph.

[0167] In step 604, the graph query neural network module and the time module are executed to process the time series knowledge graph and perform graph query.

[0168] Then, the graph neural network (GNN) module is used to process the subgraph G (query time sequence graph) and generate an embedding vector (first feature and second feature). This process can be described by the graph convolutional network formula (10):

[0169]

[0170] In formula (10), H (l) is the node feature of the lth layer (for l = 0, H (0) is the initial feature of the node), is the normalized adjacency matrix with self-connection added, W (l) is the weight matrix of the lth layer, and σ is a nonlinear activation function, such as ReLU. The features finally obtained by graph convolution are taken as the first feature and the second feature.

[0171] In step 605, the answer generation module generates an answer based on the query result.

[0172] After the GNN processing is completed, the temporal reasoning module uses the generated embedding vectors (first feature and second feature) to perform temporal logical reasoning. Temporal reasoning mainly involves the following steps:

[0173] (1) Temporal entity recognition: Identify temporal expressions from the question (the first text carrying temporal constraints) and convert them into a standardized temporal format.

[0174] (2) Temporal relationship reasoning: Infer the temporal relationship between entities based on temporal expressions and temporal annotations in the knowledge graph.

[0175] (3) Time constraint satisfaction: Ensure that the generated answer satisfies the time constraints in the question.

[0176] After the embedding vector h of entity e has been determined e (Second feature), and it is necessary to evaluate whether the entity satisfies a certain condition at time t. The temporal reasoning module can perform reasoning through the following formula (11):

[0177] h e,t =f(h e ,h t ) (11)

[0178] In formula (11), h e,t is the fusion feature, h e is the first feature, h t is the second feature, and f() is the time reasoning function. The time reasoning function f can be a simple function, such as vector addition, or a complex neural network. The purpose of the time reasoning function is to incorporate time information into entity embedding. For example, if vector addition can be used as the time reasoning function, as shown in formula (12):

[0179] h e,t =h e +h t (12)

[0180] In formula (12), h e,t is the fusion feature, h e is the first feature, h t The second feature.

[0181] In practical applications, temporal reasoning may be more complex and may need to consider factors such as time intervals, durations, time points, and time sequences. Advanced temporal reasoning may use specialized temporal reasoning networks that can handle these complex temporal relationships and output answers that satisfy temporal constraints.

[0182] For example, if we want to determine whether an event e occurs before time point t, we may need a comparison function g to compare the event time embedding and the time point embedding. For details, see the following formula (13):

[0183] isBefore(e, t) = g(h e,t ,h t ) (13)

[0184] In formula (13), isBefore(e, t) is the comparison result, h e,t is the fusion feature, h t is the second feature. g() is a comparison function used to output the probability of the target event occurring before time point t.

[0185] The temporal reasoning module ensures that the question answering system considers not only the correctness of entities and facts, but also the correctness and relevance of time when providing answers.

[0186] In step 606, the answer ranking and selection module evaluates the answers and selects the best option.

[0187] Given all possible answer candidates in the past (candidate answers), the answer generation and ranking module will score and rank these candidates based on a series of criteria. These criteria may include the confidence of the answer, time relevance, and other contextual factors. The ranking process can be implemented by a learned ranking model R, which will give each answer candidate a i Mapped to a score s i =R(a i ), and then sorts the candidate answers based on these scores.

[0188] In step 607, the explanation generation module provides an explanation for the selected answer.

[0189] Finally, the explanation generation module builds an easy-to-understand explanation content for the selected best answer, which helps increase users’ trust in the answer. The explanation content can be built by a rule system or a generative model Exp to generate natural language text.

[0190] In step 608, the final answer and explanation are passed through the user interface layer and the answer is output.

[0191] At the end of the entire process, the front-end interface will show users the highest-ranked answers and corresponding explanations, completing the complete data flow from question to answer. Users can further interact based on the answers provided, such as asking more questions or providing feedback.

[0192] The text processing method provided in the embodiment of the present application can produce the following beneficial effects:

[0193] (1) Improving question-answering accuracy: Using graph neural networks to encode entities and relationships in temporal knowledge graphs can capture the complex relationships between entities, including their temporal relationships. This rich representation capability enables the system to more accurately understand and answer questions involving temporal logic.

[0194] (2) Enhanced processing capabilities of temporal logic: Traditional question-answering systems may have limitations in processing temporal logic, especially when questions involve complex temporal relationships and constraints. The embodiments of the present application can better handle such questions by integrating a dedicated temporal reasoning module to ensure the temporal accuracy and relevance of the answers.

[0195] (3) Improved generalization ability: Graph neural networks can better generalize to unseen entities and relationships by learning how to extract features from graph structures. This is because graph neural networks consider not only the features of nodes, but also the structural position of nodes in the graph, which is particularly important for understanding new, unlabeled, or dynamically changing knowledge graphs.

[0196] (4) Adaptability of dynamic knowledge graph: The temporal knowledge graph changes continuously over time. The embodiments of the present application can utilize its temporal reasoning module to dynamically adapt to these changes and provide users with the latest information, rather than relying solely on static data.

[0197] (5) Processing of complex queries: Due to the combination of the graph neural network module and the temporal reasoning module, the embodiments of the present application are able to process more complex queries, such as those involving multi-step logical reasoning and time dimensions.

[0198] The main reasons for these beneficial effects include:

[0199] (1) Effective utilization of graph structure: Graph neural networks can effectively utilize the information in the graph structure, which is crucial for pattern recognition and feature learning in graph data (such as temporal knowledge graphs).

[0200] (2) Integration of the time dimension: By embedding time as part of the system, embodiments of the present application are able to handle temporal dynamics, which is crucial for understanding and answering time-dependent questions.

[0201] (3) End-to-end learning of the model: The embodiments of the present application generally adopt an end-to-end learning model, which means that from input to output, all parameters in the entire question-answering process can be optimized in a data-driven manner, thereby improving the overall performance.

[0202] In summary, the embodiments of the present application, by combining the graph neural network and the temporal reasoning module, can process more complex temporal logic while maintaining the accuracy of the question-answering system, and provide richer and more dynamic question-answering services.

[0203] It is understandable that in the embodiments of the present application, related data such as user information is involved. When the embodiments of the present application are applied to specific products or technologies, user permission or consent is required, and the collection, use and processing of relevant data must comply with relevant laws, regulations and standards.

[0204] The following is a description of an exemplary structure of a text processing device 555 provided in an embodiment of the present application implemented as a software module. In some embodiments, Figure 2 As shown, the software modules stored in the text processing device 555 of the memory 550 may include:

[0205] A statement construction module 5551, configured to generate a query statement of the first text based on the first text carrying the time constraint condition;

[0206] A graph convolution module 5552 is used to perform graph convolution processing on the query statement to obtain a first feature corresponding to the entity of the query statement and a second feature corresponding to the time of the query statement;

[0207] The answer reasoning module 5553 is used to perform answer reasoning on the first text based on the first feature and the second feature to obtain a second text that meets the time constraint.

[0208] In some embodiments, the sentence construction module 5551 is further used to extract features from the first text carrying the time constraint condition to obtain a third feature; and to construct a sentence based on the third feature to obtain a query sentence for the first text.

[0209] In some embodiments, the sentence construction module 5551 is also used to perform word segmentation processing on the first text carrying the time constraint condition to obtain the word segments corresponding to the first text; perform feature extraction on the word segments to obtain the word segmentation features corresponding to the word segments; perform feature fusion processing on the word segmentation features corresponding to the word segments to obtain the third features corresponding to the first text.

[0210] In some embodiments, the sentence construction module 5551 is further used to decode the third feature to obtain the query structure and keywords of the first text, wherein the keywords include entities and time; add the time constraint range indicated by the time to the time object of the query structure, and add the entity to the entity object of the query structure to obtain the query sentence of the first text.

[0211] In some embodiments, the graph convolution module 5552 is also used to parse the query statement to obtain the entity and time constraint range indicated by the query statement; based on the time series knowledge graph, the entity and the time constraint range are graph converted to obtain a query timing graph corresponding to the query statement, the time series knowledge graph includes multiple nodes, one node corresponds to one entity, an edge is used to represent the logical relationship between the entities corresponding to the two connected nodes, and the node is attached with a timestamp; the query timing graph is graph convolution processed to obtain a first feature corresponding to the entity of the query statement and a second feature corresponding to the time of the query statement.

[0212] In some embodiments, the answer reasoning module 5553 is also used to query the nodes in the temporal knowledge graph based on the first feature to obtain an entity matching the first feature and a third text associated with the entity; based on the second feature, query the timestamp of the third text in the temporal knowledge graph to obtain a fourth text corresponding to the timestamp matching the second feature; based on the fourth text, determine a second text that satisfies the time constraint.

[0213] In some embodiments, the answer reasoning module 5553 is also used to score the multiple fourth texts based on the scoring influence factor of each of the fourth texts to obtain the scores of the fourth texts when there are multiple fourth texts; and to filter out the fourth texts whose scores exceed the score threshold from the multiple fourth texts, and use the filtered out fourth texts as the second text that satisfies the time constraint.

[0214] In some embodiments, the answer reasoning module 5553 is also used to query the timestamp in the time series knowledge graph based on the second feature to obtain a fifth text corresponding to the timestamp matching the second feature; perform feature extraction on the entity associated with the fifth text to obtain a fourth feature; match the fourth feature with the first feature, and when the fourth feature matches the first feature, use the fifth text as the second text that satisfies the time constraint.

[0215] In some embodiments, the answer reasoning module 5553 is also used to fuse the first feature and the second feature to obtain a fused feature; perform answer reasoning on the first text based on the fused feature to obtain a sixth text; perform time comparison on the fused feature and the second feature based on the time comparison function in the time reasoning network to obtain a comparison result, wherein the comparison result indicates the probability that the sixth text satisfies the time constraint; when the comparison result indicates that the probability is greater than a probability threshold, the sixth text is used as the second text that satisfies the time constraint.

[0216] In some embodiments, the answer reasoning module 5553 is also used to perform interpretation generation processing on the second text to obtain the interpretation content of the second text; use the second text and the interpretation content as the answer content of the first text, and output the answer content.

[0217] The embodiment of the present application provides a computer program product, which includes a computer program or a computer executable instruction, and the computer program or the computer executable instruction is stored in a computer-readable storage medium. The processor of the electronic device reads the computer executable instruction from the computer-readable storage medium, and the processor executes the computer executable instruction, so that the electronic device executes the text processing method described in the embodiment of the present application.

[0218] The present application embodiment provides a computer-readable storage medium in which computer executable instructions or computer programs are stored. When the computer executable instructions or computer programs are executed by a processor, the processor will be caused to execute the text processing method provided by the present application embodiment, for example, Figure 3A The text processing method shown.

[0219] In some embodiments, the computer-readable storage medium may be a memory such as RAM, ROM, flash memory, magnetic surface memory, optical disk, or CD-ROM; or may be various devices including one or any combination of the above memories.

[0220] In some embodiments, computer executable instructions may be in the form of a program, software, software module, script or code, written in any form of programming language (including compiled or interpreted languages, or declarative or procedural languages), and may be deployed in any form, including as a stand-alone program or as a module, component, subroutine or other unit suitable for use in a computing environment.

[0221] As an example, computer-executable instructions may, but need not, correspond to a file in a file system, may be stored as part of a file that stores other programs or data, such as in one or more scripts in a HyperText Markup Language (HTML) document, in a single file dedicated to the program in question, or in multiple coordinated files (e.g., files storing one or more modules, subroutines, or code portions).

[0222] As an example, computer executable instructions may be deployed to be executed on one electronic device, or on multiple electronic devices located at one site, or on multiple electronic devices distributed at multiple sites and interconnected by a communication network.

[0223] In summary, the following beneficial effects can be achieved through the embodiments of the present application:

[0224] Based on the first text carrying the time constraint, a query statement of the first text is generated. By generating a standard query statement, the accuracy of the query statement of the first text can be improved, thereby improving the accuracy of the answer obtained by subsequent queries. The query statement is processed by graph convolution to obtain a first feature corresponding to the entity of the query statement and a second feature corresponding to the time of the query statement. Based on the first feature and the second feature, the answer is inferred for the first text to obtain a second text that meets the time constraint. By means of graph convolution, information corresponding to the entity and information corresponding to the time in the query statement can be obtained at the same time, which increases the dimension of the information obtained and the amount of information obtained, thereby increasing the amount of information used to infer the answer to the first text and improving the accuracy of the answer obtained by reasoning.

[0225] The above is only an embodiment of the present application and is not intended to limit the protection scope of the present application. Any modifications, equivalent substitutions and improvements made within the spirit and scope of the present application are included in the protection scope of the present application.< / hastermend> < / hastermstart> < / hastitle> < / hastermend> < / hastermstart> < / hastitle>

Claims

1. A text processing method, characterized in that: The method comprises: Based on the first text carrying the time constraint condition, generating a query statement of the first text; Performing graph convolution processing on the query statement to obtain a first feature corresponding to the entity of the query statement and a second feature corresponding to the time of the query statement; Based on the first feature and the second feature, answer reasoning is performed on the first text to obtain a second text that meets the time constraint condition.

2. The method according to claim 1, characterized in that The step of generating a query statement of the first text based on the first text carrying the time constraint condition includes: Perform feature extraction on the first text carrying the time constraint condition to obtain a third feature; A sentence is constructed based on the third feature to obtain a query sentence of the first text.

3. The method according to claim 2, characterized in that The step of extracting features from the first text carrying the time constraint condition to obtain a third feature includes: Performing word segmentation processing on the first text carrying the time constraint condition to obtain word segments corresponding to the first text; Performing feature extraction on the word segmentation to obtain word segmentation features corresponding to the word segmentation; Feature fusion processing is performed on the word segmentation features corresponding to the word segmentation to obtain a third feature corresponding to the first text.

4. The method according to claim 2, characterized in that: The constructing a sentence based on the third feature to obtain a query sentence of the first text includes: Decoding the third feature to obtain a query structure and keywords of the first text, wherein the keywords include entities and time; The time constraint range of the time indication is added to the time object of the query structure, and the entity is added to the entity object of the query structure to obtain the query statement of the first text.

5. The method according to claim 1, characterized in that The performing graph convolution processing on the query statement to obtain a first feature corresponding to the entity of the query statement and a second feature corresponding to the time of the query statement includes: Parsing the query statement to obtain the entity and time constraint range indicated by the query statement; Based on the time series knowledge graph, the entity and the time constraint range are subjected to graph conversion processing to obtain a query time series graph corresponding to the query statement, wherein the time series knowledge graph includes a plurality of nodes, one node corresponds to one entity, an edge is used to represent a logical relationship between entities corresponding to two connected nodes, and the node is attached with a timestamp; Graph convolution processing is performed on the query timing graph to obtain a first feature corresponding to the entity of the query statement and a second feature corresponding to the time of the query statement.

6. The method according to claim 5, characterized in that The step of performing answer reasoning on the first text based on the first feature and the second feature to obtain a second text that satisfies the time constraint condition includes: Based on the first feature, query the nodes in the temporal knowledge graph to obtain an entity matching the first feature and a third text associated with the entity; Based on the second feature, query the timestamp of the third text in the time series knowledge graph to obtain a fourth text corresponding to the timestamp matching the second feature; Based on the fourth text, a second text satisfying the time constraint is determined.

7. The method according to claim 6, characterized in that The determining, based on the fourth text, a second text satisfying the time constraint condition comprises: In the case where there are multiple fourth texts, scoring the multiple fourth texts based on the scoring influence factor of each fourth text to obtain the score of the fourth text; From the multiple fourth texts, fourth texts with scores greater than a score threshold are screened out, and the screened out fourth texts are used as second texts that meet the time constraint condition.

8. The method according to claim 5, characterized in that The step of performing answer reasoning on the first text based on the first feature and the second feature to obtain a second text that satisfies the time constraint condition includes: Based on the second feature, query the timestamp in the time series knowledge graph to obtain a fifth text corresponding to the timestamp matching the second feature; Performing feature extraction on the entity associated with the fifth text to obtain a fourth feature; The fourth feature is matched with the first feature, and when the fourth feature matches the first feature, the fifth text is used as the second text that meets the time constraint condition.

9. The method according to claim 1, characterized in that: The reasoning of the answer to the first text based on the first feature and the second feature to obtain the second one that satisfies the time constraint condition includes: fusing the first feature and the second feature to obtain a fused feature; Performing answer reasoning on the first text based on the fusion feature to obtain a sixth text; Based on the time comparison function in the time reasoning network, perform a time comparison on the fused feature and the second feature to obtain a comparison result, wherein the comparison result indicates a probability that the sixth text satisfies the time constraint condition; When the comparison result indicates that the probability is greater than a probability threshold, the sixth text is used as the second text satisfying the time constraint.

10. A text processing device, characterized in that: The device comprises: A statement construction module, used to generate a query statement of the first text based on the first text carrying the time constraint condition; A graph convolution module, used to perform graph convolution processing on the query statement to obtain a first feature corresponding to the entity of the query statement and a second feature corresponding to the time of the query statement; An answer reasoning module is used to perform answer reasoning on the first text based on the first feature and the second feature to obtain a second text that meets the time constraint condition.

11. An electronic device, characterized in that: The electronic device comprises: A memory for storing computer executable instructions or computer programs; The processor is used to implement the text processing method according to any one of claims 1 to 9 when executing the computer executable instructions or computer programs stored in the memory.

12. A computer-readable storage medium storing computer-executable instructions or a computer program, characterized in that: When the computer executable instructions or computer program are executed by a processor, the text processing method according to any one of claims 1 to 9 is implemented.

13. A computer program product comprising computer executable instructions or a computer program, characterized in that: When the computer executable instructions or computer program are executed by a processor, the text processing method according to any one of claims 1 to 9 is implemented.

Citation Information

Cited By

  • NLP semantic extraction unstructured text generation logic axis and computing power optimization method

    CN120218084A