core-nlp-workflows
Use TextBlob document-level NLP workflows for tokenization, sentence splitting, POS tags, noun phrases, sentiment, parsing, counts, and Blobber routing.
- License 许可
- MIT
- 最近更新
- 2026-09-03
- Stars
- ★ 351
- Forks
- 27
01 前言 Front Matter
- name
- core-nlp-workflows
- license
- MIT
- metadata
- { "disco-role": "operating" }
- description
- Use TextBlob document-level NLP workflows for tokenization, sentence splitting, POS tags, noun phrases, sentiment, parsing, counts, and Blobber routing.
- disable-model-invocation
- true
02 资源文件 4
- 参考文档references/api-reference.md5.4 KB
- 参考文档references/troubleshooting.md6.5 KB
- 参考文档references/workflows.md7.7 KB
- 脚本scripts/core_nlp_smoke.py3.2 KB
03 SKILL.md 正文
TextBlob core NLP workflows
Use this sub-skill when a task starts from raw text and needs TextBlob's
high-level document or sentence APIs: TextBlob, Sentence, Blobber, words,
tokens, sentences, POS tags, noun phrases, sentiment, parsing, n-grams, counts,
JSON serialization, or built-in model overrides.
Route elsewhere when the request is mostly about:
- Word-level spelling, inflection, lemmatization, stemming, WordNet, or
WordListbatch transforms:../word-and-lexical-tools/SKILL.md. - Classifier training/evaluation, training data files, feature extractors, or
TextBlob(..., classifier=...):../classifiers-and-data-formats/SKILL.md. - Writing custom model classes, extension packages, or reusable
Blobberfactories with custom components:../custom-models-and-extensions/SKILL.md.
Bundled resources
- Workflows: task-oriented recipes for tokenization,
tagging, noun phrases, sentiment, parsing, counts, JSON, and
Blobber. - API reference: verified signatures, defaults, return shapes, and model classes for document-level APIs.
- Troubleshooting: missing NLTK corpora, punctuation/tokenization surprises, slow corpus-backed models, and analyzer or parser misuse.
- Core NLP smoke script: read-only installed
package checks. Run
python scripts/core_nlp_smoke.py --help.
Operating workflow
- Confirm setup. TextBlob import alone is not enough for corpus-backed workflows. If tags, sentence splitting, noun phrases, lemmatization, or the Naive Bayes sentiment analyzer are needed, ensure the installed environment has TextBlob corpora. The parent skill links a setup reference and a root setup diagnostic.
- Create a blob. Use
TextBlob(text)for ordinary raw text. The constructor validates tokenizer, POS tagger, NP extractor, analyzer, and parser objects when custom ones are supplied. - Choose the right property.
- Use
.sentencesforSentenceobjects and sentence-level processing. - Use
.wordsfor word tokens without punctuation. - Use
.tokensor.tokenize(tokenizer)when punctuation or a custom tokenizer contract matters. - Use
.tags/.pos_tagsfor flattened POS tags across sentences. - Use
.noun_phrasesfor normalized lowercase noun phrase strings. - Use
.sentiment,.polarity,.subjectivity, or.sentiment_assessmentsfor built-in sentiment workflows. - Use
.parse()for the pattern-style parse string. - Use
.word_counts,.np_counts, and.ngrams(n)for simple counts and phrase windows.
- Use
- Use
Blobberwhen models should be shared.Blobber(...)createsTextBlobinstances that reuse the same tokenizer, tagger, extractor, analyzer, parser, and classifier objects. This is useful for expensive or configured models; route to the custom-model sub-skill when implementing the components themselves. - Validate with a tiny smoke. Run the bundled smoke script before relying
on a new environment or after debugging corpus paths. Use
--skip-corpus-heavyonly when POS, sentences, and noun phrases are not part of the task. - Keep downstream outputs explicit. TextBlob properties are convenient and often cached. When building pipelines, record which property produced each field, whether punctuation was kept, and whether corpora or optional models were required.
Quick patterns
from textblob import Blobber, TextBlob
from textblob.sentiments import NaiveBayesAnalyzer
from textblob.tokenizers import WordTokenizer
blob = TextBlob("TextBlob is amazingly simple. Great fun!")
[str(s) for s in blob.sentences]
[(str(word), tag) for word, tag in blob.tags]
blob.noun_phrases
blob.sentiment.polarity
blob.ngrams(2)
# Discrete sentiment analyzer trained from movie_reviews corpus.
TextBlob("I love this library", analyzer=NaiveBayesAnalyzer()).sentiment
# Shared model factory.
tb = Blobber(tokenizer=WordTokenizer())
first = tb("one text")
second = tb("another text")
assert first.tokenizer is second.tokenizer
If .tags, .sentences, or .noun_phrases raises MissingCorpusError, do not
silently switch algorithms. Use references/troubleshooting.md
to identify the missing corpus and run the explicit setup command in the target
environment.
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).