Python Multilingual Ucrel Semantic Analysis System, is a rule based token and Multi Word Expression semantic tagger. The tagger can support any semantic tagset, however the tagset we have concentrated on and released pre-configured spaCy components for is the Ucrel Semantic Analysis System (USAS).
- 📚 Usage Guides - What the package is, tutorials, how to guides, and explanations.
- 🔎 API Reference - The docstrings of the library, with minimum working examples.
- 🚀 Roadmap
PyMUSAS currently support 10 different languages with pre-configured spaCy components that can be downloaded, each language has it's own guide on how to tag text using PyMUSAS. Below we show the languages supported, if the model for that language supports Multi Word Expression (MWE) identification and tagging (all languages support token level tagging by default), and size of the model:
| Language (BCP 47 language code) | MWE Support | Size |
|---|---|---|
| Mandarin Chinese (cmn) | ✔️ | 1.28MB |
| Welsh (cy) | ✔️ | 1.09MB |
| Spanish, Castilian (es) | ✔️ | 0.20MB |
| Finnish (fi) | ❌ | 0.63MB |
| French (fr) | ❌ | 0.08MB |
| Indonesian (id) | ❌ | 0.24MB |
| Italian (it) | ✔️ | 0.50MB |
| Dutch, Flemish (nl) | ❌ | 0.15MB |
| Portuguese (pt) | ✔️ | 0.27MB |
| English (en) | ✔️ | 0.88MB |
Can be installed on all operating systems and supports Python version >= 3.10 < 3.14, to install run:
pip install pymusasIf using uv:
uv add pymusasYou can either use the dev container with your favourite editor, e.g. VSCode. Or you can create your setup locally below we demonstrate both.
In both cases they share the same tools, of which these tools are:
- uv for Python packaging and development
- node for building and serving the documentation.
- make (OPTIONAL) for automation of tasks, not strictly required but makes life easier.
A dev container uses a docker container to create the required development environment, the Dockerfile we use for this dev container can be found at ./.devcontainer/Dockerfile. To run it locally it requires docker to be installed, you can also run it in a cloud based code editor, for a list of supported editors/cloud editors see the following webpage.
To run for the first time on a local VSCode editor (a slightly more detailed and better guide on the VSCode website):
- Ensure docker is running.
- Ensure the VSCode Dev Containers extension is installed in your VSCode editor.
- Open the command pallete
CMD + SHIFT + Pand then selectDev Containers: Rebuild and Reopen in Container
You should now have everything you need to develop, uv, node, npx, yarn, make, for VSCode various extensions like Pylance, etc.
If you have any trouble see the VSCode website..
To run locally first ensure you have the following tools installted locally:
- uv for Python packaging and development. (version
0.9.6) - node using
nvmwithyarn. (version24). After installing this run the followingcd docs && corepack use yarnit install the correct version ofyarn. - make (OPTIONAL) for automation of tasks, not strictly required but makes life easier.
- Ubuntu:
apt-get install make - Mac: Xcode command line tools includes
makeelse you can use brew. - Windows: Various solutions proposed in this blog post on how to install on Windows, inclduing
Cygwin, andWindows Subsystem for Linux.
- Ubuntu:
When developing on the project you will want to install the Python package locally in editable format with all the extra requirements, this can be done like so:
uv syncThis code base uses isort, flake8 and mypy to ensure that the format of the code is consistent and contain type hints. ISort and mypy settings can be found within ./pyproject.toml and the flake8 settings can be found in ./.flake8. To run these linters:
make lintTo run the tests with code coverage (NOTE these are the code coverage tests that the Continuos Integration (CI) reports at the top of this README, the doc tests are not part of this report):
make testsTo run the doc tests, these are tests to ensure that examples within the documentation run as expected:
make doc-testsThe default or recommended Python version is shown in [.python-version](./.python-version, currently 3.12, this can be changed using the uv command:
uv python pin
# uv python pin 3.13PyMUSAS is an open-source project that has been created and funded by the University Centre for Computer Corpus Research on Language (UCREL) at Lancaster University. For more information on who has contributed to this code base see the contributions page.