Knowledge graph construction method and device and storage medium
Through the integration and extraction of texts in the target field by the large language model, the knowledge graph is constructed, which solves the problems of semantic overlap and conflicts of multiple texts in the existing technology, and improves the efficiency and accuracy of the construction of knowledge graphs.
Patent Information
- Application Number
- CN202411058637.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-02
- Publication Date
- 2024-12-31
AI Technical Summary
It is difficult for the prior art to effectively build a knowledge graph, especially when dealing with multiple target texts, which affects the efficiency and accuracy of the construction of knowledge graphs.
A large language model is used to fuse multiple texts related to the target field, generate fusion text, and obtain accurate text extraction results through text extraction, build a knowledge graph based on these results, and optimize text integration and retelling rules using preset entity attribute pairs and retelling rules. Extraction process.
The efficiency and accuracy of knowledge graph construction are improved, and the data quality and construction efficiency of knowledge graphs are improved through text fusion and extraction, and the problems of semantic overlap and conflict are solved.
Smart Images

Figure CN119227729A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of artificial intelligence processing, and in particular to a knowledge graph construction method, device and storage medium. Background Art
[0002] Knowledge Graph is a semantic network used to describe the relationships between entities. It represents concepts, entities and their relationships in the real world in a structured form.
[0003] With the development of artificial intelligence technology, it has shown its application precedents in the field of knowledge graph construction. How to use artificial intelligence technology to realize the construction of knowledge graph has become a problem that needs to be solved. Summary of the invention
[0004] This application at least provides a knowledge graph construction method, device and storage medium.
[0005] The present application provides a method for constructing a knowledge graph, including: obtaining multiple target texts related to a target field; using a large language model to fuse the multiple target texts to obtain at least one fused text; performing text extraction on each fused text to obtain text extraction results corresponding to each fused text; and constructing a knowledge graph of the target field based on the text extraction results.
[0006] The present application provides an electronic device, including a memory and a processor, wherein the processor is used to execute program instructions stored in the memory to implement any of the above-mentioned knowledge graph construction methods.
[0007] The present application provides a computer-readable storage medium having program instructions stored thereon, which implement any of the above-mentioned knowledge graph construction methods when executed by a processor.
[0008] In the above scheme, a large language model is used to fuse texts related to the target field to obtain fused text, and text extraction is performed on the fused text. A knowledge graph is constructed based on the extraction results, thereby realizing the construction of a knowledge graph using a large language model.
[0009] It is to be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present application. BRIEF DESCRIPTION OF THE DRAWINGS
[0010] The drawings herein are incorporated into the specification and constitute a part of the specification. These drawings illustrate embodiments consistent with the present application and are used together with the specification to illustrate the technical solution of the present application.
[0011] Figure 1 This is a flow chart of an embodiment of the knowledge graph construction method of the present application;
[0012] Figure 2 It is a schematic diagram of an embodiment of the main body scope of the present application;
[0013] Figure 3 It is a flowchart of another embodiment of the knowledge graph construction method of the present application;
[0014] Figure 4 It is a schematic diagram of an embodiment of the pre-processing step 1 of the present application;
[0015] Figure 5 It is a schematic diagram of an embodiment of the fusion step 1 of the present application;
[0016] Figure 6 It is a schematic diagram of an embodiment of step 1 of text extraction of the present application;
[0017] Figure 7 It is a schematic diagram of the framework of an embodiment of the electronic device of the present application;
[0018] Figure 8 It is a schematic diagram of a framework of an embodiment of a computer-readable storage medium of the present application. DETAILED DESCRIPTION
[0019] The scheme of the embodiment of the present application is described in detail below in conjunction with the drawings of the specification.
[0020] In the following description, for the purpose of explanation rather than limitation, specific details such as specific subsystem structures, interfaces, and technologies are provided to facilitate a thorough understanding of the present application.
[0021] The term "and / or" in this article is only a description of the association relationship of associated objects, indicating that there may be three relationships. For example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone. In addition, the character " / " in this article generally indicates that the objects associated before and after are in an "or" relationship. In addition, "many" in this article means two or more than two. In addition, the term "at least one" in this article means any combination of at least two of any one or more of a plurality of, for example, including at least one of A, B, and C, can mean including any one or more elements selected from the set consisting of A, B, and C.
[0022] See also Figure 1 , Figure 1 This is a flow chart of an embodiment of the knowledge graph construction method of the present application. Specifically, the method may include:
[0023] Step S110: Acquire multiple target texts related to the target field.
[0024] It is understandable that the knowledge graph construction method in this application can be used to construct a knowledge graph corresponding to a target field. The target field can be set according to user needs. For example, the target field can be the agricultural field.
[0025] The multiple target texts related to the target field may be obtained from one or more data sources of the target field.
[0026] Step S120: using a large language model to fuse multiple target texts to obtain at least one fused text.
[0027] It is understandable that there may be semantic overlaps and conflicts in multiple target texts. Using a large language model, multiple target texts can be fused to obtain at least one fused text to accurately represent information related to the target field.
[0028] Among them, multiple target texts can be used as inputs of the large language model, and prompt information instructing the large language model to fuse can also be input together, and the large language model is used to process the multiple target texts. Further, fusing the multiple target texts using the large language model can include two steps: extracting at least one associated text related to several preset entity attribute pairs from the multiple target texts, and generating fused texts based on the associated texts corresponding to each entity.
[0029] Through the above steps, the text of interest can be extracted from multiple target texts, and the extracted texts can be fused to achieve the integration of information in multiple target texts for subsequent text extraction, thereby improving the accuracy of text data used for text extraction and improving the efficiency of knowledge graph construction.
[0030] Of course, the specific processing steps of the large model may also be indicated according to actual application needs, and may not be limited to the above examples.
[0031] It should be noted that the entities in different preset entity attribute pairs can be the same. For example, both "Sheath blight-symptoms" and "Sheath blight-control methods" contain the entity "Sheath blight". When generating fused text, fusion can be performed from the entity dimension, and fused text about the entity can be generated based on associated texts related to the same entity to obtain text that can accurately represent information related to the entity.
[0032] In a specific application scenario, the preset entity attribute pairs include sheath blight-symptoms, sheath blight-prevention and control methods, head blight-symptoms, head blight-prevention and control methods, and the associated texts are extracted for the above four preset entity attribute pairs respectively. The associated text related to sheath blight is used to generate the fused text, and the associated text related to head blight is used to generate the fused text.
[0033] In some cases, the associated texts corresponding to each entity attribute pair may be fused separately to obtain the fusion results corresponding to each entity attribute pair, and then the fusion results corresponding to the same entity may be fused to obtain the fusion texts corresponding to each entity.
[0034] Step S130: performing text extraction on each fused text respectively to obtain text extraction results corresponding to each fused text.
[0035] Among them, the text extraction step can be achieved by using a large language model.
[0036] In some embodiments, the first prompt information and the fused text are used as inputs of the large language model, and the large language model is used to perform text extraction on the fused text to obtain a text extraction result. The first prompt information is used to instruct the large semantic model to extract multiple preset data items from the fused text.
[0037] In a specific application scenario, the first prompt information may be: Prompt = (
[0038] "Data Source: [Input Agricultural Text Data]\n"
[0039] "Given a text describing the growth of crops, please extract and summarize the following information:\n"
[0040] "It is necessary to sort out information such as variety name, crop type, winter and spring nature, variety source, variety introduction, agronomic traits, resistance description, quality characteristics, suitable planting areas, yield performance, and cultivation techniques.\n"
[0041] “Ensure that output is clear, accurate, and presented in an easy-to-read list” )
[0043] Step S140: Construct a knowledge graph of the target domain based on the text extraction results.
[0044] It can be understood that the text extracted from the fused text can be used to construct triples to form a knowledge graph.
[0045] Among them, triples can include two types. The first type is a triple consisting of a head entity, a relationship, and a tail entity. The second type is a triple consisting of an entity, an attribute, and an attribute value.
[0046] In the above scheme, a large language model is used to fuse texts related to the target field to obtain fused text, and text extraction is performed on the fused text. A knowledge graph is constructed based on the extraction results, thereby realizing the construction of a knowledge graph assisted by a large language model.
[0047] Furthermore, before extraction, the text is fused and organized to improve the accuracy and standardization of the text used for extraction, improve the accuracy of extraction, and improve the effect of knowledge graph construction.
[0048] In some embodiments, the input to the large language model also includes priority rules, which are used to instruct the large language model to extract from multiple target texts in sequence according to the text order corresponding to the attributes, to obtain at least one associated text related to the preset entity attribute pair, and there is no semantic repetition or conflict between the associated texts.
[0049] In one implementation scenario, multiple target texts may come from multiple different data sources, and different data sources may contain different content qualities. The order of authority may be determined for different data sources, and in the process of extracting related texts, texts with higher authority may be referred to first. Specifically, the target texts may be sorted from high to low according to the authority of the source, and the target texts may be extracted in order.
[0050] Furthermore, the corresponding text order can be determined for each attribute. For example, for attribute A, database A is the most authoritative, and for attribute B, database B is the most authoritative.
[0051] In a specific application scenario, for the attribute of symptoms, multiple data sources are sorted in descending order of authority: A database, B database, C book, and multiple target texts are sorted in descending order of authority of the source.
[0052] In one implementation scenario, in the process of extracting the associated texts with the preset entity attribute pair, the texts are extracted from multiple target texts in sequence according to the text order corresponding to the attributes, and there is no semantic duplication or conflict between the extracted associated texts. Therefore, the target text that is sorted first is more authoritative, and after the associated text is extracted from it, if there is text in the subsequent target text that has semantic duplication with the extracted associated text, it does not need to be extracted, and if there is text that has semantic conflict with the extracted associated text, it is not extracted either, and the target text with higher authority shall prevail.
[0053] In a specific application scenario, the authority of the data source can be evaluated from four aspects: content timeliness, logic, comprehensiveness, and completeness.
[0054] In some embodiments, before extracting the related text, the method may further include: collecting question texts related to the target field, performing word segmentation statistics on the question texts, and obtaining statistical results. Based on the statistical results, at least one pair is selected from the entity attribute pair library as a preset entity attribute pair.
[0055] In a specific application scenario, agricultural questions can be collected from relevant question-and-answer websites or applications (such as the China Agricultural Machinery Information Promotion Platform, Qiangnong APP, etc.). During the collection process, the scope of collection can also be adjusted according to actual application needs, for example, for specific crop types, for specific regions, etc. The results of word segmentation statistics can include the words in the target field that appear in the question text and the corresponding word frequency. According to the word segmentation statistics results, the preset entity attribute pairs related to the high-frequency words are selected from the entity attribute pair library.
[0056] In some embodiments, the input of the large language model also includes an entity alias library, which includes multiple names corresponding to the entity, including a preset entity name and several aliases. The entity alias library can be used to instruct the large language model to replace the corresponding alias with the preset entity name.
[0057] In a specific application scenario, the entity is corn, and its aliases are corn, maize, and corn. Corn can be used to replace corn, maize, and corn in the text. In some cases, corn can also be used as a preset entity name, and other names can be used as aliases, and corn can be used to replace other names.
[0058] In some embodiments, the input of the large language model also includes a paraphrase rule, which may include a logic rule about the fused text, and the paraphrase rule is used to instruct the large language model to generate the fused text according to the preset logic corresponding to each attribute. It is understandable that in order to obtain a clearer fused text about each attribute of the entity, the corresponding logic can be determined in advance for each attribute to instruct the large language model to generate the fused text according to the preset logic corresponding to the attribute.
[0059] In a specific application scenario, the repetition rule corresponding to the attribute of symptoms may include: describing the symptoms of the disease in sequence according to the onset period or the onset site.
[0060] In some embodiments, the paraphrase rule may also include a format rule for the fused text, which is used to instruct the large language model to generate the fused text according to a specified format. The format rule may be applicable to the fused text corresponding to each attribute, or different format rules may be determined for each attribute.
[0061] In a specific application scenario, the restatement rules include: separating each rule with a semicolon.
[0062] In a specific application scenario, the repetition rules corresponding to the attribute of symptoms may include: Please select the following templates and output according to one of the template formats: Template 1: *** disease mainly harms *** (part). Symptoms of different harm parts are as follows: 1. Description of diseased part 1. 2. Description of diseased part 2. 3. Description of diseased part 3. Template 2: *** disease mainly harms *** (part). Symptoms of different harm periods are as follows: 1. Period 1. 2. Period 2. 3. Period 3.
[0063] In some embodiments, before obtaining multiple target texts related to the target domain, an ontology of the target domain may be constructed in advance to determine the scope of the ontology and define entities, attributes, relationships, etc.
[0064] See also Figure 2 , Figure 2 It is a schematic diagram of an embodiment of the main body of the present application.
[0065] It should be noted that the scope of the target field is relatively broad. When the knowledge of the target field can be divided into multiple parts according to a certain standard, the original text can be collected and subsequently processed for one part or multiple parts respectively.
[0066] In this embodiment, the target field is the agricultural field. Agricultural knowledge can be divided around crop types, so the original texts can be collected and subsequently processed for different crop types. For example, the original texts are collected and subsequently processed for wheat and corn respectively.
[0067] Furthermore, the scenes can be divided into multiple scenes. At least part of all scenes can be selected as the scenes of interest, and the original texts can be collected for the scenes of interest.
[0068] like Figure 2 As shown, the crops that need to be paid attention to and the target scenarios that need to be paid attention to can be determined in advance, and several preset scenarios in the target field include crop varieties, regions, environmental factors, agricultural technologies, diseases, pests, weeds, common sense and concepts.
[0069] In some embodiments, the method may further include: collecting question texts related to the target field, performing word segmentation statistics on the question texts, and obtaining statistical results. The statistical results may include the words that appear in each scenario in the question text and the corresponding frequency of occurrence. Agricultural experts may refer to this statistical result to determine the scope of the agricultural ontology. Exemplarily, agricultural experts may first determine the scope of the agricultural ontology, and then adjust the scope of the agricultural ontology with reference to the statistical results, such as deleting scenes that are less concerned, or refining scenes that are more concerned.
[0070] In a specific application scenario, word segmentation statistics are mainly performed on words in the target field. If the statistical results show that the frequency of words related to fertilization is very high, this scenario can be further refined into fertilization amount, fertilization time, fertilization method, and fertilization fertilizer type.
[0071] It should be noted that the above statistical results can also be used to determine the preset entity attribute pairs in various scenarios.
[0072] In addition, during the ontology construction phase, entities, relationships, etc. can also be defined.
[0073] In this embodiment, the entity types defined are as follows:
[0074]
[0075] The relationship categories defined in this embodiment are as follows:
[0076]
[0077] See also Figure 3 , Figure 3 It is a flow chart of another embodiment of the knowledge graph construction method of the present application.
[0078] Specifically, the method may include:
[0079] Step S310: Acquire multiple original texts related to the target field.
[0080] The multiple original texts may be collected from several data sources related to the target domain.
[0081] In a specific application scenario, the crop types that need to be paid attention to can be determined in advance, and for each crop type, relevant texts of all preset scenarios are collected.
[0082] In some embodiments, after collecting a plurality of original texts in the target field, the original texts may be preprocessed to improve the text quality.
[0083] Furthermore, the large language model can be used to implement preprocessing. Specifically, the second prompt information and the original text can be used as inputs of the large language model, and the large language model can be used to preprocess the original text. The second prompt information is used to indicate specific steps of the preprocessing. Exemplarily, the second prompt information can be used to indicate that the preprocessing includes at least one of the following: deleting parts that are not related to the target field, correcting typos, correcting grammatical errors, and standardizing text.
[0084] In a specific application scenario, the second prompt information includes: Use the following rules to clean the agricultural data in the data source: Delete all non-agricultural related content, such as advertisements, irrelevant comments, and garbled fields. Correct all typos and grammatical errors. Standardize agricultural professional terms. Convert units such as m in the text into Chinese characters.
[0085] In a specific application scenario, the second prompt information is: Prompt = (
[0086] "Data Source: [Input Agricultural Text Data]\n"
[0087] "Task: Use the following rules to clean the agricultural data in the data source.\n"
[0088] "Rule:\n"
[0089] "Remove all non-agricultural related content such as ads, irrelevant comments, and gibberish fields.\n"
[0090] "Correct all typos and grammatical errors and standardize agricultural terminology.\n"
[0091] "Convert units such as m2 in the text into Chinese characters.\n"
[0092] "Output: Cleaned text. / n" )
[0094] See also Figure 4 , Figure 4 It is a schematic diagram of an embodiment of the preprocessing step 1 of the present application. Figure 4 The effect of preprocessing the original text is shown in FIG. The preprocessed original text can enter the step corresponding to the preset scenario.
[0095] Step S320: using the large language model to match the original text with one or more of several preset scenarios in the target domain, and obtaining multiple original texts corresponding to each preset scenario.
[0096] It is understandable that the scope of the target domain is relatively broad and can be subdivided into many scenarios, including the preset domains that are focused on when building the knowledge graph. After collecting the original text, the preset scenarios corresponding to the original text can be determined.
[0097] The multiple original texts corresponding to each preset scenario can be taken as multiple target texts related to the target field, and the texts under each preset scenario can be subsequently processed separately. Specifically, a sub-graph can be constructed using the texts under the preset field, and the sub-graphs corresponding to multiple preset fields together constitute the knowledge graph of the target field.
[0098] In some cases, if the original text does not correspond to the preset scenario, the original text may not be involved in the subsequent processing process.
[0099] In a specific application scenario, several preset scenarios within the target field include at least one of crop varieties, cultivation techniques, pest and disease control, environmental factors, common sense concepts, pesticides and fertilizers, agricultural machinery and facilities, and agricultural rules.
[0100] In a specific application scenario, the following prompt information and the original text can be input into the large language model to determine the corresponding relationship between the text and the scenario: Prompt = (
[0101] "Data Source: [Input Agricultural Text Data]\n"
[0102] "Task: Classify text according to the following classification criteria.\n"
[0103] "Classification standards: crop varieties, cultivation techniques, pest and disease control, environmental factors, common sense concepts, pesticides and fertilizers, agricultural machinery and facilities, and agricultural rules.\n"
[0104] "Output: The category to which the text belongs. / n" )
[0106] Step S330: using a large language model to fuse multiple target texts to obtain at least one fused text.
[0107] See also Figure 5 , Figure 5 It is a schematic diagram of an embodiment of the fusion step 1 of the present application. Figure 5 The figure shows the partial fusion text corresponding to the wheat crop type and the sheath blight symptoms in the disease scenario.
[0108] Step S340: performing text extraction on each fused text respectively to obtain text extraction results corresponding to each fused text.
[0109] In some embodiments, the first prompt information and the fused text are used as inputs of the large language model, and the large language model is used to perform text extraction on the fused text. The first prompt information is used to instruct the large language model to extract multiple preset data items from the fused text.
[0110] Among them, the target domain includes several preset scenarios, and the knowledge involved in the preset scenarios is quite different. However, the knowledge similarity within the preset scenarios is relatively high. The preset data items to be extracted can be determined in advance for each preset scenario, including entities, attribute values, etc. that will appear in the preset scenario.
[0111] In a specific application scenario, the preset data items corresponding to each preset scenario are as follows: Crop varieties: variety name, crop type, winter and spring nature, variety source, variety introduction, agronomic traits, resistance description, quality characteristics, suitable planting areas, yield performance, cultivation technology, etc. Cultivation technology: technology name, research and development unit, technology description, suitable area, etc. Disease, insect, and weed control: diseases correspond to disease name, pathogen, pathogen introduction, prevention and control methods, transmission route, cause of disease, harmful crops, harmful parts, disease period, distribution area, etc.; insect pests need to sort out information such as insect pest name, distribution area, prevention and control methods, living habits, and harmful crops; weed pests correspond to weed pest name, distribution area, prevention and control methods, identification points, etc. Environmental factors: extreme environment type, rating standard, disaster name, harmful crops, preventive measures, remedial measures, etc. Common sense concepts: professional terms, term definitions, proper nouns, noun definitions, growth laws, law descriptions, etc. Pesticides and fertilizers: Pesticides correspond to pesticide names, pesticide aliases, chemical names, toxicity, action characteristics, application methods, physical and chemical properties, precautions, applicable scope, pesticide types (fungicides, insecticides, herbicides, growth regulators, antidotes, mixed agents), dosage forms, etc. Fertilizers correspond to fertilizer names, fertilizer types, fertilizer ingredients, applicable scope, application methods, fertilizer uses, storage methods, precautions, etc. Agricultural machinery and facilities: Agricultural machinery names, product parameters, applicable crops, manufacturers, applicable scope, product characteristics, product introduction, etc. Agricultural rules: Rule name, release time, rule content, release unit, etc.
[0112] See also Figure 6 , Figure 6 It is a schematic diagram of an embodiment of the text extraction step 1 of the present application. Figure 6 The figure shows the text extraction results corresponding to the entity "Dwarf Resistant 58" in the wheat crop type and crop variety scenario.
[0113] Step S350: Build a knowledge graph of the target domain based on the text extraction results.
[0114] The text extraction result includes extracted texts corresponding to multiple preset data items.
[0115] It should be noted that a fused text is a fusion of information related to an entity, and extracted texts extracted from the same fused text can be used to form a triple. For example, multiple extracted texts extracted from the fused text about scab can be used to combine into a triple.
[0116] In one implementation scenario, several triple definitions are predetermined, and each triple definition includes the target data item included in the triple. For example, a triple definition includes variety, breeder, and name. The head entity is variety, the relationship is breeder, and the tail entity is name. A triple definition includes disease, control agent, and agent name. From the extracted text extracted from the same fused text, select the text corresponding to the target data item included in a triple definition to form a triple.
[0117] In some embodiments, after the knowledge graph is constructed, the knowledge graph may be evaluated. Furthermore, the evaluation of the knowledge graph may be completed by both manual evaluation and large model evaluation.
[0118] In some embodiments, a large language model can be used to score the triples contained in the constructed knowledge graph. In response to the existence of a target triple with a score less than a preset threshold, the large language model is used to fuse multiple target texts and subsequent steps to redetermine the target triple.
[0119] In some embodiments, for at least some triples, the scores of manual evaluation and the scores of large language model evaluation can be combined to obtain a final score, and whether the score is less than a preset threshold can be determined based on the final score.
[0120] In a specific application scenario, triples and corresponding manually evaluated scores can be used as samples and input into a large language model to instruct the large language model to learn to score triples, so that the large language model can score triples.
[0121] In a specific application scenario, if there is a target triplet with a low score, the step of preprocessing the original text can be re-executed for the scenario involved in the target triplet to update the target text, and the step of text fusion and the step of text extraction can be re-executed for the target text related to the target triplet. The target triplet is a head entity, a relationship, a tail entity or an entity, an attribute, and an attribute value, and the third element is re-determined for the first two elements of the target triplet based on the re-extracted text extraction result.
[0122] In a specific application scenario, the scoring range is 0-10 points, and the final score is calculated as the average of the expert score and the model score. The quality threshold score is 6 points. If the final score is greater than 6 points, the quality is qualified and output is allowed. If the score is less than 6 points, the triple is re-determined.
[0123] See also Figure 7 , Figure 7 It is a schematic diagram of the framework of an embodiment of the electronic device of the present application.
[0124] In this embodiment, the electronic device 70 includes a memory 71 and a processor 72, and the processor 72 is used to execute program instructions stored in the memory 71 to implement any of the above-mentioned knowledge graph construction methods. In a specific implementation scenario, the electronic device 70 may include but is not limited to: computer equipment, electrical equipment, microcomputers, desktop computers, servers, and in addition, the electronic device 70 may also include mobile devices such as laptops and tablet computers, which are not limited here.
[0125] Specifically, the processor 72 is used to control itself and the memory 71 to implement any of the above-mentioned knowledge graph construction methods. The processor 72 can also be called a CPU (Central Processing Unit). The processor 72 may be an integrated circuit chip with signal processing capabilities. The processor 72 can also be a general-purpose processor, a digital signal processor (Digital Signal Processor, DSP), an application-specific integrated circuit (Application Specific Integrated Circuit, ASIC), a field-programmable gate array (Field-Programmable Gate Array, FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components. The general-purpose processor can be a microprocessor or the processor can also be any conventional processor, etc. In addition, the processor 72 can be implemented by an integrated circuit chip.
[0126] See also Figure 8 , Figure 8 It is a schematic diagram of a framework of an embodiment of a computer-readable storage medium of the present application.
[0127] The computer-readable storage medium 80 provided in this embodiment stores program instructions 81 that can be run by a processor. When the program instructions 81 are executed by the processor, they are used to implement any of the above-mentioned knowledge graph construction methods.
[0128] The above description of various embodiments tends to emphasize the differences between the various embodiments. The same or similar aspects can be referenced to each other, and for the sake of brevity, they will not be repeated herein.
[0129] In the several embodiments provided in the present application, it should be understood that the disclosed methods and devices can be implemented in other ways. For example, the device implementation described above is only schematic. For example, the division of modules or units is only a logical function division. There may be other division methods in actual implementation, such as units or components can be combined or integrated into another subsystem, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, and the indirect coupling or communication connection of devices or units can be electrical, mechanical or other forms.
[0130] In addition, each functional unit in each embodiment of the present application can be integrated into a processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The above-mentioned integrated unit can be implemented in the form of hardware or in the form of a software functional unit. If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including several instructions to enable a computer device (which can be a personal computer, a server, or a network device, etc.) or a processor (processor) to perform all or part of the steps of each implementation method of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk and other media that can store program code.
Claims
1. A knowledge graph construction method, characterized in that: The method comprises: Obtain multiple target texts related to the target field; Using a large language model to fuse the multiple target texts to obtain at least one fused text; Performing text extraction on each of the fused texts respectively to obtain text extraction results corresponding to each of the fused texts; Construct a knowledge graph of the target domain based on the text extraction results.
2. The method according to claim 1, characterized in that The using of the large language model to fuse the multiple target texts to obtain at least one fused text comprises: The plurality of target texts are used as inputs of the large language model, and at least one associated text related to a plurality of preset entity attribute pairs is extracted from the plurality of target texts using the large language model; and the fused text is generated based on the associated texts corresponding to each of the entities.
3. The method according to claim 2, characterized in that The input of the large language model further includes a priority rule, wherein the priority rule is used to instruct the large language model to extract from the multiple target texts in sequence according to the text order corresponding to the attributes to obtain the at least one associated text related to the preset entity attribute pair, and there is no semantic repetition or conflict between the associated texts; and / or, The input of the large language model further includes an entity alias library, the entity alias library includes multiple names corresponding to entities, the multiple names include preset entity names and several aliases, and the entity alias library is used to instruct the large language model to replace the corresponding alias with the preset entity name; and / or, The input of the large language model also includes a paraphrase rule, and the paraphrase rule is used to instruct the large language model to generate the fused text according to the preset logic corresponding to each of the attributes.
4. The method according to claim 2, characterized in that: Before extracting at least one associated text related to a plurality of preset entity attribute pairs from the plurality of target texts respectively using the large language model, the method further comprises: Collect question texts related to the target area; Perform word segmentation statistics on the question text to obtain statistical results; At least one pair is selected from an entity attribute pair library based on the statistical result as the preset entity attribute pair.
5. The method according to claim 1, characterized in that The performing text extraction on each of the fused texts to obtain text extraction results corresponding to each of the fused texts comprises: The first prompt information and the fused text are used as inputs of the large language model, and the large language model is used to perform text extraction on the fused text to obtain the text extraction result; wherein the first prompt information is used to instruct the large language model to extract multiple preset data items from the fused text.
6. The method according to claim 1, characterized in that The obtaining of multiple target texts related to the target field includes: Acquire a plurality of original texts related to the target field; The large language model is used to match the original text with one or more of several preset scenarios in the target domain, so as to obtain multiple original texts corresponding to each preset scenario, and the multiple original texts corresponding to each preset scenario are used as the multiple target texts related to the target domain.
7. The method according to claim 6, characterized in that The target field is agriculture, and the preset scenarios in the target field include at least one of crop varieties, cultivation techniques, pest and disease control, environmental factors, common sense concepts, pesticides and fertilizers, agricultural machinery and facilities, and agricultural rules; and / or, After acquiring a plurality of original texts related to the target field, the method further includes: The second prompt information and the original text are used as inputs of the large language model, and the original text is preprocessed using the large language model; wherein the second prompt information is used to indicate that the preprocessing includes at least one of the following: deleting parts that are not relevant to the target field, correcting typos, correcting grammatical errors, and standardizing text.
8. The method according to claim 1, characterized in that The text extraction result includes extracted texts corresponding to a plurality of preset data items; and constructing the knowledge graph of the target domain based on the text extraction result includes: Based on the target data item included in the triple definition, the extracted text corresponding to the target data item is selected from the text extraction result corresponding to the fused text to form a triple.
9. The method according to claim 1, characterized in that: The method further comprises: Using the large language model to score the triples contained in the constructed knowledge graph; In response to the existence of a target triple whose score is less than a preset threshold, the step of fusing the plurality of target texts using the large language model and subsequent steps are re-executed to redetermine the target triple.
10. An electronic device, characterized in that: The method comprises a memory and a processor, wherein the memory stores program instructions, and when the program instructions are executed by the processor, the method according to any one of claims 1 to 9 is implemented.
11. A computer-readable storage medium having program instructions stored thereon, characterized in that: When the program instructions are executed by a processor, the method according to any one of claims 1 to 9 is implemented.
