Przejdź do treści
Biblioteka skilli
Dane i analityka · Analiza

alterlab-text-as-data

/alterlab-text-as-data

Analizuje tekst jako dane w naukach społecznych: modelowanie tematów BERTopic i LDA, osadzenia dokumentów, metody słownikowe i klasyfikację nadzorowaną z walidacją wyników.

Licencja
MIT
Ostatnia zmiana repozytorium
23.09.2026

Ocena i bezpieczeństwo

100/ 100Klasa: dobry
Format25 / 25
Frontmatter z nazwą i opisem, poprawna nazwa, opis do 1024 znaków, nazwa zgodna z folderem.
Odkrywalność25 / 25
Opis mówi, kiedy użyć skilla, ma sensowną długość i jest w 3. osobie.
Treść35 / 35
Co najmniej 150 słów i do 500 linii, nagłówki, listy kroków, przykłady albo kod.
Higiena15 / 15
Bez zaślepek typu TODO, bez ścieżek Windows, z licencją.
Ryzykobrak sygnałów w skanie
Pliki w paczce
4
Skrypty
1
Komentarze HTML
0
Adresy URL w SKILL.md
0
Przestarzałość

Brak sygnałów. Repozytorium zmienione 23.09.2026, bez odwołań do wycofanych modeli i API.

Licencja

MIT, otwarta: można używać i zmieniać, z zachowaniem informacji o autorze.

Co sprawdzić przed instalacją
  • 1 skrypt w paczce. Przejrzyj je przed instalacją, bo Claude może je uruchomić.

Skrypty: scripts/text_method_router.py

Co robi i kiedy

Analizuje tekst jako dane w naukach społecznych: modelowanie tematów BERTopic i LDA, osadzenia dokumentów, metody słownikowe i klasyfikację nadzorowaną z walidacją wyników.

Oryginalny opis (EN)

Analyzes text as social-science data — topic modeling (BERTopic with embeddings + class-based TF-IDF, LDA/NMF via scikit-learn or gensim), document embeddings (sentence-transformers), dictionary/lexicon methods, and supervised text classification — choosing the method that matches the inferential goal (discovery vs measurement vs prediction) and validating topic reliability rather than trusting one stochastic run. It uses the verified stack (BERTopic, scikit-learn, gensim CoherenceModel, spaCy, sentence-transformers) with pinned patterns. Use when the request mentions topic modeling, text as d

Jak działa

  1. Core Mission
  2. When to Use This Skill
  3. Method by goal (verified stack, pinned)
  4. The reliability discipline (topic models are stochastic)
  5. Output Template
  6. References
Sekcje z nagłówków SKILL.md, w oryginale · 77 linii, 568 słów
Podgląd SKILL.md
---
name: alterlab-text-as-data
description: "Analyzes text as social-science data — topic modeling (BERTopic with embeddings + class-based TF-IDF, LDA/NMF via scikit-learn or gensim), document embeddings (sentence-transformers), dictionary/lexicon methods, and supervised text classification — choosing the method that matches the inferential goal (discovery vs measurement vs prediction) and validating topic reliability rather than trusting one stochastic run. It uses the verified stack (BERTopic, scikit-learn, gensim CoherenceModel, spaCy, sentence-transformers) with pinned patterns. Use when the request mentions topic modeling, text as data, computational text analysis, document embeddings, dictionary/sentiment lexicons, or classifying a corpus. For training or fine-tuning transformer models prefer alterlab-transformers; for humanities close-reading corpora prefer alterlab-digital-humanities. Part of the AlterLab Academic Skills suite."
license: MIT
allowed-tools: Read Bash(python:*)
compatibility: "Requires (declare in-session, no runtime install on Anthropic API): bertopic>=0.16, scikit-learn>=1.3, gensim>=4.3, spacy>=3.7 (+ a model like en_core_web_sm), sentence-transformers>=2.2 (pip). Runs locally via `uv run python`; no API key."
metadata:
    skill-author: AlterLab
    version: "1.0.1"
    last_updated: "2026-09-23"
    depends_on: "alterlab-ssci-design-gate, alterlab-transformers (model training), alterlab-digital-humanities; audited by alterlab-ssci-inference-gate"
---

# Text-as-Data — Match the Method to the Inferential Goal

**Skill type: ANALYSIS MODULE.** Turns a corpus into measurements. The discipline is choosing by
*goal* — **discovery** (what themes exist?), **measurement** (how much of concept X?), or
**prediction** (label new documents) — and validating that a topic solution is **reliable**, not a
single lucky stochastic run.

## Core Mission

```
PICK BY GOAL: DISCOVERY vs MEASUREMENT vs PREDICTION. THEN VALIDATE THE TOPICS — ONE RUN IS NOT A RESULT.
```

## When to Use This Skill

- "Run topic modeling on my corpus (BERTopic / LDA)."
- "Measure how much each document expresses concept X (dictionary/lexicon)."
- "Embed my documents and cluster / compare them."
- "Classify these texts into categories."

### Does NOT Trigger

| The request is really about… | Route to | Why not this skill |
|---|---|---|
| Training / fine-tuning a transformer model | `alterlab-transformers` | Model training, not corpus measurement. |
| Humanities close-reading / annotation of texts | `alterlab-digital-humanities` | Interpretive, not quantitative text-as-data. |
| Whether a text method fits the question at all | `alterlab-ssci-design-gate` | Design routing, upstream. |
| Plain tabular statistics | `alterlab-statistical-analysis` | No text. |

## Method by goal (verified stack, pinned)

| Goal | Method | Verified call |
|------|--------|---------------|
| **Discovery** (emergent themes, contextual) | **BERTopic** (v0.17) | `from bertopic import BERTopic; topics, probs = BERTopic().fit_transform(docs)`; `get_topic_info()`, `get_topic(0)`. Plug embeddings via `embedding_model=SentenceTransformer("all-MiniLM-L6-v2")`, a `vectorizer_model=CountVectorizer(min_df=10)`. |
| Discovery (bag-of-words, classic) | **LDA / NMF** | sklearn: `LatentDirichletAllocation(n_components=k).fit(CountVectorizer().fit_transform(docs))`; or gensim `LdaModel(corpus, num_topics=k, id2word=dictionary)`. |
| Topic quality | **coherence** | gensim `CoherenceModel(model=lda, texts=tok, dictionary=d, coherence="c_v").get_coherence()`. |
| **Measurement** (how much of concept X) | **dictionary / lexicon** | count validated lexicon terms; report reliability and validate against hand-coding. |
| Embeddings / similarity | **sentence-transformers** (v6) | `SentenceTransformer("all-MiniLM-L6-v2").encode(texts)` → cluster / cosine-compare. |
| **Prediction** (label documents) | **supervised** | `TfidfVectorizer()` → a sklearn classifier; report held-out F1, not in-sample fit. |
| Linguistic features (POS, entities) | **spaCy** (v3) | `nlp = spacy.load("en_core_web_sm"); doc = nlp(text)`. |

Method-selection helper (stdlib): `scripts/text_method_router.py`. Full patterns, preprocessing,
and the topic-reliability procedure: `references/text_stack.md`.

## The reliability discipline (topic models are stochastic)

LDA (and, to a lesser degree, BERTopic via UMAP) gives different topics on different runs. A single
run is not a result. Required:

1. **Replicate** across seeds/runs; align topics across runs (e.g. Hungarian matching) and score
   stability (top-word overlap, RBO); report a **prototype** (most-representative) solution.
2. **Coherence, not just perplexity** — choose K by `c_v` coherence and human readability, not
   log-likelihood alone.
3. **Determinism where possible** — fix `random_state` (sklearn LDA) and UMAP's `random_state`
   (BERTopic) for reproducibility; still report stability across *different* seeds.
4. **Validate measurement** — a dictionary/topic used as a *measure* of a concept needs validation
   against human coding (precision/recall or correlation), exactly like any other instrument.

## Output Template

```
GOAL:         discovery | measurement | prediction
METHOD:       <BERTopic / LDA / dictionary / embeddings / supervised> + why it matches the goal
MODEL:        <call + K selection by coherence; embedding/vectorizer choices>
RELIABILITY:  <seeds run; topic stability; coherence c_v; determinism settings>
VALIDATION:   <if used as a measure: agreement with human coding>
CLAIM SCOPE:  descriptive/measurement of the corpus; generalization scoped to the corpus/sampling
```

## References

- `references/text_stack.md` — BERTopic/LDA/gensim/spaCy/embeddings patterns, preprocessing, topic-reliability procedure.
- `scripts/text_method_router.py` — stdlib router from goal + corpus features to the right method.

Part of the AlterLab Academic Skills suite.
Pliki w paczce (4)
  • SKILL.md 6 KB
  • evals/evals.json 3 KB
  • references/text_stack.md 4 KB
  • scripts/text_method_router.py 3 KB

Wersje

W bazie nie ma innych skilli o nazwie alterlab-text-as-data.

Migawka bazy z 13.11.2026 · wersja paczki 04f5d79036b4 (skrót SHA-256 całej paczki)

Pobrania w ostatnich 30 dniach: 0 · ranking

Zgłoś problem z tym skillem: szkodliwa treść, błędny opis albo prośba autora o usunięcie.

Podobne skille

  • 100local-embeddings-sentence-transformers
    Generuje lokalnie gęste osadzenia zdań i dokumentów przez Sentence Transformers na urządzeniach brzegowych.
  • 100scikit-learn-ml
    Buduje modele uczenia maszynowego w scikit-learn: klasyfikację, regresję, klasteryzację, redukcję wymiarów i ocenę modeli.
  • 100alterlab-scikit-learn
    Prowadzi klasyczne uczenie maszynowe w scikit-learn: klasyfikację, regresję, klasteryzację, redukcję wymiarów, ocenę modeli, strojenie hiperparametrów i potoki.
  • 100algo-nlp-lda
    Wykrywa ukryte tematy w zbiorze dokumentów modelem LDA i grupuje teksty według motywów przewodnich.
  • 100scikit-learn-supervised-learning-pipelines
    Trenuje, ocenia i wdraża tabelaryczne modele klasyfikacji i regresji w scikit-learn w pełnych potokach. Przydaje się przy danych tabelarycznych i prognozach.
  • 95scikit-learn
    Wspiera uczenie maszynowe w Pythonie z scikit-learn: klasyfikacja, regresja, klastrowanie, ocena modeli i potoki ML.

Uwagi i zgłoszenia

Wiadomość trafi do Bartosza Sokolińskiego. Adres e-mail jest potrzebny tylko do odpowiedzi. Szczegóły w polityce prywatności.