kosac-lexicon¶
A morpheme-level Korean sentiment lexicon derived from KOSAC (the Korean
Sentiment Analysis Corpus), packaged for Python. The import name is kosac; the
distribution name is kosac-lexicon.
Note
Pre-release (beta, 0.5.0). The API may change before the 1.0 release.
import kosac
lex = kosac.load_lexicon("polarity", ngrams=[1], min_freq=5)
lex.get_entry("힘/NNG")
analyzer = kosac.SentimentAnalyzer("polarity", negation=True) # needs [kiwi]
analyzer.analyze("이 영화는 안 좋다")["features"]["polarity"]["label"] # 'NEG'
# For POS/NEG classification, the high-accuracy blend + multi-scale scorer:
clf = kosac.SentimentAnalyzer("polarity-blend")
clf.predict_polarity("이 영화 정말 재미있다") # 'POS'
Tutorials