One of the aspects of Morti's code that's been in need of attention has been how he deals with "person transforms" (e.g. "I like you" to "You like me", etc.). Over the last week or so, I've been working on a function that more elegantly handles the problem, and I
think I've got the function working to my satisfaction. But I want to test it a lot more before I go installing it into Morti's script, just in case. And, of course, this is where you folks come in.
I've made a test page at
http://www.geekcavecreations.com/Morti/personTest.php that I would love to have some folks visit, and throw some phrases and sentences at. The page script logs both the input and the output, so if there are any missed or mangled transformations, I'll be able to catch them, and come up with a means to correct things. So if you have a few moments to spare, I invite and encourage you to pop on over, and check it out. I'd dearly love to be able to incorporate this into Morti's script before the CBC, if I can, but I won't do it without enough testing.
For those interested, the way this function works is this:
I have a list of 2100+ verbs/adverbs in a file, named verbList.dat - This list is paired with the words "I" and "you", and turned into Regular Expression patterns and replacements. Since PHP's RegEx functions are extremely fast, searching for this many combinations is not all that time consuming, so the performance hit is very small. Anyways, since the function has to not only change things from "I want" to "you want", but also (at the same time) change "you said" to "I said", it can't just do a "straight across" swap, or everything would end up as "I said" and "I want". To fix this, I do the swaps in a certain order, doing the transforms from first to second (with a twist), then second to first. then I "fix" the "twist", and everything is the way it belongs (so far). The "twist" is in changing all instances of "I [word]" to "y ou [word]", and then swapping all instances of "y ou" to "you" as a final step. The only way this wouldn't work is if the function came across a "second person" pronoun that didn't start with "you". I can't think of any, but I'm not an expert in grammar. If anyone knows of one, I'd love to hear about it.
Ok, I've babbled enough, and probably caused hundreds of pairs of eyes to glaze over. I'll shut up now.