nltk
Use NLTK for classical natural-language processing in Python: install the package and data, tokenize and tag text, stem or lemmatize, build grammars and parse trees, train classical models, score metrics, and work with translation alignments.
- License 许可
- Apache-2.0
- 最近更新
- 2026-09-03
- Stars
- ★ 351
- Forks
- 27
01 前言 Front Matter
- name
- nltk
- license
- Apache 2.0
- metadata
- { "disco-role": "operating" }
- description
- Use NLTK for classical natural-language processing in Python: install the package and data, tokenize and tag text, stem or lemmatize, build grammars and parse trees, train classical models, score metrics, and work with translation alignments.
- disable-model-invocation
- true
02 资源文件 5
- 参考文档references/native-verification.md3.9 KB
- 参考文档references/repo-provenance.md2.7 KB
- 参考文档references/repo-routing-metadata.json511 B
- 参考文档references/troubleshooting.md5.5 KB
- 脚本scripts/nltk_doctor.py7.2 KB
03 SKILL.md 正文
NLTK
Use this skill when a task names NLTK or asks for classical Python NLP workflows involving tokenization, corpora, POS tagging, stemming, parsing, grammar, text classification, sentiment, language models, translation metrics, or NLTK data packages.
NLTK 3.10.x is a broad toolkit rather than one end-to-end model. Start from the user's artifact and task: raw text, tokens, tagged sentences, a corpus/resource, a grammar, features, an aligned parallel corpus, or an evaluation score.
Install and import check
NLTK supports Python 3.10 through 3.14. The base install provides defusedxml, click, joblib, regex, and tqdm.
python -m pip install nltk
python - <<'PY'
import nltk
print(nltk.__version__)
PY
Optional extras are deliberately separate: machine_learning (numpy, python-crfsuite, scikit-learn, scipy), plot (matplotlib), tgrep (pyparsing), twitter (twython), and corenlp (requests). Install only the extra or external tool the task requires.
NLTK code and NLTK data are separate. Do not treat import nltk as proof that punkt_tab, tagger models, corpora, WordNet, or VADER data are installed.
Route by task
- Install, locate, download, or repair corpora/models/data: read
sub-skills/data-and-downloader/SKILL.md. It coversNLTK_DATA,nltk.data.path,nltk.data.find/load, targeted downloader commands, corpus readers, and safe recovery. - Tokenize, detokenize, tag, stem, lemmatize, or run sentiment preprocessing: read
sub-skills/tokenize-tag-stem/SKILL.md. It coversword_tokenize,sent_tokenize, thenltk tokenizeCLI,pos_tag, tagger backoff, stemmers, WordNet lemmatization, and VADER. - Write grammars, chunk POS-tagged text, parse, manipulate trees, evaluate dependencies, or interpret logical semantics: read
sub-skills/grammar-parse-semantics/SKILL.md. - Train classical classifiers, cluster vectors, fit n-gram language models, use probability distributions, score metrics, or build translation alignments: read
sub-skills/ml-metrics-and-translation/SKILL.md.
For a pipeline that spans routes, use them in order: data/resource checks → tokenization/tagging → grammar or feature construction → model/metric evaluation. Keep each stage's input shape explicit.
Shared operating rules
- Prefer small, deterministic, no-download checks before downloading data or installing optional dependencies.
- When a
LookupErrornames an attempted resource, use that exact path to choose the smallest package; do not default toallorpopular. - Preserve tokenization and tagset choices in outputs. A parser, classifier, or metric is not comparable if preprocessing changes silently.
- Treat third-party Java/binary wrappers, GUI apps, network downloads, credentials, and large corpora as explicit optional prerequisites.
- Never manually unzip untrusted NLTK packages or bypass
nltk.datapath-security checks.
Shared references and diagnostics
- Read
references/troubleshooting.mdfor cross-cutting installation, data, optional-dependency, API-shape, CLI, and security failures. - Read
references/native-verification.mdwhen selecting a safe smoke or native test; it records what was verified and what remains data- or tool-dependent. - Run
scripts/nltk_doctor.pywith--helpfirst, then--jsonfor a read-only import/CLI/resource diagnostic. It never downloads data unless--downloadis explicitly supplied. - Read
references/repo-provenance.mdbefore deciding whether this skill matches a changed NLTK checkout or should be refreshed.
Boundaries
This is a runtime package skill, not a release or contributor manual. It does not bundle NLTK corpora, Java tools, Stanford/CoreNLP/Senna/Malt/MEGAM/TADM binaries, GUI assets, credentials, or the original repository's tests/docs. Those artifacts informed the routes and verification plan; runtime helpers and distilled references live inside this skill 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).