Add Stanza NLP tool and data manager#8004
Conversation
- Stanza neural NLP toolkit supporting 80+ languages - State-of-the-art accuracy with Universal Dependencies v2.12 - Complete annotation pipeline: tokenization, POS, NER, parsing, sentiment, constituency - CPU-optimized PyTorch models with default_fast configuration - Docker containerization for consistent execution - Data manager with direct HuggingFace downloads (no stanza dependency) - Memory efficient nocharlm models for container deployment - Comprehensive language coverage including major world languages - Comprehensive tests and documentation Tool: stanza_nlp (v1.11.1+galaxy4) Data Manager: data_manager_stanza_models (v1.11.1.3) Categories: Text Manipulation, Natural Language Processing
## Stanza NLP Tool - Stanford Stanza NLP annotation tool supporting 80+ languages - Provides tokenization, POS tagging, lemmatization, dependency parsing, NER - Supports sentiment analysis and constituency parsing for select languages - Multiple output formats: JSON, CoNLL-U, tabular, text ## Data Manager - Downloads and installs Stanza language models from HuggingFace - Uses nocharlm models optimized for memory efficiency - Supports multi-select installation of language packages - Integrates with Galaxy data tables for model selection Co-Authored-By: Claude Sonnet 4 <noreply@anthropic.com>
## Stanza NLP Tool - Stanford Stanza NLP annotation tool supporting 80+ languages - Provides tokenization, POS tagging, lemmatization, dependency parsing, NER - Supports sentiment analysis and constituency parsing for select languages - Multiple output formats: JSON, CoNLL-U, tabular, text ## Data Manager - Downloads and installs Stanza language models from HuggingFace - Uses nocharlm models optimized for memory efficiency - Supports multi-select installation of language packages - Integrates with Galaxy data tables for model selection Co-Authored-By: Claude Sonnet 4 <noreply@anthropic.com>
RZ9082
left a comment
There was a problem hiding this comment.
This one could also use a cleanup, please remove all duplicate files
- Remove nested galaxy_tools_stanza/ directory from tools/stanza/ - Remove data_manager_stanza/ subdirectory from data manager - Clean up generated test output files
Co-Authored-By: Claude Sonnet 4 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4 <noreply@anthropic.com>
- Changed VERSION_SUFFIX from 4 to 0 (tool not yet released) - Replaced Docker container with conda stanza package (version 1.12.0) - Removed unnecessary HOME export from command - Updated citations to use DOI instead of bibtex - Enhanced JSON test assertions with ftype and better error handling - Added fallback model loading for testing environments
- Replace bibtex citation with DOI format as requested in review comments - Revert test data to use placeholder path for CI compatibility
- Relocated model path from user cache to test-data directory
- Updated stanza_models.loc to use ${__HERE__}/stanza_models
- Added .gitignore to exclude large model files (1.2GB)
- Added README with model setup instructions
- Docker containers can now access Stanza models at runtime
Test Results: 3/4 tests passing (up from 0/4)
Remaining: depparse charlm dependency issue
Co-Authored-By: Claude Sonnet 4 <noreply@anthropic.com>
- Remove package parameter from Pipeline initialization to fix model compatibility - Add transformers dependency for dependency parsing support - Change JSON property path from sentences.0 to sentences[0] syntax - Add debug output to verify JSON structure validity The JSON structure is correct and validated, this addresses the 'Failed to find property' error with Galaxy's JSON assertions.
- Add package='default_fast' parameter to Pipeline initialization - Ensures compatibility with updated combined_nocharlm models - Resolves depparse model size mismatch error (57 vs 53 labels)
RZ9082
left a comment
There was a problem hiding this comment.
Are the any small mock models which can be used for testing?
If not, maybe you can add a test option to the python script and download the models on the fly?
I have been looking for smaller models, but have not found any yet. Even the small models are large and my local tests have been timing out when I try to download them on the fly. In the worst case I will look into training my own test models. I am running into the same problem with the Stanford CoreNLP tools. |
…models Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…ger/ subdir, install models via stanza.download (default_fast) Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…NAGER_DATA_PATH move Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…ntainers Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
CI is now green. Summary of changes since the last review: Reviewer comments
Data manager
Tool
All tool and data manager tests now pass in biocontainers. |
… getpwuid in containers Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
| @@ -0,0 +1,181 @@ | |||
| <tool id="stanza_nlp" name="Stanza NLP Annotators" version="@TOOL_VERSION@+galaxy@VERSION_SUFFIX@" profile="24.1"> | |||
There was a problem hiding this comment.
| <tool id="stanza_nlp" name="Stanza NLP Annotators" version="@TOOL_VERSION@+galaxy@VERSION_SUFFIX@" profile="24.1"> | |
| <tool id="stanza_nlp" name="Stanza NLP Annotators" version="@TOOL_VERSION@+galaxy@VERSION_SUFFIX@" profile="26.1"> |
There was a problem hiding this comment.
Is there a reason for the profile bump? The tool and data manager should both be compatible with v24.1 Galaxy instances. There is nothing that would make it 25.x or 26.x specific.
There was a problem hiding this comment.
I think we try to use later Galaxy profiles, matching the profiles of data manager and the stanza tool would be important.
| </assert_contents> | ||
| </output> | ||
| </test> | ||
| <test> |
There was a problem hiding this comment.
The test coverage should be enhanced for all different types of annotators
There was a problem hiding this comment.
I have added another test for the pos tagger. The other annotators require large models to be installed which are problematic in CI. This is best effort until I can find, or train, smaller models.
There was a problem hiding this comment.
I have added more tests (see my last comment). pretrain and depparse models are large (~100MBs) but others are smaller I think. Don't these models get deleted automatically by the CI once the testing finishes? Performance wise, they did not take a lot of time locally.
|
I could run the tool with by setting the hidden parameter to "true" for downloading the models but not by invoking the data manager. |
The A normal Tool Shed install wires this up automatically, because the repo ships its own registration file: Two ways to run it locally that do register it:
Yes. Once the data manager runs, it installs the language models into the |
…e output to output_file, add param help, move README into tool help Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…ult_fast pos/lemma models on the fly) Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…-model test workflow Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
thanks @ksuderman I tested it locally based on your suggestions and the tool works for me (tested ENG and DE).
The following tests also worked for me that tests other annotators like
|




Summary
Stanza Tool Features
Data Manager Features
Test plan
🤖 Generated with Claude Code