LiminaliaLiminalia
Technical docs: Text counts and spelling variants

Text counts and spelling variants

Open in Claude (new tab)
On this page

Liminalia counts the characters of dialogue and narration in the scenarios and finds candidate spelling variants. lim stats and Studio’s Check screen use the same counting (textStats and findVariants in packages/lang).

Usage

lim stats [project]                 # writes 統計.md and CSV files to exports/stats and prints a summary
lim stats [project] --out reports   # the folder to write to (a path from the project)
lim stats [project] --json          # only prints JSON (writes no files)

It writes the following files (the CSV files have a BOM so that Excel can open them). The file names and contents, and the summary it prints, are in Japanese.

FileContents
統計.md (statistics)Tables of the totals and of the counts by file, scene and speaker, and the candidate spelling variants (with where the less common spellings appear)
ファイル別.csv (by file) / シーン別.csv (by scene)Lines and characters of dialogue and narration, the number and characters of choices, and the number of voiced dialogue lines
話者別.csv (by speaker)Lines and characters of dialogue per speaker, and the number of voiced dialogue lines
表記ゆれ.csv (spelling variants)Group, kind, spelling, count, location (file and line), excerpt

Pack scenarios (packs/<id>/scenario) are counted too, with file names given as packs/<id>/scenario/<scenario>. The totals add both the main scenarios a pack replaces and the pack scenarios (how much is written, not how much shows in play). Studio can’t open pack scenarios, so their rows and places don’t jump to the line.

In Studio, the Check screen shows the “Characters,” “Voice” and “Spelling variants” cards below the list of problems, along with breakdown tables by file, scene and speaker and the list of spelling variant groups (they’re recounted when you open the Check screen, and when you save and the syntax check runs again). Click a heading in a breakdown table to sort by that column (numbers from the largest, names in character order; click again to reverse the order). “Export CSV” saves the table of the current tab as CSV (with a BOM) in its current order. Click a row of a table, or a place where a spelling variant appears, to go to that line of the scenario. Up to 8 places of the less common spellings are listed, and “Show all” shows the rest (up to 50 places per spelling). “Unify” on a spelling variant group opens replace in all files (the search field of the Scenes list) with the text to find and the replacement filled in, to replace the less common spellings with the more common one (before replacing, you check the matching lines and can leave out lines or files. Only the text is searched, except for character names). “Exclude” adds that group to stats.variants.ignore in liminalia.json. Excluded groups are listed at the bottom, and “Restore” undoes the exclusion (when nothing is left, ignore itself is removed).

The replacement used by “Unify” is built for each group when counting (VariantForm.replace). When both spellings list the same number of word forms (出来る/できる …, where each spelling covers its inflected forms), only the part that differs is replaced, after checking the characters around it (「出来(?=る|ない|…)」→「でき」, so the 出来 in 出来事 isn’t changed). Otherwise, it’s replaced only when the more common spelling settles on a single form. Groups where no single form can be decided, such as full-width / half-width digits, don’t get a replacement (“Unify” isn’t shown).

Progress (Studio)

The “Progress” card on the Check screen shows how the character count is progressing (the total of dialogue, narration and choices, the same as the large number on the “Characters” card) (packages/studio/src/client/model/text-progress.ts, panes/stats.ts).

  • Today’s progress: the last count of the day minus the last count of the previous day that was counted (if there is no previous day, minus the first count of the day). Negative if it went down
  • Goal: click “Set a goal,” or the share of the goal, and enter a number of characters (leave it empty to remove the goal). The share stops at 100%
  • Daily progress: bars for the 14 days up to today (days without a count are 0; hover to see that day’s count)
  • Estimated play time: the character count divided by 500 characters per minute, rounded up

Counts are taken shortly after Studio opens and when the Check screen recounts. They’re saved in textGoal (the goal) and textDaily (date → the first and last counts of that day; 400 days) in the project’s .liminalia/studio.json, and aren’t included in the game or in the output of lim stats. The date follows the clock of that device.

How things are counted

  • Dialogue and narration count each line as one, and choice text is counted separately
  • Only characters that are shown are counted. For ruby, only the base text is counted. Inline commands ({@…}), embedded values ({= …}), line breaks and spaces (including full-width spaces) aren’t counted. For dialogue, the outer brackets (「」 『』 ()) aren’t counted
  • A scene runs from a label to the next label (lines before the first label are in “start”). Lines inside macros (@define) are counted in the scene where they’re written
  • Voiced dialogue is dialogue with @voice on the line before, {@voice …} in the text, or from a speaker made automatic with @voice-auto (not counted while stopped with @voice-auto-off). If there is a voice number lock (voice-lock.json), lines not in the lock don’t play, so they aren’t counted

Spelling variants

Different ways of writing the same word or symbol are put into groups, and groups where the project uses two or more of the spellings are shown as candidates (the more common spelling first, followed by the places where the less common spellings appear). The built-in groups are of the following kinds. Most of them are about Japanese writing (kanji and kana are the Japanese writing systems, and okurigana are the kana endings written after kanji), so the examples are in Japanese.

KindExamples
Kanji and kana (kana)出来る/できる, 下さい/ください, 頂く/いただく, 分かる/わかる/解る/判る, 私達/私たち
Okurigana (okurigana)終わる/終る, 変わる/変る, 行う/行なう, 当たる/当る
Symbols (symbol)…/・・・/..., ――/——/──, !?/!?/?!
Full and half width (width)!/!, ?/?, full-width and half-width digits and letters, half-width kana, long vowel marks (ー/-/-), wave dashes (〜/~)
Character names (name)Speaker names that differ only in hiragana and katakana, in full and half width, or in a middle dot or space (ユイ/ゆい), and names in the text whose middle dots or spaces vary (アンナ/アン・ナ)
Glossary (glossary)Words in extra.glossary in liminalia.json and their alternative spellings (term and aliases). Words without alternative spellings aren’t grouped

Groups such as 事/こと, which can also be part of other words, aren’t built in (the 出来 in 出来事 isn’t counted as 出来る).

Dictionary

You can add or remove groups with stats.variants in liminalia.json. A dictionary used only on the author’s own machine is written in the same form in .liminalia/variants.json (the two are used together).

"stats": {
  "variants": {
    "add": [["好き", "すき"], ["ユイ", "ゆい"]],
    "ignore": ["kana:できる", "…"],
    "off": ["width"]
  }
}
  • add: groups to add. List the different spellings of the same word. If you include a spelling that’s in a built-in group, the added group is used instead of the built-in one
  • ignore: groups not to show. Either the group name (such as kana:できる, which appears in 統計.md and 表記ゆれ.csv from lim stats; the part after : alone also works) or any of the spellings in the group
  • off: kinds not to show (kana okurigana symbol width name glossary)