Enterprise name search method, enterprise name search device and terminal equipment

By using the trained sentence vector generation model and sorting model, the semantic information of enterprise name search statements is solved, and the problem of inaccurate search results in the existing technology is achieved, and more efficient and accurate enterprise name retrieval is achieved.

CN112597208BActive Publication Date: 2025-02-28SHENZHEN VALUE ONLINE INFORMATION POLYTRON TECH INC
View PDF 4 Cites 0 Cited by

Patent Information

Application Number
CN202011604087.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-12-29
Publication Date
2025-02-28
Estimated Expiration
2040-12-29

AI Technical Summary

Technical Problem

The existing enterprise name search method fails to effectively consider the semantic information of the search statement, resulting in inaccurate search results.

Method used

The trained sentence vector generation model obtains the sentence vector of the search statement, and performs distance calculations from the sentence vector of the candidate enterprise name to determine the recall enterprise name; then the trained sorting model determines the target enterprise name from the recall enterprise name.

Benefits of technology

It improves the accuracy of enterprise name retrieval, retains semantic information of the search statement, and saves generation time and sorting time by using the trained model, improving retrieval efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN112597208B_ABST
    Figure CN112597208B_ABST
Patent Text Reader

Abstract

The present application is applicable to the field of data processing technology, and provides a method for searching for company names, a device for searching for company names, and a terminal device, wherein the method comprises: obtaining a first sentence vector of a first search statement according to a trained sentence vector generation model; obtaining a second sentence vector of each of a plurality of candidate company names; determining a plurality of recalled company names from the plurality of candidate company names according to the distance between the first sentence vector and the second sentence vector; and determining a target company name corresponding to the first search statement from the plurality of recalled company names according to a trained sorting model. Through the above method, the accuracy of company name search can be effectively improved, while the search efficiency can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application belongs to the field of data processing technology, and in particular relates to a company name search method, a company name search device and a terminal device. Background Art

[0002] With the rapid economic growth, the number of registered companies is increasing year by year. Many companies have long full names, and users may only remember the abbreviation of the company name or a few words in it. In this case, it is difficult to find the target name from a large number of company names.

[0003] In the existing enterprise name search method, the search sentence is usually divided into characters or words, and then the search is performed in units of characters or words. The existing method only considers the matching degree between words or characters, but does not consider the semantic information of the search sentence, resulting in inaccurate search results. Summary of the invention

[0004] The embodiments of the present application provide a company name search method, a company name search device and a terminal device, which can improve the accuracy of company name search.

[0005] In a first aspect, an embodiment of the present application provides a method for searching for company names, comprising:

[0006] Obtaining a first sentence vector of a first search sentence according to the trained sentence vector generation model;

[0007] Obtain the second sentence vector of each of the multiple candidate company names;

[0008] Determining a plurality of recalled enterprise names from the plurality of candidate enterprise names according to the distance between the first sentence vector and the second sentence vector;

[0009] According to the trained ranking model, the target enterprise name corresponding to the first search statement is determined from the multiple recalled enterprise names.

[0010] In the embodiment of the present application, the first sentence vector of the first search sentence is obtained through the trained sentence vector generation model, which avoids dividing the search sentence into characters or words, but processes the first search sentence as a whole, which can retain the semantic information of the first search sentence; then, by calculating the distance between the first sentence vector and the second sentence vector, the target company name is determined, that is, the company name with semantics similar to the first search sentence is found, which effectively improves the accuracy of the search results. In addition, the sentence vector generation model and the sorting model are both trained models. Using the trained model for data processing can greatly save the generation time and sorting time of the sentence vector, thereby improving the efficiency of retrieval.

[0011] In a possible implementation manner of the first aspect, determining a plurality of recalled enterprise names from the plurality of candidate enterprise names according to the distance between the first sentence vector and the second sentence vector includes:

[0012] Calculating the Euclidean distance between the first sentence vector and each of the second sentence vectors;

[0013] Sorting the calculated Euclidean distances in ascending order to obtain a distance queue;

[0014] The candidate enterprise names corresponding to the first M Euclidean distances in the distance queue are determined as the recalled enterprise names, wherein M is a positive integer.

[0015] In a possible implementation of the first aspect, determining the target enterprise name corresponding to the first search statement from the multiple recalled enterprise names according to the trained ranking model includes:

[0016] Inputting the first sentence vector and the second sentence vector of each of the multiple recalled enterprise names into the trained sorting model, and outputting the matching probability of each of the multiple recalled enterprise names;

[0017] Sort the matching probabilities in descending order to obtain a probability queue;

[0018] The recalled enterprise names corresponding to the first N matching probabilities in the probability queue are determined as the target enterprise names, wherein N is a positive integer and N is less than or equal to the number of the recalled enterprise names.

[0019] In a possible implementation manner of the first aspect, the method further includes:

[0020] Acquire multiple groups of first training data, wherein each group of the first training data includes a second search statement, a first positive example name, a first negative example name, and a second negative example name, wherein the first positive example name is used to represent a company name that matches the second search statement, and the first negative example name and the second negative example name are used to represent a company name that does not match the second search statement;

[0021] Input each group of the first training data into the sentence vector generation model respectively, and output a vector data group of each group of the first training data, wherein the vector data group of each group of the first training data includes a third sentence vector of the second search sentence, a fourth sentence vector of the first positive example name, a fifth sentence vector of the first counterexample name, and a sixth sentence vector of the second counterexample name;

[0022] Calculate a first error value according to each of the vector data groups of the plurality of groups of first training data;

[0023] The model parameters of the sentence vector generation model are updated using the first error value to obtain the trained sentence vector generation model.

[0024] In a possible implementation manner of the first aspect, calculating the first error value according to the vector data groups of each of the multiple groups of first training data includes:

[0025] Calculate the first error value by a preset formula;

[0026] The preset formula is:

[0027]

[0028] Wherein, LOSS is the first error value, S i is the third sentence vector of the second search sentence in the i-th group of training data, P i is the fourth sentence vector of the first positive example name in the i-th group of the training data, is the fifth sentence vector of the first counterexample name in the i-th group of the training data, is the sixth sentence vector of the second counterexample name in the i-th group of the training data, t1 and t2 are preset thresholds, and Q is the number of groups of the training data.

[0029] In a possible implementation manner of the first aspect, the method further includes:

[0030] Acquire second training data, wherein the second training data includes a third search statement, a second positive example name, attribute information of the second positive example name, a third negative example name, and attribute information of the third negative example name, wherein the second positive example name is used to represent a company name that matches the third search statement, and the third negative example name is used to represent a company name that does not match the third search statement;

[0031] concatenating the third search statement, the second positive example name, and the attribute information of the second positive example name into a first concatenated statement;

[0032] concatenating the third search statement, the third counterexample name, and the attribute information of the third counterexample name into a second concatenated statement;

[0033] Inputting the first concatenated sentence and the second concatenated sentence into the sorting model respectively, and outputting a first probability value corresponding to the second positive example name and a second probability value corresponding to the third negative example name;

[0034] Calculate a second error value according to the first probability value and a first preset probability;

[0035] Calculating a third error value according to the second probability value and a second preset probability;

[0036] The model parameters of the sorting model are updated according to the second error value and the third error value respectively to obtain the trained sorting model.

[0037] In a possible implementation manner of the first aspect, the sentence vector generation model is an ALBERT model.

[0038] In a second aspect, an embodiment of the present application provides a company name search device, including:

[0039] A vector generation unit, used to obtain a first sentence vector of a first search sentence according to a trained sentence vector generation model;

[0040] A vector acquisition unit, used to acquire the second sentence vector of each of the plurality of candidate enterprise names;

[0041] a distance calculation unit, configured to determine a plurality of recalled enterprise names from the plurality of candidate enterprise names according to the distance between the first sentence vector and the second sentence vector;

[0042] The name retrieval unit is used to determine the target enterprise name corresponding to the first search statement from the multiple recalled enterprise names according to the trained sorting model.

[0043] In a third aspect, an embodiment of the present application provides a terminal device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements a company name retrieval method as described in any one of the first aspects above when executing the computer program.

[0044] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium. An embodiment of the present application provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and wherein the computer program, when executed by a processor, implements a method for retrieving enterprise names as described in any one of the first aspects above.

[0045] In a fifth aspect, an embodiment of the present application provides a computer program product. When the computer program product is run on a terminal device, the terminal device executes the enterprise name search method described in any one of the above-mentioned first aspects.

[0046] It can be understood that the beneficial effects of the second to fifth aspects mentioned above can be found in the relevant description of the first aspect mentioned above, and will not be repeated here. BRIEF DESCRIPTION OF THE DRAWINGS

[0047] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative labor.

[0048] Figure 1 It is a flowchart of the enterprise name search method provided in the embodiment of the present application;

[0049] Figure 2 It is a flowchart of a training method for a sentence vector generation model provided in an embodiment of the present application;

[0050] Figure 3 It is a flowchart of a training method for a sentence vector generation model provided in another embodiment of the present application;

[0051] Figure 4 It is a flowchart of a training method for a sorting model provided in an embodiment of the present application;

[0052] Figure 5 It is a schematic diagram of the structure of the sorting model provided in the embodiment of the present application;

[0053] Figure 6 is a structural block diagram of a corporate name search device provided in an embodiment of the present application;

[0054] Figure 7 It is a schematic diagram of the structure of the terminal device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0055] In the following description, specific details such as specific system structures, technologies, etc. are provided for the purpose of illustration rather than limitation, so as to provide a thorough understanding of the embodiments of the present application. However, it should be clear to those skilled in the art that the present application may also be implemented in other embodiments without these specific details. In other cases, detailed descriptions of well-known systems, devices, circuits, and methods are omitted to prevent unnecessary details from obstructing the description of the present application.

[0056] It should be understood that when used in the present specification and the appended claims, the term "comprising" indicates the presence of described features, wholes, steps, operations, elements and / or components, but does not exclude the presence or addition of one or more other features, wholes, steps, operations, elements, components and / or combinations thereof.

[0057] In addition, in the description of the present application specification and the appended claims, the terms "first", "second", "third", etc. are only used to distinguish the descriptions and cannot be understood as indicating or implying relative importance.

[0058] References to "one embodiment" or "some embodiments" etc. described in the specification of this application mean that one or more embodiments of the present application include specific features, structures or characteristics described in conjunction with the embodiment. Therefore, the phrases "in one embodiment", "in some embodiments", "in some other embodiments", "in some other embodiments", etc. appearing in different places in this specification do not necessarily refer to the same embodiment, but mean "one or more but not all embodiments", unless otherwise specifically emphasized in other ways.

[0059] See also Figure 1 , is a flow chart of a method for searching for company names provided in an embodiment of the present application. As an example but not a limitation, the method may include the following steps:

[0060] S101, obtaining a first sentence vector of a first search sentence according to a trained sentence vector generation model.

[0061] In the prior art, the search sentence is usually divided into words, and then the word vector of each word is calculated using the tf-idf algorithm, and then the sentence vector of the input sentence is calculated based on each word vector. The existing method focuses more on the meaning of each word in the search sentence, while ignoring the semantic relationship between the words in the search sentence, resulting in low accuracy of the search results.

[0062] In order to solve the problems in the prior art, the sentence vector generation model after training is used in the embodiment of the present application to obtain the sentence vector of the search sentence. It avoids dividing the sentence into characters or words, but processes the search sentence as a whole, which can retain the semantic information of the search sentence. In addition, the use of the sentence vector generation model after training can effectively improve the generation speed of the sentence vector, thereby improving the search efficiency.

[0063] S102, obtaining the second sentence vector of each of the plurality of candidate enterprise names.

[0064] In practical applications, a database can be established in advance to store multiple company names in the database. All company names in the database are candidate company names. Usually, company names are not easily changed. Therefore, sentence vectors can be generated for each company name in the database in advance and stored in the database. When it is needed, it can be called from the database without regenerating sentence vectors every time a search is performed, which effectively improves the search efficiency.

[0065] It should be noted that the method for generating the sentence vector of each candidate enterprise name in the database may be the same as the method in S101, and will not be described in detail here.

[0066] S103, determining a plurality of recalled enterprise names from a plurality of candidate enterprise names according to the distance between the first sentence vector and the second sentence vector.

[0067] The distance in the embodiment of the present application is used to measure the similarity between two sentence vectors. The larger the distance value, the lower the similarity between the two sentence vectors; the smaller the distance value, the higher the similarity between the two sentence vectors. There are many ways to measure the distance between two vectors, such as Mahalanobis distance, Chebyshev distance, Manhattan distance, etc.

[0068] In one embodiment of the present application, the Euclidean distance may be used. Accordingly, one implementation method for determining the name of the recalled enterprise includes:

[0069] Calculate the Euclidean distance between the first sentence vector and each second sentence vector; sort the calculated Euclidean distances in ascending order to obtain a distance queue; determine the candidate enterprise names corresponding to the first M Euclidean distances in the distance queue as the recalled enterprise names.

[0070] Wherein, M is a positive integer.

[0071] The calculation formula of Euclidean distance is as follows:

[0072]

[0073] Among them, d(x,y) represents the distance between vector x and vector y, x j is the jth element in vector x, y j is the jth element in vector y, and n is the vector dimension.

[0074] Sorting the Euclidean distance from small to large is actually sorting the similarity from large to small. Then the candidate enterprise names corresponding to the first M Euclidean distance characters in the distance queue are enterprise names with high similarity to the first search statement.

[0075] In step S103, the essence is to measure the similarity between the two vectors. Therefore, in addition to the above-mentioned distance measurement of similarity, the similarity coefficient between the two vectors can also be calculated, such as the cosine similarity coefficient, Jaccard coefficient and Pearson coefficient between the two vectors. Accordingly, another implementation method for determining the name of the recalled enterprise includes:

[0076] Calculate the similarity coefficient between the first sentence vector and each second sentence vector; sort the calculated similarity coefficients in descending order to obtain a coefficient queue; determine the candidate enterprise names corresponding to the first M similarity coefficients in the coefficient queue as the recalled enterprise names.

[0077] S104: Determine the target enterprise name corresponding to the first search statement from the multiple recalled enterprise names according to the trained ranking model.

[0078] The trained sorting model is used to identify the target company name from multiple recalled company names, that is, to find company names with semantic similarity to the first search statement, which effectively improves the accuracy of the search results. In addition, using the trained model for data processing can greatly save sorting time, thereby improving the efficiency of retrieval.

[0079] In one embodiment, a method for determining the target enterprise name includes:

[0080] The first sentence vector and the second sentence vectors of each of the multiple recalled enterprise names are input into the trained sorting model, and the matching probability of each of the multiple recalled enterprise names is output; the matching probabilities are sorted in order from large to small to obtain a probability queue; and the recalled enterprise names corresponding to the first N matching probabilities in the probability queue are determined as target enterprise names.

[0081] Wherein, N is a positive integer, and N is less than or equal to the number of recalled enterprise names.

[0082] The higher the matching probability, the higher the matching degree. N recalled enterprise names with higher matching probabilities may be displayed to the user for selection.

[0083] The output of the above ranking model is the matching probability. Optionally, in another embodiment, the first sentence vector and the second sentence vectors of the multiple recalled enterprise names can be input into the trained ranking model to output the target enterprise name.

[0084] In this way, the process of sorting the matching probabilities is included in the sorting model. In this way, the sorting model has a higher degree of automation, but is less flexible than the previous method. The specific method can be selected according to actual needs.

[0085] Exemplarily, it is assumed that there are 1000 candidate enterprise names in the database, and the second sentence vector of each candidate enterprise name is stored. When the user enters the first search sentence, the processor uses the enterprise name search method in the embodiment of the present application to first obtain the first sentence vector of the first search sentence according to the trained sentence vector generation model, and obtain 1000 second sentence vectors; then respectively calculate the Euclidean distance between the first sentence vector and each second sentence vector to obtain 1000 Euclidean distances; then sort the 1000 Euclidean distances in order from small to large to obtain a distance sequence; determine the candidate enterprise names corresponding to the first 100 Euclidean distances in the distance sequence as the recalled enterprise names; input the recalled enterprise names into the sorting model after training, and output the matching probability of each recalled enterprise name; sort the 100 matching probabilities in order from large to small to obtain a probability sequence; determine the recalled enterprise names corresponding to the first 10 matching probabilities in the probability sequence as the target enterprise names; finally, display these 10 target enterprise names to the user through a display device.

[0086] According to the above method, the trained sentence vector generation model and ranking model are needed. Therefore, these two models need to be pre-trained. The following introduces the training methods of the two models respectively.

[0087] In one embodiment, see Figure 2 , is a flow chart of the training method of the sentence vector generation model provided in the embodiment of the present application, such as Figure 2 As shown, the training method of the sentence vector generation model may include:

[0088] S201, obtaining multiple groups of first training data.

[0089] Each group of first training data includes a second search sentence, a first positive example name, a first negative example name and a second negative example name.

[0090] The first positive example name is used to represent the company name that matches the second search statement, and the first negative example name and the second negative example name are used to represent the company name that does not match the second search statement.

[0091] In practical applications, the first positive example name, the first negative example name and the second negative example name may be manually assigned to the second search statement, wherein the first negative example name and the second negative example name may be any two enterprise names in the database except the first positive example name.

[0092] S202, input each group of first training data into the sentence vector generation model respectively, and output a vector data group of each group of first training data.

[0093] Among them, the vector data group of each group of first training data includes the third sentence vector of the second search sentence, the fourth sentence vector of the first positive example name, the fifth sentence vector of the first negative example name and the sixth sentence vector of the second negative example name.

[0094] Since the existing word2vec model and glove model cannot be fine-tuned, and the company name with less contextual information needs to be understood more accurately, the sentence vector generation model can be the ALBERT model. This model has the advantages of short training time, small memory usage, and fast prediction speed.

[0095] See also Figure 3 , is a flowchart of a training method for a sentence vector generation model provided in another embodiment of the present application.

[0096] The ALBERT model has three types of input data, including input_ids, input_masks, and segment_ids. Among them, input_ids represents the index sequence corresponding to the input sentence (which can be obtained from the preset dictionary); input_masks represents the mask of the input sentence (the mask within the preset length of the input sentence is 1, and the mask of the part exceeding the preset length is 0); segment_ids represents the distinction between the corresponding characters of multiple inputs (the mask of the first input is 0, and the mask of the second sentence is 1).

[0097] like Figure 3 As shown, the second search sentence, the first positive example name, the first negative example name and the second negative example name are converted into three types of input data respectively; then their three types of input data are input into the ALBERT model respectively, and their respective sentence vectors are output.

[0098] S203, calculating a first error value according to respective vector data groups of the plurality of groups of first training data.

[0099] Optionally, a method for calculating the first error value includes:

[0100] Calculate a first error value using a preset formula;

[0101] The default formula is:

[0102]

[0103] Among them, LOSS is the first error value, S i is the third sentence vector of the second search sentence in the i-th group of training data, P i is the fourth sentence vector of the first positive example name in the i-th group of training data, is the fifth sentence vector of the first counterexample name in the i-th group of training data, is the sixth sentence vector of the second counterexample name in the i-th group of training data, t1 and t2 are preset thresholds, and Q is the number of groups of training data.

[0104] Because the distance between the search sentence and the positive example name cannot be infinitely close to 0, and the distance between the search sentence and the negative example name, and the distance between the negative example name and the negative example name cannot be infinitely close to 1, so thresholds t1 and t2 are set. The learning goal is that the difference between the distances of d(search, negative example) and d(search, positive example) is greater than t1. When the difference in distance is greater than t1, it means that the learning is sufficient. Similarly, according to the threshold t2, the same operation is performed on the distance between the two negative example names to obtain the error.

[0105] S204: Use the first error value to update the model parameters of the sentence vector generation model to obtain a trained sentence vector generation model.

[0106] The Adam optimizer can be used to update the parameters through back-propagation.

[0107] In addition, the multiple groups of first training data in the above steps can be regarded as a training set. In practical applications, multiple training sets can be selected, and then each training set can be used to train the model, continuously reducing the error, and finally training to convergence. Exemplarily, 1000 groups of first training data can be divided into 10 training sets, each training set has 100 groups of first training data. First, the model is trained with 100 groups of first training data in the first training set, and then the model is trained with 100 groups of first training data in the second training set, and so on, until the model converges (that is, the first error value is less than the preset difference); the sentence vector generation model at this time is determined as the trained sentence vector generation model.

[0108] The purpose of training the sentence vector generation model is to make the distance between the search sentence and the positive example name in the space smaller, and to make the distance between the search sentence and the negative example name in the space larger. The positive example name can "tell" the model what name is correct, and the negative example name can "tell" the model what name is wrong. Through the model trained with positive examples and negative examples, the output results can be as "close" to the positive example as possible and as "far away" from the negative example as possible. Compared with a single negative example, a double negative example can learn the differences between negative examples, and can accelerate network convergence while having higher accuracy. Through the above method, the accuracy of the sentence vector generation model can be improved; in addition, since 1 positive example and 2 negative examples are used at the same time in a training process, that is, 3 data are trained at the same time, the training efficiency is greatly improved and the convergence speed of the model is accelerated.

[0109] In one embodiment, see Figure 4 , is a flow chart of the training method of the sorting model provided in the embodiment of the present application. Figure 4 As shown, the training method of the sorting model may include:

[0110] S401: Acquire second training data.

[0111] Among them, the second training data includes a third search statement, a second positive example name, attribute information of the second positive example name, a third negative example name and attribute information of the third negative example name. The second positive example name is used to represent the company name that matches the third search statement, and the third negative example name is used to represent the company name that does not match the third search statement.

[0112] Of course, you can also Figure 2 As described in the embodiment, training data of 1 positive example and 2 negative examples are used.

[0113] The word vector generation stage processes a large amount of data and requires high processing efficiency. The sorting stage only processes M recalled company names, and the data volume is small, so more features can be introduced for accurate sorting. This task can be compared to the semantic similarity matching task in natural language processing. In addition to the company name itself, attribute information (such as name abbreviation, company registration place, stock code, corporate legal person, chairman, etc.) can also be introduced to assist the sorting process.

[0114] S402: Concatenate the third search statement, the second positive example name, and the attribute information of the second positive example name into a first concatenated statement.

[0115] Optionally, you can use the unique tags [CLS] and [SEP] in the BERT model for concatenation. For example: the third search sentence is xxyy, the second positive example name is xxyy company, the attribute information of the second positive example name is abbreviated as xy, registered place is Beijing, stock code is 000022, and the legal person is Zhang San. The first concatenated sentence after concatenation is [CLS]xxyy[SEP]xxyy company's abbreviation is xy, registered place is Beijing, stock code is 000022, and the legal person is Zhang San.

[0116] S403: Concatenate the third search statement, the third counterexample name, and the attribute information of the third counterexample name into a second concatenated statement.

[0117] The method for concatenating the second sentences is the same as that in S402 and will not be described in detail here.

[0118] S404: Input the first concatenated sentence and the second concatenated sentence into the sorting model respectively, and output a first probability value corresponding to the second positive example name and a second probability value corresponding to the third negative example name.

[0119] Optionally, the ranking model can also use the ALBERT model. Figure 5, is a schematic diagram of the structure of the sorting model provided in the embodiment of the present application. Figure 5 As shown, the sorting model includes an ALBERT model, a first fully connected layer, a second fully connected layer, and a softmax layer.

[0120] The ALBERT model here has different parameters from the word vector generation model, but its function is also to generate word vectors for input sentences.

[0121] The more layers of the fully connected layer, the more accurate the semantic recognition, but the greater the amount of calculation. Preferably, two layers of fully connected layers are selected in the embodiment of the present application. Exemplarily, the first fully connected layer may include 128 neurons, and the second fully connected layer may include 2 neurons. Through the above-mentioned network structure of two fully connected layers, while ensuring recognition accuracy, the calculation efficiency can be guaranteed.

[0122] The softmax layer is used to calculate probability values ​​and normalize them. For example, the probability values ​​can be normalized to two values, such as 0 or 1, or to a preset value range, such as [0,1].

[0123] S405: Calculate a second error value according to the first probability value and the first preset probability.

[0124] S406: Calculate a third error value according to the second probability value and the second preset probability.

[0125] Optionally, a cross entropy function may be used as the error function.

[0126] S407, updating the model parameters of the sorting model according to the second error value and the third error value respectively, to obtain a trained sorting model.

[0127] The Adam optimizer can be used to update the parameters through back-propagation.

[0128] The above steps describe a training process. In practical applications, multiple sets of second training data may be used to train the sorting model until the sorting model converges.

[0129] Through the above method, the attribute information of the positive example name and the negative example name is used to train the sorting model, which can effectively improve the accuracy of the sorting model. In addition, since the positive example and the negative example are used at the same time in a training process, that is, multiple data are trained at the same time, the training efficiency is greatly improved and the convergence speed of the model is accelerated.

[0130] It should be understood that the size of the serial numbers of the steps in the above embodiments does not mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present application.

[0131] Corresponding to the enterprise name search method described in the above embodiment, Figure 6 This is a structural block diagram of the enterprise name search device provided in the embodiment of the present application. For the sake of convenience of explanation, only the parts related to the embodiment of the present application are shown.

[0132] Reference Figure 6 , the device comprises:

[0133] The vector generating unit 61 is used to obtain a first sentence vector of the first search sentence according to the trained sentence vector generating model.

[0134] The vector acquisition unit 62 is used to acquire the second sentence vector of each of the plurality of candidate enterprise names.

[0135] The distance calculation unit 63 is used to determine a plurality of recalled enterprise names from the plurality of candidate enterprise names according to the distance between the first sentence vector and the second sentence vector.

[0136] The name retrieval unit 64 is used to determine the target enterprise name corresponding to the first search statement from the multiple recalled enterprise names according to the trained ranking model.

[0137] Optionally, the distance calculation unit 63 is further used for:

[0138] Calculate the Euclidean distance between the first sentence vector and each of the second sentence vectors; sort the calculated Euclidean distances in ascending order to obtain a distance queue; determine the candidate enterprise names corresponding to the first M Euclidean distances in the distance queue as the recalled enterprise names, where M is a positive integer.

[0139] Optionally, the name retrieval unit 64 is further used for:

[0140] The first sentence vector and the second sentence vector of each of the multiple recalled enterprise names are input into the trained sorting model, and the matching probability of each of the multiple recalled enterprise names is output; the matching probabilities are sorted in order from large to small to obtain a probability queue; the recalled enterprise names corresponding to the first N matching probabilities in the probability queue are determined as the target enterprise names, wherein N is a positive integer, and N is less than or equal to the number of the recalled enterprise names.

[0141] Optionally, the device 6 comprises:

[0142] A sentence vector generation model training unit is used to obtain multiple groups of first training data, wherein each group of the first training data includes a second search statement, a first positive example name, a first negative example name and a second negative example name, the first positive example name is used to represent a company name that matches the second search statement, and the first negative example name and the second negative example name are used to represent a company name that does not match the second search statement; each group of the first training data is input into the sentence vector generation model respectively, and a vector data group of each group of the first training data is output, wherein the vector data group of each group of the first training data includes a third sentence vector of the second search statement, a fourth sentence vector of the first positive example name, a fifth sentence vector of the first negative example name and a sixth sentence vector of the second negative example name; a first error value is calculated according to the vector data groups of each of the multiple groups of first training data; the model parameters of the sentence vector generation model are updated using the first error value to obtain the trained sentence vector generation model.

[0143] Optionally, the sentence vector generation model training unit is also used to:

[0144] Calculate the first error value by a preset formula;

[0145] The preset formula is:

[0146]

[0147] Wherein, LOSS is the first error value, S i is the third sentence vector of the second search sentence in the i-th group of training data, P i is the fourth sentence vector of the first positive example name in the i-th group of the training data, is the fifth sentence vector of the first counterexample name in the i-th group of the training data, is the sixth sentence vector of the second counterexample name in the i-th group of the training data, t1 and t2 are preset thresholds, and Q is the number of groups of the training data.

[0148] Optionally, the sentence vector generation model is an ALBERT model.

[0149] Optionally, the device 6 comprises:

[0150] A sorting model training unit is used to obtain second training data, wherein the second training data includes a third search statement, a second positive example name, attribute information of the second positive example name, a third negative example name and attribute information of the third negative example name, the second positive example name is used to represent the enterprise name that matches the third search statement, and the third negative example name is used to represent the enterprise name that does not match the third search statement; the third search statement, the second positive example name and the attribute information of the second positive example name are spliced ​​into a first spliced ​​statement; the third search statement, the third negative example name and the attribute information of the third negative example name are spliced ​​into a second spliced ​​statement; the first spliced ​​statement and the second spliced ​​statement are respectively input into the sorting model, and a first probability value corresponding to the second positive example name and a second probability value corresponding to the third negative example name are output; a second error value is calculated according to the first probability value and the first preset probability; a third error value is calculated according to the second probability value and the second preset probability; the model parameters of the sorting model are updated according to the second error value and the third error value respectively to obtain the trained sorting model.

[0151] It should be noted that the information interaction, execution process, etc. between the above-mentioned devices / units are based on the same concept as the method embodiment of the present application. Their specific functions and technical effects can be found in the method embodiment part and will not be repeated here.

[0152] in addition, Figure 6 The enterprise name search device shown may be a software unit, a hardware unit, or a combination of software and hardware, which is built into an existing terminal device, or may be integrated into the terminal device as an independent accessory, or may exist as an independent terminal device.

[0153] The technicians in the relevant field can clearly understand that for the convenience and simplicity of description, only the division of the above-mentioned functional units and modules is used as an example for illustration. In practical applications, the above-mentioned function allocation can be completed by different functional units and modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above. The functional units and modules in the embodiment can be integrated in a processing unit, or each unit can exist physically separately, or two or more units can be integrated in one unit. The above-mentioned integrated unit can be implemented in the form of hardware or in the form of software functional units. In addition, the specific names of the functional units and modules are only for the convenience of distinguishing each other, and are not used to limit the scope of protection of this application. The specific working process of the units and modules in the above-mentioned system can refer to the corresponding process in the aforementioned method embodiment, which will not be repeated here.

[0154] Figure 7Schematic diagram of the structure of the terminal device provided in the embodiment of the present application. Figure 7 As shown, the terminal device 7 of this embodiment includes: at least one processor 70 ( Figure 7 Only one is shown in the figure) a processor, a memory 71, and a computer program 72 stored in the memory 71 and executable on the at least one processor 70, and when the processor 70 executes the computer program 72, the steps in any of the above-mentioned enterprise name retrieval method embodiments are implemented.

[0155] The terminal device may be a computing device such as a desktop computer, a notebook, a PDA, or a cloud server. The terminal device may include, but is not limited to, a processor and a memory. Those skilled in the art will understand that Figure 7 It is only an example of the terminal device 7 and does not constitute a limitation on the terminal device 7. It may include more or fewer components than shown in the figure, or a combination of certain components, or different components. For example, it may also include input and output devices, network access devices, etc.

[0156] The processor 70 may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or any conventional processor, etc.

[0157] In some embodiments, the memory 71 may be an internal storage unit of the terminal device 7, such as a hard disk or memory of the terminal device 7. In other embodiments, the memory 71 may also be an external storage device of the terminal device 7, such as a plug-in hard disk, a smart media card (SMC), a secure digital (SD) card, a flash card, etc. equipped on the terminal device 7. Further, the memory 71 may also include both an internal storage unit and an external storage device of the terminal device 7. The memory 71 is used to store an operating system, an application program, a boot loader, data, and other programs, such as the program code of the computer program. The memory 71 may also be used to temporarily store data that has been output or is to be output.

[0158] An embodiment of the present application further provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps in the above-mentioned method embodiments can be implemented.

[0159] An embodiment of the present application provides a computer program product. When the computer program product is run on a terminal device, the terminal device can implement the steps in the above-mentioned method embodiments when executing the computer program product.

[0160] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the present application implements all or part of the processes in the above-mentioned embodiment method, which can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a computer-readable storage medium, and the computer program can implement the steps of the above-mentioned various method embodiments when executed by the processor. Among them, the computer program includes computer program code, and the computer program code can be in source code form, object code form, executable file or some intermediate form. The computer-readable medium may at least include: any entity or device that can carry the computer program code to the device / terminal device, a recording medium, a computer memory, a read-only memory (ROM, Read-Only Memory), a random access memory (RAM, Random Access Memory), an electric carrier signal, a telecommunication signal, and a software distribution medium. For example, a USB flash drive, a mobile hard disk, a magnetic disk or an optical disk. In some jurisdictions, according to legislation and patent practice, computer-readable media cannot be electric carrier signals and telecommunication signals.

[0161] In the above embodiments, the description of each embodiment has its own emphasis. For parts that are not described or recorded in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.

[0162] Those of ordinary skill in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.

[0163] In the embodiments provided in the present application, it should be understood that the disclosed devices / terminal equipment and methods can be implemented in other ways. For example, the device / terminal equipment embodiments described above are only schematic. For example, the division of the modules or units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.

[0164] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0165] The embodiments described above are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application has been described in detail with reference to the aforementioned embodiments, a person skilled in the art should understand that the technical solutions described in the aforementioned embodiments may still be modified, or some of the technical features may be replaced by equivalents. Such modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present application, and should all be included in the protection scope of the present application.

Claims

1. A method for searching enterprise names, characterized in that: include: Obtaining a first sentence vector of a first search sentence according to the trained sentence vector generation model; Obtain the second sentence vector of each of the multiple candidate company names; According to the Euclidean distance or similarity coefficient between the first sentence vector and the second sentence vector, a plurality of recalled enterprise names are determined from the plurality of candidate enterprise names according to the order of the Euclidean distance or similarity coefficient; According to the trained sorting model, determining the target enterprise name corresponding to the first search sentence from the multiple recalled enterprise names, including: inputting the first sentence vector and the second sentence vector of each of the multiple recalled enterprise names into the trained sorting model, and outputting the matching probability of each of the multiple recalled enterprise names; sorting the matching probabilities in descending order to obtain a probability queue; determining the recalled enterprise names corresponding to the first N matching probabilities in the probability queue as the target enterprise names, wherein N is a positive integer, and N is less than or equal to the number of the recalled enterprise names; The method further comprises: Acquire multiple groups of first training data, wherein each group of the first training data includes a second search statement, a first positive example name, a first negative example name, and a second negative example name, wherein the first negative example name and the second negative example name are used to represent enterprise names that do not match the second search statement; Input each group of the first training data into the sentence vector generation model respectively, and output a vector data group of each group of the first training data, wherein the vector data group of each group of the first training data includes a third sentence vector of the second search sentence, a fourth sentence vector of the first positive example name, a fifth sentence vector of the first counterexample name, and a sixth sentence vector of the second counterexample name; Calculate a first error value according to the vector data group of each of the plurality of groups of first training data; Using the first error value to update the model parameters of the sentence vector generation model, to obtain the trained sentence vector generation model; Acquire second training data, wherein the second training data includes a third search statement, a second positive example name, attribute information of the second positive example name, a third negative example name, and attribute information of the third negative example name, wherein the third negative example name is used to indicate a company name that does not match the third search statement; concatenating the third search statement, the second positive example name, and the attribute information of the second positive example name into a first concatenated statement; concatenating the third search statement, the third counterexample name, and the attribute information of the third counterexample name into a second concatenated statement; Inputting the first concatenated sentence and the second concatenated sentence into the sorting model respectively, and outputting a first probability value corresponding to the second positive example name and a second probability value corresponding to the third negative example name; Calculate a second error value according to the first probability value and a first preset probability; Calculating a third error value according to the second probability value and a second preset probability; The model parameters of the sorting model are updated according to the second error value and the third error value respectively to obtain the trained sorting model.

2. The enterprise name search method according to claim 1, characterized in that: The step of determining a plurality of recalled enterprise names from the plurality of candidate enterprise names according to the distance between the first sentence vector and the second sentence vector comprises: Calculating the Euclidean distance between the first sentence vector and each of the second sentence vectors; Sorting the calculated Euclidean distances in ascending order to obtain a distance queue; The candidate enterprise names corresponding to the first M Euclidean distances in the distance queue are determined as the recalled enterprise names, wherein M is a positive integer.

3. The enterprise name search method according to claim 1, characterized in that: The first positive example name is used to represent the company name that matches the second search statement.

4. The enterprise name search method according to claim 3, characterized in that: The calculating the first error value according to the vector data groups of each of the plurality of groups of first training data comprises: Calculate the first error value by a preset formula; The preset formula is: Wherein, LOSS is the first error value, S i is the third sentence vector of the second search sentence in the i-th group of training data, P i is the fourth sentence vector of the first positive example name in the i-th group of the training data, is the fifth sentence vector of the first counterexample name in the i-th group of the training data, is the sixth sentence vector of the second counterexample name in the i-th group of the training data, t1 and t2 are preset thresholds, and Q is the number of groups of the training data.

5. The enterprise name search method according to claim 1, characterized in that: The second positive example name is used to represent the company name that matches the third search statement.

6. The enterprise name search method according to any one of claims 1 to 5, characterized in that: The sentence vector generation model is the ALBERT model.

7. A company name search device, characterized in that: include: A vector generation unit, used to obtain a first sentence vector of a first search sentence according to a trained sentence vector generation model; A vector acquisition unit, used to acquire the second sentence vector of each of the plurality of candidate enterprise names; a distance calculation unit, configured to determine a plurality of recalled enterprise names from the plurality of candidate enterprise names according to the Euclidean distance or similarity coefficient between the first sentence vector and the second sentence vector and to sort the Euclidean distance or similarity coefficient; A name retrieval unit, used to determine the target enterprise name corresponding to the first search statement from the multiple recalled enterprise names according to the trained sorting model, specifically used to: input the first sentence vector and the second sentence vector of each of the multiple recalled enterprise names into the trained sorting model, and output the matching probability of each of the multiple recalled enterprise names; sort the matching probabilities in order from large to small to obtain a probability queue; determine the recalled enterprise names corresponding to the first N matching probabilities in the probability queue as the target enterprise names, wherein N is a positive integer, and N is less than or equal to the number of the recalled enterprise names; A sentence vector generation model training unit is used to obtain multiple groups of first training data, wherein each group of the first training data includes a second search statement, a first positive example name, a first negative example name, and a second negative example name, wherein the first positive example name is used to represent a company name that matches the second search statement, and the first negative example name and the second negative example name are used to represent a company name that does not match the second search statement; input each group of the first training data into the sentence vector generation model respectively, and output a vector data group of each group of the first training data, wherein the vector data group of each group of the first training data includes a third sentence vector of the second search statement, a fourth sentence vector of the first positive example name, a fifth sentence vector of the first negative example name, and a sixth sentence vector of the second negative example name; calculate a first error value according to each of the vector data groups of the multiple groups of first training data; use the first error value to update the model parameters of the sentence vector generation model to obtain the trained sentence vector generation model; A sorting model training unit is used to obtain second training data, wherein the second training data includes a third search statement, a second positive example name, attribute information of the second positive example name, a third negative example name and attribute information of the third negative example name, the second positive example name is used to represent the enterprise name that matches the third search statement, and the third negative example name is used to represent the enterprise name that does not match the third search statement; the third search statement, the second positive example name and the attribute information of the second positive example name are spliced ​​into a first spliced ​​statement; the third search statement, the third negative example name and the attribute information of the third negative example name are spliced ​​into a second spliced ​​statement; the first spliced ​​statement and the second spliced ​​statement are respectively input into the sorting model, and a first probability value corresponding to the second positive example name and a second probability value corresponding to the third negative example name are output; a second error value is calculated according to the first probability value and the first preset probability; a third error value is calculated according to the second probability value and the second preset probability; the model parameters of the sorting model are updated according to the second error value and the third error value respectively to obtain the trained sorting model.

8. A terminal device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the method according to any one of claims 1 to 6 is implemented.

9. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the method according to any one of claims 1 to 6 is implemented.

Citation Information

Patent Citations

  • Training method and system of text sorting model

    CN110969006A

  • Question and answer method and device and terminal equipment

    CN111046147A

  • Automatic question and answer processing method and device, computer equipment and storage medium

    CN111858859A

  • Text statement processing method and device, computer equipment and storage medium

    CN111950269A