Constraint Grammar is a method used in natural language processing for adding/removing/selecting grammatical tags (such as part of speech and inflectional tags, as well as lemma and wordform) in a given context, e.g. for disambiguation, syntax annotation or dependency parsing. CG files often have thousands of simple, hand-written rules. VISL CG-3 is a popular free/open-source compiler/processor for CG.
There is a nice CG Tutorial to get you started.
VISL CG-3 – a fast and featureful free/open source CG compiler/processor (available in official Debian/Ubuntu repositories too).