
Nlp Processing
- 30 installs
- 4 repo stars
- Updated January 5, 2026
- pluginagentmarketplace/custom-plugin-ai-data-scientist
nlp-processing is a Claude Code skill for ai & agent building.
About
nlp-processing is a Claude Code skill for ai & agent building. It helps solo builders move faster with AI-assisted development.
- nlp-processing
- AI & Agent Building
- AI-coding skill
Nlp Processing by the numbers
- 30 all-time installs (skills.sh)
- Ranked #9,316 of 16,546 AI & Agent Building skills by installs in the Skillselion catalog
- Data as of Aug 4, 2026 (Skillselion catalog sync)
npx skills add https://github.com/pluginagentmarketplace/custom-plugin-ai-data-scientist --skill nlp-processingAdd your badge
Show developers this skill is listed on Skillselion. Paste this into your README.
| Installs | 30 |
|---|---|
| repo stars | ★ 4 |
| Last updated | January 5, 2026 |
| Repository | pluginagentmarketplace/custom-plugin-ai-data-scientist ↗ |
How do I helps with ai & agent building tasks.?
Helps with ai & agent building tasks.
Who is it for?
Best when you're working on ai & agent building and need structured help with nlp processing.
Skip if: Teams with no ai & agent building needs, or anyone wanting a generic chat assistant without this specific workflow.
When should I use this skill?
When you need to helps with ai & agent building tasks., or when nlp-processing is a claude code skill for ai & agent building.
What you get
Structured output aligned to nlp-processing: nlp-processing, AI & Agent Building.
Files
Natural Language Processing
Process, analyze, and understand text data with modern NLP techniques.
Quick Start
Text Preprocessing
import re
import nltk
from nltk.tokenize import word_tokenize
from nltk.corpus import stopwords
from nltk.stem import WordNetLemmatizer
def preprocess_text(text):
# Lowercase
text = text.lower()
# Remove special characters
text = re.sub(r'[^a-zA-Z0-9\s]', '', text)
# Tokenize
tokens = word_tokenize(text)
# Remove stopwords
stop_words = set(stopwords.words('english'))
tokens = [w for w in tokens if w not in stop_words]
# Lemmatize
lemmatizer = WordNetLemmatizer()
tokens = [lemmatizer.lemmatize(w) for w in tokens]
return ' '.join(tokens)Sentiment Analysis
from transformers import pipeline
# Pre-trained model
sentiment_analyzer = pipeline("sentiment-analysis")
result = sentiment_analyzer("I love this product!")
# [{'label': 'POSITIVE', 'score': 0.9998}]
# Custom model
from sklearn.feature_extraction.text import TfidfVectorizer
from sklearn.linear_model import LogisticRegression
vectorizer = TfidfVectorizer(max_features=1000)
X = vectorizer.fit_transform(documents)
model = LogisticRegression()
model.fit(X, labels)TF-IDF Vectorization
from sklearn.feature_extraction.text import TfidfVectorizer
vectorizer = TfidfVectorizer(
max_features=5000,
ngram_range=(1, 2), # Unigrams and bigrams
min_df=2, # Minimum document frequency
max_df=0.8 # Maximum document frequency
)
X = vectorizer.fit_transform(documents)
feature_names = vectorizer.get_feature_names_out()Named Entity Recognition
import spacy
nlp = spacy.load("en_core_web_sm")
doc = nlp("Apple Inc. was founded by Steve Jobs in California.")
for ent in doc.ents:
print(f"{ent.text}: {ent.label_}")
# Apple Inc.: ORG
# Steve Jobs: PERSON
# California: GPEBERT for Text Classification
from transformers import (
BertTokenizer, BertForSequenceClassification,
Trainer, TrainingArguments
)
# Load tokenizer and model
tokenizer = BertTokenizer.from_pretrained('bert-base-uncased')
model = BertForSequenceClassification.from_pretrained(
'bert-base-uncased',
num_labels=2
)
# Tokenize
def tokenize_function(examples):
return tokenizer(
examples['text'],
padding='max_length',
truncation=True,
max_length=128
)
tokenized_datasets = dataset.map(tokenize_function, batched=True)
# Train
training_args = TrainingArguments(
output_dir='./results',
num_train_epochs=3,
per_device_train_batch_size=16,
evaluation_strategy='epoch'
)
trainer = Trainer(
model=model,
args=training_args,
train_dataset=tokenized_datasets['train'],
eval_dataset=tokenized_datasets['test']
)
trainer.train()Text Generation with GPT
from transformers import GPT2LMHeadModel, GPT2Tokenizer
tokenizer = GPT2Tokenizer.from_pretrained('gpt2')
model = GPT2LMHeadModel.from_pretrained('gpt2')
input_text = "The future of AI is"
input_ids = tokenizer.encode(input_text, return_tensors='pt')
output = model.generate(
input_ids,
max_length=50,
num_return_sequences=1,
temperature=0.7,
top_k=50,
top_p=0.95
)
generated_text = tokenizer.decode(output[0], skip_special_tokens=True)
print(generated_text)Topic Modeling with LDA
from sklearn.decomposition import LatentDirichletAllocation
from sklearn.feature_extraction.text import CountVectorizer
vectorizer = CountVectorizer(max_features=1000, max_df=0.8, min_df=2)
X = vectorizer.fit_transform(documents)
lda = LatentDirichletAllocation(n_components=5, random_state=42)
lda.fit(X)
# Display topics
feature_names = vectorizer.get_feature_names_out()
for topic_idx, topic in enumerate(lda.components_):
top_words = [feature_names[i] for i in topic.argsort()[-10:]]
print(f"Topic {topic_idx}: {', '.join(top_words)}")Word Embeddings
from gensim.models import Word2Vec
# Train Word2Vec
sentences = [word_tokenize(doc) for doc in documents]
model = Word2Vec(sentences, vector_size=100, window=5, min_count=1)
# Get vector
vector = model.wv['king']
# Find similar words
similar = model.wv.most_similar('king', topn=5)Common Tasks
Text Classification:
- Sentiment analysis
- Spam detection
- Intent classification
- Topic categorization
Sequence Labeling:
- Named Entity Recognition (NER)
- Part-of-Speech (POS) tagging
- Keyword extraction
Generation:
- Text summarization
- Machine translation
- Chatbots
- Code generation
Best Practices
1. Clean text (remove noise, normalize) 2. Handle class imbalance 3. Use pre-trained models when possible 4. Fine-tune on domain-specific data 5. Validate with diverse test data 6. Monitor for bias and fairness
# NLP Processing Configuration
# Text preprocessing and model configuration
# Preprocessing Pipeline
preprocessing:
# Tokenization
tokenizer:
type: "wordpiece" # wordpiece, bpe, sentencepiece, whitespace
vocab_size: 30000
lowercase: true
strip_accents: true
# Text cleaning
cleaning:
remove_html: true
remove_urls: true
remove_emails: true
remove_numbers: false
remove_punctuation: false
remove_extra_whitespace: true
min_length: 3
# Normalization
normalization:
unicode_normalize: "NFC"
expand_contractions: true
correct_spelling: false
# Stopwords
stopwords:
enabled: true
language: "english"
custom_stopwords:
- "etc"
- "also"
# Stemming/Lemmatization
stemming:
enabled: false
type: "porter" # porter, snowball, lancaster
lemmatization:
enabled: true
pos_tag: true
# Embedding Configuration
embeddings:
type: "transformer" # word2vec, glove, fasttext, transformer
word2vec:
vector_size: 300
window: 5
min_count: 2
workers: 4
transformer:
model: "bert-base-uncased"
max_length: 512
pooling: "mean" # cls, mean, max
# Model Configuration
model:
task: "classification" # classification, ner, generation, qa
classification:
architecture: "bert"
num_labels: 5
dropout: 0.1
hidden_size: 768
training:
epochs: 5
batch_size: 16
learning_rate: 2e-5
warmup_steps: 500
weight_decay: 0.01
gradient_accumulation_steps: 2
# Optimization
optimizer:
name: "adamw"
betas: [0.9, 0.999]
epsilon: 1e-8
scheduler:
name: "linear"
warmup_ratio: 0.1
# Evaluation
evaluation:
metrics:
- "accuracy"
- "f1_macro"
- "precision"
- "recall"
- "confusion_matrix"
validation_split: 0.2
test_split: 0.1
# Output
output:
save_model: true
save_tokenizer: true
output_dir: "models/nlp"
logging_steps: 100
save_steps: 500
NLP Models Selection Guide
Model Selection by Task
┌──────────────────────────────────────────────────────────────────────────┐
│ NLP Task │ Recommended Models │
├──────────────────────────────┼───────────────────────────────────────────┤
│ Text Classification │ BERT, RoBERTa, DistilBERT │
│ Sentiment Analysis │ BERT, XLNet, DistilBERT │
│ Named Entity Recognition │ BERT-NER, spaCy, Flair │
│ Question Answering │ BERT-QA, RoBERTa, ALBERT │
│ Text Generation │ GPT-2, GPT-3, T5, LLaMA │
│ Summarization │ BART, T5, Pegasus │
│ Translation │ mBART, MarianMT, NLLB │
│ Semantic Similarity │ Sentence-BERT, SimCSE │
│ Zero-shot Classification │ BART-MNLI, DeBERTa-v3 │
│ Token Classification │ BERT, RoBERTa, LayoutLM │
└──────────────────────────────┴───────────────────────────────────────────┘Model Comparison
| Model | Parameters | Speed | Quality | Best For |
|---|---|---|---|---|
| DistilBERT | 66M | Fast | Good | Production, edge |
| BERT-base | 110M | Medium | Very Good | General NLP |
| BERT-large | 340M | Slow | Excellent | High accuracy |
| RoBERTa | 125M | Medium | Excellent | Most NLP tasks |
| ALBERT | 12M | Fast | Good | Mobile/edge |
| XLNet | 340M | Slow | Excellent | Long documents |
| GPT-2 | 1.5B | Slow | Excellent | Text generation |
| T5 | 220M-11B | Varies | Excellent | Multi-task |
Preprocessing Decision Tree
Input Text
│
▼
┌─────────────────────┐
│ Clean & Normalize │ Remove HTML, URLs, special chars
└─────────┬───────────┘
│
▼
┌─────────────────────┐
│ Tokenization │ WordPiece/BPE/SentencePiece
└─────────┬───────────┘
│
┌─────┴─────┐
▼ ▼
Classical Transformer
│ │
▼ ▼
┌──────────┐ ┌──────────┐
│Stopwords │ │ Subword │
│Stemming │ │ Tokens │
│TF-IDF │ │ Attention│
└──────────┘ └──────────┘Embedding Methods Comparison
| Method | Type | Pros | Cons |
|---|---|---|---|
| Bag of Words | Sparse | Simple | No semantics |
| TF-IDF | Sparse | Term importance | No context |
| Word2Vec | Dense | Semantic | Fixed vectors |
| GloVe | Dense | Good quality | Pre-trained only |
| FastText | Dense | Subwords | Larger files |
| BERT | Contextual | State-of-art | Compute heavy |
| Sentence-BERT | Sentence | Fast similarity | Task-specific |
Fine-tuning Best Practices
Learning Rate Schedule
# Typical learning rates for fine-tuning
LEARNING_RATES = {
'bert-base': 2e-5,
'bert-large': 1e-5,
'roberta': 2e-5,
'distilbert': 5e-5,
'gpt2': 5e-5
}
# Warmup steps (typically 6-10% of total)
warmup_steps = int(0.1 * total_steps)Data Requirements
| Task | Minimum | Recommended |
|---|---|---|
| Classification | 1000 | 10,000+ |
| NER | 5000 | 50,000+ |
| QA | 10,000 | 100,000+ |
| Generation | 100,000 | 1M+ |
Evaluation Metrics by Task
| Task | Primary Metrics |
|---|---|
| Classification | Accuracy, F1, AUC-ROC |
| NER | Entity F1, Exact Match |
| QA | Exact Match, F1 |
| Generation | BLEU, ROUGE, Perplexity |
| Similarity | Spearman, Cosine Sim |
| Translation | BLEU, chrF, COMET |
Common Architectures
Encoder-only (BERT-style)
- Best for: Classification, NER, embeddings
- Examples: BERT, RoBERTa, DistilBERT
Decoder-only (GPT-style)
- Best for: Text generation, completion
- Examples: GPT-2, GPT-3, LLaMA
Encoder-Decoder (T5-style)
- Best for: Translation, summarization, multi-task
- Examples: T5, BART, mBART
Resources
#!/usr/bin/env python3
"""
NLP Text Preprocessing Pipeline
Comprehensive text cleaning and preprocessing utilities
"""
import re
import unicodedata
from typing import List, Optional, Callable
from dataclasses import dataclass
import logging
logging.basicConfig(level=logging.INFO)
logger = logging.getLogger(__name__)
@dataclass
class PreprocessingConfig:
"""Configuration for text preprocessing."""
lowercase: bool = True
remove_html: bool = True
remove_urls: bool = True
remove_emails: bool = True
remove_numbers: bool = False
remove_punctuation: bool = False
remove_extra_whitespace: bool = True
min_token_length: int = 2
expand_contractions: bool = True
unicode_normalize: bool = True
class TextPreprocessor:
"""Comprehensive text preprocessing pipeline."""
# Common contractions
CONTRACTIONS = {
"ain't": "am not",
"aren't": "are not",
"can't": "cannot",
"couldn't": "could not",
"didn't": "did not",
"doesn't": "does not",
"don't": "do not",
"hadn't": "had not",
"hasn't": "has not",
"haven't": "have not",
"he'd": "he would",
"he'll": "he will",
"he's": "he is",
"i'd": "i would",
"i'll": "i will",
"i'm": "i am",
"i've": "i have",
"isn't": "is not",
"it's": "it is",
"let's": "let us",
"mightn't": "might not",
"mustn't": "must not",
"shan't": "shall not",
"she'd": "she would",
"she'll": "she will",
"she's": "she is",
"shouldn't": "should not",
"that's": "that is",
"there's": "there is",
"they'd": "they would",
"they'll": "they will",
"they're": "they are",
"they've": "they have",
"we'd": "we would",
"we're": "we are",
"we've": "we have",
"weren't": "were not",
"what'll": "what will",
"what're": "what are",
"what's": "what is",
"what've": "what have",
"where's": "where is",
"who'd": "who would",
"who'll": "who will",
"who're": "who are",
"who's": "who is",
"who've": "who have",
"won't": "will not",
"wouldn't": "would not",
"you'd": "you would",
"you'll": "you will",
"you're": "you are",
"you've": "you have"
}
def __init__(self, config: Optional[PreprocessingConfig] = None):
self.config = config or PreprocessingConfig()
self._build_pipeline()
def _build_pipeline(self):
"""Build preprocessing pipeline based on config."""
self.pipeline: List[Callable[[str], str]] = []
if self.config.unicode_normalize:
self.pipeline.append(self._normalize_unicode)
if self.config.lowercase:
self.pipeline.append(str.lower)
if self.config.remove_html:
self.pipeline.append(self._remove_html)
if self.config.remove_urls:
self.pipeline.append(self._remove_urls)
if self.config.remove_emails:
self.pipeline.append(self._remove_emails)
if self.config.expand_contractions:
self.pipeline.append(self._expand_contractions)
if self.config.remove_numbers:
self.pipeline.append(self._remove_numbers)
if self.config.remove_punctuation:
self.pipeline.append(self._remove_punctuation)
if self.config.remove_extra_whitespace:
self.pipeline.append(self._remove_extra_whitespace)
def preprocess(self, text: str) -> str:
"""Apply full preprocessing pipeline to text."""
if not text:
return ""
for step in self.pipeline:
text = step(text)
return text.strip()
def preprocess_batch(self, texts: List[str]) -> List[str]:
"""Preprocess a batch of texts."""
return [self.preprocess(text) for text in texts]
@staticmethod
def _normalize_unicode(text: str) -> str:
"""Normalize unicode characters."""
return unicodedata.normalize('NFKC', text)
@staticmethod
def _remove_html(text: str) -> str:
"""Remove HTML tags."""
clean = re.compile('<.*?>')
return re.sub(clean, ' ', text)
@staticmethod
def _remove_urls(text: str) -> str:
"""Remove URLs from text."""
url_pattern = r'https?://\S+|www\.\S+'
return re.sub(url_pattern, ' ', text)
@staticmethod
def _remove_emails(text: str) -> str:
"""Remove email addresses."""
email_pattern = r'\b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Z|a-z]{2,}\b'
return re.sub(email_pattern, ' ', text)
def _expand_contractions(self, text: str) -> str:
"""Expand contractions (e.g., don't -> do not)."""
for contraction, expansion in self.CONTRACTIONS.items():
text = re.sub(r'\b' + contraction + r'\b', expansion, text, flags=re.IGNORECASE)
return text
@staticmethod
def _remove_numbers(text: str) -> str:
"""Remove numbers from text."""
return re.sub(r'\d+', ' ', text)
@staticmethod
def _remove_punctuation(text: str) -> str:
"""Remove punctuation."""
return re.sub(r'[^\w\s]', ' ', text)
@staticmethod
def _remove_extra_whitespace(text: str) -> str:
"""Remove extra whitespace."""
return ' '.join(text.split())
class Tokenizer:
"""Simple tokenization utilities."""
@staticmethod
def word_tokenize(text: str) -> List[str]:
"""Basic word tokenization."""
return text.split()
@staticmethod
def sentence_tokenize(text: str) -> List[str]:
"""Basic sentence tokenization."""
# Simple sentence boundary detection
sentences = re.split(r'(?<=[.!?])\s+', text)
return [s.strip() for s in sentences if s.strip()]
@staticmethod
def ngrams(tokens: List[str], n: int) -> List[tuple]:
"""Generate n-grams from tokens."""
return list(zip(*[tokens[i:] for i in range(n)]))
class TextStatistics:
"""Calculate text statistics."""
@staticmethod
def word_count(text: str) -> int:
"""Count words in text."""
return len(text.split())
@staticmethod
def char_count(text: str, include_spaces: bool = False) -> int:
"""Count characters in text."""
if include_spaces:
return len(text)
return len(text.replace(' ', ''))
@staticmethod
def sentence_count(text: str) -> int:
"""Count sentences in text."""
return len(Tokenizer.sentence_tokenize(text))
@staticmethod
def avg_word_length(text: str) -> float:
"""Calculate average word length."""
words = text.split()
if not words:
return 0.0
return sum(len(word) for word in words) / len(words)
@staticmethod
def vocabulary_size(text: str) -> int:
"""Count unique words."""
return len(set(text.lower().split()))
@staticmethod
def lexical_diversity(text: str) -> float:
"""Calculate type-token ratio (lexical diversity)."""
words = text.lower().split()
if not words:
return 0.0
return len(set(words)) / len(words)
def main():
"""Demo NLP preprocessing."""
print("NLP Text Preprocessing Demo")
print("=" * 50)
# Sample text with various issues
sample_text = """
<p>Hello! Check out https://example.com for more info!</p>
I can't believe it's already 2024... Contact us at info@example.com.
This is AMAZING!!! Don't you think so?
We've got 100+ products with extra spaces.
"""
print("Original text:")
print(sample_text)
print("-" * 50)
# Create preprocessor
config = PreprocessingConfig(
lowercase=True,
remove_html=True,
remove_urls=True,
remove_emails=True,
remove_numbers=False,
remove_punctuation=False,
expand_contractions=True
)
preprocessor = TextPreprocessor(config)
cleaned = preprocessor.preprocess(sample_text)
print("\nCleaned text:")
print(cleaned)
print("-" * 50)
# Text statistics
print("\nText Statistics:")
print(f" Word count: {TextStatistics.word_count(cleaned)}")
print(f" Sentence count: {TextStatistics.sentence_count(cleaned)}")
print(f" Avg word length: {TextStatistics.avg_word_length(cleaned):.2f}")
print(f" Vocabulary size: {TextStatistics.vocabulary_size(cleaned)}")
print(f" Lexical diversity: {TextStatistics.lexical_diversity(cleaned):.3f}")
print("\n[SUCCESS] NLP preprocessing complete!")
if __name__ == '__main__':
main()
Related skills
FAQ
What does nlp-processing do?
nlp-processing is a Claude Code skill for ai & agent building.
When should I use nlp-processing?
When you need to helps with ai & agent building tasks., or when nlp-processing is a claude code skill for ai & agent building.
What are the main capabilities?
nlp-processing; AI & Agent Building; AI-coding skill.