🚀 韓国語タイポ修正器
このツールは、ETRI - et5モデルをベースにファインチューニングした韓国語の口語体専用のタイポ修正器です。
🚀 クイックスタート
韓国語タイポ修正器は、ETRI - et5モデルを利用して韓国語の口語体のタイポを修正します。以下に使用方法を示します。
✨ 主な機能
- ETRI - et5モデルをベースにファインチューニングされた韓国語口語体専用のタイポ修正機能を提供します。
📦 インストール
本モデルを使用するには、transformers
ライブラリが必要です。以下のコマンドでインストールできます。
pip install transformers
💻 使用例
基本的な使用法
from transformers import T5ForConditionalGeneration, T5Tokenizer
model = T5ForConditionalGeneration.from_pretrained("j5ng/et5-typos-corrector")
tokenizer = T5Tokenizer.from_pretrained("j5ng/et5-typos-corrector")
device = "cuda:0" if torch.cuda.is_available() else "cpu"
model = model.to(device)
input_text = "아늬 진짜 무ㅓ하냐고"
input_encoding = tokenizer("맞춤법을 고쳐주세요: " + input_text, return_tensors="pt")
input_ids = input_encoding.input_ids.to(device)
attention_mask = input_encoding.attention_mask.to(device)
output_encoding = model.generate(
input_ids=input_ids,
attention_mask=attention_mask,
max_length=128,
num_beams=5,
early_stopping=True,
)
output_text = tokenizer.decode(output_encoding[0], skip_special_tokens=True)
print(output_text)
高度な使用法
from transformers import T5ForConditionalGeneration, T5Tokenizer, pipeline
model = T5ForConditionalGeneration.from_pretrained('j5ng/et5-typos-corrector')
tokenizer = T5Tokenizer.from_pretrained('j5ng/et5-typos-corrector')
typos_corrector = pipeline(
"text2text-generation",
model=model,
tokenizer=tokenizer,
device=0 if torch.cuda.is_available() else -1,
framework="pt",
)
input_text = "완죤 어이업ㅅ네진쨬ㅋㅋㅋ"
output_text = typos_corrector("맞춤법을 고쳐주세요: " + input_text,
max_length=128,
num_beams=5,
early_stopping=True)[0]['generated_text']
print(output_text)
📚 ドキュメント
ベースとなるPLMモデル
- ETRI(https://aiopen.etri.re.kr/et5Model)
ベースとなるデータセット
- 모두의 말뭉치(https://corpus.korean.go.kr/request/reausetMain.do?lang=ko)のタイポ修正データ
データ前処理
-
- 特殊文字(カンマ、ピリオド)を削除します。
-
- null値("")を削除します。
-
- 非常に短い文(長さが2以下)を削除します。
-
- 文中の&name&、name1などの名前タグが含まれる単語を削除します(単語のみ削除し、文は残します)。
- 合計: 318,882ペア
📄 ライセンス
本プロジェクトは、Apache - 2.0ライセンスの下で公開されています。