Difference between revisions of "Unigram tagger"
Line 7: | Line 7: | ||
</pre> |
</pre> |
||
Then, see [[Minimal installation from SVN#Set up environment]]. Finally, configure, build, and install m5w/apertium. See [[Minimal installation from SVN#Configure, build, and install]]. |
Then, see [[Minimal installation from SVN#Set up environment]]. Finally, configure, build, and install m5w/apertium. See [[Minimal installation from SVN#Configure, build, and install]]. |
||
+ | ==Usage== |
||
− | |||
+ | See <code>apertium-tagger -h</code>. |
||
+ | ===Training a Model on a Hand-Tagged Corpus=== |
||
+ | First, get a hand-tagged corpus as one would for all other models. |
||
+ | <pre> |
||
+ | ^a/a<a>$ |
||
+ | ^a/a<b>$ |
||
+ | ^a/a<b>$ |
||
+ | ^aa/a<a>+a<a>$ |
||
+ | ^aa/a<a>+a<b>$ |
||
+ | ^aa/a<a>+a<b>$ |
||
+ | ^aa/a<b>+a<a>$ |
||
+ | ^aa/a<b>+a<a>$ |
||
+ | ^aa/a<b>+a<a>$ |
||
+ | ^aa/a<b>+a<b>$ |
||
+ | ^aa/a<b>+a<b>$ |
||
+ | ^aa/a<b>+a<b>$ |
||
+ | ^aa/a<b>+a<b>$ |
||
+ | </pre> |
||
+ | ''Example: a Hand-Tagged Corpus for <code>apertium-tagger</code>'' |
||
==Unigram Models== |
==Unigram Models== |
||
This code's <code>apertium-tagger</code> implements the three unigram models in [http://coltekin.net/cagri/papers/trmorph-tools.pdf A set of open-source tools for Turkish natural language processing]. See section 5.3. |
This code's <code>apertium-tagger</code> implements the three unigram models in [http://coltekin.net/cagri/papers/trmorph-tools.pdf A set of open-source tools for Turkish natural language processing]. See section 5.3. |
Revision as of 15:58, 14 January 2016
m5w/apertium's apertium-tagger
supports all A set of open-source tools for Turkish natural language processing's unigram models.
Contents
Install
First, install all prerequisites. See Installation#If you want to add language data / do more advanced stuff.
Then, replace <directory>
with the directory you'd like to clone m5w/apertium into and clone the repository.
git clone https://github.com/m5w/apertium.git <directory>
Then, see Minimal installation from SVN#Set up environment. Finally, configure, build, and install m5w/apertium. See Minimal installation from SVN#Configure, build, and install.
Usage
See apertium-tagger -h
.
Training a Model on a Hand-Tagged Corpus
First, get a hand-tagged corpus as one would for all other models.
^a/a<a>$ ^a/a<b>$ ^a/a<b>$ ^aa/a<a>+a<a>$ ^aa/a<a>+a<b>$ ^aa/a<a>+a<b>$ ^aa/a<b>+a<a>$ ^aa/a<b>+a<a>$ ^aa/a<b>+a<a>$ ^aa/a<b>+a<b>$ ^aa/a<b>+a<b>$ ^aa/a<b>+a<b>$ ^aa/a<b>+a<b>$
Example: a Hand-Tagged Corpus for apertium-tagger
Unigram Models
This code's apertium-tagger
implements the three unigram models in A set of open-source tools for Turkish natural language processing. See section 5.3.
Model 1
See section 5.3.1. This model scores each analysis string in proportion to its frequency with add-one smoothing. Consider the following corpus.
^a/a<a>$ ^a/a<b>$ ^a/a<b>$
Passed the lexical unit ^a/a<a>/a<b>/a<c>$
, the tagger assigns the analysis string a<a>
a score of
f + 1 = (1) + 1 = 2
and a<b>
a score of (2) + 1 = 3
. The unknown analysis string a<c>
is assigned a score of 1
.
If reconfigured with --enable-debug
, the tagger prints such calculations to stderr.
score("a<a>") == 2 == 2.000000000000000000 score("a<b>") == 3 == 3.000000000000000000 score("a<c>") == 1 == 1.000000000000000000 ^a<b>$