Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/eddieantonio/fsttest

Test your Foma FSTs!
https://github.com/eddieantonio/fsttest

finite-state-transducer foma foma-fsts fst fsts testing unit-testing

Last synced: 25 days ago
JSON representation

Test your Foma FSTs!

Awesome Lists containing this project

README

        

fsttest
=======

[![Build Status](https://travis-ci.org/eddieantonio/fsttest.svg?branch=development)](https://travis-ci.org/eddieantonio/fsttest)
[![codecov](https://codecov.io/gh/eddieantonio/fsttest/branch/development/graph/badge.svg)](https://codecov.io/gh/eddieantonio/fsttest)

Test your Foma FSTs!

Install
-------

For macOS users with [Homebrew](https://brew.sh/):

$ brew install eddieantonio/eddieantonio/fsttest

For everybody else:

$ pip install fsttest

Usage
-----

Write `test_*.toml` scripts in a folder called `tests/`, then run:

$ fsttest

Documentation
-------------

* [How to specify the FST under test](https://github.com/eddieantonio/fsttest/blob/development/docs/fst-under-test.md#how-to-specify-the-fst-under-test)

Tutorial
--------

In your FST project, create a folder called `tests/`:

$ mkdir tests

Within this folder create a file called `test_{something}.toml` where
`{something}` is something specific to your FST. For example,
`test_phonology.toml`:

$ touch tests/test_phonology.toml

Use the following template to create your test:

```toml
# tests/test_phonology.toml
[fst]
eval = "rewrite_rules.xfscript"
compose = ["TInsertion", "NiTDeletion", "Cleanup"]

[[tests]]
upper = "ni t || [n i | k i] "<" _ Vowel ;
define NiTDeletion n i "<" t -> d || _ Vowel ;
define Cleanup %< -> 0 ;
```

Yours will be different!

```toml
compose = ["TInsertion", "NiTDeletion"]
```

This line says that the **FST under test** is the result of _composing_
the `TInsertion` regex with the `NiTDeletion` regex. That is, the FST
puts its input into `TInsertion` and then passes the result to
`NiTDeletion`. The result of passing it through both FSTs is the result
we want to test.

```toml
[[tests]]
```

Next we define one or more test cases. Begin every test case with
`[[tests]]`: note the **two square brackets**!

```toml
upper = "ni