Phoner is a CLI tool and library to validate phonotactic patterns for constructed languages. It is compatible with either romanization and phonetic transcription.
Syntax Highlighting Extension for VSCode
This program is still in development, and is subject to change.
This project can be used as a rust library, or as a binary.
``` $ phoner --help
Usage: phoner.exe [OPTIONS] [TESTS]
Options:
-t, --tests
-f, --file
Eg. `phoner -f ./myfile.phoner`
[default: phoner]
-d, --display-level
Options can be single letter
Eg. `phoner -d just-fails` or `phoner -df`
[default: show-all]
Possible values:
- show-all: Show everything (passes, notes, fails)
- notes-and-fails: Show most (notes, fails), but not passes
- just-fails: Show only fails, not passes or notes
- hide-all: Show nothing: not passes, notes, or fails
-m, --minify [
Possible values:
- tests: Include tests
-h, --help
Print help information (use -h
for a summary)
```
```bash
phoner
phoner -t some,words
phoner -f myfile.phoner
phoner -df
phoner -d just-fails phoner -d fails
phoner -m
phoner -f myfile.phoner -dh -mt ```
Replace <path_to_file>
with the directory of the downloaded binary.
Add alias in .bashrc
in user directory
```bash
alias phoner="
Add to $env:PATH
ps1
$env:Path = "$env:Path;<path_to_file>\phoner.exe"
Add phoner = "0.5.3"
to your Crates.toml
file
```rs use phoner::prelude::*; use std::fs;
fn main() { let file = fs::readtostring("phoner").unwrap();
// Parse file let scheme = Phoner::parse(&file).expect("Failed to parse");
// Run tests let results = PhonerResults::run(scheme);
// Display results results.display(DisplayLevel::ShowAll); } ```
A phoner
file is used to define the rules, classes, and tests for the program.
Syntax Highlighting Extension for VSCode
The syntax is a statements, each separated by a semicolon ;
or a linebreak.
All whitespace is ignored, except to separate words in tests.
Each statement must begin with an operator:
#
Hashtag: A whole line comment. A semicolon ends the comment$
Dollar: Define a class+
Plus or !
Bang: Define a rule@
Commat: Define a reason if a test fails?
Question: Create a test*
Star: Create a test noteClasses are used as shorthand Regular Expressions, substituted into rules at runtime.
Syntax:
$
Dollar=
Equals<>
(as with rules)Example:
```phoner
$C = [ptksmn]
$V = [iueoa]
$C_s = [sz] ```
Rules are Regular Expressions used to test if a word is valid.
Rules are defined with an intent, either +
for positive, or !
for negative.
To use a class, use the class name, surrounded by angle brackets <>
.
Syntax:
+
Plus or !
Bang - Plus for positive rule, Bang for negative rule<>
Example (with predefined classes):
```phoner
!
Tests are checked against all rules, and the result is displayed in the output.
Tests are ran in the order of definition.
Like rules, tests must have a defined intent, either +
for positive, or !
for negative.
Syntax:
?
Question mark+
Plus or !
Bang - Plus for positive test, Bang for negative testExample (with predefined rules):
```phoner
?+ taso
?! tax
?+ taso sato tasa ```
Reasons are used before rules as an explanation if a test fails.
Syntax:
@
Commat*
Star - Use as a note as wellExample:
```phoner
@ Syllable structure
+ ^ (
?+ tasto
@* Must not have two vowels in a row
!
?+ taso ```
Notes are printed to the terminal output, alongside tests.
They can be used to separate tests into sections, however this is only cosmetic.
Syntax:
*
StarExample (with predefined rules):
```phoner * Should match ?+ taso
See the examples folder for phoner
file examples.
/<.*>/
in stringclone
s where possible