serdarakyol
commited on
Commit
•
7bf40a4
1
Parent(s):
4ce654d
Update README.md
Browse files
README.md
CHANGED
@@ -20,6 +20,8 @@ tokenizer = AutoTokenizer.from_pretrained("serdarakyol/interpress-turkish-news-c
|
|
20 |
|
21 |
model = AutoModelForSequenceClassification.from_pretrained("serdarakyol/interpress-turkish-news-classification")
|
22 |
```
|
|
|
|
|
23 |
```sh
|
24 |
# PREPROCESSING
|
25 |
import re
|
@@ -91,7 +93,11 @@ def prediction(news):
|
|
91 |
pred = np.argmax(logits,axis=1)[0]
|
92 |
return pred
|
93 |
```
|
94 |
-
|
|
|
|
|
|
|
|
|
95 |
```sh
|
96 |
labels = {
|
97 |
0 : "Culture-Art",
|
@@ -107,6 +113,7 @@ labels = {
|
|
107 |
}
|
108 |
pred = prediction(news)
|
109 |
print(labels[pred])
|
|
|
110 |
```
|
111 |
Thanks to @yavuzkomecoglu for contributes
|
112 |
|
|
|
20 |
|
21 |
model = AutoModelForSequenceClassification.from_pretrained("serdarakyol/interpress-turkish-news-classification")
|
22 |
```
|
23 |
+
## NOTE: Please remember, for predict on BERT model, you don't actually need to preprocessing but the dataset was real world data. That why I needed to do some preprocessing. If you have normal news from any news web page, you can just copy the news and past. Then delete the first comment on ***prediction*** function. That's it.
|
24 |
+
|
25 |
```sh
|
26 |
# PREPROCESSING
|
27 |
import re
|
|
|
93 |
pred = np.argmax(logits,axis=1)[0]
|
94 |
return pred
|
95 |
```
|
96 |
+
```sh
|
97 |
+
news = r"ABD'den Prens Selman'a yaptırım yok Beyaz Saray Sözcüsü Psaki, Muhammed bin Selman'a yaptırım uygulamamanın \"doğru karar\" olduğunu savundu. Psaki, \"Tarihimizde, Demokrat ve Cumhuriyetçi başkanların yönetimlerinde diplomatik ilişki içinde olduğumuz ülkelerin liderlerine yönelik yaptırım getirilmemiştir\" dedi."
|
98 |
+
```
|
99 |
+
You can find the news in this [link](https://www.ntv.com.tr/dunya/abdden-prens-selmana-yaptirim-yok,YTeWNv0-oU6Glbhnpjs1JQ)
|
100 |
+
news data: 02/03/2021
|
101 |
```sh
|
102 |
labels = {
|
103 |
0 : "Culture-Art",
|
|
|
113 |
}
|
114 |
pred = prediction(news)
|
115 |
print(labels[pred])
|
116 |
+
# > World
|
117 |
```
|
118 |
Thanks to @yavuzkomecoglu for contributes
|
119 |
|