razdel

0

Описание

Rule-based token, sentence segmentation for Russian language

Языки

  • Python99,9%
  • Makefile0,1%
3 года назад
7 лет назад
3 года назад
7 лет назад
6 лет назад
3 года назад
3 года назад
3 года назад
6 лет назад
README.md

CI

razdel
— rule-based system for Russian sentence and word tokenization.

Usage

Installation

razdel
supports Python 3.7+ and PyPy 3.

Documentation

Materials are in Russian:

Evaluation

Unfortunately, there is no single correct way to split text into sentences and tokens. For example, one may split

«Как же так?! Захар...» — воскликнут Пронин.
into three sentences
["«Как же так?!", "Захар...»", "— воскликнут Пронин."]
while
razdel
splits it into two
["«Как же так?!", "Захар...» — воскликнут Пронин."]
. What would be the correct way to tokenizer
т.е.
? One may split in into
т.|е.
,
razdel
splits into
т|.|е|.
.

razdel
tries to mimic segmentation of these 4 datasets: SynTagRus, OpenCorpora, GICRYA and RNC. These datasets mainly consist of news and fiction.
razdel
rules are optimized for these kinds of texts. Library may perform worse on other domains like social media, scientific articles, legal documents.

We measure absolute number of errors. There are a lot of trivial cases in the tokenization task. For example, text

чуть-чуть?!
is not non-trivial, one may split it into
чуть|-|чуть|?|!
while the correct tokenization is
чуть-чуть|?!
, such examples are rare. Vast majority of cases are trivial, for example text
в 5 часов ...
is correctly tokenized even via Python native
str.split
into
в| |5| |часов| |...
. Due to the large number of trivial case overall quality of all segmenators is high, it is hard to compare differentiate between for examlpe 99.33%, 99.95% and 99.88%, so we report the absolute number of errors.

errors
— number of errors per 1000 tokens/sentencies. For example, consider etalon segmentation is
что-то|?
, prediction is
что|-|то?
, then the number of errors is 3: 1 for missing split
то?
+ 2 for extra splits
что|-|то
.

time
— seconds taken to process whole dataset.

spacy_tokenize
,
aatimofeev
and others a defined in naeval/segment/models.py, for links to models see Naeval registry. Tables are computed in naeval/segment/main.ipynb.

Tokens

corporasyntaggicryarnc
errorstimeerrorstimeerrorstimeerrorstime
re.findall(\w+|\d+|\p+)240.5160.5190.4600.4
spacy266.2135.8144.1323.9
nltk.word_tokenize603.42563.3752.71992.9
mystem235.0154.7193.7143.9
mosestokenizer112.181.9151.6161.7
segtok.word_tokenize162.382.3141.891.8
aatimofeev/spacy_russian_tokenizer1748.7451.1539.52052.2
koziev/rutokenizer151.181.0230.8680.9
razdel.tokenize92.992.832.0162.2

Sentences

corporasyntaggicryarnc
errorstimeerrorstimeerrorstimeerrorstime
re.split([.?!…])1140.9530.6630.71301.0
segtok.split_single10617.83613.410011.19122.8
mosestokenizer2388.91825.7806.42877.4
nltk.sent_tokenize9210.1365.3445.61838.9
deeppavlov/rusenttokenize5710.9107.9566.81197.0
razdel.sentenize526.173.9724.5597.5

Support

Development

Dev env

Test

Release

mystem
errors on
syntag

Non-trivial token tests

Update integration tests

razdel
and
moses
diff

razdel
performance