Try storing your third person verbs in a hash, keyed to their second person version.
%verbs =
{ are => 'is',
do => 'does',
have => 'has',
}
If the verb doesn't change then leave it out. You should be able to do a simple replacement of the changed verbs (assuming that you don't change objects in the sentence). I doubt there are many verbs that change based on their object, especially since you're just working from a db of questions. | [reply] [d/l] |
As an extension to the parent post, why do you actually store the second person in plain text?
If you have multiple hashes/arrays for each conjugation, you can easily splice the correct one in, without translation/possible translation errors.
All that's then needed is the initial declaration about which conjugation you require, and voila, the rest should run sweetly.
Unless, of course that's outside the scope of what you're able to do with the database to to commercial constraints.
Just a thought
Malk
*I lost my .sig. Do you have a spare?*
| [reply] |
The questions are in plain text because it's (very) legacy
data.
At this moment my developers are currently leaning toward
making the maintainers of questions use a tailor-made
markup; as the dba, I was hoping to ride to the rescue
yelling "but wait - there's no need to go to all that
hassle since Perl can seamlessly translate the question on
the fly!".
Lingua::EN::Inflect got me part of the way there - an already
existing markup syntax & decoder would carry a lot of
weight - but without
a 2nd=>3rd person verb translation tool I'm stuck.
Sounds like a fun module to write, but I'm one
of the last guys you'd want writing a Lingua::EN module. :-)
Since I'm one of the few Perl proponants at my company, I
probably won't win the fight to have CGI generate the pages,
and thus a nice perl syntax for the markup (like
$to_be{first}{singular}{present}) probably won't
happen.
I agree English is contorted - check out the exceptions
Damian mentions in his module & it's hard to argue the man
isn't a saint for such an extraordinary job.
(Yup, this does sound like a homework question, but it
isn't. We do ask-a-nurse telephone triage, and we're
moving to having the
patients triage themselves via the web. Presentation means
a lot, or so I'm told.)
Thanks, everybody. Your help is appreciated.
| [reply] |
My suggestion is that you give up on English. It was WAY to many exceptions to a rule (which, BTW, is why it's considered the third hardest language to learn. Behing Chinese and Japanese). Try Sandskrit. I understand all it's rules are followed with out exception. That'll make what you change the verb to much easier. | [reply] |
May I ask if this is a homework question? | [reply] |
| [reply] |