Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

A command-line sound change applier written in Python.

License

NotificationsYou must be signed in to change notification settings

erickcan/sound-change-applier

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

35 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

A command-line sound change applier written in Python.

Setup

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-options

You 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

Command line

sca (-f rules-file words-file | -n named-rules-json named-rule words)    [--csv-output] [-s sound-classes-json | --no-sound-classes]

Usage

  • --file-based-sound-change |-f to 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 rules
    • words-file: text file with the words
  • --named-sound-change |-n to 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 defined
    • named-rule: name of the rule to apply (defined innamed-rules-json)
    • words: words to apply the sound change
  • --csv-output to create a before and after of the changed words;
  • --sound-classes-file |-s to specify the JSON file where the sound classes are defined (see alsoDefault sound classes);
  • --no-sound-classes to not make use of sound classes.

Examples

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

aeonbedscluedaemonknowledgelateralsmediasandswords

If this were passed to the command line,

$ sca -f rules.txt words.txt --csv-output

the 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,sordz

And 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 allucinated

Rule notation

The rules can be written in any of the following forms:

x  > y / a_bx -> y / a_bx => y / a_b

wherex becomesy whenx is betweena andb. (Spaces between>,->,=> and/ are insignificant.)

Symbols

symbolmeaningexample
#word boundary_#: end of word,#_: start of word
A..Zsound classGt: classG followed byt
[xyz]ad-hoc classu[rl]:u followed byr orl
> _sound-eraserh -> _: deletesh
_everywhere, when_x: when followed byx,_: everywhere
!_not preceded byu!_: when not preceded byu
_!not followed by_!n: when not followed byn

Appendix

Default sound classes

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

Stars

Watchers

Forks

Languages


[8]ページ先頭

©2009-2025 Movatter.jp