Morphological generator

From LING073
Revision as of 05:16, 16 February 2017 by Jwashin1 (talk | contribs) (Created page with "== Some useful symbols == The basic stuff: * <code>:</code> separates the lexc side of the transducer (left) from the output side (right); e.g. <code>%>:0</code> * <code>0...")

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Some useful symbols

The basic stuff:

  • : separates the lexc side of the transducer (left) from the output side (right); e.g. %>:0
  • 0 on the left side means empty output
  • _ is the location in which the rule is applied
  • <=> separates what gets mapped from the environment, and can be read as "where"
  • ; represents the end of an environment

Some more advanced stuff:

  • \ means "not" the thing after it
  • () means that the thing inside it is optional
  • [] groups blocks of things
  • | means "or"
  • * after a symbol (e.g., x:y* or [ … ]* means 0 to infinite occurrences of that thing

Some more tricks

You can use list multiple environments

x:y <=> _ :a ;
        b: _ ;

The rule above maps x to y before an output a and after an output b.

You can also exclude certain environments using the word except:

x:y <=> _ :a ;
    except
        b: _ ;

The rule above maps x to y before an output a unless it's after an output b.

You can do a whole bunch of pairs of symbols in the same environment using a single rule, like this:

TODO


Useful commands

See what lexc outputs

echo "life<n><pl>" | hfst-lookup .deps/eng.LR.lexc.hfst 

There should be a line like this:

> life<n><pl>	li{f}e>{e}s	0.000000

This shows that lexc part of the transducer maps house<n><> to house>{e}s.

Check what's being generated by the full transducer

echo "^life<n><pl>$" | apertium -d . -f none eng-gener

will output something like

lifes/lifees/lives/livees

Examples of rules

Remove a symbol

"

Choose an output for a symbol