Tuesday, 17 September 2013

Abbreviation permutation in PHP

Abbreviation permutation in PHP

I'm trying to write a small routine responsible for permuting all possible
abbreviations for a string. This string is a full name, separated by
spaces. Like this:
James Mitchell Rhodes
I want to output:
J. Mitchell Rhodes
James M. Rhodes
J. M. Rhodes
And so on... however, i also have to consider "stopwords":
James the Third Rhodes
I want to output:
J. the Third R.
James The Third R.
Is there a known algorithm for this? I've been trying to fix this problems
for quite some time now.

No comments:

Post a Comment