Downloads · 30 days
12
0% of all-time downloads
nikolasmoya/c4-binary-english-grammar-checker
c4-binary-english-grammar-checker is a text classification model from nikolasmoya. Use it when you need a label for a piece of text. It is set up for transformers. The card lists the license as mit.
The recommendation is to split the text into sentences and evaluate sentence by sentence, you can do that using spacy:
Downloads · 30 days
12
0% of all-time downloads
All-time downloads
89.7K
Public
Parameters
125M
4.5 GB on disk
Likes
0
Public
Click a slice to open those files.
.bin499 MB · 50%
From the Hugging Face model README
The recommendation is to split the text into sentences and evaluate sentence by sentence, you can do that using spacy:
import spacy
def clean_up_sentence(text: str) -> str:
text = text.replace("---", "")
text = text.replace("\n", " ")
text = text.strip()
if not text.endswith(('.', '!', '?', ":")):
# Since we are breaking a longer text into sentences ourselves, we should always end a sentence with a period.
text = text + "."
return text
sentence_splitter = spacy.load("en_core_web_sm")
spacy_document = sentence_splitter("This is a long text. It has two or more sentence. Spacy will break it down into sentences.")
results = []
for sentence in spacy_document.sents:
clean_text = clean_up_sentence(str(sentence))
classification = grammar_checker(clean_text)[0]
results.append({
"label": classification['label'],
"score": classification['score'],
"sentence": clean_text
})
pd.DataFrame.from_dict(results)
This model is a fine-tuned version of roberta-base on the None dataset. It achieves the following results on the evaluation set:
More information needed
More information needed
More information needed
The following hyperparameters were used during training:
| Training Loss | Epoch | Step | Validation Loss | Accuracy | Matthews Correlation |
|---|---|---|---|---|---|
| 0.363 | 1.0 | 200000 | 0.3634 | 0.8487 | 0.7025 |
| 0.3032 | 2.0 | 400000 | 0.3546 | 0.8577 | 0.7192 |