classifiers-and-data-formats
Build, evaluate, update, and debug TextBlob classifiers and their CSV, JSON, TSV, and custom training data formats.
- License 许可
- MIT
- 最近更新
- 2026-09-03
- Stars
- ★ 351
- Forks
- 27
01 前言 Front Matter
- name
- classifiers-and-data-formats
- license
- MIT
- metadata
- { "disco-role": "operating" }
- description
- Build, evaluate, update, and debug TextBlob classifiers and their CSV, JSON, TSV, and custom training data formats.
- disable-model-invocation
- true
02 资源文件 5
- 参考文档references/api-reference.md6.4 KB
- 参考文档references/classifier-workflows.md7.0 KB
- 参考文档references/data-formats.md5.6 KB
- 参考文档references/troubleshooting.md5.6 KB
- 脚本scripts/classifier_smoke.py6.9 KB
03 SKILL.md 正文
TextBlob classifiers and data formats
Use this sub-skill when the task is about training, evaluating, updating, or debugging a textblob.classifiers classifier, or when classifier training/test data must be loaded from CSV, JSON, TSV, or a registered custom format.
Bundled resources
- Classifier workflows: recipes for training, evaluating, updating, TextBlob sentence classification, Positive Naive Bayes, MaxEnt, feature extractors, and difficult mixed-format cases.
- Data formats: CSV/JSON/TSV schemas, automatic detection, registry usage, and custom format registration.
- API reference: constructor signatures, methods, return shapes, and caveats.
- Troubleshooting: malformed train sets, missing corpora, file-like mistakes, unknown formats, classifier injection errors, and feature-extractor debugging.
- Classifier smoke script: tiny in-memory and temporary-file classifier/data-format checks. Run
python scripts/classifier_smoke.py --help.
Covered capabilities
- Classifiers:
NaiveBayesClassifier,DecisionTreeClassifier,MaxEntClassifier,PositiveNaiveBayesClassifier, andNLTKClassifierwrappers. - Feature extractors:
basic_extractor,contains_extractor, and custom one-argument or two-argument extractors. - Training/evaluation data shapes: in-memory
[(text_or_tokens, label), ...], opened file-like data, CSVtext,label, JSON arrays withtextandlabel, TSV, and custom registered formats. - Classifier operations:
classify,prob_classify,accuracy,update,labels,informative_features,show_informative_features,pretty_format, andpseudocode. TextBlob(..., classifier=cl)workflows, including sentence-level.classify()on blobs created with the same classifier.textblob.formats.detect,get_registry,register, and commonFormatError/ValueErrorhandling.
Route elsewhere
NaiveBayesAnalyzeras a sentiment analyzer is covered by core NLP workflows. It is classifier-backed, but its operating surface isTextBlob(..., analyzer=NaiveBayesAnalyzer()).sentiment, not custom classifier training.- Writing reusable base interfaces, extension packages, custom model classes, or language-package integrations belongs in custom models and extensions. This sub-skill only covers classifier feature extractors and file-format registration needed for classifier data.
Operating workflow
- Choose the classifier. Use Naive Bayes for a small reliable default, Decision Tree when explainable tree output is needed, MaxEnt only when its slower NLTK training is acceptable, Positive Naive Bayes for one-positive-class plus unlabeled data, and
NLTKClassifieronly when wrapping a concretenltk.classifyclass. - Normalize data before training. Prefer a list of
(document, label)pairs wheredocumentis either a string or a list of tokens. Keep labels consistent ("pos"/"neg", booleans, or other labels, but not a mixture unless that is intentional). - Use file-like inputs correctly. Open CSV/JSON/TSV files yourself and pass the file object, not a filename string. Let TextBlob detect simple files or pass
format="csv","json", or"tsv"explicitly for reliability. - Train and validate. Call
classify()on known examples,accuracy()on held-out data, andlabels()to confirm the label set. For Naive Bayes or MaxEnt, useprob_classify()when probabilities matter. - Update deliberately.
update()expects normalized in-memory examples. If new data arrives as CSV/JSON/TSV, parse it into a list first, validate labels, then callupdate(). - Integrate with TextBlob. Pass
classifier=cltoTextBloborBlobber; thenblob.classify()classifies the full blob and each sentence object created from that blob shares the same classifier. - Inspect or explain. Use Naive Bayes
informative_features()/show_informative_features()or Decision Treepretty_format()/pseudocode()when a user needs reasons, audits, or debugging clues.
If a workflow fails, first check the symptom table in troubleshooting, then inspect the exact data schema in data formats. Use the bundled smoke script for a package-level sanity check:
python scripts/classifier_smoke.py --json
python scripts/classifier_smoke.py --skip-decision-tree
04 同仓库更多 Skills
passnet-triton-opt
Make a single PassNet Triton kernel fast AND numerically faithful: performance model (when a replacement can win at all), block/grid/warp tuning, autotune policy, launch overhead, and per-op numeric recipes to pass the dtype baseline tolerances. Use when a pass matches and is correct but speedup below expected, or when correctness fails by small numeric margins.
passnet-solve
END-TO-END playbook for solving one PassNet sample: analyze the computation graphs, decide the optimization strategy (what to fuse, what to replace, what to leave alone), drive the iteration loop, and maximize the sample score. This is the ENTRY skill — invoke it first for any PassNet optimization task; it tells you when to use passnet-pattern-fusion, passnet-triton-opt and passnet-feedback.
passnet-skill
PassNet GPU kernel optimization via compiler passes. Design and implement Triton-based optimization passes, create pass files under ./pass_dir/, self-evaluate with pass_evaluator, and iterate to maximize GPU speedup.
passnet-pattern-fusion
Author PassNet pass files: write patterns that actually MATCH the FX graph, pick fusion regions (which ops to absorb into one Triton kernel), and structure multi-pass submissions with the mandatory shared-dispatch architecture. Use when creating or fixing pattern()/replacement_args()/replacement_func() files, when a pass "failed to match", or when deciding how to fuse multiple kernels/ops.
passnet-orchestrate
Round/batch planning and decision support for PassNet graph optimization. Use for multi-sample triage, worker allocation, eval-budget policy, and post-eval keep/revert decisions. For solving one concrete sample end to end, use passnet-solve as the entry skill; consult this skill only when you need broader planning or a specific decision gate.
passnet-feedback
Fast, deterministic feedback for PassNet work: pre-flight pattern/match verification WITHOUT burning a GPU evaluation, per-node bottleneck analysis of a sample's graphs, and eval-log parsing into per-variant status + estimated score + failure classification. Use BEFORE every GPU evaluation (check_pattern), at the START of a sample (analyze_graph), and AFTER every evaluation (parse_eval_log).