Cross-paragraph text semantic representation vector generation method and device and storage medium
By combining the generation of multi-granularity graphs across paragraph texts with deep pre-trained language models, the problem of deep pre-trained language models having difficulty extracting semantic information in cross-paragraph texts is solved, achieving more accurate search and question-answering results.
Patent Information
- Application Number
- CN202510639074.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2021-02-08
- Publication Date
- 2025-09-26
AI Technical Summary
Existing deep pre-trained language models have difficulty effectively extracting semantic information across paragraphs in complex search and question-answering scenarios, especially when the object relationships in multi-paragraph text are complex, the generated semantic representation vectors are not effective.
By generating a multi-granularity graph across paragraph texts, combining it with the semantic representation vector of a deep pre-trained language model, and fusing multiple granularity sub-text relationships within the same paragraph and across paragraphs, a richer semantic representation vector for cross-paragraph texts is generated.
The ranking accuracy of search candidate paths and the extraction accuracy of question-answering answers are improved, and rich semantic information of cross-paragraph text is captured through multi-granularity fusion.
Smart Images

Figure CN120706429A_ABST
Abstract
Description
[0001] This application is a divisional application. The application number of the original application is 202110172625.6, and the original application date is February 8, 2021. The entire content of the original application is incorporated into this application by reference. Technical Field
[0002] The present application relates to the field of artificial intelligence technology, and in particular to a method, device, and storage medium for generating a semantic representation vector of a cross-paragraph text. Background Art
[0003] Currently, deep pre-trained language models are the mainstream technology in natural language processing tasks such as search and question answering. Deep pre-trained language models can generate semantic representation vectors for input text, but because their core structure - the fully connected attention layer - extracts semantic information, it completely relies on the model's learning of the relationship between identifier tokens. Tokens are obtained after text segmentation, thus completely discarding any additional prior information that may be obtained, such as Figure 1a For complex search and question-answering scenarios, where the input involves multiple paragraphs, using deep pre-trained language models presents challenges such as more input text, more complex relationships between objects within the text, and the need to extract cross-paragraph semantic information. This significantly reduces the performance of models that rely solely on learning relationships between tokens to extract semantic information, significantly increasing the difficulty of generating text semantic representation vectors using deep pre-trained language models.
[0004] In the existing technology, for complex search, question-answering and other scenarios, in order to better generate cross-paragraph text semantic representation vectors based on deep pre-trained language models, based on the semantic connection between entities, information interaction is performed at the entity granularity to generate a graph node feature vector in the entity graph, and the graph node feature vector is fused with the text semantic representation vector generated by the deep pre-trained language model to obtain the final cross-paragraph text semantic representation vector. In addition to the semantic information extracted by the deep pre-trained language model, the cross-paragraph text semantic representation vector generated by this method also incorporates additional prior information such as the semantic connection between entities. Figure 1b shown.
[0005] However, because the semantic connection at the entity granularity is too simple, this technology cannot effectively solve the problem of weak semantic connection between multiple web page paragraphs input in complex search and question-answering task scenarios. It is also unable to focus on key semantic information for longer input texts, more complex objects and the relationships between objects, and the effect of improving the semantic representation vector of cross-paragraph text is not obvious. Summary of the Invention
[0006] The present application discloses a method, device and storage medium for generating a cross-paragraph text semantic representation vector, which can generate a cross-paragraph text semantic representation vector with richer and more comprehensive semantics.
[0007] In the first aspect, an embodiment of the present application provides a method for generating a semantic representation vector of a cross-paragraph text, comprising: obtaining a first semantic representation vector and a multi-granularity graph of the cross-paragraph text based on the cross-paragraph text, wherein the cross-paragraph text includes at least two paragraphs, and the multi-granularity graph indicates the relationship between sub-texts of multiple granularities within the same paragraph of the cross-paragraph text, as well as the relationship between sub-texts of multiple granularities across paragraphs; obtaining a graph node feature vector of the cross-paragraph text based on the first semantic representation vector of the cross-paragraph text and the multi-granularity graph, the graph node feature vector indicating the semantic information of sub-texts of multiple granularities within the same paragraph and across paragraphs of the cross-paragraph text; obtaining a second semantic representation vector of the cross-paragraph text, wherein both the first semantic representation vector and the second semantic representation vector indicate the semantic information of the cross-paragraph text, and the second semantic representation vector is obtained by fusing the first semantic representation vector of the cross-paragraph text and the graph node feature vector. The above-mentioned second semantic representation vector is obtained by fusing the first semantic representation vector of the cross-paragraph text and the graph node feature vector, that is, by fusing the first semantic representation vector of the cross-paragraph text and the graph node feature vector. This fusion is based on the first semantic representation vector of the cross-paragraph text, and then fuses the relationships between sub-texts of multiple granularities within the same paragraph and across paragraphs to obtain the above-mentioned second semantic representation vector. Fusion refers to obtaining a single feature vector based on two feature vectors. This solution does not specifically limit how to achieve fusion. For example, fusion can be achieved by vector superposition, or other fusion methods can also be used.
[0008] Through the embodiment of the present application, the graph node feature vector of the cross-paragraph text is obtained based on the first semantic representation vector and the multi-granularity graph of the cross-paragraph text, and the second semantic representation vector of the cross-paragraph text is obtained based on the above-mentioned first semantic representation vector and the graph node feature vector. Compared with the semantic representation vector of the cross-paragraph text obtained based on only the single granularity of entity granularity in the prior art, the semantic representation vector of the cross-paragraph text obtained based on multiple granularities is obtained according to the relationship between multi-granularity texts within the same paragraph in the cross-paragraph text, and the relationship between multi-granularity texts across paragraphs. Since the present solution involves more types of granularity, the semantic information contained in the semantic representation vector of the cross-paragraph text is richer and more comprehensive when generating the semantic representation vector, which helps to improve the accuracy of the ranking of candidate paths for subsequent searches, and also helps to improve the accuracy of question and answer answer extraction.
[0009] As an optional implementation manner, the relationship between sub-texts of multiple granularities includes the relationship between sub-texts of the same granularity and the relationship between sub-texts of different granularities.
[0010] Based on the captured various relationships in cross-paragraph texts, the goal of fully expressing the semantic connections between cross-paragraph texts at different levels is achieved.
[0011] As an optional implementation, the multi-granularity graph includes nodes of at least two granularities and edges for connecting two nodes, wherein each node of the at least two granularities indicates a sub-text of a granularity, and the edge indicates the relationship between the two connected nodes, and the relationship is a relationship between sub-texts of the same granularity or a relationship between sub-texts of different granularities.
[0012] Multi-granularity composition is performed based on the text organization structure of cross-paragraph text and the various relationships captured in the cross-paragraph text, achieving the purpose of fully expressing the semantic connections between cross-paragraph texts at different levels.
[0013] As an optional implementation, a first intermediate result is obtained based on the first semantic representation vector of the cross-paragraph text and the subtexts carried by nodes of multiple granularities in the multi-granularity graph; a second intermediate result is obtained based on the relationship between the first intermediate result and subtexts of the same granularity; and a graph node feature vector of the cross-paragraph text is obtained based on the relationship between the second intermediate result and subtexts of different granularities. The relationship between subtexts of the same granularity involves multiple granularities.
[0014] This scheme not only performs information interaction within nodes of the same granularity on the graph node feature vectors, so that the graph node feature vectors can fully capture the semantic connections across paragraphs at different levels of semantic information; it also performs information interaction between nodes of different granularity on the graph node feature vectors, so that the feature vectors of each type of node contain semantic information at different levels from macro to local, which makes the amount of information contained in the graph node feature vectors more comprehensive and rich.
[0015] As an optional implementation method, the first intermediate result and the first subgraph are input into a first neural network to obtain a first intermediate result after the first subgraph is updated, wherein the first subgraph includes nodes of the first granularity in the multi-granularity graph and edges corresponding to the nodes of the first granularity; the first intermediate result and the second subgraph are input into a second neural network to obtain a first intermediate result after the second subgraph is updated, wherein the second subgraph includes nodes of the second granularity in the multi-granularity graph and edges corresponding to the nodes of the second granularity; the second intermediate result is obtained based on the first intermediate result after the first subgraph is updated and the first intermediate result after the second subgraph is updated.
[0016] The multi-granularity graph includes at least two of paragraph granularity, sentence granularity and entity granularity.
[0017] Among them, paragraph division can be performed starting with the indentation of the first line of the current paragraph and ending with the indentation of the first line of the adjacent paragraph, thereby obtaining nodes of paragraph granularity. Sentence division can be performed using punctuation marks such as commas, semicolons, periods, exclamation marks, and ellipsis as units, thereby obtaining nodes of sentence granularity. In this solution, an entity refers to an instance of a concept, and an entity is a text or a label. For example, entities are mainly nouns, numerals, and other words or phrases with clear reference objects, such as names of people, places, organizations, proper nouns, etc., as well as texts representing concepts such as time, quantity, currency, and proportional values. Entity recognition can be performed based on entity recognition technology, thereby obtaining nodes of entity granularity.
[0018] As an optional implementation, the relationship includes at least one of the following: inclusion, inclusion of the same entity, entity co-reference, and web page hyperlink.
[0019] The aforementioned inclusion relationships include relationships such as paragraphs including sentences and sentences including entities. A "containing the same entity" relationship indicates that sentences have the same entity. An entity co-reference relationship indicates that entities have the same meaning. A webpage hyperlink relationship indicates that at least two paragraphs have a webpage hyperlink relationship.
[0020] As an optional implementation, the first neural network and the second neural network are different heterogeneous graph neural networks.
[0021] In a second aspect, an embodiment of the present application provides a device for generating a semantic representation vector of a cross-paragraph text, comprising: a first generation module, for obtaining a first semantic representation vector and a multi-granularity graph of the cross-paragraph text based on the cross-paragraph text, wherein the cross-paragraph text includes at least two paragraphs, and the multi-granularity graph indicates the relationship between sub-texts of multiple granularities within the same paragraph in the cross-paragraph text, as well as the relationship between sub-texts of multiple granularities across paragraphs; a second generation module, for obtaining a graph node feature vector of the cross-paragraph text based on the first semantic representation vector of the cross-paragraph text and the multi-granularity graph, wherein the graph node feature vector indicates semantic information of sub-texts of multiple granularities within the same paragraph and across paragraphs of the cross-paragraph text; a third generation module, for obtaining a second semantic representation vector of the cross-paragraph text, wherein both the first semantic representation vector and the second semantic representation vector indicate semantic information of the cross-paragraph text, and the second semantic representation vector is obtained by fusing the first semantic representation vector of the cross-paragraph text and the graph node feature vector.
[0022] Optionally, the multi-granularity graph includes nodes of at least two granularities and edges for connecting two nodes, wherein each of the at least two granularities of nodes indicates a sub-text of a granularity, and the edge indicates the relationship between the two connected nodes, and the relationship is a relationship between sub-texts of the same granularity or a relationship between sub-texts of different granularities.
[0023] Among them, the second generation module is used to: the second generation module is used to: obtain a first intermediate result based on the first semantic representation vector of the cross-paragraph text and the sub-texts carried by nodes of multiple granularities in the multi-granularity graph; obtain a second intermediate result based on the relationship between the first intermediate result and sub-texts of the same granularity; obtain the graph node feature vector of the cross-paragraph text based on the relationship between the second intermediate result and sub-texts of different granularities.
[0024] Optionally, the multi-granularity graph includes a first granularity and a second granularity, and the second generation module is used to: input the first intermediate result and the first subgraph into the first neural network to obtain a first intermediate result after the first subgraph is updated, the first subgraph includes the nodes of the first granularity in the multi-granularity graph, and the edges corresponding to the nodes of the first granularity; input the first intermediate result and the second subgraph into the second neural network to obtain the first intermediate result after the second subgraph is updated, the second subgraph includes the nodes of the second granularity in the multi-granularity graph, and the edges corresponding to the nodes of the second granularity; obtain the second intermediate result based on the first intermediate result after the first subgraph is updated and the first intermediate result after the second subgraph is updated.
[0025] Optionally, the multi-granularity graph includes at least two of paragraph granularity, sentence granularity and entity granularity.
[0026] Optionally, the relationship includes at least one of the following: inclusion, inclusion of the same entity, entity co-reference, and web page hyperlink.
[0027] Optionally, the first neural network and the second neural network are different heterogeneous graph neural networks.
[0028] In a third aspect, an embodiment of the present application provides a device for generating a semantic representation vector of a cross-paragraph text, comprising a processor and a memory; wherein the memory is used to store program code, and the processor is used to call the program code to execute the described method.
[0029] In a fourth aspect, the present application provides a computer storage medium comprising computer instructions, which, when executed on an electronic device, enables the electronic device to execute a method as provided in any possible implementation of the first aspect.
[0030] In a fifth aspect, an embodiment of the present application provides a computer program product, which, when executed on a computer, enables the computer to execute a method provided in any possible implementation of the first aspect.
[0031] It is understandable that the apparatus described in the second aspect, the apparatus described in the third aspect, the computer storage medium described in the fourth aspect, or the computer program product described in the fifth aspect are all used to execute any of the methods provided in the first aspect. Therefore, the beneficial effects that can be achieved can be referenced to the beneficial effects of the corresponding methods and will not be repeated here. BRIEF DESCRIPTION OF THE DRAWINGS
[0032] The following is an introduction to the drawings used in the embodiments of this application.
[0033] Figure 1a This is a schematic diagram of the fully connected attention layer of the deep pre-trained language model in the existing technology;
[0034] Figure 1b This is a flowchart of a method for generating a semantic representation vector of a cross-paragraph text in the prior art;
[0035] Figure 2a This is a natural language processing system provided by an embodiment of the present application;
[0036] Figure 2b It is another natural language processing system provided by the embodiment of the present application;
[0037] Figure 2c It is another natural language processing system provided by the embodiment of the present application;
[0038] Figure 2d This is a schematic diagram of a system architecture provided by an embodiment of the present application;
[0039] Figure 3 This is a flow chart of a method for generating a semantic representation vector of a cross-paragraph text provided in an embodiment of the present application;
[0040] Figure 4a This is a node division diagram provided in an embodiment of the present application;
[0041] Figure 4b This is a schematic diagram of an edge of a node within a paragraph provided by an embodiment of the present application;
[0042] Figure 4c is a schematic diagram of a multi-granularity graph provided in an embodiment of the present application;
[0043] Figure 4d This is a schematic diagram of a subgraph of a paragraph-granularity node provided in an embodiment of the present application;
[0044] Figure 4e This is a schematic diagram of a subgraph of a sentence-granularity node provided in an embodiment of the present application;
[0045] Figure 4f This is a schematic diagram of a subgraph of nodes of different granularities provided in an embodiment of the present application;
[0046] Figure 5 This is a flow chart of a method for generating a semantic representation vector of a cross-paragraph text provided in an embodiment of the present application;
[0047] Figure 6a is a schematic diagram of a multi-granularity graph provided in an embodiment of the present application;
[0048] Figure 6b This is a schematic diagram of updating a graph node feature vector provided by an embodiment of the present application;
[0049] Figure 6c This is a schematic diagram of another method for updating a graph node feature vector provided by an embodiment of the present application;
[0050] Figure 7 This is a flow chart of a method for generating a semantic representation vector of a cross-paragraph text provided in an embodiment of the present application;
[0051] Figure 8 Schematic diagram of a device for generating a semantic representation vector of a cross-paragraph text provided in an embodiment of the present application;
[0052] Figure 9 It is a structural diagram of another device for generating a semantic representation vector of cross-paragraph text provided in an embodiment of the present application. DETAILED DESCRIPTION
[0053] The following describes the embodiments of the present application in conjunction with the accompanying drawings. The terms used in the implementation methods of the embodiments of the present application are only used to explain the specific embodiments of the present application and are not intended to limit the present application.
[0054] Scene Introduction
[0055] like Figure 2a As shown, a natural language processing system includes a user device and a data processing device.
[0056] The user device includes a user and an intelligent terminal such as a mobile phone, a personal computer or an information processing center. The user device is the initiator of natural language data processing, and is the initiator of language question and answer or query requests. Usually, the user initiates the request through the user device.
[0057] The data processing device can be a device or server with data processing capabilities, such as a cloud server, network server, application server, or management server. The data processing device receives query statements / voice / text queries from the smart terminal via the interactive interface, and then performs language data processing using a memory for storing data and a data processing processor, including machine learning, deep learning, search, reasoning, and decision-making. The memory can be a general term that includes local storage and a database for storing historical data. The database can be located on the data processing device or on another network server.
[0058] like Figure 2b The figure shows another application scenario of the natural language processing system. In this scenario, the smart terminal directly acts as a data processing device, directly receiving input from the user and directly processing it by the hardware of the smart terminal itself. The specific process is the same as Figure 2a Similarly, please refer to the above description and will not be repeated here.
[0059] like Figure 2c As shown, the user device may be a local device 101 or 102, and the data processing device may be an execution device 110, wherein the data storage system 150 may be integrated on the execution device 110, or may be set on a cloud or other network server.
[0060] See attached Figure 2d , an embodiment of the present invention provides a system architecture 200. A data collection device 260 is used to collect training data and store it in a database 230. A training device 220 generates a cross-paragraph text semantic representation vector model 201 based on the training data maintained in the database 230. The following describes in more detail how the training device 220 obtains the cross-paragraph text semantic representation vector model 201 based on the training data. The generated cross-paragraph text semantic representation vector model can determine the web page ranking of candidate paths or the final answer to the question based on the question statement.
[0061] Figure 2d The following is a functional module diagram of the data processing process, corresponding to Figure 2a-2c In the actual application scenario diagram in FIG, the user equipment 240 may be Figure 2a-2c The user device in the embodiment, the execution device 210 and the data storage system 250 are Figure 2a-2c In some embodiments, the execution device 210 and the data storage system 250 may be integrated into the user device. Figure 2a The database 230, training device 220 and data acquisition device 260 can be integrated into the data processing device. Figure 2aThe data processing device in the system can be set up on the cloud or other servers on the network.
[0062] In the field of NLP, the data acquisition device 260 can be a terminal device or an input and output interface of a server or cloud, which is an interactive layer (interface) for obtaining query statements and returning response statements.
[0063] The above-mentioned cross-paragraph text semantic representation vector model 201 can be composed of a deep neural network. The operation of each layer in the deep neural network can be described by a mathematical expression: From a physical perspective, the operation of each layer in the deep neural network can be understood as completing the transformation from the input space to the output space (i.e., from the row space to the column space of the matrix) through five operations on the input space (a set of input vectors). These five operations include: 1. Dimensionality increase / decrease; 2. Zoom in / out; 3. Rotation; 4. Translation; 5. "Bending". Operations 1, 2, and 3 are performed by , operation 4 is completed by , and operation 5 is implemented by . The word "space" is used here because the object being classified is not a single thing, but a class of things, and space refers to the collection of all individuals of this class of things. Among them, is a weight vector, and each value in this vector represents the weight value of a neuron in this layer of the neural network. This vector determines the spatial transformation from the input space to the output space described above, that is, the weight of each layer controls how the space is transformed. The purpose of training a deep neural network is to ultimately obtain the weight matrix of all layers of the trained neural network (a weight matrix formed by vectors from many layers). Therefore, the training process of a neural network is essentially about learning how to control spatial transformations, and more specifically, about learning the weight matrix.
[0064] Because we want the output of a deep neural network to be as close as possible to the value we really want to predict, we can compare the current network's predicted value with the target value we really want, and then update the weight vector of each layer of the neural network based on the difference between the two (of course, there is usually an initialization process before the first update, which is to pre-configure the parameters for each layer in the deep neural network). For example, if the network's predicted value is too high, the weight vector is adjusted to make it predict a lower value, and this adjustment is continued until the neural network can predict the target value we really want. Therefore, it is necessary to pre-define "how to compare the difference between the predicted value and the target value." This is the loss function or objective function, which are important equations used to measure the difference between the predicted value and the target value. Taking the loss function as an example, the higher the output value (loss) of the loss function, the greater the difference. Then, the training of the deep neural network becomes a process of minimizing this loss as much as possible.
[0065] The cross-paragraph text semantic representation vector model 201 obtained by the training device 220 can be applied to different systems or devices. Figure 2d In the embodiment, the execution device 210 is configured with an I / O interface 212 for data interaction with external devices, and a “user” can input data into the I / O interface 212 through a user device 240 .
[0066] The execution device 210 can call data, code, etc. in the data storage system 250 , and can also store data, instructions, etc. in the data storage system 250 .
[0067] The association function module 213 pre-processes the received question sentence to facilitate the subsequent generation of a cross-paragraph text semantic representation vector for the question sentence. Optionally, the association function module 213 can also post-process the generated cross-paragraph text semantic representation vector to output a sentence / speech / text, etc.
[0068] Finally, the I / O interface 212 returns the processing result to the user device 240 and provides it to the user.
[0069] More deeply, the training device 220 can generate corresponding cross-paragraph text semantic representation vector models 201 based on different data for different goals to provide users with better results.
[0070] exist Figure 2d In the case shown in , the user can manually specify the data to be input into the execution device 210, for example, by operating in the interface provided by the I / O interface 212. In another case, the user device 240 can automatically input data into the I / O interface 212 and obtain the results. If the automatic input of data by the user device 240 requires user authorization, the user can set the corresponding permissions in the user device 240. The user can view the results output by the execution device 210 on the user device 240, and the specific presentation form can be a specific method such as display, sound, action, etc. The user device 240 can also serve as a data collection terminal to store the collected training data in the database 230.
[0071] It is worth noting that Figure 2d This is only a schematic diagram of a system architecture provided by an embodiment of the present invention. The positional relationship between the devices, components, modules, etc. shown in the figure does not constitute any limitation. For example, in the attached Figure 2d In the embodiment, the data storage system 250 is an external memory relative to the execution device 210. In other cases, the data storage system 250 can also be placed in the execution device 210.
[0072] The following is a detailed introduction to the method for generating a cross-paragraph text semantic representation vector provided by an embodiment of the present application. Among them, the embodiment of the present application is applicable to complex search scenarios and complex question-and-answer scenarios. A complex search scenario refers to a query input by a user that is related to information on at least two web pages. Specifically, the search engine needs to output multiple paths from large to small according to the correlation between the query and the path, and each path includes at least two web pages. The path can be understood as a set consisting of two or more web page paragraphs that have semantic connections. A complex question-and-answer scenario refers to a question input by a user that needs to get a correct answer based on the information on at least two web pages. Specifically, the question-and-answer system needs to extract the answer based on an optimal path recalled, and the optimal path is the path that is most likely to extract the correct answer based on the path. In other words, the embodiment of the present application is applicable to scenarios where the results of search / question-and-answer are determined based on at least two web pages.
[0073] Reference Figure 3 FIG. 1 is a flow chart of a method for generating a semantic representation vector of a cross-paragraph text provided in an embodiment of the present application. The method specifically includes steps 301-303, which are as follows:
[0074] 301. Obtain a first semantic representation vector and a multi-granularity graph of the cross-paragraph text based on the cross-paragraph text, wherein the cross-paragraph text includes at least two paragraphs, and the multi-granularity graph indicates relationships between sub-texts of multiple granularities within the same paragraph of the cross-paragraph text, and relationships between sub-texts of multiple granularities across paragraphs.
[0075] Before step 301, the method may further include steps 3001-3003, which are specifically as follows:
[0076] 3001. Receive Query / Question input from the user;
[0077] The Query represents the text content entered by the user in the search box, that is, the "query" entered by the user. For example, the user searches for relevant information on a search engine.
[0078] The Question represents the question entered by the user. For example, the user performs a question-and-answer operation based on a question-and-answer robot or smart speaker.
[0079] 3002. Obtain M candidate paths according to the Query / Question input by the user, where each candidate path includes at least two web pages;
[0080] The candidate path represents the source of the current web page as a candidate query result or answer to the question. Based on the above M candidate paths, the M candidate paths are sorted to obtain the final query result / answer to the question.
[0081] 3003. Obtain M cross-paragraph texts according to the Query / Question and at least two web pages of each candidate path in the M candidate paths.
[0082] Optionally, the first paragraph of each of the at least two web pages of each candidate path is obtained, and then the Query / Question and the first paragraph of each of the at least two web pages of each candidate path are concatenated to obtain M cross-paragraph texts.
[0083] That is, each cross-paragraph text includes at least two paragraphs. The above embodiment uses the first paragraph of each web page as an example for splicing. As another implementation, the last paragraph of each web page can be used for splicing. Of course, any other paragraphs can also be spliced, such as the first paragraph of the first web page and the second paragraph of the second web page, etc. This solution does not specifically limit this.
[0084] Specifically, the first semantic representation vector of each cross-paragraph text can be obtained by inputting the cross-paragraph text into a deep pre-trained language model.
[0085] It should be noted that the embodiment of the present application is described by taking M as 1 as an example.
[0086] The multi-granularity graph includes nodes of at least two granularities and edges for connecting two nodes, wherein each node of the at least two granularities indicates a sub-text of a granularity, and the edge indicates the relationship between the two connected nodes, and the relationship is a relationship between sub-texts of the same granularity or a relationship between sub-texts of different granularities.
[0087] As an implementation method, the above-mentioned step of obtaining the multi-granularity graph of the cross-paragraph text according to the cross-paragraph text includes steps 301A-301C, which are specifically as follows:
[0088] 301A. Obtaining, based on at least two paragraphs in the cross-paragraph text, a node corresponding to each of the at least two paragraphs, wherein the node corresponding to each paragraph includes nodes of at least two granularities;
[0089] A sentence segmentation technology and an entity recognition technology are used for any of the above cross-paragraph texts to obtain nodes of different granularities corresponding to each paragraph in the above at least two paragraphs.
[0090] Specifically, paragraphs can be divided starting with the indentation of the first line of the current paragraph and ending with the indentation of the first line of the adjacent paragraph, thereby obtaining nodes of paragraph granularity. Sentences can be divided using punctuation marks such as commas, semicolons, periods, exclamation points, and ellipsis as units, thereby obtaining nodes of sentence granularity. In this solution, entities refer to instances of a certain concept, mainly including nouns such as names of people, places, organizations, and proper nouns, as well as text representing concepts such as time, quantity, currency, and proportional values. Entity recognition can be performed based on entity recognition technology, thereby obtaining nodes of entity granularity.
[0091] The above embodiment uses paragraph, sentence, and entity granularity as examples for division. Alternatively, any two of these three granularities may be used, for example, paragraph and sentence granularity, sentence and entity granularity, or paragraph and entity granularity. Of course, any other granularity is also possible, and this solution does not impose any specific limitations on this.
[0092] like Figure 4a FIG. 1 is a schematic diagram of node division of a cross-paragraph text provided by an embodiment of the present application. The cross-paragraph text includes:
[0093] Query: When was the author of Harry Potter born?
[0094] Paragraph 1: Harry Potter is a series of seven fantasy novels, written by British author JKRowling……
[0095] Paragraph 2: JKRowling (born 31July 1965), is best known for writing the Harry Potter fantasy series…
[0096] Reference Figure 4a , where the nodes at paragraph granularity include 2, the nodes at sentence granularity shown in the figure include 5, and the nodes at entity granularity shown in the figure include 6. The total number of nodes in paragraph 1 includes 6, and the total number of nodes in paragraph 2 includes 5.
[0097] 301B. Obtain edges corresponding to the nodes in each paragraph according to the relationship between the nodes in each paragraph of the at least two paragraphs;
[0098] Based on the inclusion relationship between paragraphs and sentences, the inclusion relationship between sentences and entities, and the contextual relationship between sentences in the above-mentioned cross-paragraph text T, edge connections are established between paragraphs and sentences within the paragraph, between adjacent sentences in the same paragraph, between sentences and entities within the sentence, and between entities within the same sentence.
[0099] like Figure 4b As shown, based on the above inclusion relationship and contextual relationship, we can get Figure 4a The edges corresponding to the nodes in paragraph 1 and the edges corresponding to the nodes in paragraph 2 are shown.
[0100] 301C. Obtain edges corresponding to nodes across paragraphs based on the relationship between the nodes between the at least two paragraphs.
[0101] By fully capturing the relationships across paragraph texts at various granularities, including but not limited to web page hyperlinks, inclusion of the same entities, entity co-occurrence, entity co-reference, and other relationships, that is, at least two paragraphs have web page hyperlink relationships, sentences with the same entities, entities indicating the same meaning, etc., based on the above various relationships, cross-paragraph edge connections are established at different granularities.
[0102] The multi-granularity graph of the cross-paragraph text T includes nodes corresponding to at least two paragraphs of the cross-paragraph text T, edges corresponding to nodes within paragraphs of at least two paragraphs of the cross-paragraph text T, and edges corresponding to nodes across paragraphs.
[0103] like Figure 4c As shown, Figure 4b On this basis, the edges corresponding to the nodes across paragraphs between paragraph 1 and paragraph 2 are obtained to obtain a multi-granularity graph.
[0104] The above embodiment performs multi-granularity composition based on the text organization structure of cross-paragraph text and the above-mentioned various relationships captured in the cross-paragraph text, thereby achieving the purpose of fully expressing the semantic connections of cross-paragraph text at different levels.
[0105] 302. Obtain a graph node feature vector of the cross-paragraph text based on the first semantic representation vector of the cross-paragraph text and the multi-granularity graph, wherein the graph node feature vector indicates semantic information of sub-texts of multiple granularities within the same paragraph and across paragraphs of the cross-paragraph text;
[0106] A graph node feature vector is usually a real-valued vector of fixed length, which is used to represent the data or information of different nodes in the graph.
[0107] Step 302 may specifically include steps 3021-3023, as follows:
[0108] 3021. Obtain a first intermediate result based on the first semantic representation vector of the cross-paragraph text and the subtexts carried by nodes of multiple granularities in the multi-granularity graph;
[0109] For cross-paragraph text, a first semantic representation vector is output based on a deep pre-trained language model, and then a first intermediate result corresponding to a node in the multi-granularity graph is obtained based on the first semantic representation vector. To distinguish nodes of different granularities (types), the graph node feature vectors of nodes of different granularities are mapped to different vector spaces.
[0110] 3022. Obtain a second intermediate result based on the relationship between the first intermediate result and the subtext of the same granularity;
[0111] Step 3022 may include steps 3022A-3022C, which are specifically as follows:
[0112] 3022A. Input the first intermediate result and the first subgraph into a first neural network to obtain a first intermediate result after the first subgraph is updated, where the first subgraph includes nodes of a first granularity in the multi-granularity graph and edges corresponding to the nodes of the first granularity.
[0113] For example, the first granularity is the paragraph granularity, and the first sub-graph can refer to Figure 4d shown.
[0114] 3022B. Input the first intermediate result and the second subgraph into a second neural network to obtain an updated first intermediate result of the second subgraph, where the second subgraph includes nodes of a second granularity in the multi-granularity graph and edges corresponding to the nodes of the second granularity.
[0115] For example, the second granularity is the sentence granularity, and the second subgraph can refer to Figure 4e shown.
[0116] The first and second neural networks described above can be heterogeneous graph neural networks. A heterogeneous graph neural network uses a heterogeneous graph as its computational graph, distinguishing between node and edge types when performing information transfer, transformation, and aggregation on the graph. A heterogeneous graph contains more than one node or edge type. Specifically, different granularities correspond to heterogeneous graph neural networks with different parameters.
[0117] 3022C. Obtain the second intermediate result according to the updated first intermediate result of the first subgraph and the updated first intermediate result of the second subgraph.
[0118] The second intermediate result is obtained by integrating the graph node feature vectors updated at the first granularity and the second granularity, respectively.
[0119] Since cross-paragraph texts are connected at different semantic levels, and the focus of semantic connections at different levels is different, by capturing the connections at each semantic level, cross-paragraph semantic information can be extracted more comprehensively and fully.
[0120] When performing multi-granularity composition based on cross-paragraph text, cross-paragraph edge connections are established according to the relationships between cross-paragraph texts at each granularity. Therefore, through information interaction within nodes of the same granularity, the semantic connections across paragraphs can be fully captured at different levels of semantic information.
[0121] This embodiment of the present application uses two granularities as an example for illustration. Accordingly, when there are three different granularities, for example, the third granularity is an entity granularity, the subgraph corresponding to the entity granularity is also included. The processing method is the same as that for the first and second granularities described above, and this solution will not be repeated here.
[0122] 3023. Obtain a graph node feature vector of the cross-paragraph text based on the relationship between the second intermediate result and sub-texts of different granularities.
[0123] Specifically, the second intermediate result and the third subgraph are input into the third neural network to obtain a graph node feature vector.
[0124] The third sub-graph can be found in Figure 4f As shown, by retaining multiple granularity Figure 4c The edges and corresponding nodes between nodes of different granularity can be obtained Figure 4f .
[0125] By further interacting information between nodes of different granularities, a graph node feature vector is generated. The graph node feature vector contains semantic information at multiple levels, from macro to local.
[0126] Paragraph-level nodes contain paragraph-level semantic information, sentence-level nodes contain sentence-level semantic information, and entity-level nodes contain entity-level semantic information. Semantic information from the paragraph to the entity level encompasses information from coarse-grained to fine-grained, and from macroscopic to local. By allowing graph node feature vectors to interact with nodes of different granularities, the feature vectors of each node in the graph contain semantic information at different levels, from macroscopic to local. This makes the graph node feature vectors more comprehensive and rich in information.
[0127] 303. Obtain a second semantic representation vector of the cross-paragraph text, where the first semantic representation vector and the second semantic representation vector both indicate semantic information of the cross-paragraph text, and the second semantic representation vector is obtained by fusing the first semantic representation vector of the cross-paragraph text and the graph node feature vector.
[0128] A second semantic representation vector of the cross-paragraph text is obtained by fusing the first semantic representation vector of the cross-paragraph text and the graph node feature vector.
[0129] The above-mentioned second semantic representation vector is obtained by fusing the first semantic representation vector of the cross-paragraph text and the graph node feature vector, that is, it is obtained by fusing the first semantic representation vector of the cross-paragraph text and the graph node feature vector. This fusion is based on the first semantic representation vector of the cross-paragraph text, and the relationship between sub-texts of multiple granularities within the same paragraph of the cross-paragraph text and across paragraphs is fused to obtain the above-mentioned second semantic representation vector. For example, the fusion is performed by vector superposition, or other means can also be used, and this solution does not make specific restrictions on this.
[0130] Through the embodiment of the present application, the graph node feature vector of the cross-paragraph text is obtained based on the first semantic representation vector and the multi-granularity graph of the cross-paragraph text, and the second semantic representation vector of the cross-paragraph text is obtained based on the above-mentioned first semantic representation vector and the graph node feature vector. Compared with the semantic representation vector of the cross-paragraph text obtained based on only the single granularity of entity granularity in the prior art, the semantic representation vector of the cross-paragraph text obtained based on multiple granularities is obtained according to the relationship between multi-granularity texts within the same paragraph in the cross-paragraph text, and the relationship between multi-granularity texts across paragraphs. Since the present solution involves more types of granularity, the semantic information contained in the semantic representation vector of the cross-paragraph text is richer and more comprehensive when generating the semantic representation vector, which helps to improve the accuracy of the ranking of candidate paths for subsequent searches, and also helps to improve the accuracy of question and answer answer extraction.
[0131] On the other hand, this scheme not only performs information interaction within nodes of the same granularity on the graph node feature vector, so that the graph node feature vector can fully capture the semantic connections across paragraphs at different levels of semantic information; but also performs information interaction between nodes of different granularity on the graph node feature vector, so that the feature vector of each type of node contains semantic information at different levels from macro to local, which makes the amount of information contained in the graph node feature vector more comprehensive and rich.
[0132] Example 1
[0133] The following is a detailed description of the method for generating a cross-paragraph text semantic representation vector provided by the present application, using the application of the method in a search scenario as an example. Among them, the embodiment of the present application can be applied to search engines such as Baidu Search, Google Search, etc.
[0134] Reference Figure 5 FIG. 5 is a flow chart of a web page ranking method for a search scenario provided by an embodiment of the present application. The method may include steps 501-505, which are as follows:
[0135] 501. Receive the query input by the user;
[0136] 502. Obtaining a recalled web page according to the Query input by the user;
[0137] Specifically, based on the query input by the user, the web page rough recall module recalls several candidate web pages.
[0138] Generally, if it is a general query, the webpage coarse recall module will recall a set of candidate webpages; if it is a complex query, the webpage coarse recall module will recall a set of candidate paths, that is, each candidate path contains at least two webpages.
[0139] 503. Confirm whether the acquired path is a candidate path set;
[0140] The webpage rough recall module determines whether the recalled set is a candidate path set. Specifically, the module determines whether each element in the recalled set contains a single webpage or multiple webpages, thereby determining whether the candidate path set is obtained. If the candidate path set is obtained, i.e., corresponding to a complex search scenario, the rough recall result is input into the path fine ranking module, and step 504 is executed to output the ranking result of the candidate paths. If the candidate path set is not obtained, i.e., corresponding to a general search scenario, the rough recall result is input into the webpage fine ranking module, and step 505 is executed to output the ranking result of the candidate webpages.
[0141] 504. If the recalled webpage is a webpage of a candidate path, sort the M candidate paths in the candidate path set to obtain a sorting result of the M candidate paths;
[0142] The above step 504 may include steps 5041-5046, which are specifically as follows:
[0143] 5041. Obtain the cross-paragraph text of each candidate path in the M candidate paths;
[0144] Specifically, the candidate path set P recalled by the webpage rough recall module can be expressed as:
[0145] P = {p1, p2, ...pi, ...pM}, where i∈(1, M)
[0146] Among them, pi represents the path ranked in the i-th position during the web page rough recall process, and M represents that the web page rough recall module recalls a total of M candidate paths.
[0147] Each of the above paths contains multiple web pages. Preferably, the first paragraph of each web page is taken as the web page text, and any path pi can be expressed as:
[0148] pi={w1,w2,……wj,……wK}, where j∈(1,K)
[0149] Wherein, wj represents the webpage text of the j-th webpage in the path, and K represents that the path includes K webpages in total.
[0150] By concatenating the query text with the text of each candidate path in the M candidate paths, we can obtain the cross-paragraph text of each candidate path in the M candidate paths, and then we can obtain the cross-paragraph text set corresponding to the M candidate paths:
[0151] T={t1,t2,…ti,…tM}, i∈(1,M)
[0152] The cross-paragraph text of each candidate path can be expressed as:
[0153] ti=[Q][w1][w2]……[wj]……[wK], j∈(1,K)
[0154] Where Q represents the text of Query.
[0155] 5042. Obtain a first set of semantic representation vectors corresponding to the M candidate paths based on the cross-paragraph text of each candidate path;
[0156] The cross-paragraph texts t1-tM in the cross-paragraph text set are respectively input into the text semantic generation module implemented by the deep pre-trained language model to obtain the first semantic representation vector set corresponding to the M candidate paths:
[0157] R={r1,r2,…ri,…rM}, i∈(1,M)
[0158] Where ri represents the first semantic representation vector of the i-th candidate path.
[0159] 5043. Obtain a multi-granularity graph for each of the M candidate paths based on the cross-paragraph text of each candidate path;
[0160] The present application embodiment uses nodes of three granularities as an example for explanation. Figure 6a shown.
[0161] For details, please refer to the description of generating a multi-granularity graph in the aforementioned embodiment to obtain a multi-granularity graph for each candidate path, that is, a multi-granularity graph for each cross-paragraph text, which will not be described in detail here.
[0162] 5044. Obtain a graph node feature vector of each cross-paragraph text according to the first semantic representation vector of each cross-paragraph text in the M cross-paragraph texts and the multi-granularity graph;
[0163] Specifically, when obtaining the graph node feature vector, the node feature vector of the multi-granularity graph Gi (the multi-granularity graph of the i-th candidate path) is first initialized based on the first semantic representation vector ri of the candidate path; then, in order to distinguish nodes of different granularities, different linear layers are used to map the node features of different granularities to different vector spaces, where the linear layer is a neural network structure, also known as a fully connected layer, in which each neuron is connected to all neurons in the previous layer, which can realize a linear combination or linear transformation of the input; then, as Figure 6b As shown in , different heterogeneous graph neural networks are used to perform information interaction between nodes of the same granularity at the paragraph granularity, sentence granularity, and entity granularity respectively; finally, as Figure 6c As shown in Figure 2, heterogeneous graph neural networks are used to implement information interaction between nodes of different granularities. After the above steps, the graph node feature vectors of M candidate paths can be obtained:
[0164] g={g1,g2,…gi,…gM}, i∈(1,M)
[0165] Where gi represents the graph node feature vector of the i-th candidate path.
[0166] 5045. Fuse the first semantic representation vector of each cross-paragraph text in the M cross-paragraph texts with the graph node feature vector to obtain a semantic representation vector of each cross-paragraph text in the M cross-paragraph texts.
[0167] Specifically, the first semantic representation vector ri of each candidate path and the graph node feature vector gi are fed into a fusion module and fused using a Transformer layer. This outputs a semantic representation vector for the cross-paragraph text corresponding to each candidate path. The Transformer layer is a neural network structure that extracts features solely through an attention mechanism and linear layers. Other fusion methods are also possible, and this solution does not specifically limit them.
[0168] 5046. Obtain a score for each cross-paragraph text according to the semantic representation vector of each cross-paragraph text in the M cross-paragraph texts, and sort the M cross-paragraph texts according to the score.
[0169] For example, the semantic representation vector of the cross-paragraph text of each candidate path is input into the path scoring module to obtain a score for each candidate path, and then the ranking result of the candidate paths is determined based on the score. For example, the semantic representation vector corresponding to the first identifier token in the cross-paragraph text of each candidate path is subjected to dimensionality reduction processing through a neural network, and then processed through an activation function to obtain the score of each candidate path. Preferably, the candidate paths are ranked from high to low according to the score.
[0170] 505. If the obtained path is not a candidate path set, the recalled web pages are sorted to obtain a sorting result of the recalled web pages.
[0171] Specifically, the webpage ranking module typically uses a deep pre-trained language model to generate text semantic vectors and then scores webpages based on these vectors. For example, a neural network is used to reduce the dimensionality of the semantic representation vector corresponding to the first identifier token in the webpage text, and then an activation function is used to process it to obtain a score for each webpage.
[0172] Through the embodiments of the present application, by constructing a multi-granularity graph for the cross-paragraph text of each candidate path, the relationship between multiple paragraphs within the path is fully expressed, which helps to capture the semantic connection between cross-paragraph text and extract cross-paragraph semantic information, laying the foundation for the subsequent acquisition of graph node feature vectors. On the other hand, by generating graph node feature vectors based on multi-granularity information fusion, the graph node feature vectors can not only represent the semantic connection between paragraphs, but also contain semantic information at different levels from macro to local, achieving effective supplementation and enhancement of the text semantic representation vector.
[0173] By fusing the first semantic representation vector of the cross-paragraph text and the graph node feature vector, the semantic representation vector of the cross-paragraph text is obtained, which effectively improves the sorting effect when used to calculate the scores of candidate paths.
[0174] Example 2
[0175] The following is a detailed description of the method for generating cross-paragraph text semantic representation vectors provided in this application, using the method as an example in a question-answering scenario.
[0176] Reference Figure 7 FIG. 7 is a flow chart of a method for obtaining answers to questions provided in an embodiment of the present application. The method may include steps 701-705, which are as follows:
[0177] 701. Receive Question input by the user;
[0178] 702. Obtain evidence paragraphs according to the Question input by the user;
[0179] Specifically, based on the question input by the user, the evidence paragraph recall module recalls several evidence paragraphs, wherein the evidence paragraphs are paragraphs containing semantic information necessary for extracting the answer.
[0180] Generally, if it is a general question, the evidence paragraph recall module will recall a single web page; if it is a complex question, the evidence paragraph recall module will recall a reasoning path including multiple web pages.
[0181] 703. Determine whether the evidence paragraph belongs to the evidence paragraph of the reasoning path;
[0182] Specifically, the Evidence Paragraph Recall Module determines whether the recalled result is a single reasoning path, that is, whether the recalled result contains multiple web pages. If it is a reasoning path, corresponding to a complex question-and-answer scenario, the question and the recalled reasoning path are input into the Cross-Paragraph Answer Extraction Module, and step 704 is executed to output the extracted answer. If it is not a reasoning path, corresponding to a general question-and-answer scenario, the question and the recalled single evidence paragraph are input into the Single-Paragraph Answer Extraction Module, and step 705 is executed to output the extracted answer.
[0183] 704. If the evidence paragraph belongs to an evidence paragraph of the reasoning path, obtain the extracted answer based on a method for generating a cross-paragraph text semantic representation vector;
[0184] Among them, step 704 is to obtain the extracted answer based on an inference path. Accordingly, when the value of M in Example 1 is 1, the cross-paragraph text semantic representation vector corresponding to the evidence paragraph can be obtained based on the relevant description in step 504 in Example 1, and then a neural network is used to predict the probability of the token as the beginning and end of the answer according to the semantic representation vector of each token in the cross-paragraph text. Among them, the extracted answer can be obtained based on the token with the highest probability of being the beginning and end of the answer. Please refer to the description in the aforementioned embodiment for details, which will not be repeated here.
[0185] It should be noted that the evidence paragraph recall module of this solution recalls a reasoning path. The evidence paragraph recall module can use the candidate path ranking method described in Example 1 to obtain the candidate path corresponding to the highest score, which is the reasoning path.
[0186] 705. If the evidence paragraph does not belong to the evidence paragraph of the reasoning path, obtain the extracted answer based on the single evidence paragraph.
[0187] Through the embodiments of the present application, by constructing a multi-granularity graph for the cross-paragraph text of the reasoning path, the relationship between multiple paragraphs within the path is fully expressed, which helps to capture the semantic connection between cross-paragraph text and extract cross-paragraph semantic information, laying the foundation for the subsequent acquisition of graph node feature vectors. On the other hand, by generating graph node feature vectors based on multi-granularity information fusion, the graph node feature vectors can not only represent the semantic connection between cross-paragraphs, but also contain semantic information at different levels from macro to local, achieving effective supplementation and enhancement of the text semantic representation vector.
[0188] By fusing the first semantic representation vector of the cross-paragraph text and the graph node feature vector, the semantic representation vector of the cross-paragraph text is obtained, which improves the accuracy of answer extraction.
[0189] Reference Figure 8 As shown in FIG. , a device for generating a semantic representation vector of a cross-paragraph text provided in an embodiment of the present application is provided. The device includes a first generation module 801, a second generation module 802, and a third generation module 803, specifically as follows:
[0190] A first generating module 801 is configured to obtain a first semantic representation vector and a multi-granularity graph of a cross-paragraph text based on the cross-paragraph text, wherein the cross-paragraph text includes at least two paragraphs, and the multi-granularity graph indicates the relationship between sub-texts of multiple granularities within the same paragraph of the cross-paragraph text, and the relationship between sub-texts of multiple granularities across paragraphs;
[0191] A second generating module 802 is configured to obtain a graph node feature vector of the cross-paragraph text based on the first semantic representation vector of the cross-paragraph text and the multi-granularity graph, wherein the graph node feature vector indicates semantic information of sub-texts of multiple granularities within the same paragraph and across paragraphs of the cross-paragraph text;
[0192] The third generation module 803 is used to obtain a second semantic representation vector of the cross-paragraph text, where the first semantic representation vector and the second semantic representation vector both indicate semantic information of the cross-paragraph text, and the second semantic representation vector is obtained by fusing the first semantic representation vector of the cross-paragraph text and the graph node feature vector.
[0193] Optionally, the multi-granularity graph includes nodes of at least two granularities and edges for connecting two nodes, wherein each of the at least two granularities of nodes indicates a sub-text of a granularity, and the edge indicates the relationship between the two connected nodes, and the relationship is a relationship between sub-texts of the same granularity or a relationship between sub-texts of different granularities.
[0194] Among them, the second generation module 802 is used for: the second generation module is used for: obtaining a first intermediate result based on the first semantic representation vector of the cross-paragraph text and the sub-texts carried by nodes of multiple granularities in the multi-granularity graph; obtaining a second intermediate result based on the relationship between the first intermediate result and sub-texts of the same granularity; obtaining a graph node feature vector of the cross-paragraph text based on the relationship between the second intermediate result and sub-texts of different granularities.
[0195] Optionally, the multi-granularity graph includes a first granularity and a second granularity, and the second generation module 802 is used to: input the first intermediate result and the first subgraph into the first neural network to obtain a first intermediate result after the first subgraph is updated, the first subgraph includes the nodes of the first granularity in the multi-granularity graph, and the edges corresponding to the nodes of the first granularity; input the first intermediate result and the second subgraph into the second neural network to obtain a first intermediate result after the second subgraph is updated, the second subgraph includes the nodes of the second granularity in the multi-granularity graph, and the edges corresponding to the nodes of the second granularity; obtain the second intermediate result based on the first intermediate result after the first subgraph is updated and the first intermediate result after the second subgraph is updated.
[0196] Optionally, the multi-granularity graph includes at least two of paragraph granularity, sentence granularity and entity granularity.
[0197] Optionally, the relationship includes at least one of the following: inclusion, inclusion of the same entity, entity co-reference, and web page hyperlink.
[0198] Optionally, the first neural network and the second neural network are different heterogeneous graph neural networks.
[0199] The specific implementation means of the above modules can be found in the introduction of the above embodiments and will not be repeated here.
[0200] Reference Figure 9 As shown in FIG, a device for generating a semantic representation vector of a cross-paragraph text is provided in an embodiment of the present application. Figure 9 As shown, the apparatus 900 includes at least one processor 901, at least one memory 902, and at least one communication interface 903. The processor 901, the memory 902, and the communication interface 903 are connected via the communication bus and communicate with each other.
[0201] The processor 901 may be a general-purpose central processing unit (CPU), a microprocessor, an application-specific integrated circuit (ASIC), or one or more integrated circuits for controlling the execution of the above program.
[0202] The communication interface 903 is used to communicate with other devices or communication networks, such as Ethernet, Radio Access Network (RAN), Wireless Local Area Networks (WLAN), etc.
[0203] The memory 902 may be a read-only memory (ROM) or other type of static storage device that can store static information and instructions, a random access memory (RAM) or other type of dynamic storage device that can store information and instructions, or an electrically erasable programmable read-only memory (EEPROM), a compact disc read-only memory (CD-ROM) or other optical disc storage, optical disc storage (including compact disc, laser disc, optical disc, digital versatile disc, Blu-ray disc, etc.), a magnetic disk storage medium or other magnetic storage device, or any other medium that can be used to carry or store desired program code in the form of instructions or data structures and can be accessed by a computer, but is not limited thereto. The memory may exist independently and be connected to the processor via a bus. The memory may also be integrated with the processor.
[0204] The memory 902 is used to store application code for executing the above solution, and the execution is controlled by the processor 901. The processor 901 is used to execute the application code stored in the memory 902.
[0205] The code stored in the memory 902 may execute any of the above-mentioned methods for generating a cross-paragraph text semantic representation vector.
[0206] An embodiment of the present application also provides a chip system, which is applied to an electronic device; the chip system includes one or more interface circuits and one or more processors; the interface circuit and the processor are interconnected through a line; the interface circuit is used to receive a signal from the memory of the electronic device and send the signal to the processor, the signal including computer instructions stored in the memory; when the processor executes the computer instructions, the electronic device executes the method.
[0207] An embodiment of the present application also provides a computer-readable storage medium, which stores instructions. When the computer-readable storage medium is executed on a computer or a processor, the computer or processor executes one or more steps in any of the above methods.
[0208] The present application also provides a computer program product comprising instructions, which, when executed on a computer or processor, causes the computer or processor to execute one or more steps in any of the above methods.
[0209] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented using software, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the process or function described in the embodiment of the present application is generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer-readable storage medium or transmitted via the computer-readable storage medium. The computer instructions can be transmitted from one website, computer, server or data center to another website, computer, server or data center via a wired (e.g., coaxial cable, optical fiber, digital subscriber line) or wireless (e.g., infrared, wireless, microwave, etc.) method. The computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server or data center that includes one or more available media integrated. The available medium can be a magnetic medium (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), or a semiconductor medium (e.g., a solid state drive (SSD)).
[0210] In this application, "at least one" means one or more, and "more than one" means two or more. "And / or" describes the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can mean: A exists alone, A and B exist simultaneously, and B exists alone. A and B can be singular or plural.
[0211] Those skilled in the art will appreciate that all or part of the process steps in the above-described method embodiments can be implemented by a computer program instructing the relevant hardware. The program can be stored in a computer-readable storage medium, and when executed, the program can include the process steps in the above-described method embodiments. The aforementioned storage medium includes various media capable of storing program code, such as ROM or random access memory (RAM), magnetic disks, or optical disks.
[0212] The above description is merely a specific embodiment of the present invention, but the scope of protection of the present invention is not limited thereto. Any changes or substitutions within the technical scope disclosed in the present invention should be included in the scope of protection of the present invention. Therefore, the scope of protection of the present invention should be based on the scope of protection of the claims.
Claims
1. A method for generating a semantic representation vector of a cross-paragraph text, characterized in that: include: Obtaining a first semantic representation vector of the cross-paragraph text according to the cross-paragraph text, wherein the cross-paragraph text includes at least two paragraphs; Obtaining a graph node feature vector of the cross-paragraph text according to the first semantic representation vector of the cross-paragraph text, wherein the graph node feature vector indicates semantic information of sub-texts of multiple granularities across paragraphs of the cross-paragraph text; A second semantic representation vector of the cross-paragraph text is obtained, wherein the first semantic representation vector and the second semantic representation vector both indicate semantic information of the cross-paragraph text, and the second semantic representation vector is obtained based on the first semantic representation vector and the graph node feature vector.
2. The method according to claim 1, characterized in that The method further comprises: A multi-granularity graph is obtained based on the cross-paragraph text; the multi-granularity graph indicates the relationship between sub-texts of multiple granularities across paragraphs in the cross-paragraph text; The obtaining of the graph node feature vector of the cross-paragraph text according to the first semantic representation vector of the cross-paragraph text includes: A graph node feature vector of the cross-paragraph text is obtained according to the first semantic representation vector of the cross-paragraph text and the multi-granularity graph.
3. The method according to claim 2, characterized in that The multi-granularity graph is also used to indicate the relationship between sub-texts of multiple granularities within the same paragraph in the cross-paragraph text; the graph node feature vector also indicates semantic information of sub-texts of multiple granularities in the same paragraph of the cross-paragraph text.
4. The method according to claim 2 or 3, characterized in that The multi-granularity graph includes nodes of at least two granularities and edges for connecting two nodes, wherein each node of the at least two granularities indicates a sub-text of a granularity, and the edge indicates the relationship between the two connected nodes, and the relationship is a relationship between sub-texts of the same granularity or a relationship between sub-texts of different granularities.
5. The method according to any one of claims 1 to 4, characterized in that The obtaining of the graph node feature vector of the cross-paragraph text according to the first semantic representation vector of the cross-paragraph text and the multi-granularity graph includes: Obtain a first intermediate result according to the first semantic representation vector of the cross-paragraph text; Obtaining a second intermediate result based on the relationship between the first intermediate result and the subtext of the same granularity; The graph node feature vector of the cross-paragraph text is obtained according to the relationship between the second intermediate result and sub-texts of different granularities.
6. The method according to claim 5, characterized in that The first intermediate result is a subtext carried by nodes of multiple granularities in the multi-granularity graph according to the first semantic representation vector of the cross-paragraph text.
7. The method according to claim 6, characterized in that The multi-granularity graph includes a first granularity and a second granularity, and obtaining the second intermediate result based on the relationship between the first intermediate result and a subtext of the same granularity includes: Inputting the first intermediate result and the first subgraph into a first neural network to obtain a first intermediate result after the first subgraph is updated, where the first subgraph includes nodes of a first granularity in the multi-granularity graph and edges corresponding to the nodes of the first granularity; Inputting the first intermediate result and the second subgraph into a second neural network to obtain an updated first intermediate result of the second subgraph, where the second subgraph includes nodes of a second granularity in the multi-granularity graph and edges corresponding to the nodes of the second granularity; The second intermediate result is obtained according to the first intermediate result after the first subgraph is updated and the first intermediate result after the second subgraph is updated.
8. The method according to any one of claims 2 to 7, characterized in that The multi-granularity graph includes at least two of paragraph granularity, sentence granularity, and entity granularity.
9. The method according to any one of claims 1 to 8, characterized in that The relationship includes at least one of the following: Contains, contains the same entity, entity coreference, web page hyperlink.
10. The method according to claim 7, characterized in that The first neural network and the second neural network are different heterogeneous graph neural networks.
11. A device for generating a semantic representation vector of a cross-paragraph text, characterized in that: include: A first generating module is configured to obtain a first semantic representation vector of the cross-paragraph text according to the cross-paragraph text, wherein the cross-paragraph text includes at least two paragraphs; A second generating module is configured to obtain a graph node feature vector of the cross-paragraph text according to the first semantic representation vector of the cross-paragraph text, wherein the graph node feature vector indicates semantic information of sub-texts of multiple granularities across paragraphs of the cross-paragraph text; The third generation module is used to obtain a second semantic representation vector of the cross-paragraph text, where the first semantic representation vector and the second semantic representation vector both indicate semantic information of the cross-paragraph text, and the second semantic representation vector is obtained based on the first semantic representation vector and the graph node feature vector.
12. The device according to claim 11, characterized in that The first generating module is further configured to obtain a multi-granularity graph based on the cross-paragraph text; the multi-granularity graph indicates the relationship between sub-texts of multiple granularities across paragraphs in the cross-paragraph text; In the aspect of obtaining the graph node feature vector of the cross-paragraph text according to the first semantic representation vector of the cross-paragraph text, the first generating module is configured to: A graph node feature vector of the cross-paragraph text is obtained according to the first semantic representation vector of the cross-paragraph text and the multi-granularity graph.
13. The device according to claim 12, characterized in that The multi-granularity graph is also used to indicate the relationship between sub-texts of multiple granularities within the same paragraph in the cross-paragraph text; the graph node feature vector also indicates semantic information of sub-texts of multiple granularities in the same paragraph of the cross-paragraph text.
14. The device according to claim 12 or 13, characterized in that The multi-granularity graph includes nodes of at least two granularities and edges for connecting two nodes, wherein each node of the at least two granularities indicates a sub-text of a granularity, and the edge indicates the relationship between the two connected nodes, and the relationship is a relationship between sub-texts of the same granularity or a relationship between sub-texts of different granularities.
15. The device according to any one of claims 11 to 14, characterized in that The second generating module is used to: Obtain a first intermediate result according to the first semantic representation vector of the cross-paragraph text; Obtaining a second intermediate result based on the relationship between the first intermediate result and the subtext of the same granularity; The graph node feature vector of the cross-paragraph text is obtained according to the relationship between the second intermediate result and sub-texts of different granularities.
16. The device according to claim 15, characterized in that The first intermediate result is a subtext carried by nodes of multiple granularities in the multi-granularity graph according to the first semantic representation vector of the cross-paragraph text.
17. The device according to claim 16, characterized in that The multi-granularity graph includes a first granularity and a second granularity, and the second generating module is configured to: Inputting the first intermediate result and the first subgraph into a first neural network to obtain a first intermediate result after the first subgraph is updated, where the first subgraph includes nodes of a first granularity in the multi-granularity graph and edges corresponding to the nodes of the first granularity; Inputting the first intermediate result and the second subgraph into a second neural network to obtain an updated first intermediate result of the second subgraph, where the second subgraph includes nodes of a second granularity in the multi-granularity graph and edges corresponding to the nodes of the second granularity; The second intermediate result is obtained according to the first intermediate result after the first subgraph is updated and the first intermediate result after the second subgraph is updated.
18. The device according to any one of claims 12 to 17, characterized in that The multi-granularity graph includes at least two of paragraph granularity, sentence granularity, and entity granularity.
19. The device according to any one of claims 11 to 18, characterized in that The relationship includes at least one of the following: Contains, contains the same entity, entity coreference, web page hyperlink.
20. The device according to claim 17, wherein The first neural network and the second neural network are different heterogeneous graph neural networks.
21. A device for generating a semantic representation vector of a cross-paragraph text, characterized in that: The method comprises a processor and a memory; wherein the memory is used to store program code, and the processor is used to call the program code to execute the method according to any one of claims 1 to 10.
22. A computer-readable storage medium, characterized in that The computer-readable storage medium stores a computer program, and the computer program is executed by a processor to implement the method according to any one of claims 1 to 10.
23. A computer program product, characterized in that When the computer program product is run on a computer, the computer is caused to perform the method according to any one of claims 1 to 10.