diff --git a/src/components/Analyzer.tsx b/src/components/Analyzer.tsx index 217c8b980..50b483190 100644 --- a/src/components/Analyzer.tsx +++ b/src/components/Analyzer.tsx @@ -53,35 +53,25 @@ const AnalysisResult = ({ const splitUnit = unit.split('/'); const morphemes: Array = []; - const joinedMorphemes: Record> = {}; splitUnit.slice(1).forEach((unit, i) => { const matches = unit.match(unitRegex); if (matches && matches.length > 2) { - matches.slice(1, matches.length - 1).forEach((match) => { - if (joinedMorphemes[match]) { - joinedMorphemes[match].push(unit); - } else { - joinedMorphemes[match] = [unit]; - } - }); + matches + .filter((m) => m.length > 0) + .forEach((match, n) => { + const subreadingIndent = 30; + const width = subreadingIndent * n; + morphemes.push( +
+ {formatUnit(match)} +
, + ); + }); } else { morphemes.push(
{formatUnit(unit)}
); } }); - Object.entries(joinedMorphemes).forEach(([joinedMorpheme, units], i) => { - morphemes.push(
{formatUnit(joinedMorpheme)}
); - units.forEach((unit, j) => { - const unitMatch = unit.match(unitRegex); - if (unitMatch) { - morphemes.push( -
- {formatUnit(unitMatch[0])} -
, - ); - } - }); - }); return (