AI Text Classification
Fit a small bag-of-words model and state what it cannot understand.
How it works
A bag-of-words representation counts tokens and loses word order. Multinomial naive Bayes combines token evidence under simplifying assumptions. This tiny fictional note dataset distinguishes cleanup and dispatch vocabulary. It is a real fitted classifier, but it is not a language model or a test of broad semantic understanding.
Run the code
This is a local Python example, not supported by Bhylu’s plain Python browser editor. In a separate virtual environment use Python 3.12.14 with the pinned requirements: NumPy 2.5.4 and scikit-learn 1.9.1. Run python -m pip install -r requirements-local.txt in that environment, then run this complete downloaded source. These are reviewed versions, not a newest-release promise. No external dataset, provider account, database or PHP setting is needed.
Example
from sklearn.pipeline import make_pipeline
from sklearn.feature_extraction.text import CountVectorizer
from sklearn.naive_bayes import MultinomialNB
notes = ["wash trays", "clean bench", "pack crates", "load van"]
labels = ["cleanup", "cleanup", "dispatch", "dispatch"]
model = make_pipeline(CountVectorizer(), MultinomialNB())
model.fit(notes,labels)
print(model.predict(["wash bench", "load crates"]).tolist())
Expected result
['cleanup', 'dispatch']
The test phrases recombine known words. Unknown words, negation, spelling differences and new contexts can behave very differently. Keep real text private and obtain appropriate permissions before creating an actual training corpus.