Computer database-based language generation method and device, and electronic device

By constructing a database-based entity spatial relationship model, sentences describing the spatial location relationships of target nodes are generated, solving the problems of inaccurate information processing and degraded model performance in existing technologies, and achieving more accurate language generation and recognition.

CN116842049BActive Publication Date: 2026-06-02张莉敏

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
张莉敏
Filing Date
2023-05-11
Publication Date
2026-06-02

AI Technical Summary

Technical Problem

Existing natural language processing techniques based on large language models neglect the essence of natural language, resulting in inaccurate information processing and a decline in model performance as new corpora are generated, making training time-consuming and laborious.

Method used

Using the spatial location information of entities encoded in natural language as the research object, an entity spatial relationship model is constructed and stored in a database. A statement describing the spatial location relationship of the target node is generated through mapping relationships.

Benefits of technology

It achieves more accurate language generation and recognition, improves entity location recognition rate, simplifies the model building process, and avoids the dilemma of model performance declining as new corpus is generated.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116842049B_ABST
    Figure CN116842049B_ABST
Patent Text Reader

Abstract

The embodiment of the present disclosure provides a language generation method and device based on a computer database, and an entity space relation model construction method and equipment. The method comprises the following steps: constructing an entity space relation model based on the spatial position relation among entities in a real scene, and storing the entity space relation model in the database; finding a target node and an auxiliary node having a mapping relation with the target node based on an entity word data set through the mapping relation in the database; finding a directed edge associated with the target node and the auxiliary node from the directed edge data set based on the mapping relation; generating a data segment describing the spatial position relation of the target node through the target node, the auxiliary node and the directed edge; and generating a sentence describing the spatial position relation of the target node after encoding the data segment based on an encoder. The present disclosure makes the language generation process more accurate, the position relation among entities more clear, and the position recognition rate among entities greatly improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This disclosure relates to the field of computer technology, and in particular to a language generation method, apparatus, model building method and device based on a computer database. Background Technology

[0002] The generation, processing, and understanding of natural language have become crucial artificial intelligence technologies in real-world society. However, all current natural language processing technologies based on large language models treat natural language sentences as their direct research object. This cognitive bias in the research object leads to different types of information encoded as natural language being processed using the same model (including but not limited to statistical and rule-based processing models). In reality, different types of information need to be categorized and processed according to their inherent nature and characteristics.

[0003] Natural language generation and understanding are crucial artificial intelligence technologies in human-computer interaction. In daily life, absolute positioning coordinate systems and corresponding databases have been widely and maturely applied in machine interaction, navigation, and measurement. Natural language is a vital tool for information exchange between people, and current natural language processing technologies based on large language models aim to achieve communication between humans and machines. However, these large language model technologies, which use natural language as the modeling object, neglect the fact that natural language is essentially an encoding method of information. Different types of information encoded as natural language need to be categorized and processed according to their different natures and characteristics. Therefore, unlike large language model technologies, this application changes the modeling object from natural language to the information encoded by natural language, choosing the spatial location information of entities as the object, and proposes a database construction method for human-computer interaction, as well as a database-based natural language generation and understanding method. Summary of the Invention

[0004] Based on the above problems, this invention selects the spatial location information of entities encoded by natural language as the research object and proposes a database-based natural language processing technology.

[0005] In a first aspect, embodiments of this disclosure provide a language generation method based on a computer database, including:

[0006] An entity spatial relationship model is constructed based on the spatial location relationships between entities in a real-world scenario. The entity spatial relationship model is stored in the database. The entity spatial relationship model includes an entity word dataset, a directed edge dataset, and a spatial relevance dataset. The entity word dataset, the directed edge dataset, and the spatial relevance dataset form a mapping relationship between each other.

[0007] In the database, based on the mapping relationship, the target node and the auxiliary node that has a mapping relationship with the target node are found in the entity word dataset. Based on the mapping relationship, the directed edge associated with the target node and the auxiliary node is found in the directed edge dataset.

[0008] Data segments describing the spatial positional relationships of the target node are generated using the target node, the auxiliary node, and the directed edges.

[0009] The encoder encodes the data segment to generate a statement describing the spatial positional relationship of the target node.

[0010] In some embodiments, constructing an entity spatial relationship model based on the spatial positional relationships between entities in a real-world scenario includes:

[0011] Each entity in the real-world scene is marked as a node, and the spatial relationships between entities in the real-world scene are marked as directed edges. A corresponding relationship tree is generated based on the spatial relationships between entities in the real-world scene.

[0012] Each entity in the real-world scene is marked as a node, and the spatial directional relationship between entities in the real-world scene is abstracted as directed edges. Based on the spatial directional relationship between entities in the real-world scene, a corresponding relationship graph is generated.

[0013] Using the nodes with stable spatial positions shared by the relationship tree and the relationship graph as connection points, the relationship tree and the relationship graph are integrated into an entity spatial relationship model that includes spatial positional relationships. The entity spatial relationship model represents the spatial range relationship between entities in the vertical structure and the spatial direction relationship between entities in the horizontal structure.

[0014] In some embodiments, the target node and the auxiliary node include one directed edge, two directed edges, or multiple directed edges.

[0015] In some embodiments, generating a statement describing the spatial location relationship of the target nodes based on the encoding of the data segment by the encoder includes:

[0016] Based on the encoder, the entity words represented by the target node and the auxiliary node in the data segment are extracted;

[0017] Based on the encoder, the spatial range relation words and / or spatial direction relation words represented by the directed edges in the data segment are extracted;

[0018] The spatial correlation between the target node and the auxiliary node is configured based on the encoder;

[0019] Based on the entity words, the spatial range relation words and / or spatial direction relation words, and spatial relevance, a statement describing the spatial positional relationship of the target node is generated.

[0020] In some embodiments, the step of extracting spatial range relation words and / or spatial direction relation words represented by the directed edges in the data segment based on the encoder includes:

[0021] The spatial range relationship and / or spatial direction relationship in the data segment are calculated to generate the final spatial range relationship and / or spatial direction relationship.

[0022] Based on the encoder's encoding of the final spatial range relationship and / or the final spatial direction relationship, the final spatial range relationship word and / or spatial direction relationship word are generated.

[0023] Accordingly, based on the entity words, the spatial range relation words and / or spatial direction relation words, and spatial relevance, a statement describing the spatial positional relationship of the target node is generated, including:

[0024] Based on the entity words, the spatial range relation words and / or spatial direction relation words and / or spatial distance relation words, and spatial correlation, a statement describing the spatial positional relationship of the target node is generated.

[0025] In some embodiments, it also includes:

[0026] Based on the encoder configuration, the spatial dimension words of the target node and the auxiliary node are configured;

[0027] Accordingly, based on the entity words, the spatial range relation words and / or spatial direction relation words, and spatial relevance, a statement describing the spatial positional relationship of the target node is generated, including:

[0028] Based on the entity words, the spatial range relation words and / or spatial direction relation words, spatial relevance, and spatial dimension words, a statement describing the spatial positional relationship of the target node is generated.

[0029] Secondly, embodiments of this disclosure provide a method for constructing an entity spatial relationship model based on a computer database, including:

[0030] Each entity in the real-world scene is marked as a node, and the spatial relationships between entities in the real-world scene are marked as directed edges. A corresponding relationship tree is generated based on the spatial relationships between entities in the real-world scene.

[0031] Each entity in the real-world scene is marked as a node, and the spatial directional relationship between entities in the real-world scene is abstracted as directed edges. Based on the spatial directional relationship between entities in the real-world scene, a corresponding relationship graph is generated.

[0032] Using the nodes with stable spatial positions shared by the relationship tree and the relationship graph as connection points, the relationship tree and the relationship graph are integrated into an entity spatial relationship model that includes spatial positional relationships. The entity spatial relationship model represents the spatial range relationship between entities in the vertical structure and the spatial direction relationship between entities in the horizontal structure.

[0033] Thirdly, embodiments of this disclosure provide a language generation apparatus based on a computer database, comprising:

[0034] The model building unit is configured to build an entity spatial relationship model based on the spatial positional relationship between entities in a real scene. The entity spatial relationship model is stored in the database. The entity spatial relationship model includes an entity word dataset, a directed edge dataset, and a spatial correlation dataset. The entity word dataset, the directed edge dataset, and the spatial correlation dataset form a mapping relationship between each pair of entities.

[0035] The data lookup unit is configured to search for a target node and an auxiliary node that has a mapping relationship with the target node in the database based on the entity word dataset through the mapping relationship, and to search for the directed edge associated with the target node and the auxiliary node from the directed edge dataset based on the mapping relationship.

[0036] The first generation unit is configured to generate a data segment describing the spatial positional relationship of the target node through the target node, the auxiliary node, and the directed edge;

[0037] The second generation unit is configured to generate statements describing the spatial positional relationships of the target nodes based on the data segment encoded by the encoder.

[0038] Fourthly, embodiments of this disclosure provide an electronic device, including a processor and a memory, wherein the memory stores computer program instructions executable by the processor, and when the processor executes the computer program instructions, it implements any of the steps described above.

[0039] Fifthly, embodiments of this disclosure provide a non-transitory computer-readable storage medium storing computer program instructions that, when invoked and executed by a processor, implement the steps of any of the methods described above.

[0040] Compared with the prior art, this disclosure has at least the following technical effects:

[0041] This invention is a database-based natural language sentence generation method. The method marks the spatial relationships between entities in a real-world scene as a mapping entity spatial relationship model. Based on this model, a database is generated to store the spatial positional relationships between entities in the real-world scene. Then, based on the entity spatial relationship model, sentences describing the spatial position of target entities in the corresponding real-world scene are generated. This disclosure makes the language generation process more accurate, the positional relationships between entities clearer, and significantly improves the positional recognition rate of entities. Attached Figure Description

[0042] To more clearly illustrate the technical solutions in the embodiments of this disclosure or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of this disclosure. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0043] Figure 1 A flowchart illustrating the language generation method based on a computer database provided in this embodiment of the disclosure;

[0044] Figure 2 A flowchart illustrating the method for constructing an entity spatial relationship model based on a computer database provided in this embodiment of the disclosure;

[0045] Figure 3 A schematic diagram of the relational tree structure of the language generation method based on a computer database provided in this embodiment of the disclosure;

[0046] Figure 4 A schematic diagram of the relational structure of the language generation method based on a computer database provided in this embodiment of the disclosure;

[0047] Figure 5 A schematic diagram of the relational graph structure of a language generation method based on a computer database provided in another embodiment of this disclosure;

[0048] Figure 6 This is a schematic diagram of an entity spatial relationship model structure based on a computer database, provided in another embodiment of this disclosure.

[0049] Figure 6a A logical relationship diagram for sentence generation and parsing based on an entity space relationship model provided in this embodiment of the disclosure;

[0050] Figure 7 A schematic diagram of the data segment structure of the language generation method based on a computer database provided in this embodiment of the disclosure;

[0051] Figure 8A flowchart illustrating a language generation method based on a computer database provided in another embodiment of this disclosure;

[0052] Figure 9 A schematic diagram of the spatial dimension structure of the language generation method based on a computer database provided in this embodiment of the disclosure;

[0053] Figure 10 A flowchart illustrating the language parsing method based on a computer database provided in this embodiment of the disclosure;

[0054] Figure 11 A schematic diagram of the statement decomposition structure of the language parsing method based on a computer database provided in this embodiment of the disclosure;

[0055] Figure 12 A schematic diagram of the statement decomposition structure of the language parsing method based on a computer database provided in this embodiment of the disclosure;

[0056] Figure 13 A schematic diagram of the database structure of the language parsing method based on a computer database provided in this embodiment of the disclosure;

[0057] Figure 14 A schematic diagram of the structure of a language generation device based on a computer database provided in this embodiment of the disclosure;

[0058] Figure 15 A schematic diagram of the structure of a language generation device based on a computer database provided in another embodiment of this disclosure;

[0059] Figure 16 A schematic diagram of the structure of a language generation device based on a computer database provided in another embodiment of this disclosure;

[0060] Figure 17 A schematic diagram of the electronic structure of a robot provided in an embodiment of this disclosure. Detailed Implementation

[0061] To make the objectives, technical solutions, and advantages of this disclosure clearer, the disclosure will be further described in detail below with reference to the accompanying drawings. Obviously, the described embodiments are only a part of the embodiments of this disclosure, and not all of them. Based on the embodiments of this disclosure, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this disclosure.

[0062] The terminology used in the embodiments of this disclosure is for the purpose of describing particular embodiments only and is not intended to be limiting of this disclosure. The singular forms “a,” “the,” and “the” as used in the embodiments of this disclosure and the appended claims are also intended to include the plural forms, and “multiple” generally includes at least two unless the context clearly indicates otherwise.

[0063] It should be understood that the term "and / or" used in this article is merely a description of the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A existing alone, A and B existing simultaneously, and B existing alone. Additionally, the character " / " in this article generally indicates that the preceding and following related objects have an "or" relationship.

[0064] It should also be noted that the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that an article or device that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such an article or device. Without further limitation, an element defined by the phrase "comprising one" does not exclude the presence of other identical elements in the article or device that includes said element.

[0065] Natural Language Processing (NLP) based on language models takes natural language as its direct research object, feeding a large amount of corpus data into the model and allowing it to undergo supervised learning based on iterative algorithms. The aim is to find solutions to problems such as sentence generation and sentence comprehension. Currently, technologies that directly study natural language still need improvement in the accuracy of sentence generation and comprehension. This is because: firstly, this technology misunderstands the research object—natural language is essentially a way of encoding information. Sentence comprehension aims to understand the information encoded in a sentence, and sentence generation aims to encode the information to be conveyed into a sentence and then output it. Existing technologies, based on this flawed understanding of the research object, use language models trained on large corpora. These models are not accurate enough in understanding certain words and sentences and often generate erroneous sentences that seem to conform to language usage logic but do not conform to factual logic. Secondly, language models trained on large corpora through supervised learning gradually lose accuracy as new corpora are generated, and retraining the model is inevitably time-consuming and laborious.

[0066] Based on this, this disclosure provides a language generation method based on a computer database, comprising: constructing an entity spatial relationship model based on the spatial positional relationships between entities in a real-world scene, wherein the entity spatial relationship model is stored in the database, and wherein the entity spatial relationship model includes an entity word dataset, a directed edge dataset, and a spatial relevance dataset, wherein the entity word dataset, the directed edge dataset, and the spatial relevance dataset form a mapping relationship between each pair; in the database, using the mapping relationship, finding a target node and an auxiliary node that has a mapping relationship with the target node based on the entity word dataset, and finding a directed edge associated with the target node and the auxiliary node from the directed edge dataset based on the mapping relationship; generating a data segment describing the spatial positional relationship of the target node using the target node, the auxiliary node, and the directed edge; and generating a statement describing the spatial positional relationship of the target node by encoding the data segment using an encoder.

[0067] This invention is a database-based natural language sentence generation method. It marks the spatial relationships between entities in a real-world scene as an entity spatial relationship model with mapping relationships. Based on this model, a database is generated to store the spatial positional relationships between entities in the real-world scene. Then, based on the entity spatial relationship model, elements from different datasets are called through mapping relationships, and after compilation and integration, sentences describing the spatial position of target entities in the corresponding real-world scene are generated. This disclosed language generation method makes the language generation process more rigorous, allowing the construction of an accurate language model without extensive training. The positional relationships between entity elements in this language model are clear, making the natural language sentences generated through the pre-constructed logical relationships between entities more accurate and significantly improving the parsing and recognition rate.

[0068] The optional embodiments of this disclosure are described in detail below with reference to the accompanying drawings.

[0069] To better understand the technical content of this disclosure, several basic concepts are explained below:

[0070] InfoS (Information Sender): The information sender is the party that searches for and organizes the content they want to express during the information exchange process, and then outputs the information through the output port. For example, in the roles that perform a dialogue task, the party that outputs the information is the information sender. The task of the information sender is to encode the data in the database into natural language statements and then output them to the outside world.

[0071] InfoR (Information Receiver): In the process of information exchange, the information receiver is the party that receives information input from the other party and searches and parses the information. For example, in the roles of performing a dialogue task, the party receiving the information is the information receiver. The task of the information receiver is to decompose the received natural language statements and restore them into data in the database, and then understand them.

[0072] When exchanging information using natural language, two roles naturally emerge: InfoS and InfoR. During the exchange, the same party will continuously switch between these two roles. When the same party assumes the roles of InfoS and InfoR, the information processing tasks they face are different, but both require organizing the output of language information and parsing the other party's language information through their own constructed entity space relationship model.

[0073] InfoP (Information Processor): Both InfoS and InfoR are information processors. When there is no need to distinguish the information processing role, they are collectively referred to as information processors, i.e., InfoP.

[0074] entity:

[0075] Passive entities: Passive entities refer to entities whose spatial location attribute values ​​are unique or do not change over a period of time, such as "a mountain", "a city", "a building", and "refrigerator" and "table" mentioned in this invention are also passive entities.

[0076] Active entities: Active entities refer to entities whose spatial location attribute values ​​are not unique and usually have multiple spatial location attribute values ​​within a certain period of time. Examples include "person", "car", and "cat" and "apple" mentioned in this invention. In order to distinguish entities, entities are marked with quotation marks, for example: entity "apple".

[0077] Specifically, such as Figure 1 As shown, this disclosure provides a language generation method based on a computer database, including the following method steps:

[0078] Step S102: Construct an entity spatial relationship model based on the spatial location relationships between entities in the real scene. The entity spatial relationship model is stored in the database. The entity spatial relationship model includes an entity word dataset, a directed edge dataset, and a spatial correlation dataset. The entity word dataset, the directed edge dataset, and the spatial correlation dataset form a mapping relationship between each other.

[0079] Step S104: In the database, based on the entity word dataset, find the target node and the auxiliary node that has a mapping relationship with the target node through the mapping relationship, and find the directed edge associated with the target node and the auxiliary node from the directed edge dataset based on the mapping relationship;

[0080] Step S106: Generate a data segment describing the spatial positional relationship of the target node using the target node, the auxiliary node, and the directed edge;

[0081] Step S108: Generate a statement describing the spatial positional relationship of the target node after encoding the data segment based on the encoder.

[0082] In step S102, each entity in the real scene is marked, and the positional relationship between each entity is marked, and the spatial correlation between each entity is marked. Then, the marked entities, positional relationships, and spatial correlations are stored in the entity word dataset, the directed edge dataset, and the spatial correlation dataset, respectively. A mapping relationship is constructed between the entity word dataset, the directed edge dataset, and the spatial correlation dataset so that when a certain element is called, the element in the corresponding set can be found through the mapping relationship. The spatial positional relationship includes the spatial range relationship, the spatial direction relationship, and the spatial distance relationship.

[0083] In some embodiments, such as Figure 2 As shown, in step S102, constructing an entity spatial relationship model based on the spatial positional relationships between entities in the real-world scene includes the following sub-steps:

[0084] Step S102-1: Mark each entity in the real scene as a node, mark the spatial range relationship between entities in the real scene as directed edges, and generate the corresponding relationship tree based on the spatial range relationship between entities in the real scene;

[0085] Step S102-3: Mark each entity in the real scene as a node, abstract the spatial directional relationship between entities in the real scene as directed edges, and generate the corresponding relationship graph based on the spatial directional relationship between entities in the real scene;

[0086] Step S102-5: Using the nodes with stable spatial positions shared by the relationship tree and the relationship graph as connection points, integrate the relationship tree and the relationship graph into an entity spatial relationship model that includes spatial positional relationships. The entity spatial relationship model represents the spatial range relationship between entities in the vertical structure and the spatial direction relationship between entities in the horizontal structure.

[0087] In step S102-1, entities in the real-world scene are abstracted as nodes. , where i is the layer number of the entity node in the database, j is the number of the parent node of the entity node, and k is the number of the entity node; abstract the spatial range relationship between entities in the real scenario as a directed edge , referring to the spatial range relationship between entities in the real scenario, generate a corresponding relationship tree V = { }, generate a corresponding relationship tree to describe the relationship between elements and store the corresponding relationship tree in the database.

[0088] The following takes a person's real-life scenario as an example for illustration (not limited to this), and some entities with relatively stable spatial positions (unique spatial position attribute values) can be found, such as: the community "Jimen Community" where a person lives (non-mobile entity), the non-mobile entities "parking lot" and "cafe" in this community, the "home" of a person (non-mobile entity); the non-mobile entities "dining table", "sofa", and "refrigerator" in this "home"; and the mobile entities with relatively unstable spatial positions (non-unique spatial position attribute values), such as: the entity "cat" in the "home".

[0089] Taking a person's real work scenario as an example again, some entities with relatively stable spatial positions can be found, such as: the person's work unit "Beijing Film Academy" (non-mobile entity); the non-mobile entities "library" and "office building" in this unit; the non-mobile entity "office" in this "office building"; the non-mobile entity "computer" in this "office". There are also other entities existing in a person's real life and work scenarios, such as: "Jimen Bridge", "State Intellectual Property Office", "Yuancheng Site Park", etc.

[0090] Abstract the above entities as nodes, summarize and store them in the entity word dataset, abstract the spatial range relationship between the above entities as directed edges, summarize and store them in the directed edge dataset, and a relationship tree as shown in Figure 3 can be constructed through the relationship between parent and child nodes to describe the spatial range relationship between some entities in a person's real life and work scenarios. Among them, the directed edge includes words or terms that can express the spatial range relationship between two entities. As an example, for instance, "inside", "outside", "within", "in the middle", etc. There is no limitation on this, and the words and terms in the directed edge dataset can be supplemented according to the development of the language.

[0091] In the relationship tree, the child nodes under the same parent node are independent of each other in terms of spatial range relationship (there is no inclusion relationship); if a child node is not independent of other child nodes in terms of spatial range, but there is an inclusion relationship, then this node needs to be moved up or down one layer until all child nodes under the same parent node are independent of each other in terms of spatial range relationship (there is no inclusion relationship).

[0092] ;

[0093] Nodes in the relation tree V must satisfy condition F: That is, the child nodes under the same parent node are independent (unrelated) in terms of spatial scope; if a child node is not independent of other child nodes in terms of spatial scope, but has an inclusion relationship, then the node must be moved up or down one level until condition F is satisfied.

[0094] In step S102-3, entities in the real-world scene are abstracted into nodes. The spatial directional relationships between entities in real-world scenarios are summarized and stored in the entity word dataset, and are abstracted into directed edges. The relationships are summarized and stored in a directed edge dataset. Referring to the spatial directional relationships between entities in real-world scenarios, a corresponding relationship graph can be generated through the parent-child node relationships to describe the relationships between elements. This relationship graph is then stored in the database, and the generated relationship graph satisfies...

[0095] ,in , The nodes in the directed edge must satisfy condition F. Based on the different spatial directional relationships they represent, they can be divided into spatial relative directional relationships. Relationship with absolute spatial direction .

[0096] like Figure 4 As shown, the spatial relative orientation relationship , It is a set of 6 fixed spatial relative directional relationships.

[0097] As an example, spatial relative directional relationships include, but are not limited to, the six spatial relative directional relationships of "left," "right," "front," "back," "up," and "down." The spatial relative directional relationships between physical objects such as a "dining table," "sofa," "refrigerator," and "cat" are also relevant. can be used as Figure 4 This is represented by a diagram showing the spatial relative orientation of the physical entities "dining table," "sofa," "refrigerator," and "cat."

[0098] Figure 4 The relationship diagram between the entities "dining table", "sofa", "refrigerator" and "cat" shown can be described by the matrix in Table 2 to determine the mapping relationship between each entity. Representing different entities (nodes), in the matrix Directed edges represent the relationships between entities (nodes).

[0099] ,

[0100] like Figure 5 As shown, the spatial absolute direction relationship , It is a set of four fixed spatial absolute directional relationships.

[0101] The absolute spatial directional relationships include four relative spatial directional relationships: "East," "West," "South," and "North." The absolute spatial directional relationships between the entities "Jimen Residential Area," "Yuan Tu Cheng Ruins Park," "Beijing Film Academy," "State Intellectual Property Office," and "Jimen Bridge" are also mentioned.

[0102] can be used as Figure 5 This is represented by a diagram showing the spatial absolute directional relationships between the entities "Jimen Community", "Yuan Tucheng Ruins Park", "Beijing Film Academy", "State Intellectual Property Office" and "Jimen Bridge".

[0103] Figure 5 The relationship diagram between the entities "Jimen Residential Area", "Yuan Tucheng Ruins Park", "Beijing Film Academy", "State Intellectual Property Office" and "Jimen Bridge" shown can be described by the matrix in Table 3 to determine the mapping relationship between each entity. Representing different entities (nodes), in the matrix Directed edges represent the relationships between entities (nodes).

[0104] ,

[0105] The relationship diagram described above can be represented algebraically as follows:

[0106] Relationship graph G =<V,E> It consists of a non-empty node set V (i.e., entity word dataset) and a directed edge dataset E. The node set V is the set of child nodes that share the same parent node in the relation tree model. The directed edge dataset E is a set of 6 fixed spatial relative directional relationships or 4 fixed spatial absolute directional relationships.

[0107] , where i is the layer number, j is the subgraph number, and n is an integer.

[0108] i is the layer number, j is the subgraph number, k is the node number, and n is an integer.

[0109] , It is a set of 6 fixed spatial relative directional relationships.

[0110] , It is a set of four fixed spatial absolute directional relationships.

[0111] In steps S102-5, the relationship tree V, which represents the spatial range relationship between entities, and the relationship graph, which represents the spatial direction relationship between entities, are abstracted from the real scene. Using nodes with relatively stable spatial positions shared by both entities as connection points, the relationship tree and relationship graph are integrated into an entity spatial relationship model that describes the spatial range relationship between entities in the vertical structure (inter-layer structure) and the spatial direction relationship between entities in the horizontal structure (intra-layer structure).

[0112] like Figure 6 As shown, the entity spatial relationship model can be continuously extended upwards and downwards in the vertical structure, and can also be continuously refined in the horizontal structure. Therefore, the entity spatial relationship model can meet the needs of describing and storing the spatial position of different entities in the real scene. Compared with other spatial position data models constructed based on the 3D numerical spatial position information (numerical coordinate information) of entities, the entity spatial relationship model proposed in this invention is closer to the mechanism by which the human brain processes entity spatial position information, and it is easier to find and determine the spatial position relationship between entities, thus making it easier to clearly and accurately express the spatial position relationship between entities.

[0113] Based on the aforementioned entity spatial relationship model, a database can be generated to map and store the spatial positions of various entities in a real-world scene. The nodes representing each entity in this database can also store 3D numerical information (e.g., numerical coordinates) of the entity's spatial location. Thus, this database can not only simulate human processing habits for spatial location information to store entity spatial location information, but also store numerical spatial location information of entities that is convenient for machine use. The method in this embodiment meets the diverse usage needs of users.

[0114] like Figure 6a As shown, the database in this application can perform the following tasks: ① Encoding data segments from the entity spatial relation database can generate statements; ② Decoding the statements allows them to be stored in the entity spatial relation database for understanding; ③ Converting data from the 3D map database into data from the entity spatial relation database; ④ Converting data from the entity spatial relation database into data from the 3D map database. Furthermore, combining tasks ③ and ① can convert information exchanged between machines into information that humans can understand; combining tasks ② and ④ can convert information used for communication between people into information that machines can understand and use. Therefore, the database in this application realizes human-computer interaction by building a bridge for information exchange between machines and humans.

[0115] In this embodiment, the constructed database based on stable spatial relationships between passive entities in real-world scenarios only needs to modify the position of the corresponding active entity in the database when the spatial position of the active entity changes in the real-world scenario, without having to make major adjustments and modifications to the entire database. Therefore, this increases the flexibility and practicality of the invention and avoids the dilemma of current large language models where the model performance gradually declines with the generation of new corpora, requiring retraining.

[0116] In some embodiments, when expressing the location of a target node (e.g., a cat), it is necessary to use a computer to find the entity word in the entity word dataset of a database, and to find at least one auxiliary node associated with it through the mapping relationship of a relation tree or relation graph. Furthermore, based on the mapping relationship of the relation tree or relation graph, all directed edges between every two nodes of the target node and at least one auxiliary node are found. In step S104, the target node and the auxiliary node include one, two, or more directed edges; that is, the positional relationship between the target node and the auxiliary node can be determined by a single directed edge, or by two or more directed edges. For example... Figure 7 As shown, different auxiliary nodes (such as the house in L1, the refrigerator in L2, the sofa in L3, the dining table in L4, the Jimen Community in L5, and the Yuantucheng Ruins Park in L6) can find the target node (cat) through different numbers of directed edges (such as 1 in L1 and L2, 2 in L3 and L5, and 3 in L4 and L6).

[0117] In step S106, as Figure 7 As shown, based on the target node found in step S104, at least one auxiliary node, and the directed edges between the target node and each auxiliary node, at least one data segment describing the spatial positional relationship of the target node through the auxiliary nodes is generated, for example... Figure 7 As shown, in order to describe the target node "cat", multiple auxiliary nodes and corresponding directed edges can be found, and then multiple data segments (L1-L6) can be generated. As an example, the auxiliary nodes can be determined based on the current spatial location of InfoS. For example, when InfoS is in "home", auxiliary nodes in data segment L1-L4 can be selected, and when InfoS is in "Haidian District", auxiliary nodes in data segment L5-L6 can be selected.

[0118] When InfoS needs to locate a target entity, it can describe the location of the target entity by finding auxiliary entities (nodes S) in the database that are connected to the target entity (node ​​T). Specifically, it finds the node T in the database that corresponds to the target entity, then finds the node S that is connected to node T, and reads the data segment L consisting of node T, node S, and the directed edge E between them.

[0119] In this embodiment, based on Figure 6 In the database model example, when InfoS needs to describe the spatial location of the target entity "cat", it can find the node T representing the target entity "cat" and the nodes S that have direct connections with it through the constructed mapping relationship in the database, such as "home" and "refrigerator". The corresponding results can then be obtained. Figure 7 The data segments L1 and L2 in the data can be used to find nodes S that have indirect connections with node T, such as "Sofa", "Table", "Jimen Community" and "Yuantucheng Ruins Park". Correspondingly, the data can be obtained... Figure 7 Data segments L3-L6 in the middle.

[0120] Figure 7 The six data segments L in the model are abstract representations of the spatial relationships of corresponding entities in a real-world scene. Therefore, the accuracy of each of these six data segments L in describing the spatial position of the target entity "cat" is 100%. The difference lies in the different nodes S selected in each data segment L, resulting in varying degrees of precision in describing the spatial position of the target entity "cat". Furthermore, as an active entity, the target entity "cat" requires corresponding database updates when its position in space changes. Only the spatial position of the target entity "cat" needs to be updated; updates to passive entity nodes in other locations are unnecessary, simplifying the update scope of the data model.

[0121] In some embodiments, in step S108, generating a statement describing the spatial location relationship of the target nodes based on the encoder encoding the data segment includes the following sub-steps, such as... Figure 8 As shown:

[0122] Step S108-1: Extract entity words represented by the target node and the auxiliary node in the data segment based on the encoder;

[0123] Step S108-3: Extract spatial range relation words and / or spatial direction relation words represented by the directed edges in the data segment based on the encoder;

[0124] Step S108-5: Configure the spatial correlation between the target node and the auxiliary node based on the encoder;

[0125] Step S108-7: Generate a statement describing the spatial position relationship of the target node based on the entity word, the spatial range relationship word and / or the spatial direction relationship word, and the spatial correlation.

[0126] In step S108-1, the target entity and the auxiliary entity in the data segment of each of the above embodiments are represented in the form of nodes. The encoder re-encodes the nodes representing entities in the data segment into corresponding entity words. For example, the target node T in each node in the above data segment L1 is encoded as "cat", and the auxiliary node S is encoded as "home". The same applies to other data segments and will not be elaborated here.

[0127] In step S108-3, the directed edge E representing the spatial position relationship in the data segment of each of the above embodiments is encoded by the encoder into corresponding spatial position relationship words. As shown in Table 4, in the present disclosure, the words representing the spatial position relationship between entities are referred to as spatial relationship attribute words.

[0128] ,

[0129] In some embodiments, in step S108-3, the extracting of the spatial range relationship word and / or the spatial direction relationship word represented by the directed edge in the data segment based on the encoder includes the following steps:

[0130] Perform operations on the spatial range relationship and / or the spatial direction relationship in the data segment to generate the final spatial range relationship and / or the final spatial direction relationship;

[0131] Based on the encoder, encode the final spatial range relationship and / or the final spatial direction relationship to generate the final spatial range relationship word and / or the final spatial direction relationship word.

[0132] When there is only one element in the directed edge E in the data segment L, the directed edge can be directly encoded. For example: Figure 7 In the data segment L1, the relationship chain E = ( ), and in L2, the relationship chain E = ( ). The above relationship chains can be directly encoded with the words "in" and "on". When there are more than one element in the relationship chain E in the data segment L, the following relational operations need to be performed on this relationship chain:

[0133] Elimination operation: ;

[0134] Merge operation: ; ; ; ;

[0135] Mixed operations: When a relation chain contains both spatial directional relationships and spatial extent relationships, the spatial relationship upstream in the relation chain takes precedence. For example:

[0136] As an example, based on the spatial relationship calculation method above, the spatial relationships of each data segment in the above embodiment can be obtained as follows: 

[0137] Space link E in data segment L3 The calculation process is as follows: ;

[0138] Space link E in data segment L4 The calculation process is as follows: ;

[0139] Space link E in data segment L5 The calculation process is as follows: ;

[0140] Space links in data segment L6 The calculation process is as follows: ;

[0141] Among them, the spatial relationship calculation results in data segment L4 are " There is no corresponding natural language encoded vocabulary for "cat". In actual use, data segment L4 is rarely chosen to describe the spatial location of the target entity "cat". Therefore, it is usually discarded.

[0142] In some embodiments, the method further includes: extracting spatial distance relation words represented by the directed edges in the data segment based on the encoder;

[0143] Accordingly, in step S108-7, generating a statement describing the spatial positional relationship of the target node based on the entity words, the spatial range relation words and / or the spatial direction relation words and the spatial correlation includes: generating a statement describing the spatial positional relationship of the target node based on the entity words, the spatial range relation words and / or the spatial direction relation words and / or the spatial distance relation words and the spatial correlation.

[0144] For the above data segment L4, when it is difficult to describe the directional relationship between nodes, or the distance between two nodes is relatively close and it is not necessary to precisely distinguish the specific spatial directional relationship between the nodes, the spatial relationship between the nodes can be described by the spatial distance relationship. For example, the spatial relationship "front upper right" in data segment L4 can be encoded using the words "beside" or "nearby". The judgment basis for the relatively close distance between two entities is that both can be relatively close to InfoP at the same time. For example, they appear within the visual range of InfoP at the same time. In this case, without precisely describing the spatial directional relationship between the two, InfoR can also quickly find the target positioning object based on the given spatial distance relationship between the two.

[0145] In step S108-5, in addition to the nodes and directed edges in data segment L, it is also necessary to encode the spatial correlation between the target entity and the auxiliary entity, and call the spatial correlation vocabulary in the spatial correlation dataset through the encoder. The spatial correlation between entities can be encoded using the Chinese word "in". The spatial correlation is that there is a specific connection relationship between nodes (which can be divided into direct connection relationship and indirect connection relationship). When there is no spatial correlation between nodes, it can be encoded using the Chinese word "not in". Other words representing the spatial correlation between entities are "located at", "in a certain state", etc. When encoding, they can be called from the spatial correlation dataset according to actual needs, and specific details are not limited here.

[0146] In step S108-7, through the encoding of the foregoing steps, statements expressing the target entity through the auxiliary entity are generated, such as "The cat is at home", "The cat is in the community", "The cat is west of Yuantu City Site Park", etc. These statements can be selectively output based on the different spatial positions of InfoR.

[0147] In some embodiments, the method further includes: configuring the spatial dimension words of the target node and the auxiliary node based on the encoder;

[0148] Correspondingly, in step S108-7, generating a statement describing the spatial position relationship of the target node based on the entity word, the spatial range relationship word and / or the spatial direction relationship word, and the spatial correlation includes: generating a statement describing the spatial position relationship of the target node based on the entity word, the spatial range relationship word and / or the spatial direction relationship word, the spatial correlation, and the spatial dimension word.

[0149] The vocabulary of spatial dimensions is shown in Table 3 and Figure 9 As shown, in this disclosure, the vocabulary representing the spatial dimension is called the spatial dimension word, such as Figure 9As shown, the spatial dimensions that exist in real-world scenarios are: 0-dimensional space (point); 1-dimensional space (line); 2-dimensional space (plane); 3-dimensional space (volume). The spatial dimension terms corresponding to different spatial dimensions are shown in Table 3. Without affecting the accuracy of spatial position, InfoS can omit the encoding of spatial dimensions.

[0150] Finally, by organizing the encoding of each part of the data segment L in the above embodiments according to the Chinese sentence structure in Table 4, the corresponding Chinese sentences can be obtained.

[0151] ;

[0152] In the table, the words in parentheses are the parts that can be omitted from the encoding.

[0153] Similarly, as shown in Table 5, when InfoS needs to describe the absence of a certain spatial relationship between two entities, the word "not present" can be used to encode the spatial irrelevance between them.

[0154] ;

[0155] This invention labels the spatial relationships between entities in a real-world scene as an entity spatial relationship model with mapping relationships. Based on this model, a database is generated to store the spatial positional relationships between entities in the real-world scene. Then, based on the entity spatial relationship model, elements from different datasets are called through mapping relationships, and after compilation and integration, sentences describing the spatial position of target entities in the corresponding real-world scene are generated. The language generation method disclosed in this invention makes the language generation process more rigorous, and an accurate language model can be built without extensive training. The positional relationships between entity elements in this language model are clear, making the natural sentences generated through the pre-built logical relationships between entities more accurate, and significantly improving the parsing and recognition rate.

[0156] As an example, this disclosure also provides a method for implementing semantic parsing, as detailed below:

[0157] After receiving the statement from InfoS describing the spatial relationships between entities, InfoR follows... Figure 10 The steps shown demonstrate the interpretation of the statement, as follows:

[0158] Step S31: After receiving the statement describing the spatial relationships between entities, InfoR first deconstructs the statement by extracting different datasets and mapping relationships, breaking it down into the following components:

[0159] Encoding Object 3: Lexicons representing spatial relevance

[0160] Encoding Object 2: Lexicons representing spatial relationships

[0161] Encoding Object 1: Vocabulary representing the positioning subject and auxiliary positioning points

[0162] Encoding Object 4: Lexicons representing spatial dimensions

[0163] Example 1: An apple is in the refrigerator. / The State Intellectual Property Office is located south of the Beijing Film Academy.

[0164] Taking the two statements in Example 1 as examples, according to the components of the decomposed statements, the statements can be reorganized into... Figure 11 The form of a sentence tree in Chinese.

[0165] S32: Further, InfoR searches its own database for data (node ​​S) corresponding to the auxiliary positioning point in the statement tree. If it fails to find the data, InfoR cannot obtain the spatial location information of the auxiliary positioning point (node ​​S), and therefore cannot locate the positioning subject (node ​​T) given in the statement through node S. This situation is considered a failure of understanding. If the data is found, InfoR can locate the positioning subject (node ​​T) given in the statement through the node S in its own database, and proceed to step S33.

[0166] S33: Starting from node S, InfoR searches for data (node ​​T) corresponding to the located subject in the statement tree along the other end of the given spatial relationship (relationship chain E). If the data is found, the understanding task ends, and the spatial relationship between the entities described in the statement is known information to InfoR. If the data is not found, InfoR can create node T corresponding to the located subject in its own database and write node T to the other end of the relationship chain E. This process can be regarded as InfoR's response to the received statement, that is, writing the new information conveyed in the statement into InfoR's database.

[0167] Example 2: The car is located in the southeast and northeast of Zhang.

[0168] Furthermore, in real-world scenarios, situations often arise where statements are ambiguous in their interpretation. This embodiment also provides a solution for such semantic ambiguity. Ambiguous statements refer to situations where, during the deconstruction process, a statement can be broken down into different solutions (as shown in Example 2), and different deconstruction solutions will lead to different interpretations. For this situation, the solution is as follows:

[0169] Taking the statement in Example 2 as an example, it contains four spatial relational attribute words: "east," "south," "east," and "north." Following the order from right to left, it can be broken down into three spatial relational attribute phrases: "north," "northeast," and "south-northeast." However, the spatial relational attribute phrase "south-northeast" contains two opposing directions, "south" and "north," so it can be determined that "south-northeast" is not a relational attribute phrase. Therefore, as... Figure 12 As shown, the feasible disassembly schemes are Scheme 1 and Scheme 2.

[0170] Further, in step S32, InfoR determines whether the auxiliary positioning points “Zhang Dongnan Dong” and “Zhang Dongnan” exist in its database.

[0171] If none of them exist, then the understanding fails;

[0172] If one of them exists, then the disassembly scheme corresponding to the auxiliary positioning point can be determined as a feasible scheme.

[0173] If both exist, further information is needed to help eliminate uncertainty, but how to obtain such further information is beyond the scope of this public discussion.

[0174] It is evident that ambiguity in statement comprehension arises from different decomposition schemes during statement deconstruction. In this embodiment, a method can be adopted to verify different statement decomposition schemes in the database to eliminate infeasible decomposition schemes (eliminate ambiguous options), thereby achieving the purpose of semantic disambiguation.

[0175] According to the database architecture model provided in this invention, and the semantic parsing method in the above embodiments, InfoP can autonomously learn (i.e., construct a database) by learning input statements describing spatial relationships between entities. For example, after receiving the statements in Example 3, InfoP can construct a database by learning the spatial relationships between different entities described in these statements. Figure 13 The database shown is shown below. Note that InfoP typically sets its own layer to layer 0 of the database; here, it is assumed that InfoP and the entity "a certain building" are on the same layer.

[0176] Example 3: A building is in a city. / A building is in a district. / District is in a city. / Building 1 is north of Building 2. / Building 1 is in a district. / Building 3 is south of Building 2. / Building 3 is in a district. / Building 4 is west of Building 3. / Building 5 is east of Building 3. / Building 6 is located within a mile of Building 3. / Building 8 is within a mile of Building 3. / Building 4 is located within a certain urban area. / Urban area 1 is east of urban area 2.

[0177] It is evident that, based on the method disclosed in this invention, the database can be expanded by learning the information conveyed in the language.

[0178] As an example, this disclosure also provides a method for constructing an entity spatial relationship model based on a computer database, including the following method steps:

[0179] Each entity in the real-world scene is marked as a node, and the spatial relationships between entities in the real-world scene are marked as directed edges. A corresponding relationship tree is generated based on the spatial relationships between entities in the real-world scene.

[0180] Each entity in the real-world scene is marked as a node, and the spatial directional relationship between entities in the real-world scene is abstracted as directed edges. Based on the spatial directional relationship between entities in the real-world scene, a corresponding relationship graph is generated.

[0181] Using the nodes with stable spatial positions shared by the relationship tree and the relationship graph as connection points, the relationship tree and the relationship graph are integrated into an entity spatial relationship model that includes spatial positional relationships. The entity spatial relationship model represents the spatial range relationship between entities in the vertical structure and the spatial direction relationship between entities in the horizontal structure.

[0182] As an example, this disclosure also provides a language generation apparatus based on a computer database for performing the steps described in the above embodiments. The same features have the same technical effects, and will not be repeated here. See below for details. Figure 14 The language generation device includes:

[0183] The model building unit 1002 is configured to build an entity spatial relationship model based on the spatial positional relationship between entities in a real scene. The entity spatial relationship model is stored in the database. The entity spatial relationship model includes an entity word dataset, a directed edge dataset, and a spatial correlation dataset. The entity word dataset, the directed edge dataset, and the spatial correlation dataset form a mapping relationship between each other.

[0184] The data lookup unit 1004 is configured to search for a target node and an auxiliary node that has a mapping relationship with the target node in the database based on the entity word dataset through the mapping relationship, and to search for the directed edge associated with the target node and the auxiliary node from the directed edge dataset based on the mapping relationship.

[0185] The first generation unit 1006 is configured to generate a data segment describing the spatial positional relationship of the target node through the target node, the auxiliary node, and the directed edge;

[0186] The second generation unit 1008 is configured to generate a statement describing the spatial positional relationship of the target node based on the data segment encoded by the encoder.

[0187] In some embodiments, such as Figure 15 As shown, the model building unit 1002 includes the following sub-units:

[0188] Relationship Tree Generation Unit 1002-1: Marks each entity in the real scene as a node, marks the spatial range relationship between entities in the real scene as directed edges, and generates the corresponding relationship tree based on the spatial range relationship between entities in the real scene;

[0189] Relationship graph generation unit 1002-3: Marks each entity in the real scene as a node, abstracts the spatial directional relationship between entities in the real scene as directed edges, and generates the corresponding relationship graph based on the spatial directional relationship between entities in the real scene;

[0190] Data model generation unit 1002-5: Using the nodes with stable spatial positions shared by the relationship tree and the relationship graph as connection points, the relationship tree and the relationship graph are integrated into an entity spatial relationship model containing spatial positional relationships. The entity spatial relationship model represents the spatial range relationship between entities in the vertical structure and the spatial direction relationship between entities in the horizontal structure.

[0191] In some embodiments, such as Figure 16 As shown, the second generation unit 1008 includes the following sub-units:

[0192] The first extraction unit 1008-1 is configured to extract entity words represented by the target node and the auxiliary node in the data segment based on the encoder;

[0193] The second extraction unit 1008-3 is configured to extract spatial range relation words and / or spatial direction relation words represented by the directed edges in the data segment based on the encoder.

[0194] The relation configuration unit 1008-5 is configured to configure the spatial correlation between the target node and the auxiliary node based on the encoder.

[0195] The statement generation unit 1008-7 is configured to generate a statement describing the spatial positional relationship of the target node based on the entity words, the spatial range relation words and / or spatial direction relation words, and spatial correlation.

[0196] As an example, this disclosure also provides an electronic device including a processor and a memory, the memory storing computer program instructions executable by the processor, wherein the processor executes the computer program instructions to implement any of the method steps described above.

[0197] As an example, embodiments of this disclosure also provide a non-transitory computer-readable storage medium storing computer program instructions that, when invoked and executed by a processor, implement the steps of any of the methods described above.

[0198] like Figure 17 As shown, the electronic device may include a processing unit (e.g., a central processing unit, a graphics processing unit, etc.) 1301, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 1302 or a program loaded from a storage device 1308 into a random access memory (RAM) 1303. The RAM 1303 also stores various programs and data required for the operation of the electronic device. The processing unit 1301, ROM 1302, and RAM 1303 are interconnected via a bus 1304. An input / output (I / O) interface 1305 is also connected to the bus 1304.

[0199] Typically, the following devices can be connected to I / O interface 1305: input devices 1306 including, for example, touchscreens, touchpads, keyboards, mice, cameras, microphones, accelerometers, gyroscopes, etc.; output devices 1307 including, for example, liquid crystal displays (LCDs), speakers, vibrators, etc.; storage devices 1308 including, for example, hard disks, etc.; and communication devices 1309. Communication device 1309 allows electronic devices to communicate wirelessly or wiredly with other devices to exchange data. Although Figure 17 Electronic devices with various devices are shown, but it should be understood that it is not required to implement or have all of the devices shown. More or fewer devices may be implemented or have instead.

[0200] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of this disclosure. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions indicated in the blocks may occur in a different order than those indicated in the drawings. For example, two consecutively indicated blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in the block diagrams and / or flowcharts, and combinations of blocks in the block diagrams and / or flowcharts, can be implemented using a dedicated hardware-based system that performs the specified function or operation, or using a combination of dedicated hardware and computer instructions.

[0201] Finally, it should be noted that the various embodiments in this specification are described in a progressive manner, with each embodiment focusing on its differences from other embodiments. Similar or identical parts between embodiments can be referred to interchangeably. For the systems or apparatus disclosed in the embodiments, since they correspond to the methods disclosed in the embodiments, the descriptions are relatively simple, and relevant parts can be referred to the method section.

[0202] The above embodiments are merely illustrative of the technical solutions of this disclosure and are not intended to limit it. Although this disclosure has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features; and these modifications or substitutions do not cause the essence of the corresponding technical solutions to depart from the technical solutions of the embodiments of this disclosure.

[0203] Spirit and scope.

Claims

1. A language generation method based on a computer database, characterized in that, include: An entity spatial relationship model is constructed based on the spatial location relationships between entities in a real-world scenario. The entity spatial relationship model is stored in a database. The entity spatial relationship model includes an entity word dataset, a directed edge dataset, and a spatial relevance dataset. The entity word dataset, the directed edge dataset, and the spatial relevance dataset form a mapping relationship between each other. In the database, based on the mapping relationship, the target node and the auxiliary node that has a mapping relationship with the target node are found in the entity word dataset. Based on the mapping relationship, the directed edge associated with the target node and the auxiliary node is found in the directed edge dataset. Data segments describing the spatial positional relationships of the target node are generated using the target node, the auxiliary node, and the directed edges. The data segment is encoded by the encoder to generate a statement describing the spatial positional relationship of the target node; The construction of the entity spatial relationship model based on the spatial positional relationships between entities in a real-world scenario includes: Each entity in the real-world scene is marked as a node, and the spatial relationships between entities in the real-world scene are marked as directed edges. A corresponding relationship tree is generated based on the spatial relationships between entities in the real-world scene. Each entity in the real-world scene is marked as a node, and the spatial directional relationship between entities in the real-world scene is abstracted as directed edges. Based on the spatial directional relationship between entities in the real-world scene, a corresponding relationship graph is generated. Using the nodes with stable spatial positions shared by the relationship tree and the relationship graph as connection points, the relationship tree and the relationship graph are integrated into an entity spatial relationship model that includes spatial positional relationships. The entity spatial relationship model represents the spatial range relationship between entities in the vertical structure and the spatial direction relationship between entities in the horizontal structure.

2. The method according to claim 1, characterized in that, The target node and the auxiliary node are connected by one, two, or more directed edges.

3. The method according to claim 1, characterized in that, The step of generating a statement describing the spatial location relationship of the target nodes after encoding the data segment by the encoder includes: Based on the encoder, the entity words represented by the target node and the auxiliary node in the data segment are extracted; Based on the encoder, the spatial range relation words and / or spatial direction relation words represented by the directed edges in the data segment are extracted; The spatial correlation between the target node and the auxiliary node is configured based on the encoder; Based on the entity words, the spatial range relation words and / or spatial direction relation words, and spatial relevance, a statement describing the spatial positional relationship of the target node is generated.

4. The method according to claim 3, characterized in that, The step of extracting spatial range relation words and / or spatial direction relation words represented by the directed edges in the data segment based on the encoder includes: The spatial range relationship and / or spatial direction relationship in the data segment are calculated to generate the final spatial range relationship and / or spatial direction relationship. Based on the encoder's encoding of the final spatial range relationship and / or the final spatial direction relationship, the final spatial range relationship word and / or spatial direction relationship word are generated.

5. The method according to claim 3, characterized in that, Also includes: Based on the encoder, the spatial distance relation words represented by the directed edges in the data segment are extracted; Accordingly, based on the entity words, the spatial range relation words and / or spatial direction relation words, and spatial relevance, a statement describing the spatial positional relationship of the target node is generated, including: Based on the entity words, the spatial range relation words and / or spatial direction relation words and / or spatial distance relation words, and spatial correlation, a statement describing the spatial positional relationship of the target node is generated.

6. The method according to claim 3, characterized in that, Also includes: Based on the encoder configuration, the spatial dimension words of the target node and the auxiliary node are configured; Accordingly, based on the entity words, the spatial range relation words and / or spatial direction relation words, and spatial relevance, a statement describing the spatial positional relationship of the target node is generated, including: Based on the entity words, the spatial range relation words and / or spatial direction relation words, spatial relevance, and spatial dimension words, a statement describing the spatial positional relationship of the target node is generated.

7. A language generation device based on a computer database, characterized in that, include: The model building unit is configured to build an entity spatial relationship model based on the spatial positional relationship between entities in a real scene. The entity spatial relationship model is stored in a database. The entity spatial relationship model includes an entity word dataset, a directed edge dataset, and a spatial correlation dataset. The entity word dataset, the directed edge dataset, and the spatial correlation dataset form a mapping relationship between each pair of entities. The construction of the entity spatial relationship model based on the spatial positional relationships between entities in a real-world scenario includes: Each entity in the real-world scene is marked as a node, and the spatial relationships between entities in the real-world scene are marked as directed edges. A corresponding relationship tree is generated based on the spatial relationships between entities in the real-world scene. Each entity in the real-world scene is marked as a node, and the spatial directional relationship between entities in the real-world scene is abstracted as directed edges. Based on the spatial directional relationship between entities in the real-world scene, a corresponding relationship graph is generated. Using the nodes with stable spatial positions shared by the relationship tree and the relationship graph as connection points, the relationship tree and the relationship graph are integrated into an entity spatial relationship model that includes spatial positional relationships. The entity spatial relationship model represents the spatial range relationship between entities in the vertical structure and the spatial direction relationship between entities in the horizontal structure. The data lookup unit is configured to search for a target node and an auxiliary node that has a mapping relationship with the target node in the database based on the entity word dataset through the mapping relationship, and to search for the directed edge associated with the target node and the auxiliary node from the directed edge dataset based on the mapping relationship. The first generation unit is configured to generate a data segment describing the spatial positional relationship of the target node through the target node, the auxiliary node, and the directed edge; The second generation unit is configured to generate statements describing the spatial positional relationships of the target nodes based on the data segment encoded by the encoder.

8. An electronic device comprising a processor and a memory, characterized in that, The memory stores computer program instructions that can be executed by the processor, and when the processor executes the computer program instructions, it implements the method as described in any one of claims 1-6.