PsychiatryNLPKit.analysis.BatchAnalyzer
- class PsychiatryNLPKit.analysis.BatchAnalyzer(text_data, included_analyses='all', excluded_analyses=None, image_paths=None)[source]
Run selected analyses on a
TextDataobject in batch.The analyzer is an orchestrator only — every analysis is executed through
TextData.compute. Models required by the requested analyses must be attached to theTextDatainstance; the analyzer keeps them loaded for the whole run and unloads them afterwards.- Args:
- text_data: Pre-built
TextDatainstance with sections and any models required by the requested analyses.
- included_analyses:
"all"runs every registered analysis. Pass an explicit list of function names to run a subset.
- excluded_analyses: Function names to remove from included_analyses. Every
name here must already be in the resolved inclusion list; otherwise an
AssertionErroris raised.- image_paths: Mapping of section name → image file path. Required if
"image_text_similarity"is in analyses; must cover every section intext_data.section_names.
- text_data: Pre-built
- Raises:
- AssertionError: If a requested analysis requires a model or data argument
that was not provided.
Example:
# Run all analyses (requires all models attached to text_data) result = BatchAnalyzer( text_data, image_paths={"Paragraph 1": "img1.jpg", "Paragraph 2": "img2.jpg"} ).run() # Selective analyses with language-dependent metrics result = BatchAnalyzer( text_data, included_analyses=["sentence_length", "adverb_ratio", "filler_words_count"], ).run()
Methods
__init__(text_data[, included_analyses, ...])run()Execute all requested analyses and return merged results.