Knowledge graph construction method and device and computer equipment
By converting list file data into target text in columns or rows, and using a large language model to summarize categories and relationships, the problem of high computational resource consumption in existing technologies is solved, and the effect of efficiently constructing knowledge graphs is achieved.
Patent Information
- Application Number
- CN202511592911.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-10-31
- Publication Date
- 2026-02-03
AI Technical Summary
Existing technologies consume significant computational resources when constructing knowledge graphs, especially when processing list files, leading to inefficiency.
By converting the data in the list file into target text in columns or rows, and using a large language model to summarize categories and relationships, a knowledge graph is generated.
It significantly reduces the consumption of computing resources, improves processing efficiency, and enables efficient construction of knowledge graphs.
Smart Images

Figure CN121457584A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the field of displaying large models, and in particular to a knowledge graph construction method and device and computer equipment. BACKGROUND
[0002] In a company or other organization, a large number of list files are generated in daily office work. If a vertical domain, private domain or professional knowledge base needs to be established, there is a strong demand to extract information from the list files and put it into the knowledge base. The list files usually contain a large amount of data information, which has a very high statistical value.
[0003] In the prior art, the position information and relationship in the list file are replaced by spaces and carriage returns to obtain a plane text, and then the plane text is divided into several paragraphs using a text blocking technology, and then a large model is used to extract knowledge from each paragraph, and a knowledge graph is formed according to the extracted knowledge entities and knowledge relationships. This way consumes a lot of computing resources. SUMMARY
[0004] The present application provides a knowledge graph construction method, device and computer equipment to solve the problem of large consumption of computing resources.
[0005] In a first aspect, a knowledge graph construction method is provided, comprising:
[0006] Obtaining a list file to be processed, each column of data in the list file to be processed belonging to the same category;
[0007] Converting the data contained in the list file to be processed into a target text described in column units;
[0008] Inputting the target text and a first prompt word into the large language model, the first prompt word being used to instruct the large language model to perform category summarization on the target text taking columns as objects, to obtain a category summarization result output by the large language model;
[0009] Inputting the category summarization result and a second prompt word into the large language model, the second prompt word being used to instruct the large language model to perform relationship summarization on any two categories contained in the category summarization result, to obtain a category relationship summarization result output by the large language model;
[0010] Generating a knowledge graph corresponding to the list file to be processed based on the data contained in the list file to be processed and the category relationship summarization result.
[0011] In some embodiments, the conversion of the data contained in the list file to be processed into a target text described in column units comprises:
[0012] determining, according to the input word limit of the large language model, the word number of the first prompt word, and the word number of a line of data in the to-be-processed list file, a data line number of data in the to-be-processed list file to be input to the large language model;
[0013] sampling the to-be-processed list file in a line unit based on the data line number to obtain sampling data; and converting the sampling data into target text described in a column unit.
[0014] In some embodiments, the first prompt word is used to instruct the large language model to, for any column in the target text, if the first data contained in the column is a table header, take the table header as the category of the column; and if the first data contained in the column is not a table header, summarize all data contained in the column to obtain the category of the column.
[0015] In some embodiments, generating the knowledge graph corresponding to the to-be-processed list file based on the data contained in the to-be-processed list file and the category relationship summary result comprises:
[0016] traversing each data contained in the to-be-processed list file;
[0017] for the target data currently traversed, obtaining any data other than the target data in the to-be-processed list file and determining the column in which the any data is located; obtaining, from the category summary result, the first category corresponding to the column in which the target data is located and the second category corresponding to the column in which the any data is located; and obtaining, from the category relationship summary result, the target category relationship between the first category and the second category;
[0018] obtaining a set of knowledge of the target data based on the target data, the any data, and the target category relationship;
[0019] obtaining the knowledge graph corresponding to the to-be-processed list file after the traversal is completed.
[0020] In a second aspect, a knowledge graph construction method is provided, comprising:
[0021] obtaining a to-be-processed list file, each line of data in the to-be-processed list file belonging to the same category;
[0022] converting data contained in the to-be-processed list file into target text described in a line unit;
[0023] inputting the target text and a first prompt word to the large language model, the first prompt word being used to instruct the large language model to perform category summarization on the target text in a line object to obtain a category summary result output by the large language model.
[0024] input the category summary result and a second prompt word into the large language model, the second prompt word being used to instruct the large language model to perform relationship summarization on any two categories contained in the category summary result, to obtain a category relationship summary result output by the large language model;
[0025] generate a knowledge graph corresponding to the to-be-processed list file based on the data contained in the to-be-processed list file and the category relationship summary result.
[0026] In some embodiments, the first prompt word is used to instruct the large language model to, for any row in the target text, if a first data contained in the row is a table header, take the table header as the category of the column, and if the first data contained in the row is not a table header, summarize all data contained in the row to obtain the category of the row.
[0027] In a third aspect, the present application further provides a knowledge graph construction device, comprising:
[0028] an acquisition module configured to acquire a to-be-processed list file, each column of data in the to-be-processed list file belonging to the same category;
[0029] a conversion module configured to convert data contained in the to-be-processed list file into a target text described in column units;
[0030] a first reasoning module configured to input the target text and a first prompt word into the large language model, the first prompt word being used to instruct the large language model to perform category summarization on the target text with columns as objects, to obtain a category summary result output by the large language model;
[0031] a second reasoning module configured to input the category summary result and a second prompt word into the large language model, the second prompt word being used to instruct the large language model to perform relationship summarization on any two categories contained in the category summary result, to obtain a category relationship summary result output by the large language model;
[0032] a picture generation module configured to generate a knowledge graph corresponding to the to-be-processed list file based on the data contained in the to-be-processed list file and the category relationship summary result.
[0033] In a fourth aspect, the present application further provides a computer device comprising a memory and a processor, the memory storing a computer program, and the processor, when executing the computer program, implements the knowledge graph construction method provided in the first aspect or the second aspect.
[0034] Fifthly, this application also provides a computer-readable storage medium having a computer program stored thereon, wherein the computer program, when executed by a processor, implements the knowledge graph construction method provided in the first or second aspect.
[0035] Sixthly, this application also provides a computer program product, including a computer program that, when executed by a processor, implements the knowledge graph construction method provided in the first or second aspect.
[0036] The aforementioned knowledge graph construction method, apparatus, and computer equipment involve: acquiring a list file to be processed, where each column of data in the list file belongs to the same category; converting the data in the list file into target text described in columns; inputting the target text and a first prompt word into a large language model, where the first prompt word instructs the large language model to perform category summarization on the target text column by column, resulting in a category summary output by the large language model; inputting the category summary result and a second prompt word into the large language model, where the second prompt word instructs the large language model to perform relationship summarization on any two categories contained in the category summary result, resulting in a category relationship summary output by the large language model; and generating a knowledge graph corresponding to the list file based on the data in the list file and the category relationship summary result. The solution in this application embodiment finds the relationships between columns and maps these relationships to each data point, significantly reducing the consumption of computing resources. Attached Figure Description
[0037] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0038] Figure 1 This is a schematic diagram illustrating an operational scenario between a display device and a control device provided in some embodiments of this application;
[0039] Figure 2 This is a schematic diagram of the hardware configuration of a display device provided in some embodiments of this application;
[0040] Figure 3 This is a schematic diagram of the hardware configuration of the control device provided in some embodiments of this application;
[0041] Figure 4 This is a schematic diagram of the software configuration of a display device provided in some embodiments of this application;
[0042] Figure 5 The flow of the knowledge graph construction method provided in some embodiments of this application Figure 1 ;
[0043] Figure 6 The flow of the knowledge graph construction method provided in some embodiments of this application Figure 2 . Detailed Implementation
[0044] The 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 represent the same or similar elements. The embodiments described below do not represent all embodiments consistent with this application. They are merely examples of systems and methods consistent with some aspects of this application as detailed in the claims.
[0045] It should be noted that the brief descriptions of terms in this application are only for the convenience of understanding the embodiments described below, and are not intended to limit the embodiments of this application. Unless otherwise stated, these terms should be understood in their ordinary and common meaning.
[0046] The terms "first," "second," "third," etc., used in the specification, claims, and accompanying drawings of this application are used to distinguish similar or related objects or entities, and do not necessarily imply a specific order or sequence, unless otherwise specified. It should be understood that such terms are interchangeable where appropriate.
[0047] The terms “comprising” and “having”, and any variations thereof, are intended to cover but not exclude inclusion, for example, a product or device that includes a range of components is not necessarily limited to all of the components that are clearly listed, but may include other components that are not clearly listed or that are inherent to such product or device.
[0048] The term "module" refers to any known or subsequently developed hardware, software, firmware, artificial intelligence, fuzzy logic, or combination of hardware and / or software code that is capable of performing the functions associated with that element.
[0049] In this embodiment, the display device 200 generally refers to a device with screen display and data processing capabilities. For example, the display device 200 includes, but is not limited to, smart TVs, mobile terminals, computers, monitors, advertising screens, wearable devices, virtual reality devices, augmented reality devices, etc.
[0050] Figure 1 This is a schematic diagram illustrating an operational scenario between a display device and a control device provided in some embodiments of this application. For example... Figure 1As shown, users can operate the display device 200 via touch operation, mobile terminal 300, and control device 100. For example, control device 100 can be a remote control, stylus, gamepad, etc.
[0051] The mobile terminal 300 can function as a control device for human-computer interaction between the user and the display device 200. It can also function as a communication device for establishing a communication connection with the display device 200 and exchanging data. In some embodiments, the mobile terminal 300 can have software applications installed on it and communicate with the display device 200 via network communication protocols to achieve one-to-one control and data communication. Furthermore, it can transmit audio and video content displayed on the mobile terminal 300 to the display device 200 for synchronized display.
[0052] like Figure 1 The diagram also shows that the display device 200 communicates with the server 400 via various communication methods. This allows the display device 200 to communicate via a local area network (LAN), a wireless local area network (WLAN), and other networks.
[0053] Display device 200 can provide broadcast television reception function, and can also be equipped with intelligent network television function that provides computer support function, including but not limited to network television, smart television, Internet Protocol television (IPTV), etc.
[0054] Figure 2 Provided for some embodiments of this application Figure 1 Hardware configuration block diagram of display device 200.
[0055] In some embodiments, the display device 200 may include at least one of a tuner 210, a communication device 220, a detector 230, a device interface 240, a controller 250, a display 260, an audio output device 270, a memory, a power supply, and a user input interface.
[0056] In some embodiments, detector 230 is used to acquire signals from the external environment or to interact with the outside world. For example, detector 230 includes a light receiver, a sensor for acquiring ambient light intensity; or, detector 230 includes an image acquisition device, such as a camera, which can be used to acquire external environmental scenes, user attributes, or user interaction gestures; or, detector 230 includes a sound acquisition device, such as a microphone, for receiving external sounds.
[0057] In some embodiments, the display 260 includes display function components for presenting images and driving components for driving image display. The display 260 is used to receive and display image signals output from the controller 250. For example, the display 260 can be used to display video content, image content, menu control interface components, and user control UI interfaces, etc.
[0058] In some embodiments, the communication device 220 is a component used to communicate with external devices or the server 400 according to various communication protocol types. The display device 200 may have multiple communication devices 220 depending on the supported communication methods. For example, when the display device 200 supports wireless network communication, it may have a communication device 220 with WiFi functionality. When the display device 200 supports Bluetooth connectivity, it needs to have a communication device 220 with Bluetooth functionality.
[0059] The communication device 220 enables the display device 200 to communicate with external devices or the server 400 via wireless or wired connections. Wired connections utilize data cables, interfaces, or other components to connect the display device 200 to external devices. Wireless connections utilize wireless signals or wireless networks. The display device 200 can directly establish a connection with external devices or indirectly through gateways, routers, or other connection devices.
[0060] In some embodiments, the controller 250 may include at least one of a central processing unit, a video processor, an audio processor, a graphics processor, and a power processor, and a first to an nth interface for input / output. The controller 250 controls the operation of the display device and responds to user operations through various software control programs stored in memory. The controller 250 controls the overall operation of the display device 200.
[0061] In some embodiments, the controller 250 and the tuner 210 may be located in different separate devices, that is, the tuner 210 may also be located in an external device of the main device where the controller 250 is located, such as an external set-top box.
[0062] In some embodiments, a user can input user commands through a graphical user interface (GUI) displayed on a display 260, and the user input interface receives user input commands through the graphical user interface (GUI).
[0063] In some embodiments, the audio output device 270 can be a built-in speaker of the display device 200 or an external audio output device connected to the display device 200. For the external audio output device connected to the display device 200, the display device 200 may also be provided with an external audio output terminal, through which the audio output device can be connected to the display device 200 to output sound from the display device 200.
[0064] In some embodiments, the user input interface 280 can be used to receive instructions from user input.
[0065] Figure 3 Provided for some embodiments of this application Figure 1 Hardware configuration block diagram of the central control device. (Example) Figure 3 As shown, the control device 100 may include: a controller 110, a communication interface 130, a user input / output interface, a memory, and a power supply.
[0066] The control device 100 is configured to control the display device 200, and to receive user input operation commands and convert the operation commands into commands that the display device 200 can recognize and respond to, thus acting as an intermediary for interaction between the user and the display device 200.
[0067] In some embodiments, the control device 100 may be an intelligent device. For example, the control device 100 may be equipped with various applications for controlling the display device 200 according to user needs.
[0068] In some embodiments, such as Figure 1 As shown, the mobile terminal 300 or other smart electronic devices can perform similar functions to the control device 100 after installing the application of the control display device 200.
[0069] The controller 110 includes a processor 112, RAM 113, ROM 114, a communication interface 130, and a communication bus. The controller 110 is used to control the operation of the control device 100, as well as the communication and cooperation between internal components and the external and internal data processing functions.
[0070] Under the control of the controller 110, the communication interface 130 enables communication of control signals and data signals with the display device 200. The communication interface 130 may include at least one of other near-field communication modules such as WiFi chip 131, Bluetooth module 132, and NFC module 133.
[0071] User input / output interface 140, wherein the input interface includes at least one of other input interfaces such as microphone 141, touchpad 142, sensor 143, and button 144.
[0072] In some embodiments, the control device 100 includes at least one of a communication interface 130 and an input / output interface 140. The control device 100 is configured with the communication interface 130, such as a WiFi, Bluetooth, or NFC module, which can encode user input commands via WiFi, Bluetooth, or NFC protocols and send them to the display device 200.
[0073] The memory 190 is used to store various operating programs, data, and applications for driving and controlling the control device 100 under the control of the controller. The memory 190 can also store various control signal instructions input by the user.
[0074] The power supply 180 is used to provide operating power support for the various components of the control device 100 under the control of the controller.
[0075] In order to perform user interaction, in some embodiments, the display device 200 may run an operating system. The operating system is a computer program used to manage and control the hardware and software resources in the display device 200. The operating system can (control the display device) provide a user interface, allowing users to interact with the display device 200 and supporting the running of various applications.
[0076] It should be noted that the operating system can be a native operating system based on a specific operating platform, a third-party operating system that is deeply customized based on a specific operating platform, or an independent operating system specifically developed for display devices.
[0077] An operating system can be divided into different modules or levels based on the functions it implements, for example... Figure 4 As shown, in some embodiments, the system is divided into four layers, from top to bottom: the Applications layer (referred to as the "Application Layer"), the Application Framework layer (referred to as the "Framework Layer"), the System Library layer, and the Kernel layer.
[0078] In some embodiments, the application layer provides services and interfaces for applications, enabling the display device 200 to run the applications and interact with the user based on the applications. The application layer may contain at least one application, which may be a built-in Windows program, system settings program, or clock program of the operating system; or it may be an application developed by a third-party developer. In specific implementations, the application packages in the application layer are not limited to the examples above.
[0079] The framework layer provides application programming interfaces (APIs) and a programming framework for applications. The application framework layer includes predefined functions. It acts as a central processing unit, determining the actions taken by applications within the application layer. Through the API, applications can access system resources and obtain system services during execution.
[0080] like Figure 4 As shown, the application framework layer in this embodiment includes a view system, managers, and content providers. The view system designs and implements the application's interface and interactions, and includes lists, grids, text boxes, and buttons. The managers include at least one of the following modules: an activity manager for interacting with all running activities in the system; a location manager for providing system services or applications with access to system location services; a package manager for retrieving various information related to application packages currently installed on the device; a notification manager for controlling the display and clearing of notification messages; and a window manager for managing icons, windows, toolbars, wallpapers, and desktop widgets on the user interface.
[0081] In some embodiments, the Activity Manager manages the lifecycle of individual applications and common navigation and back functions, such as controlling application exit, opening, and back actions. The Window Manager manages all window programs, such as obtaining the screen size, determining if a status bar is present, locking the screen, capturing the screen, and controlling changes to the display window, such as shrinking the display window, shaking the display, or distorting the display.
[0082] In some embodiments, the system runtime library layer can provide support for the framework layer. When the framework layer is used, the operating system runs the instruction library contained in the system runtime library layer, such as the C / C++ instruction library, to implement the functions to be performed by the framework layer.
[0083] In some embodiments, the kernel layer is a functional layer situated between the hardware and software of the display device 200. The kernel layer can implement functions such as hardware abstraction, multitasking, and memory management. For example, ... Figure 4As shown, hardware drivers can be configured in the kernel layer. The kernel layer can contain at least one of the following drivers: audio driver, display driver, Bluetooth driver, camera driver, WIFI driver, USB driver, HDMI driver, sensor driver (such as fingerprint sensor, temperature sensor, pressure sensor, etc.), and power driver, etc.
[0084] It should be noted that the above examples are merely a simple division of operating system functions and do not limit the specific form of the operating system of the display device 200 in this application embodiment. Depending on the function of the display device, the type of operating system, and other factors, the number of levels and the specific level type of the operating system may be expressed in other forms.
[0085] In some embodiments, a knowledge graph construction method is provided, which can be applied to the aforementioned display device. See [link to relevant documentation]. Figure 5 As shown, the method includes the following steps:
[0086] Step 501: Obtain the list file to be processed, wherein each column of data in the list file belongs to the same category.
[0087] Optionally, the list file to be processed can be uploaded by the user via the network, created and edited by the user locally, or transmitted by other devices via the grid. This application embodiment does not limit this.
[0088] Optionally, the format of the list file to be processed can be Excel.
[0089] Optionally, the data in the list file to be processed can be entered manually or by machine.
[0090] In this application, each column of data in the to-be-processed list file belongs to the same category, while different columns belong to different categories. For example, the to-be-processed list file includes three columns: the first column belongs to office supplies, the second to organization members, and the third to transportation equipment. This is merely an example and does not constitute a limitation on the embodiments of this application. As long as each column of data in the list file belongs to the same category, the list file can be used as the to-be-processed list file in the embodiments of this application.
[0091] Step 502: Convert the data contained in the list file to be processed into target text described in columns.
[0092] One approach is to use data conversion tools to convert the data in the list file to be processed into target text described in columns. For example, see Table 1, which shows an example of the data in the list file to be processed, containing three columns of data. These three columns can be converted into target text described in columns.
[0093] Table 1
[0094]
[0095] The converted target text, described in columns, is as follows:
[0096] The first column contains data: {Column 1 - Data 1, Column 1 - Data 2, Column 1 - Data 3, Column 1 - Data 4}.
[0097] The second column contains data: {Column 2 - Data 1, Column 2 - Data 2, Column 2 - Data 3, Column 2 - Data 4}.
[0098] The third column contains data: {Column 3 - Data 1, Column 3 - Data 2, Column 3 - Data 3, Column 3 - Data 4}.
[0099] ……….”
[0100] Optionally, as in the example above, the target text described in columns also includes formatting characters such as "{}" and "、". Therefore, the target text described in columns above can also be called formatted flat text. The positional and relational information of the list is preserved.
[0101] Step 503: Input the target text and the first prompt word into the large language model. The first prompt word is used to instruct the large language model to perform category summarization on the target text by column, and obtain the category summary result output by the large language model.
[0102] After obtaining the target text, the target text and the first prompt word can be input into the large language model. The first prompt word can be pre-set and used to instruct the large language model to summarize the categories of the target text by column. After receiving the target text and the first prompt word, the large language model summarizes the category of each column of data by column. The category of each column of data constitutes the category summary result, and the large language model outputs the category summary result.
[0103] For example, assuming the list file to be processed contains 3 columns of data, after obtaining the target text corresponding to the list file to be processed through the above steps, the target text and the first prompt word are input into the large language model. The summary results of the categories output by the large language model are shown in Table 2.
[0104] Table 2
[0105]
[0106] Step 504: Input the category summary result and the second prompt word into the large language model. The second prompt word is used to instruct the large language model to summarize the relationship between any two categories contained in the category summary result, and obtain the category relationship summary result output by the large language model.
[0107] The category summary result and the second prompt word can be input into the large language model. The second prompt word can also be preset to instruct the large language model to summarize the relationship between any two categories contained in the category summary result. After receiving the category summary result and the second prompt word, the large language model summarizes the relationship between any two categories contained in the category summary result, thereby obtaining the category relationship summary result and outputting it.
[0108] For example, assuming the category summary results are shown in Table 2, after inputting the category summary results and the second prompt word into the large language model, the category relationship summary results output by the large language model are shown in Table 3.
[0109] Table 3
[0110]
[0111] Step 505: Based on the data contained in the list file to be processed and the summary results of the category relationships, generate a knowledge graph corresponding to the list file to be processed.
[0112] In this application, for the first and second data points in different columns of the list file to be processed, the column to which the first data point belongs can be determined, and the corresponding category can be found in the category summary results. For ease of explanation, this category is referred to as the first category in this embodiment. Similarly, the column to which the second data point belongs can be determined, and the corresponding category can be found in the category summary results. For ease of explanation, this category is referred to as the second category in this embodiment. The relationship between the first and second categories can be found in the category relationship summary results, and this relationship is taken as the relationship between the first and second data points. The first and second data points can be considered as entities, and the relationship between the two entities has been determined. Based on the same method, the relationships between other data points in the list file to be processed can be obtained, thereby obtaining the knowledge graph corresponding to the list file to be processed.
[0113] In the above embodiments, a list file to be processed is obtained, wherein each column of data in the list file belongs to the same category; the data contained in the list file is converted into target text described in columns; the target text and a first prompt word are input into the large language model, wherein the first prompt word is used to instruct the large language model to perform category summarization on the target text by column, thereby obtaining the category summary result output by the large language model; the category summary result and a second prompt word are input into the large language model, wherein the second prompt word is used to instruct the large language model to perform relationship summarization on any two categories contained in the category summary result, thereby obtaining the category relationship summary result output by the large language model; based on the data contained in the list file to be processed and the category relationship summary result, a knowledge graph corresponding to the list file to be processed is generated. The solution of this application embodiment finds the relationship between columns and maps these relationships to each data, greatly reducing the consumption of computing resources.
[0114] In some embodiments, converting the data contained in the list file to be processed into target text described in columns includes: determining the number of data rows in the list file to be input into the large language model based on the input character limit of the large language model, the number of characters of the first prompt word, and the number of characters in a row of data in the list file to be processed; sampling the list file in columns based on the number of data rows to obtain sampled data; and converting the sampled data into target text described in columns.
[0115] In view of the fact that some large oracle models have a limit on the number of input characters, and the data contained in the list file to be processed may be very large, this application proposes to sample the data contained in the list file to be processed and then process the sampled data.
[0116] Optionally, the total amount of data allowed to be collected can be obtained by subtracting the number of characters of the first prompt word from the input character limit of the large language model. Then, by dividing the total amount of data by the number of characters in a line of data in the list file to be processed, the number of data lines in the list file to be input into the large language model can be obtained.
[0117] After obtaining the number of data rows, sampling can be performed line by line in the to-be-processed list file to obtain sampled data. For example, if the calculation above determines that there are 3 data rows in the to-be-processed list file to be input into the large language model, one row of data can be collected starting from the first row of the to-be-processed list file, for each preset row, until 3 rows of data are collected. These 3 rows of data can be used as sampled data. These 3 rows of data can then be converted into target text described in columns.
[0118] In the above embodiments, considering that some large oracle models have input character limits, and the data contained in the list file to be processed may be very large, this application proposes to determine the number of data rows in the list file to be input into the large language model based on the input character limit of the large language model, the number of characters in the first prompt word, and the number of characters in a single line of data in the list file to be processed; based on the number of data rows, sampling is performed on a row-by-row basis in the list file to obtain sampled data; the sampled data is then converted into target text described in columns. This ensures that the large oracle model can function normally.
[0119] In some embodiments, the first prompt word is used to instruct the large language model: for any column in the target text, if the first data contained in the column is a header, the header is taken as the category of the column; if the first data contained in the column is not a header, all data contained in the column are summarized to obtain the category of the column.
[0120] Specifically, after obtaining the target text, the target text and a first prompt word can be input into the large language model. This first prompt word can be pre-set and instructs the large language model: for any column in the target text, if the first data in the column is a header, the header is taken as the category of the column; if the first data in the column is not a header, all data in the column are summarized to obtain the category of the column. After receiving the target text and the first prompt word, the large language model judges the first data in each column. If the first data is a header, it is taken as the category of the corresponding column; if the first data is not a header, all data in the column are summarized to obtain the category of the column. Finally, the large language model outputs the category summary result.
[0121] In the above embodiments, the method of setting the first prompt word can help the large language model determine the category of each column more quickly, thereby improving processing efficiency.
[0122] In some embodiments, generating a knowledge graph corresponding to the list file to be processed based on the data contained in the list file and the summary results of the category relationships includes:
[0123] Traverse each data item contained in the list file to be processed; for the target data currently traversed, obtain any other data item in the list file to be processed besides the target data item, and determine the column where the other data item is located; obtain the first category corresponding to the column where the target data item is located and the second category corresponding to the column where the other data item is located from the category summary results; obtain the target category relationship between the first category and the second category from the category relationship summary results; based on the target data item, the other data item, and the target category relationship, obtain a set of knowledge about the target data item; after traversal, obtain the knowledge graph corresponding to the list file to be processed.
[0124] This process involves iterating through each data item in the to-be-processed list file, row by row. For the currently encountered target data, any other data item in the to-be-processed list file, excluding the target data, can be retrieved. Specifically, any other data item in the to-be-processed list file that is not in the same column as the target data can be retrieved. The column containing the target data and the column containing any of the aforementioned data items can be searched. From the category summary results, the category corresponding to the column containing the target data (referred to as the first category for convenience) and the category corresponding to the column containing any of the aforementioned data items (referred to as the second category for convenience) can be found. The target category relationship between the first category and the second category can be obtained from the category relationship summary results. The target data and any of the aforementioned data items can be treated as entities, and the target category relationship can be considered as the relationship between them, thus obtaining a set of knowledge. All the knowledge obtained after the traversal is complete can constitute the knowledge graph corresponding to the to-be-processed list file.
[0125] Optionally, after obtaining the knowledge graph, conventional knowledge graph operations such as filtering out self-loops (e.g., relationship between category 1 and category 1) and cleaning invalid values can be performed on the entities in the knowledge graph. Then, deduplication statistics are performed, and knowledge entity weights and knowledge relationship weights are formed based on the frequency of knowledge occurrence.
[0126] In the above embodiments, each piece of data contained in the list file to be processed is traversed; for the target data currently being traversed, any other data in the list file to be processed, excluding the target data, is obtained, and the column where the other data is located is determined; from the category summary results, the first category corresponding to the column where the target data is located and the second category corresponding to the column where the other data is located are obtained; from the category relationship summary results, the target category relationship between the first category and the second category is obtained; based on the target data, the other data, and the target category relationship, a set of knowledge about the target data is obtained; after traversal, the knowledge graph corresponding to the list file to be processed is obtained. The solution of this application embodiment finds the relationship between columns and maps these relationships to each piece of data, greatly reducing the consumption of computing resources.
[0127] In some embodiments, a knowledge graph construction method is provided, see [link to relevant documentation]. Figure 6 As shown, it includes the following steps:
[0128] Step 601: Obtain the list file to be processed, wherein each row of data in the list file belongs to the same category.
[0129] Optionally, the list file to be processed can be uploaded by the user via the network, created and edited by the user locally, or transmitted by other devices via the grid. This application embodiment does not limit this.
[0130] Optionally, the format of the list file to be processed can be Excel.
[0131] Optionally, the data in the list file to be processed can be entered manually or by machine.
[0132] In this application, each row of data in the list file belongs to the same category, while different rows belong to different categories. For example, the list file includes three rows of data: the first row belongs to office supplies, the second row belongs to organization members, and the third row belongs to transportation equipment. This is just an example and does not constitute a limitation on the embodiments of this application. As long as each row of data in the list file belongs to the same category, the list file can be used as the list file for processing in the embodiments of this application.
[0133] Step 602: Convert the data contained in the list file to be processed into target text described in lines.
[0134] Among these methods, data conversion tools can be used to convert the data contained in the list file to be processed into target text described in lines.
[0135] Step 603: Input the target text and the first prompt word into the large language model. The first prompt word is used to instruct the large language model to perform category summarization on the target text as a behavior object, and obtain the category summary result output by the large language model.
[0136] After obtaining the target text, the target text and the first prompt word can be input into the large language model. The first prompt word can be pre-set and used to instruct the large language model to summarize the categories of the target text as behavior objects. After receiving the target text and the first prompt word, the large language model summarizes the categories of each column of data as behavior objects. The categories of each column of data constitute the category summary result, and the large language model outputs the category summary result.
[0137] Step 604: Input the category summary result and the second prompt word into the large language model. The second prompt word is used to instruct the large language model to summarize the relationship between any two categories contained in the category summary result, and obtain the category relationship summary result output by the large language model.
[0138] The category summary result and the second prompt word can be input into the large language model. The second prompt word can also be preset to instruct the large language model to summarize the relationship between any two categories contained in the category summary result. After receiving the category summary result and the second prompt word, the large language model summarizes the relationship between any two categories contained in the category summary result, thereby obtaining the category relationship summary result and outputting it.
[0139] Step 605: Based on the data contained in the list file to be processed and the summary results of the category relationships, generate a knowledge graph corresponding to the list file to be processed.
[0140] In this application, for the first and second data points in different rows of the list file to be processed, the row to which the first data point belongs can be determined, and the corresponding category for that row can be found in the category summary results. For ease of explanation, this category is referred to as the first category in this embodiment. Similarly, the row to which the second data point belongs can be determined, and the corresponding category for that row can be found in the category summary results. For ease of explanation, this category is referred to as the second category in this embodiment. The relationship between the first and second categories can be found in the category relationship summary results, and this relationship is taken as the relationship between the first and second data points. The first and second data points can be considered as entities, and the relationship between the two entities has been determined. Based on the same method, the relationships between other data points in the list file to be processed can be obtained, thereby obtaining the knowledge graph corresponding to the list file to be processed.
[0141] In the above embodiments, a list file to be processed is obtained, wherein each row of data in the list file belongs to the same category; the data contained in the list file is converted into target text described in line units; the target text and a first prompt word are input into the large language model, wherein the first prompt word is used to instruct the large language model to perform category summarization on the target text by line object, thereby obtaining the category summary result output by the large language model; the category summary result and a second prompt word are input into the large language model, wherein the second prompt word is used to instruct the large language model to perform relationship summarization on any two categories contained in the category summary result, thereby obtaining the category relationship summary result output by the large language model; based on the data contained in the list file to be processed and the category relationship summary result, a knowledge graph corresponding to the list file to be processed is generated. The solution of this application embodiment finds the relationship between rows and maps these relationships to each data, greatly reducing the consumption of computing resources.
[0142] In some embodiments, the first prompt word is used to instruct the large language model: for any line in the target text, if the first data contained in the line is a header, the header is taken as the category of the column; if the first data contained in the line is not a header, all data contained in the line are summarized to obtain the category of the line.
[0143] Specifically, after obtaining the target text, the target text and a first prompt word can be input into the large language model. This first prompt word can be pre-set and instructs the large language model: for any line in the target text, if the first data element in the line is a table header, the table header is taken as the category of the line; if the first data element is not a table header, all data elements in the line are summarized to obtain the category of the line. After receiving the target text and the first prompt word, the large language model judges the first data element in each line as a line object. If the first data element is a table header, it is taken as the category of the corresponding line; if the first data element is not a table header, all data elements in the line are summarized to obtain the category of the line. The large language model finally outputs the category summary result.
[0144] In the above embodiments, the method of setting the first prompt word can help the large language model determine the category of each column more quickly, thus improving processing efficiency. Compared with the previous implementation, this embodiment is aimed at a list file where each row of data belongs to the same category. The construction process of its knowledge graph is similar to that of the aforementioned list file where each column of data belongs to the same category, and they can be referred to each other.
[0145] It should be understood that although the steps in the flowcharts of the embodiments described above are shown sequentially according to the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless explicitly stated herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least some steps in the flowcharts of the embodiments described above may include multiple steps or multiple stages. These steps or stages are not necessarily completed at the same time, but can be executed at different times. The execution order of these steps or stages is not necessarily sequential, but can be performed alternately or in turn with other steps or at least some of the steps or stages in other steps. It is understood that the steps in different embodiments can be freely combined as needed, and all non-contradictory solutions formed by such combinations are within the scope of protection of this application.
[0146] Based on the same inventive concept, this application also provides a knowledge graph construction apparatus for implementing the knowledge graph construction method described above. The solution provided by this apparatus is similar to the implementation scheme described in the above method; therefore, the specific limitations in one or more knowledge graph construction apparatus embodiments provided below can be found in the limitations of the knowledge graph construction method described above, and will not be repeated here.
[0147] In one exemplary embodiment, a knowledge graph construction apparatus is provided, comprising:
[0148] The acquisition module is used to acquire a list file to be processed, wherein each column of data in the list file belongs to the same category.
[0149] The conversion module is used to convert the data contained in the list file to be processed into target text described in columns;
[0150] The first reasoning module is used to input the target text and the first prompt word into the large language model. The first prompt word is used to instruct the large language model to perform category summarization on the target text in terms of columns, and to obtain the category summary result output by the large language model.
[0151] The second reasoning module is used to input the category summary result and the second prompt word into the large language model. The second prompt word is used to instruct the large language model to summarize the relationship between any two categories contained in the category summary result, so as to obtain the category relationship summary result output by the large language model.
[0152] The image generation module is used to generate a knowledge graph corresponding to the list file to be processed based on the data contained in the list file to be processed and the summary results of the category relationships.
[0153] In one exemplary embodiment, a knowledge graph construction apparatus is provided, comprising:
[0154] The acquisition module is used to acquire a list file to be processed, wherein each row of data in the list file belongs to the same category;
[0155] The conversion module is used to convert the data contained in the list file to be processed into target text described in lines;
[0156] The first reasoning module is used to input the target text and the first prompt word into the large language model. The first prompt word is used to instruct the large language model to perform category summarization on the target text as a behavior object, and obtain the category summary result output by the large language model.
[0157] The second reasoning module is used to input the category summary result and the second prompt word into the large language model. The second prompt word is used to instruct the large language model to summarize the relationship between any two categories contained in the category summary result, so as to obtain the category relationship summary result output by the large language model.
[0158] The image generation module is used to generate a knowledge graph corresponding to the list file to be processed based on the data contained in the list file to be processed and the summary results of the category relationships.
[0159] In one embodiment, a computer device is also provided, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement the steps in the above method embodiments.
[0160] In one embodiment, a computer-readable storage medium is provided having a computer program stored thereon that, when executed by a processor, implements the steps in the above method embodiments.
[0161] In one embodiment, a computer program product is provided, including a computer program that, when executed by a processor, implements the steps in the above method embodiments.
[0162] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of this application, and are not intended to limit them. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some or all of the technical features therein. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of this application.
[0163] For ease of explanation, the above description has been provided in conjunction with specific embodiments. However, the above exemplary discussion is not intended to be exhaustive or to limit the embodiments to the specific forms disclosed above. Various modifications and variations can be obtained based on the above teachings. The selection and description of the above embodiments are for the purpose of better explaining the principles and practical applications, thereby enabling those skilled in the art to better utilize the described embodiments and various different variations of embodiments suitable for specific use considerations.
Claims
1. A method for constructing a knowledge graph, characterized in that, include: Obtain a list file to be processed, wherein each column of data in the list file belongs to the same category; The data contained in the list file to be processed is converted into target text described in columns; The target text and the first prompt word are input into the large language model. The first prompt word is used to instruct the large language model to perform category summarization on the target text by column, and the category summary result output by the large language model is obtained. The category summary result and the second prompt word are input into the large language model. The second prompt word is used to instruct the large language model to summarize the relationship between any two categories contained in the category summary result, and the category relationship summary result output by the large language model is obtained. Based on the data contained in the list file to be processed and the summary results of the category relationships, a knowledge graph corresponding to the list file to be processed is generated.
2. The method according to claim 1, characterized in that, The step of converting the data contained in the list file to be processed into target text described in columns includes: Based on the input character limit of the large language model, the character count of the first prompt word, and the character count of a line of data in the to-be-processed list file, determine the number of data lines in the to-be-processed list file to be input into the large language model; Based on the number of data rows, sample data is obtained by sampling in the list file to be processed, row by row; the sample data is then converted into target text described in columns.
3. The method according to claim 1, characterized in that, The first prompt word is used to instruct the large language model: for any column in the target text, if the first data contained in the column is a header, the header is taken as the category of the column; If the first data in a column is not a header, all data in the column are summarized to determine the category of the column.
4. The method according to claim 1, characterized in that, The step of generating a knowledge graph corresponding to the list file to be processed based on the data contained in the list file to be processed and the summary results of the category relationships includes: Iterate through each piece of data contained in the list file to be processed; For the target data currently being traversed, obtain any other data in the list file to be processed besides the target data, and determine the column where the target data is located; obtain the first category corresponding to the column where the target data is located and the second category corresponding to the column where the target data is located from the category summary results; obtain the target category relationship between the first category and the second category from the category relationship summary results; Based on the target data, any one of the data, and the relationship between the target categories, a set of knowledge about the target data is obtained; After traversal, the knowledge graph corresponding to the list of files to be processed is obtained.
5. A method for constructing a knowledge graph, characterized in that, include: Obtain a list file to be processed, wherein each row of data in the list file belongs to the same category; Convert the data contained in the list file to be processed into target text described in lines; The target text and the first prompt word are input into the large language model. The first prompt word is used to instruct the large language model to perform category summarization on the target text as an action object, and the category summary result output by the large language model is obtained. The category summary result and the second prompt word are input into the large language model. The second prompt word is used to instruct the large language model to summarize the relationship between any two categories contained in the category summary result, and the category relationship summary result output by the large language model is obtained. Based on the data contained in the list file to be processed and the summary results of the category relationships, a knowledge graph corresponding to the list file to be processed is generated.
6. The method according to claim 1, characterized in that, The first prompt word is used to instruct the large language model: for any line in the target text, if the first data contained in the line is a table header, the table header is used as the category of the column; If the first piece of data in a row is not a header, summarize all the data in that row to obtain the category of the row.
7. A knowledge graph construction device, characterized in that, The device includes: The acquisition module is used to acquire a list file to be processed, wherein each column of data in the list file belongs to the same category. The conversion module is used to convert the data contained in the list file to be processed into target text described in columns; The first reasoning module is used to input the target text and the first prompt word into the large language model. The first prompt word is used to instruct the large language model to perform category summarization on the target text in terms of columns, and to obtain the category summary result output by the large language model. The second reasoning module is used to input the category summary result and the second prompt word into the large language model. The second prompt word is used to instruct the large language model to summarize the relationship between any two categories contained in the category summary result, so as to obtain the category relationship summary result output by the large language model. The image generation module is used to generate a knowledge graph corresponding to the list file to be processed based on the data contained in the list file to be processed and the summary results of the category relationships.
8. A computer device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that, When the processor executes the computer program, it implements the steps of the method according to any one of claims 1 to 6.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 6.
10. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 6.