Interset/Tagset/MT/Mlss.pm untested

filter: Statementstmt 0.0% 0 / 134 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 8 Podpod 0.0% 0 / 2 totaltotal 0.0% 0 / 144 CC 1 SCAR 6.9
CC
1
Cov
0%
get_tagset_id
2.0
decode
2.0
BEGIN
2.0
CRAP 2.0
1 # ABSTRACT: Driver for the tagset of the Maltese Language Software Services (TnT tagger).
2 # Copyright © 2015, 2017 Dan Zeman <zeman@ufal.mff.cuni.cz>
3  
4 # Part-of-Speech tagger for Maltese (including description of tags)
5 # http://metanet4u.research.um.edu.mt/POS.jsp
6 # MLRS (Maltese Language Resource Server) corpus
7 # http://mlrs.research.um.edu.mt/index.php?page=31
8  
9 package Lingua::Interset::Tagset::MT::Mlss;
10 use strict;
11 use warnings;
12 our $VERSION = '3.015';
13  
14 use utf8;
15 use open ':utf8';
16 use namespace::autoclean;
17 use Moose;
18 extends 'Lingua::Interset::Atom';
19  
20  
21  
22 #------------------------------------------------------------------------------
23 # Returns the tagset id that should be set as the value of the 'tagset' feature
24 # during decoding. Every derived class must (re)define this method! The result
25 # should correspond to the last two parts in package name, lowercased.
26 # Specifically, it should be the ISO 639-2 language code, followed by '::' and
27 # a language-specific tagset id. Example: 'cs::multext'.
28 #------------------------------------------------------------------------------
29 sub get_tagset_id
30 {
31 return 'mt::mlss';
32 }
33  
34  
35  
36 #------------------------------------------------------------------------------
37 # This block will be called before object construction. It will build the
38 # decoding and encoding maps for this particular tagset.
39 # Then it will pass all the attributes to the constructor.
40 #------------------------------------------------------------------------------
41 around BUILDARGS => sub
42 {
43 my $orig = shift;
44 my $class = shift;
45 # Call the default BUILDARGS in Moose::Object. It will take care of distinguishing between a hash reference and a plain hash.
46 my $attr = $class->$orig(@_);
47 # Construct decode_map in the form expected by Atom.
48 # http://metanet4u.research.um.edu.mt/POS.jsp
49 my %dm =
50 (
51 # coordinating conjunction
52 # examples: u, jew, iżda, imma, bħal (and, or, but, but, as)
53 'CC' => ['pos' => 'conj', 'conjtype' => 'coor'],
54 # complementizer
55 # examples: li, illi, ili, imbilli (that)
56 'CMP' => ['pos' => 'conj', 'conjtype' => 'sub', 'other' => {'conjtype' => 'cmp'}],
57 # paired coordinating conjunction? only one element of the pair?
58 # examples: la, ukoll (either/neither, (both-)and)
59 'CR' => ['pos' => 'conj', 'conjtype' => 'coor', 'other' => {'conjtype' => 'cr'}],
60 # subordinating conjunction
61 # examples: biex, kemm, għax, billi, jekk (to, either, because, since, if)
62 'CS' => ['pos' => 'conj', 'conjtype' => 'sub'],
63 # determiner
64 # no occurrences in the corpus
65 #'DD' => ['pos' => 'adj', 'prontype' => 'prn'],
66 # definite determiner, clitic
67 # examples: l-, il-, it-, is-, t- (the)
68 'DDC' => ['pos' => 'adj', 'prontype' => 'art', 'definiteness' => 'def'],
69 # determiner, plural (quantifier)
70 # examples: ħafna, ftit, bosta, tant, wisq (many, few, many, so many, too)
71 'DP' => ['pos' => 'adj', 'prontype' => 'ind', 'numtype' => 'card', 'number' => 'plur'],
72 # determiner quantifier
73 # no occurrence in the corpus
74 #'DQ' => [],
75 # specifier, singular
76 # examples: xi, kull, nofs, ebda, jimxi (some, every, middle, no, go)
77 'DS' => ['pos' => 'adj', 'prontype' => 'ind', 'number' => 'sing'],
78 # existential marker ###!!! Chris Manning suggested a correction for handling of English EX in Interset; should it apply here as well?
79 # examples: hemm, hawn, hemmx, ilux, damx (there, here, there, there, here)
80 'EX' => ['pos' => 'adv', 'advtype' => 'ex'],
81 # interjection
82 # examples: le (no), e, bye
83 'II' => ['pos' => 'int'],
84 # modifier, adjective
85 # examples: oħra, ieħor, iżjed, aktar, istess (other, other, more, more, same)
86 'MJ' => ['pos' => 'adj'],
87 # modifier, adverb
88 # examples: skont, kif, meta, bħala, hekk (according, how, where/when, as, so)
89 'MV' => ['pos' => 'adv'],
90 # Maltese cardinal numerals have transitive (used with a noun) and intransitive (used without a noun) forms.
91 # intransitive: 2 tnejn, 3 tlieta, 4 erbgħa, 5 ħamsa, 6 sitta, 7 sebgħa, 8 tmienja, 9 disgħa, 10 għaxra, 11 ħdax, 12 tnax, 13 tlettax, 14 erbatax, 15 ħmistax, 16 sittax, 17 sbatax, 18 tmintax, 19 dsatax
92 # transitive with multi-syllable noun: 2 zewg, 3 tliet, 4 erba', 5 ħames, 6 sitt, 7 seba', 8 tmien, 9 disa', 10 għaxar
93 # transitive with one-syllable noun: 2 zewgt, 3 tlett, 4 erbat, 5 ħamest, 6 sitt, 7 sebat, 8 tmint, 9 disat, 10 għaxart
94 # certain transitive cardinals are followed by a singular noun: 11 ħdax-il, 12 tnax-il, 13 tlettax-il, 14 erbatax-il, 15 ħmistax-il, 16 sittax-il, 17 sbatax-il, 18 tmintax-il, 19 dsatax-il
95 # numeral, cardinal
96 # both expressed in words and in digits
97 # examples: żewġ, 2010, 2009, tliet, 3 (two, 2010, 2009, three, 3)
98 'NC' => ['pos' => 'num', 'numtype' => 'card'],
99 # numeral, cardinal, intransitive (i.e. the number is a label of something, no counted noun follows)
100 # examples: 5, 1968, 1984, 1791, 1998
101 # all examples found are numbers expressed using digits, although it is probably not guaranteed
102 'NCI' => ['pos' => 'num', 'numtype' => 'card', 'numform' => 'digit', 'other' => {'cardtype' => 'intr'}],
103 # numeral, cardinal, transitive
104 # no occurrence in the corpus
105 #'NCT' => ['pos' => 'num', 'numtype' => 'card'],
106 # common noun
107 # examples: persuna, lingwa, mod, istudenti, tagħlim (person, language, way, students, teaching)
108 'NN' => ['pos' => 'noun', 'nountype' => 'com'],
109 # numeral, ordinal
110 # examples: ewwel, tieni, tielet, erbgħin, għaxar (first, second, third, fifth, tenth)
111 'NO' => ['pos' => 'adj', 'numtype' => 'ord'],
112 # proper name
113 # examples: Vassalli, Malta, Għawdex, Kummerċ, Ġust (Vassalli, Malta, Gozo, Trade, Fair)
114 'NP' => ['pos' => 'noun', 'nountype' => 'prop'],
115 # initial in proper name
116 # no occurrence in the corpus
117 #'NPI' => ['pos' => 'noun', 'nountype' => 'prop', 'abbr' => 'yes'],
118 # verbal negator
119 # examples: ma, mhux, m', mhix, mhuwiex (not, not, not, not, not)
120 'NV' => ['pos' => 'part', 'polarity' => 'neg'],
121 # numeral or indefinite determiner 'one'?
122 # examples: wieħed, waħda, wħud, uħud, ċaħda (one, one, one, some, some)
123 'NW' => ['pos' => 'num', 'numtype' => 'card', 'numvalue' => '1'],
124 # not documented; perhaps the same as PAC?
125 # examples: għad (yet)
126 # there are only three occurrences of għad/PA, and there are 17 occurrences of għad/PAC; is PA a tagging error?
127 #'PA' => ['pos' => 'part'],
128 # particle, aspect marker, continuous aspect
129 # examples: qed, għad, għadx (still)
130 'PAC' => ['pos' => 'part', 'aspect' => 'prog'],
131 # particle, aspect marker, prospective aspect
132 # examples: se (would)
133 'PAF' => ['pos' => 'part', 'aspect' => 'prosp'],
134 # pronoun, demonstrative
135 # examples: dan, din, dawn, dak, dik, dawk (this, this, these, that, that, those)
136 'PD' => ['pos' => 'noun|adj', 'prontype' => 'dem'],
137 # pronoun, indefinite
138 # examples: kollha, kollu, kulħadd, xejn, kollox (all, all, all, nothing, all)
139 'PI' => ['pos' => 'noun|adj', 'prontype' => 'ind'],
140 # preposition ma' with bound pronoun
141 # examples: miegħu, magħhom, magħha, irwieħhom, magħna (with him, with them, with her, ?, with us)
142 ###!!! We should remove adpostype=preppron from Interset! If the fused word cannot be split, then it should together be a pronoun in a strange case, not a preposition!
143 'PMP' => ['pos' => 'adp', 'adpostype' => 'preppron'],
144 # pronoun, personal
145 # examples: huwa, huma, hija, hu, hi (he, they, she, he, she)
146 'PP' => ['pos' => 'noun', 'prontype' => 'prs'],
147 # pronoun, reflexive
148 # examples: ruħu, nnifsu, innifsu, ruħhom, nnifisha (himself, herself, itself, themselves, itself)
149 'PR' => ['pos' => 'noun', 'prontype' => 'prs', 'reflex' => 'yes'],
150 # preposition
151 # examples: ta', f', fuq, minn, b' (of, ?, ?, from, in)
152 'PRP' => ['pos' => 'adp', 'adpostype' => 'prep'],
153 # fused preposition-article
154 # examples: tal-, fil-, fl-, għall-, mill- (of, in, in, to, from)
155 'PRPC' => ['pos' => 'adp', 'adpostype' => 'prep', 'prontype' => 'art', 'definiteness' => 'def'],
156 # pronoun, possessive
157 # examples: tiegħu, tagħhom, tagħha, tagħna, tiegħi (his, their, her, our, my)
158 'PT' => ['pos' => 'adj', 'prontype' => 'prs', 'poss' => 'yes'],
159 # punctuation
160 # examples: , . ' ( )
161 'PUN' => ['pos' => 'punc'],
162 # pronoun, interrogative?
163 # examples: x', min, liema (?, who, what)
164 'PW' => ['pos' => 'noun|adj', 'prontype' => 'int'],
165 # residual, acronym
166 # examples: Dr, ICT, Prof., UE, PARC
167 'RA' => ['pos' => 'noun', 'nountype' => 'prop', 'abbr' => 'yes'],
168 # residual, abbreviation
169 # examples: ..., Ltd, Ed, GĦST, ICT
170 'RB' => ['abbr' => 'yes'],
171 # residual, date
172 # examples: 13, 631, 22, 158, 33
173 # this tag is not restricted to dates, it appears e.g. in "artikolu 631" (article 631)
174 'RD' => ['pos' => 'num', 'numtype' => 'card', 'other' => {'cardtype' => 'date'}],
175 # residual, formula, mathematical symbol
176 'RFR' => ['pos' => 'sym'],
177 # residual, foreign word
178 # examples: of, the, for, in, e
179 'RFW' => ['foreign' => 'yes'],
180 # residual, honorific
181 # examples: Sur, San, Dun, European, Fr
182 'RH' => ['pos' => 'noun', 'nountype' => 'com', 'other' => {'nountype' => 'title'}],
183 # residual, other
184 # examples: a, b, S, A, d
185 'RO' => [],
186 # residual, other symbol
187 # III, II, V, I, XVIII
188 # all examples observed in the corpus are Roman numerals
189 'RS' => ['pos' => 'num', 'numtype' => 'card|ord', 'numform' => 'roman'],
190 # (unique, unassigned) multiword utterance
191 # no occurrence in the corpus
192 #'UAM' => [],
193 # verb, auxiliary
194 # examples: kien, kienu, kienet, jkun, tkun (was, were, would, be, be)
195 'VA' => ['pos' => 'verb', 'verbtype' => 'aux'],
196 # pseudo verb
197 # inflected forms of the preposition 'għand', e.g. 'għandu' = at/to him = he has
198 # past tense: kellu = kien ("he was") + l- + "to" = he had / he had to (if followed by verb)
199 # examples: għandu, kellu, għandhom, għandha, kellhom (has, had, have, has, had)
200 'VG' => ['pos' => 'verb', 'other' => {'verbtype' => 'have'}],
201 # participle, active, or passive
202 # examples: qiegħed, mgħallma, qegħdin, miftuħa, meqjus (being, taught, being, open, considered)
203 'VP' => ['pos' => 'verb', 'verbform' => 'part'],
204 # main verb
205 # examples: jistgħu, jista', jiġi, jgħid, tista' (can, could, be, say, can)
206 'VV' => ['pos' => 'verb']
207 );
208 # Construct encode_map in the form expected by Atom.
209 my %em =
210 (
211 'prontype' => { 'art' => { 'pos' => { 'adp' => 'PRPC',
212 '@' => 'DDC' }},
213 'dem' => 'PD',
214 'ind' => { 'number' => { 'sing' => 'DS',
215 'plur' => 'DP',
216 '@' => 'PI' }},
217 'tot' => 'PI',
218 'neg' => 'PI',
219 'int' => 'PW',
220 'rel' => 'PW',
221 'prs' => { 'poss' => { 'yes' => 'PT',
222 '@' => { 'reflex' => { 'yes' => 'PR',
223 '@' => 'PP' }}}},
224 '@' => { 'pos' => { 'noun' => { 'nountype' => { 'prop' => { 'abbr' => { 'yes' => 'RA',
225 '@' => 'NP' }},
226 '@' => { 'other/nountype' => { 'title' => 'RH',
227 '@' => 'NN' }}}},
228 'adj' => { 'numtype' => { 'ord' => 'NO',
229 '@' => 'MJ' }},
230 'num' => { 'other/cardtype' => { 'intr' => 'NCI',
231 'date' => 'RD',
232 '@' => { 'numform' => { 'roman' => 'RS',
233 '@' => { 'numvalue' => { '1' => 'NW',
234 '@' => 'NC' }}}}}},
235 'verb' => { 'verbtype' => { 'aux' => 'VA',
236 '@' => { 'other/verbtype' => { 'have' => 'VG',
237 '@' => { 'verbform' => { 'part' => 'VP',
238 '@' => 'VV' }}}}}},
239 'adv' => { 'advtype' => { 'ex' => 'EX',
240 '@' => 'MV' }},
241 'adp' => { 'adpostype' => { 'preppron' => 'PMP',
242 '@' => 'PRP' }},
243 'conj' => { 'conjtype' => { 'sub' => { 'other/conjtype' => { 'cmp' => 'CMP',
244 '@' => 'CS' }},
245 '@' => { 'other/conjtype' => { 'cr' => 'CR',
246 '@' => 'CC' }}}},
247 'part' => { 'polarity' => { 'neg' => 'NV',
248 '@' => { 'aspect' => { 'prosp' => 'PAF',
249 '@' => 'PAC' }}}},
250 'int' => 'II',
251 'sym' => 'RFR',
252 'punc' => 'PUN',
253 '@' => { 'abbr' => { 'yes' => 'RB',
254 '@' => { 'foreign' => { 'yes' => 'RFW',
255 '@' => 'RO' }}}}}}}
256 );
257 # Now add the references to the attribute hash.
258 $attr->{surfeature} = 'pos';
259 $attr->{decode_map} = \%dm;
260 $attr->{encode_map} = \%em;
261 $attr->{tagset} = 'mt::mlss';
262 return $attr;
263 };
264  
265  
266  
267 #------------------------------------------------------------------------------
268 # Decodes a physical tag (string) and returns the corresponding feature
269 # structure. In addition to Atom, we just need to identify the tagset of
270 # origin.
271 #------------------------------------------------------------------------------
272 sub decode
273 {
274 my $self = shift;
275 my $tag = shift;
276 my $fs = $self->SUPER::decode($tag);
277 $fs->set_tagset('mt::mlss');
278 return $fs;
279 }
280  
281  
282  
283 1;
284  
285 __END__
286  
287 =pod
288  
289 =encoding UTF-8
290  
291 =head1 NAME
292  
293 Lingua::Interset::Tagset::MT::Mlss - Driver for the tagset of the Maltese Language Software Services (TnT tagger).
294  
295 =head1 VERSION
296  
297 version 3.015
298  
299 =head1 SYNOPSIS
300  
301 use Lingua::Interset::Tagset::MT::Mlss;
302 my $driver = Lingua::Interset::Tagset::MT::Mlss->new();
303 my $fs = $driver->decode('NN');
304  
305 or
306  
307 use Lingua::Interset qw(decode);
308 my $fs = decode('mt::mlss', 'NN');
309  
310 =head1 DESCRIPTION
311  
312 Interset driver for the part-of-speech tagset of the Maltese Language Software Services
313 (TnT tagger; see L<http://metanet4u.research.um.edu.mt/POS.jsp>).
314 The tagset is used in the MLRS (Maltese Language Resource Server) corpus,
315 L<http://mlrs.research.um.edu.mt/index.php?page=31>.
316  
317 =head1 SEE ALSO
318  
319 L<Lingua::Interset>
320 L<Lingua::Interset::Tagset>,
321 L<Lingua::Interset::FeatureStructure>
322 L<Lingua::Interset::Tagset::EN::Penn>
323  
324 =head1 AUTHOR
325  
326 Dan Zeman <zeman@ufal.mff.cuni.cz>
327  
328 =head1 COPYRIGHT AND LICENSE
329  
330 This software is copyright (c) 2019 by Univerzita Karlova (Charles University).
331  
332 This is free software; you can redistribute it and/or modify it under
333 the same terms as the Perl 5 programming language system itself.
334  
335 =cut