Skip to main content

AistrighNLP



MIT License Release

AistrighNLP is a collection of tools and models used for Aistrigh, the BT Young Scientist 2021 project. Our aim is to bring Irish into the modern era with NLP tools to give it parity with English. The tools included are based around the work in Neural Models for Predicting Celtic Mutations (Scannell, 2020). Included is all the tools needed to create a demutated Irish corpus, which can be used in all sorts of NLP tasks, and a model to reinsert them. For the Python API docs visit AistrighNLP Python API

Installing the Package

AistrighNLP can be downloaded using pip

pip install aistrigh-nlp

Lowercasing

When lowercasing either Irish or Scots Gaelic for prediciting mutations, you must be aware of special cases outlined in the paper above. Our lowercaser handles that

aistrigh-nlp lowercase -i input.txt -o output.txt

Removing mutations

To remove mutations from an entire dataset for use for NLP tasks (like Machine Translation) use demutate-corpus. -l/--lang must take ISO 639 language codes like 'ga'.

aistrigh-nlp demutate-corpus -i input.txt -o output.txt -l ga

To remove mutations with a 'window' on either side to train a neural network, use demutate-window, with -w set to your desired window length on each side

aistrigh-nlp demutate-window -i input.txt -o output.csv -l ga -w 16

Predicting the mutations

To predict mutations on each word, use predict-mutations. As of right now, it's only compatible with PyTorch+Torchtext models but we are working on expanding to TensorFlow and Keras. You'll need your vocab, labels and model checkpoint in the same folder (-d/--data). We provide default models to be used here.

aistrigh-nlp predict-mutations -i input.txt -o output.txt -w 16 -d nn_100k

Applying the predicted mutations

To apply the mutations predicted by predict-mutations, use apply-mutations.

aistrigh-nlp apply-mutations -i input.txt -o output.txt -l ga

Scoring Celtic NMT models using Standard and Demutated BLEU

To score NMT models using both these metrics run;

aistrigh-nlp bleu -r reference.txt -p predictions.txt -l ga

If you're scoring a demutated NMT model and haven't reapplied mutations, pass your demutated reference (-d) and predictions, and the original reference (-r).

aistrigh-nlp bleu -d demutated_reference.txt -r reference.txt -p predictions.txt -l ga

NOTE

AistrighNLP uses PyTorch Traces to save the full computational graphs as checkpoints. This way, the model architecture need not be declared into hard-coded scripts. See this StackOverflow Thread for instructions to save a traced checkpoint.

Metadata

Release files for aistrigh-nlp 0.2.0

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

Source distribution (sdist)

Source distribution for aistrigh-nlp 0.2.0
File Size Uploaded
aistrigh-nlp-0.2.0.tar.gz 11.5 kB Details

Release files / aistrigh-nlp-0.2.0.tar.gz

Download URL aistrigh-nlp-0.2.0.tar.gz
Size 11.5 kB
Tags Source
SHA-256 checksum
How to use checksums
cf8705b4178542b295abecaa8aebcdab77f3951a5656e97a0de1dda155ff3950
BLAKE2b-256 checksum
How to use checksums
6f09b317e6cbec85cc5f01c2b0b146004c3ebe7e12f1432a2a91262a84277023
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.3.0 pkginfo/1.6.1 requests/2.25.1 setuptools/51.1.1 requests-toolbelt/0.9.1 tqdm/4.55.0 CPython/3.8.2

Release history Release notifications | RSS feed

This release

0.2.0 This release

1 release file

0.1.0

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