--- 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.