Method for constructing professional recommendation knowledge graph based on large language model and query system
Patent Information
- Application Number
- CN202410173159.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-02-07
- Publication Date
- 2026-10-27
- Estimated Expiration
- 2044-02-07
AI Technical Summary
然而,该技术方案中,在进行推荐过程中没有过多考虑用户自身的性格特点与专业所需的性格特点之间的关联,因此推荐的专业往往难以满足用户自身的性格特点
[0036]1、本发明可用户可根据自己的性格测试结果查询得到相应的推荐专业、职业,通过专业的筛选得到满足条件的职业、性格品质;
Smart Images

Figure CN118069865B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of knowledge graphs, and more specifically, to a professional recommendation knowledge graph query method and system based on a large language model. Background Technology
[0002] The National College Entrance Examination (Gaokao) is an important process for many people, and the choice of major when filling out college applications is particularly crucial. Different majors mean different career paths, requiring different personality traits. Therefore, to determine which majors are suitable for you, you need to understand yourself and the personality traits corresponding to those majors. Conversely, you also need to understand which personality traits you should cultivate to better adapt to the demands of your chosen major.
[0003] However, the current internet lacks intelligent professional recommendation service systems that meet this need, failing to fully correlate professional and personality traits, causing inconvenience in choosing majors and career planning during college application. While existing technology, such as the invention patent with application number CN202010309835.0, discloses a subject-based professional recommendation method, device, computer equipment, and storage medium, this method includes: receiving a professional recommendation instruction carrying a user identifier; obtaining user answer data corresponding to the user identifier based on the professional recommendation instruction; extracting corresponding subject knowledge features, skill features, thinking ability features, and personality trait features from the user answer data; inputting these features into a college application professional recommendation model to obtain the output recognition result; obtaining the corresponding recommended major based on the output recognition result; and sending the recommended major to the user terminal corresponding to the user identifier for display. However, this technical solution does not adequately consider the correlation between the user's own personality traits and the personality traits required for the major during the recommendation process, therefore the recommended majors often fail to meet the user's personality characteristics. Therefore, finding a quick way to determine the correlation between professional skills and personality traits is an urgent need that needs to be addressed. Summary of the Invention
[0004] To address the problems existing in the prior art, this invention proposes a method for constructing a professional recommendation knowledge graph and a query system based on a large language model.
[0005] To achieve the objectives of this invention, the following technical solution is adopted:
[0006] In a first aspect, the present invention provides a method for constructing a professional recommendation knowledge graph based on a large language model, the steps of which are as follows:
[0007] S1: For each major within the recommended range, obtain the standard major name and the text describing the personality traits required for that major; for each occupation within the recommended range, obtain the standard occupation name and the text describing the personality traits required for that occupation; for each possible result in the personality test, obtain its standard personality test result name and the text describing the personality traits corresponding to that personality test result.
[0008] S2. By setting prompt words in the input of the large language model, construct an entity extraction model suitable for completing the task of building a professional recommendation knowledge graph. The prompt words need to include specific reasoning examples. At the same time, the extracted entity and relation categories need to be defined and hierarchical output of concepts at each level is required. The format of the output entity attributes also needs to be specified.
[0009] S3. Using the entity extraction model, extract text entities from the text describing the personality traits required for each major, the personality traits required for each occupation, and the personality traits required for each personality test result within the recommended range. Extract the personality traits required for each major, the occupation name suitable for each occupation, the personality traits required for each occupation, and the personality traits possessed by each personality test result.
[0010] S4. Using all majors, all occupations, all extracted personality traits entities, and all personality test results within the recommendation scope as nodes of the graph, relationships are added between nodes based on the entity extraction results in S3. The correlation between majors and personality traits, occupations and personality traits, and personality test results and personality traits are obtained according to a multi-level weight algorithm. Finally, personality traits are used as the connection between majors and personality test results to construct a knowledge graph for major recommendation.
[0011] As a preferred embodiment of the first aspect mentioned above, the text describing the personality traits required for the major, the text describing the personality traits required for the profession, and the text describing the personality traits corresponding to the personality test results are all derived from the entries on the encyclopedia website, and the entries need to undergo text preprocessing to meet the input requirements for entity extraction.
[0012] As a preferred embodiment of the first aspect above, the personality test is one or more of the MBTI test, the Holland Occupational Personality Test, and the Multiple Intelligences Test.
[0013] As a preferred embodiment of the first aspect above, when constructing the entity extraction model in S2, the prompt words in the input of the large language model need to be continuously optimized and adjusted to meet the entity extraction task. The optimization and adjustment process is as follows:
[0014] S21. First, extract samples from all description texts to be extracted, and manually label the target entities in all description text samples to obtain sample data.
[0015] S22. Add specific reasoning examples to the prompt words of the large language model, define the extracted entity and relation categories, and require the large language model to output concepts at each level. At the same time, specify the entity attribute format that the large language model should output. Then, test the large language model after constructing the prompt words on sample data, and further adjust the prompt words according to the test results until the accuracy of the large language model in extracting text entities reaches the preset requirements. Finally, use the final prompt words in the large language model to construct the entity extraction model.
[0016] As a preferred option in the first aspect mentioned above, the descriptive text input to the large language model needs to be pre-marked with the document structure using the large language model. Taking advantage of the large language model's ability to process massive amounts of data, prompt words are constructed to allow the large language model to determine and label the text level in the term content based on the subordinate relationship. The main text in the term content is labeled as level 0, and the Nth level heading in the term content is labeled as level N.
[0017] As a preferred embodiment of the first aspect above, the process of the multi-level weighting algorithm calculating the relevance and constructing the professional recommendation knowledge graph is as follows:
[0018] S41. For each major, calculate the first frequency of different personality quality entities appearing in the description text of the personality qualities required for the major, and use the first frequency to represent the first degree of correlation between the major and the personality quality.
[0019] S42. For each major, determine the occupational names suitable for that major from the extracted entities. Then, for each occupation suitable for that major, count the second frequency of different personality quality entities appearing in the description text of the personality quality required for that occupation. Use this second frequency to characterize the second correlation between the major and personality quality.
[0020] S43. For each pair of major and personality traits, the first correlation between the major and the personality trait and the second correlation between all occupations suitable for the major and the personality trait are weighted and summed to obtain the final correlation between the major and the personality trait.
[0021] S44. For each personality test result, calculate the third frequency of different personality quality entities in the personality quality description text corresponding to the personality test result, and use the third frequency to characterize the correlation between the corresponding personality test result and personality quality.
[0022] S45. Using all majors, all occupations, all extracted personality traits, and all personality test results as nodes in a graph, based on the entity extraction results in S3, establish edge connections between each major and the occupations suitable for that major, between each major and the personality traits required for that major, between each occupation and the personality traits required for that occupation, and between each personality test result and the personality traits possessed by that personality test result. Simultaneously, assign edge weights to the corresponding nodes based on the final correlation between majors and personality traits obtained in S43, and assign edge weights to the corresponding nodes based on the correlation between personality test results and personality traits obtained in S44. This connects majors and personality test results through personality traits, constructing a major recommendation knowledge graph capable of recommending majors based on personality test results.
[0023] As a preferred embodiment of the first aspect above, in step S4, each entity, relation, and degree of association are stored in the Neo4j database, and the professional recommendation knowledge graph is visualized in the front end using the Neo4j visualization tool based on the Neo4j database.
[0024] As a preferred option in the first aspect mentioned above, all standard professional names, all standard occupational names, and all standard personality test result names need to be clustered into several major categories of professional names, occupational names, and personality test result names, and then stored in the database.
[0025] As a preferred option in the first aspect mentioned above, the recommended scope of majors only includes popular majors, which are obtained as follows:
[0026] First, all professional names appearing in the encyclopedia corpus containing a large number of professional names are sorted using the TextRank algorithm. In the TextRank algorithm, the edge weight between two standard professional names is corrected by the similarity of the word vector representations of the two professional names. The word vector representation of each professional name is obtained by encoding the encyclopedia entry content of that professional name using Doc2Vec.
[0027] Then, the top-ranked majors with a set proportion are selected from the ranking results as popular majors and included in the major recommendation scope of the knowledge graph.
[0028] Secondly, this invention provides a professional query and recommendation system based on a large language model and knowledge graph, comprising:
[0029] The personality test module is used to obtain the user's personality test results;
[0030] The knowledge graph module is used to store the professional recommendation knowledge graphs constructed according to the construction method described in any of the schemes in the first aspect above;
[0031] The professional recommendation module uses the user's personality test results as query conditions. It retrieves all professions connected to the personality test results via the professional recommendation knowledge graph as recommended professions. It calculates the product of the edge weights of all edges on each shortest path between the personality test results and each recommended profession. The sum of the edge weight products of all shortest paths is taken as the comprehensive relevance between the personality test results and the recommended professions. All recommended professions are sorted in descending order according to the comprehensive relevance and returned to the user as the recommendation results.
[0032] Thirdly, the present invention provides a computer electronic device, which includes a memory and a processor;
[0033] The memory is used to store computer programs;
[0034] The processor is configured to, when executing the computer program, implement the professional recommendation method based on a large language model and knowledge graph as described in any of the solutions of the first aspect, or implement the professional query recommendation system based on a large language model and knowledge graph as described in the solution of the second aspect.
[0035] Therefore, compared with the prior art, the present invention has the following beneficial effects:
[0036] 1. This invention allows users to query and obtain corresponding recommended majors and occupations based on their personality test results, and obtain occupations and personality traits that meet the conditions through professional screening;
[0037] 2. This invention can utilize the context learning ability and thought chain reasoning ability of large language models to identify and extract entities, as well as supplement the relationships between entities. Compared with the common fine-tuned BERT model, it is more efficient and has better results.
[0038] 3. This invention can utilize the API of a large language model and write automated scripts to annotate the document structure of encyclopedia corpus data by taking advantage of the large language model's ability to process massive amounts of data, saving the cost of manual annotation and achieving higher accuracy.
[0039] 4. This invention can use the TextRank algorithm based on Doc2Vec to replace the traditional Word2Vec algorithm, taking into account the impact of weights on text classification, and can achieve the screening of popular majors.
[0040] 5. The professional query and recommendation system based on a large language model and knowledge graph constructed in this invention can be displayed on the front end based on the knowledge graph. By adjusting the position of the nodes displayed on the interface and folding and expanding category data according to the classification of personality test results, it is also possible to click on the nodes and edges of the knowledge graph to view specific attributes, making the display effect more concise and intuitive. Attached Figure Description
[0041] The present invention will now be further described with reference to the accompanying drawings.
[0042] Figure 1 A flowchart illustrating the steps involved in constructing a professional recommendation knowledge graph based on a large language model;
[0043] Figure 2 A schematic diagram illustrating the module composition of a professional query and recommendation system based on a large language model and knowledge graph;
[0044] Figure 3 This is an example illustration of the results of a professional-personality test.
[0045] Figure 4 This is an example of a display of professional skills, career, and personality traits. Detailed Implementation
[0046] The specific embodiments of the present invention will be described in more detail below with reference to the accompanying drawings. The features and advantages of the present invention will become more apparent through specific examples.
[0047] In a preferred embodiment of the present invention, a method for constructing a professional recommendation knowledge graph based on a large language model is provided, the steps of which are shown in S1 to S4. The specific implementation of each step is described in detail below.
[0048] S1: For each major within the recommended range, obtain the standard major name and the text describing the personality traits required for that major; for each occupation within the recommended range, obtain the standard occupation name and the text describing the personality traits required for that occupation; for each possible outcome in the personality test, obtain its standard personality test result name and the text describing the personality traits corresponding to that personality test result.
[0049] It should be noted that the aforementioned descriptions of personality traits required for different majors, professions, and personality test results can be collected from various sources, as long as the required content is available. In the embodiments of this invention, the aforementioned descriptions of personality traits required for different majors, professions, and personality test results are all derived from encyclopedia entries, and the entry content needs to undergo text preprocessing to meet the input requirements for entity extraction.
[0050] In one example of this invention, professional-related information can be obtained by using web crawling technology to retrieve entries from the Chinese Wikipedia website based on standard professional names. These entries contain descriptions of the personality traits required for the profession. In the professional name entries, the professional name is typically located in the first-level headings of the Wikipedia page, such as Computer Science and Technology, Software Engineering, etc. The professional information description is usually one or more paragraphs introducing the professional content, required personality traits, etc. Related occupations suitable for the profession are usually located in the second-level headings of certain "fields" or "categories" on the Wikipedia page. Alternatively, for occupation-related information, it can also be obtained by using web crawling technology to retrieve entries from the Chinese Wikipedia website based on standard occupation names. These entries contain descriptions of the personality traits required for the occupation.
[0051] It should be noted that the aforementioned personality test can be any test capable of classifying an individual's personality or character traits. In embodiments of the present invention, the personality test can be one or more of the MBTI test, the Holland Occupational Theory Test, and the Multiple Intelligences Test. Similarly, in one example of an embodiment of the present invention, the test result categories of various personality tests can be obtained by using web crawling technology to retrieve the content of entries on the Wikipedia Chinese website based on the standard personality test result names. The content contains text describing the personality qualities corresponding to the personality test results.
[0052] Of course, besides using online web crawlers to collect data, in another example of this invention, the existing Wikipedia Chinese corpus can also be used for filtering. The specific method is as follows:
[0053] 1) Obtain the original Wikipedia Chinese corpus. The corpus contains some Traditional Chinese characters, which are first simplified using OpenCC. Then, match each entry in the corpus with strings containing professional names, occupational names, or personality test result names, filtering out invalid data that does not contain any professional names, occupational names, or personality test result names. Note that the strings containing professional names should include different names of the same professional field, not necessarily standard professional names. This employs synonym matching or fuzzy matching to maximize the sample size.
[0054] 2) Perform entity disambiguation on the professional-related terms, occupation-related terms, and personality test result-related terms processed in 1), so as to unify the naming format of professional and occupational names, and at the same time unify the format of personality test result names. For example, Computer Science and Computer Science and Technology are unified as Computer Science and Technology; and personality test results such as ISTJ and INFP results obtained from MBTI are unified according to the standard names of the corresponding personality tests.
[0055] 3) Since some professional information, career information, and personality test results are published repeatedly in different Wikipedia entries, it is necessary to deduplicate all information data, delete duplicate information data, and obtain the corresponding entry datasets for professional, career, and personality test results, which can then be used as the corresponding personality quality description texts.
[0056] In addition, considering the need to build a knowledge graph later, all standard professional names, all standard occupational names, and all standard personality test result names can be clustered into several major categories of professional names, occupational names, and personality test result names, and then their information can be stored in the database.
[0057] Moreover, in practical applications, users' needs for professional recommendations are often concentrated on popular majors, while less popular majors are generally not included in the recommendation scope. Therefore, in another example of this invention embodiment, the professional recommendation scope only includes popular majors. The selection of popular majors adopts the TextRank algorithm based on Doc2Vec. First, word vectors are trained using Doc2Vec. Compared with the traditional Word2Vec algorithm, it not only considers the semantic information between words, but also the influence of word order on sentences or texts, resulting in a word vector training model. This model can be used to calculate the similarity and adjacency relationship of each word in the major name, occupation name, and personality test result name, respectively, to improve the weight transition probability matrix of the TextRank algorithm. The following describes one method for obtaining popular majors, with the following steps:
[0058] First, all professional names appearing in the encyclopedia corpus containing a large number of professional names are sorted using the TextRank algorithm. In the TextRank algorithm, the edge weight between two standard professional names is corrected by the similarity of the word vector representations of the two professional names. The word vector representation of each professional name is obtained by encoding the encyclopedia entry content of that professional name using Doc2Vec.
[0059] Then, the top-ranked majors with a set proportion are selected from the ranking results as popular majors and included in the major recommendation scope of the knowledge graph.
[0060] It should be noted that both the TextRank algorithm and the Doc2Vec word vector tool are existing technologies. The Doc2Vec word vector tool is mainly used to encode the content of encyclopedia entries for each major to form corresponding word vectors. The word vectors of different majors can be used to represent the similarity between majors by calculating the cosine distance. This similarity will be used to improve the weight transition probability matrix of the original TextRank algorithm. The aforementioned encyclopedia entry corpus containing a large number of major names can be the Wikipedia Chinese corpus with major names as the first-level headings, obtained by filtering according to steps 1) to 3) above. The TextRank algorithm can be used in advance to sort the major names in the effective major information dataset according to their current weights. The weights can be selected by the frequency of the major names appearing in the dataset. Then, major names with weights higher than a certain threshold are selected as popular majors to participate in subsequent clustering, while other non-popular major names are filtered out and do not participate in subsequent clustering. The original weight calculation formula for nodes in the TextRank algorithm is as follows:
[0061]
[0062] In the formula: in(v i ) is a pointer to node i, out(v j ) is the target node originating from node j. ω ji and ω jk This refers to the edge weight between two nodes. The weight mainly consists of two parts: the proportion of the co-occurrence frequency of nodes i and j relative to all nodes connected to node i in the entire text, and the similarity between nodes i and j. WS(V j ) is the weight of node i. d is the damping coefficient, usually taken as 0.85.
[0063] Word vectors converted using the Doc2Vec word vector tool can be used to calculate the distance between node i and node j, which can be considered as the similarity and closeness between two professional names. Vertex v i and vertex v j Weight calculation method between them:
[0064]
[0065] Where: t is the corrected weighting factor, ω ji α represents the number of times words i and j appear together. ji Represents the vertex v calculated by Doc2Vec. i and vertex v j The word vector similarity of the corresponding professional names, for example, using cosine similarity.
[0066] Ultimately, the edge weights between the two standard professional names in the TextRank algorithm were adjusted to:
[0067]
[0068] However, it should be noted that the above-mentioned selection of popular majors is not necessary. It can be set according to the actual needs of major recommendation, or all majors in the major catalog can be included in the recommendation scope.
[0069] The above clustering of professional names can be achieved using spectral clustering. In one example, using spectral clustering, 92 major professional categories, 400 major occupational categories, and 30 categories of personality test results were obtained.
[0070] Additionally, it should be noted that the set of occupations within the above-mentioned recommended scope can be obtained entirely from an occupational directory, or only occupations mentioned in the entries of all professions can be included in the recommended scope, depending on actual business needs and data availability.
[0071] S2. By setting prompt words in the input of the large language model, construct an entity extraction model suitable for completing the task of building a professional recommendation knowledge graph. The prompt words need to include specific reasoning examples. At the same time, the extracted entity and relation categories need to be defined, and the hierarchical output of concepts at each level is required. The format of the output entity attributes also needs to be specified.
[0072] It should be noted that the Large Language Model (LLM) mentioned in this invention can be implemented using commercially available large language models, such as GPT-3.5, GPT-4.0, etc. For ease of batch processing, its corresponding API can be directly called.
[0073] Furthermore, in the embodiments of the present invention, when constructing the entity extraction model in step S2 above, the prompt words in the input of the large language model can be continuously optimized and adjusted to meet the entity extraction task. The key to extracting entities using a large language model is to utilize the three important capabilities of the large language model: In-Context Learning (ICL), instruction following, and Chain-of-Thougt (CoT). Therefore, the present invention can manually supervise the addition of prompts, incorporating specific reasoning steps into the demonstration input's thought process. That is, first define entity and relation categories, then output concepts at each level hierarchically, then specify the output entity attribute format, and finally obtain the optimized large language model, which automatically completes attributes and relations. During this process, the prompts are iteratively optimized based on the feedback from the large model. The optimization and adjustment process is described in detail below:
[0074] S21. First, extract samples from all description texts to be extracted, and manually label the target entities in all description text samples to obtain sample data.
[0075] S22. Add specific reasoning examples to the prompt words of the large language model, define the extracted entity and relation categories, and require the large language model to output concepts at each level. At the same time, specify the entity attribute format that the large language model should output. Then, test the large language model after constructing the prompt words on sample data, and further adjust the prompt words according to the test results until the accuracy of the large language model in extracting text entities reaches the preset requirements. Finally, use the final prompt words in the large language model to construct the entity extraction model.
[0076] Furthermore, since encyclopedia entries generally possess a clear document structure, and this structure often implicitly contains the entities to be extracted, in this embodiment of the invention, the descriptive text input to the large language model needs to be pre-marked using the large language model to represent the document structure. Leveraging the advantages of the large language model in processing massive amounts of data, prompt words are constructed to allow the large language model to determine and label the text levels within the entry content based on hierarchical relationships. The main text of the entry is labeled as level 0, the Nth level heading is labeled as level N (i.e., first-level headings are level 1, second-level headings are level 2, and so on). For example, in the Wikipedia entry on accounting, "accounting" is level 1, "accounting can be divided into several fields, including financial accounting, management accounting, government accounting, and cost accounting, and can also be divided into profit accounting and non-profit accounting" is level 0, and "history" is level 2.
[0077] To facilitate understanding, the following example demonstrates the process of optimizing the prompt word in a large language model:
[0078] 1) In the process of reasoning through thought chain, adding similar examples and specific reasoning steps to the prompt can optimize redundant or missing results.
[0079] Original example: "Computer science encompasses many branches; some emphasize the computation of specific results, such as computer graphics; while others explore the nature of computational problems, such as the theory of computation." Perform named entity recognition and extraction on the above passage.
[0080] Output: "Computer Science", "Computation", "Computer Graphics", "Computation", "Computation Theory".
[0081] The corrected use case for the prompt is: "Computer graphics is the study of digital visual content, involving the composition and manipulation of image data. It is closely related to many other areas of computer science, including computer vision, image processing, computational geometry, and visualization." The named entities in this passage are "computer graphics," "computer science," "computer vision," "image processing," and "computational geometry and visualization." Can you try to analyze the named entities in the passage: "Computer science encompasses many branches; some emphasize the computation of specific results, such as computer graphics; while others explore the nature of computational problems, such as computational theory."
[0082] Outputs: "Computer Science", "Computer Graphics", "Computation Theory".
[0083] 2) Defining entity and relation categories in the prompt can help large language models return results more clearly that are suitable for knowledge graphs;
[0084] Original example: "Computer graphics is the study of digital visual content, involving the synthesis and manipulation of image data. It is closely related to many other areas of computer science, including computer vision, image processing, computational geometry, and visualization." Perform named entity recognition and extraction on this passage.
[0085] Outputs: "Computer Graphics", "Computer Science", "Computer Vision", "Image Processing", "Computational Geometry and Visualization".
[0086] The revised use case is: "Computer graphics is the study of digital visual content, involving the synthesis and manipulation of image data. It is closely related to many other areas of computer science, including computer vision, image processing, computational geometry, and visualization." This passage is categorized by named entity type, and its hierarchical relationships are returned. For example, in "Accounting can be divided into several areas, including financial accounting, management accounting, etc.," the areas of "accounting" are "financial accounting" and "management accounting."
[0087] Output: Fields of "Computer Science": "Computer Vision", "Image Processing", "Computational Geometry and Visualization", "Computer Graphics".
[0088] 3) To enable large language model-assisted augmentation of knowledge graphs, the output attribute format can be specified in the prompt; for example, based on the modified use cases in 2) (using them as input), the prompt should require the return of results in the following format according to the subordinate relationship: [$entity1,$entity2,……], and indicate the subordinate relationship.
[0089] Output: Fields: [Computer Science, Computer Vision], [Computer Science, Image Processing], [Computer Science, Computational Geometry and Visualization], [Computer Science, Computer Graphics].
[0090] 4) The above is a simple example. After performing named entity recognition and extraction on the dataset based on the large language model, the relationships between the four types of entities—professional names, occupational names, personality traits, and personality test results—are supplemented based on the context learning ability of the large language model.
[0091] Once the prompt words for the large language model are optimized, a corresponding entity extraction model can be built based on these prompt words and the large language model's API. For example, based on GPT3.5, an automated script can be written using the API key to implement an entity extraction model capable of batch extracting entities from different terms.
[0092] Furthermore, in the embodiments of this invention, to ensure that the constructed entity extraction model meets the required requirements, after constructing the entity extraction model, a traditional BERT-BiLSTM-CRF architecture entity extraction model can be further used to perform knowledge entity recognition on the professional information dataset and personality test result dataset, obtaining the association information of each knowledge entity. The association information obtained using the traditional BERT-BiLSTM-CRF model is then compared and verified with the association information obtained using the large language model. Once verified, it can be used to perform named entity recognition on the imported remaining professional information data.
[0093] S3. Using the entity extraction model, extract text entities from the text describing the personality traits required for each major, the personality traits required for each occupation, and the personality traits required for each personality test result within the recommended range. Extract the personality traits required for each major, the occupation name suitable for each occupation, the personality traits required for each occupation, and the personality traits possessed by each personality test result.
[0094] Similarly, in this step, if the text describing various personality traits is in the form of term content, it can also be divided into document structures by a large language model, and then the term content is input segment by segment into the entity extraction model for entity extraction. Taking professional term content as an example, for instance, if the input is "In China, Computer Science and Technology is a second-level major under Engineering (first-level category), and people usually work as backend development engineers", then Computer Science and Technology and Backend Development Engineer will be identified and extracted, and the output format will follow the aforementioned definition.
[0095] S4. Using all majors, all occupations, all extracted personality traits entities, and all personality test results within the recommendation scope as nodes of the graph, relationships are added between nodes based on the entity extraction results in S3. The correlation between majors and personality traits, occupations and personality traits, and personality test results and personality traits are obtained according to a multi-level weight algorithm. Finally, personality traits are used as the connection between majors and personality test results to construct a knowledge graph for major recommendation.
[0096] In an embodiment of the present invention, the process of calculating the relevance and constructing a professional recommendation knowledge graph using a multi-level weighting algorithm is as follows:
[0097] S41. For each major, calculate the first frequency of different personality quality entities appearing in the description text of the personality qualities required for the major, and use the first frequency to represent the first degree of correlation between the major and the personality quality.
[0098] S42. For each major, determine the occupational names suitable for that major from the extracted entities. Then, for each occupation suitable for that major, count the second frequency of different personality quality entities appearing in the description text of the personality quality required for that occupation. Use this second frequency to characterize the second correlation between the major and personality quality.
[0099] S43. For each pair of major and personality traits, the first correlation between the major and the personality trait and the second correlation between all occupations suitable for the major and the personality trait are weighted and summed to obtain the final correlation between the major and the personality trait.
[0100] S44. For each personality test result, calculate the third frequency of different personality quality entities in the personality quality description text corresponding to the personality test result, and use the third frequency to characterize the correlation between the corresponding personality test result and personality quality.
[0101] S45. Using all majors, all occupations, all extracted personality traits, and all personality test results as nodes in a graph, based on the entity extraction results in S3, establish edge connections between each major and the occupations suitable for that major, between each major and the personality traits required for that major, between each occupation and the personality traits required for that occupation, and between each personality test result and the personality traits possessed by that personality test result. Simultaneously, assign edge weights to the corresponding nodes based on the final correlation between majors and personality traits obtained in S43, and assign edge weights to the corresponding nodes based on the correlation between personality test results and personality traits obtained in S44. This connects majors and personality test results through personality traits, constructing a major recommendation knowledge graph capable of recommending majors based on personality test results.
[0102] To make it easier to understand, let's take a concrete example to demonstrate the implementation process of the multi-level weighting algorithm described above:
[0103] 1) For each major, classify the personality traits extracted from named entity recognition, and calculate the corresponding correlation degree (0 <= Pi <= 1) based on the frequency of each personality trait appearing in the major information. The formula is:
[0104] Where Xi represents the number of times the i-th personality trait occurs;
[0105] For example, in software engineering, five personality traits can be extracted: resilience, responsibility, initiative, decision-making ability, and communication and collaboration skills. Each trait is assigned a normalized value (0 <= Pi <= 1) based on its frequency of occurrence in entity recognition within software engineering information. The normalization process can be achieved using the frequency of the most frequently occurring personality trait as the denominator. For instance, resilience is calculated to have a normalized value of 1 (unit), responsibility 0.8, initiative 0.4, decision-making ability 0.2, and communication and collaboration ability 0.5. Therefore, according to the aforementioned formula for Pi, the process of calculating the first degree of relevance is as follows:
[0106] Resilience correlation: 1 / (1+0.8+0.4+0.2+0.5)=0.345
[0107] Correlation of responsibility: 0.8 / (1+0.8+0.4+0.2+0.5)=0.276
[0108] Active correlation degree: 0.4 / (1+0.8+0.4+0.2+0.5)=0.138
[0109] Correlation degree of decision-making ability: 0.2 / (1+0.8+0.4+0.2+0.5)=0.070
[0110] Correlation of communication and collaboration skills: 0.5 / (1+0.8+0.4+0.2+0.5)=0.172;
[0111] 2) Based on the occupations suitable for each major extracted through entity recognition, personality trait entities are extracted from the entity recognition results of the corresponding term content (i.e., occupational information) for each occupation. The frequency of each personality trait appearing in the occupational information is counted, and the aforementioned normalized values are calculated to calculate the second degree of association. For example, for software engineering-related occupations such as backend development engineer, the calculated normalized values are: tenacity 1 (unit), responsibility 0.6, initiative 0.4, decision-making ability 0.2, and communication and collaboration ability 0.2. The process of calculating the second degree of association is as follows:
[0112] Resilience correlation: 1 / (1+0.6+0.4+0.2+0.2)=0.417
[0113] Correlation of responsibility: 0.6 / (1+0.6+0.4+0.2+0.2)=0.25
[0114] Active correlation degree: 0.4 / (1+0.6+0.4+0.2+0.2)=0.167
[0115] Correlation degree of decision-making ability: 0.2 / (1+0.6+0.4+0.2+0.2)=0.083
[0116] Correlation of communication and collaboration skills: 0.2 / (1+0.6+0.4+0.2+0.2)=0.083;
[0117] 3) Since it's necessary to calculate the correlation between personality test results and professional fields, we can statistically analyze the frequency of each personality trait appearing in the corresponding terms in the personality test results. Similarly, we can calculate the aforementioned normalized values to determine the correlation between the personality test results and the personality traits. For example, for ISTJ, the calculated normalized values are: tenacity 1, conscientiousness 0.9, initiative 0.3, decision-making ability 0.5, and communication and collaboration ability 0.4. The process for calculating the correlation between the personality test result name and the personality trait is as follows:
[0118] Resilience correlation: 1 / (1+0.9+0.3+0.5+0.4)=0.326
[0119] Correlation of responsibility: 0.9 / (1+0.9+0.3+0.5+0.4)=0.290
[0120] Active correlation degree: 0.3 / (1+0.9+0.3+0.5+0.4)=0.097
[0121] Correlation degree of decision-making ability: 0.5 / (1+0.9+0.3+0.5+0.4)=0.161
[0122] Correlation of communication and collaboration skills: 0.4 / (1+0.9+0.3+0.5+0.4)=0.129;
[0123] 4) The first and second correlations mentioned above reflect the direct and indirect relationships between a major and a personality trait, respectively. Therefore, appropriate weights need to be assigned to both correlations to integrate them. The personality trait descriptions in the major information are more direct, so their weight is 0.7, and the weight of personality traits corresponding to major-related occupations is 0.3. The weighted sum of the first correlation between a major and a personality trait, and the second correlation between all occupations suitable for that major and that personality trait, is taken as the final correlation between the major and that personality trait. Using the example above, the final weighted correlation between the major and the personality trait is as follows:
[0124] Weight: 0.7 * 0.345 + 0.3 * 0.417 = 0.3666
[0125] Resilience: 0.7 * 0.276 + 0.3 * 0.25 = 0.2682
[0126] Sense of responsibility: 0.7 * 0.138 + 0.3 * 0.167 = 0.1467
[0127] Decision-making ability: 0.7 * 0.070 + 0.3 * 0.083 = 0.0739
[0128] Communication and collaboration skills: 0.7 * 0.172 + 0.3 * 0.083 = 0.1453;
[0129] However, it should be noted that the above calculation example only involves the personality traits corresponding to a single major-related occupation. If there are multiple suitable occupations for a certain major, it is necessary to weight the second correlation between all occupations and that personality trait.
[0130] Finally, after obtaining the weighted correlation degree corresponding to all combinations of majors and personality traits from 4), and the correlation degree corresponding to all combinations of personality test results and personality traits from 3), all majors, all occupations, all extracted personality trait entities, and all personality test results can be used as nodes in the graph. Based on the aforementioned entity extraction results, edge connections are established between each major and the occupation suitable for that major, between each major and the personality traits required for that major, between each occupation and the personality traits required for that occupation, and between each personality test result and the personality traits possessed by that personality test result.
[0131] To enable professional recommendations, this knowledge graph requires assigning weights to the edges. As mentioned earlier, the edge weights of corresponding nodes can be assigned based on the final correlation between a professional and personality traits, and the correlation between personality test results and personality traits. Thus, a link can be established between professional and personality test results through personality traits, enabling recommendations of suitable professional careers based on these results. The recommendation method is as follows: using the user's personality test results as query conditions, all professional careers connected to the personality test results via the shortest path from the professional recommendation knowledge graph are retrieved as recommended careers. The product of the edge weights of all edges along each shortest path between the personality test results and each recommended career is calculated (i.e., multiplying the edge weights of all edges along a path). The sum of these shortest path weight products is then used as the comprehensive correlation between the personality test results and the recommended career. This comprehensive correlation represents the probability of a career recommendation corresponding to the current personality test result.
[0132] Taking the aforementioned example, the calculation method for the overall relevance between software engineering and ISTJ is as follows:
[0133]
[0134] Of course, the above calculation method is only an idealized example. The actual results involve more personality traits and occupations, and the calculation process is more complex.
[0135] Therefore, once the aforementioned knowledge graph is completed, a professional query and recommendation system based on a large language model and knowledge graph can be constructed to achieve professional recommendations based on personality test results, such as... Figure 3 As shown, the functional modules of this system include:
[0136] The personality test module is used to obtain the user's personality test results;
[0137] The knowledge graph module is used to store the professional recommendation knowledge graphs constructed according to the aforementioned construction method;
[0138] The professional recommendation module uses the user's personality test results as query conditions. It retrieves all professions connected to the personality test results via the shortest path from the professional recommendation knowledge graph as recommended professions. It calculates the product of the edge weights of all edges on each shortest path between the personality test results and each recommended profession. The sum of the edge weight products of all shortest paths is taken as the comprehensive relevance between the personality test results and the recommended profession. All recommended professions are sorted in descending order according to the comprehensive relevance and returned as the recommendation results to the user. The knowledge graph is then visualized according to the business display logic.
[0139] Furthermore, in embodiments of the present invention, each entity, relationship, and the degree of association are stored in the Neo4j database, and the professional recommendation knowledge graph is visualized on the front end using the Neo4j visualization tool based on the Neo4j database. After the system is built, it can retrieve the corresponding return data from the professional recommendation knowledge graph through the interaction of the backend Neo4j for the instructions entered by the user in the front end interface, and display it on the front end interface.
[0140] The commands entered by the user on the front-end interface here are query commands or operation commands. In this embodiment of the invention, the input query commands include:
[0141] A) By taking a personality test, you can obtain the personality test results and then look up the corresponding recommended majors. For example, after taking the MBTI, Holland Occupational Personality Test, and Multiple Intelligences Test, the test results, based on the major recommendation map analysis, indicate that you are hardworking, proactive, and have excellent comprehension skills, resulting in recommended majors such as Computer Science and Technology, Software Engineering, and Electronic Information.
[0142] B) Searching by major name will yield corresponding occupations and personality traits. For example, entering "Computer Science and Technology" will display related occupations such as backend development engineer and algorithm engineer, and related personality traits such as perseverance, responsibility, initiative, decision-making ability, communication and collaboration ability, and comprehension ability.
[0143] In addition, the input operation commands in this embodiment of the invention include:
[0144] Data is extracted from Neo4j and visualized using EachArts relationship graphs; nodes of the knowledge graph are collapsed and expanded in the graph display space, and the layout of the relationship network of the knowledge graph is adjusted by dragging; specific attributes such as correlation degree are viewed by clicking on nodes or edges of the graph.
[0145] In an example of an embodiment of the present invention, Figure 3 The example demonstrates the display effect of the professional-personality test results of the present invention, in which textual information is not important, and only the display status is shown through graphs. Figure 4 The example illustrates the professional, occupational, and personality traits displayed by the present invention, where textual information is not important and the display effect is only shown through the diagrams.
[0146] Similarly, based on the same inventive concept, another preferred embodiment of the present invention also provides a computer electronic device corresponding to the professional recommendation method based on large language model and knowledge graph provided in the above embodiments, which includes a memory and a processor;
[0147] The memory is used to store computer programs;
[0148] The processor is configured to, when executing the computer program, implement the professional recommendation method based on large language models and knowledge graphs as described above, or the professional query recommendation system based on large language models and knowledge graphs as described above.
[0149] Furthermore, the logical instructions in the aforementioned memory can be implemented as software functional units and, when sold or used as independent products, can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, or a portion of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present invention.
[0150] Therefore, based on the same inventive concept, another preferred embodiment of the present invention also provides a computer-readable storage medium corresponding to the professional recommendation method based on large language models and knowledge graphs provided in the above embodiments. The storage medium stores a computer program, which, when executed by a processor, can realize the professional recommendation method based on large language models and knowledge graphs as described above, or the professional query recommendation system based on large language models and knowledge graphs as described above.
[0151] It is understood that the aforementioned storage media may include random access memory (RAM) or non-volatile memory (NVM), such as at least one disk storage device. Furthermore, the storage media may also be various media capable of storing program code, such as USB flash drives, external hard drives, magnetic disks, or optical discs.
[0152] It is understood that the processors mentioned above can be general-purpose processors, including central processing units (CPUs), network processors (NPs), etc.; they can also be digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components.
[0153] It should also be noted that those skilled in the art will understand that, for the sake of convenience and brevity, the specific working process of the system described above can be referred to the corresponding process in the foregoing method embodiments, and will not be repeated here. In the embodiments provided in this application, the division of steps or modules in the system and method is merely a logical functional division, and there may be other division methods in actual implementation. For example, multiple modules or steps may be combined or integrated together, and a module or step may also be split.
[0154] The embodiments described above are merely preferred embodiments of the present invention and are not intended to limit the invention. Those skilled in the art can make various changes and modifications without departing from the spirit and scope of the invention. Therefore, all technical solutions obtained through equivalent substitution or transformation fall within the protection scope of the present invention.
Claims
1. A method for constructing a professional recommendation knowledge graph based on a large language model, characterized in that, The steps are as follows: S1: For each major within the recommended range, obtain the standard major name and the text describing the personality traits required for that major; for each occupation within the recommended range, obtain the standard occupation name and the text describing the personality traits required for that occupation; for each possible result in the personality test, obtain its standard personality test result name and the text describing the personality traits corresponding to that personality test result. S2. By setting prompt words in the input of the large language model, construct an entity extraction model suitable for completing the task of building a professional recommendation knowledge graph. The prompt words need to include specific reasoning examples. At the same time, the extracted entity and relation categories need to be defined and hierarchical output of concepts at each level is required. The format of the output entity attributes also needs to be specified. S3. Using the entity extraction model, extract text entities from the text describing the personality traits required for each major, the personality traits required for each occupation, and the personality traits required for each personality test result within the recommended range. Extract the personality traits required for each major, the occupation name suitable for each occupation, the personality traits required for each occupation, and the personality traits possessed by each personality test result. S4. Take all majors, all occupations, all extracted personality quality entities, and all personality test results within the recommendation range as nodes of the graph. Based on the entity extraction results in S3, add relationships between nodes and obtain the correlation between majors and personality qualities, occupations and personality qualities, and personality test results and personality qualities according to the multi-level weight algorithm. Finally, use personality qualities as the connection between majors and personality test results to construct a knowledge graph for major recommendation. When constructing the entity extraction model in S2, the prompt words in the input of the large language model need to be continuously optimized and adjusted to meet the entity extraction task. The optimization and adjustment process is as follows: S21. First, extract samples from all description texts to be extracted, and manually label the target entities in all description text samples to obtain sample data. S22. Add specific reasoning examples to the prompt words of the large language model, define the extracted entity and relation categories, and require the large language model to output concepts at each level. At the same time, specify the entity attribute format that the large language model should output. Then, test the large language model after constructing the prompt words on sample data, and further adjust the prompt words according to the test results until the accuracy of the large language model in extracting text entities reaches the preset requirements. Finally, use the final prompt words in the large language model to construct the entity extraction model. The process of calculating the relevance and constructing the professional recommendation knowledge graph using the multi-level weighting algorithm is as follows: S41. For each major, calculate the first frequency of different personality quality entities appearing in the description text of the personality qualities required for the major, and use the first frequency to represent the first degree of correlation between the major and the personality quality. S42. For each major, determine the occupational names suitable for that major from the extracted entities. Then, for each occupation suitable for that major, count the second frequency of different personality quality entities appearing in the description text of the personality quality required for that occupation. Use this second frequency to characterize the second correlation between the major and personality quality. S43. For each pair of major and personality traits, the first correlation between the major and the personality trait and the second correlation between all occupations suitable for the major and the personality trait are weighted and summed to obtain the final correlation between the major and the personality trait. S44. For each personality test result, calculate the third frequency of different personality quality entities in the personality quality description text corresponding to the personality test result, and use the third frequency to characterize the correlation between the corresponding personality test result and personality quality. S45. Using all majors, all occupations, all extracted personality traits, and all personality test results as nodes in the graph, based on the entity extraction results in S3, establish edge connections between each major and the occupations suitable for that major, between each major and the personality traits required for that major, between each occupation and the personality traits required for that occupation, and between each personality test result and the personality traits possessed by that personality test result. Simultaneously, assign edge weights to the corresponding nodes based on the final correlation between majors and personality traits obtained in S43, and assign edge weights to the corresponding nodes based on the correlation between personality test results and personality traits obtained in S44. This connects majors and personality test results through personality traits, constructing a major recommendation knowledge graph capable of recommending majors based on personality test results.
2. The method for constructing a professional recommendation knowledge graph based on a large language model as described in claim 1, characterized in that, The text describing the personality traits required for the major, the personality traits required for the profession, and the personality traits corresponding to the personality test results are all derived from the entries on the encyclopedia website. The entries need to undergo text preprocessing to meet the input requirements for entity extraction. The personality test is one or more of the MBTI test, Holland Occupational Personality Test, and Multiple Intelligences Test.
3. The method for constructing a professional recommendation knowledge graph based on a large language model as described in claim 2, characterized in that, The descriptive text input to the large language model needs to be pre-marked with the document structure using the large language model. Taking advantage of the large language model's ability to process massive amounts of data, prompt words are constructed to allow the large language model to determine and label the text level in the term content based on the subordinate relationship. The main text in the term content is labeled as level 0, and the Nth level heading in the term content is labeled as level N.
4. The method for constructing a professional recommendation knowledge graph based on a large language model as described in claim 1, characterized in that, In step S4, each entity, relation, and degree of association are stored in the Neo4j database, and the professional recommendation knowledge graph is visualized on the front end using the Neo4j visualization tool based on the Neo4j database.
5. The method for constructing a professional recommendation knowledge graph based on a large language model as described in claim 4, characterized in that, All standard professional names, all standard occupational names, and all standard personality test result names need to be clustered separately to form several major categories of professional names, occupational names, and personality test result names, and then stored in the database.
6. The method for constructing a professional recommendation knowledge graph based on a large language model as described in claim 5, characterized in that, The recommended majors are limited to popular majors, which are obtained as follows: First, all professional names appearing in the encyclopedia corpus containing a large number of professional names are sorted using the TextRank algorithm. In the TextRank algorithm, the edge weight between two standard professional names is corrected by the similarity of the word vector representations of the two professional names. The word vector representation of each professional name is obtained by encoding the encyclopedia entry content of that professional name using Doc2Vec. Then, the top-ranked majors with a set proportion are selected from the ranking results as popular majors and included in the major recommendation scope of the knowledge graph.
7. A professional query and recommendation system based on a large language model and knowledge graph, characterized in that, include: The personality test module is used to obtain the user's personality test results; The knowledge graph module is used to store the professional recommendation knowledge graph constructed according to any one of the construction methods described in claims 1 to 6; The professional recommendation module uses the user's personality test results as query conditions. It retrieves all professions connected to the personality test results via the shortest path from the professional recommendation knowledge graph as recommended professions. It calculates the product of the edge weights of all edges on each shortest path between the personality test results and each recommended profession. The sum of the edge weight products of all shortest paths is taken as the comprehensive relevance between the personality test results and the recommended profession. All recommended professions are sorted in descending order according to the comprehensive relevance and returned as the recommendation results to the user. The knowledge graph is then visualized according to the business display logic.
8. A computer electronic device, characterized in that, Including memory and processor; The memory is used to store computer programs; The processor is configured to, when executing the computer program, implement the professional recommendation method based on a large language model and knowledge graph as described in any one of claims 1 to 6, or implement the professional query recommendation system based on a large language model and knowledge graph as described in claim 7.
Citation Information
Patent Citations
Professional recommendation method and device based on discipline, computer equipment and storage medium
CN111639256A