Apertium has moved from SourceForge to GitHub.
If you have any questions, please come and talk to us on #apertium on irc.freenode.net or contact the GitHub migration team.

Apertium-recursive/Example

From Apertium
< Apertium-recursive(Difference between revisions)
Jump to: navigation, search
m (A Simple Set of Rules: syntax update)
m (switch link to overleaf)
 
Line 1: Line 1:
A version of this example with pictures can be found at https://github.com/apertium/apertium-recursive/blob/master/docs/Hobbit_Example.pdf
+
A version of this example with pictures can be found at https://www.overleaf.com/read/pkjjgzjczhzh (if that link doesn't work, the source is [https://github.com/apertium/apertium-recursive/blob/master/docs/Hobbit_Example.tex here]).
   
 
=== Initial Sentence ===
 
=== Initial Sentence ===

Latest revision as of 19:39, 13 August 2019

A version of this example with pictures can be found at https://www.overleaf.com/read/pkjjgzjczhzh (if that link doesn't work, the source is here).

Contents

[edit] Initial Sentence

In a hole in the ground there lived a Hobbit.

[edit] Output of eng-spa-lex

^In<pr>/En<pr>$ ^a<det><ind><sg>/uno<det><ind><GD><sg>$ ^hole<n><sg>/agujero<n><m><sg>$ ^in<pr>/en<pr>$ ^the<det><def><sp>/el<det><def><GD><ND>$ ^ground<n><sg>/tierra<n><f><sg>$ ^there<adv>/allí<adv>$ ^live<vblex><past>/vivir<vblex><past>$ ^a<det><ind><sg>/uno<det><ind><GD><sg>$ ^Hobbit<n><sg>/Hobbit<n><m><sg>$^.<sent>/.<sent>$^.<sent>/.<sent>$

[edit] A Simple Set of Rules

gender = m f;
number = (ND sg) sg pl ND;
definite = def ind;
tense = past pres ifi;
person = (PD p3) p1 p2 p3 PD;

tense > tense : past ifi;

n: _.gender.number;
det: _.definite.gender.number;
pr: _;
vblex: _.tense.person.number;
adv: _;

NP: _.gender.number;
DP: _.gender.number;
PP: _;
VP: _.tense.person.number;

NP -> %n { 1 } |
      10: %n PP { 1 _1 2 } ;

PP -> pr DP { 1 _1 2 } ;

DP -> det %NP { 1[gender=2.gender, number=2.number] _1 2 } ;

VP -> %vblex DP { 1[tense=$tense, person=$person, number=$number] _1 2 } |
      adv %VP (if (1.lem/sl = there) 
                  { %2 }
               else
                  { 1 _1 %2 } ) |
      PP %VP { 1 _1 %2 } ;

[edit] Process

Action Result Comments
Read token
  1. ^In<pr>/En<pr>$
Read token
  1. ^In<pr>/En<pr>$
  2. ^a<det><ind><sg>/uno<det><ind><GD><sg>$
Read token
  1. ^In<pr>/En<pr>$
  2. ^a<det><ind><sg>/uno<det><ind><GD><sg>$
  3. ^hole<n><sg>/agujero<n><m><sg>$
Split
  1. ^In<pr>/En<pr>$
  2. ^a<det><ind><sg>/uno<det><ind><GD><sg>$
  3. ^hole<n><sg>/agujero<n><m><sg>$

  1. ^In<pr>/En<pr>$
  2. ^a<det><ind><sg>/uno<det><ind><GD><sg>$
  3. ^hole<n><sg>/agujero<n><m><sg>$</pre>
Rule 1 (NP -> n) could apply, but it's possible that reading more of the input would make it so rule 2 (NP -> n PP) could apply, so we do both.
Apply rule 1 (NP -> n) in the first branch
  1. ^In<pr>/En<pr>$
  2. ^a<det><ind><sg>/uno<det><ind><GD><sg>$
  3. ^unknown<NP><m><sg>{^hole<n><sg>/agujero<n><m><sg>$}$

  1. ^In<pr>/En<pr>$
  2. ^a<det><ind><sg>/uno<det><ind><GD><sg>$
  3. ^hole<n><sg>/agujero<n><m><sg>$
Since the rule says %n, the required NP tags (gender and number) are filled in with the values of the noun tags.
Apply rule 4 (DP -> det NP) in the first branch
  1. ^In<pr>/En<pr>$
  2. ^unknown<DP><m><sg>{^a<det><ind><sg>/uno<det><ind><GD><sg>$ ^unknown<NP><m><sg>{^hole<n><sg>/agujero<n><m><sg>$}$}$

  1. ^In<pr>/En<pr>$
  2. ^a<det><ind><sg>/uno<det><ind><GD><sg>$
  3. ^hole<n><sg>/agujero<n><m><sg>$
Note that the determiner still has GD as it's gender. Child tags are not modified until the output step.
Apply rule 3 (PP -> pr DP) in the first branch
  1. ^unknown<PP>{^In<pr>/En<pr>$ ^unknown<DP><m><sg>{^a<det><ind><sg>/uno<det><ind><GD><sg>$ ^unknown<NP><m><sg>{^hole<n><sg>/agujero<n><m><sg>$}$}$}$

  1. ^In<pr>/En<pr>$
  2. ^a<det><ind><sg>/uno<det><ind><GD><sg>$
  3. ^hole<n><sg>/agujero<n><m><sg>$
Read token
  1. ^unknown<PP>{^In<pr>/En<pr>$ ^unknown<DP><m><sg>{^a<det><ind><sg>/uno<det><ind><GD><sg>$ ^unknown<NP><m><sg>{^hole<n><sg>/agujero<n><m><sg>$}$}$}$
  2. ^in<pr>/en<pr>$

  1. ^In<pr>/En<pr>$
  2. ^a<det><ind><sg>/uno<det><ind><GD><sg>$
  3. ^hole<n><sg>/agujero<n><m><sg>$
  4. ^in<pr>/en<pr>$
Read token
  1. ^unknown<PP>{^In<pr>/En<pr>$ ^unknown<DP><m><sg>{^a<det><ind><sg>/uno<det><ind><GD><sg>$ ^unknown<NP><m><sg>{^hole<n><sg>/agujero<n><m><sg>$}$}$}$
  2. ^in<pr>/en<pr>$
  3. ^the<det><def><sp>/el<det><def><GD><ND>$

  1. ^In<pr>/En<pr>$
  2. ^a<det><ind><sg>/uno<det><ind><GD><sg>$
  3. ^hole<n><sg>/agujero<n><m><sg>$
  4. ^in<pr>/en<pr>$
  5. ^the<det><def><sp>/el<det><def><GD><ND>$
Read token
  1. ^unknown<PP>{^In<pr>/En<pr>$ ^unknown<DP><m><sg>{^a<det><ind><sg>/uno<det><ind><GD><sg>$ ^unknown<NP><m><sg>{^hole<n><sg>/agujero<n><m><sg>$}$}$}$
  2. ^in<pr>/en<pr>$
  3. ^the<det><def><sp>/el<det><def><GD><ND>$
  4. ^ground<n><sg>/tierra<n><f><sg>$

  1. ^In<pr>/En<pr>$
  2. ^a<det><ind><sg>/uno<det><ind><GD><sg>$
  3. ^hole<n><sg>/agujero<n><m><sg>$
  4. ^in<pr>/en<pr>$
  5. ^the<det><def><sp>/el<det><def><GD><ND>$
  6. ^ground<n><sg>/tierra<n><f><sg>$
Apply rule 1 (NP -> n) in both branches
  1. ^unknown<PP>{^In<pr>/En<pr>$ ^unknown<DP><m><sg>{^a<det><ind><sg>/uno<det><ind><GD><sg>$ ^unknown<NP><m><sg>{^hole<n><sg>/agujero<n><m><sg>$}$}$}$
  2. ^in<pr>/en<pr>$
  3. ^the<det><def><sp>/el<det><def><GD><ND>$
  4. ^unknown<NP><f><sg>{^ground<n><sg>/tierra<n><f><sg>$}$

  1. ^In<pr>/En<pr>$
  2. ^a<det><ind><sg>/uno<det><ind><GD><sg>$
  3. ^hole<n><sg>/agujero<n><m><sg>$
  4. ^in<pr>/en<pr>$
  5. ^the<det><def><sp>/el<det><def><GD><ND>$
  6. ^unknown<NP><f><sg>{^ground<n><sg>/tierra<n><f><sg>$}$
This time the next word is an adverb, rather than a preposition, so no splitting occurs and the rule is applied in each branch.
Apply rule 4 (DP -> det NP) in both branches
  1. ^unknown<PP>{^In<pr>/En<pr>$ ^unknown<DP><m><sg>{^a<det><ind><sg>/uno<det><ind><GD><sg>$ ^unknown<NP><m><sg>{^hole<n><sg>/agujero<n><m><sg>$}$}$}$
  2. ^in<pr>/en<pr>$
  3. ^unknown<DP><f><sg>{^the<det><def><sp>/el<det><def><GD><ND>$ ^unknown<NP><f><sg>{^ground<n><sg>/tierra<n><f><sg>$}$}$

  1. ^In<pr>/En<pr>$
  2. ^a<det><ind><sg>/uno<det><ind><GD><sg>$
  3. ^hole<n><sg>/agujero<n><m><sg>$
  4. ^in<pr>/en<pr>$
  5. ^unknown<DP><f><sg>{^the<det><def><sp>/el<det><def><GD><ND>$ ^unknown<NP><f><sg>{^ground<n><sg>/tierra<n><f><sg>$}$}$
Apply rule 3 (PP -> pr DP) in both branches
  1. ^unknown<PP>{^In<pr>/En<pr>$ ^unknown<DP><m><sg>{^a<det><ind><sg>/uno<det><ind><GD><sg>$ ^unknown<NP><m><sg>{^hole<n><sg>/agujero<n><m><sg>$}$}$}$
  2. ^unknown<PP>{^in<pr>/en<pr>$ ^unknown<DP><f><sg>{^the<det><def><sp>/el<det><def><GD><ND>$ ^unknown<NP><f><sg>{^ground<n><sg>/tierra<n><f><sg>$}$}$}$

  1. ^In<pr>/En<pr>$
  2. ^a<det><ind><sg>/uno<det><ind><GD><sg>$
  3. ^hole<n><sg>/agujero<n><m><sg>$
  4. ^unknown<PP>{^in<pr>/en<pr>$ ^unknown<DP><f><sg>{^the<det><def><sp>/el<det><def><GD><ND>$ ^unknown<NP><f><sg>{^ground<n><sg>/tierra<n><f><sg>$}$}$}$
Apply rule 2 (NP -> n PP) in the second branch
  1. ^unknown<PP>{^In<pr>/En<pr>$ ^unknown<DP><m><sg>{^a<det><ind><sg>/uno<det><ind><GD><sg>$ ^unknown<NP><m><sg>{^hole<n><sg>/agujero<n><m><sg>$}$}$}$
  2. ^unknown<PP>{^in<pr>/en<pr>$ ^unknown<DP><f><sg>{^the<det><def><sp>/el<det><def><GD><ND>$ ^unknown<NP><f><sg>{^ground<n><sg>/tierra<n><f><sg>$}$}$}$

Weight: 10

  1. ^In<pr>/En<pr>$
  2. ^a<det><ind><sg>/uno<det><ind><GD><sg>$
  3. ^unknown<NP><m><sg>{^hole<n><sg>/agujero<n><m><sg>$ ^unknown<PP>{^in<pr>/en<pr>$ ^unknown<DP><f><sg>{^the<det><def><sp>/el<det><def><GD><ND>$ ^unknown<NP><f><sg>{^ground<n><sg>/tierra<n><f><sg>$}$}$}$}$
Note that rule 2 has a weight attached to it, so now the second branch is weighted.
Apply rule 4 (DP -> det NP) in the second branch
  1. ^unknown<PP>{^In<pr>/En<pr>$ ^unknown<DP><m><sg>{^a<det><ind><sg>/uno<det><ind><GD><sg>$ ^unknown<NP><m><sg>{^hole<n><sg>/agujero<n><m><sg>$}$}$}$
  2. ^unknown<PP>{^in<pr>/en<pr>$ ^unknown<DP><f><sg>{^the<det><def><sp>/el<det><def><GD><ND>$ ^unknown<NP><f><sg>{^ground<n><sg>/tierra<n><f><sg>$}$}$}$

Weight: 10

  1. ^In<pr>/En<pr>$
  2. ^unknown<DP><m><sg>{^a<det><ind><sg>/uno<det><ind><GD><sg>$ ^unknown<NP><m><sg>{^hole<n><sg>/agujero<n><m><sg>$ ^unknown<PP>{^in<pr>/en<pr>$ ^unknown<DP><f><sg>{^the<det><def><sp>/el<det><def><GD><ND>$ ^unknown<NP><f><sg>{^ground<n><sg>/tierra<n><f><sg>$}$}$}$}$}$
Apply rule 3 (PP -> pr DP) in the second branch
  1. ^unknown<PP>{^In<pr>/En<pr>$ ^unknown<DP><m><sg>{^a<det><ind><sg>/uno<det><ind><GD><sg>$ ^unknown<NP><m><sg>{^hole<n><sg>/agujero<n><m><sg>$}$}$}$
  2. ^unknown<PP>{^in<pr>/en<pr>$ ^unknown<DP><f><sg>{^the<det><def><sp>/el<det><def><GD><ND>$ ^unknown<NP><f><sg>{^ground<n><sg>/tierra<n><f><sg>$}$}$}$

Weight: 10

  1. ^unknown<PP>{^In<pr>/En<pr>$ ^unknown<DP><m><sg>{^a<det><ind><sg>/uno<det><ind><GD><sg>$ ^unknown<NP><m><sg>{^hole<n><sg>/agujero<n><m><sg>$ ^unknown<PP>{^in<pr>/en<pr>$ ^unknown<DP><f><sg>{^the<det><def><sp>/el<det><def><GD><ND>$ ^unknown<NP><f><sg>{^ground<n><sg>/tierra<n><f><sg>$}$}$}$}$}$}$
Read token
  1. ^unknown<PP>{^In<pr>/En<pr>$ ^unknown<DP><m><sg>{^a<det><ind><sg>/uno<det><ind><GD><sg>$ ^unknown<NP><m><sg>{^hole<n><sg>/agujero<n><m><sg>$}$}$}$
  2. ^unknown<PP>{^in<pr>/en<pr>$ ^unknown<DP><f><sg>{^the<det><def><sp>/el<det><def><GD><ND>$ ^unknown<NP><f><sg>{^ground<n><sg>/tierra<n><f><sg>$}$}$}$
  3. ^there<adv>/allí<adv>$

Weight: 10

  1. ^unknown<PP>{^In<pr>/En<pr>$ ^unknown<DP><m><sg>{^a<det><ind><sg>/uno<det><ind><GD><sg>$ ^unknown<NP><m><sg>{^hole<n><sg>/agujero<n><m><sg>$ ^unknown<PP>{^in<pr>/en<pr>$ ^unknown<DP><f><sg>{^the<det><def><sp>/el<det><def><GD><ND>$ ^unknown<NP><f><sg>{^ground<n><sg>/tierra<n><f><sg>$}$}$}$}$}$}$
  2. ^there<adv>/allí<adv>$
Read token
  1. ^unknown<PP>{^In<pr>/En<pr>$ ^unknown<DP><m><sg>{^a<det><ind><sg>/uno<det><ind><GD><sg>$ ^unknown<NP><m><sg>{^hole<n><sg>/agujero<n><m><sg>$}$}$}$
  2. ^unknown<PP>{^in<pr>/en<pr>$ ^unknown<DP><f><sg>{^the<det><def><sp>/el<det><def><GD><ND>$ ^unknown<NP><f><sg>{^ground<n><sg>/tierra<n><f><sg>$}$}$}$
  3. ^there<adv>/allí<adv>$
  4. ^live<vblex><past>/vivir<vblex><past>$

Weight: 10

  1. ^unknown<PP>{^In<pr>/En<pr>$ ^unknown<DP><m><sg>{^a<det><ind><sg>/uno<det><ind><GD><sg>$ ^unknown<NP><m><sg>{^hole<n><sg>/agujero<n><m><sg>$ ^unknown<PP>{^in<pr>/en<pr>$ ^unknown<DP><f><sg>{^the<det><def><sp>/el<det><def><GD><ND>$ ^unknown<NP><f><sg>{^ground<n><sg>/tierra<n><f><sg>$}$}$}$}$}$}$
  2. ^there<adv>/allí<adv>$
  3. ^live<vblex><past>/vivir<vblex><past>$
Read token
  1. ^unknown<PP>{^In<pr>/En<pr>$ ^unknown<DP><m><sg>{^a<det><ind><sg>/uno<det><ind><GD><sg>$ ^unknown<NP><m><sg>{^hole<n><sg>/agujero<n><m><sg>$}$}$}$
  2. ^unknown<PP>{^in<pr>/en<pr>$ ^unknown<DP><f><sg>{^the<det><def><sp>/el<det><def><GD><ND>$ ^unknown<NP><f><sg>{^ground<n><sg>/tierra<n><f><sg>$}$}$}$
  3. ^there<adv>/allí<adv>$
  4. ^live<vblex><past>/vivir<vblex><past>$
  5. ^a<det><ind><sg>/uno<det><ind><GD><sg>$

Weight: 10

  1. ^unknown<PP>{^In<pr>/En<pr>$ ^unknown<DP><m><sg>{^a<det><ind><sg>/uno<det><ind><GD><sg>$ ^unknown<NP><m><sg>{^hole<n><sg>/agujero<n><m><sg>$ ^unknown<PP>{^in<pr>/en<pr>$ ^unknown<DP><f><sg>{^the<det><def><sp>/el<det><def><GD><ND>$ ^unknown<NP><f><sg>{^ground<n><sg>/tierra<n><f><sg>$}$}$}$}$}$}$
  2. ^there<adv>/allí<adv>$
  3. ^live<vblex><past>/vivir<vblex><past>$
  4. ^a<det><ind><sg>/uno<det><ind><GD><sg>$
Read token
  1. ^unknown<PP>{^In<pr>/En<pr>$ ^unknown<DP><m><sg>{^a<det><ind><sg>/uno<det><ind><GD><sg>$ ^unknown<NP><m><sg>{^hole<n><sg>/agujero<n><m><sg>$}$}$}$
  2. ^unknown<PP>{^in<pr>/en<pr>$ ^unknown<DP><f><sg>{^the<det><def><sp>/el<det><def><GD><ND>$ ^unknown<NP><f><sg>{^ground<n><sg>/tierra<n><f><sg>$}$}$}$
  3. ^there<adv>/allí<adv>$
  4. ^live<vblex><past>/vivir<vblex><past>$
  5. ^a<det><ind><sg>/uno<det><ind><GD><sg>$
  6. ^Hobbit<n><sg>/Hobbit<n><m><sg>$

Weight: 10

  1. ^unknown<PP>{^In<pr>/En<pr>$ ^unknown<DP><m><sg>{^a<det><ind><sg>/uno<det><ind><GD><sg>$ ^unknown<NP><m><sg>{^hole<n><sg>/agujero<n><m><sg>$ ^unknown<PP>{^in<pr>/en<pr>$ ^unknown<DP><f><sg>{^the<det><def><sp>/el<det><def><GD><ND>$ ^unknown<NP><f><sg>{^ground<n><sg>/tierra<n><f><sg>$}$}$}$}$}$}$
  2. ^there<adv>/allí<adv>$
  3. ^live<vblex><past>/vivir<vblex><past>$
  4. ^a<det><ind><sg>/uno<det><ind><GD><sg>$
  5. ^Hobbit<n><sg>/Hobbit<n><m><sg>$
Apply rule 1 (NP -> n) in both branches
  1. ^unknown<PP>{^In<pr>/En<pr>$ ^unknown<DP><m><sg>{^a<det><ind><sg>/uno<det><ind><GD><sg>$ ^unknown<NP><m><sg>{^hole<n><sg>/agujero<n><m><sg>$}$}$}$
  2. ^unknown<PP>{^in<pr>/en<pr>$ ^unknown<DP><f><sg>{^the<det><def><sp>/el<det><def><GD><ND>$ ^unknown<NP><f><sg>{^ground<n><sg>/tierra<n><f><sg>$}$}$}$
  3. ^there<adv>/allí<adv>$
  4. ^live<vblex><past>/vivir<vblex><past>$
  5. ^a<det><ind><sg>/uno<det><ind><GD><sg>$
  6. ^unknown<NP><m><sg>{^Hobbit<n><sg>/Hobbit<n><m><sg>$}$

Weight: 10

  1. ^unknown<PP>{^In<pr>/En<pr>$ ^unknown<DP><m><sg>{^a<det><ind><sg>/uno<det><ind><GD><sg>$ ^unknown<NP><m><sg>{^hole<n><sg>/agujero<n><m><sg>$ ^unknown<PP>{^in<pr>/en<pr>$ ^unknown<DP><f><sg>{^the<det><def><sp>/el<det><def><GD><ND>$ ^unknown<NP><f><sg>{^ground<n><sg>/tierra<n><f><sg>$}$}$}$}$}$}$
  2. ^there<adv>/allí<adv>$
  3. ^live<vblex><past>/vivir<vblex><past>$
  4. ^a<det><ind><sg>/uno<det><ind><GD><sg>$
  5. ^unknown<NP><m><sg>{^Hobbit<n><sg>/Hobbit<n><m><sg>$}$
Apply rule 4 (DP -> det NP) in both branches
  1. ^unknown<PP>{^In<pr>/En<pr>$ ^unknown<DP><m><sg>{^a<det><ind><sg>/uno<det><ind><GD><sg>$ ^unknown<NP><m><sg>{^hole<n><sg>/agujero<n><m><sg>$}$}$}$
  2. ^unknown<PP>{^in<pr>/en<pr>$ ^unknown<DP><f><sg>{^the<det><def><sp>/el<det><def><GD><ND>$ ^unknown<NP><f><sg>{^ground<n><sg>/tierra<n><f><sg>$}$}$}$
  3. ^there<adv>/allí<adv>$
  4. ^live<vblex><past>/vivir<vblex><past>$
  5. ^unknown<DP><m><sg>{^a<det><ind><sg>/uno<det><ind><GD><sg>$ ^unknown<NP><m><sg>{^Hobbit<n><sg>/Hobbit<n><m><sg>$}$}$

Weight: 10

  1. ^unknown<PP>{^In<pr>/En<pr>$ ^unknown<DP><m><sg>{^a<det><ind><sg>/uno<det><ind><GD><sg>$ ^unknown<NP><m><sg>{^hole<n><sg>/agujero<n><m><sg>$ ^unknown<PP>{^in<pr>/en<pr>$ ^unknown<DP><f><sg>{^the<det><def><sp>/el<det><def><GD><ND>$ ^unknown<NP><f><sg>{^ground<n><sg>/tierra<n><f><sg>$}$}$}$}$}$}$
  2. ^there<adv>/allí<adv>$
  3. ^live<vblex><past>/vivir<vblex><past>$
  4. ^unknown<DP><m><sg>{^a<det><ind><sg>/uno<det><ind><GD><sg>$ ^unknown<NP><m><sg>{^Hobbit<n><sg>/Hobbit<n><m><sg>$}$}$
Apply rule 5 (VP -> vblex DP) in both branches
  1. ^unknown<PP>{^In<pr>/En<pr>$ ^unknown<DP><m><sg>{^a<det><ind><sg>/uno<det><ind><GD><sg>$ ^unknown<NP><m><sg>{^hole<n><sg>/agujero<n><m><sg>$}$}$}$
  2. ^unknown<PP>{^in<pr>/en<pr>$ ^unknown<DP><f><sg>{^the<det><def><sp>/el<det><def><GD><ND>$ ^unknown<NP><f><sg>{^ground<n><sg>/tierra<n><f><sg>$}$}$}$
  3. ^there<adv>/allí<adv>$
  4. ^unknown<VP><past><PD><ND>{^live<vblex><past>/vivir<vblex><past>$ ^unknown<DP><m><sg>{^a<det><ind><sg>/uno<det><ind><GD><sg>$ ^unknown<NP><m><sg>{^Hobbit<n><sg>/Hobbit<n><m><sg>$}$}$}$

Weight: 10

  1. ^unknown<PP>{^In<pr>/En<pr>$ ^unknown<DP><m><sg>{^a<det><ind><sg>/uno<det><ind><GD><sg>$ ^unknown<NP><m><sg>{^hole<n><sg>/agujero<n><m><sg>$ ^unknown<PP>{^in<pr>/en<pr>$ ^unknown<DP><f><sg>{^the<det><def><sp>/el<det><def><GD><ND>$ ^unknown<NP><f><sg>{^ground<n><sg>/tierra<n><f><sg>$}$}$}$}$}$}$
  2. ^there<adv>/allí<adv>$
  3. ^unknown<VP><past><PD><ND>{^live<vblex><past>/vivir<vblex><past>$ ^unknown<DP><m><sg>{^a<det><ind><sg>/uno<det><ind><GD><sg>$ ^unknown<NP><m><sg>{^Hobbit<n><sg>/Hobbit<n><m><sg>$}$}$}$
VP wants tense, person, and number tags. The verb supplies tense, but it doesn't have person or number tags, so the defaults are used instead.
Apply rule 6 (VP -> adv VP) in both branches
  1. ^unknown<PP>{^In<pr>/En<pr>$ ^unknown<DP><m><sg>{^a<det><ind><sg>/uno<det><ind><GD><sg>$ ^unknown<NP><m><sg>{^hole<n><sg>/agujero<n><m><sg>$}$}$}$
  2. ^unknown<PP>{^in<pr>/en<pr>$ ^unknown<DP><f><sg>{^the<det><def><sp>/el<det><def><GD><ND>$ ^unknown<NP><f><sg>{^ground<n><sg>/tierra<n><f><sg>$}$}$}$
  3. ^unknown<VP><past><PD><ND>{^there<adv>/allí<adv>$ ^unknown<VP><past><PD><ND>{^live<vblex><past>/vivir<vblex><past>$ ^unknown<DP><m><sg>{^a<det><ind><sg>/uno<det><ind><GD><sg>$ ^unknown<NP><m><sg>{^Hobbit<n><sg>/Hobbit<n><m><sg>$}$}$}$}$

Weight: 10

  1. ^unknown<PP>{^In<pr>/En<pr>$ ^unknown<DP><m><sg>{^a<det><ind><sg>/uno<det><ind><GD><sg>$ ^unknown<NP><m><sg>{^hole<n><sg>/agujero<n><m><sg>$ ^unknown<PP>{^in<pr>/en<pr>$ ^unknown<DP><f><sg>{^the<det><def><sp>/el<det><def><GD><ND>$ ^unknown<NP><f><sg>{^ground<n><sg>/tierra<n><f><sg>$}$}$}$}$}$}$
  2. ^unknown<VP><past><PD><ND>{^there<adv>/allí<adv>$ ^unknown<VP><past><PD><ND>{^live<vblex><past>/vivir<vblex><past>$ ^unknown<DP><m><sg>{^a<det><ind><sg>/uno<det><ind><GD><sg>$ ^unknown<NP><m><sg>{^Hobbit<n><sg>/Hobbit<n><m><sg>$}$}$}$}$
Apply rule 7 (VP -> PP VP) in the first branch
  1. ^unknown<PP>{^In<pr>/En<pr>$ ^unknown<DP><m><sg>{^a<det><ind><sg>/uno<det><ind><GD><sg>$ ^unknown<NP><m><sg>{^hole<n><sg>/agujero<n><m><sg>$}$}$}$
  2. ^unknown<VP><past><PD><ND>{^unknown<PP>{^in<pr>/en<pr>$ ^unknown<DP><f><sg>{^the<det><def><sp>/el<det><def><GD><ND>$ ^unknown<NP><f><sg>{^ground<n><sg>/tierra<n><f><sg>$}$}$}$ ^unknown<VP><past><PD><ND>{^there<adv>/allí<adv>$ ^unknown<VP><past><PD><ND>{^live<vblex><past>/vivir<vblex><past>$ ^unknown<DP><m><sg>{^a<det><ind><sg>/uno<det><ind><GD><sg>$ ^unknown<NP><m><sg>{^Hobbit<n><sg>/Hobbit<n><m><sg>$}$}$}$}$}$

Weight: 10

  1. ^unknown<PP>{^In<pr>/En<pr>$ ^unknown<DP><m><sg>{^a<det><ind><sg>/uno<det><ind><GD><sg>$ ^unknown<NP><m><sg>{^hole<n><sg>/agujero<n><m><sg>$ ^unknown<PP>{^in<pr>/en<pr>$ ^unknown<DP><f><sg>{^the<det><def><sp>/el<det><def><GD><ND>$ ^unknown<NP><f><sg>{^ground<n><sg>/tierra<n><f><sg>$}$}$}$}$}$}$
  2. ^unknown<VP><past><PD><ND>{^there<adv>/allí<adv>$ ^unknown<VP><past><PD><ND>{^live<vblex><past>/vivir<vblex><past>$ ^unknown<DP><m><sg>{^a<det><ind><sg>/uno<det><ind><GD><sg>$ ^unknown<NP><m><sg>{^Hobbit<n><sg>/Hobbit<n><m><sg>$}$}$}$}$
Apply rule 7 (VP -> PP VP) in the first branch
  1. ^unknown<VP><past><PD><ND>{^unknown<PP>{^In<pr>/En<pr>$ ^unknown<DP><m><sg>{^a<det><ind><sg>/uno<det><ind><GD><sg>$ ^unknown<NP><m><sg>{^hole<n><sg>/agujero<n><m><sg>$}$}$}$ ^unknown<VP><past><PD><ND>{^unknown<PP>{^in<pr>/en<pr>$ ^unknown<DP><f><sg>{^the<det><def><sp>/el<det><def><GD><ND>$ ^unknown<NP><f><sg>{^ground<n><sg>/tierra<n><f><sg>$}$}$}$ ^unknown<VP><past><PD><ND>{^there<adv>/allí<adv>$ ^unknown<VP><past><PD><ND>{^live<vblex><past>/vivir<vblex><past>$ ^unknown<DP><m><sg>{^a<det><ind><sg>/uno<det><ind><GD><sg>$ ^unknown<NP><m><sg>{^Hobbit<n><sg>/Hobbit<n><m><sg>$}$}$}$}$}$}$

Weight: 10

  1. ^unknown<PP>{^In<pr>/En<pr>$ ^unknown<DP><m><sg>{^a<det><ind><sg>/uno<det><ind><GD><sg>$ ^unknown<NP><m><sg>{^hole<n><sg>/agujero<n><m><sg>$ ^unknown<PP>{^in<pr>/en<pr>$ ^unknown<DP><f><sg>{^the<det><def><sp>/el<det><def><GD><ND>$ ^unknown<NP><f><sg>{^ground<n><sg>/tierra<n><f><sg>$}$}$}$}$}$}$
  2. ^unknown<VP><past><PD><ND>{^there<adv>/allí<adv>$ ^unknown<VP><past><PD><ND>{^live<vblex><past>/vivir<vblex><past>$ ^unknown<DP><m><sg>{^a<det><ind><sg>/uno<det><ind><GD><sg>$ ^unknown<NP><m><sg>{^Hobbit<n><sg>/Hobbit<n><m><sg>$}$}$}$}$
Apply rule 7 (VP -> PP VP) in the second branch
  1. ^unknown<VP><past><PD><ND>{^unknown<PP>{^In<pr>/En<pr>$ ^unknown<DP><m><sg>{^a<det><ind><sg>/uno<det><ind><GD><sg>$ ^unknown<NP><m><sg>{^hole<n><sg>/agujero<n><m><sg>$}$}$}$ ^unknown<VP><past><PD><ND>{^unknown<PP>{^in<pr>/en<pr>$ ^unknown<DP><f><sg>{^the<det><def><sp>/el<det><def><GD><ND>$ ^unknown<NP><f><sg>{^ground<n><sg>/tierra<n><f><sg>$}$}$}$ ^unknown<VP><past><PD><ND>{^there<adv>/allí<adv>$ ^unknown<VP><past><PD><ND>{^live<vblex><past>/vivir<vblex><past>$ ^unknown<DP><m><sg>{^a<det><ind><sg>/uno<det><ind><GD><sg>$ ^unknown<NP><m><sg>{^Hobbit<n><sg>/Hobbit<n><m><sg>$}$}$}$}$}$}$

Weight: 10

  1. ^unknown<VP><past><PD><ND>{^unknown<PP>{^In<pr>/En<pr>$ ^unknown<DP><m><sg>{^a<det><ind><sg>/uno<det><ind><GD><sg>$ ^unknown<NP><m><sg>{^hole<n><sg>/agujero<n><m><sg>$ ^unknown<PP>{^in<pr>/en<pr>$ ^unknown<DP><f><sg>{^the<det><def><sp>/el<det><def><GD><ND>$ ^unknown<NP><f><sg>{^ground<n><sg>/tierra<n><f><sg>$}$}$}$}$}$}$ ^unknown<VP><past><PD><ND>{^there<adv>/allí<adv>$ ^unknown<VP><past><PD><ND>{^live<vblex><past>/vivir<vblex><past>$ ^unknown<DP><m><sg>{^a<det><ind><sg>/uno<det><ind><GD><sg>$ ^unknown<NP><m><sg>{^Hobbit<n><sg>/Hobbit<n><m><sg>$}$}$}$}$}$
Prune branches Weight: 10
  1. ^unknown<VP><past><PD><ND>{^unknown<PP>{^In<pr>/En<pr>$ ^unknown<DP><m><sg>{^a<det><ind><sg>/uno<det><ind><GD><sg>$ ^unknown<NP><m><sg>{^hole<n><sg>/agujero<n><m><sg>$ ^unknown<PP>{^in<pr>/en<pr>$ ^unknown<DP><f><sg>{^the<det><def><sp>/el<det><def><GD><ND>$ ^unknown<NP><f><sg>{^ground<n><sg>/tierra<n><f><sg>$}$}$}$}$}$}$ ^unknown<VP><past><PD><ND>{^there<adv>/allí<adv>$ ^unknown<VP><past><PD><ND>{^live<vblex><past>/vivir<vblex><past>$ ^unknown<DP><m><sg>{^a<det><ind><sg>/uno<det><ind><GD><sg>$ ^unknown<NP><m><sg>{^Hobbit<n><sg>/Hobbit<n><m><sg>$}$}$}$}$}$
No rules begin with VP, so it's time to output. Both rules have the same number of trees (1), but the second one has higher weight (10), so the first one gets discarded and we output the second one.
Apply output side of rule 7 (VP -> PP VP)
  1. ^unknown<PP>{^In<pr>/En<pr>$ ^unknown<DP><m><sg>{^a<det><ind><sg>/uno<det><ind><GD><sg>$ ^unknown<NP><m><sg>{^hole<n><sg>/agujero<n><m><sg>$ ^unknown<PP>{^in<pr>/en<pr>$ ^unknown<DP><f><sg>{^the<det><def><sp>/el<det><def><GD><ND>$ ^unknown<NP><f><sg>{^ground<n><sg>/tierra<n><f><sg>$}$}$}$}$}$}$
  2. ^unknown<VP><past><p3><sg>{^there<adv>/allí<adv>$ ^unknown<VP><past><PD><ND>{^live<vblex><past>/vivir<vblex><past>$ ^unknown<DP><m><sg>{^a<det><ind><sg>/uno<det><ind><GD><sg>$ ^unknown<NP><m><sg>{^Hobbit<n><sg>/Hobbit<n><m><sg>$}$}$}$}$
At output, the unspecified tags PD and ND are replaced with the defaults p3 and sg.
Apply output side of rule 3 (PP -> pr DP)
  1. ^En<pr>$
  2. ^unknown<DP><m><sg>{^a<det><ind><sg>/uno<det><ind><GD><sg>$ ^unknown<NP><m><sg>{^hole<n><sg>/agujero<n><m><sg>$ ^unknown<PP>{^in<pr>/en<pr>$ ^unknown<DP><f><sg>{^the<det><def><sp>/el<det><def><GD><ND>$ ^unknown<NP><f><sg>{^ground<n><sg>/tierra<n><f><sg>$}$}$}$}$}$
  3. ^unknown<VP><past><p3><sg>{^there<adv>/allí<adv>$ ^unknown<VP><past><PD><ND>{^live<vblex><past>/vivir<vblex><past>$ ^unknown<DP><m><sg>{^a<det><ind><sg>/uno<det><ind><GD><sg>$ ^unknown<NP><m><sg>{^Hobbit<n><sg>/Hobbit<n><m><sg>$}$}$}$}$
Output first word
  1. ^unknown<DP><m><sg>{^a<det><ind><sg>/uno<det><ind><GD><sg>$ ^unknown<NP><m><sg>{^hole<n><sg>/agujero<n><m><sg>$ ^unknown<PP>{^in<pr>/en<pr>$ ^unknown<DP><f><sg>{^the<det><def><sp>/el<det><def><GD><ND>$ ^unknown<NP><f><sg>{^ground<n><sg>/tierra<n><f><sg>$}$}$}$}$}$
  2. ^unknown<VP><past><p3><sg>{^there<adv>/allí<adv>$ ^unknown<VP><past><PD><ND>{^live<vblex><past>/vivir<vblex><past>$ ^unknown<DP><m><sg>{^a<det><ind><sg>/uno<det><ind><GD><sg>$ ^unknown<NP><m><sg>{^Hobbit<n><sg>/Hobbit<n><m><sg>$}$}$}$}$
The preposition wasn't built by a rule, so we just write it to the output stream.
Apply output side of rule 4 (DP -> det NP)
  1. ^uno<det><ind><m><sg>$
  2. ^unknown<NP><m><sg>{^hole<n><sg>/agujero<n><m><sg>$ ^unknown<PP>{^in<pr>/en<pr>$ ^unknown<DP><f><sg>{^the<det><def><sp>/el<det><def><GD><ND>$ ^unknown<NP><f><sg>{^ground<n><sg>/tierra<n><f><sg>$}$}$}$}$
  3. ^unknown<VP><past><p3><sg>{^there<adv>/allí<adv>$ ^unknown<VP><past><PD><ND>{^live<vblex><past>/vivir<vblex><past>$ ^unknown<DP><m><sg>{^a<det><ind><sg>/uno<det><ind><GD><sg>$ ^unknown<NP><m><sg>{^Hobbit<n><sg>/Hobbit<n><m><sg>$}$}$}$}$
Here the gender and the number of NP are copied to the determiner.
Output first word
  1. ^unknown<NP><m><sg>{^hole<n><sg>/agujero<n><m><sg>$ ^unknown<PP>{^in<pr>/en<pr>$ ^unknown<DP><f><sg>{^the<det><def><sp>/el<det><def><GD><ND>$ ^unknown<NP><f><sg>{^ground<n><sg>/tierra<n><f><sg>$}$}$}$}$
  2. ^unknown<VP><past><p3><sg>{^there<adv>/allí<adv>$ ^unknown<VP><past><PD><ND>{^live<vblex><past>/vivir<vblex><past>$ ^unknown<DP><m><sg>{^a<det><ind><sg>/uno<det><ind><GD><sg>$ ^unknown<NP><m><sg>{^Hobbit<n><sg>/Hobbit<n><m><sg>$}$}$}$}$
Apply output side of rule 2 (NP -> n PP)
  1. ^agujero<n><m><sg>$
  2. ^unknown<PP>{^in<pr>/en<pr>$ ^unknown<DP><f><sg>{^the<det><def><sp>/el<det><def><GD><ND>$ ^unknown<NP><f><sg>{^ground<n><sg>/tierra<n><f><sg>$}$}$}$
  3. ^unknown<VP><past><p3><sg>{^there<adv>/allí<adv>$ ^unknown<VP><past><PD><ND>{^live<vblex><past>/vivir<vblex><past>$ ^unknown<DP><m><sg>{^a<det><ind><sg>/uno<det><ind><GD><sg>$ ^unknown<NP><m><sg>{^Hobbit<n><sg>/Hobbit<n><m><sg>$}$}$}$}$
Output first word
  1. ^unknown<PP>{^in<pr>/en<pr>$ ^unknown<DP><f><sg>{^the<det><def><sp>/el<det><def><GD><ND>$ ^unknown<NP><f><sg>{^ground<n><sg>/tierra<n><f><sg>$}$}$}$
  2. ^unknown<VP><past><p3><sg>{^there<adv>/allí<adv>$ ^unknown<VP><past><PD><ND>{^live<vblex><past>/vivir<vblex><past>$ ^unknown<DP><m><sg>{^a<det><ind><sg>/uno<det><ind><GD><sg>$ ^unknown<NP><m><sg>{^Hobbit<n><sg>/Hobbit<n><m><sg>$}$}$}$}$
Apply output side of rule 3 (PP -> pr DP)
  1. ^en<pr>$
  2. ^unknown<DP><f><sg>{^the<det><def><sp>/el<det><def><GD><ND>$ ^unknown<NP><f><sg>{^ground<n><sg>/tierra<n><f><sg>$}$}$
  3. ^unknown<VP><past><p3><sg>{^there<adv>/allí<adv>$ ^unknown<VP><past><PD><ND>{^live<vblex><past>/vivir<vblex><past>$ ^unknown<DP><m><sg>{^a<det><ind><sg>/uno<det><ind><GD><sg>$ ^unknown<NP><m><sg>{^Hobbit<n><sg>/Hobbit<n><m><sg>$}$}$}$}$
Output first word
  1. ^unknown<DP><f><sg>{^the<det><def><sp>/el<det><def><GD><ND>$ ^unknown<NP><f><sg>{^ground<n><sg>/tierra<n><f><sg>$}$}$
  2. ^unknown<VP><past><p3><sg>{^there<adv>/allí<adv>$ ^unknown<VP><past><PD><ND>{^live<vblex><past>/vivir<vblex><past>$ ^unknown<DP><m><sg>{^a<det><ind><sg>/uno<det><ind><GD><sg>$ ^unknown<NP><m><sg>{^Hobbit<n><sg>/Hobbit<n><m><sg>$}$}$}$}$
Apply output side of rule 4 (DP -> det NP)
  1. ^el<det><def><f><sg>$
  2. ^unknown<NP><f><sg>{^ground<n><sg>/tierra<n><f><sg>$}$
  3. ^unknown<VP><past><p3><sg>{^there<adv>/allí<adv>$ ^unknown<VP><past><PD><ND>{^live<vblex><past>/vivir<vblex><past>$ ^unknown<DP><m><sg>{^a<det><ind><sg>/uno<det><ind><GD><sg>$ ^unknown<NP><m><sg>{^Hobbit<n><sg>/Hobbit<n><m><sg>$}$}$}$}$
Once again we copy the gender and number of the NP to the determiner.
Output first word
  1. ^unknown<NP><f><sg>{^ground<n><sg>/tierra<n><f><sg>$}$
  2. ^unknown<VP><past><p3><sg>{^there<adv>/allí<adv>$ ^unknown<VP><past><PD><ND>{^live<vblex><past>/vivir<vblex><past>$ ^unknown<DP><m><sg>{^a<det><ind><sg>/uno<det><ind><GD><sg>$ ^unknown<NP><m><sg>{^Hobbit<n><sg>/Hobbit<n><m><sg>$}$}$}$}$
Apply output side of rule 1 (NP -> n)
  1. ^tierra<n><f><sg>$
  2. ^unknown<VP><past><p3><sg>{^there<adv>/allí<adv>$ ^unknown<VP><past><PD><ND>{^live<vblex><past>/vivir<vblex><past>$ ^unknown<DP><m><sg>{^a<det><ind><sg>/uno<det><ind><GD><sg>$ ^unknown<NP><m><sg>{^Hobbit<n><sg>/Hobbit<n><m><sg>$}$}$}$}$
Output first word
  1. ^unknown<VP><past><p3><sg>{^there<adv>/allí<adv>$ ^unknown<VP><past><PD><ND>{^live<vblex><past>/vivir<vblex><past>$ ^unknown<DP><m><sg>{^a<det><ind><sg>/uno<det><ind><GD><sg>$ ^unknown<NP><m><sg>{^Hobbit<n><sg>/Hobbit<n><m><sg>$}$}$}$}$
Apply output side of rule 6 (VP -> adv VP)
  1. ^unknown<VP><past><p3><sg>{^live<vblex><past>/vivir<vblex><past>$ ^unknown<DP><m><sg>{^a<det><ind><sg>/uno<det><ind><GD><sg>$ ^unknown<NP><m><sg>{^Hobbit<n><sg>/Hobbit<n><m><sg>$}$}$}$
Since the source language lemma of the adverb is "there", we take the first clause of the if statement and only output the VP, which takes all its tags from the parent chunk.
Apply output side of rule 5 (VP -> vblex DP)
  1. ^vivir<vblex><past><p3><sg>$
  2. ^unknown<DP><m><sg>{^a<det><ind><sg>/uno<det><ind><GD><sg>$ ^unknown<NP><m><sg>{^Hobbit<n><sg>/Hobbit<n><m><sg>$}$}$
As with the previous line, the verb gets all its tags from the parent chunk, but in this rule we've explicitly listed them.
Output first word
  1. ^unknown<DP><m><sg>{^a<det><ind><sg>/uno<det><ind><GD><sg>$ ^unknown<NP><m><sg>{^Hobbit<n><sg>/Hobbit<n><m><sg>$}$}$
Apply output side of rule 4 (DP -> det NP)
  1. ^uno<det><ind><m><sg>$
  2. ^unknown<NP><m><sg>{^Hobbit<n><sg>/Hobbit<n><m><sg>$}$
Output first word
  1. ^unknown<NP><m><sg>{^Hobbit<n><sg>/Hobbit<n><m><sg>$}$
Apply output side of rule 1 (NP -> n)
  1. ^Hobbit<n><m><sg>$
Output first word
Read token
  1. ^.<sent>/.<sent>$
Output first word No rules apply to punctuation in this example, so we just immediately output it when we see it.
Read token
  1. ^.<sent>/.<sent>$
Output first word

[edit] Output of Transfer

^En<pr>$ ^uno<det><ind><m><sg>$ ^agujero<n><m><sg>$ ^en<pr>$ ^el<det><def><f><sg>$ ^tierra<n><f><sg>$ ^vivir<vblex><ifi><p3><sg>$ ^uno<det><ind><m><sg>$ ^Hobbit<n><m><sg>$^.<sent>$^.<sent>$

[edit] Overall Output

En un agujero en la tierra vivió un Hobbit.
Personal tools