Categorizing 1Million+ posts?

thizzladen

Power Member
Joined
Jul 11, 2009
Messages
765
Reaction score
671
I have generated about 1 million posts on a test website. The problem is I'm looking for ideas on how best to categorize them programmatically, it could take forever doing it manually (Even if I categorize 1000 posts per day it would take almost 3 years o_O) .
 
Mysql may be? Bigger question is, how do you know which post goes to which category?
 
Mysql may be? Bigger question is, how do you know which post goes to which category?
Yep, that's my problem. I have them in mongodb already, I set each post with tags, but now i have thousands of tags so I'm looking for a way to put them in categories instead.
 
Yep, that's my problem. I have them in mongodb already, I set each post with tags, but now i have thousands of tags so I'm looking for a way to put them in categories instead.
Hmmm so.. Perhaps try making a node.js script that looks for certain keywords inside the post description, short description (if any) and title... if it finds the keyword, it calls mongodb and updates the record and assigns the related category (you could have a map of category vs keyword). This is easier said than done though.
 
Hmmm so.. Perhaps try making a node.js script that looks for certain keywords inside the post description, short description (if any) and title... if it finds the keyword, it calls mongodb and updates the record and assigns the related category (you could have a map of category vs keyword). This is easier said than done though.
That sounds like a good plan to start, that way my "Uncategorized" posts won't be as many and I can do those manually. Thanks!
 
Would say by using MySQL base if you know how to make one, and if you aren't sure you can hire someone to help you with it, it will be cheaper even then buying some tool and you'll get more precise results.
 
Use a python script with Natural Language Processing (NLP), you can use a library like NLTK to extract keywords and categorize based on the most prominent keyword.
 
Use a python script with Natural Language Processing (NLP), you can use a library like NLTK to extract keywords and categorize based on the most prominent keyword.
Thats a really interesting library thanks for the suggestion!
 
How did you generate 1M articles? How many days it took to complete?
 
Try to make a script that looks for keyword density in each post content (with expections like "the", "or" etc.) and then assign categories to certain keywords OR basically create categories off those keywords that have the most density overall (all posts). IMO the best way to do that, or try some magic with NLP as someone already said.
 
I have generated about 1 million posts on a test website. The problem is I'm looking for ideas on how best to categorize them programmatically, it could take forever doing it manually (Even if I categorize 1000 posts per day it would take almost 3 years o_O) .

You need some kind of algorithm to classify that amount of text, and defining a set of keywords is not feasible for a lot of reasons.

You would need to have an idea of what the articles are talking about already, with so many posts keywords would certainly overlap in a lot of cases, and your categorization would be limited to words and not meaning: imagine a post about blogging. It will contain references to content marketing, SEO and possibly web-design. How can you determine programmatically what's the actual topic without reading the text?

Solution 1: an algorithm capable of finding intra-article keyword density with respect to the rest of the corpus, so excluding the most frequent words from the analysis (hint: if blogging appears in every article with the same frequency, is not so relevant for classification). You can realize something similar with TF-IDF (Term Frequency — Inverse Document Frequency) vectorizing. An implementation is possible with Sklearn and NLTK.

Solution 2: Use word embeddings to reduce dimensionality and cluster your articles on meaning. The approach is similar, but words are not considered in a vacuum: the approach above would not take into account if blogging and blog have the same meaning. The words are grouped if they tend to appear together in a document and the algorithm you are looking for is LSA (Latent semantic analysis), which can be implemented as a PCA (Principal component analysis) on Sklearn.

Solution 3: A Fill-Mask model based on BERT to assign a label to every article. You can fine-tune a model on Huggingface or use one as-it-is, but don't expect miracles.

Solution 4, not suggested: There are easy pipelines to set up on Spacy to extract keywords from text. Look for RAKE and you should find some more methods. It is simple to start with this one but for experience, I can tell you it is fairly inaccurate.

I hope that helps!
 
You need some kind of algorithm to classify that amount of text, and defining a set of keywords is not feasible for a lot of reasons.

You would need to have an idea of what the articles are talking about already, with so many posts keywords would certainly overlap in a lot of cases, and your categorization would be limited to words and not meaning: imagine a post about blogging. It will contain references to content marketing, SEO and possibly web-design. How can you determine programmatically what's the actual topic without reading the text?

Solution 1: an algorithm capable of finding intra-article keyword density with respect to the rest of the corpus, so excluding the most frequent words from the analysis (hint: if blogging appears in every article with the same frequency, is not so relevant for classification). You can realize something similar with TF-IDF (Term Frequency — Inverse Document Frequency) vectorizing. An implementation is possible with Sklearn and NLTK.

Solution 2: Use word embeddings to reduce dimensionality and cluster your articles on meaning. The approach is similar, but words are not considered in a vacuum: the approach above would not take into account if blogging and blog have the same meaning. The words are grouped if they tend to appear together in a document and the algorithm you are looking for is LSA (Latent semantic analysis), which can be implemented as a PCA (Principal component analysis) on Sklearn.

Solution 3: A Fill-Mask model based on BERT to assign a label to every article. You can fine-tune a model on Huggingface or use one as-it-is, but don't expect miracles.

Solution 4, not suggested: There are easy pipelines to set up on Spacy to extract keywords from text. Look for RAKE and you should find some more methods. It is simple to start with this one but for experience, I can tell you it is fairly inaccurate.

I hope that helps!
Necro bump incoming but I think this is a good post.
You seem to be particularly knowledgeable in this area of ML / NLP.
 
You can actually write a script that fetches the post and add it to a specific category if it matches a good percentage of grouped tags,
So, your first step would be to group tags to get each one of them to match a category,
Then you'll be fetching each blog post to collect the post tags, and if let's say 60% of specific group tags, then it will be added to the category,
And if it does match tags from a different group, it will be added to a secondary category as well,

Idk if i did explain that well,
but i hope you got the point!
 
I had a similar challenge last month with a new 500,000 post experimental website that I was launching! I ran a python script with Natural Language Processing (NLP) to categorize and add tags to all posts. It did an incredible job and saved me days, if not months, of hard work.

Here is a brief overview of how to get it done: CLICK HERE

Or you can hire someone to get the job done if you're not very familiar with Python.
 
You can actually write a script that fetches the post and add it to a specific category if it matches a good percentage of grouped tags,
So, your first step would be to group tags to get each one of them to match a category,
Then you'll be fetching each blog post to collect the post tags, and if let's say 60% of specific group tags, then it will be added to the category,
And if it does match tags from a different group, it will be added to a secondary category as well,

Idk if i did explain that well,
but i hope you got the point!
thanks for your advice
 
With the possibility that Google indexes all your 1 million posts being essentially 0%, you're best off just setting some categories manually and then randomly assigning your posts to them.
 
Back
Top