Autocorrect EN V2
A
Autocorrect EN V2
Cipher-AIによって開発
T5-baseベースの英語スペル自動修正モデルで、テキスト内のスペルミスを効率的に修正できます。
ダウンロード数 60
リリース時間 : 3/10/2025
モデル概要
このモデルは英語テキストのスペルミス修正に特化しており、複雑なスペル変形を処理し、文法と意味に合致した修正結果を出力します。
モデル特徴
マルチレベル修正
モデル組み合わせにより文字置換検出と意味レベル修正の二重誤り訂正メカニズムを実現
コンテキスト認識
単純な辞書マッチングではなく、文脈意味に基づいたインテリジェントな修正が可能
記号保持
修正プロセスで元のテキストの句読点や特殊文字を保持
モデル能力
英語スペル修正
意味回復
誤字修正
文法正規化
使用事例
テキスト処理
文書自動校正
オフィス文書内のスペルミスを自動修正
文書の専門性と可読性向上
ユーザー入力修正
チャットボットが受信した誤字を含むユーザー入力を修正
対話システムの理解精度向上
教育支援
言語学習ツール
英語学習者にライティングアドバイスを提供
非ネイティブのライティング品質改善を支援
🚀 文章の誤字修正モデル
このモデルは文章中の誤字を検出し、修正された文章を出力します。
🚀 クイックスタート
このモデルは文章中の誤字を検出し、修正された文章を出力するために使用されます。
✨ 主な機能
- 文章中の誤字を検出し、修正された文章を出力します。
📦 インストール
このモデルを使用するには、transformers
ライブラリが必要です。以下のコマンドでインストールできます。
pip install transformers
💻 使用例
基本的な使用法
#Load the model and tokenizer
text = "" #Text with typos here!
inputs = tokenizer(cipher_text, return_tensors="pt", padding=True, truncation=True, max_length=256).to(device)
outputs = model.generate(inputs["input_ids"], max_length=256)
corrected_text = tokenizer.decode(outputs[0], skip_special_tokens=True)
高度な使用法
from transformers import AutoTokenizer, AutoModelForSeq2SeqLM
import torch
from string import ascii_lowercase
import Levenshtein
import random
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
tokenizer = AutoTokenizer.from_pretrained("Cipher-AI/Substitution-Cipher-Alphabet-Eng")
alphabet_model = AutoModelForSeq2SeqLM.from_pretrained("Cipher-AI/Substitution-Cipher-Alphabet-Eng").to(device)
correction_model = AutoModelForSeq2SeqLM.from_pretrained("Cipher-AI/AutoCorrect-EN-v2").to(device)
def similarity_percentage(s1, s2):
distance = Levenshtein.distance(s1, s2)
max_len = max(len(s1), len(s2))
similarity = (1 - distance / max_len) * 100
return similarity
def decode(cipher_text, key):
decipher_map = {ascii_lowercase[i]: j for i, j in enumerate(key[:26])}
decipher_map.update({ascii_lowercase[i].upper(): j.upper() for i, j in enumerate(key[:26])})
ans = ''.join(map(lambda x: decipher_map[x] if x in decipher_map else x, cipher_text))
return ans
def model_pass(model, input, max_length=256):
inputs = tokenizer(input, return_tensors="pt", padding=True, truncation=True, max_length=256).to(device)
outputs = model.generate(inputs["input_ids"], max_length=max_length)
result = tokenizer.decode(outputs[0], skip_special_tokens=True)
return result
def decipher(cipher_text, key) -> str:
decipher_map = {ascii_lowercase[i]: j for i, j in enumerate(key[0])}
decipher_map.update({ascii_lowercase[i].upper(): j.upper() for i, j in enumerate(key[0])})
result = ''.join(map(lambda x: decipher_map[x] if x in decipher_map else x, cipher_text[0]))
return result
def cipher(plain_text) -> tuple[str, list]:
alphabet_map = list(ascii_lowercase)
random.shuffle(alphabet_map)
alphabet_map = {i : j for i, j in zip(ascii_lowercase, alphabet_map)}
alphabet_map.update({i.upper() : j.upper() for i, j in alphabet_map.items()})
cipher_text = ''.join(map(lambda x: alphabet_map[x] if x in alphabet_map else x, plain_text))
return cipher_text, alphabet_map
def correct_text(cipher_text, model_output):
cipher_text = cipher_text.split(' ')
model_output = model_output.split(' ')
letter_map = {i: {j: 0 for j in ascii_lowercase} for i in ascii_lowercase}
# Levenstein distance for lenghts of words
n = len(cipher_text)
m = len(model_output)
i = 0
j = 0
dp = [[0 for _ in range(m + 1)] for _ in range(n + 1)]
for i in range(n + 1):
dp[i][0] = i
for j in range(m + 1):
dp[0][j] = j
for i in range(1, n + 1):
for j in range(1, m + 1):
if len(cipher_text[i - 1]) == len(model_output[j - 1]):
dp[i][j] = dp[i - 1][j - 1]
else:
dp[i][j] = min(dp[i - 1][j], dp[i][j - 1], dp[i - 1][j - 1]) + 1
i = n
j = m
while i > 0 and j > 0:
before = min([(0, dp[i - 1][j - 1]), (1, dp[i - 1][j]), (2, dp[i][j - 1])], key=lambda x: x[1])
match before[0]:
case 0:
if dp[i - 1][j - 1] == dp[i][j]:
# If the same we add them to letter map
cipher = cipher_text[i-1]
model_o = model_output[j-1]
for c_letter, m_letter in zip(cipher.lower(), model_o.lower()):
if c_letter in letter_map and m_letter in letter_map[c_letter]:
letter_map[c_letter][m_letter] += 1
i = i - 1
j = j - 1
case 1:
i = i - 1
case 2:
j = j - 1
for letter in ascii_lowercase:
letter_sum = sum(letter_map[letter].values())
if letter_sum == 0:
# That letter wasn't in the text
letter_map[letter] = None
continue
# Sorted from most accuring to least
letter_map[letter] = [(k, v / letter_sum) for k, v in sorted(letter_map[letter].items(), key=lambda item: item[1], reverse=True)]
change_map = {
i : None for i in ascii_lowercase
}
for i in range(len(ascii_lowercase)):
for letter in ascii_lowercase:
if letter_map[letter] is None:
continue # That letter wasn't in the text
# If None then it didn't get substituted earlier
map_letter = letter_map[letter][i][0]
if (letter_map[letter][i][1] > 0 and (change_map[map_letter] is None
or (change_map[map_letter][2] < letter_map[letter][i][1] and change_map[map_letter][1] >= i))):
change_map[map_letter] = (letter, i, letter_map[letter][i][1])
# Letter, iteration, percentage
change_map = {i[1][0]: i[0] for i in change_map.items() if i[1] is not None}
for letter in ascii_lowercase:
if letter not in change_map:
change_map[letter] = '.'
# Add uppercases
change_map.update(
{
i[0].upper() : i[1].upper() for i in change_map.items()
}
)
new_text = []
for cipher in cipher_text:
new_word = ""
for c_letter in cipher:
if c_letter in change_map:
new_word += change_map[c_letter]
else:
new_word += c_letter
new_text.append(new_word)
return ' '.join(new_text)
def crack_sub(cipher_text):
output = model_pass(alphabet_model, cipher_text, 26)
decoded = decode(cipher_text, output)
second_pass = model_pass(correction_model, decoded, len(decoded))
second_text = correct_text(cipher_text, second_pass)
third_pass = model_pass(correction_model, second_text, len(decoded))
return third_pass
"""
Use crack_sub() function to solve monoalphabetic substitution ciphers!
"""
📚 ドキュメント
入力例
誤字のある文章: Whathvhr wh call owr carhaivhrs - doctors, nwrsh practitionhrs, clinicians, - wh nhhd thhm not only to carh, wh nhhd thhm to uh aulh to providh thh riaht valwh.
出力例
修正された文章: Whatever we call our caregivers - doctors, nurse practitioners, clinicians, - we need them not only to care, we need them to be able to provide the right value.
📄 ライセンス
このモデルはApache 2.0ライセンスの下で提供されています。
属性 | 详情 |
---|---|
モデルタイプ | text2text-generation |
訓練データ | agentlans/high-quality-english-sentences |
ベースモデル | google-t5/t5-base |
ライブラリ名 | transformers |
Bart Large Cnn
MIT
英語コーパスで事前学習されたBARTモデルで、CNNデイリーメールデータセットに特化してファインチューニングされ、テキスト要約タスクに適しています。
テキスト生成 英語
B
facebook
3.8M
1,364
Parrot Paraphraser On T5
ParrotはT5ベースの言い換えフレームワークで、自然言語理解(NLU)モデルのトレーニング加速のために設計され、高品質な言い換えによるデータ拡張を実現します。
テキスト生成
Transformers

P
prithivida
910.07k
152
Distilbart Cnn 12 6
Apache-2.0
DistilBARTはBARTモデルの蒸留バージョンで、テキスト要約タスクに特化して最適化されており、高い性能を維持しながら推論速度を大幅に向上させています。
テキスト生成 英語
D
sshleifer
783.96k
278
T5 Base Summarization Claim Extractor
T5アーキテクチャに基づくモデルで、要約テキストから原子声明を抽出するために特別に設計されており、要約の事実性評価プロセスの重要なコンポーネントです。
テキスト生成
Transformers 英語

T
Babelscape
666.36k
9
Unieval Sum
UniEvalは自然言語生成タスクの自動評価のための統一された多次元評価器で、複数の解釈可能な次元での評価をサポートします。
テキスト生成
Transformers

U
MingZhong
318.08k
3
Pegasus Paraphrase
Apache-2.0
PEGASUSアーキテクチャを微調整したテキスト再述モデルで、意味は同じだが表現が異なる文章を生成できます。
テキスト生成
Transformers 英語

P
tuner007
209.03k
185
T5 Base Korean Summarization
これはT5アーキテクチャに基づく韓国語テキスト要約モデルで、韓国語テキスト要約タスク用に設計され、paust/pko-t5-baseモデルを微調整して複数の韓国語データセットで訓練されました。
テキスト生成
Transformers 韓国語

T
eenzeenee
148.32k
25
Pegasus Xsum
PEGASUSは、Transformerに基づく事前学習モデルで、抽象的なテキスト要約タスクに特化しています。
テキスト生成 英語
P
google
144.72k
198
Bart Large Cnn Samsum
MIT
BART-largeアーキテクチャに基づく対話要約モデルで、SAMSumコーパス用に微調整され、対話要約の生成に適しています。
テキスト生成
Transformers 英語

B
philschmid
141.28k
258
Kobart Summarization
MIT
KoBARTアーキテクチャに基づく韓国語テキスト要約モデルで、韓国語ニュース記事の簡潔な要約を生成できます。
テキスト生成
Transformers 韓国語

K
gogamza
119.18k
12
おすすめAIモデル
Llama 3 Typhoon V1.5x 8b Instruct
タイ語専用に設計された80億パラメータの命令モデルで、GPT-3.5-turboに匹敵する性能を持ち、アプリケーションシナリオ、検索拡張生成、制限付き生成、推論タスクを最適化
大規模言語モデル
Transformers 複数言語対応

L
scb10x
3,269
16
Cadet Tiny
Openrail
Cadet-TinyはSODAデータセットでトレーニングされた超小型対話モデルで、エッジデバイス推論向けに設計されており、体積はCosmo-3Bモデルの約2%です。
対話システム
Transformers 英語

C
ToddGoldfarb
2,691
6
Roberta Base Chinese Extractive Qa
RoBERTaアーキテクチャに基づく中国語抽出型QAモデルで、与えられたテキストから回答を抽出するタスクに適しています。
質問応答システム 中国語
R
uer
2,694
98