# Automatic question categorization when we know important words in each category

I am currently working on a question categorization problem where I automatically want to assign a category to the question. The question set I have is unlabelled. The categories for the problem are well defined e.g. Business, Technology, Sports etc. I also have a specific set of words which are important for each of the category (which have been taken from the dataset) and which define the respective categories. Using these information, which learning algorithm can I use wherein I can specify these categories and the important words for that category in context of the unlabelled data that I have?

Repsonses are highly valued. Thanks in advance.

• Posting it as an answer since I don't have enough reputation to comment. Have you tried using LDA (Latent Dirichlet Allocation) Nov 13, 2017 at 9:04
• To get started, can't you label some of them yourself (say 100; or 10/category); and then apply a supervised learning method such as Multinomial Naive Bayes on your dataset.
– knb
Nov 13, 2017 at 14:06
• I have around 700 odd questions. Wouldn't labeling just 100 be quite less in terms of representation of the overall data-set and inadequate for the learning algorithm? Nov 14, 2017 at 5:01
• Just try it. If it doesn't work, try something else.
– knb
Nov 14, 2017 at 15:19

You said you have a bunch of keywords for each category extracted from the data. It is better to explain how did you get them as your data does not contain labels i.e. how do you know the word $w_i$ is a representative of category business?

You might have assigned them based on semantics which is not bad but does not give you a level of confidence that they are really the representatives of category. The whole point about clustering is to find this representative words via the algorithm. An example is the famous concept of Stop Words. Everyone thinks that words such as $The$, $is$, $an$ and the rest of common lists are stop words but empirically you always get better classification result including them! That's because in NLP the only reference to indicate a stop word is the data itself. So be careful about it.

Assuming your words are really representatives (however I would rely on LDA results), I would design a score for similarity of each question to each category representation list. It could be the category which has the maximum number of representatives in the sentence. It most probably falls in overfitting problem however you will not see that (your problem is unsupervised) but if you insist using them it could be a starting point.

In the direction of this idea, another one could be to extract the very extreme words for each category (e.g. "Manchester united" and "Neymar" are more probable to represent sport) then do the same clustering with only extreme words and based on found categories find more representatives and feed them to the algorithm again (iterative manner) and continue till some stopping criterion is satisfied. This looks like above but the difference is that the least input (first set of words) are fed manually and the rest will be found through algorithm.

You also may have a look at embedding algorithm such as word2vec or doc2vec and use them with some similarity measure (cosine similarity for example).