# Sentiment features for machine learning `KosacVectorizer` turns Korean text into KOSAC label-probability features, so the lexicon can feed a scikit-learn pipeline. ## Install ```bash pip install "kosac-lexicon[kiwi,sklearn]" ``` (`[kiwi]` for the tokenizer, `[sklearn]` for the estimator base classes.) ## A classification pipeline ```python from kosac.sklearn import KosacVectorizer from sklearn.linear_model import LogisticRegression from sklearn.pipeline import make_pipeline train_texts = [ "정말 훌륭하고 만족스러운 제품이다", "최고의 경험이었고 매우 행복했다", "친절한 서비스에 기분이 좋았다", "형편없고 실망스러운 품질이다", "최악이었고 다시는 안 쓴다", "불친절해서 너무 화가 났다", ] labels = ["pos", "pos", "pos", "neg", "neg", "neg"] clf = make_pipeline(KosacVectorizer("all"), LogisticRegression(max_iter=1000)) clf.fit(train_texts, labels) clf.predict(["기대 이상으로 만족스럽다", "두 번 다시 가고 싶지 않다"]) # array(['pos', 'neg'], dtype='=