README.rst 4.86 KB
Newer Older
1 2
Vallex Tools
============
3

4
| A Python interface to various valency lexicon data.
Jonathan L. Verner's avatar
Jonathan L. Verner committed
5 6 7 8 9 10
| https://verner.gitlab.io/pyvallex/

.. code-block:: bash

    pip install vallex-tools

11 12 13

Features
--------
Jonathan L. Verner's avatar
Jonathan L. Verner committed
14
- `MIT <https://en.wikipedia.org/wiki/MIT_License>`_ licensed
15 16 17
- 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
Jonathan L. Verner's avatar
Jonathan L. Verner committed
18 19
- Qt(WebEngine) based ui (searching, simple editing)
- web based interface (searching)
20 21 22 23 24 25

Example Use
-----------

.. code-block:: python

26
    from vallex import LexiconCollection, add_file_to_collection
27 28 29 30
    from vallex.grep import parse_pattern, filter_db


    # Create a collection of lexicons
31
    coll = LexiconCollection()
32 33

    # Load a lexicon and add it to the collections
34
    add_file_to_collection(coll, open('v-vallex.txt', 'r', encoding='utf-8'))
35 36


37
    # Filter the collection looking for lexical units which have ACT in their frame
38
    pat = parse_pattern('frame.functor=ACT')
39
    coll = filter_db(coll, pat)
40 41 42 43


    # Print out the frame attribute of each lexical unit in the filtered
    # collection
44
    for lu in coll.lexical_units:
45 46 47 48 49 50
        print(lu.frame)

It also includes a cli interface:

.. code-block:: bash

51
    $ vallex-cli -i v-vallex.txt --filter frame,lemma,refl -- grep frame.functor=ACT
52 53 54 55 56 57 58 59 60 61

      ...

    * Ž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

62
    $ vallex-cli -i v-vallex.json --histogram frame.functor -- grep frame.functor=ACT
63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81

      ...

    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)


82 83
Installing the command-line tools
---------------------------------
84

85 86
Unix
####
87

88
We suggest using the `pipx <https://pipxproject.github.io/pipx/>`_ or `pipsi <https://github.com/mitsuhiko/pipsi>`_ script installers:
89 90 91

.. code-block:: bash

92 93 94
    $ python3 -m pip install --user pipx
    $ python3 -m pipx ensurepath
    $ pipx install vallex-tools
95

96

97
Alternatively, just create a Python3 virtualenv and run vallex-tools from there:
98 99 100

.. code-block:: bash

101 102 103
    $ python3 -m virtualenv -p `which python3` venv
    $ . venv/bin/activate
    (venv) $ pip install vallex-tools
104

105 106
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`:
107 108 109

.. code-block:: bash

110
    eval $(pipx run vallex-cli completion)
111

112 113
(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).
114

115 116
Windows
#######
117

118 119 120 121 122 123
Run the `install-win.ps1 <https://verner.gitlab.io/pyvallex/_static/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.
124

125 126 127
Contributing and Development
----------------------------

128
Please use the `GitLab issue tracker <https://gitlab.com/Verner/pyvallex/-/issues>`_ to submit bugs or request features.
129

Jonathan L. Verner's avatar
Jonathan L. Verner committed
130 131
Please see `Developer documentation <https://verner.gitlab.io/pyvallex/development.html>`_
for documentation describing how to set-up your environment for working on vallex-tools.
132 133
Please see `Production documentation <https://verner.gitlab.io/pyvallex/production.html>`_ for information regarding setting up a web-server to run `PyVallex` as a webservice.
There is also a `REST API <https://verner.gitlab.io/pyvallex/restapi.html>`_.
134 135 136 137

Changelog
---------

Anna Vernerová's avatar
Anna Vernerová committed
138
Consult the `Changelog <https://gitlab.com/Verner/pyvallex/-/blob/master/CHANGELOG.rst>`_ page for fixes and enhancements of each version.
139 140


Jonathan L. Verner's avatar
Jonathan L. Verner committed
141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156
.. Obtaining Lexicon Data
.. ----------------------
..
..
.. Command Line Interface
.. ----------------------
..
..
.. Web Interface
.. -------------
..
..
.. Data Validation Tests
.. ---------------------
..
..
157