🚀 bert-restore-punctuation
このモデルは、Yelpレビューの句読点復元のために微調整されたbert-base-uncasedモデルです。このモデルは、小文字の平文テキストの句読点と大文字化を予測します。例えば、音声認識の出力や、句読点が失われたテキストの場合に使用できます。このモデルは、一般的な英語の句読点復元モデルとして直接使用することを想定しています。また、特定ドメインのテキストに対する句読点復元タスクでのさらなる微調整にも使用できます。モデルは、[! ? . , - : ; ' ] の句読点を復元し、単語の大文字化も復元します。
🚀 クイックスタート
モデルの使用方法
以下は、このモデルをすぐに使い始めるための手順です。
- まず、パッケージをインストールします。
pip install rpunct
- サンプルのPythonコードです。
from rpunct import RestorePuncts
rpunct = RestorePuncts()
rpunct.punctuate("""in 2018 cornell researchers built a high-powered detector that in combination with an algorithm-driven process called ptychography set a world record
by tripling the resolution of a state-of-the-art electron microscope as successful as it was that approach had a weakness it only worked with ultrathin samples that were
a few atoms thick anything thicker would cause the electrons to scatter in ways that could not be disentangled now a team again led by david muller the samuel b eckert
professor of engineering has bested its own record by a factor of two with an electron microscope pixel array detector empad that incorporates even more sophisticated
3d reconstruction algorithms the resolution is so fine-tuned the only blurring that remains is the thermal jiggling of the atoms themselves""")
このモデルは、任意の長さの英語テキストに対応しており、GPUが利用可能な場合はGPUを使用します。
✨ 主な機能
- 英語の平文テキストの句読点と大文字化を予測する。
- 以下の句読点を復元する -- [! ? . , - : ; ' ]
- 単語の大文字化を復元する。
- 任意の長さの英語テキストに対応。
- GPUが利用可能な場合はGPUを使用。
📦 インストール
pip install rpunct
💻 使用例
基本的な使用法
from rpunct import RestorePuncts
rpunct = RestorePuncts()
rpunct.punctuate("""in 2018 cornell researchers built a high-powered detector that in combination with an algorithm-driven process called ptychography set a world record
by tripling the resolution of a state-of-the-art electron microscope as successful as it was that approach had a weakness it only worked with ultrathin samples that were
a few atoms thick anything thicker would cause the electrons to scatter in ways that could not be disentangled now a team again led by david muller the samuel b eckert
professor of engineering has bested its own record by a factor of two with an electron microscope pixel array detector empad that incorporates even more sophisticated
3d reconstruction algorithms the resolution is so fine-tuned the only blurring that remains is the thermal jiggling of the atoms themselves""")
📚 ドキュメント
学習データ
このモデルを微調整するために使用した商品レビューの数は以下の通りです。
言語 |
テキストサンプル数 |
英語 |
560,000 |
最適な収束は約 3エポック で得られ、これが現在提供されているモデルです。 |
|
精度
微調整されたモデルは、45,990のホールドアウトテキストサンプルで以下の精度を達成しました。
精度 |
全体のF1スコア |
評価サポート |
91% |
90% |
45,990 |
以下は、各ラベルごとのモデルの性能の内訳です。
ラベル |
精度 |
再現率 |
F1スコア |
サポート |
! |
0.45 |
0.17 |
0.24 |
424 |
!+Upper |
0.43 |
0.34 |
0.38 |
98 |
' |
0.60 |
0.27 |
0.37 |
11 |
, |
0.59 |
0.51 |
0.55 |
1522 |
,+Upper |
0.52 |
0.50 |
0.51 |
239 |
- |
0.00 |
0.00 |
0.00 |
18 |
. |
0.69 |
0.84 |
0.75 |
2488 |
.+Upper |
0.65 |
0.52 |
0.57 |
274 |
: |
0.52 |
0.31 |
0.39 |
39 |
:+Upper |
0.36 |
0.62 |
0.45 |
16 |
; |
0.00 |
0.00 |
0.00 |
17 |
? |
0.54 |
0.48 |
0.51 |
46 |
?+Upper |
0.40 |
0.50 |
0.44 |
4 |
none |
0.96 |
0.96 |
0.96 |
35352 |
Upper |
0.84 |
0.82 |
0.83 |
5442 |
📄 ライセンス
このモデルはMITライセンスの下で提供されています。
☕ コンタクト
質問、フィードバック、または同様のモデルのリクエストについては、Daulet Nurmanbetovに連絡してください。