langid: read past markup and letter-spaced scans

Markdown image targets and HTML page markers are left out before counting:
an image named by a hash read as two-letter words and made one memoir Latin.

Scanned letter-spaced type ("w i t h", "n o t") filled the sample with
single letters, and a, e, o and y are common words in several Romance
languages, so English lost its margin and came back with no answer. When
more than a quarter of the words are single letters they are left out; if
what remains is mostly fragments, as wrongly decoded fonts are, there is
still no answer.
This commit is contained in:
funkpower committed 2026-11-24 11:46:23 -05:00
1 parent eb27662f69
commit 29d64ae8c2
3 files changed
+94 -1

No files matched your search

+11
View File
@@ -98,6 +98,17 @@ with its thirty commonest function words. The score is the share of a text's
words found in each list, and the lists are the same length so the scores
compare.
**Markup is not language.** HTML comments such as page markers, and the
targets of markdown links and images, are left out before anything is
counted: an image named by a hash reads as a run of two-letter words.
**Letter-spaced type is read by its whole words.** A scan of type set
letter-spaced comes out of OCR as "w i t h" and "n o t". Single letters are
not words of any language, but "a", "e", "o" and "y" are among the commonest
words of several, so when more than a quarter of the words are single letters
they are left out. If what remains is mostly one- and two-letter fragments, as
text decoded with the wrong font table is, there is no answer.
**A close call is no answer.** The winner must be a quarter ahead of the
runner-up. `de` is among the commonest words of four languages at once, and on
its own settles none of them — so a text that short comes back with the script