resolve_model#
- scikitplot.cleanprompt.resolve_model(language='en', size='sm', explicit=None)[source]#
Resolve a language and size into a spaCy model name.
- Parameters:
- languagestr, default=’en’
Language code.
- sizestr, default=’sm’
Preferred model size; one of
MODEL_SIZES.- explicitstr, optional
A model name that overrides everything else.
- Returns:
- modelstr
The model name to load.
- notedict
What was decided:
language,requested_size,resolved_size,fallbackand, when a substitution happened,reason.
- Raises:
- PolicyError
If
sizeis not a known size.
- Parameters:
- Return type:
Notes
User notes. When
fallbackisTruethe multilingual model was substituted, and it recognises only broad categories. Treat thin results as a limitation of that model rather than as an empty document.Examples
>>> resolve_model("en", "sm")[0] 'en_core_web_sm' >>> resolve_model("de", "lg")[0] 'de_core_news_lg' >>> model, note = resolve_model("tr") >>> model, note["fallback"] ('xx_ent_wiki_sm', True) >>> resolve_model("de", explicit="my_model")[0] 'my_model'
Gallery examples#
Cleanprompt Moderate: Policies, Entities, and the Vault’s Lifecycle
Cleanprompt Moderate: Policies, Entities, and the Vault's Lifecycle