The Problem

Fudoki delivers a browser‑based Japanese text analyzer and speech‑synthesis tool, but the codebase has no test suite, no CI gate, and no licence file. Changes can therefore introduce regressions that go undetected, and the code cannot be legally reused without clarifying rights.

What This Does

Fudoki runs entirely in the browser: it segments Japanese text with kuromoji.js, tags parts‑of‑speech, shows readings, and reads selections aloud via the Web Speech API. A built‑in EasyMDE markdown editor (static/libs/easymde/easymde.min.js) co‑exists with the analysis pipeline, letting users write rich text while preserving kuromoji processing. Dictionary lookup pulls from bundled JMdict chunks (static/libs/dict/chunks/jmdict_chunk_*.json). Playback controls (static/js/tts.js) expose voice, speed (0.5‑2.0), pause/resume, and persist settings in localStorage. Multiple documents are autosaved and switchable, and the UI offers dark mode, multilingual labels, and a draggable toolbar.

How It Is Wired

Execution starts at handler defined in static/main-js.js:7211 – the sole entry point that reaches one internal function and is called from nowhere else. The initialization of the dictionary service lives in static/libs/dict/dictionary-service.js:15 (init), invoked from nine call sites.

The internal call graph contains 2 623 self‑edges. The most‑connected modules are:

ModuleCalls fromCalls to
slice84 places
t (i18n)68 places
e48 places
main‑js.js functions ($, katakanaToHiragana, addFuriganaToPreview)1 external caller8 internal modules
static/libs/kuromoji.js (e, s, slice, apply, initialParams)7 callers2 internal modules

Notable structural concerns:

  • Oversized filesstatic/main-js.js and static/libs/kuromoji.js each contain ~4 278 lines, making the code hard to hold in one mental model.
  • Deep nesting – max indentation depth of 8 in those files; guard‑clause flattening would improve readability.
  • High branching density265 branch points over 536 lines in static/main-js.js and static/js/tts.js.
  • Empty catch blocks – four occurrences (static/js/tts.js, static/js/ui-utils.js, static/libs/kuromoji.js) silently discard errors.
  • Duplicated logic – nine 6‑line blocks repeated across static/js/tts.js and static/main-js.js.

Edges such as applyI18n → t (×67) and updateSettingsLabels → setText (×39) illustrate how a single function ripples through the UI.

How To Use It

# 1️⃣ Clone the repo
git clone https://github.com/moses-y/fudoki
cd fudoki

# 2️⃣ Start a local static server (no build step required)
python -m http.server 8000
# then open http://localhost:8000 in a browser

The README also notes npm is the package manager, but the project ships pre‑bundled; simply serving the static/ directory is sufficient.

Real‑World Use

A content‑team member opens the app, pastes a Japanese technical article into the EasyMDE editor, and instantly sees morphological segmentation, POS tags, and kana readings. Clicking a word card fetches JMdict translations. With a single click they toggle the voice selector and speed slider; the playback control pauses, applies the new setting, then resumes at the current position. The team can embed the handler function in a larger web product to provide on‑device Japanese analysis without a server round‑trip.

Code Health & Issues

  • High – deep nesting x2, control flow hard to follow – static/main-js.js, static/libs/kuromoji.js
  • High – oversized files x2, ~4 278 code lines each – static/main-js.js, static/libs/kuromoji.js
  • Medium – empty catch blocks x4, errors silently discarded – static/js/tts.js, static/js/ui-utils.js, static/libs/kuromoji.js
  • Medium – duplicated code blocks x9 repeated 6‑line blocks – static/js/tts.js, static/main-js.js
  • Medium – high branching density x2, 265 branch points over 536 lines – static/js/tts.js, static/main-js.js
  • Low – 9 TODO/FIXME markers – static/libs/kuromoji.js

These findings stem from static analysis of the 12 JavaScript source files; they indicate areas where refactoring, error handling, and test coverage would markedly improve maintainability.

The Bottom Line

Fudoki is a functional, client‑side Japanese analysis and TTS tool that can be dropped into a browser‑only workflow without backend infrastructure. Its main drawbacks are the lack of a licence, no test suite, absent CI, and code health problems (oversized, deeply nested, error‑silencing sections). It is well‑suited for rapid prototyping, documentation aids, or embedding Japanese language features into existing web apps, but should be refactored and licensed before being relied upon in production‑critical contexts.