PsychiatryNLPKit.analysis.stop_words_ratio
- PsychiatryNLPKit.analysis.stop_words_ratio(pos_tags, sections=None, lang='en', averaging_method='macro')[source]
Stop word-to-total-word ratio per section.
- Notes:
Theoretical basis - Baseline measure of function-word usage. Matches against lemmas (not surface forms). Function word patterns are sensitive to thought disorder and language impairment.
- Args:
pos_tags: Dict mapping section names to lists of POS-tagged sentences. sections: Sections to process.
Noneprocesses all sections inpos_tags.
lang: Language code (“en” or “fr”). averaging_method:
"macro"averages per-sentence ratios;"micro"computes total stopwords / total words across the section.
- Returns:
Dict mapping section names to a dict with keys
"stop_words_ratio"and"stop_words_count". Empty sections receivefloat("nan")for both.