freeze to change structure of phoneme and epoch hooks
This commit is contained in:
parent
1724355a6c
commit
5fd4406675
1 changed files with 20 additions and 4 deletions
|
@ -23,7 +23,7 @@ const PhonoChangeApplier = () => {
|
||||||
tʰ: [ 'occlusive', 'plosive', 'obstruent', 'alveolar', 'aspirated' ],
|
tʰ: [ 'occlusive', 'plosive', 'obstruent', 'alveolar', 'aspirated' ],
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
const [ epochs, setEpochs ] = useState([{name: 'epoch 1', changes:['[+ rounded]>[+ unrounded]/_#']}]);
|
const [ epochs, setEpochs ] = useState([{name: 'epoch 1', changes:['[+ rounded]>[- 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({})
|
||||||
|
@ -73,17 +73,20 @@ const PhonoChangeApplier = () => {
|
||||||
}
|
}
|
||||||
startingIndex = index;
|
startingIndex = index;
|
||||||
})
|
})
|
||||||
|
lexemeBundle.unshift(['#'])
|
||||||
|
lexemeBundle.push(['#'])
|
||||||
lexicalFeatureBundles.push(lexemeBundle);
|
lexicalFeatureBundles.push(lexemeBundle);
|
||||||
})
|
})
|
||||||
|
console.log(lexicalFeatureBundles)
|
||||||
|
|
||||||
// decompose rules
|
// decompose rules
|
||||||
let allEpochs = epochs.map(epoch => {
|
let allEpochs = epochs.map(epoch => {
|
||||||
let ruleBundle = epoch.changes.map(rule => {
|
let ruleBundle = epoch.changes.map(rule => {
|
||||||
return {
|
return {
|
||||||
input: rule.split('>')[0],
|
input: rule.split('>')[0].replace(/\[|\]|\+/g, '').trim(),
|
||||||
result: rule.split('>')[1].split('/')[0],
|
result: rule.split('>')[1].split('/')[0],
|
||||||
preInput: rule.split('/')[1].split('_')[0],
|
preInput: rule.split('/')[1].split('_')[0].replace(/\[|\]|\+/g, '').trim(),
|
||||||
postInput: rule.split('/')[1].split('_')[1],
|
postInput: rule.split('/')[1].split('_')[1].replace(/\[|\]|\+/g, '').trim(),
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
return {epoch: epoch.name, rules: ruleBundle}
|
return {epoch: epoch.name, rules: ruleBundle}
|
||||||
|
@ -91,6 +94,19 @@ const PhonoChangeApplier = () => {
|
||||||
|
|
||||||
console.log(allEpochs)
|
console.log(allEpochs)
|
||||||
// apply sound changes
|
// apply sound changes
|
||||||
|
allEpochs.reduce((diachronicLexicon, epoch) => {
|
||||||
|
let startingLexicon = diachronicLexicon.length
|
||||||
|
? diachronicLexicon[diachronicLexicon.length - 1]
|
||||||
|
: lexicalFeatureBundles;
|
||||||
|
let currentRules = epoch.rules;
|
||||||
|
let resultingLexicon = startingLexicon.forEach(lexeme => {
|
||||||
|
currentRules.forEach(rule => {
|
||||||
|
let ruleEnvironment = [[rule.preInput], [rule.input], [rule.postInput]];
|
||||||
|
console.log(ruleEnvironment)
|
||||||
|
})
|
||||||
|
})
|
||||||
|
diachronicLexicon.push(resultingLexicon)
|
||||||
|
},[])
|
||||||
|
|
||||||
// handle output
|
// handle output
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue