模型:

felflare/bert-restore-punctuation

英文

✨ bert-restore-punctuation

这是一个针对 Yelp Reviews 进行标点恢复的bert-base-uncased模型微调模型。

该模型预测普通小写文本的标点符号和大写。一个示例用例可以是ASR输出。或其他文本丢失标点符号的情况。

该模型适用于直接用作一般英语语言的标点符号恢复模型。或者,您可以在特定领域的文本上进一步微调,用于标点恢复任务。

模型恢复以下标点符号 -- [! ? . , - : ; ' ]

该模型还恢复单词的大写形式。

🚋 使用方法

以下是一个快速上手使用该模型的方法。

  • 首先,安装包。
  • pip install rpunct
    
  • 示例python代码。
  • from rpunct import RestorePuncts
    # The default language is 'english'
    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""")
    # Outputs the following:
    # 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。

    📡 训练数据

    这里是我们用于微调模型的产品评论数量:

    Language Number of text samples
    English 560,000

    我们发现在 3个周期 下获得了最佳收敛,这是本文所述的并可通过下载获取。

    🎯 精确度

    经过微调的模型在45,990个保留文本样本上获得了以下准确性:

    Accuracy Overall F1 Eval Support
    91% 90% 45,990

    以下是模型按每个标签的性能的详细情况:

    label precision recall f1-score support
    ! 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

    ☕ 联系

    如有问题、反馈或类似模型请求,请联系 Daulet Nurmanbetov。