Method for labelling documents by keywords

The method addresses inefficiencies in keyword labeling by using TF-IDF and IDF metrics to create a similarity matrix, efficiently organizing keywords and reducing redundant access, thus enhancing data access for large datasets without prior data requirements.

WO2024200879A1PCT designated stage expired Publication Date: 2024-10-03ORBITAL ADVERTISING SL
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
PCT/ES2023/070191
Authority / Receiving Office
WO · WO
Patent Type
Applications
Current Assignee / Owner
Filing Date
2023-03-27
Publication Date
2024-10-03

AI Technical Summary

Technical Problem

Existing methods for labeling documents with keywords are inefficient due to redundant information and high computing requirements, especially when handling large volumes of data, and often rely on prior data that may not be available.

Method used

A method that calculates a similarity matrix between keywords and documents using TF-IDF and IDF metrics to efficiently label documents based on lexical similarity, eliminating redundant access and reducing computing time by filtering and selecting the most relevant keywords.

Benefits of technology

This method enables efficient data access by accurately organizing keywords, reducing redundant information and minimizing computing time, making it suitable for large datasets without requiring prior data.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure ES2023070191_03102024_PF_FP_ABST
    Figure ES2023070191_03102024_PF_FP_ABST
Patent Text Reader

Abstract

The present invention discloses a method for labelling documents by keywords. The method comprises: receiving (10) a data set consisting of keywords and documents; extracting (20) tokens from the keywords; calculating (30) the frequency of each token for each keyword and document, and generating a "frequency" matrix; calculating (30') the Inverse Document Frequency "IDFtokenJ" for each token; calculating (40) a "TF-IDF" matrix of tokens by multiplying the frequency matrix by a diagonal matrix formed by the "IDFtokenJ" of each token; calculating (61) a "documents" matrix that is the sum of the rows of the "TF-IDF" matrix of all the keywords that belong to one same document; calculating (62) a "similarity" matrix, where each element of the similarity matrix represents the score of each keyword with respect to each document, and selecting (70) for each keyword the document with the highest score in the similarity matrix.
Need to check novelty before this filing date? Find Prior Art

Description

[0001] METHOD OF LABELING DOCUMENTS BY KEYWORDS

[0002] DESCRIPTION

[0003] OBJECT OF THE INVENTION

[0004] The present invention relates to a method for tagging documents. The main objective of the method of the present invention is to correctly organize the keywords that tag documents according to lexical similarity, thus making data access more efficient and eliminating redundant access to information.

[0005] The invention finds particular application in the field of physics techniques, and more specifically in digital data calculation and processing.

[0006] BACKGROUND OF THE INVENTION AND TECHNICAL PROBLEM TO BE SOLVED

[0007] Search engines typically rank documents based on a set of keywords. This ranking is done automatically, through web scraping, or manually by humans. This process is often prone to errors due to the large volume of data or the subjectivity of the data entry operator. Errors that occur are generally related to redundant information or information that is not correctly used as a "tag" for the correct document. This can result in both search engines and applications dependent on them (e.g., digital marketing applications) being less efficient when searching for documents based on keywords. Different strategies have emerged to address these types of problems by properly organizing keywords.Among the state-of-the-art strategies, approaches have been found that use NLP (Natural Language Processing), machine learning techniques, neural networks, and other metrics and measures to achieve this goal.

[0008] The article by Yang Y., Jansen et al. entitled “Keyword optimization in sponsored search advertising: A multilevel computational framework” is known in the state of the art. IEEE Intelligent Systems, 34(1), 32-42. DOI: https: / / doi.org / 10.1109 / MIS.2019.2893590, and published on January 16, 2019. The algorithm described in this article aims to organize keywords at different levels (campaign and ad group levels - “ad-group”) following a greedy approach and measuring the proposed solution using a relevance score at different levels. To create the keyword distribution, it uses different strategies according to the different levels: for the campaign level it solves the problem known as “multiple-choice knapsack problem”, and for the “ad-group” level it solves the problem known as “clustering problem”.To measure the organization of the proposed keywords, the algorithm uses co-occurring statistical relationships between the keywords and metrics obtained from the advertising platform.

[0009] Other state-of-the-art documents based on natural language processing and machine learning algorithms are also known. One of them is the thesis by Lohs, D., published on January 18, 2021, entitled "Identification of negative keywords in search marketing with embedding layers and neural networks." Another is the thesis by Coenders, R., published in August 2019, entitled "Semantical Search Term Clustering for Performance Prediction." Both theses make use of word embedding (NLP) together with machine learning algorithms (neural networks and classifiers) to propose coherent organizations of keywords in documents.The main problems with these state-of-the-art solutions are that they require extensive prior data and significant computational time to train the models underlying their operation, both for Natural Language Processing and for machine learning algorithms.

[0010] Therefore, there is a need in the state of the art to be able to handle large quantities of documents to be tagged using keywords in a way that is efficient in terms of computation time and does not require prior data, which may not even be available.

[0011] DESCRIPTION OF THE INVENTION

[0012] The present invention relates to a method for tagging documents. The main objective of the method of the present invention is to correctly organize the keywords that tag documents according to lexical similarity, thus making data access more efficient and eliminating redundant access to information.

[0013] In order to better understand the invention, certain concepts that appear recurrently are defined below: • “Keyword”: is a word or a set of words that a person inserts when performing a search in a search engine (for example, in a search engine);

[0014] • “Token”: each word that makes up a keyword; and,

[0015] • “Document”: Data that has been tagged according to a set of keywords.

[0016] In a first aspect of the invention, a method for labeling documents by keywords is disclosed. The method for labeling documents by keywords of the present invention comprises: a) receiving a data set consisting of keywords and documents to which each of the keywords belong; b) extracting tokens from the keywords and classifying each token based on each keyword and document to which the token belongs; c) calculating the frequency of each token for each keyword and for each of the documents, and generating a frequency matrix of "0" and "1" with as many rows as the number of keywords and as many columns as tokens, where "1" represents that a token is contained in a document and "0" represents that a token is not contained in a document; d) calculating the Inverse Document Frequency "IDF" tO ken_¡“ for each token as: where N to tai is the total number of documents and M doCs_token is the number of documents containing tokenj; e) calculate a “TF-IDF” matrix of tokens by multiplying the frequency matrix by a diagonal matrix where each element of the main diagonal is the “IDF” tO ken_¡“ of each token; f) calculate a documents matrix where each row of the documents matrix is ​​the sum of the rows of the “TF-IDF” matrix of all the keywords that belong to the same document; g) calculate a similarity matrix with as many rows as keywords and as many columns as documents, where each element of the similarity matrix represents the score of each keyword with respect to each document, where each element of the similarity matrix is ​​calculated as: where:

[0017] A¡ are the components of the vector A , which is formed by each of the rows of the “TF-IDF” matrix;

[0018] B¡ are the components of the vector B , which is formed by each of the rows of the “documents” matrix; h) select for each keyword, the document with the highest score from the similarity matrix.

[0019] This is how documents are tagged with those keywords that obtain the highest score in the keyword-document relationship.

[0020] In one embodiment of the invention, the method of the present invention allows, for a new keyword, to select the document with the highest score from among all the documents that make up the data set. To do so, the method additionally comprises the following steps: extracting tokens of the new keyword; identifying whether the tokens of the new keyword are in the frequency matrix and discarding the tokens that are not in the frequency matrix; creating a new vector A of the same size as the previous vector A, where the new vector A is formed by multiplying the frequency of each token by the IDF of each token, for each token of the new keyword; and, repeating steps g) and h) above (of the first aspect of the invention).

[0021] In another embodiment of the invention, the step of calculating the “TF-IDF” matrix may additionally comprise filtering the “TF-IDF” matrix by selecting an option from among: keeping keywords classified as mandatory, eliminating keywords repeated at least three times, and a combination of the above.

[0022] In another embodiment of the invention, the method may additionally comprise assigning an identification number "tokenjd" to each token. This may facilitate the processing of each token, for which tupias may be formed where the first element of the tupia is the "tokenjd" and the second is the "IDF" tO ken_¡“-

[0023] In a second aspect of the invention, a computer-implemented method for tagging documents by keywords is disclosed, comprising the steps of the method for tagging documents by keywords of the first aspect of the invention. Optionally, the computer-implemented method for tagging documents by keywords may also comprise some or all of the embodiments of the invention described above for the first aspect of the invention.

[0024] In a third aspect of the invention, a processing device is disclosed comprising means for carrying out the steps of the method for tagging documents by keywords of the first aspect of the invention. Optionally, the processing device may also comprise means for carrying out some or all of the embodiments of the invention described above for the first aspect of the invention.

[0025] In a fourth aspect of the invention, a computer program is disclosed comprising instructions that, when the program is executed on a computer, cause the computer to carry out the steps of the method of tagging documents by keywords of the first aspect of the invention and, optionally, some or all of the embodiments of the invention described above for the first aspect of the invention.

[0026] In a fifth aspect of the invention, a computer-readable medium is disclosed comprising instructions that, when executed on a computer, cause the computer to carry out the steps of the method of tagging documents by keywords of the first aspect of the invention and, optionally, some or all of the embodiments of the invention described above for the first aspect of the invention.

[0027] BRIEF DESCRIPTION OF THE FIGURES

[0028] To complete the description of the invention and in order to assist in a better understanding of its characteristics, in accordance with a preferred embodiment thereof, a set of drawings is attached in which, for illustrative and non-limiting purposes, the following figures have been represented: FIG. 1 represents a flowchart of the method of labeling documents by keywords of the present invention for keywords of the documents.

[0029] FIG. 2 represents a flowchart of the method of tagging documents by keywords of the present invention for new keywords with respect to previously received documents.

[0030] DESCRIPTION OF A PREFERRED EMBODIMENT OF THE INVENTION

[0031] In order to illustrate the present invention, an exemplary embodiment thereof is detailed below, where the indicated references can be found in FIGS. 1 and 2.

[0032] The method of tagging documents by keywords of the present invention begins by receiving (10) a data set consisting of keywords and documents to which each of the keywords belongs. For example:

[0033] Table 1

[0034] The method then extracts (20) keyword tokens and classifies each token based on each keyword and each document to which the token belongs. Continuing with the previous example:

[0035] Table 2

[0036] The method then calculates (30) the frequency of each token for each keyword and for each of the documents. One way to express the frequency of each token is through a matrix. Therefore, the method generates a matrix that can be called a "frequency matrix", which is composed of "0" and "1". The frequency matrix has as many rows as the number of keywords and as many columns as the number of tokens. The "1" represents that a token is contained in a document and the "0" represents that a token is not contained in a document. Before showing the frequency matrix, and in order to improve the handling and clarity of the tokens, the method assigns (21) an identifying number called "tokenjd" to each token. Continuing with the previous example, Table 3 is shown below with the tokens and their corresponding tokensjd:

[0037] Table 3

[0038] With the mapping between tokens and tokenjd shown in Table 3, the elements of the frequency matrix will be composed of tupias formed by the tokenjd and the frequency "1" or "0", depending on whether the token is present in the keyword or not. Continuing with the example (see Table 4):

[0039] Table 4

[0040] In parallel, before or after the step of calculating the frequency matrix, the method calculates (30') the Inverse Document Frequency “IDF tO ken_¡“ for each token as: where N to tai is the total number of documents and M doC s_token is the number of documents containing tokenj. This gives (see Table 5): Table 5

[0041] The method then combines the token frequencies with the IDF calculated for each token. To do this, the method calculates (40) a matrix that can be called the “TF-IDF matrix” of tokens by multiplying the frequency matrix by a diagonal matrix where each element of the main diagonal is the “IDF” tO ken_¡“ of each token. To perform this computation, only the frequency values ​​(“1” or “0”) are taken without the respective tokenjd. That is: The next step in the method is to filter (50) the "TF-IDF" matrix. This step is optional and will depend on the amount of data (documents, keywords, and tokens) to be computed. In this embodiment, no filter is applied since the amount of data is not large. An example of filtering consists of keeping keywords classified as mandatory. Another example of filtering consists of eliminating keywords repeated at least three times. Both examples can be combined.

[0042] Since no data has been leaked, and re-entering the tokensjd, the “TF-IDF” matrix, in tupias format, would look like this (see Table 6):

[0043] Table 6

[0044] The method then calculates (60) the similarity between keywords and documents.

[0045] This step (60) involves two sub-steps. The first sub-step is to calculate (61) a matrix that can be called the “document matrix” where each row of the documents matrix is ​​the sum of the rows of the “TF-IDF” matrix of all the keywords belonging to the same document. Continuing with the example and expressing the documents matrix as with tupias (tokenjd, frequency) (see Table 7):

[0046] Table 7

[0047] The next sub-step is to calculate (62) a matrix called “similarity matrix” with as many rows as keywords and as many columns as documents, where each element of the similarity matrix represents the score of each keyword with respect to each document, where each element of the similarity matrix is ​​calculated as (equation 1): where A¡ are the components of vector A , which is formed by each of the rows of the “TF-IDF” matrix; and B¡ are the components of vector B , which is formed by each of the rows of the “documents” matrix. Continuing with the example, the calculation for the keyword “a storm” and “document 1” is shown:

[0048] A = [ 3 / 10, 3 / 10,0,0,0,0,0,0,0], which can be expressed with tokens (tokenjd, value) for better understanding:

[0049] A = [(0.3 / 10), (1.3 / 10), (2.0), (3.0), (4.0), (5.0), (6.0), (7.0), (8.0)]

[0050] B = [9 / 10,3 / 5,3 / 5,3 / 25,0,0,0,0,0], which can also be expressed with tokens (tokenjd, value) for better understanding:

[0051] B =[(0.9 / 10), (1.3 / 5), (2, 3 / 5), (3, 3 / 25), (4.0), (5.0), (6.0), (7.0), (8.0)]

[0052] Applying equation 1: cos(0)

[0053] = 0.86 Applying equation 1 for each keyword in each document we obtain (see Table 8):

[0054] Table 8

[0055] Finally, the method iterates over the results obtained and selects (70) the document with the highest similarity score, which is then labeled. The result is summarized in Table 9, which highlights the selected score. It should be noted that in this step, although all keywords are considered during the iteration, it is at this point that repeated keywords are eliminated based on their score, resulting in the selection of the keywords with the highest scores:

[0056] Table 9

[0057] The method additionally allows to label which document of the documents contained in the data set received in the first step (10) has the best similarity score with respect to a new keyword. For example, the new keyword (100) is "snow sunny weather". The method extracts the tokens (110) of the new keyword. Subsequently, the method identifies (120) if the tokens of the new keyword are included in the frequency matrix, and discards (121) the tokens that are not in the frequency matrix. With the tokens that are in the frequency matrix, the method creates (130) a new vector A of the same size as the previous vector A, where the new vector A is formed by multiplying the frequency of each token by the IDF of each token, for each token of the new keyword. Continuing with the example (see Table 10):

[0058] Table 10

[0059] Method (140) then calculates the similarity (=distance) between the new vector A and the vectors in the documents matrix. That is, it applies the cosine theorem (equation 1) to the new vector A and to the vectors in the documents matrix.

[0060] Table 11 where A¡ are the components of the new vector A; and B¡ are the components of the vector B , which is formed by each of the rows of the matrix “documents”. Continuing with the example, the calculation for the new keyword “snow sunny weather” is shown. 1 ' and “document 1”:

[0061] A = [ 0, 0, 3 / 10, 0, 0, 6 / 10, 3 / 10, 0, 0], which can be expressed with tokens (tokenjd, value) for better understanding: new A = [(0,0), (1,0), (2, 3 / 10), (3,0), (4,0), (5, 6 / 10), (6, 3 / 10), (7,0), (8,0)]

[0062] B = [9 / 10,3 / 5,3 / 5,3 / 25,0,0,0,0,0], which can be expressed with tokens (tokenjd, value) for better understanding:

[0063] B =[(0.9 / 10), (1.3 / 5), (2, 3 / 5), (3, 3 / 25), (4.0), (5.0), (6.0), (7.0), (8.0)]

[0064] Applying equation 1: cos(0)

[0065] = 0.19

[0066] Applying equation 1 for each keyword in each document we obtain (see Table 12):

[0067] Table 12

[0068] Finally, method (150) selects and labels the document with the greatest similarity to the new keyword. That is, among all the documents, it chooses the one with the highest value, which represents the greatest similarity and the smallest distance. Continuing with the example, document 3 is labeled as the document with the greatest similarity to the new keyword "snow sunny weather."

Claims

CLAIMS 1.- A method for labeling documents by keywords, characterized in that it comprises: a) receiving (10) a data set formed by keywords and documents to which each of the keywords belong; b) extracting (20) tokens of the keywords and classifying each token based on each keyword and document to which the token belongs; c) calculating (30) the frequency of each token for each keyword and for each of the documents, and generating a "frequency" matrix of "0" and "1" with as many rows as the number of keywords and as many columns as tokens, where "1" represents that a token is contained in a document and "0" represents that a token is not contained in a document; d) calculating (30') the Inverse Document Frequency "IDF" tO ken_¡“ for each token as: where N to tai is the total number of documents and M doCs_token is the number of documents containing tokenj; e) calculate (40) a “TF-IDF” matrix of tokens by multiplying the “frequency” matrix by a diagonal matrix where each element of the main diagonal is the “IDF tO ken_¡“ of each token; f) calculate (61) a matrix “documents” where each row of the matrix “documents” is the sum of the rows of the matrix “TF-IDF” of all the keywords that belong to the same document; g) calculate (62) a matrix “similarity” with as many rows as keywords and as many columns as documents, where each element of the matrix “similarity” represents the score of each keyword with respect to each document, where each element of the matrix “similarity” is calculated as: where: A¡ are the components of the vector A , which is formed by each of the rows of the “TF-IDF” matrix; B¡ are the components of the vector B , which is formed by each of the rows of the “documents” matrix; h) select and label (70) for each keyword, the document with the highest score in the similarity matrix. 2.- The method of claim 1, characterized in that it additionally comprises selecting for a new keyword (100), the document with a higher score, for which the method additionally comprises the following steps: • extract (110) some tokens from the new keyword; • identify (120) whether the tokens of the new keyword are in the “frequency” array and discard (121) the tokens that are not in the “frequency” array; • create (130) a new vector A of the same size as the previous vector A, where the new vector A is formed by the result of multiplying the frequency of each token by the IDF of each token, for each token of the new keyword; • repeat steps g) (140) and h) (150) above. 3.- The method of claim 1 or 2, characterized in that the step of calculating (40) the “TF-IDF” matrix additionally comprises filtering (50) the “TF-IDF” matrix by selecting an option from among: keeping keywords classified as mandatory, eliminating keywords repeated at least three times and a combination of the above. 4.- The method of any one of the preceding claims, characterized in that it additionally comprises assigning (21) an identification number “token id” to each token. 5.- A method of tagging documents by keywords implemented by computer, characterized in that it comprises the steps included in one of claims 1 to 4. 6.- A processing device comprising means for carrying out the steps of the method of one of claims 1 to 4. 7.- Computer program, characterized in that it comprises instructions that, when the program is executed on a computer, cause the computer to carry out the steps of the method of any one of claims 1 to 4. 8.- Computer-readable medium comprising instructions that, when executed on a computer, cause the computer to carry out the steps of the method of any one of claims 1 to 4.

Citation Information

Patent Citations

  • Key-word identification

    US11288453B1

  • Cross-domain contextual targeting without any in-domain labelled data

    US20210097571A1

  • Method and device for matching semantic text data with a tag, and computer-readable storage medium having stored instructions

    US20210286835A1