Text tools

Tools that deal in plain text: measuring it, recasing it, comparing two drafts, generating filler, or reshaping it to fit rules that some other system will enforce.

6 tools · nothing uploaded · no sign-up

What the counters count

A word count is a convention rather than a measurement, and this one is the plainest: the text is trimmed and split on runs of whitespace. A hyphenated compound is one word, and a script that does not space its words — Chinese, Japanese, Thai — arrives as a handful of long ones.

Characters are counted in UTF-16 code units rather than in what you see, so an emoji usually costs two. Sentences end at a full stop, question mark, exclamation mark or ellipsis, which makes an abbreviation two sentences; paragraphs are blocks separated by a blank line.

Case conversion loses information in one direction — uppercase erases which letters were capitals — so every conversion is computed from the text you typed, not from the previous result.

The cost of comparing

Comparing two texts builds a longest-common-subsequence table, one cell per pair of tokens, costing as much memory as time: two 4,000-token sides are sixteen million cells, about 64 MB. Past that the comparison is refused rather than run, and in word mode the gaps count as tokens too, so the real ceiling is nearer two thousand words a side.

The tallies above the result ignore whitespace: a token of only spaces is highlighted when it changes but never counted, so reflowing a paragraph shows colour without moving the numbers.

Text with a grammar to obey

A slug keeps letters and digits and turns everything else into the separator, then lowercases the result. That filter is not ASCII-only, so a Cyrillic title would come out as a Cyrillic slug, and the accent stripping that runs before it is right for é but does nothing to Львів, which is not accented Latin. So a transliteration table runs first, following the Ukrainian national standard, which gives five letters a second form at the start of a word: Я is ya there and ia elsewhere.

Moodle's GIFT import has a grammar of its own: ~ = # { } and the backslash are syntax, a bare :: opens a question name, and a raw line break ends the question, so each is escaped. Underline and colour do not survive a copy out of Word, so the answer key is hunted for in the marks that do — an asterisk, a bracketed tick, an “Answer: b” line, a key block at the end.