pythainlp.sentiment

The romanization.sentiment is sentiment analysis.

pythainlp.sentiment.sentiment(text, engine='old')[source]
Parameters
  • text (str) – thai text

  • engine (str) – sentiment analysis engine (old or ulmfit)

Returns

pos or neg

Example::
>>> from pythainlp.sentiment import sentiment
>>> text="วันนี้อากาศดีจัง"
>>> sentiment(text)
'pos'
>>> sentiment(text,'ulmfit')
'pos'
>>> text="วันนี้อารมณ์เสียมาก"
>>> sentiment(text)
'neg'
>>> sentiment(text,'ulmfit')
'neg'