Your skill will accomplish
what the force of many cannot
natural language sentence constructionby thpfft (Chaplain)
|on Jun 17, 2001 at 15:03 UTC||Need Help??|
thpfft has asked for the
wisdom of the Perl Monks concerning the following question:
Most of my work involves interface-building, and I've found that once the logic and presentation are reasonably together, the biggest factor in the success or failure of the system is the tone and clarity with which it addresses the user.
So i've become obsessed with writing ui scripts that use proper colloquial english. People react so much better to a page that tells them what's going in a conversational way that i almost don't mind bloating the scripts with sentence construction code and obfuscating the templates with grammatical conditionals.
Here's a very simple example, dug out of the middle of a script i'm updating at the moment. The end result is a sentence in the form:
We found 27 campaign updates and case studies relevant to children and young people, death penalty and the Americas.
except sometimes it's only one type of document, or no restriction at all, or only one keyword, only two results, and so on. There are dozens of permutations, and the proper way of describing the situation is different each time in small but vital ways. This excerpt is as close as I've come without spelling everything out:
If anyone is interested enough to make this more elegant - or just play golf with it - i'd be much obliged.
but my main question: is there a module or project that'll do some of this work for me? CPAN yields a lot of stemming and other mechanisms designed to make words more friendly to computers, but not much designed to make them more friendly to people.
If there isn't any such module, i'd like to start building one. I imagine something extensibly rule-based with a relatively small number of abstract construction mechanisms for common sentence forms, and a vocabulary of prepositions and articles and so on. Ideally swappable into languages other than English, one day. Any views about feasibility or functionality?