Create README.md
Browse files
README.md
ADDED
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Usage
|
2 |
+
```python
|
3 |
+
# import library
|
4 |
+
import torch
|
5 |
+
from transformers import AutoTokenizer, AutoModelForSequenceClassification, TextClassificationPipeline
|
6 |
+
|
7 |
+
# load model
|
8 |
+
tokenizer = AutoTokenizer.from_pretrained("jaehyeong/koelectra-base-v3-finetuned-generalized-sentiment-analysis")
|
9 |
+
model = AutoModelForSequenceClassification.from_pretrained("jaehyeong/koelectra-base-v3-finetuned-generalized-sentiment-analysis")
|
10 |
+
sentiment_classifier = TextClassificationPipeline(tokenizer=tokenizer, model=model)
|
11 |
+
|
12 |
+
# target reviews
|
13 |
+
review_list = [
|
14 |
+
'μ΄μκ³ μ’μμ~~~μ»κΈ°λ νΈνκ³ μμ΄κ³ μ΄μλ€κ³ μκΈ°λ°©μ κ°λ€λκ³ μμ¨μ~^^',
|
15 |
+
'μμ§ μ
μ΄λ³΄μ§ μμμ§λ§ κ΅μ₯ν κ°λ²Όμμ~~ λ€λ₯Έ 리뷰μ²λΌ μ΄κΉ‘μ΄ μ’ λλ€μγ
λ§μ‘±ν©λλ€. μμ² λΉ λ₯Έλ°μ‘ κ°μ¬λλ €μ :)',
|
16 |
+
'μ¬κ΅¬λ§€ νκ±΄λ° λ무λ무 κ°μ±λΉμΈκ±° κ°μμ!! λ€μμ λ μκ°λλ©΄ 3κ°μ§Έ λ μ΄λ―..γ
γ
',
|
17 |
+
'κ°μ΅λμ΄ λ무 μ μ΄μ. λ°©μ΄ μμ§ μλ€λ©΄ 무쑰건 ν°κ±Έλ‘ꡬ맀νμΈμ. λ¬Όλλ μ‘°κΈλ°μ μλ€μ΄κ°μ μ°κΈ°λ λΆνΈν¨',
|
18 |
+
'νλ²μ
μλλ° μμ λ΄μ μ λ€ νλ¦¬κ³ μ€λ°₯λ κ³μ λμ΅λλ€. λ§κ° μ²λ¦¬ λ무 μλ§ μλκ°μ?',
|
19 |
+
'λ°λ»νκ³ μ’κΈ΄νλ° λ°°μ‘μ΄ λλ €μ',
|
20 |
+
'λ§μ μλλ° κ°κ²©μ΄ μλ νΈμ΄μμ'
|
21 |
+
]
|
22 |
+
|
23 |
+
# predict
|
24 |
+
for idx, review in enumerate(review_list):
|
25 |
+
pred = sentiment_classifier(review)
|
26 |
+
print(f'{review}\n>> {pred[0]}')
|
27 |
+
```
|