File size: 2,236 Bytes
fa12432
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
---
language:
- ja
library_name: transformers
pipeline_tag: text-classification
tags:
- sentiment
- analysis
- Japanses
---

# Sentiment Analysis in Japanese - Phân tích cảm xúc trong tiếng Nhật
## Bert phân tích cảm xúc


## Model description

Mô hình có tác dụng xác định cảm xúc của đoạn văn.
Sử dụng nhãn: "positive", "negative"

Ví dụ:
今日はいい天気ですね
```text
    negative: 6.001393558108248e-05
    positive: 0.999940037727356
```

今日の食べ物はとてもつまらない
```text
    negative: 0.9999252557754517
    positive: 7.470489799743518e-05
```

## Base model

Mô hình được đạo tạo dựa trên cơ sở của model Base Japanese

## Training data

Mô hình được đào tạo dựa trên dữ liệu được thu thập bởi TAKAHIRO KUBO (https://www.kaggle.com/datasets/takahirokubo0/chabsa) - có chỉnh sửa.

## Model variations

Chưa xác định

## Intended uses & limitations

Chưa xác định

## License

Đây là một open-source library, bạn có thể sử dụng nó với bất kì mục đích nào.
Rất cảm ơn nếu bạn ghi nguồn khi sử dụng mô hình này (nếu không ghi cũng không sao).

### How to use

```python
from transformers import AutoTokenizer, AutoModelForSequenceClassification
import torch
import os


def clear():
    os.system('clear')


checkpoint = "mr4/bert-base-jp-sentiment-analysis"
tokenizer = AutoTokenizer.from_pretrained(checkpoint)
model = AutoModelForSequenceClassification.from_pretrained(checkpoint)
clear()
print("Ngày hôm nay của bạn thế nào?")
val = input("")
raw_inputs = [val]
inputs = tokenizer(raw_inputs, padding=True,
                   truncation=True, return_tensors="pt")
outputs = model(**inputs)
predictions = torch.nn.functional.softmax(outputs.logits, dim=-1)
clear()
print(">>>>>>>>>>>>>>>>>>>>>>>>>>")
for i, prediction in enumerate(predictions):
    print(raw_inputs[i])
    for j, value in enumerate(prediction):
        print(
            "    " + model.config.id2label[j] + ": " + str(value.item()))
print("<<<<<<<<<<<<<<<<<<<<<<<<<<")

```

## Liên hệ

Mọi thông tin liên quan có thể liên hệ qua email: zZz4everzZz@live.co.uk.