Instructions to use MarcusBennevall/sentence-function-classifier with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- sentence-transformers
How to use MarcusBennevall/sentence-function-classifier with sentence-transformers:
from sentence_transformers import SentenceTransformer model = SentenceTransformer("MarcusBennevall/sentence-function-classifier") sentences = [ "The weather is lovely today.", "It's so sunny outside!", "He drove to the stadium." ] embeddings = model.encode(sentences) similarities = model.similarity(embeddings, embeddings) print(similarities.shape) # [3, 3] - Notebooks
- Google Colab
- Kaggle
Upload folder using huggingface_hub
Browse files- README.md +29 -0
- classifier.joblib +3 -0
- label_encoder.joblib +3 -0
- metadata.json +59 -0
README.md
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
language: en
|
| 3 |
+
tags:
|
| 4 |
+
- sentence-classification
|
| 5 |
+
- sentence-transformers
|
| 6 |
+
- text-classification
|
| 7 |
+
library_name: scikit-learn
|
| 8 |
+
---
|
| 9 |
+
|
| 10 |
+
# Sentence Function Classifier
|
| 11 |
+
|
| 12 |
+
This model classifies English sentences as: declarative, exclamatory, imperative, interrogative, optative.
|
| 13 |
+
|
| 14 |
+
It embeds sentences with `sentence-transformers/all-MiniLM-L6-v2` and predicts the final
|
| 15 |
+
class with a logistic regression classifier trained on a balanced seed dataset.
|
| 16 |
+
|
| 17 |
+
## Intended Use
|
| 18 |
+
|
| 19 |
+
This is designed for educational demos and lightweight sentence-function
|
| 20 |
+
analysis. It is not intended as a grammar authority for high-stakes assessment.
|
| 21 |
+
|
| 22 |
+
## Evaluation
|
| 23 |
+
|
| 24 |
+
- Dataset size: 125
|
| 25 |
+
- Held-out test split: 0.2
|
| 26 |
+
- Accuracy: 0.760
|
| 27 |
+
|
| 28 |
+
The seed dataset is small, so the metrics should be treated as a smoke test
|
| 29 |
+
rather than a final benchmark.
|
classifier.joblib
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:4b260b9c4beca37747b67e3bdaacae8e209558ee0f8bef891ec14cc8cb53a013
|
| 3 |
+
size 16287
|
label_encoder.joblib
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:3443a3829aff360dd0874a6dcbaaa228653e23bcd991aa24d59356df331eba09
|
| 3 |
+
size 587
|
metadata.json
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"created_at": "2026-04-29T02:52:45.301316+00:00",
|
| 3 |
+
"embedding_model": "sentence-transformers/all-MiniLM-L6-v2",
|
| 4 |
+
"labels": [
|
| 5 |
+
"declarative",
|
| 6 |
+
"exclamatory",
|
| 7 |
+
"imperative",
|
| 8 |
+
"interrogative",
|
| 9 |
+
"optative"
|
| 10 |
+
],
|
| 11 |
+
"dataset_path": "data\\sentence_function_dataset.csv",
|
| 12 |
+
"dataset_size": 125,
|
| 13 |
+
"test_size": 0.2,
|
| 14 |
+
"metrics": {
|
| 15 |
+
"declarative": {
|
| 16 |
+
"precision": 0.5,
|
| 17 |
+
"recall": 0.4,
|
| 18 |
+
"f1-score": 0.4444444444444444,
|
| 19 |
+
"support": 5.0
|
| 20 |
+
},
|
| 21 |
+
"exclamatory": {
|
| 22 |
+
"precision": 0.8333333333333334,
|
| 23 |
+
"recall": 1.0,
|
| 24 |
+
"f1-score": 0.9090909090909091,
|
| 25 |
+
"support": 5.0
|
| 26 |
+
},
|
| 27 |
+
"imperative": {
|
| 28 |
+
"precision": 1.0,
|
| 29 |
+
"recall": 0.8,
|
| 30 |
+
"f1-score": 0.8888888888888888,
|
| 31 |
+
"support": 5.0
|
| 32 |
+
},
|
| 33 |
+
"interrogative": {
|
| 34 |
+
"precision": 0.5,
|
| 35 |
+
"recall": 0.6,
|
| 36 |
+
"f1-score": 0.5454545454545454,
|
| 37 |
+
"support": 5.0
|
| 38 |
+
},
|
| 39 |
+
"optative": {
|
| 40 |
+
"precision": 1.0,
|
| 41 |
+
"recall": 1.0,
|
| 42 |
+
"f1-score": 1.0,
|
| 43 |
+
"support": 5.0
|
| 44 |
+
},
|
| 45 |
+
"accuracy": 0.76,
|
| 46 |
+
"macro avg": {
|
| 47 |
+
"precision": 0.7666666666666667,
|
| 48 |
+
"recall": 0.76,
|
| 49 |
+
"f1-score": 0.7575757575757576,
|
| 50 |
+
"support": 25.0
|
| 51 |
+
},
|
| 52 |
+
"weighted avg": {
|
| 53 |
+
"precision": 0.7666666666666667,
|
| 54 |
+
"recall": 0.76,
|
| 55 |
+
"f1-score": 0.7575757575757575,
|
| 56 |
+
"support": 25.0
|
| 57 |
+
}
|
| 58 |
+
}
|
| 59 |
+
}
|