decompose rules to produce rule bundle array for epoch object
This commit is contained in:
parent
4903c6b8a3
commit
1724355a6c
1 changed files with 30 additions and 11 deletions
|
@ -1,6 +1,7 @@
|
||||||
import React, { useState, useEffect } from 'react';
|
import React, { useState, useEffect } from 'react';
|
||||||
import './PhonoChangeApplier.scss';
|
import './PhonoChangeApplier.scss';
|
||||||
import ls from 'local-storage';
|
|
||||||
|
// import ls from 'local-storage';
|
||||||
|
|
||||||
import ProtoLang from './components/ProtoLang';
|
import ProtoLang from './components/ProtoLang';
|
||||||
import Features from './components/Features';
|
import Features from './components/Features';
|
||||||
|
@ -11,20 +12,24 @@ import Output from './components/Output';
|
||||||
const PhonoChangeApplier = () => {
|
const PhonoChangeApplier = () => {
|
||||||
const [ lexicon, setLexicon ] = useState(['mun', 'tʰu', 'tɯm', 'utʰ']);
|
const [ lexicon, setLexicon ] = useState(['mun', 'tʰu', 'tɯm', 'utʰ']);
|
||||||
const [ phonemes, setPhonemes ] = useState(
|
const [ phonemes, setPhonemes ] = useState(
|
||||||
{
|
// ! candidate for trie to avoid situations where >2 graph phonemes
|
||||||
n: [ 'occlusive', 'sonorant', 'obstruent', 'nasal', 'alveolar' ],
|
// ! are uncaught by lexeme decomposition when <n graph phonemes are not present
|
||||||
m: [ 'occlusive', 'sonorant', 'obstruent', 'nasal', 'bilabial' ],
|
{
|
||||||
u: [ 'continuant', 'sonorant', 'syllabic', 'high', 'back', 'rounded' ],
|
n: [ 'occlusive', 'sonorant', 'obstruent', 'nasal', 'alveolar' ],
|
||||||
ɯ: [ 'continuant', 'sonorant', 'syllabic', 'high', 'back', 'unrounded' ],
|
m: [ 'occlusive', 'sonorant', 'obstruent', 'nasal', 'bilabial' ],
|
||||||
t: [ 'occlusive', 'plosive', 'obstruent', 'alveolar' ],
|
u: [ 'continuant', 'sonorant', 'syllabic', 'high', 'back', 'rounded' ],
|
||||||
tʰ: [ 'occlusive', 'plosive', 'obstruent', 'alveolar', 'aspirated' ]
|
ɯ: [ 'continuant', 'sonorant', 'syllabic', 'high', 'back', 'unrounded' ],
|
||||||
}
|
t: [ 'occlusive', 'plosive', 'obstruent', 'alveolar' ],
|
||||||
|
tʰ: [ 'occlusive', 'plosive', 'obstruent', 'alveolar', 'aspirated' ],
|
||||||
|
}
|
||||||
);
|
);
|
||||||
const [ epochs, setEpochs ] = useState([{name: 'epoch 1', changes:['[+ feature]>[- feature]/_#']}]);
|
const [ epochs, setEpochs ] = useState([{name: 'epoch 1', changes:['[+ rounded]>[+ unrounded]/_#']}]);
|
||||||
const [ options, setOptions ] = useState({output: 'default', save: false})
|
const [ options, setOptions ] = useState({output: 'default', save: false})
|
||||||
const [ results, setResults ] = useState([])
|
const [ results, setResults ] = useState([])
|
||||||
const [ errors, setErrors ] = useState({})
|
const [ errors, setErrors ] = useState({})
|
||||||
const [ features, setFeatures ] = useState([])
|
const [ features, setFeatures ] = useState(
|
||||||
|
['occlusive', 'sonorant', 'obstruent', 'nasal', 'alveolar','bilabial',
|
||||||
|
'continuant','syllabic','high','back','rounded','unrounded', 'plosive','aspirated'])
|
||||||
|
|
||||||
const runChanges = e => {
|
const runChanges = e => {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
@ -71,6 +76,20 @@ const PhonoChangeApplier = () => {
|
||||||
lexicalFeatureBundles.push(lexemeBundle);
|
lexicalFeatureBundles.push(lexemeBundle);
|
||||||
})
|
})
|
||||||
|
|
||||||
|
// decompose rules
|
||||||
|
let allEpochs = epochs.map(epoch => {
|
||||||
|
let ruleBundle = epoch.changes.map(rule => {
|
||||||
|
return {
|
||||||
|
input: rule.split('>')[0],
|
||||||
|
result: rule.split('>')[1].split('/')[0],
|
||||||
|
preInput: rule.split('/')[1].split('_')[0],
|
||||||
|
postInput: rule.split('/')[1].split('_')[1],
|
||||||
|
}
|
||||||
|
})
|
||||||
|
return {epoch: epoch.name, rules: ruleBundle}
|
||||||
|
})
|
||||||
|
|
||||||
|
console.log(allEpochs)
|
||||||
// apply sound changes
|
// apply sound changes
|
||||||
|
|
||||||
// handle output
|
// handle output
|
||||||
|
|
Loading…
Reference in a new issue