Consider an application that stores a set of records that contain:
- Description
- Cost
- Purchase Date
I’d like to be able to allow users to utilize natural language to search the dataset.
For example, the search expression:
blue from last month less than $20
would translate into (Linq as an example only – correctness of the query is not in question):
_db.Widgets.Where(w => w.Description.Contains('blue') && w.PurchaseDate >= DateTime.Now.AddMonths(-1) && w.Cost < 20)
I’m struggling to find a starting point. Any resources to get me in the right direction would be appreciated (I am working in .NET).
2
“Natural Language” quicksand as far as computers are concerned. You will get bogged down ambiguous detail as soon as you enter. Which language? I suppose you mean English out of the several thousand available. Then which dialect of “English” you probably mean “East Coast University American” minus Jargon and Slang. So you end up with a limited vocabulary of “proper” English with a restricted grammar. Which ain’t natural in the slightest.
“Dates” on the other hand are a minefield. What is “10/02/02” or “10/12/11”? Which calendar? There are several to choose from its 2557 where I am sitting but the guy next to me thinks it’s 1345.
This is why we have forms with pull downs and date choosers. They remove these ambiguities and with a little effort can be adopted to many languages and cultural conventions.
2