patch transformLexeme to remove empty phoneme object in case of deletion
This commit is contained in:
parent
07be982b51
commit
42f0b179c8
2 changed files with 4 additions and 2 deletions
|
@ -14,8 +14,8 @@ export const initState = (changesArgument: number): stateType => {
|
||||||
'[+ occlusive - nasal]>[+ occlusive + nasal]/n_.',
|
'[+ occlusive - nasal]>[+ occlusive + nasal]/n_.',
|
||||||
'a>ɯ/._#',
|
'a>ɯ/._#',
|
||||||
'[+ sonorant - low rounded high back]>0/._.',
|
'[+ sonorant - low rounded high back]>0/._.',
|
||||||
// 'nn>nun/._.',
|
|
||||||
// '[+ nasal][+ obstruent]>[+ nasal obstruent aspirated ]/#_.',
|
// '[+ nasal][+ obstruent]>[+ nasal obstruent aspirated ]/#_.',
|
||||||
|
// 'nn>nun/._.',
|
||||||
// '[+ sonorant rounded]>[+ sonorant - rounded]/._#'
|
// '[+ sonorant rounded]>[+ sonorant - rounded]/._#'
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
|
@ -183,6 +183,8 @@ export const transformLexeme = (lexemeBundle, rule, features) => {
|
||||||
if (!isEnvironmentBoundByRule([phoneme], position)) return [...newLexeme, phoneme];
|
if (!isEnvironmentBoundByRule([phoneme], position)) return [...newLexeme, phoneme];
|
||||||
if (!isEnvironmentBoundByRule(lexemeBundle.slice(index, index + post.length), post)) return [...newLexeme, phoneme];
|
if (!isEnvironmentBoundByRule(lexemeBundle.slice(index, index + post.length), post)) return [...newLexeme, phoneme];
|
||||||
const newPhoneme = swapPhoneme(phoneme, rule.newFeatures[0], features);
|
const newPhoneme = swapPhoneme(phoneme, rule.newFeatures[0], features);
|
||||||
|
// if deletion occurs
|
||||||
|
if (!newPhoneme.grapheme) return [ ...newLexeme] ;
|
||||||
return [...newLexeme, newPhoneme];
|
return [...newLexeme, newPhoneme];
|
||||||
}, [])
|
}, [])
|
||||||
return newLexeme;
|
return newLexeme;
|
||||||
|
@ -212,7 +214,7 @@ export const run = (state: stateType, action: resultsAction): stateType => {
|
||||||
const lexiconBundle = formBundleFromLexicon(lexicon)(phones);
|
const lexiconBundle = formBundleFromLexicon(lexicon)(phones);
|
||||||
const passResults = transformLexicon(lexiconBundle)(ruleBundle)(features);
|
const passResults = transformLexicon(lexiconBundle)(ruleBundle)(features);
|
||||||
const stringifiedPassResults = passResults.map(stringifyResults);
|
const stringifiedPassResults = passResults.map(stringifyResults);
|
||||||
|
console.log(passResults)
|
||||||
const pass = {
|
const pass = {
|
||||||
pass: epoch.name,
|
pass: epoch.name,
|
||||||
lexicon: stringifiedPassResults
|
lexicon: stringifiedPassResults
|
||||||
|
|
Loading…
Reference in a new issue