Power marketing business large model corpus matching method and device
By constructing hollow spherical word vector space and an improved multi-pattern matching method, the problems of deep knowledge and search efficiency of big model in power marketing business are solved, and fast and accurate retrieval feedback is achieved to meet the efficient needs of power marketing business.
Patent Information
- Application Number
- CN202411885644.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-20
- Publication Date
- 2025-04-25
AI Technical Summary
In the field of power marketing business professionals, it is difficult for the existing technology to effectively improve the depth, accuracy and timeliness of large models in vertical services. Especially in the search of massive business model series, the traditional multi-pattern matching method is inefficient and difficult to meet the needs of power marketing business.
The hollow spherical word vector space is constructed through vector spatial positioning and vector space center optimization methods, and the improved multi-pattern matching method is used to combine disadvantaged character rules and excellent prefix rules to achieve the rapid retrieval feedback function.
While ensuring the accuracy of matching, the search speed is significantly improved, and the vocabulary of related power marketing business can be quickly screened out, matching efficiency can be improved, and rapid search needs of power marketing business.
Smart Images

Figure CN119884305A_ABST
Abstract
Description
Technical Field
[0001] The invention relates to a method and a device for matching a large model corpus of an electric power marketing business, and belongs to the technical field of intelligent corpus of an electric power marketing business. Background Art
[0002] Focusing on the underlying technology of generative artificial intelligence, vector databases play an important role in building various artificial intelligence applications based on large language models. Although large models can answer general questions, their knowledge depth, accuracy and timeliness are limited in vertical field services such as power marketing business. In order to solve this problem, vector databases are widely used in the market to combine large models and proprietary knowledge assets to build intelligent services in vertical fields, and their retrieval quality and efficiency directly affect the service effect. At present, the retrieval logic of traditional text retrieval is to obtain the corresponding results by inputting marketing business keywords and the text to be retrieved for pattern matching. When there are multiple keywords, retrieval can be achieved through multi-pattern matching algorithms. In traditional multi-pattern matching algorithms, the keywords to be retrieved are pattern strings. However, in the scenario of massive business pattern strings in power marketing, if the multi-pattern matching method is used alone for retrieval, its efficiency is still low and it is difficult to meet the needs of power marketing business. Summary of the invention
[0003] The purpose of the present invention is to provide a method and device for matching a large model corpus of power marketing business, which realizes a rapid retrieval and feedback function for the power marketing business corpus through vector space positioning, vector space center optimization and improved multi-mode matching method, and can effectively improve the retrieval speed while ensuring the accuracy of relevant data matching.
[0004] In order to achieve the above purpose / solve the above technical problems, the present invention is implemented by adopting the following technical solutions:
[0005] In a first aspect, the present invention provides a method for matching a large model corpus of a power marketing business, comprising the following steps:
[0006] Generate a word vector database based on text data in the power marketing business corpus;
[0007] Mapping the word vectors in the word vector database to a spherical space, optimizing the range of the spherical space using a word vector space positioning method and a vector space optimization method, and obtaining a hollow spherical word vector space;
[0008] Generate a word vector to be searched according to the acquired power marketing business question and the hollow spherical word vector space;
[0009] Using an improved multi-mode matching method, the word vector to be searched is matched with the word vector database to obtain a matching result;
[0010] An answer to the power marketing business question is generated according to the matching result.
[0011] In combination with the first aspect, further, mapping the word vectors in the word vector database to a spherical space, optimizing the range of the spherical space using a word vector space positioning method and a vector space optimization method, and obtaining a hollow spherical word vector space, includes:
[0012] The word vectors in the word vector database are mapped to a spherical space through the Word2Vec model, and the coordinates of each word vector in the spherical space are obtained;
[0013] According to the coordinates of all word vectors in the spherical space in the word vector database, the initial space center is calculated using the word vector space positioning method;
[0014] According to the distance from each word vector in the word vector database to the center of the space, the word vector closest to and farthest from the center of the space is obtained, and the closest distance and farthest distance are obtained;
[0015] The spatial center is optimized using the vector space optimization method to obtain the optimal spatial center, and the farthest distance and the shortest distance are updated according to the optimal spatial center;
[0016] The hollow spherical word vector space is obtained according to the coordinates of the optimal space center, the closest distance and the farthest distance.
[0017] Combined with the first aspect, further, the coordinates of the center of the space are L={L1, L2,…,L n},in, Represents the coordinate value of the jth dimension of the space center, j=1,2,…,n, n is the total number of dimensions of the space center coordinates; The calculation formula is as follows:
[0018] ;
[0019] Among them, p ij It represents the j-th dimension coordinate value of the i-th word vector, and m is the total number of word vectors in the word vector database.
[0020] In combination with the first aspect, further, optimizing the space center by using the vector space optimization method to obtain the optimal space center, and updating the farthest distance and the shortest distance according to the optimal space center, includes:
[0021] Initialize the iteration intermediate quantity E, iteration step length step and iteration termination threshold eplse;
[0022] Suppose the word vector farthest from the center of the space is M2, and the distance between the word vector M2 and the center of the space L is the farthest distance fin2. Subtract the coordinate value of each dimension of the word vector M2 from the coordinate value of the same dimension in the current center of the space L, and divide it by the farthest distance fin2 to obtain the optimization parameter of the dimension. The calculation formula is as follows:
[0023] ;
[0024] in, is the optimization parameter of the jth dimension, is the j-th dimension coordinate value of the word vector M2 farthest from the center of the space, Represents the coordinate value of the j-th dimension of the space center j=1,2,…,n, where n is the total number of dimensions of the space center coordinates;
[0025] According to the optimization parameters of n dimensions, the total optimization parameters are obtained ;
[0026] Add the total optimization parameter to the coordinates of the current space center to obtain the coordinates of the new space center;
[0027] According to the coordinates of the new space center, update the word vector M1 closest to the space center, the closest distance fin1, the word vector M2 farthest from the space center, and the farthest distance fin2;
[0028] The distance between the two spatial centers before and after the update is calculated according to the Euclidean distance calculation formula, which is recorded as the iterative intermediate quantity E. If the iterative intermediate quantity E is less than the iteration termination threshold eplse, the iteration is stopped, and the updated spatial center is used as the optimal spatial center. The optimal spatial center, the nearest distance fin1, and the farthest distance fin2 are output; if the iterative intermediate quantity E is not less than the iteration termination threshold eplse, the iteration is continued and the optimization parameters are recalculated.
[0029] In combination with the first aspect, further, a hollow spherical word vector space is generated with the optimal space center as the sphere center, the closest distance fin1 as the inner radius, and the farthest distance fin2 as the outer radius.
[0030] In combination with the first aspect, further, generating a to-be-searched word vector according to the acquired power marketing business question and the hollow spherical word vector space includes:
[0031] Preprocessing the acquired power marketing business questions to obtain a plurality of power marketing business vocabulary, wherein the preprocessing includes word segmentation and stop word removal;
[0032] The Word2Vec model is used to convert the power marketing business vocabulary into word vector form and map it to the hollow spherical word vector space to obtain multiple initial word vectors to be retrieved;
[0033] Calculate the distance between each initial word vector to be searched and the center of the hollow spherical word vector space, and compare it with the closest distance fin1 and the farthest distance fin2 to determine whether the initial word vector to be searched exists in the hollow spherical word vector space;
[0034] If the initial word vector to be retrieved exists in the hollow spherical word vector space, the initial word vector to be retrieved is used as the word vector to be retrieved.
[0035] In combination with the first aspect, further, the using of the improved multi-mode matching method to match the to-be-searched word vector with the word vector database to obtain a matching result includes:
[0036] Take the word vector to be searched as the pattern string and build a pattern tree based on all the word vectors to be searched;
[0037] Take any word vector in the word vector database as a text string, right-align the pattern tree with the text string, and start matching from the rightmost character of the text string;
[0038] When characters do not match, the inferior character rule and the superior prefix rule are used to determine the pattern tree jump distance, and the pattern tree is manipulated to move to the left of the text string as a whole according to the pattern tree jump distance;
[0039] If the pattern tree still cannot match successfully after jumping to the leftmost character of the text string, the next word vector in the word vector database is selected and the matching operation is repeated until the match is successful.
[0040] In combination with the first aspect, further, the disadvantaged character rule is:
[0041] When the characters at the same position in the current pattern string and the text string do not match, the unmatched characters are recorded as mismatched characters, and the mismatched characters are searched from left to right in other pattern strings according to the structure of the pattern tree; if there are mismatched characters in other pattern strings, the pattern tree is moved to the left side of the text string according to the position of the mismatched characters in other pattern strings, so that the positions of the mismatched characters in other pattern strings and the text string are aligned; if there are no mismatched characters in other pattern strings, the pattern tree is moved to the left side of the text string by the length of the shortest pattern string, where the shortest pattern string refers to the pattern string with the shortest length in the pattern tree.
[0042] In combination with the first aspect, further, the good prefix rule is:
[0043] When the characters at the same position in the current pattern string and the text string do not match, the unmatched characters are recorded as mismatched characters; if there is a root node in the pattern tree that has matched a substring in the text string, the pattern tree is moved to the left of the text string until the root node of the pattern tree is aligned with the position of the matched substring in the text string, and the pattern tree jump distance does not exceed the length of the shortest pattern string.
[0044] In a second aspect, the present invention provides a large model corpus matching device for power marketing business, comprising:
[0045] A database module, used to generate a word vector database based on text data in the power marketing business corpus;
[0046] A space module is used to map the word vectors in the word vector database to a spherical space, and optimize the range of the spherical space by using a word vector space positioning method and a vector space optimization method to obtain a hollow spherical word vector space;
[0047] A preprocessing module, used for generating a to-be-searched word vector according to the acquired power marketing business question and the hollow spherical word vector space;
[0048] A matching module, used to match the word vector to be searched with the word vector database using an improved multi-mode matching method to obtain a matching result;
[0049] An answer module is used to generate answers to the questions asked about the power marketing business based on the matching results.
[0050] Compared with the prior art, the present invention has the following beneficial effects:
[0051] The present invention proposes a method and device for matching a large model corpus of an electric power marketing business. A hollow spherical vector space is constructed through vector space positioning and vector space center optimization methods. The range of the hollow spherical vector space is equivalent to the matching range of a word vector database. By distance comparison, matching electric power marketing business vocabulary can be quickly screened out from electric power marketing business questions, and word vectors to be retrieved are generated. Then, an improved multi-mode matching method is used to match the word vectors to be retrieved with the word vector database. During the matching process, the entire pattern tree is moved through inferior character rules and superior prefix rules to improve matching efficiency, realize a rapid retrieval feedback function for the electric power marketing business corpus, and ensure matching accuracy while improving matching speed. BRIEF DESCRIPTION OF THE DRAWINGS
[0052] Figure 1 The figure shows a schematic diagram of the steps of a method for matching a large model corpus of a power marketing business provided by the present invention;
[0053] Figure 2 FIG. 1 is a schematic diagram of compressing a word vector in a spherical space to a two-dimensional plane in an embodiment of the present invention;
[0054] Figure 3 The figure shows a schematic diagram of the moving trajectory during the spatial center optimization process in an embodiment of the present invention;
[0055] Figure 4It is a schematic diagram of the movement pattern tree based on the inferior character rule in an embodiment of the present invention;
[0056] Figure 5 It is a schematic diagram of a pattern tree after moving based on the inferior character rule in an embodiment of the present invention;
[0057] Figure 6 It is a schematic diagram of a moving pattern tree based on a good prefix rule in an embodiment of the present invention;
[0058] Figure 7 It is a schematic diagram of a moving pattern tree based on a good prefix rule in an embodiment of the present invention;
[0059] Figure 8 The figure is a schematic diagram showing the comparison of the matching results of the method of the present invention and the traditional multi-mode matching method in an embodiment of the present invention;
[0060] Fig. 9 Shown is a structural schematic diagram of a large model corpus matching device for power marketing business provided by the present invention. DETAILED DESCRIPTION
[0061] The technical solution of the present invention is described in detail below through the accompanying drawings and specific embodiments. It should be understood that the embodiments of the present invention and the specific features in the embodiments are detailed descriptions of the technical solution of the present invention, rather than limitations on the technical solution of the present invention. The embodiments of the present invention and the technical features in the embodiments may be combined with each other unless there is a conflict.
[0062] Example 1
[0063] This embodiment introduces a method for matching a large model corpus of power marketing business. Figure 1 As shown, the specific steps include:
[0064] Step A: Generate a word vector database based on the text data in the large model corpus of the power marketing business.
[0065] In an embodiment of the present invention, text data in a large model corpus of the power marketing business is preprocessed to obtain a plurality of power marketing business keywords, the preprocessing includes operations such as text cleaning, word segmentation, and stop word removal, the power marketing business keywords are processed using a Word2Vec model, a plurality of word vectors are constructed and generated, and a word vector database is generated using the plurality of word vectors.
[0066] Step B: Map the word vectors in the word vector database to a spherical space, calculate the spatial center of the spherical space using the word vector space positioning method, and optimize the spatial center of the spherical space using the vector space optimization method. Optimize the range of the spherical space according to the distance between the word vector in the word vector database and the spatial center to obtain a hollow spherical word vector space.
[0067] Step B01, map the word vectors in the word vector database to a spherical space through the Word2Vec model to obtain the coordinates of each word vector in the word vector database in the spherical space.
[0068] Step B02: Calculate the initial space center according to the coordinates of all word vectors in the word vector database in the spherical space.
[0069] Suppose the word vector database has a total of m word vectors, and the coordinates of the i-th word vector in the word vector database are P i ={ p i1 ,p i2 ,…,p in}, where p ij Represents the j-th dimension coordinate value of the ith word vector, j=1,2,…,ni, ni represents the total number of dimensions of the ith word vector. In the embodiment of the present invention, since different power marketing business keywords have different numbers of characters, the dimensions of the word vectors obtained after processing using the Word2Vec model are also different.
[0070] Add the coordinate values of the same dimension in all word vectors and divide them by the corresponding dimension to obtain the coordinate value of the dimension at the center of the initial space. The formula is as follows:
[0071] (1)
[0072] in, Represents the coordinate value of the j-th dimension of the center of the initial space.
[0073] The coordinates of the center of the space are L={L1, L2,…,L n}.
[0074] Step B03: According to the distance from each word vector in the word vector database to the center of the space, obtain the word vector closest to and farthest from the center of the space.
[0075] First, define a maximum value fin1=MAX_VALUE and a minimum value fin2=-1 to ensure that the algorithm can correctly initialize and update key variables and perform optimization and search effectively.
[0076] The Euclidean distance principle is used to calculate the distance from each word vector to the center of the space. The calculation formula is as follows:
[0077] (2)
[0078] in, is the distance from the i-th word vector to the center of the space L.
[0079] Sort all word vectors according to their distance, and select the word vector closest to the center of the space, denoted as M1, the closest distance Recorded as fin1, at the same time, select the word vector farthest from the center of the space, recorded as M2, the farthest distance Denoted as fin2.
[0080] Step B04, the present invention uses the closest distance fin1 as the radius to construct a spherical space, which does not contain any word vectors; then uses the farthest distance fin2 as the radius to construct a spherical space, and wraps the spherical space with fin1 as the radius, so as to obtain a spherical space with a hollow center. Theoretically, all word vectors in the word vector database exist in the hollow spherical space with the center, but in the actual process, if the space center is not calculated properly, the range of the hollow spherical space with the center will be inaccurate. Therefore, in order to divide the space area more accurately, the present invention uses the vector space optimization method to continuously move the space center position to obtain the optimal space center.
[0081] (1) Initializing iteration parameters, including: iterative intermediate quantity E = MAX_VALUE, the iterative intermediate quantity represents the distance between the spatial centers obtained by two iterations. In the initialization stage, the present invention assigns a larger value to the iterative intermediate quantity E; iterative step length step = 1e-5; and iterative termination threshold eplse = 1e-8.
[0082] (2) Traverse each word vector P in the space i For each dimension j, subtract the coordinate value of the corresponding dimension in the current space center from the value of each dimension farthest from the center, and divide it by the farthest distance fin2 to obtain the optimization parameter Y of the dimension j , the specific calculation formula is as follows:
[0083] (3)
[0084] in, is the optimization parameter of the jth dimension, is the j-th dimension coordinate value of the word vector M2 farthest from the center of the space.
[0085] The total optimization parameter Y is obtained according to the optimization parameters of n dimensions.
[0086] (3) Add the total optimization parameter to the coordinates of the current space center to obtain the coordinates of the new space center, that is, L = L + Y.
[0087] (4) According to the coordinates of the new spatial center, update the word vector M1 closest to the spatial center, the closest distance fin1, the word vector M2 farthest from the spatial center, and the farthest distance fin2.
[0088] (5) Calculate the distance between the two spatial centers before and after the update according to the Euclidean distance calculation formula, denoted as E. If E is less than the iteration termination threshold eplse, stop the iteration, take the latest spatial center as the optimal spatial center, and output the optimal spatial center, the closest distance fin1, and the farthest distance fin2; if E is not less than the iteration termination threshold eplse, return to step (2).
[0089] Step B05: Obtain a hollow spherical word vector space according to the optimal spatial center position, the closest distance fin1 and the farthest distance fin2.
[0090] The embodiments of the present invention verify the effectiveness of the vector space positioning and vector space optimization methods through the following test experiments. Taking the marketing business keywords "electricity marketing", "electricity bill settlement", "customer relationship management", "demand side management", "smart meter", "load forecasting", "electricity consumption information collection", "energy efficiency management", "market research", "electricity price strategy", "contract energy management", "electricity trading", "value-added services", "power supply reliability", and "line loss management" as examples, the corresponding word vectors are constructed. First, the vector space positioning method is used to obtain the initial center of these word vectors, which is recorded as a, and the word farthest from a is found: "power supply reliability", which is recorded as b. In this way, a spherical space is constructed. For the convenience of display, these word vectors are compressed to a two-dimensional plane, such as Figure 2 shown.
[0091] After obtaining the initial spatial center and the farthest distance, on the premise of wrapping all word vectors, the area surrounded by the spherical space is reduced as much as possible to reduce time consumption, thereby improving retrieval efficiency. In order to obtain the optimal spatial center, a is continuously moved to b through the vector space optimization method. After each movement of the spatial center, a new word b is generated that is farthest from a by comparing the Euclidean distance between the spatial center and each word. After several iterations of this experiment, "line loss management" became the business word farthest from a. The center records its position once after each fixed number of iterations. The movement trajectory of the center is shown in the figure below. Figure 3 As shown, c1 represents the initial center and c2 represents the final center.
[0092] Step C: Generate a word vector to be retrieved based on the power marketing business question input into the system and the hollow spherical word vector space obtained in step B.
[0093] Step C01: pre-process the power marketing business questions input into the system (including word segmentation, stop word removal, etc.) to obtain a plurality of power marketing business vocabulary.
[0094] Step C02: Use the Word2Vec model to convert the power marketing business vocabulary into word vector form and map it to the hollow spherical word vector space, which is recorded as the initial word vector to be retrieved.
[0095] Step C03, calculate the distance from each initial word vector to be searched to the space center of the hollow spherical word vector space, and compare it with the nearest distance fin1 and the farthest distance fin2 to determine whether the initial word vector to be searched exists in the hollow spherical word vector space. If it exists in the hollow spherical word vector space, it will enter the next step as the word vector to be searched. If it does not exist in the hollow spherical word vector space, it means that the initial word vector to be searched does not belong to the keyword to be searched and is deleted.
[0096] The present invention quickly screens keywords that need to be searched through a hollow spherical word vector space, which is beneficial to improving search efficiency.
[0097] Step D: Use the improved multi-mode matching method to match the word vector to be retrieved with the word vector database to obtain a matching result.
[0098] The present invention combines the automaton AC algorithm with the BM algorithm to propose an improved multi-mode matching method. The method fully utilizes the advantages of "inferior characters" and "excellent suffixes" of the BM method, and can skip unnecessary fields in the document string as much as possible, thereby speeding up the matching and retrieval speed. The specific operation of step D is as follows:
[0099] Step D01: construct a pattern tree based on the word vector to be searched.
[0100] The present invention converts the vector of the word to be searched into a pattern string, and then adds each character from each pattern string to a pattern tree from front to back to form a tree structure.
[0101] Step D02, for any word vector in the word vector database, record it as a text string, right-align the pattern tree with the text string, and start matching from the rightmost character of the text string. When encountering character mismatches, use the inferior character rule and the superior prefix rule to determine the pattern tree jump distance, manipulate the pattern tree as a whole to move to the left of the text string according to the pattern tree jump distance, and continue matching. If the match still fails after jumping to the leftmost character of the text string, select the next word vector in the word vector database and repeat the matching operation until the match is successful.
[0102] Different from the BM algorithm, the improved multi-pattern matching method matches by moving the entire pattern tree. Since the match starts from the rightmost side of the text, the two rules of "inferior characters" and "excellent prefixes" are used to guide the jump problem in the matching process, and multiple characters can be jumped at one time.
[0103] In the embodiment of the present invention, the inferior character rule is as follows: if a character in a certain pattern string does not match a character in a text string during the matching process, it is necessary to move according to the structure of the pattern tree so as to find a character in the remaining pattern strings that matches the current text string as quickly as possible, and then move the pattern tree to the left to align the characters. If the current mismatched character does not exist in other pattern strings, the pattern tree is moved to the left by the length of the shortest pattern string.
[0104] The following is an example to illustrate this. Assume that the pattern string set P = {tried, time, tiring, tinted, tinsel}, and the text string to be matched is T = "timeisonmyside". The shortest pattern string in P is "time", which has a length of 4. Therefore, "time" is right-aligned with the text string, such as Figure 4 As shown in the figure, after alignment, the algorithm finds through matching that the character 't' in the pattern tree and the character 's' in the text string do not match, and the mismatched character is 's'; the algorithm tries to find the character 's' in the remaining pattern strings of the pattern tree, and the next 's' exists in the pattern string "tinsel". Since it takes 3 characters to move from the character "t" to the character "s", the pattern tree is moved 3 characters to the left as a whole. After the movement, Figure 5 shown.
[0105] In the embodiment of the present invention, the good prefix rule is as follows: during the matching process, if the characters of a certain pattern string do not match the characters in the text string, the pattern tree will be moved according to the successfully matched substring. Specifically, the pattern tree is moved to the left until the root node of the pattern tree is aligned with the matched substring in the text string, and the longest moving distance of the pattern tree cannot exceed the length of the shortest pattern string.
[0106] The following is an example to illustrate this. Assume that the pattern string set P = {tired, tiring, time, tomato, tornado}, and the text string T = "automaton". The shortest pattern string in P is "time", with a length of 4. "time" is right-aligned with the text string, such as Figure 6 As shown in the figure, after the shortest pattern string in the pattern tree is right-aligned with the text string, it is found that the substring "to" of the pattern string "tomato" matches the text string, so the pattern tree is shifted left by 4 characters to align the next "to" in the text string with the pattern tree, as shown in the figure. Figure 7 shown.
[0107] Step E: Answers to questions about the power marketing business may be generated based on the matching results.
[0108] In order to verify the effect of the method of the present invention, the embodiment of the present invention uses the traditional multi-mode matching method and the method of the present invention to match and retrieve the same power marketing business question. The results are as follows: Figure 8 As shown, from Figure 8 It can be seen that when faced with the same power marketing business questions, the present invention can complete matching retrieval more quickly, effectively improving retrieval efficiency.
[0109] Example 2
[0110] Based on the same inventive concept as Example 1, this example introduces a large model corpus matching device for power marketing business, such as Fig. 9 As shown, it includes a database module, a space module, a preprocessing module, a matching module and an answer module.
[0111] The database module is used to generate a word vector database based on the text data in the power marketing business corpus.
[0112] The space module is used to map the word vectors in the word vector database to a spherical space, and optimize the range of the spherical space using the word vector space positioning method and the vector space optimization method to obtain a hollow spherical word vector space.
[0113] The preprocessing module is used to generate the word vector to be retrieved according to the acquired power marketing business questions and the hollow spherical word vector space.
[0114] The matching module is used to match the word vector to be retrieved with the word vector database using an improved multi-mode matching method to obtain a matching result.
[0115] The answer module is used to generate answers to questions raised by the power marketing business based on the matching results.
[0116] The specific functional implementation of each of the above modules can be found in the relevant contents of the method in Example 1 and will not be elaborated here.
[0117] To summarize the above embodiments, in the scenario of building an artificial intelligence large model corpus vector database, the present invention realizes the rapid retrieval and feedback of relevant knowledge data in the field of power marketing business by optimizing the index structure and matching method, which can ensure the matching accuracy while improving the matching speed, and can efficiently enable the construction of future large model corpus knowledge base.
[0118] The present invention constructs a hollow spherical vector space through vector space positioning and vector space center optimization methods. Through distance comparison, matching power marketing business vocabulary can be quickly screened out from power marketing business questions as keywords to be searched, and word vectors to be searched are generated. Then, an improved multi-mode matching method is used to match the word vectors to be searched and the word vector database. During the matching process, the entire pattern tree is moved through the inferior character rule and the superior prefix rule to improve the matching efficiency, thereby realizing a rapid retrieval feedback function for the power marketing business corpus.
[0119] The method of the present invention is conducive to promoting the digital transformation of marketing. By applying a variety of improvement methods such as vector space division, pattern matching, and space center optimization, a relatively complete marketing knowledge vector library construction optimization plan can be formed. Through its wide application in related businesses, it can promote the digital transformation of power marketing and improve the company's technical and management levels.
[0120] In the future, the method of the present invention can be used as a basis to build business applications for more scenarios, realize the organic integration of knowledge fusion and quick question and answer, greatly enhance the business personnel's perception of professional knowledge, lower the threshold for knowledge acquisition, help improve the level of power service, improve the company's existing knowledge management system, accelerate the company's digital development process, and effectively enhance the social image of the power grid company.
[0121] It will be appreciated by those skilled in the art that embodiments of the present invention may be provided as methods, systems, or computer program products. Therefore, the present invention may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Furthermore, the present invention may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0122] The present invention is described with reference to flowcharts and / or block diagrams of methods, devices (systems), and computer program products according to embodiments of the present invention. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0123] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0124] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0125] The embodiments of the present invention are described above in conjunction with the accompanying drawings, but the present invention is not limited to the above-mentioned specific implementation methods. The above-mentioned specific implementation methods are merely illustrative and not restrictive. Under the enlightenment of the present invention, ordinary technicians in this field can also make many forms without departing from the scope of protection of the purpose of the present invention and the claims, which all fall within the protection of the present invention.
Claims
1. A method for matching large-scale corpus of power marketing business model, characterized in that: The steps include: Generate a word vector database based on text data in the power marketing business corpus; Mapping the word vectors in the word vector database to a spherical space, optimizing the range of the spherical space using a word vector space positioning method and a vector space optimization method, and obtaining a hollow spherical word vector space; Generate a word vector to be searched according to the acquired power marketing business question and the hollow spherical word vector space; Using an improved multi-mode matching method, the word vector to be searched is matched with the word vector database to obtain a matching result; An answer to the power marketing business question is generated according to the matching result.
2. The method according to claim 1, characterized in that The word vectors in the word vector database are mapped to a spherical space, and the range of the spherical space is optimized by using a word vector space positioning method and a vector space optimization method to obtain a hollow spherical word vector space, including: The word vectors in the word vector database are mapped to a spherical space through the Word2Vec model, and the coordinates of each word vector in the spherical space are obtained; According to the coordinates of all word vectors in the spherical space in the word vector database, the initial space center is calculated using the word vector space positioning method; According to the distance from each word vector in the word vector database to the center of the space, the word vector closest to and farthest from the center of the space is obtained, and the closest distance and farthest distance are obtained; The spatial center is optimized using the vector space optimization method to obtain the optimal spatial center, and the farthest distance and the shortest distance are updated according to the optimal spatial center; The hollow spherical word vector space is obtained according to the coordinates of the optimal space center, the closest distance and the farthest distance.
3. The method according to claim 2, characterized in that The coordinates of the center of the space are L={L1, L2,…,L n },in, Represents the coordinate value of the jth dimension of the space center, j=1,2,…,n, n is the total number of dimensions of the space center coordinates; The calculation formula is as follows: ; Among them, p ij It represents the j-th dimension coordinate value of the i-th word vector, and m is the total number of word vectors in the word vector database.
4. The method according to claim 2, characterized in that: The method of optimizing the space center by using the vector space optimization method to obtain the optimal space center, and updating the farthest distance and the shortest distance according to the optimal space center, includes: Initialize the iteration intermediate quantity E, iteration step length step and iteration termination threshold eplse; Suppose the word vector farthest from the center of the space is M2, and the distance between the word vector M2 and the center of the space L is the farthest distance fin2. Subtract the coordinate value of each dimension of the word vector M2 from the coordinate value of the same dimension in the current center of the space L, and divide it by the farthest distance fin2 to obtain the optimization parameter of the dimension. The calculation formula is as follows: ; in, is the optimization parameter of the jth dimension, is the j-th dimension coordinate value of the word vector M2 farthest from the center of the space, Represents the coordinate value of the j-th dimension of the space center j=1,2,…,n, where n is the total number of dimensions of the space center coordinates; According to the optimization parameters of n dimensions, the total optimization parameters are obtained ; Add the total optimization parameter to the coordinates of the current space center to obtain the coordinates of the new space center; According to the coordinates of the new space center, update the word vector M1 closest to the space center, the closest distance fin1, the word vector M2 farthest from the space center, and the farthest distance fin2; The distance between the two spatial centers before and after the update is calculated according to the Euclidean distance calculation formula, which is recorded as the iterative intermediate quantity E. If the iterative intermediate quantity E is less than the iteration termination threshold eplse, the iteration is stopped, and the updated spatial center is used as the optimal spatial center. The optimal spatial center, the nearest distance fin1, and the farthest distance fin2 are output; if the iterative intermediate quantity E is not less than the iteration termination threshold eplse, the iteration is continued and the optimization parameters are recalculated.
5. The method according to claim 4, characterized in that With the center of the optimal space as the center of the sphere, the closest distance fin1 as the inner radius, and the farthest distance fin2 as the outer radius, a hollow spherical word vector space is generated.
6. The method according to claim 1, characterized in that The step of generating a word vector to be searched based on the acquired power marketing business question and the hollow spherical word vector space includes: Preprocessing the acquired power marketing business questions to obtain a plurality of power marketing business vocabulary, wherein the preprocessing includes word segmentation and stop word removal; The Word2Vec model is used to convert the power marketing business vocabulary into word vector form and map it to the hollow spherical word vector space to obtain multiple initial word vectors to be retrieved; Calculate the distance between each initial word vector to be searched and the center of the hollow spherical word vector space, and compare it with the closest distance fin1 and the farthest distance fin2 to determine whether the initial word vector to be searched exists in the hollow spherical word vector space; If the initial word vector to be retrieved exists in the hollow spherical word vector space, the initial word vector to be retrieved is used as the word vector to be retrieved.
7. The method according to claim 1, characterized in that The improved multi-mode matching method is used to match the word vector to be searched with the word vector database to obtain a matching result, including: Take the word vector to be searched as the pattern string and build a pattern tree based on all the word vectors to be searched; Take any word vector in the word vector database as a text string, right-align the pattern tree with the text string, and start matching from the rightmost character of the text string; When characters do not match, the inferior character rule and the superior prefix rule are used to determine the pattern tree jump distance, and the pattern tree is manipulated to move to the left of the text string as a whole according to the pattern tree jump distance; If the pattern tree still cannot match successfully after jumping to the leftmost character of the text string, the next word vector in the word vector database is selected and the matching operation is repeated until the match is successful.
8. The method according to claim 7, characterized in that The disadvantage character rules are: When the characters at the same position in the current pattern string and the text string do not match, the unmatched characters are recorded as mismatched characters, and the mismatched characters are searched from left to right in other pattern strings according to the structure of the pattern tree; If there are mismatched characters in other pattern strings, move the pattern tree to the left of the text string according to the position of the mismatched characters in other pattern strings, so that the positions of the mismatched characters in other pattern strings and text strings are aligned; If there are no mismatched characters in other pattern strings, the pattern tree is moved to the left of the text string by the length of the shortest pattern string, where the shortest pattern string refers to the shortest pattern string in the pattern tree.
9. The method according to claim 7, characterized in that: The good prefix rule is: When the characters at the same position in the current pattern string and the text string do not match, the unmatched characters are recorded as mismatched characters; if there is a root node in the pattern tree that has matched a substring in the text string, the pattern tree is moved to the left of the text string until the root node of the pattern tree is aligned with the position of the matched substring in the text string, and the pattern tree jump distance does not exceed the length of the shortest pattern string.
10. A large-scale model corpus matching device for power marketing business, characterized in that: include: A database module, used to generate a word vector database based on text data in the power marketing business corpus; A space module is used to map the word vectors in the word vector database to a spherical space, and optimize the range of the spherical space by using a word vector space positioning method and a vector space optimization method to obtain a hollow spherical word vector space; A preprocessing module, used for generating a to-be-searched word vector according to the acquired power marketing business question and the hollow spherical word vector space; A matching module, used to match the word vector to be searched with the word vector database using an improved multi-mode matching method to obtain a matching result; An answer module is used to generate answers to the questions asked about the power marketing business based on the matching results.