0
$\begingroup$

I am working on a project where I have a dataset which contains very less data. These are the comments of people. I have only 130 lines with 10 words per line. My goal is to identify the common topics which are being discussed here. What should be my approach?

  1. Topic modelling
  2. Topic classification
  3. Keyword Extraction
  4. Text Summariser
$\endgroup$

1 Answer 1

1
$\begingroup$

Maybe a simpler solution like below would help? I am not a fan of topic modeling because i feel results wont be worth the effort.

To understand what the people are talking about here:

  1. Use ngram frequency analysis to get common topics being discussed.
  2. If sentiment score makes sense, try a good hugging face pipeline to get sentiment score. (If you have bandwidth try your own sentiment model)
  3. Now build your ngram analysis on positive and negative sentiment separately and have a feel of what the people are generally happy about and what they are disappointed on.

Here is an example for huggingface model with +ve, -ve and neutral flags:

# pip install -q transformers
from transformers import pipeline
sentiment_pipeline = pipeline(model="finiteautomata/bertweet-base-sentiment-analysis")
data = ["I love you", "I hate you"]
sentiment_pipeline(data)

Below is snippet example on how you can get ngram frequencies: Play with ngram_range parameter to get bigram and trigrams only eg: (2,3) etc..

from sklearn.feature_extraction.text import CountVectorizer

word_vectorizer = CountVectorizer(ngram_range=(1,3), analyzer='word', lowercase=True, stop_words="english")

sparse_matrix = word_vectorizer.fit_transform(text_list)

frequencies = sum(sparse_matrix).toarray()[0]

f = pd.DataFrame(frequencies, index=word_vectorizer.get_feature_names(), columns=['frequency']).sort_values("frequency", ascending=False)

I would also suggest to look at aspect based sentiment analysis and check if there are any pretrained models you can use.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.