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 './PhonoChangeApplier.scss';
|
||||
import ls from 'local-storage';
|
||||
|
||||
// import ls from 'local-storage';
|
||||
|
||||
import ProtoLang from './components/ProtoLang';
|
||||
import Features from './components/Features';
|
||||
|
@ -11,20 +12,24 @@ import Output from './components/Output';
|
|||
const PhonoChangeApplier = () => {
|
||||
const [ lexicon, setLexicon ] = useState(['mun', 'tʰu', 'tɯm', 'utʰ']);
|
||||
const [ phonemes, setPhonemes ] = useState(
|
||||
// ! candidate for trie to avoid situations where >2 graph phonemes
|
||||
// ! are uncaught by lexeme decomposition when <n graph phonemes are not present
|
||||
{
|
||||
n: [ 'occlusive', 'sonorant', 'obstruent', 'nasal', 'alveolar' ],
|
||||
m: [ 'occlusive', 'sonorant', 'obstruent', 'nasal', 'bilabial' ],
|
||||
u: [ 'continuant', 'sonorant', 'syllabic', 'high', 'back', 'rounded' ],
|
||||
ɯ: [ 'continuant', 'sonorant', 'syllabic', 'high', 'back', 'unrounded' ],
|
||||
t: [ 'occlusive', 'plosive', 'obstruent', 'alveolar' ],
|
||||
tʰ: [ 'occlusive', 'plosive', 'obstruent', 'alveolar', 'aspirated' ]
|
||||
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 [ results, setResults ] = 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 => {
|
||||
e.preventDefault();
|
||||
|
@ -71,6 +76,20 @@ const PhonoChangeApplier = () => {
|
|||
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
|
||||
|
||||
// handle output
|
||||
|
|
Loading…
Reference in a new issue