tokenize-tag-stem
Use NLTK tokenization, detokenization, POS tagging, tagger training, stemming, lemmatization, and sentiment preprocessing APIs without reopening the source repo.
- License 许可
- Apache-2.0
- 最近更新
- 2026-09-03
- Stars
- ★ 351
- Forks
- 27
01 前言 Front Matter
- name
- tokenize-tag-stem
- license
- Apache 2.0
- metadata
- { "disco-role": "operating" }
- description
- Use NLTK tokenization, detokenization, POS tagging, tagger training, stemming, lemmatization, and sentiment preprocessing APIs without reopening the source repo.
- disable-model-invocation
- true
02 资源文件 5
- 参考文档references/api-reference.md8.7 KB
- 参考文档references/troubleshooting.md8.7 KB
- 参考文档references/workflows.md7.7 KB
- 脚本scripts/text_preprocess_smoke.py8.0 KB
- 脚本scripts/tokenize_cli_smoke.py4.2 KB
03 SKILL.md 正文
Tokenize Tag Stem
Use this sub-skill when the task is about NLTK text preprocessing: tokenizing or detokenizing strings, running the nltk tokenize CLI, POS-tagging tokens, training simple taggers, stemming or lemmatizing words, or using VADER/basic sentiment preprocessing.
Route away from this sub-skill when the task is mainly about:
- Installing, locating, or repairing NLTK data packages: use
../data-and-downloader/SKILL.md. - Grammars, parse trees, chunkers, dependency graphs, semantics, or theorem-proving: use
../grammar-parse-semantics/SKILL.md. - Classifiers, language models, probability distributions, metrics, or translation/alignment algorithms after features are prepared: use
../ml-metrics-and-translation/SKILL.md.
Fast Paths
- For no-download word splitting, prefer
WordPunctTokenizer,TreebankWordTokenizer,TweetTokenizer, orword_tokenize(text, preserve_line=True).sent_tokenize()andword_tokenize(..., preserve_line=False)need Punkt table data for the selected language. - For command-line tokenization, use
nltk tokenize; it reads stdin and exposes--language,--preserve-line,--processes,--encoding, and--delimiter. The bundled CLI smoke checks the installed console script. - For tweets/social text, use
TweetTokenizer(strip_handles=True, reduce_len=True, preserve_case=...); decide whether phone numbers should be matched withmatch_phone_numbers. - For POS tags, pass a list of tokens to
pos_tag(tokens, tagset=None, lang="eng")or a list of token lists topos_tag_sents. English usesaveraged_perceptron_tagger_eng; Russian useslang="rus"andaveraged_perceptron_tagger_rus. - For a quick custom baseline tagger, combine
RegexpTaggerrules withUnigramTagger(train_sents, backoff=...); evaluate withaccuracy,evaluate_per_tag, or aConfusionMatrixwhen gold tagged sentences are available. - For stemming, use
PorterStemmer(mode=...),SnowballStemmer(language, ignore_stopwords=False),LancasterStemmer,RegexpStemmer, or language-specific stemmers. Porter and most Snowball workflows do not need NLTK data. - For lemmatization,
WordNetLemmatizer.lemmatize(word, pos="n")depends on WordNet for real morphology; download/checkwordnetandomw-2.0when multilingual or synonym-aware behavior is needed. - For sentiment,
SentimentIntensityAnalyzer()requiresvader_lexicon; route missing lexicon errors to the data/downloader sub-skill.SentimentAnalyzercan build features for a classifier workflow, which then routes to the ML sub-skill.
Reference Map
- Public tokenization, tagging, stemming, lemmatization, and sentiment API contracts plus data-package requirements:
references/api-reference.md. - Task recipes for tokenizer selection, CLI use, POS tagging, tagger baselines, stemming/lemmatization, and sentiment preprocessing:
references/workflows.md. - Diagnosis for missing
punkt_tab, perceptron taggers, universal tagsets, VADER/WordNet data, regex pitfalls, language codes, and CLI/API misuse:references/troubleshooting.md. - Console-script check for
nltk tokenizewith tiny stdin:scripts/tokenize_cli_smoke.py. - No-download API smoke for tokenizer/stemmer basics plus optional data-resource probes:
scripts/text_preprocess_smoke.py.
Minimum Validation Pattern
- Print
nltk.__version__, the exact API or CLI route, and whether the workflow is allowed to download NLTK data. - For tokenization, test one representative string and state whether sentence splitting is enabled (
preserve_line=False) or skipped (preserve_line=True). - For POS tagging, assert the input is
list[str], not a raw string; for batches, assertlist[list[str]]. - Before running data-backed APIs, probe exact resources such as
tokenizers/punkt_tab/english/,taggers/averaged_perceptron_tagger_eng/,taggers/universal_tagset/,corpora/wordnet/, orsentiment/vader_lexicon.zip/vader_lexicon/vader_lexicon.txt. - For custom taggers, keep training/testing data separated and report unknown-token behavior instead of hiding
Nonetags. - Run the bundled no-download smoke from any current working directory in an environment with NLTK installed:
python /path/to/skills/disco/nltk/sub-skills/tokenize-tag-stem/scripts/text_preprocess_smoke.py --json
python /path/to/skills/disco/nltk/sub-skills/tokenize-tag-stem/scripts/tokenize_cli_smoke.py --json
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).