Crate stop_words

source ·
Expand description

Github CI Crates.io docs.rs

About

Stop words are words that don’t carry much meaning, and are typically removed as a preprocessing step before text analysis or natural language processing. This crate contains common stop words for a variety of languages. This crate uses stop word lists from Stopwords ISO and also from NLTK.

Usage

Using this crate is fairly straight-forward:

// Get the stop words
let words = stop_words::get(stop_words::LANGUAGE::English);

// Print them
for word in words {
    println!("{}", word);
}

The function get will take either a member of the LANGUAGE enum or a two-letter ISO language code as either a str or a String type.

You can find a complete example of how to read in a text file and remove stop words here.

ISO Language Availability

This crate supports all languages from Stopwords ISO and also from NLTK. Expand the table below to see a comprehensive description.

Language Coverage Table
ISO 639-1 CodeLanguageStopwords ISONLTK
aaAfar
abAbkhazian
afAfrikaans
akAkan
sqAlbanian
amAmharic
arArabic
anAragonese
hyArmenian
asAssamese
avAvaric
aeAvestan
ayAymara
azAzerbaijani
baBashkir
bmBambara
euBasque
beBelarusian
bnBengali
bhBihari languages
biBislama
boTibetan
bsBosnian
brBreton
bgBulgarian
myBurmese
caCatalan; Valencian
csCzech
chChamorro
ceChechen
zhChinese
cuChurch Slavic; Old Slavonic; Church Slavonic; Old Bulgarian; Old Church Slavonic
cvChuvash
kwCornish
coCorsican
crCree
cyWelsh
daDanish
deGerman
dvDivehi; Dhivehi; Maldivian
nlDutch; Flemish
dzDzongkha
elGreek, Modern (1453-)
enEnglish
eoEsperanto
etEstonian
eeEwe
foFaroese
faPersian
fjFijian
fiFinnish
frFrench
fyWestern Frisian
ffFulah
kaGeorgian
gdGaelic; Scottish Gaelic
gaIrish
glGalician
gvManx
gnGuarani
guGujarati
htHaitian; Haitian Creole
haHausa
heHebrew
hzHerero
hiHindi
hoHiri Motu
hrCroatian
huHungarian
igIgbo
isIcelandic
ioIdo
iiSichuan Yi; Nuosu
iuInuktitut
ieInterlingue; Occidental
iaInterlingua (International Auxiliary Language Association)
idIndonesian
ikInupiaq
itItalian
jvJavanese
jaJapanese
klKalaallisut; Greenlandic
knKannada
ksKashmiri
krKanuri
kkKazakh
kmCentral Khmer
kiKikuyu; Gikuyu
rwKinyarwanda
kyKirghiz; Kyrgyz
kvKomi
kgKongo
koKorean
kjKuanyama; Kwanyama
kuKurdish
loLao
laLatin
lvLatvian
liLimburgan; Limburger; Limburgish
lnLingala
ltLithuanian
lbLuxembourgish; Letzeburgesch
luLuba-Katanga
lgGanda
mkMacedonian
mhMarshallese
mlMalayalam
miMaori
mrMarathi
msMalay
mgMalagasy
mtMaltese
mnMongolian
naNauru
nvNavajo; Navaho
nrNdebele, South; South Ndebele
ndNdebele, North; North Ndebele
ngNdonga
neNepali
nnNorwegian Nynorsk; Nynorsk, Norwegian
nbBokmål, Norwegian; Norwegian Bokmål
noNorwegian
nyChichewa; Chewa; Nyanja
ocOccitan (post 1500)
ojOjibwa
orOriya
omOromo
osOssetian; Ossetic
paPanjabi; Punjabi
piPali
plPolish
ptPortuguese
psPushto; Pashto
quQuechua
rmRomansh
roRomanian; Moldavian; Moldovan
rnRundi
ruRussian
sgSango
saSanskrit
siSinhala; Sinhalese
skSlovak
slSlovenian
seNorthern Sami
smSamoan
snShona
sdSindhi
soSomali
stSotho, Southern
esSpanish; Castilian
scSardinian
srSerbian
ssSwati
suSundanese
swSwahili
svSwedish
tyTahitian
taTamil
ttTatar
teTelugu
tgTajik
tlTagalog
thThai
tiTigrinya
toTonga (Tonga Islands)
tnTswana
tsTsonga
tkTurkmen
trTurkish
twTwi
ugUighur; Uyghur
ukUkrainian
urUrdu
uzUzbek
veVenda
viVietnamese
voVolapük
waWalloon
woWolof
xhXhosa
yiYiddish
yoYoruba
zaZhuang; Chuang
zuZulu

Constructed Language Availability

We also support some constructed (fictional/fantasy) languages! Expand the table below to see a comprehensive description. ChatGPT was used to generate these lists quickly, so they are incomplete and approximate. Help welcome! To use these languages, add the constructed feature.

Language Coverage Table
ISO 639-3 CodeLanguage
qyaQuenya
sjnSindarin
tlhKlingon
mis (dot is used here)Dothraki
mis (dov is used here)Dovahzul
mis (nav is used here)Navi
mis (val is used here)High Valyrian

The following prompt was used with the Mar 14, 2023 version of ChatGPT:

Please give me one list of 20 stop words for each of the following languages: Sindarin, Quenya, DOthraki, Na'vi, 
Dovahzul, Klingon, and High Valyrian. I'd like the lists to be formatted as follows:
Sindarin
1. [word goes here]
2. [word goes here]
...
20. [word goes here]
Quenya
1. [word goes here]
...

And so on

Enums

  • Enum containing available language names

Functions

  • This function fetches stop words for a language using either a member of the LANGUAGE enum, or a two-character ISO language code as either a str or a String type. Please note that constructed languages use either a member of the LANGUAGE enum, or a three-character ISO language code as either a str or a String type