Checking With Style
Issue: 7.1 (November/December 2008)
Author: JC Cruz
Article Description: No description available.
Article Length (in bytes): 26,931
Starting Page Number: 28
RBD Number: 7113
project7113.zip Updated: Saturday, November 1, 2008 at 11:57 AM
Related Web Link(s):
Known Limitations: None
Excerpt of article text...
In the last two REALWord articles, we learned how a spell-checker works. We got to build a basic spell-check engine, and even improved it by using refactoring and by adding new features. Now, we will study its next of kin: the style checker. We will learn some of the basic rules of styles and how to render each rule as a regex pattern. And we will build a basic style-check engine as a finite-state machine.
The Need For Style
A grammar engine is another feature found in many word processors. With this feature, users can check for and correct any grammar errors in their documents. The grammar engine works by first dividing each sentence into its component words. It then looks at how each word is used and how one word relates to the other. If either usage or relation is wrong, the engine flags the offending word(s) and prompts users for correction. Some engines will display the correct usage; others will even correct the error themselves.
Grammar engines, however, are quite complex little beasts. They use special algorithms to break down a sentence into verbs, nouns, pronouns, and so on. Then they examine how each word fits in the sentence based on a large set of rules. Some of the rules differ based on the target language; others differ based on audience. And many of the algorithms use optimized data structures to store their data.
...End of Excerpt. Please purchase the magazine to read the full article.
Article copyrighted by REALbasic Developer magazine. All rights reserved.