28sungmin/m4-add-skills/vocabulary-diversity
Claude Code and agent skill by 28sungmin/m4-add-skills
- community
Checking that the SKILL.md file is still in the repository.
Measure diversity of noun words in clinical notes using NLTK POS tagging; computes unique/total noun ratio and top-5/10/20% coverage scores. No API key required. Use for LYDUS data quality assessment of vocabulary richness in unstructured text.
Install
npx vskill@latest install 28sungmin/m4-add-skills/vocabulary-diversitySKILL.md
Vocabulary Diversity
Measures the diversity of noun words in clinical notes extracted from a QUIQ-format table. High diversity means notes use varied vocabulary; low diversity means a small set of nouns dominates all documentation.
When to Use This Skill
- After QUIQ conversion, to assess how varied the noun vocabulary is in clinical notes
- To detect template-heavy or formulaic documentation (low vocabulary diversity)
- To identify the most frequently used clinical terms (coverage score analysis)
- As part of LYDUS quality management assessment
SQL Support
Not applicable. Requires NLTK word tokenization and POS tagging.
Filtering Logic
| Condition | Value | |
|---|---|---|
Mapping_info_1 | contains note (case-insensitive) — covers note_clinical, note_rad, etc. | |
Value | used as the note text |
Algorithm
- Word tokenization (
_noun_words): tokenize each note with NLTKword_tokenize - Noun filter: keep only tokens with POS tag starting with
NN(noun, proper noun, etc.) - Diversity metrics:
| Metric | Formula | Meaning | |
|---|---|---|---|
Vocabulary Diversity (%) | unique_nouns / total_nouns × 100 | 높을수록 다양한 명사 어휘 사용 | |
Coverage Score (Top X%) | Top X% of unique noun types → % of total occurrences | 상위 X% 어휘가 전체 명사의 몇 % 차지 |
Coverage score example: Top 5% = the most-common 5% of unique noun types cover Y% of all noun occurrences. Low Y% → diverse vocabulary; high Y% → a few terms dominate.
Comparison with sentence-diversity
| Skill | Unit of analysis | POS filter | |
|---|---|---|---|
| sentence-diversity | sentences | VB* (verbs) | |
| vocabulary-diversity | words | NN* (nouns) |
NLTK Dependencies
The script auto-downloads required NLTK data on first run:
punkt/punkt_tab— word tokenizeraveraged_perceptron_tagger/averaged_perceptron_tagger_eng— POS tagger
Output
| File | Description | |
|---|---|---|
vocabulary_diversity_summary.txt | Vocabulary Diversity (%), Coverage Scores for top 5/10/20% | |
vocabulary_diversity_frequency.csv | Per-word: Count, Percentage (sorted by frequency) | |
vocabulary_diversity_plot.png | Bar chart of top-N most frequent nouns |
How to Run
As a script with config
Critical Notes
- note 필터만 적용 —
Mapping_info_1에note가 포함된 모든 행이 대상 (note_clinical,note_rad등).
- Noun 단어만 집계 — NN* POS 태그만 포함. 동사, 형용사, 관사 등은 제외. 임상 개체명(진단명, 약물명 등)이 주요 분석 대상.
- NLTK 자동 다운로드 — 첫 실행 시 punkt, averaged_perceptron_tagger가 없으면 자동으로 다운로드됨.
- 원본 코드 개선 사항:
df_note['TEXT_words'] = ...SettingWithCopyWarning →.copy()후 할당assert len(df_note) > 0→ 명시적 FAIL 메시지 후 빈 결과 반환 (AssertionError 방지)total_words변수 이중 할당 혼란 →total_count/counter명확히 분리os.path.join사용 (f-string 경로 대신)--configargparse에required=True추가matplotlib.use('Agg')추가 (헤드리스 환경)
- Dependencies —
nltk,pandas,matplotlib
References
- LYDUS 품질관리 프로그램 활용 가이드라인 (비공개 내부 문서)
- Original Python implementation: LYDUS_Vocabulary_Diversity.py (이성민 작성)
- Bird, S., Klein, E., & Loper, E. (2009). Natural Language Processing with Python. O'Reilly.
Security
- Security scanPassed, 90 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingsrc/m4/skills/lydus/vocabulary-diversity/SKILL.md
Popularity
- 7-day trend score
- 0
Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/28sungmin/m4-add-skills/vocabulary-diversity)