A Python interface for working with vallency lexicon data.
Project description
pip install vallex-tools
Features
MIT licensed
parses lexicon data in txt and json formats
provides a cli for working with the data (searching, printing histogram, converting between txt/json, running data tests)
infrastructure to run data tests
Qt(WebEngine) based ui (searching, simple editing)
web based interface (searching)
Example Use
from vallex import LexiconCollection, add_file_to_collection
from vallex.grep import parse_pattern, filter_db
# Create a collection of lexicons
coll = LexiconCollection()
# Load a lexicon and add it to the collections
add_file_to_collection(coll, open('v-vallex.txt', 'r', encoding='utf-8'))
# Filter the collection looking for lexical units which have ACT in their frame
pat = parse_pattern('frame.functor=ACT')
coll = filter_db(coll, pat)
# Print out the frame attribute of each lexical unit in the filtered
# collection
for lu in coll.lexical_units:
print(lu.frame)
It also includes a cli interface:
$ vallex-cli -i v-vallex.txt --filter frame,lemma,refl -- grep frame.functor=ACT
...
* ŽRÁT SE
: id: blu-v-žrát-se-1
~ impf: žrát se
+ ACT(1;obl)CAUS(7,pro+4;typ)
#
# END ========== ../data-txt/v-vallex.txt ========== END
$ vallex-cli -i v-vallex.json --histogram frame.functor -- grep frame.functor=ACT
...
NTT (186/17819)
DPHR * (286/17819)
DIR1 * (286/17819)
MANN * (325/17819)
ORIG * (382/17819)
DIR ** (484/17819)
EFF *** (601/17819)
LOC *** (606/17819)
DIR3 *** (610/17819)
BEN *** (637/17819)
ADDR *** (731/17819)
MEANS **** (809/17819)
PAT ************************ (4836/17819)
ACT ******************************* (6176/17819)
Installing the command-line tools
Unix
We suggest using the pipx or pipsi script installers:
$ python3 -m pip install --user pipx
$ python3 -m pipx ensurepath
$ pipx install vallex-tools
Alternatively, just create a Python3 virtualenv and run vallex-tools from there:
$ python3 -m virtualenv -p `which python3` venv
$ . venv/bin/activate
(venv) $ pip install vallex-tools
Assuming you used pipx to install vallex-tools, you can get bash command completion for vallex-cli, by putting the following line into your .bashrc or .bash_profile:
eval $(pipx run vallex-cli completion)
(For pipsi, replace pipx with pipsi. For the virtualenv, you need to first activate the virtualenv, then run the eval with just vallex-cli instead of pipx, and then deactivate the environment again).
Windows
Run the install-win.ps1 script in a PowerShell prompt. This script will download and install a Python interpretter into C:\vallex-tools and the it will use it to install the vallex-tools package. Finally, it will put a shortcut to run the vallex-gui on the desktop. Using this method, all configuration & logs will live in the C:\vallex-tools directory. To change this directory, you can edit the script and change the definition of the $install_path variable.
Contributing
Please see Developer documentation for documentation describing how to set-up your environment for working on vallex-tools.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for vallex_tools-0.12-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | fa1623ea340749de5aeea6f1097b8a11d7a0534bfa12ce6d55444b5e84263395 |
|
MD5 | 305d035a00f10d86dcabc4f26ee33663 |
|
BLAKE2b-256 | c439c9872f7863864e4ceb8eac3d90a15ad11aafb22b77eb325cfa99fa17b1cc |