A method and device for detecting the meaning of life
By constructing knowledge graphs and large language models to generate text with deep semantic information, and combining them with long short-term memory networks to train models, the accuracy problem of detecting the sense of meaning in life in social platform data has been solved, achieving higher detection accuracy.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-08-06
- Publication Date
- 2026-03-10
AI Technical Summary
Current methods for detecting meaning in life have low accuracy in social media data and lack a systematic interpretation method, leading to inaccurate test results.
We construct a knowledge graph based on multiple scientific documents, use a large language model to generate knowledge description text with deep semantic information, train a life meaning detection model through a long short-term memory network, and combine it with social text for detection.
It improves the accuracy of life meaning detection by integrating professional knowledge and social platform data, enhancing the model's ability to identify implicit emotional information.
Smart Images

Figure CN120596640B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of artificial intelligence technology, and in particular to a method and apparatus for detecting the meaning of life. Background Technology
[0002] A strong sense of meaning in life is closely linked to mental and psychological health. Detecting a person's sense of meaning in life can help with interventions and development of their mental health. Research shows that a high level of meaning in life is positively correlated with mental and psychological health, and strongly correlated with higher emotional well-being, motivation and job satisfaction, self-esteem, psychosocial functioning, and physical health. A lack of meaning in life not only affects an individual's psychological state but also has a profound impact on social stability and development.
[0003] Current methods for detecting meaning in life analyze user-posted content on social media to identify emotions and intentions related to meaning in life. However, the sheer volume and diversity of content on social media platforms, coupled with the lack of a systematic approach to interpreting meaning in life, makes it difficult to extract implicit emotional information from the data, resulting in low accuracy in meaning-of-life detection. Therefore, a method is needed to improve the accuracy of meaning-of-life detection. Summary of the Invention
[0004] In view of this, this application aims to propose a method and apparatus for detecting the meaning of life, so as to improve the accuracy of detecting the meaning of life.
[0005] To achieve the above objectives, the technical solution of this application is as follows:
[0006] A first aspect of this application provides a method for detecting the meaning of life, the method comprising:
[0007] A knowledge graph is constructed based on multiple scientific documents; the knowledge graph includes multiple triples related to the sense of meaning in life; each triple contains two entities and their corresponding relations;
[0008] Obtain text data for training;
[0009] The knowledge graph is used as the background knowledge of the large language model, and the large language model generates knowledge description text corresponding to the text data; the knowledge description text includes: enhanced semantic information that reflects the life meaning of the text data;
[0010] Based on the text data and the knowledge description text, a synthetic text is generated, and the synthetic text is converted into a corresponding fusion vector;
[0011] A life meaning detection model is trained based on the fused vectors; the life meaning detection model is constructed based on a long short-term memory network.
[0012] The trained life meaning detection model is used to detect fusion vectors generated from social text.
[0013] Optionally, a knowledge graph can be constructed based on multiple scientific documents, including:
[0014] Based on the preset first keyword, multiple scientific articles related to the sense of meaning in life were retrieved;
[0015] Triples were extracted from all scientific literature to obtain initial triples;
[0016] Perform cross-filtering on all initial triples;
[0017] The initial triples after cross-filtering were deduplicated to obtain multiple triples related to the sense of meaning in life.
[0018] A knowledge graph is formed by constructing entity sets and relation sets based on all triples related to the sense of meaning in life.
[0019] Optionally, after obtaining multiple triplets related to the sense of meaning in life, the following may also be included:
[0020] The system uses at least two different large language models to detect whether there is a hidden relationship between any two entities in the knowledge graph whose distance is less than a distance threshold and which have no relation.
[0021] Based on the detection results of various large language models, multiple entity pairs with implicit relationships are obtained;
[0022] Based on each entity pair and its corresponding implicit relation, supplementary triples are generated;
[0023] Add the supplementary triple to the knowledge graph.
[0024] Optionally, all initial triples are cross-filtered, including:
[0025] Remove triples containing entities with psychological terminology, abstract entities, and entities lacking objects;
[0026] Remove triples that contain a specific group of objects;
[0027] Retain the triples belonging to entities with a second keyword, and the triples belonging to entities without a second keyword but related to the sense of meaning in life.
[0028] Optionally, after constructing entity sets and relation sets based on all triples related to the sense of meaning in life to form a knowledge graph, the following is also included:
[0029] Based on the crawling cycle, popular keywords that appear more frequently than a frequency threshold are crawled from social platforms as new entities;
[0030] Traverse all entities stored in the knowledge graph to obtain the entities associated with the new entity;
[0031] Based on the new entity and the entities in the knowledge graph associated with the new entity, a new triple is generated;
[0032] The new triple is added to the knowledge graph.
[0033] Optionally, the knowledge graph is used as background knowledge for a large language model, and the large language model is used to generate knowledge description text corresponding to the text data, including:
[0034] The text data is divided into multiple text blocks, with each user as a unit.
[0035] Each text block and the knowledge graph are input into the large language model, and the large language model obtains the entities and relationships that match the text block from the knowledge graph; wherein, the relationships include: the relationships between entities, and the relationships between entities and the sense of meaning in life;
[0036] The large language model processes the matching entities and relationships of the text block to generate text that embodies the life meaning of the text block, which serves as the knowledge description text corresponding to the text block.
[0037] Optionally, obtaining entities and relationships matching the text block from the knowledge graph using the large language model includes:
[0038] The knowledge graph is traversed using the large language model to determine whether each entity in the knowledge graph exists in the text block, and whether each entity in the knowledge graph is semantically similar to the entity in the text block.
[0039] Entities existing in the text block, as well as entities semantically similar to those in the text block, are selected as candidate entities.
[0040] The large language model is used to determine the relationships between candidate entities and the relationship between each candidate entity and the sense of meaning in life, and to generate corresponding ternary relation groups.
[0041] According to a second aspect of the present application, a life meaning detection device is provided for implementing the steps of the method provided in the first aspect of the present application, the device comprising:
[0042] The construction module is configured to build a knowledge graph based on multiple scientific documents; the knowledge graph includes multiple triples related to the sense of meaning in life; wherein each triple contains two entities and their corresponding relations;
[0043] The acquisition module is configured to acquire text data for training.
[0044] The fusion module is configured to use the knowledge graph as background knowledge for a large language model, and generate knowledge description text corresponding to the text data through the large language model; the knowledge description text includes: enhanced semantic information that reflects the life meaning of the text data; and generate synthetic text based on the text data and the knowledge description text, and convert the synthetic text into a corresponding fusion vector.
[0045] The training module is configured to train a life meaning detection model based on the fused vectors; the life meaning detection model is constructed based on a long short-term memory network.
[0046] The detection module is configured to detect fusion vectors generated from social text using a trained life meaning detection model.
[0047] According to a third aspect of the present application, a computer-readable storage medium is provided, on which a computer program is stored, which, when executed by a processor, implements the steps of the method provided in the first aspect of the present application.
[0048] According to a fourth aspect of the present application, an electronic device is provided, including a memory, a processor, and a computer program stored in the memory and executable on the processor. When executed by the processor, the computer program implements the steps of the method provided in the first aspect of the present application.
[0049] This application employs the life meaning detection method provided, constructing a knowledge graph related to life meaning based on multiple scientific documents. This knowledge graph is then used as background knowledge corpus for a large language model. The large language model processes user text from social media platforms to generate corresponding knowledge description text that reflects the life meaning of the text. Because the knowledge graph integrates professional knowledge information from different sources, organizing and displaying complex information and concepts related to life meaning in the form of triples, it forms systematic and intuitive data. Therefore, the large language model, through learning from the knowledge graph, can better generate deep semantic information reflecting the life meaning in user text. Based on this, the knowledge description text is synthesized with the user's original text, resulting in a synthetic text with richer semantic information. Using the fusion vector from the synthesized text transformation to train the life meaning detection model significantly improves its ability to extract implicit emotional information from text, thereby enhancing the model's performance and accuracy. Attached Figure Description
[0050] To more clearly illustrate the technical solutions of the embodiments of this application, the drawings used in the description of the embodiments of this application will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0051] Figure 1 This is a flowchart of a life meaning detection method proposed in an embodiment of this application;
[0052] Figure 2 This is a schematic diagram illustrating the generation of a fusion vector in one embodiment of this application;
[0053] Figure 3 This is a schematic diagram of a life meaning detection device according to an embodiment of this application;
[0054] Figure 4 This is a schematic diagram of an electronic device according to an embodiment of this application. Detailed Implementation
[0055] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0056] It should be understood that the phrase "one embodiment" or "an embodiment" throughout the specification means that a specific feature, structure, or characteristic related to the embodiment is included in at least one embodiment of this application. Therefore, "in one embodiment" or "in an embodiment" appearing throughout the specification does not necessarily refer to the same embodiment. Furthermore, these specific features, structures, or characteristics can be combined in any suitable manner in one or more embodiments.
[0057] In the various embodiments of this application, it should be understood that the sequence number of each process described below does not imply the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of this application.
[0058] Exemplary embodiments will now be described in detail, examples of which are illustrated in the accompanying drawings. When the following description relates to the drawings, unless otherwise indicated, the same numbers in different drawings denote the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with this application. Rather, they are merely examples of apparatuses and methods consistent with some aspects as detailed in this application.
[0059] It should be noted that, unless otherwise specified, the embodiments and features described in this application can be combined with each other.
[0060] Social media platforms, due to their openness and high-frequency information dissemination, have become an important data source for studying individual psychological states. This application pre-constructs a knowledge graph related to the sense of meaning in life, and combines the structured knowledge graph information with text data from social media platforms to improve the ability of the sense of meaning in life detection model to identify the sense of meaning in life and to improve the accuracy of the model in detecting the sense of meaning in life.
[0061] The present application will now be described in detail with reference to the accompanying drawings and embodiments.
[0062] Figure 1 This is a flowchart of a life meaning detection method proposed in an embodiment of this application. Figure 1 As shown, the method includes:
[0063] S1: Construct a knowledge graph based on multiple scientific documents; the knowledge graph includes multiple triples related to the sense of meaning in life; each triple contains two entities and their corresponding relations;
[0064] S2: Obtain text data for training;
[0065] S3: Using the knowledge graph as background knowledge for the large language model, the large language model generates knowledge description text corresponding to the text data; the knowledge description text contains: deep semantic information that reflects the life meaning of the text data;
[0066] S4: Generate synthetic text based on the text data and the knowledge description text, and convert the synthetic text into a corresponding fusion vector;
[0067] S5: Train a life meaning detection model based on the fused vector; the life meaning detection model is constructed based on a long short-term memory network;
[0068] S6: Detect the fusion vector generated based on social text using the trained life meaning detection model.
[0069] In this embodiment, a knowledge graph related to the sense of meaning in life was pre-constructed based on multiple scientific documents. The knowledge graph contains multiple triples composed of entities related to the sense of meaning in life. Each triple consists of two entities and the relationship between them, reflecting the association between two entities related to the sense of meaning in life.
[0070] In this embodiment, text data for training is obtained from social media platforms, and a large language model, based on professional knowledge information provided by a knowledge graph, generates knowledge-descriptive text that reflects the life meaning of the original text data. Specifically, the knowledge graph corpus is input into the large language model, which processes each piece of text data to generate corresponding knowledge-descriptive text. Based on the professional knowledge of the knowledge graph, the large language model analyzes entities related to life meaning in the text data, extracts entities and relationships related to the text data from the knowledge graph, and generates corresponding knowledge-descriptive text based on this. Each piece of text data is then synthesized with its corresponding knowledge-descriptive text to obtain a synthesized text. The synthesized text originates from text information on social media platforms and the professional knowledge of the knowledge graph. The text on social media platforms reflects individual subjective experiences, while the variables related to life meaning extracted from scientific literature are objective standards proven by previous research.
[0071] The synthesized text is converted into corresponding embedding vectors (i.e., fused vectors). Then, the fused vectors are used to train a life meaning detection model. The fused vectors construct a comprehensive feature space, supplementing the original text data with additional information from the knowledge graph, providing the life meaning detection model with more domain-specific knowledge. Furthermore, training the life meaning detection model with fused vectors supplements the model with authoritative information sources, improving the model's ability to learn implicit emotional information from text, enhancing model performance and the accuracy of detection results. The trained life meaning detection model can accurately detect life meaning based on fused vectors generated from the text to be detected. In practical applications, a large language model is used to process the text to be detected, obtaining corresponding knowledge description text. Then, the text to be detected and the corresponding knowledge description text are synthesized and converted into fused vectors. The fused vectors are then input into the trained life meaning detection model to obtain the detection results.
[0072] In this embodiment, a fusion vector is used to train the life meaning detection model. This allows the model to not only detect text data from social media platforms but also learn from professional knowledge, improving its accuracy. Furthermore, the trained life meaning model can combine knowledge graphs to detect input text data, further enhancing the accuracy of the detection results.
[0073] As one implementation method of this application, a knowledge graph is constructed based on multiple scientific documents, including:
[0074] Based on the preset first keyword, multiple scientific articles related to the sense of meaning in life were retrieved;
[0075] Triples were extracted from all scientific literature to obtain initial triples;
[0076] Perform cross-filtering on all initial triples;
[0077] The initial triples after cross-filtering were deduplicated to obtain multiple triples related to the sense of meaning in life.
[0078] A knowledge graph is formed by constructing entity sets and relation sets based on all triples related to the sense of meaning in life.
[0079] In one embodiment, triplets related to the sense of meaning in life are first constructed, namely "head entity-relation-tail entity". In this embodiment, a scientific article database is searched based on the first keywords "meaning in life" and "meaningful life" to obtain multiple relevant scientific articles. The retrieved scientific articles are sorted from high to low relevance, and a certain number of scientific articles are selected for triplet extraction. In practical applications, the number of scientific articles extracted can be set according to actual needs; the more scientific articles selected, the larger the number of triplets in the knowledge graph. In this embodiment, 500 scientific articles are ultimately selected for triplet extraction.
[0080] All selected scientific literature is formatted and triplet extraction is performed. In one embodiment, the API (Application Programming Interface) of a large language model is invoked for extraction. Considering that scientific literature related to the meaning of life contains a large amount of English data, the GPT (Generative Pre-trained Transformer) model, which is more suitable for processing English data, is used for triplet extraction. The specific steps are as follows:
[0081] (1) Define the entity extraction function:
[0082] The entities to be set include: "Time", "Place", "People", "Country / Region", "Organization" and "Concept";
[0083] Configure GPT to identify potential entities from scientific literature, with the following output requirements:
[0084] 1) The output format is entity name:entity type;
[0085] 2) Each pair of output results is separated by a fixed symbol;
[0086] 3) Extract only from the given sentences; do not summarize on your own.
[0087] 4) The conceptual entity is complete.
[0088] (2) Define the relation extraction function:
[0089] 1) Give the entity a specific definition:
[0090] ① Concepts: These refer to concepts related to the meaning of life in the field of psychology, such as the meaning of life, value, health-related quality, and human beings;
[0091] 2) Define the relationship specifically:
[0092] ① Concept-Related-Concept;
[0093] ② Concept - is - concept;
[0094] 3) Feed specific entity extraction examples.
[0095] For example, value can be further divided into three main aspects: creativity, experience, and attitude.
[0096] Output: Value is related to creation; value is related to experience; value is related to attitude.
[0097] 4) Configure the commands to enable GPT to perform relation extraction, with the following output requirements:
[0098] The output format is: {head entity h}-{relation r}-{tail entity t};
[0099] Each pair of output results is separated by a fixed symbol;
[0100] Extract only from the given sentences; do not summarize on your own.
[0101] In this embodiment, the initial triples extracted from the original scientific literature are stored in a txt file and then translated into Chinese. Examples of triples are shown in Table 1 below.
[0102] Table 1
[0103]
[0104] The transformed triples still need to undergo data cleaning operations such as cross-filtering and deduplication before they can be used to construct the knowledge graph. After cross-filtering and deduplication, entity sets and relation sets are constructed based on the final retained triples to facilitate the retrieval of corresponding embedding vectors later. The knowledge graph is then constructed based on the final retained triples, entity sets, and relation sets. To facilitate the later training of the life meaning detection model, this embodiment also divides all triples into three parts—training set, test set, and validation set—and stores them in the knowledge graph for model training.
[0105] In this embodiment, the specific division of each dataset in the final generated knowledge graph is shown in Table 2 below.
[0106] Table 2
[0107]
[0108] In this embodiment, a deduplication operation is performed on the triples after cross-filtering. Specifically, new triples formed by swapping the positions of the head and tail entities are removed. The final generated entity set includes 1027 entities, and the relation set includes 33 types of relations. The 33 types of relations in the relation set are: related, predictive, relevant, reinforcing, promoting, constituting, regulating, stimulating, associating, involving, influencing, providing, improving, enhancing, originating from, predicting, increasing, causing, strengthening, improving, through, reducing, raising, lowering, mitigating, stimulating, generating, helping, restricting, depending on, adjusting, accelerating, and potentially disruptive.
[0109] In one embodiment, 11,187 triples were extracted using the above extraction method. Further, the extracted triples were further summarized using a large language model to reduce redundant data, save computational resources for subsequent entity matching, and improve matching efficiency. Specifically, prompt words were constructed, and these triples were further summarized based on the prompt words using the qwen-plus API service of the Qianwen base model. In practical applications, the number of summarization operations is determined as needed. It is worth noting that as the number of summarization operations increases, the granularity of information in the knowledge graph gradually becomes larger, which may result in the loss of detailed information to some extent. Therefore, the number of summarization operations can be determined based on the requirements for fine-grained information, data maintenance costs, and entity matching efficiency. Optionally, in this embodiment, the number of summarization operations is set to 2.
[0110] In this embodiment, the process of a single induction operation is as follows:
[0111] (1) Based on semantic similarity, each head entity is classified according to the similarity threshold to obtain multiple sets of triples, where the triples in each set of triples share a semantic subject (i.e., head entity).
[0112] (2) Perform semantic classification on all tail entities in the same set of triples and assign a subclass name to each type of tail entity;
[0113] (3) For each type of tail entity, summarize all the triples corresponding to that type of tail entity into a semantically concise and accurately representative triple. If there is only one triple corresponding to that type of tail entity, there is no need to summarize, and the original triple is directly retained.
[0114] In this embodiment, redundant data is removed by summarizing triples, thereby simplifying the knowledge graph and ultimately reducing the number of triples in the knowledge graph to 2212.
[0115] As one implementation of this application, cross-filtering is performed on all initial triples, including:
[0116] Remove triples containing entities with psychological terminology, abstract entities, and entities lacking objects;
[0117] Remove triples that contain a specific group of objects;
[0118] Retain the triples belonging to entities with a second keyword, and the triples belonging to entities without a second keyword but related to the sense of meaning in life.
[0119] In one embodiment, to ensure the accuracy of the knowledge graph, the initial triples converted to Chinese need to be cross-filtered to remove semantically inconsistent, repetitive, or missing data. This cross-filtering is specifically performed by two different large language models, and the specific filtering rules are as follows:
[0120] (1) Remove triples containing psychological terminology, abstract entities, or entities lacking objects. For example, meaning of life - related - mediating effect, meaning of life - related - human optimal development, meaning of life - related - compensation, etc.
[0121] (2) Since the knowledge graph constructed in this application is a general-purpose knowledge graph, it is necessary to remove triples that contain specific object groups. For example, meaning of life - related to chronic pain patients, positive emotions - related to the elderly, meaning of life - related to nursing experience, etc.
[0122] (3) Retain entities that do not contain a specific keyword (secondary keyword) but are related to the sense of meaning in life. For example, triples that do not contain the keyword "meaning in life" but are related to the sense of meaning in life, such as "negative emotions-related-sleep", "positive emotions-related-creativity", and "psychological needs-related-income", should be retained.
[0123] In this embodiment, the Kappa coefficient is used to measure the consistency of the cross-screening results to ensure the reliability of the quality of the triples retained by the cross-screening. SPSS analysis was used, k = 0.79, p < 0.001.
[0124] Optionally, the cross-screening operation can be performed manually. In one embodiment, the cross-screening is performed by multiple professionals with psychology backgrounds using a 0 / 1 cross-screening method, and the final screening result is determined by combining the annotation results of all professionals.
[0125] As one implementation of this application, after constructing an entity set and a relation set based on all triples related to the sense of meaning in life to form a knowledge graph, it also includes:
[0126] Based on the crawling cycle, popular keywords that appear more frequently than a frequency threshold are crawled from social platforms as new entities;
[0127] Traverse all entities stored in the knowledge graph to obtain the entities associated with the new entity;
[0128] Based on the new entity and the entities in the knowledge graph associated with the new entity, a new triple is generated;
[0129] The new triple is added to the knowledge graph.
[0130] In one embodiment, the knowledge graph is expanded by periodically extracting frequently occurring keywords from social media platforms and associating them with entities stored in the knowledge graph to form new triples. Due to the rapid development of the internet, popular phrases or new expressions may emerge on social media platforms. To improve the life meaning detection model's understanding of data such as popular phrases on social media platforms, frequently occurring popular keywords are extracted from social media platforms as new entities and added to the knowledge graph through cross-filtering, forming new triples with existing entities in the knowledge graph.
[0131] Specifically, according to the crawling cycle, popular keywords appearing more than a frequency threshold are crawled from social platforms as new entities. Based on these new entities and entities in the knowledge graph, new triples are generated through cross-labeling. Each new triple includes an entity generated from a popular keyword and an entity from the knowledge graph. These new triples are added to the knowledge graph for training the life meaning detection model. In practical applications, the crawling cycle and frequency threshold can be set as needed; this embodiment does not impose restrictions on the specific setting of the frequency threshold.
[0132] As one embodiment of this application, after obtaining multiple triplets related to the sense of meaning in life, it further includes:
[0133] The system uses at least two different large language models to detect whether there is a hidden relationship between any two entities in the knowledge graph whose distance is less than a distance threshold and which have no relation.
[0134] Based on the detection results of various large language models, multiple entity pairs with implicit relationships are obtained;
[0135] Based on each entity pair and its corresponding implicit relation, supplementary triples are generated;
[0136] Add the supplementary triple to the knowledge graph.
[0137] In one embodiment, the hidden relationships between entities in different triples within the knowledge graph are further mined to expand the knowledge graph. This allows the life meaning detection model to learn richer fusion information during subsequent training, improving the model's detection performance. Specifically, a first prompt word is constructed, and the massive prior knowledge of the large language model is used to further mine whether there are hidden relationships between entities in different triples within the knowledge graph. The mining process is as follows:
[0138] (1) For any two entities in the knowledge graph whose distance is less than a distance threshold (e.g., a distance threshold of 5) and have no relationship, different large language models are queried based on the first prompt word to determine whether there is a relationship between the two entities. In this embodiment, the large language models used to mine deep implicit relationships include: ChatGPT-4o model, Llama3.2 model, and ChatGLM model. In practical applications, the distance threshold and the specific large language model used can be specified as needed, and this application does not limit this.
[0139] (2) For each entity pair that may have a hidden relationship, it is necessary to further determine whether the hidden relationship exists. In this embodiment, the judgment results of all large language models are summarized, and entity pairs whose output results of more than half of the large language models are "there is a hidden relationship" are identified as entity pairs with a hidden relationship;
[0140] (3) For entity pairs with implicit relationships, new triples are formed and added to the knowledge graph.
[0141] In this embodiment, the existence of implicit relationships between entities in different triples in the original knowledge graph is further explored. For entity pairs with implicit relationships, new triples are formed to expand the knowledge graph. This allows for the injection of more professional domain knowledge into the subsequent training and application of the life meaning detection model, thereby further improving the accuracy of the model in detecting life meaning.
[0142] As one embodiment of this application, the knowledge graph is used as background knowledge for a large language model, and the knowledge description text corresponding to the text data is generated through the large language model, including:
[0143] The text data is divided into multiple text blocks, with each user as a unit.
[0144] Each text block and the knowledge graph are input into the large language model, and the large language model obtains the entities and relationships that match the text block from the knowledge graph; wherein, the relationships include: the relationships between entities, and the relationships between entities and the sense of meaning in life;
[0145] The large language model processes the matching entities and relationships of the text block to generate text that embodies the life meaning of the text block, which serves as the knowledge description text corresponding to the text block.
[0146] In one embodiment, text data from multiple users is obtained from a social media platform, and the text data is divided into text blocks on a user-by-user basis. In practical applications, the number of characters contained in a text block must be less than the upper limit of the number of characters that a large language model can process per word to avoid information loss.
[0147] Each user's text block is input into a large language model. Based on background knowledge provided by a knowledge graph, the large language model analyzes the text block, extracting entities and relationships that match it. Notably, the relationships extracted by the large language model include relationships between entities and relationships between entities and a sense of meaning in life. Subsequently, based on the entities and relationships matching the text block, the large language model generates a knowledge-descriptive text that reflects the sense of meaning in life conveyed by that text block.
[0148] Next, the text blocks are synthesized with the corresponding knowledge description text to obtain the synthesized text. The synthesized text is then converted into the corresponding embedding vector (i.e., the fusion vector) as training data for the life meaning detection model.
[0149] As one implementation of this application, obtaining entities and relationships matching the text block from the knowledge graph using the large language model includes:
[0150] The knowledge graph is traversed using the large language model to determine whether each entity in the knowledge graph exists in the text block, and whether each entity in the knowledge graph is semantically similar to the entity in the text block.
[0151] Entities existing in the text block, as well as entities semantically similar to those in the text block, are selected as candidate entities.
[0152] The large language model is used to determine the relationships between candidate entities and the relationship between each candidate entity and the sense of meaning in life, and to generate corresponding ternary relation groups.
[0153] In one embodiment, the COT (Chain of Thought) method is employed, using a knowledge graph as background knowledge and a large language model to perform three-step reasoning to obtain matching entities. Considering that the triples in the knowledge graph constructed in this embodiment are Chinese text, the large language model uses the Qwen3 model, which is more suitable for Chinese reasoning. The knowledge graph is pre-input into the large language model as background knowledge corpus, serving as the knowledge basis for analyzing and deriving entities and relationships that match the text data. Then, the matching entities are obtained according to the following steps:
[0154] The first step is to determine which entities in the knowledge graph match the user's text block. The prompt word and text block are input into the large language model. The large language model uses the knowledge graph as a basis, traversing each entity in the graph to identify all entities that match the user's text block as candidate entities, and generating an entity set E={e1,e2,...en}.
[0155] The second step is to reason about the direct relationships between the candidate entities in the entity set E, as well as the relationship between each candidate entity and the sense of meaning in life, to obtain the relationship set R={r1,r2,..rn};
[0156] The third step is to integrate the entity set E and the relation set R into a triple representation, resulting in a set T = {(h1,r1,t1),(h2,r2,t2),…,(hn,rn,tn)} containing multiple triples, where h represents the head entity in the triple, t represents the tail entity, and r represents the relationship between the head and tail entities. It is worth noting that, depending on the specific circumstances, multiple triples may be generated based on a single text block during integration.
[0157] In this embodiment, pre-constructed prompt words are used to guide the large language model to traverse and reason about the knowledge graph based on its information. The content of the constructed prompt words is as follows:
[0158] You are an assistant with a psychology background. Please refer to the following "Knowledge Graph of Meaning in Life" to complete the task of analyzing Weibo content:
[0159] Knowledge Graph
[0160] {kg_text}
[0161] [Task Weibo]
[0162] {weibo block}
[0163] Please follow these steps carefully:
[0164] Step 1: Entity Recognition
[0165] Please list the entities or keywords related to knowledge graphs mentioned in the Weibo post, and explain which entities in the knowledge graph might match these entities.
[0166] Step 2: Relation Extraction
[0167] Based on the entities identified in the previous step, we analyze the potential relationships between them, especially their relationship with "meaning of life," and use the relationships in the knowledge graph to make inferences.
[0168] Step 3: Triple Integration
[0169] Please integrate the above entities and their relationships into a structured triple expression, and explain how they relate to a sense of meaning in life.
[0170] Figure 2 This is a schematic diagram illustrating the generation of a fusion vector in one embodiment of this application. For example... Figure 2 As shown, each user's text block is input into a large language model that has learned from a knowledge graph. The knowledge graph and the large language model are used to infer entities and relationships matching the text block. After obtaining the matching entities and relationships, the large language model is further used to process these entities and relationships to generate corresponding knowledge description text. Since these knowledge description texts are based on entities and relationships matching the text block, they effectively convey the life and meaning of the text block. Based on this, the original text block and the corresponding knowledge description text are synthesized to obtain synthesized text. Then, the BERT (Bidirectional Encoder Representations from Transformers) model is used to convert the synthesized text into vector form, resulting in a fused vector.
[0171] The following example uses a Weibo post as an illustration. The user's Weibo post is: "I helped a classmate with their studies, and they actually bought me a milk tea! I'm so happy!" Following the method for generating the fusion vector provided in the above embodiment, the fusion vector is generated according to the following steps:
[0172] (1) Input the Weibo text into SentenceBert, a large language model with a knowledge graph as its background knowledge base, and obtain the entities and relations that match the Weibo text:
[0173] Entity 1: "Helping classmates review" → The large language model matches the entity "respectful activities" in the knowledge graph;
[0174] Entity 2: "Bought a cup of milk tea" → The large language model analysis judges that it may imply an "emotional experience of being respected" or "emotional experience of being recognized";
[0175] (2) Extract relations from the matched entities:
[0176] The two entities, "respected activities" and "appreciated emotional experiences," have a "facilitation" relationship: helping classmates review (respected activities) → facilitation → receiving milk tea (appreciated emotional experiences). Based on the knowledge graph, "respected activities" can promote "meaningful living," and this appreciation further enhances the user's sense of meaning in life.
[0177] (3) Integrate entities and relations into triples:
[0178] Triad 1: (Helping classmates review, promoting a meaningful life);
[0179] Triad 2: (Buying milk tea enhances the sense of meaning in life);
[0180] (4) Based on the integrated triples, knowledge interpretation and induction are performed, and the analysis is as follows: This Weibo post reflects that the user gained a positive emotional experience of being recognized by helping others, which may indirectly enhance their sense of meaning in life. Based on this, the large language model generates knowledge description text:
[0181] Users received positive feedback (buying milk tea) by participating in "respectful activities" (helping classmates review), thus experiencing the meaning and value of life.
[0182] (5) Combine the original text block with the knowledge description text to obtain the synthesized text. Use the BERT model to convert the synthesized text into an embedding vector to obtain the fused vector.
[0183] It is worth noting that if entities and relationships that match the user's text data cannot be obtained, then the corresponding knowledge description text is missing, that is, there is no corresponding second target vector.
[0184] This embodiment utilizes a large language model to use a knowledge graph as background knowledge corpus to reason about text data, resulting in knowledge-descriptive text that reflects the life meaning of the text data. Compared to the traditional method of segmenting text data and then matching entities based on segmentation, this embodiment uses a large language model to perform entity and relation matching on the entire text block. This allows for the complete transfer of relevant entities and relations from the knowledge graph to the text semantics, avoiding the omission of entities semantically similar to the text block, thereby improving the accuracy of the detection model.
[0185] In one embodiment, the life meaning detection model is built on LSTM (Long Short-Term Memory) networks. LSTM models can effectively handle long-term dependencies in sequences and dynamically adjust stored content according to changes in input data, making them highly suitable for long-term text updates posted by users on social media platforms. LSTM models can understand the deeper meaning of input text by continuously adjusting memory and information flow.
[0186] Before training the model using fused vectors, the dataset was split into a first training set and a first test set, based on users. Each user's fused vector NumPy matrix G was stored as a separate file, named in the format "User ID + Subscale Score for Three Dimensions of Meaning in Life + Username", for example, "1345454230+25+20+27+Zhang San.npy". This naming convention provides the ground truth label for the LSTM model, representing each user's score on the meaning in life questionnaire.
[0187] In this embodiment, the fused vector is a three-dimensional vector. After the fused vector is input into the model, the LSTM model treats it as a time series, where the three dimensions are considered as: different time series, time step size, and feature dimension at each time step. LSTM uses a gating mechanism to selectively discard or add information, thereby updating its internal state. The LSTM's gating mechanism captures important information from the input features based on the time series input feature dimension through a series of calculations, while forgetting unimportant information.
[0188] During training, the fused vector is forward-propagated through each layer of the LSTM to calculate the predicted life meaning value. The model evaluates the difference between the predicted value and the true label by calculating the loss value, and updates the weights using the backpropagation algorithm based on the loss value. The gradient with respect to each parameter is calculated using the chain rule, which represents the impact of each parameter on the final loss. Based on the calculated gradients, the weights are adjusted using an optimization algorithm. Iterative training improves the model's output performance, adjusting the weights of the output layer during training to minimize the error between the predicted value and the actual label. After the LSTM model has processed all input sequences, it generates a final hidden state that reflects the important information in the sequence. This hidden state is then passed to the activation function through a fully connected layer, ultimately outputting the strength value of the life meaning.
[0189] The detection result of the life meaning detection model is a life meaning intensity value, ranging from [-1, 1]. The life meaning intensity value represents the strength of life meaning; the closer the value is to -1, the lower the life meaning; the closer the value is to 1, the stronger the life meaning.
[0190] In this embodiment, the life meaning detection model maps important features in the fusion vector to the level of life meaning, enabling the model to better capture relevant information in Weibo text and knowledge graph and output a more accurate life meaning score.
[0191] Based on the same inventive concept, one embodiment of this application provides a device for detecting the meaning of life. (Reference) Figure 3 , Figure 3 This is a schematic diagram of a life meaning detection device 100 according to an embodiment of this application. Figure 3 As shown, the device includes:
[0192] The construction module 101 is configured to construct a knowledge graph based on multiple scientific documents; the knowledge graph includes multiple triples related to the sense of meaning in life; wherein each triple contains two entities and corresponding relations; and all entities and relations in the knowledge graph are converted into embedding vectors.
[0193] The acquisition module 102 is configured to acquire text data for training.
[0194] The fusion module 103 is configured to use the knowledge graph as background knowledge for a large language model, and generate knowledge description text corresponding to the text data through the large language model; the knowledge description text includes: enhanced semantic information that reflects the life meaning of the text data; and generate synthetic text based on the text data and the knowledge description text, and convert the synthetic text into a corresponding fusion vector.
[0195] Training module 104 is configured to train a life meaning detection model based on the fusion vector; the life meaning detection model is constructed based on a long short-term memory network.
[0196] The detection module 105 is configured to detect fusion vectors generated based on social text using a trained life meaning detection model.
[0197] As one embodiment of this application, the construction module 101 is configured to construct a knowledge graph based on multiple scientific documents, including:
[0198] Based on the preset first keyword, multiple scientific articles related to the sense of meaning in life were retrieved;
[0199] Triples were extracted from all scientific literature to obtain initial triples;
[0200] Perform cross-filtering on all initial triples;
[0201] The initial triples after cross-filtering were deduplicated to obtain multiple triples related to the sense of meaning in life.
[0202] A knowledge graph is formed by constructing entity sets and relation sets based on all triples related to the sense of meaning in life.
[0203] As one embodiment of this application, after obtaining multiple triplets related to the sense of meaning in life, the construction module 101 is further configured to perform the following steps:
[0204] The system uses at least two different large language models to detect whether there is a hidden relationship between any two entities in the knowledge graph whose distance is less than a distance threshold and which have no relation.
[0205] Based on the detection results of various large language models, multiple entity pairs with implicit relationships are obtained;
[0206] Based on each entity pair and its corresponding implicit relation, supplementary triples are generated;
[0207] Add the supplementary triple to the knowledge graph.
[0208] As one embodiment of this application, the construction module 101 is configured to perform cross-filtering on all initial triples, including:
[0209] Remove triples containing entities with psychological terminology, abstract entities, and entities lacking objects;
[0210] Remove triples that contain a specific group of objects;
[0211] Retain the triples belonging to entities with a second keyword, and the triples belonging to entities without a second keyword but related to the sense of meaning in life.
[0212] As one implementation of this application, after constructing an entity set and a relation set based on all triples related to the sense of meaning in life to form a knowledge graph, the construction module 101 is further configured to perform the following steps:
[0213] Based on the crawling cycle, popular keywords that appear more frequently than a frequency threshold are crawled from social platforms as new entities;
[0214] Traverse all entities stored in the knowledge graph to obtain the entities associated with the new entity;
[0215] Based on the new entity and the entities in the knowledge graph associated with the new entity, a new triple is generated;
[0216] The new triple is added to the knowledge graph.
[0217] In one embodiment of this application, the fusion module 103 is configured to use the knowledge graph as background knowledge for a large language model, and generate knowledge description text corresponding to the text data through the large language model, specifically including:
[0218] The text data is divided into multiple text blocks, with each user as a unit.
[0219] Each text block and the knowledge graph are input into the large language model, and the large language model obtains the entities and relationships that match the text block from the knowledge graph; wherein, the relationships include: the relationships between entities, and the relationships between entities and the sense of meaning in life;
[0220] The large language model processes the matching entities and relationships of the text block to generate text that embodies the life meaning of the text block, which serves as the knowledge description text corresponding to the text block.
[0221] As one embodiment of this application, the fusion module 103 is configured to obtain entities and relationships matching the text block from the knowledge graph through the large language model, specifically including:
[0222] The knowledge graph is traversed using the large language model to determine whether each entity in the knowledge graph exists in the text block, and whether each entity in the knowledge graph is semantically similar to the entity in the text block.
[0223] Entities existing in the text block, as well as entities semantically similar to those in the text block, are selected as candidate entities.
[0224] The large language model is used to determine the relationships between candidate entities and the relationship between each candidate entity and the sense of meaning in life, and to generate corresponding ternary relation groups.
[0225] Based on the same inventive concept, one embodiment of this application provides a computer program product. This computer program product includes a computer program that, when executed by a processor, implements the steps in the life meaning detection method as described in any of the above embodiments of this application.
[0226] Based on the same inventive concept, one embodiment of this application provides a readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps in the life meaning detection method as described in any of the above embodiments of this application.
[0227] Based on the same inventive concept, one embodiment of this application provides an electronic device, with reference to... Figure 4 , Figure 4 This is a schematic diagram of an electronic device according to an embodiment of this application. The electronic device includes a memory, a processor, and a computer program stored in the memory and executable on the processor. When executed by the processor, the computer program implements the steps in the life meaning detection method as described in any of the above embodiments of this application.
[0228] Regarding the apparatus in the above embodiments, the specific manner in which each module performs its operation has been described in detail in the embodiments related to the method, and will not be elaborated upon here.
[0229] The above description is merely a preferred embodiment of this application and is not intended to limit this application. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application should be included within the protection scope of this application.
[0230] For the sake of simplicity, the method embodiments are described as a series of actions. However, those skilled in the art should understand that this application is not limited to the described order of actions, as some steps may be performed in other orders or simultaneously according to this application. Furthermore, those skilled in the art should also understand that the embodiments described in the specification are preferred embodiments, and the actions and components involved are not necessarily essential to this application.
[0231] Those skilled in the art will understand that embodiments of this application can be provided as methods, apparatus, or computer program products. Therefore, embodiments of this application can take the form of entirely hardware embodiments, entirely software embodiments, or embodiments combining software and hardware aspects. Furthermore, embodiments of this application can take the form of computer program products implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0232] This application describes embodiments with reference to flowchart illustrations and / or block diagrams of methods, terminal devices (systems), and computer program products according to embodiments of this application. It should be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing terminal device to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing terminal device, generate instructions for implementing the flowchart illustrations. Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.
[0233] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing terminal device to operate in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.
[0234] These computer program instructions can also be loaded onto a computer or other programmable data processing terminal equipment, causing a series of operational steps to be performed on the computer or other programmable terminal equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable terminal equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.
[0235] Although preferred embodiments of the embodiments of this application have been described, those skilled in the art, once they understand the basic inventive concept, can make other changes and modifications to these embodiments. Therefore, this application is to be interpreted as including the preferred embodiments as well as all changes and modifications falling within the scope of the embodiments of this application.
[0236] Finally, it should be noted that in this document, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or terminal device that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or terminal device. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or terminal device that includes said element.
[0237] The life meaning detection method and device provided in this application have been described in detail above. Specific examples have been used to illustrate the principle and implementation of this application. The description of the above embodiments is only for the purpose of helping to understand the method and core idea of this application. At the same time, for those skilled in the art, there will be changes in the specific implementation and application scope based on the idea of this application. Therefore, the content of this specification should not be construed as a limitation of this application.
Claims
1. A method of detecting a sense of meaning in life, characterized by, The method comprises the following steps: constructing a knowledge graph based on multiple scientific literatures; the knowledge graph comprises multiple triples related to life meaning; each triple comprises two entities and a corresponding relationship; wherein, constructing the knowledge graph based on multiple scientific literatures comprises: retrieving multiple scientific literatures related to life meaning according to a preset first keyword; performing triple extraction on all scientific literatures to obtain initial triples; cross-screening all initial triples; removing duplicates from the cross-screened initial triples to obtain multiple triples related to life meaning; detecting, by at least two different large language models, whether there is an implied relationship between two entities in the knowledge graph with any distance less than a distance threshold and without a relationship; obtaining multiple entity pairs with implied relationships based on the detection results of each large language model; generating supplementary triples based on each entity pair and the corresponding implied relationship; adding the supplementary triples to the knowledge graph; constructing an entity set and a relationship set based on all triples related to life meaning to form a knowledge graph; obtaining text data for training; using the knowledge graph as background knowledge of a large language model to generate a knowledge description text corresponding to the text data by the large language model; the knowledge description text contains deep semantic information reflecting the life meaning of the text data; generating a synthetic text based on the text data and the knowledge description text, and converting the synthetic text into a corresponding fusion vector; training a life meaning detection model based on the fusion vector; the life meaning detection model is constructed based on a long short-term memory network; detecting the fusion vector generated based on social text by the trained life meaning detection model.
2. The method of claim 1, wherein Cross-screening all initial triples comprises: removing triples containing entities with psychological professional terms, abstract entities, and entities lacking objects; removing triples containing specific object groups; retaining triples containing entities with the second keyword and triples containing entities related to life meaning without the second keyword.
3. The method of claim 1, wherein After constructing the entity set and the relationship set based on all triples related to life meaning to form the knowledge graph, the method further comprises: grabbing popular keywords with a frequency greater than a frequency threshold from a social platform as new entities according to a grabbing period; traversing all entities stored in the knowledge graph to obtain entities associated with the new entities; generating new triples based on the new entities and the entities associated with the new entities in the knowledge graph; adding the new triples to the knowledge graph.
4. The method of claim 1, wherein, Using the knowledge graph as background knowledge of a large language model to generate a knowledge description text corresponding to the text data by the large language model comprises: dividing the text data into multiple text blocks in units of users; input each text block and the knowledge graph into the large language model, and acquire, by the large language model, entities and relationships matched with the text block from the knowledge graph; wherein the relationships include relationships between entities and relationships between entities and life meaning; process, by the large language model, the matched entities and relationships of the text block, and generate text reflecting the life meaning of the text block as the knowledge description text corresponding to the text block.
5. The method of claim 4, wherein acquiring, by the large language model, the entities and relationships matched with the text block from the knowledge graph includes: traversing, by the large language model, the knowledge graph, judging whether each entity in the knowledge graph exists in the text block, and whether each entity in the knowledge graph is semantically similar to the entity in the text block; taking the entity existing in the text block and the entity semantically similar to the entity in the text block as candidate entities; judging, by the large language model, the relationships between each candidate entity and the relationships between each candidate entity and life meaning, and generating corresponding triadic relationship groups.
6. A sense of meaning in life detection device, characterized by, The method comprises: a construction module configured to construct a knowledge graph based on a plurality of scientific literatures; the knowledge graph comprises a plurality of triadic groups related to life meaning; wherein each triadic group comprises two entities and corresponding relationships; an acquisition module configured to acquire text data for training; a fusion module configured to take the knowledge graph as background knowledge of a large language model, and generate, by the large language model, knowledge description text corresponding to the text data; the knowledge description text comprises reinforced semantic information reflecting the life meaning of the text data; generate a synthetic text based on the text data and the knowledge description text, and convert the synthetic text into a corresponding fusion vector; a training module configured to train a life meaning detection model based on the fusion vector; the life meaning detection model is constructed based on a long short-term memory network; a detection module configured to detect the fusion vector generated based on social text by the trained life meaning detection model.
7. A computer-readable storage medium having stored thereon a computer program, characterized in that, The computer program is executed by the processor to implement the steps in the method of any one of claims 1-5.
8. An electronic device comprising a memory, a processor, and a computer program stored on the memory and executable on the processor, characterized in that, The processor executes the computer program to implement the steps in the method of any one of claims 1-5.
Citation Information
Patent Citations
Knowledge graph construction method and device based on large language model, equipment and storage medium
CN120087461A
Knowledge graph-combined brilliance large-scale model culture knowledge generation and retrieval method
CN120256644A