4 ms·
Your code fails for French text.
by gnuvince 15y ago
Your code fails for French text.
- lsb 15y agoAs did Knuth's; see below the discussion about that. If you wanted to change it, to split "words" by blanks and punctuation characters, you would have tr -s [:blank:][:punct:] "\n" and then that piece would fit into the pipeline, the rest unscathed. This design is far easier to reason about than a dozen pages of Pascal.
- ralph 15y agoThose globs should be protected from the shell otherwise ./bc is going to alter tr's arguments.
- d0mine 15y agoHow many modern programs comply with Unicode Text Segmentation http://unicode.org/reports/tr29/ http://unicode.org/reports/tr29/ for finding word boundaries or Unicode Collation Algorithm http://unicode.org/reports/tr10/ http://unicode.org/reports/tr10/ for sorting the words.