计划执行与检查节点
executing-plans
按既定实施计划完成工作,保持过程检查和反馈。
word-and-lexical-tools【效率与协作】Use TextBlob Word and WordList for word-level morphology, spelling correction, lemmatization, WordNet lookup, and lexical frequency utilities.
独立 GitHub 快照 · 自动分类 · 以原作者文档为准
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:
TextBlob workflows: sibling
sub-skill core-nlp-workflows.TextBlob(..., classifier=...): sibling sub-skill
classifiers-and-data-formats.python scripts/lexical_smoke.py --help.core-nlp-workflows first and
return here for lexical normalization or counts on the resulting words.Word and WordList from textblob:
Word(string, pos_tag=None) for one token and WordList(collection) for a
list-like token collection.Word(...).singularize() and .pluralize(); batch with
WordList(...).singularize() or .pluralize().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.Word(...).stem() or WordList(...).stem(); Porter is the
default stemmer.Word(...).spellcheck() returns (candidate, confidence)
tuples; .correct() returns the top candidate as a Word..synsets, .get_synsets(pos=...), .definitions, and
.define(pos=...) require the NLTK WordNet corpus.WordList.count(term, case_sensitive=False) for words or
noun phrases that have already been extracted.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.references/troubleshooting.md before changing algorithms.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.