15.7. A Speller

You want the user environment for chip queries to be helpful when the user enters an unknown table name or variable name. You also want the UE to allow the user to enter queries in any combination of uppercase and lowercase, although the engine is case-sensitive. You can use a speller to achieve these aims.

One technique for maintaining a preferred spelling of known words is to keep a dictionary whose key/value pairs are composed of a known word spelled in all lowercase, followed by the preferred spelling of the word. For example, such a dictionary would contain

customerid -> CustomerID 

This lets the UE accept customerid as a valid variable name. This dictionary is also a registry of known names, so the UE will detect, for example, ...

Get Building Parsers with Java™ now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.