Link grammar
|
Link grammar (LG) is a theory of syntax which builds simple, explicit relations between pairs of words, rather than constructing constituents in tree-like hierarchy. There are two basic parameters: directionality and distance.
For example, in an SVO language like English, the verb would look left to form a subject link, and right to form an object link. Nouns would look right to complete the subject link, or left to complete the object link.
In an SOV language like Persian, the verb would look left to form an object link, and a more distant left to form a subject link. Nouns would look to the right for both subject and object links.
Contents |
Syntax
Rightward links are represented as a +, and leftward links with a -. Optional links are contained in curly brackets {...}. Undesirable links are contained in any number of square brackets [...]. Multiple links are joined either by a conjunction & or a disjunction or. Each rule ends with a semicolon ;.
Examples
Example 1
A basic rule file for an SVO language might look like:
- <determiner>: D+;
- <noun-subject>: {D-} & S+;
- <noun-object>: {D-} & O-;
- <verb>: S- & {O+};
Thus the English sentence, “The boy painted a picture” would appear as:
+-----O-----+ +-D-+--S--+ +--D--+ | | | | | The boy painted a picture
Example 2
While a rule file for a null subject SOV language might consist of the following links:
- <noun-subject>: S+;
- <noun-object>: O+;
- <verb>: {O-} & {S-};
And a simple Persian sentence, "من نان خوردم" 'I ate bread' would look like:
+-----S-----+ | +--O--+ | | | man nAn xordam
Implementations
The Link grammar syntax parser is a library for natural language processing written in C. It is currently licensed under a GPL compatible free software license.
There are also Perl and Ruby implementations available.
External links
- The Link grammar homepage (http://www.link.cs.cmu.edu/link/)
- Online English demonstration (http://www.link.cs.cmu.edu/link/submit-sentence-4.html)
- Persian LG-parser extension (http://home.byu.net/jmd56/download/persianlg-0.8.tar.gz)
- Online Persian demonstration (http://students.cs.byu.edu/~jonsafar/persianlg.html)
- Perl implementation (http://search.cpan.org/~dbrian/Lingua-LinkParser1.08/LinkParser.pm)
- Ruby implementation (http://dev.faeriemud.org/~stillflame/linkparse.html)