Skip to main content

This repository contains scripts and expriments related to the Sense frequencies project, and an rlwsd python package for WSD (word sense disambiguation) for Russian language.

rlwsd package

This package can perform WSD for Russian nouns described in the of Active Dictionary of Russian (currently, only the first volume is published with letters “А” - “Г”).

Installation

The package currently works only on CPython 3.4+. Install with pip:

pip3 install rlwsd

The package requires models that are not hosted on PyPI and most be downloaded separately (about 2.3 Gb total):

python3 -m rlwsd.download

Models are re-downloaded even if they are already present. In case of problems (download does not finish, etc.) you can download models manually from rlwsd.download.MODELS_URL and extract them into the models folder inside rlwsd (package) folder.

Usage

Most functionality is provided by the model class. Model for each word must be loaded separately:

>>> import rlwsd
>>> model = rlwsd.SphericalModel.load('альбом')
>>> model.senses
{'1': {'meaning': 'Вещь в виде большой тетради ...',
       'name': 'альбом 1'},
 '2': {'meaning': 'Книга тематически связанных изобразительных материалов ...',
       'name': 'альбом 2.1'},
 '3': {'meaning': 'Собрание музыкальных произведений ...',
       'name': 'альбом 2.2'}}
>>> model.disambiguate('она задумчиво листала', 'альбом', 'с фотографиями')
'2'

You can also get a list of all words with models:

>>> import rlwsd
>>> rlwsd.list_words()
['абрикос',
 'абсурд',
 'авангард',
 ...
 'гусь',
 'гуща']

A large word2vec model is used internally. By default it is loaded once, one the first call to .disambiguate method, which takes noticeable time. There is an option to load word2vec model in a separate process by running w2v-server command, which starts a server, and exporting W2VSRV environment variable with any non-empty value:

# in the first terminal window
$ w2v-server
running...
# in the second terminal window
$ export W2VSRV=yes
$ python

In this way you can leave the w2v-server running and save time on word2vec model reloads.

License

License is MIT

Release files for rlwsd 0.1.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for rlwsd 0.1.2
File Size Uploaded
rlwsd-0.1.2.tar.gz 11.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for rlwsd 0.1.2
File Interpreter ABI Platform
rlwsd-0.1.2-py2.py3-none-any.whl Python 2, Python 3 none any Details

Total release size: 24.0 kB

Release files / rlwsd-0.1.2.tar.gz

Download URL rlwsd-0.1.2.tar.gz
Size 11.0 kB
Tags Source
SHA-256 checksum
How to use checksums
76eac557e678aa61acf43de84d88f0223c297ae6dbffedeb8c624fe4f121aa32
BLAKE2b-256 checksum
How to use checksums
22d9c91f751c475507d8cbb0061ad405af972cfe6205e03964693b1718e2e427
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / rlwsd-0.1.2-py2.py3-none-any.whl

Download URL rlwsd-0.1.2-py2.py3-none-any.whl
Size 13.1 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
2e7687f14b75874da5b7c5241ef80e55aee1c1e9d68c78bcd362c61bcbfec8fb
BLAKE2b-256 checksum
How to use checksums
cee1c328e11f3849ab66141d5758451ad8ca00db080fa055cbb597e02d6d1797
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

This release

0.1.2 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page