New Javascript SCA

Discussion of natural languages, or language in general.
Post Reply
zompist
Boardlord
Boardlord
Posts: 3368
Joined: Thu Sep 12, 2002 8:26 pm
Location: In the den
Contact:

New Javascript SCA

Post by zompist »

I've updated the Sound Change Applier, writing it in Javascript like the vocabulary generator.

http://www.zompist.com/sca2.html

Changes (see the help file for details):
  • Supports Unicode
  • Spaces are treated as word boundaries
  • Supports epenthesis
  • Supports metathesis
  • Nonce categories (useful if they’re just for one rule)
  • Extended category substitution, e.g. Mi/Nj/_
  • Gemination and degemination
  • A gloss can be added that isn’t changed by the rules
  • Rules can be written in the form c→g/V_V
  • Rewrite rules allow you to use digraphs, or long category names
I'm sure to have made some ghastly mistake... if you find one post it here.

User avatar
Terra
Avisaru
Avisaru
Posts: 571
Joined: Tue May 24, 2005 10:01 am

Re: New Javascript SCA

Post by Terra »

I was just coming here to tell you about an error!

The error: Words are seemingly bolded (to show that they're different from last time) at random.
To reproduce: Open up the page, check "Show differences from last run", click "apply". "leitor" is bolded. Click "apply" again. Now "filha" is bolded.

Unless I misunderstand what that option's supposed to do, I think that it's an error.

Bristel
Smeric
Smeric
Posts: 1258
Joined: Mon Jun 01, 2009 3:07 pm
Location: Miracle, Inc. Headquarters
Contact:

Re: New Javascript SCA

Post by Bristel »

It looks good, I'll have to try it out sometime. This will probably be my choice for SCA, as I'm computer illiterate and couldn't figure out the command line ones, and the GUId ones didn't really work on my laptop.
[bɹ̠ˤʷɪs.təɫ]
Nōn quālibet inīquā cupiditāte illectus hoc agō
Yo te pongo en tu lugar...
Taisc mach Daró

User avatar
Terra
Avisaru
Avisaru
Posts: 571
Joined: Tue May 24, 2005 10:01 am

Re: New Javascript SCA

Post by Terra »

It looks good, I'll have to try it out sometime. This will probably be my choice for SCA, as I'm computer illiterate and couldn't figure out the command line ones, and the GUId ones didn't really work on my laptop.
Not wanting to steal Zompist's thunder, but I made a SCA in Javascript not too long ago: http://jc.tech-galaxy.com/ling/sound_ch ... plier.html

It does nearly everything that Zompist's original SCA did. Note the subtle differences in notation.

Bristel
Smeric
Smeric
Posts: 1258
Joined: Mon Jun 01, 2009 3:07 pm
Location: Miracle, Inc. Headquarters
Contact:

Re: New Javascript SCA

Post by Bristel »

Terra wrote:
It looks good, I'll have to try it out sometime. This will probably be my choice for SCA, as I'm computer illiterate and couldn't figure out the command line ones, and the GUId ones didn't really work on my laptop.
Not wanting to steal Zompist's thunder, but I made a SCA in Javascript not too long ago: http://jc.tech-galaxy.com/ling/sound_ch ... plier.html

It does nearly everything that Zompist's original SCA did. Note the subtle differences in notation.
You should have posted in it your signature, I didn't know about it.

It looks clean and simple, I like it as well. :)
[bɹ̠ˤʷɪs.təɫ]
Nōn quālibet inīquā cupiditāte illectus hoc agō
Yo te pongo en tu lugar...
Taisc mach Daró

User avatar
dhok
Avisaru
Avisaru
Posts: 859
Joined: Wed Oct 24, 2007 7:39 pm
Location: The Eastern Establishment

Re: New Javascript SCA

Post by dhok »

Nonce categories can't contain a predefined category. It's fun to play with, though.

I've also got a problem where it's running lines together. I have an input lexicon of

proto-word
proto-word
proto-word

and it spits out a single line of
wordwordword

For reference, here's my rules:
ŋ/n/_T
ŋ/m/_P
ŋ/n/_Y
T/Č/_I
t/c/_U
ŋ/n/_#
g/ŋ/V_V
i//Č_V
u//VC_#
e/ê/_
o/ô/_
L/S/_
ai/e/_
au/o/_
ae/ê/_
Q/J/ŋ_
J/Ñ/ŋ_
E/A/_NC
E/A/_N#
N//_C
N//_#
C//_²
[aêiô]//V(C)_#
C//_²
V//_²
K/G/V_V
ü//_
and my variables:
V=aeiouāēīōūêô
C=pbtdkgmnŋszrywhčjñšžçf
I=iī
U=uū
T=tdnszh
Č=čjñšžç
P=pb
Y=rywh
L=āēīōū
S=aeiou
N=mnñŋ
Q=ptčksš
J=bdjgzž
Ñ=mnñŋnñ
E=aêeiôou
A=aâêeaôo
K=pbtdkgmnŋszrywhčjñšžçf
G=fvþðxüvnŋhüŕüüüšžñhüüü

zompist
Boardlord
Boardlord
Posts: 3368
Joined: Thu Sep 12, 2002 8:26 pm
Location: In the den
Contact:

Re: New Javascript SCA

Post by zompist »

What browser are you using? With either IE or Firefox, I get the output

prôþô-wôrd
prôþô-wôrd
prôþô-wôrd

User avatar
dhok
Avisaru
Avisaru
Posts: 859
Joined: Wed Oct 24, 2007 7:39 pm
Location: The Eastern Establishment

Re: New Javascript SCA

Post by dhok »

zompist wrote:What browser are you using? With either IE or Firefox, I get the output

prôþô-wôrd
prôþô-wôrd
prôþô-wôrd

Hmm what? Sorry, it was an example. My original input was
zaŋkoku
na
teŋsi
no

ni
siōneŋ
wa
siŋwa
ni
nare
.

Wait...huh that's funny, it works fine.

zompist
Boardlord
Boardlord
Posts: 3368
Joined: Thu Sep 12, 2002 8:26 pm
Location: In the den
Contact:

Re: New Javascript SCA

Post by zompist »

Terra wrote:The error: Words are seemingly bolded (to show that they're different from last time) at random.
To reproduce: Open up the page, check "Show differences from last run", click "apply". "leitor" is bolded. Click "apply" again. Now "filha" is bolded.
Should be fixed now, thanks!

(First thing wasn't really an error: there was no previous run, so the first line was different. But I added a check to disable the bolding on the first run. Second error had to do with those pesky rewrite rules.)

User avatar
Radius Solis
Smeric
Smeric
Posts: 1248
Joined: Tue Mar 30, 2004 5:40 pm
Location: Si'ahl
Contact:

Re: New Javascript SCA

Post by Radius Solis »

:!:
Someone has read my pleas!

I'm pretty sure this will now be my SCA of choice. Nice work!

(Looking through the documentation I don't see anything about exception conditions, though... rule exceptions can often be handled in other ways of course, but over the years I've run into a couple that really couldn't without needing a large block of complex rules just to handle the one actual sound change.)

zompist
Boardlord
Boardlord
Posts: 3368
Joined: Thu Sep 12, 2002 8:26 pm
Location: In the den
Contact:

Re: New Javascript SCA

Post by zompist »

Could you describe some of these exceptions?

User avatar
Radius Solis
Smeric
Smeric
Posts: 1248
Joined: Tue Mar 30, 2004 5:40 pm
Location: Si'ahl
Contact:

Re: New Javascript SCA

Post by Radius Solis »

They were some years ago so I don't remember most of the specifics, and it may be that the extended categorization would have been sufficient to make them more workable. But it's not hard to imagine issues... the usual workarounds for a rule exception are A) changing the target to something else temporarily under the excepted condition then changing it back after applying the rule, or B) giving only the conditions in which the rule does apply.

But B can be a terrible solution when there would be lots of unexcepted environments, because 1. sometimes the situation is complex enough you couldn't readily identify them all, and 2. if you have to list them all in separate rule lines, their successive application can make them interfere with each other's environments.

And that leaves A, which can be a minor hassle if the target is a category with lots of members and you have to come up with a bunch of unused characters to temporarily represent them all. Or a larger one if you have to preserve features like aspiration and labialization through the switcheroo that had been marked with digraphs and which you otherwise had no need to handle with rewrite rules... and if the original rules situation was already complex enough you can't even tell what members of the category currently exist at that point in the ruleset (this happens!) or you've gotten too original with your sound changes and ended up with multiple exceptions that require nested or overlapping temporary categories to exist at the same time, then we're fast approaching the point where I'd just throw up my hands and apply the damned changes manually. And all of the lack of being able to say "except CC_C". The exception can be that simple and still a headache to get to work in a rules list.

All of that being said, I don't want to overstate my case either. Bad instances have been relatively rare, and it's not that hard to apply changes manually if needed. The SCA2 looks worth its salt and I'll be using it.

User avatar
Terra
Avisaru
Avisaru
Posts: 571
Joined: Tue May 24, 2005 10:01 am

Re: New Javascript SCA

Post by Terra »

zompist wrote:
Terra wrote:The error: Words are seemingly bolded (to show that they're different from last time) at random.
To reproduce: Open up the page, check "Show differences from last run", click "apply". "leitor" is bolded. Click "apply" again. Now "filha" is bolded.
Should be fixed now, thanks!

(First thing wasn't really an error: there was no previous run, so the first line was different. But I added a check to disable the bolding on the first run. Second error had to do with those pesky rewrite rules.)
It looks fixed now.

Not really an error, but a suggestion: Add a label to the radio buttons and checkboxes so that clicking on their respective description activates/deactivates the button/box. It makes them easier to click.

User avatar
Terra
Avisaru
Avisaru
Posts: 571
Joined: Tue May 24, 2005 10:01 am

Re: New Javascript SCA

Post by Terra »

Also, the "show differences" thing gets messed up if you include blank lines in the input, because the output apparently skips them.

zompist
Boardlord
Boardlord
Posts: 3368
Joined: Thu Sep 12, 2002 8:26 pm
Location: In the den
Contact:

Re: New Javascript SCA

Post by zompist »

Radius Solis wrote:They were some years ago so I don't remember most of the specifics, and it may be that the extended categorization would have been sufficient to make them more workable. But it's not hard to imagine issues... the usual workarounds for a rule exception are A) changing the target to something else temporarily under the excepted condition then changing it back after applying the rule, or B) giving only the conditions in which the rule does apply.
OK, I understand what you're saying now. This proved to be not so difficult, so it's implemented. E.g.

k/s/_F/#C_

changes k to s in environment _F but not if #C_ also applies.

User avatar
Radius Solis
Smeric
Smeric
Posts: 1248
Joined: Tue Mar 30, 2004 5:40 pm
Location: Si'ahl
Contact:

Re: New Javascript SCA

Post by Radius Solis »

zompist wrote: OK, I understand what you're saying now. This proved to be not so difficult, so it's implemented. E.g.

k/s/_F/#C_

changes k to s in environment _F but not if #C_ also applies.
Hooray! And not a day too soon, as I've just run into one in my very first try at using the SCA, so I can give you a real example after all:

I have an epenthesis rule for Mountain Western that generates a glottal stop between a nasal vowel and any unaspirated plosive. Since there had been no way to say:

/ʔ/N_[ptk]/_Ch

I would have had to pick strategy A or B, and A is impossible because there's no initial target to preserve by changing it to something else. And I can't really think of a better way to do B than to apply the rule without the exception, then go back with another rule line and delete the new glottal stops in the excepted environment... but there's a few pre-existing glottal stops in that position too, which I want to keep, so I'd have had to use the preservation strategy for that instead. Not that this is so very hard, but the solution might not be obvious to others. :)

Cedh
Sanno
Sanno
Posts: 938
Joined: Tue Nov 14, 2006 10:30 am
Location: Tübingen, Germany
Contact:

Re: New Javascript SCA

Post by Cedh »

Radius Solis wrote:I have an epenthesis rule for Mountain Western that generates a glottal stop between a nasal vowel and any unaspirated plosive. Since there had been no way to say:

/ʔ/N_[ptk]/_Ch

I would have had to pick strategy A or B, and A is impossible because there's no initial target to preserve by changing it to something else. And I can't really think of a better way to do B than to apply the rule without the exception, then go back with another rule line and delete the new glottal stops in the excepted environment... but there's a few pre-existing glottal stops in that position too, which I want to keep, so I'd have had to use the preservation strategy for that instead. Not that this is so very hard, but the solution might not be obvious to others. :)
Another strategy, which I've been using regularly with sound change appliers, would be to explicitly mark the environment before applying the change itself:
/;/N_[ptk]
;//_[ptk]h
/ʔ/_;
;//_

Of course, being able to state the exception in a single rule is much better. :)

User avatar
Radius Solis
Smeric
Smeric
Posts: 1248
Joined: Tue Mar 30, 2004 5:40 pm
Location: Si'ahl
Contact:

Re: New Javascript SCA

Post by Radius Solis »

cedh audmanh wrote: Another strategy, which I've been using regularly with sound change appliers, would be to explicitly mark the environment before applying the change itself:
/;/N_[ptk]
;//_[ptk]h
/ʔ/_;
;//_
That's another way, yes. But the last two lines look combinable into:
;/ʔ/_
Which would need one less line than my solution did.

Cedh
Sanno
Sanno
Posts: 938
Joined: Tue Nov 14, 2006 10:30 am
Location: Tübingen, Germany
Contact:

Re: New Javascript SCA

Post by Cedh »

Radius Solis wrote:the last two lines look combinable into:
;/ʔ/_
In this case, yes, but for some other types of sound changes it's better to remove ; separately so I've become accustomed to always writing it that way.

Rin
Sanci
Sanci
Posts: 25
Joined: Tue Mar 13, 2012 10:21 pm
Location: 福井県若狭町

Re: New Javascript SCA

Post by Rin »

Zompist,

This is great! Trying to get the old SCA to work was driving me nuts, and so I was just about ready to use ZoundsIPA when you posted this.

Cheers, mate!
凛より
I speak English. 日本語も話せます。
Author: A Dictionary of Japanese Counting Words 日本語数詞英和辞典 (Kindle)

Richard W
Avisaru
Avisaru
Posts: 363
Joined: Sat Oct 16, 2010 8:28 pm

Re: New Javascript SCA

Post by Richard W »

Terra wrote:Not wanting to steal Zompist's thunder, but I made a SCA in Javascript not too long ago: http://jc.tech-galaxy.com/ling/sound_ch ... plier.html
I suspect many of us did, in my case far too long ago (2004) - http://homepage.ntlworld.com/richard.wo ... 5d_rom.htm .

Post Reply