AGENT SKILL

word-and-lexical-tools

Use TextBlob Word and WordList for word-level morphology, spelling correction, lemmatization, WordNet lookup, and lexical frequency utilities.

License 许可
MIT
最近更新
2026-09-03
Stars
★ 351
Forks
27

01 前言 Front Matter

name
word-and-lexical-tools
license
MIT
metadata
{ "disco-role": "operating" }
description
Use TextBlob Word and WordList for word-level morphology, spelling correction, lemmatization, WordNet lookup, and lexical frequency utilities.
disable-model-invocation
true

02 资源文件 3

03 SKILL.md 正文

TextBlob word and lexical tools

Use this sub-skill when the task is word-level: inflecting words, stemming, lemmatizing with optional POS tags, checking spelling suggestions, using WordNet synsets/definitions, operating on WordList, or counting already extracted words/noun phrases.

Route elsewhere when the user needs document-level NLP first:

  • Tokenization, sentence splitting, POS tagging, noun-phrase extraction, sentiment, parsing, n-grams, or full TextBlob workflows: sibling sub-skill core-nlp-workflows.
  • Classifier training, classifier data formats, feature extractors, or TextBlob(..., classifier=...): sibling sub-skill classifiers-and-data-formats.

Bundled resources

  • Lexical reference: API details, recipes, WordNet POS mapping, WordList behavior, and frequency patterns.
  • Troubleshooting: missing corpora, wrong lemmas, spelling-correction caveats, inflection surprises, and list mutation gotchas.
  • Lexical smoke script: deterministic installed package smoke checks. Run python scripts/lexical_smoke.py --help.

Operating workflow

  1. Confirm this is word-level. If raw text still needs tokenization, POS tagging, noun phrases, or sentiment, route to core-nlp-workflows first and return here for lexical normalization or counts on the resulting words.
  2. Create lexical objects. Import Word and WordList from textblob: Word(string, pos_tag=None) for one token and WordList(collection) for a list-like token collection.
  3. Choose the lexical operation.
    • Inflection: Word(...).singularize() and .pluralize(); batch with WordList(...).singularize() or .pluralize().
    • Lemmatization: Word(...).lemmatize(pos=None) or cached .lemma when a Word was created with pos_tag; pass a WordNet or Penn POS for verbs, adjectives, and adverbs.
    • Stemming: Word(...).stem() or WordList(...).stem(); Porter is the default stemmer.
    • Spelling: Word(...).spellcheck() returns (candidate, confidence) tuples; .correct() returns the top candidate as a Word.
    • WordNet: .synsets, .get_synsets(pos=...), .definitions, and .define(pos=...) require the NLTK WordNet corpus.
    • Counts: use WordList.count(term, case_sensitive=False) for words or noun phrases that have already been extracted.
  4. Check corpora before WordNet-dependent operations. lemmatize, lemma, synsets, and definitions rely on NLTK WordNet data. Do not download corpora implicitly; use the smoke script with --skip-wordnet when corpus-backed checks should be bypassed.
  5. Record uncertainty. Spelling correction is heuristic and approximate; keep the original token, the proposed correction, and confidence when normalizing noisy keywords.
  6. Troubleshoot near the workflow. If output is surprising, inspect references/troubleshooting.md before changing algorithms.

Quick patterns

from textblob import Word, WordList
from textblob.wordnet import VERB

Word("cats").singularize()          # Word('cat')
Word("speling").correct()           # Word('spelling')
Word("went").lemmatize(VERB)        # 'go'
Word("went", "VBD").lemma          # 'go'
WordList(["Dog", "dog"]).count("dog")  # 2, case-insensitive by default

For noisy keyword normalization, combine spelling suggestions with an explicit POS-aware lemma and keep audit fields:

from textblob import Word
from textblob.wordnet import NOUN

def normalize_keyword(token, pos=NOUN, min_confidence=0.80):
    suggestion, confidence = Word(token).spellcheck()[0]
    chosen = suggestion if confidence >= min_confidence else token
    return {
        "original": token,
        "suggestion": suggestion,
        "confidence": confidence,
        "normalized": Word(chosen).lemmatize(pos),
    }

If Word("went").lemmatize() returns "went", it used the default noun POS; recover with Word("went").lemmatize("v"), Word("went").lemmatize(VERB), or Word("went", "VBD").lemma.

04 同仓库更多 Skills

VectorSpaceLab
VectorSpaceLab/AREX-Skill

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.

★ 351
VectorSpaceLab
VectorSpaceLab/AREX-Skill

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.

★ 351
VectorSpaceLab
VectorSpaceLab/AREX-Skill

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.

★ 351
VectorSpaceLab
VectorSpaceLab/AREX-Skill

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.

★ 351
VectorSpaceLab
VectorSpaceLab/AREX-Skill

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.

★ 351
VectorSpaceLab
VectorSpaceLab/AREX-Skill

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).

★ 351