In the initial string "T is the", the letter T is the first and fourth letters, so those words are appended to make "T is the first, fourth". Those words have further Ts at 11 and 16, so those numbers are appended, and so on.

Spaces and punctuation are ignored. Accents like acutes are stripped for letter matching. The without_conjunctions option can ignore "and" or "et" too.

Starting from "T is the", the first position is a T so "first" is not appended, but the second position is not a T so lie by giving "second", and similarly the third position, but the fourth is a T so it doesn't appear.

Accents are stripped using Unicode::Normalize if available (Perl 5.8.0 and up), or a built-in Latin-1 table as a fallback otherwise. The Latin-1 suits Lingua::FR::Numbers and probably most of the European numbers modules.

The Lingua modules and string processing means next probably isn't particularly fast. It'd be possible to go numbers-only with the usual rules for ordinals as words but generating just the positions of the "T"s or whatever desired letter, but that doesn't seem worth the effort.

Math-Aronson is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3, or (at your option) any later version.

Math-Aronson is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.