| 1 |
.. _moduleDetails: |
| 2 |
|
| 3 |
Frog Modules |
| 4 |
-------------- |
| 5 |
|
| 6 |
Character encoding |
| 7 |
~~~~~~~~~~~~~~~~~~ |
| 8 |
|
| 9 |
Frog assumes the input text to be plain text in the UTF-8 character |
| 10 |
encoding. However, Frog offers the option to specify another character |
| 11 |
encoding as input with the option t -e. This options is passed on to the |
| 12 |
*Ucto* Tokenizer. It has some limitations, (see :ref:`Tokeniser`) and will be |
| 13 |
ignored when the Tokenizer is disabled. The character encodings are |
| 14 |
derived from the ubiquitous unix tool *iconv* [12]_. The output of Frog |
| 15 |
will always be in UTF-8 character encoding. Likewise, FoLiA XML defaults |
| 16 |
to UTF-8 as well. |
| 17 |
|
| 18 |
.. _Tokenizer |
| 19 |
|
| 20 |
Tokenizer |
| 21 |
~~~~~~~~~~ |
| 22 |
|
| 23 |
Frog uses the tokenization software *Ucto* [UCTO]_ for |
| 24 |
sentence boundary detection and to separate punctuation from words. In |
| 25 |
general, recognizing sentence boundaries and punctuation is a simple |
| 26 |
task but recognizing names and abbreviations is essential to perfom this |
| 27 |
task well. As shown in example [ex-frog-out], the tokenizer recognizes |
| 28 |
abbreviations such as z.g. and ‘41 and considers them to be one token. |
| 29 |
Ucto uses manually constructed rules and lists of Dutch names and |
| 30 |
abbreviations. Detailed information on Ucto can be found on |
| 31 |
https://languagemachines.github.io/ucto/. |
| 32 |
|
| 33 |
The tokenizer module in Frog can be adjusted in several ways. If the |
| 34 |
input text is already split on sentence boundaries and has one sentence |
| 35 |
per line, the -n option can be used to prevent Frog from changing the |
| 36 |
existing sentence boundaries. When sentence boundaries were already |
| 37 |
marked with a specific marker, one can specify this marker as –uttmarker |
| 38 |
“marker”. The marker strings will be ignored and their positions will be |
| 39 |
taken as sentence boundaries. |
| 40 |
|
| 41 |
If the input text is already fully tokenized, the tokenization step in |
| 42 |
Frog can be skipped altogether using the skip parameter –skip=t. [13]_ |
| 43 |
|
| 44 |
Multi-word units |
| 45 |
~~~~~~~~~~~~~~~~~ |
| 46 |
|
| 47 |
Frog recognizes certain special multi-word units (mwu) where a group of |
| 48 |
consecutive, related tokens is treated as one token. This behavior |
| 49 |
accommodates, and is in fact required for Frog’s dependency parser as it |
| 50 |
is trained on a data set with such multi-word units. In the output the |
| 51 |
parts of the multi-word unit will be connected with an underscore. The |
| 52 |
PoS-tag, morphological analysis, named entity label and chunk label are |
| 53 |
concatenated in the same manner. |
| 54 |
|
| 55 |
| This multi-word detection can be disabled using the option –skip=m. |
| 56 |
When using this option, each element of the MWU is treated as separate |
| 57 |
token. We shown an example sentence in [ex\_mwu] that has two |
| 58 |
multi-word units: *Albert Heijn* and *’s avonds*. |
| 59 |
|
| 60 |
+----+---------------+---------------+-------------------+------------------------------------------+----------+--------------+------------+ |
| 61 |
| [ex\_mwu] Sentence | Supermarkt Albert Heijn is tegenwoordig tot ’s avonds laat open. | |
| 62 |
+====+===============+===============+===================+==========================================+==========+==============+============+ |
| 63 |
| 1 | Supermarkt | supermarkt | [super][markt] | N(soort,ev,basis,zijd,stan) | 0.542056 | O | B_NP | |
| 64 |
+----+---------------+---------------+-------------------+------------------------------------------+----------+--------------+------------+ |
| 65 |
| 2 | Albert\_Heijn | Albert\_Heijn | [Albert]\_[Heijn] | SPEC(deeleigen)\_SPEC(deeleigen) | 1.000000 | B-ORG\_I-ORG | B-NP\_I-NP | |
| 66 |
+----+---------------+---------------+-------------------+------------------------------------------+----------+--------------+------------+ |
| 67 |
| 3 | is | zijn | [zijn] | WW(pv,tgw,ev) | 0.999150 | O | B-VP | |
| 68 |
+----+---------------+---------------+-------------------+------------------------------------------+----------+--------------+------------+ |
| 69 |
| 4 | tegenwoordig | tegenwoordig | [tegenwoordig] | ADJ(vrij,basis,zonder) | 0.994033 | O | B-ADVP | |
| 70 |
+----+---------------+---------------+-------------------+------------------------------------------+----------+--------------+------------+ |
| 71 |
| 5 | tot | tot | [tot] | VZ(init) | 0.964286 | O | B-PP | |
| 72 |
+----+---------------+---------------+-------------------+------------------------------------------+----------+--------------+------------+ |
| 73 |
| 6 | ’s\_avonds | ’s\_avond | [’s]\_[avond][s] | LID(bep,gen,evmo)\_N(soort,ev,basis,gen) | 0.962560 | O\_O | O\_B-ADVP | |
| 74 |
+----+---------------+---------------+-------------------+------------------------------------------+----------+--------------+------------+ |
| 75 |
| 7 | laat | laat | [laat] | ADJ(vrij,basis,zonder) | 1.000000 | O | B-VP | |
| 76 |
+----+---------------+---------------+-------------------+------------------------------------------+----------+--------------+------------+ |
| 77 |
| 8 | open | open | [open] | ADJ(vrij,basis,zonder) | 0.983755 | O | B-ADJP | |
| 78 |
+----+---------------+---------------+-------------------+------------------------------------------+----------+--------------+------------+ |
| 79 |
| 9 | . | . | [.] | LET() | 1.000000 | O | O | |
| 80 |
+----+---------------+---------------+-------------------+------------------------------------------+----------+--------------+------------+ |
| 81 |
|
| 82 |
Lemmatizer |
| 83 |
~~~~~~~~~~ |
| 84 |
|
| 85 |
The lemmatizer assigns the canonical form of a word to each word. For |
| 86 |
verbs the canonical form is the infinitive, and for nouns it is the |
| 87 |
singular form. The lemmatizer trained on the e-Lex lexicon |
| 88 |
[ELEX]_. It is dependent on the Part-of-Speech tagger |
| 89 |
as it uses both the word form and the assigned PoS tag to disambiguate |
| 90 |
between different candidate lemmas. For example the word *zakken* used |
| 91 |
as a noun has the lemma *zak* while the verb has lemma *zakken*. Section |
| 92 |
[sec-bg-lem] presents further details on the lemmatizer. |
| 93 |
|
| 94 |
Morphological Analyzer |
| 95 |
~~~~~~~~~~~~~~~~~~~~~~ |
| 96 |
|
| 97 |
The morphological Analyzer (MBMA) cuts each word into its morphemes and |
| 98 |
shows the spelling changes that took place to create the word form. The |
| 99 |
fourth column in example [ex-frog-out] shows the morphemes of the |
| 100 |
example sentence. MBMA tries to decompose every token into morphemes, |
| 101 |
except for punctuation marks and names. Note that MBMA sometimes makes |
| 102 |
mistakes with unknown words such as abbreviations that are not included |
| 103 |
in the MBMA lexicon. The abbreviation z.g. in the example is wrongly |
| 104 |
analyzed as consisting of two parts. As shown in the earlier XML example |
| 105 |
[ex-xml-tok] the past particle *aangesneden* is split into |
| 106 |
*[aan][ge][snijd][en]* where the morpheme *[snijd]* is the root form of |
| 107 |
*sned*. More information about the MBMA architecture can be found in |
| 108 |
[sec-bg-morf]. |
| 109 |
|
| 110 |
Part-of-Speech Tagger |
| 111 |
~~~~~~~~~~~~~~~~~~~~~ |
| 112 |
|
| 113 |
The Part-of-Speech tagger uses the tag set of *Corpus Gesproken |
| 114 |
Nederlands (CNG)* [VanEynde2004]_. It has 12 main PoS |
| 115 |
tags (shown in table [tab-pos-tags]) and detailed features for type, |
| 116 |
gender, number, case, position, degree, and tense. |
| 117 |
|
| 118 |
We show an example of the PoS tagger output in table [tab-pos-conf]. The |
| 119 |
tagger also expresses how certain it was about its tag label in a |
| 120 |
confidence score between 0 (not sure) and 1 (absolutely sure). In the |
| 121 |
example the PoS tagger is very sure about the first four tokens but not |
| 122 |
about the label N(soort,ev,basis,zijd,stan) for the token *Psychologie* |
| 123 |
as it only has a confidence score of 0.67. *Psychologie* is an ambiguous |
| 124 |
token and can also be used as a name (tag SPEC). |
| 125 |
|
| 126 |
+--------+---------------------+ |
| 127 |
| ADJ | Adjective | |
| 128 |
+--------+---------------------+ |
| 129 |
| BW | Adverb | |
| 130 |
+--------+---------------------+ |
| 131 |
| LET | Punctuation | |
| 132 |
+--------+---------------------+ |
| 133 |
| LID | Determiner | |
| 134 |
+--------+---------------------+ |
| 135 |
| N | Noun | |
| 136 |
+--------+---------------------+ |
| 137 |
| SPEC | Names and unknown | |
| 138 |
+--------+---------------------+ |
| 139 |
| TSW | Interjection | |
| 140 |
+--------+---------------------+ |
| 141 |
| TW | Numerator | |
| 142 |
+--------+---------------------+ |
| 143 |
| VG | Conjunction | |
| 144 |
+--------+---------------------+ |
| 145 |
| VNW | Pronoun | |
| 146 |
+--------+---------------------+ |
| 147 |
| VZ | Preposition | |
| 148 |
+--------+---------------------+ |
| 149 |
| WW | Verb | |
| 150 |
+--------+---------------------+ |
| 151 |
|
| 152 |
Table: [tab-pos-tags] The main tags in the CGN PoS-tag set. |
| 153 |
|
| 154 |
+------+---------------+---------------------------------+----------------+ |
| 155 |
| 34 | Ik | VNW(pers,pron,nomin,vol,1,ev) | 0.999791 | |
| 156 |
+------+---------------+---------------------------------+----------------+ |
| 157 |
| 35 | ben | WW(pv,tgw,ev) | 0.999589 | |
| 158 |
+------+---------------+---------------------------------+----------------+ |
| 159 |
| 36 | ook | BW() | 0.999979 | |
| 160 |
+------+---------------+---------------------------------+----------------+ |
| 161 |
| 37 | professor | N(soort,ev,basis,zijd,stan) | 0.997691 | |
| 162 |
+------+---------------+---------------------------------+----------------+ |
| 163 |
| 38 | Psychologie | N(soort,ev,basis,zijd,stan) | **0.666667** | |
| 164 |
+------+---------------+---------------------------------+----------------+ |
| 165 |
|
| 166 |
Table: [tab-pos-conf] The PoS tagger assigns a confidence score to each |
| 167 |
tag. |
| 168 |
|
| 169 |
Named Entity Recognition |
| 170 |
~~~~~~~~~~~~~~~~~~~~~~~~ |
| 171 |
|
| 172 |
The Named Entity Recognizer (NER) detects names in the text and labels |
| 173 |
them as location (LOC), person (PER), organization (ORG), product (PRO), |
| 174 |
event (EVE) or miscellaneous (MISC). |
| 175 |
|
| 176 |
Internally and in Frog’s columned output, the tags use a so-called BIO |
| 177 |
paradigm where B stands for the beginning of the name, I signifies |
| 178 |
Inside the name, and O outside the name. |
| 179 |
|
| 180 |
More detailed information about the NER module can be found in |
| 181 |
[sec-bg-ner]. |
| 182 |
|
| 183 |
Phrase Chunker |
| 184 |
~~~~~~~~~~~~~~ |
| 185 |
|
| 186 |
The phrase chunker represents an intermediate step between |
| 187 |
part-of-speech tagging and full parsing as it produces a non-recursive, |
| 188 |
non-overlapping flat structure of recognized phrases in the text and |
| 189 |
classifies them with their grammatical function such as adverbial phrase |
| 190 |
(ADVP), verb phrase (VP) or noun phrase (NP). The tag labels produced by |
| 191 |
the chunker use the same type of BIO-tags (Beginning-Inside-Outside) as |
| 192 |
the named entity recognizer. We show an example sentence in [ex-chunk] |
| 193 |
where the four-word noun phrase *het cold case team* is recognized as |
| 194 |
one phrase. The prepositional phrases (PP) consist only of the |
| 195 |
preposition themselves due to the flat structure in which the relation |
| 196 |
between prepositions and noun phrases is not expressed (note that the |
| 197 |
dependency parse labels, section [sec-dep] do express these relations). |
| 198 |
Here *Midden-Nederland* is recognized by the PoS tagger as name and |
| 199 |
therefor marked as a separate noun phrase that follows the noun phrase |
| 200 |
*de politie*. |
| 201 |
|
| 202 |
:math:`[`\ Dat\ :math:`]_{NP} [`\ bevestigt\ :math:`]_{VP} [`\ het cold |
| 203 |
case team\ :math:`]_{NP} [`\ van\ :math:`]_{PP}] [`\ de |
| 204 |
politie\ :math:`]_{NP} [`\ Midden-Nederland\ :math:`]_{NP} [` aan |
| 205 |
:math:`]_{PP} [`\ de Telegraaf\ :math:`]_{NP} [` . |
| 206 |
|
| 207 |
+------+--------------------+--------+ |
| 208 |
| 1 | Dat | B-NP | |
| 209 |
+------+--------------------+--------+ |
| 210 |
| 2 | bevestigt | B-VP | |
| 211 |
+------+--------------------+--------+ |
| 212 |
| 3 | het | B-NP | |
| 213 |
+------+--------------------+--------+ |
| 214 |
| 4 | cold | I-NP | |
| 215 |
+------+--------------------+--------+ |
| 216 |
| 5 | case | I-NP | |
| 217 |
+------+--------------------+--------+ |
| 218 |
| 6 | team | I-NP | |
| 219 |
+------+--------------------+--------+ |
| 220 |
| 7 | van | B-PP | |
| 221 |
+------+--------------------+--------+ |
| 222 |
| 8 | de | B-NP | |
| 223 |
+------+--------------------+--------+ |
| 224 |
| 9 | politie | I-NP | |
| 225 |
+------+--------------------+--------+ |
| 226 |
| 10 | Midden-Nederland | B-NP | |
| 227 |
+------+--------------------+--------+ |
| 228 |
| 11 | aan | B-PP | |
| 229 |
+------+--------------------+--------+ |
| 230 |
| 12 | de | B-NP | |
| 231 |
+------+--------------------+--------+ |
| 232 |
| 13 | Telegraaf | I-NP | |
| 233 |
+------+--------------------+--------+ |
| 234 |
| 14 | . | O | |
| 235 |
+------+--------------------+--------+ |
| 236 |
|
| 237 |
Table: [ex-chunk] The phrase chunker detects phrase boundaries and |
| 238 |
labels the phrases with their grammatical information. |
| 239 |
|
| 240 |
Dependency Parser |
| 241 |
~~~~~~~~~~~~~~~~~~ |
| 242 |
|
| 243 |
The Constraint-satisfaction inference-based dependency parser (CSI-DP) |
| 244 |
[Canisius+2006]_ predicts grammatical relations between |
| 245 |
pairs of tokens. In each token pair relation, one token is the head and |
| 246 |
the other is the dependent. Together these relations represent the |
| 247 |
syntactic tree of the sentence. One token, usually the main verb in he |
| 248 |
sentence, forms the root of the tree and the other tokens depend on the |
| 249 |
root in a direct or indirect relation. CSI-DP is trained on the Alpino |
| 250 |
treebank [Alpino]_ for Dutch and uses the Alpino |
| 251 |
syntactic labels listed in appendix [app-dep]. In the plain text output |
| 252 |
of Frog ( example [ex-frog-out]) the dependency information is presented |
| 253 |
in the last two columns. The one-but-last column shows number of the |
| 254 |
token number of the head word of the dependency relation and the last |
| 255 |
column shows the grammatical relation type. We show the last two columns |
| 256 |
of the CSI-DP output in table [ex-dep]. The main verb *bevestigt* is |
| 257 |
root element of the sentence, the head of the subject relation (su) with |
| 258 |
the pronoun *Dat* and head in the object relation (obj1) with *team*. |
| 259 |
The noun *team* is the head in three relations: the determiner(det) |
| 260 |
*het* and the two modifiers(mod) *cold case*. The name |
| 261 |
*Midden-Nederland* is linked as an apposition to the noun *politie*. The |
| 262 |
prepositional phrase *van* is correctly assigned to the head noun *team* |
| 263 |
but the phrase *aan* is mistakenly linked to *politie* instead of the |
| 264 |
root verb *bevestigt*. Linking prepositional phrases is a hard task for |
| 265 |
parsers [atterer2007]_. More details on the |
| 266 |
architecture of the CSI-DP can be found in section [sec-bg-dep] |
| 267 |
|
| 268 |
+------+--------------------+------+---------+ |
| 269 |
| 1 | Dat | 2 | su | |
| 270 |
+------+--------------------+------+---------+ |
| 271 |
| 2 | bevestigt | 0 | ROOT | |
| 272 |
+------+--------------------+------+---------+ |
| 273 |
| 3 | het | 6 | det | |
| 274 |
+------+--------------------+------+---------+ |
| 275 |
| 4 | cold | 5 | mod | |
| 276 |
+------+--------------------+------+---------+ |
| 277 |
| 5 | case | 6 | mod | |
| 278 |
+------+--------------------+------+---------+ |
| 279 |
| 6 | team | 2 | obj1 | |
| 280 |
+------+--------------------+------+---------+ |
| 281 |
| 7 | van | 6 | mod | |
| 282 |
+------+--------------------+------+---------+ |
| 283 |
| 8 | de | 9 | det | |
| 284 |
+------+--------------------+------+---------+ |
| 285 |
| 9 | politie | 7 | obj1 | |
| 286 |
+------+--------------------+------+---------+ |
| 287 |
| 10 | Midden-Nederland | 9 | app | |
| 288 |
+------+--------------------+------+---------+ |
| 289 |
| 11 | aan | 9 | mod | |
| 290 |
+------+--------------------+------+---------+ |
| 291 |
| 12 | de | 13 | det | |
| 292 |
+------+--------------------+------+---------+ |
| 293 |
| 13 | Telegraaf | 11 | obj1 | |
| 294 |
+------+--------------------+------+---------+ |
| 295 |
| 14 | . | 13 | punct | |
| 296 |
+------+--------------------+------+---------+ |
| 297 |
|
| 298 |
Table: [ex-dep] The dependency parser labels each token with a |
| 299 |
dependency relation to its head token and assigns the grammatical |
| 300 |
relation. |
| 301 |
|
| 302 |
|
| 303 |
|
| 304 |
.. [12] |
| 305 |
In the current Frog version UTF-16 is not accepted as input in Frog. |
| 306 |
|
| 307 |
.. [13] |
| 308 |
In fact the tokenizer still is used, but in ``PassThru`` mode. This |
| 309 |
allows for conversion to FoLiA XML and sentence detection. |