# Install core NLP dependencies
pip install -r requirements.txt
# Download spaCy English model
python -m spacy download en_core_web_sm
# Optional: Install transformers for advanced features
pip install transformers torchfrom victor_hub.skills import AdvancedNLPSkill
nlp = AdvancedNLPSkill()from victor_hub.victor_boot import Task
task = Task(
id="ner-1",
type="ner",
inputs={"text": "Apple Inc. was founded by Steve Jobs in California."}
)
result = nlp.execute(task, {})
print(result.output["entities"])
# Output: [{"text": "Apple Inc.", "label": "ORG"}, ...]task = Task(
id="sentiment-1",
type="sentiment",
inputs={"text": "This is amazing!"}
)
result = nlp.execute(task, {})
print(result.output["overall_sentiment"]) # "POSITIVE"
print(result.output["confidence"]) # 0.95task = Task(
id="keywords-1",
type="keyword_extraction",
inputs={"text": "Your article text here..."}
)
result = nlp.execute(task, {})
print(result.output["top_keywords"])
# Output: [{"keyword": "ai", "frequency": 5}, ...]task = Task(
id="summary-1",
type="summarization",
inputs={
"text": "Long article...",
"max_length": 130,
"min_length": 30
}
)
result = nlp.execute(task, {})
print(result.output["summary"])task = Task(
id="analyze-1",
type="nlp",
inputs={"text": "Your text..."}
)
result = nlp.execute(task, {})
print(result.output)
# Output: {
# "statistics": {...},
# "entities": {...},
# "sentiment": {...},
# "keywords": {...}
# }| Task Type | Description | Output |
|---|---|---|
ner |
Extract named entities | Entities with labels and positions |
sentiment |
Analyze sentiment | Sentiment label + confidence |
summarization |
Summarize text | Summary + compression ratio |
keyword_extraction |
Extract keywords | Top keywords by frequency |
pos_tagging |
Part-of-speech tags | Token-level POS tags |
dependency_parsing |
Parse syntax | Dependency tree |
language_detection |
Detect language | Language code + confidence |
nlp or text_analysis |
Full analysis | All features combined |
from victor_hub.victor_boot import VictorHub, SkillRegistry
from victor_hub.skills import AdvancedNLPSkill
# Create hub
hub = VictorHub()
# Register NLP skill
nlp_skill = AdvancedNLPSkill()
hub.registry.register(nlp_skill)
# Execute task
task = Task(id="1", type="ner", inputs={"text": "..."})
result = hub.execute_task(task)# Run NLP skill tests
python test_nlp_skill.py
# Run integration example
python example_nlp_integration.py- Full Documentation: NLP_INTEGRATION.md
- Implementation Details: NLP_IMPLEMENTATION_SUMMARY.md
- Main README: README.md
python -m spacy download en_core_web_sm- NLP skill works without transformers
- Sentiment uses rule-based fallback
- Summarization uses extractive method
- Install transformers for advanced features:
pip install transformers torch
- Models load lazily on first use
- Keep skill instance alive to avoid reloading
- Consider using spaCy-only mode (no transformers)
- Reuse skill instance - Models stay in memory
- Batch processing - Process multiple texts together
- Skip transformers - Use spaCy-only for speed
- Limit text length - Very long texts may be slow
See example_nlp_integration.py for complete working examples.
Status: Production Ready ✅
Version: 1.0.0