diff --git a/src/PhonoChangeApplier.js b/src/PhonoChangeApplier.js index d68d48c..ac06c52 100644 --- a/src/PhonoChangeApplier.js +++ b/src/PhonoChangeApplier.js @@ -1,16 +1,14 @@ import React, { useState, useReducer } from 'react'; import './PhonoChangeApplier.scss'; -// import ls from 'local-storage'; - import ProtoLang from './components/ProtoLang'; import Features from './components/Features'; import Epochs from './components/Epochs'; import Options from './components/Options'; import Output from './components/Output'; -import {stateReducer} from './reducers/reducer'; -import {initState} from './reducers/reducer.init'; +import { stateReducer } from './reducers/reducer'; +import { initState } from './reducers/reducer.init'; const PhonoChangeApplier = () => { const [ state, dispatch ] = useReducer( @@ -18,26 +16,8 @@ const PhonoChangeApplier = () => { {}, initState ) - // ! DONE - const [ lexicon, setLexicon ] = useState(['mun', 'tʰu', 'tɯm', 'utʰ']); - - const [ phonemes, setPhonemes ] = useState( - { - 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' ], - } - ); - const [ epochs, setEpochs ] = useState([{name: 'epoch 1', changes:['[+ rounded]>[- rounded + unrounded]/_#']}]); - const [ options, setOptions ] = useState({output: 'default', save: false}) - const [ features, setFeatures ] = useState( - ['occlusive', 'sonorant', 'obstruent', 'nasal', 'alveolar','bilabial', - 'continuant','syllabic','high','back','rounded','unrounded', 'plosive','aspirated']) + const { lexicon, phones, phonemes, epochs, options, features, results } = state; // ! UNDONE - const [ results, setResults ] = useState([]) const [ errors, setErrors ] = useState({}) const runChanges = e => { @@ -82,11 +62,8 @@ const PhonoChangeApplier = () => { } startingIndex = index; }) - // lexemeBundle.unshift(['#']) - // lexemeBundle.push(['#']) lexicalFeatureBundles.push(lexemeBundle); }) - console.log(lexicalFeatureBundles) // decompose rules let allEpochs = epochs.map(epoch => { @@ -101,7 +78,6 @@ const PhonoChangeApplier = () => { return {epoch: epoch.name, rules: ruleBundle} }) - console.log(allEpochs) // apply sound changes allEpochs.reduce((diachronicLexicon, epoch) => { let startingLexicon = diachronicLexicon.length @@ -122,11 +98,11 @@ const PhonoChangeApplier = () => { return (
- - - - - + + + + +
); } diff --git a/src/reducers/reducer.init.js b/src/reducers/reducer.init.js index 29ab5c8..7213de5 100644 --- a/src/reducers/reducer.init.js +++ b/src/reducers/reducer.init.js @@ -16,7 +16,7 @@ export const initState = (changesArgument: number): stateType => { '[+ sonorant - low rounded high back]>0/._.', '[+ obstruent]>[+ obstruent aspirated ]/#_.', '[+ sonorant - rounded]>[+ sonorant + rounded]/._#', - 'at>ta/._#' + // 'at>ta/._#' ] } ], diff --git a/src/reducers/reducer.results.js b/src/reducers/reducer.results.js index d0cc19d..4c12174 100644 --- a/src/reducers/reducer.results.js +++ b/src/reducers/reducer.results.js @@ -259,6 +259,7 @@ export const run = (state: stateType, action: resultsAction): stateType => { // TODO iterate through each epoch try { + console.log('running results') const passResults = state.epochs.reduce((results, epoch, _) => { const { phones, features, lexicon } = state; let lexiconBundle; @@ -276,8 +277,10 @@ export const run = (state: stateType, action: resultsAction): stateType => { }, []); const results = passResults.map(stringifyResults); + console.log(results) return {...state, results } } catch (err) { + console.log(err) return {...state, errors: err }; } } \ No newline at end of file