- Notifications
You must be signed in to change notification settings - Fork1
A command-line sound change applier written in Python.
License
erickcan/sound-change-applier
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
A command-line sound change applier written in Python.
To begin using this sound change applier, you just need to download the executable (.exe) file in theReleases page and use it through the command-line prompt:
$ sca sca-optionsYou can also clone this repo and use thesca.bat orsca.sh file:
$ git clone https://github.com/erickcan/sound-change-applier.git$ sca sca-options# if Windows$ ./sca.sh sca-options# if Linux
sca (-f rules-file words-file | -n named-rules-json named-rule words) [--csv-output] [-s sound-classes-json | --no-sound-classes]--file-based-sound-change|-fto apply a set of rules to a set of words, each defined in a separate file, creating a text file with the changed words;rules-file: text file with the ruleswords-file: text file with the words
--named-sound-change|-nto apply a named sound change to words passed on the command line, and then prints the words after the change;named-rules-json: JSON file where sound classes are definednamed-rule: name of the rule to apply (defined innamed-rules-json)words: words to apply the sound change
--csv-outputto create a before and after of the changed words;--sound-classes-file|-sto specify the JSON file where the sound classes are defined (see alsoDefault sound classes);--no-sound-classesto not make use of sound classes.
Suppose the following files:
named_rules.json
{"terminal-devoicing":"[bdgz] > [ptks] / _#","h-dropping":"h -> _ / _","z-rhotacization":"z -> r / V_V","l-vocalization":"l => w / _!V","/æ/-raising":"æ => eə / _N","th-fronting":"[θð] -> [fv] / _"}rules.txt
d => ð / V_V[gk] > _ / #_na -> ə / _#l -> w / _!V[aou]e > [æøy] / _sw > s / _[ou][ao]N -> [ãõ] / _s => z / [bdg]_e -> _ / CC_#words.txt
aeonbedscluedaemonknowledgelateralsmediasandswordsIf this were passed to the command line,
$ sca -f rules.txt words.txt --csv-outputthe following file would be created:
sound-change-YYYY-MM-DD-HH-MM-SS.csv
aeon,æõbeds,bedzclue,clydaemon,dæmõknowledge,nowledglaterals,laterawsmedia,meðiəsand,sãdswords,sordzAnd if the following were passed into the command line,
$ sca -n named_rules.json h-dropping "here he had hallucinated"it would print:
ere e ad allucinatedThe rules can be written in any of the following forms:
x > y / a_bx -> y / a_bx => y / a_bwherex becomesy whenx is betweena andb. (Spaces between>,->,=> and/ are insignificant.)
| symbol | meaning | example |
|---|---|---|
# | word boundary | _#: end of word,#_: start of word |
A..Z | sound class | Gt: classG followed byt |
[xyz] | ad-hoc class | u[rl]:u followed byr orl |
> _ | sound-eraser | h -> _: deletesh |
_ | everywhere, when | _x: when followed byx,_: everywhere |
!_ | not preceded by | u!_: when not preceded byu |
_! | not followed by | _!n: when not followed byn |
If neither--sound-classes-file nor--no-sound-classes are used, the following sound classes are used:
{"V":"aeiou","C":"bcdfghjklmnpqrstvwxyz","P":"pbtdkg","F":"fvsz","N":"mn","S":"sz"}About
A command-line sound change applier written in Python.
Topics
Resources
License
Uh oh!
There was an error while loading.Please reload this page.