fix state init function to map epoch pointer to initialized lexicon

This commit is contained in:
Sorrel Bri 2019-12-16 13:41:18 -08:00
parent c8f6b65302
commit d83ee0fba3

View file

@ -7,9 +7,6 @@ export type initAction = {
export const initState = (changesArgument: number = -1): stateType => { export const initState = (changesArgument: number = -1): stateType => {
const state = { const state = {
lexicon: [
{lexeme: 'anta', epoch: 'epoch 1'}, 'anat', 'anət', 'anna', 'tan', 'ənta'
],
epochs: [ epochs: [
{ {
name: 'epoch 1', name: 'epoch 1',
@ -63,7 +60,8 @@ export const initState = (changesArgument: number = -1): stateType => {
options: {}, options: {},
results: {}, results: {},
errors: {}, errors: {},
features: {} features: {},
lexicon: []
}; };
state.features = { state.features = {
sonorant: { positive:[ state.phones.a, state.phones.u, state.phones.ɯ, state.phones.ə, state.phones.n], negative: [] }, sonorant: { positive:[ state.phones.a, state.phones.u, state.phones.ɯ, state.phones.ə, state.phones.n], negative: [] },
@ -77,6 +75,14 @@ export const initState = (changesArgument: number = -1): stateType => {
nasal: { positive:[ state.phones.n ], negative: [] }, nasal: { positive:[ state.phones.n ], negative: [] },
aspirated: { positive:[ state.phones.t.ʰ ], negative: [] }, aspirated: { positive:[ state.phones.t.ʰ ], negative: [] },
} }
state.lexicon = [
{lexeme: 'anta', epoch: state.epochs[0]},
{lexeme: 'anat', epoch: state.epochs[0]},
{lexeme: 'anət', epoch: state.epochs[0]},
{lexeme: 'anna', epoch: state.epochs[0]},
{lexeme: 'tan', epoch: state.epochs[0]},
{lexeme: 'ənta', epoch: state.epochs[0]}
]
if(changesArgument > -1) state.epochs[0].changes = state.epochs[0].changes.splice(changesArgument, 1) if(changesArgument > -1) state.epochs[0].changes = state.epochs[0].changes.splice(changesArgument, 1)