Difference between revisions of "Constraint Grammar"

From Apertium
Jump to navigation Jump to search
Line 19: Line 19:
LIST word = "hello" ;
LIST word = "hello" ;
SELECT:rule1a (tag1) (1 word) ;
SELECT:1a (tag1) (1 word) ;
SELECT:rule1b set1 (1 word) ; # equivalent to rule1a
SELECT:1b set1 (1 word) ; # equivalent to 1a
SELECT:rule2a (tag1 tag2) (1 word) ;
SELECT:2a (tag1 tag2) (1 word) ;
SELECT:rule2b set2 (1 word) ; # equivalent to rule2a
SELECT:2b set2 (1 word) ; # equivalent to 2a
SELECT:rule3a tag1 (1 word) ;
SELECT:3a tag1 (1 word) ;
SELECT:rule3b tag2 (1 word) ;
SELECT:3b tag2 (1 word) ;
SELECT:rule3c set3 (1 word) ; # equivalent to rule3a and rule3b combined
SELECT:3c set3 (1 word) ; # equivalent to 3a and 3b combined
SELECT:rule1c set1 (1 ("hello")) ; # equivalent to rule1a (or rule1b)
SELECT:1c set1 (1 ("hello")) ; # equivalent to 1a (or 1b)


==Languages using CG in Apertium==
==Languages using CG in Apertium==

Revision as of 16:32, 29 May 2010

Constraint Grammar is a tool that can be used to POS-tag ambiguous text. There are free constraint grammars developed outside the Apertium project for: Norwegian (the Oslo-Bergen tagger), Sámi languages (from Giellatekno) and Faroese (also from Giellatekno).

Terminology

See also: Apertium stream format
Apertium equivalent: ^words/word<n><pl>/word<vblex><pres><p3><sg>$
  • baseform — the lemma of a word.
  • reading — a single analysis of a word.
Apertium equivalent: ^word<n><pl>$

Note on parenthesis

Parentheses, and the distinction between tags and lists/sets, seem to be the main confusing point for people learning CG. If we have the morphological tags tag1 and tag2, then we can have rules like this:

LIST set1 = tag1 ;
LIST set2 = (tag1 tag2) ; # matches a word with both tag1 and tag2
LIST set3 = tag1 tag2 ;   # matches a word with tag1 or tag2
LIST word = "hello" ;

SELECT:1a (tag1) (1 word) ;
SELECT:1b  set1  (1 word) ;   # equivalent to 1a

SELECT:2a (tag1 tag2) (1 word) ;
SELECT:2b  set2       (1 word) ;   # equivalent to 2a

SELECT:3a tag1 (1 word) ;
SELECT:3b tag2 (1 word) ;
SELECT:3c set3 (1 word) ;   # equivalent to 3a and 3b combined

SELECT:1c  set1  (1 ("hello")) ; # equivalent to 1a (or 1b)

Languages using CG in Apertium

See also

External links