Update README.md
Browse files
README.md
CHANGED
@@ -50,17 +50,24 @@ Accuracy : 0.975
|
|
50 |
**!IMPORTANT_HINT: The sentence given to pipe must not contain Turkish characters.**
|
51 |
|
52 |
```sh
|
53 |
-
from transformers import AutoTokenizer, TextClassificationPipeline,
|
54 |
|
55 |
tokenizer = AutoTokenizer.from_pretrained("nanelimon/bert-base-turkish-job-advertisement")
|
56 |
-
model =
|
57 |
pipe = TextClassificationPipeline(model=model, tokenizer=tokenizer)
|
58 |
|
59 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
60 |
```
|
61 |
Result;
|
62 |
```sh
|
63 |
-
[{'label': '
|
64 |
```
|
65 |
- label= It shows which class the sent Turkish text belongs to according to the model.
|
66 |
- score= It shows the compliance rate of the Turkish text sent to the label found.
|
|
|
50 |
**!IMPORTANT_HINT: The sentence given to pipe must not contain Turkish characters.**
|
51 |
|
52 |
```sh
|
53 |
+
from transformers import AutoTokenizer, TextClassificationPipeline, AutoModelForSequenceClassification
|
54 |
|
55 |
tokenizer = AutoTokenizer.from_pretrained("nanelimon/bert-base-turkish-job-advertisement")
|
56 |
+
model = AutoModelForSequenceClassification.from_pretrained("nanelimon/bert-base-turkish-job-advertisement")
|
57 |
pipe = TextClassificationPipeline(model=model, tokenizer=tokenizer)
|
58 |
|
59 |
+
|
60 |
+
def set_sentence(sentence: str):
|
61 |
+
result = sentence.lower().replace('ö', 'o').replace('ı', 'i').replace('ü', 'u').replace('ç', 'c').replace('ğ', 'g').replace('ş', 's')
|
62 |
+
return result
|
63 |
+
|
64 |
+
|
65 |
+
print(pipe(set_sentence('Fiziği düzgün 17 yaş kızlar aranıyor')))
|
66 |
+
|
67 |
```
|
68 |
Result;
|
69 |
```sh
|
70 |
+
output: [{'label': 'Mustehcen', 'score': 0.9992677569389343}]
|
71 |
```
|
72 |
- label= It shows which class the sent Turkish text belongs to according to the model.
|
73 |
- score= It shows the compliance rate of the Turkish text sent to the label found.
|