469,626 Members | 949 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,626 developers. It's quick & easy.

command text parsing and hints displaying on user input.

Hi guys,

I'm writing a program with a feature of accepting user input as command
text and parsing it to correct function calls...example:

"5 minutes later"/"5 min later"/"5 minute later"/"after 5 minutes"...
are being parsed as the same rule so the system will call a later
function with minutes=5 as parameter.

Of course there are many other possiblilities, "seconds"/"days", and
even "every(each) hour"/"every Monday"/"every two days"...so on...

The datetime computation can be done with the wonderful "dateutil"
package, but I'm not sure with the command text parsing part. I could
do a lot of regular expression, but it'll be great if there is already
something similar available...or even a hint that can make it easier
than hand-writing a lot of regular expression code...

Another requirment is to display useful hints when user input the
command text. Example:

user input:"5" -hints: "5 minutes later/5 hours later/5 days
later/every 5 minutes"
user input:"fi" -hints: "next Friday"/"first thing tommorrow"
user input:"ne" -hints: "next day"/"next hour"/"next week"/"next
month"

Sounds too intelligent to do? Any advices on this?

Thanks guys.

Andy

Oct 16 '06 #1
2 1658
Anybody have an idea on this??
Does Natural Language Processing help in this case?

Oct 17 '06 #2
Andy wrote:
Hi guys,

I'm writing a program with a feature of accepting user input as command
text and parsing it to correct function calls...example:

"5 minutes later"/"5 min later"/"5 minute later"/"after 5 minutes"...
are being parsed as the same rule so the system will call a later
function with minutes=5 as parameter.
Maybe one of these will help:
http://cheeseshop.python.org/pypi/parsedatetime/0.7.4
http://cheeseshop.python.org/pypi/when/1

Kent
Oct 17 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

8 posts views Thread by BiNZGi | last post: by
6 posts views Thread by portCo | last post: by
13 posts views Thread by Chris Carlen | last post: by
reply views Thread by JosAH | last post: by
reply views Thread by gheharukoh7 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.