Skip to content
Projets

skupriienko/ukrainian-stopwords

Voir sur GitHub

À propos

Curated, categorized Ukrainian stopwords dictionary and zero-dependency Python package for NLP and data cleaning

IA et apprentissage automatique

Comment ces chiffres sont mesurés

What you can do

  • Clean & Categorized Source of Truth (data/categories/*.txt): Every entry lives in a single part-of-speech or functional file—no content nouns, proper names, or polarity-bearing adjectives that silently break classification or sentiment analysis.
  • core (1,428 unigrams) — Strict grammatical stopwords (prepositions, conjunctions, particles, negations, pronouns, auxiliary/modal verbs, deictic & discourse adverbs). Recommended for Sentiment Analysis, Text Classification, and RAG.
  • extended (1,701 unigrams) — core plus spelled-out numerals, common abbreviations/single letters, interjections, and corpus boilerplate. Recommended for Topic Modeling, Word Clouds, and Keyword Extraction.
  • phrases (105 multi-word expressions) — Compound prepositions and discourse expressions (на відміну від, у зв'язку з, до речі, etc.) stored separately so unigram tokenizers don't miss them.

Progression mesurée des étoiles

in 24h
0
in 7 days
0
in 15 days
0
in 1 month
Historique en cours

Variations nettes sur des périodes qui se chevauchent, pas des totaux quotidiens. Les mesures absentes restent vides. Les étoiles indiquent l’intérêt, pas la qualité.

README.md

Original

Ukrainian-Stopwords

CI Code License: MIT Data License: CC BY-SA 4.0 Python 3.10+

stopwords.png

A curated, linguistically categorized Ukrainian stopwords dictionary and zero-dependency Python package for NLP, text cleaning, search, and analytics.

Key Features (v2.0)

  • Clean & Categorized Source of Truth (data/categories/*.txt): Every entry lives in a single part-of-speech or functional file—no content nouns, proper names, or polarity-bearing adjectives that silently break classification or sentiment analysis.
  • Two Tiers + Multi-Word Phrases:
    • core (1,428 unigrams) — Strict grammatical stopwords (prepositions, conjunctions, particles, negations, pronouns, auxiliary/modal verbs, deictic & discourse adverbs). Recommended for Sentiment Analysis, Text Classification, and RAG.
    • extended (1,701 unigrams) — core plus spelled-out numerals, common abbreviations/single letters, interjections, and corpus boilerplate. Recommended for Topic Modeling, Word Clouds, and Keyword Extraction.
    • phrases (105 multi-word expressions) — Compound prepositions and discourse expressions (на відміну від, у зв'язку з, до речі, etc.) stored separately so unigram tokenizers don't miss them.
  • Apostrophe-Safe by Default: Ukrainian texts mix ASCII ', typographic ’, and modifier ʼ. get_stopwords() automatically expands all three variants (apostrophe="all"), and tokenize_ukrainian() preserves internal apostrophes and hyphens (з-під, дев’ять).
  • Sentiment-Safe Negation Toggle: Pass keep_negations=True to preserve не, ні, ані, нема, and немає.

Repository Layout

Path Description Format
data/categories/*.txt Modular source-of-truth word lists (11 unigram categories + multi-word phrases) UTF-8, sorted
data/stopwords_core.txt Strict grammatical stopwords (1,428 words) Newline-delimited UTF-8
data/stopwords_extended.txt Full unigram stopwords (1,701 words) Newline-delimited UTF-8
data/phrases_ua.txt Multi-word stop phrases (105 phrases) Newline-delimited UTF-8
data/stopwords_ua.json Machine-readable JSON with categories, tiers, and counts JSON (UTF-8)
src/ukrainian_stopwords/ Zero-dependency Python package (pip install) Python 3.10+
stopwords_ua.txt Legacy root unigram list (mirrors data/stopwords_extended.txt) Newline-delimited UTF-8
stopwords_ua_list.txt Legacy: Python list literal string Text (repr)
stopwords_ua_set.txt Legacy: Python set literal string Text (repr)

Installation & Quickstart

Install the Python Package

pip install "git+https://github.com/skupriienko/Ukrainian-Stopwords.git"

Or clone locally in editable mode:

git clone https://github.com/skupriienko/Ukrainian-Stopwords.git
cd Ukrainian-Stopwords
pip install -e .

Python API

from ukrainian_stopwords import get_stopwords, remove_stopwords, tokenize_ukrainian

text = "Це не поганий результат, але з-під землі дістали дев’ять старих монет."
tokens = tokenize_ukrainian(text)

# Topic modeling / general cleaning (handles ', ’, and ʼ automatically)
clean_tokens = remove_stopwords(tokens, tier="extended")

# Sentiment analysis (strict grammatical words only, keeps 'не', 'ні', 'ані', 'нема', 'немає')
sentiment_tokens = remove_stopwords(tokens, tier="core", keep_negations=True)

# Custom category subset
sw = get_stopwords(categories=["prepositions", "conjunctions", "particles"])

Without Installing (Raw Files / pandas)

from pathlib import Path
import pandas as pd

stopwords_ua = frozenset(Path("stopwords_ua.txt").read_text(encoding="utf-8").splitlines())
# Or fetch directly:
# https://raw.githubusercontent.com/skupriienko/Ukrainian-Stopwords/master/data/stopwords_core.txt

scikit-learn (TfidfVectorizer / CountVectorizer)

from sklearn.feature_extraction.text import TfidfVectorizer
from ukrainian_stopwords import get_stopwords, tokenize_ukrainian

vectorizer = TfidfVectorizer(
    tokenizer=tokenize_ukrainian,
    token_pattern=None,
    stop_words=sorted(get_stopwords("extended")),
)

spaCy (uk_core_news_sm)

import spacy
from ukrainian_stopwords import get_stopwords

nlp = spacy.load("uk_core_news_sm")
for word in get_stopwords("core", keep_negations=True):
    nlp.Defaults.stop_words.add(word)
    nlp.vocab[word].is_stop = True

Dictionary Categories

Category Tier Count Examples
negations core 5 ані, не, нема, немає, ні
prepositions core 179 в, на, з-під, всупереч, стосовно
conjunctions core 65 а, і, але, проте, оскільки, щоб
particles core 67 б, ж, ось, хіба, невже, навіть
pronouns core 876 я, він, цей, той, хтось, весь, жоден
aux_verbs core 41 є, бути, буде, можна, треба, варто
adverbs_discourse core 195 вже, дуже, зокрема, наприклад, відтак
numerals extended 122 нуль, один, два, п'ять, тридцять, перша
abbreviations_letters extended 34 рр, тис, млн, грн, напр, ст, вул
interjections extended 81 ой, йой, ага, угу, хм, тсс
boilerplate extended 36 рік, час, відсотків, сказав, дякую
phrases_multiword phrases 105 на відміну від, у зв'язку з, до речі

Contributing

All generated datasets (data/*.txt, data/stopwords_ua.json, and root legacy files) are built deterministically from data/categories/*.txt.

  1. Edit the appropriate file under data/categories/ (lowercase, UTF-8, NFC-normalized, ASCII apostrophe ').
  2. Regenerate distribution files and run the full check suite:
pip install -e ".[dev]"
python scripts/build_datasets.py
python scripts/build_datasets.py --check
ruff check .
pyright
pytest -v

License

This repository is licensed separately for code and dictionary data:

Explorer des projets similaires

Chargement…