4 ms·
The shell version completely fails on Unicode or even Latin ASCII.
by reagency 11y ago
The shell version completely fails on Unicode or even Latin ASCII.
- philh 11y agoSo does Knuth's, which embeds a case conversion table directly in the code. http://onesixtythree.com/literate/literate2.pdf http://onesixtythree.com/literate/literate2.pdf The shell script is easy enough to approximately fix: tr -cs '[:alpha:]' '\n' | tr '[:upper:]' '[:lower:]' | sort | uniq -c | sort -rn | sed ${1}q (In my tests, it doesn't turn ẞ into ß, but it does turn É into é. "straße" is recognized as all one word, but not as the same word as "strasse" - but it's not clear whether it should be or not. I'm not sure how it'll handle normalization, if the same character is represented in two different ways.)