| 1 | # ABSTRACT: Driver for the tagset of the (Prague) Tamil Dependency Treebank (TamilTB) | ||
| 2 | # Copyright © 2015, 2017 Dan Zeman <zeman@ufal.mff.cuni.cz> | ||
| 3 | # Copyright © 2011 Loganathan Ramasamy <ramasamy@ufal.mff.cuni.cz> | ||
| 4 | # Documentation at http://ufal.mff.cuni.cz/~ramasamy/tamiltb/0.1/morph_annotation.html | ||
| 5 | |||
| 6 | package Lingua::Interset::Tagset::TA::Tamiltb; | ||
| 7 | use strict; | ||
| 8 | use warnings; | ||
| 9 | our $VERSION = '3.015'; | ||
| 10 | |||
| 11 | use utf8; | ||
| 12 | use open ':utf8'; | ||
| 13 | use namespace::autoclean; | ||
| 14 | use Moose; | ||
| 15 | extends 'Lingua::Interset::Tagset'; | ||
| 16 | |||
| 17 | |||
| 18 | |||
| 19 | has 'atoms' => ( isa => 'HashRef', is => 'ro', builder => '_create_atoms', lazy => 1 ); | ||
| 20 | has 'features_pos' => ( isa => 'HashRef', is => 'ro', builder => '_create_features_pos', lazy => 1 ); | ||
| 21 | |||
| 22 | |||
| 23 | |||
| 24 | #------------------------------------------------------------------------------ | ||
| 25 | # Returns the tagset id that should be set as the value of the 'tagset' feature | ||
| 26 | # during decoding. Every derived class must (re)define this method! The result | ||
| 27 | # should correspond to the last two parts in package name, lowercased. | ||
| 28 | # Specifically, it should be the ISO 639-2 language code, followed by '::' and | ||
| 29 | # a language-specific tagset id. Example: 'cs::multext'. | ||
| 30 | #------------------------------------------------------------------------------ | ||
| 31 | sub get_tagset_id | ||
| 32 | { | ||
| 33 | return 'ta::tamiltb'; | ||
| 34 | } | ||
| 35 | |||
| 36 | |||
| 37 | |||
| 38 | #------------------------------------------------------------------------------ | ||
| 39 | # Creates atomic drivers for surface features. | ||
| 40 | #------------------------------------------------------------------------------ | ||
| 41 | sub _create_atoms | ||
| 42 | { | ||
| 43 | my $self = shift; | ||
| 44 | my %atoms; | ||
| 45 | # 1.+2. DETAILED PART OF SPEECH #################### | ||
| 46 | $atoms{pos} = $self->create_atom | ||
| 47 | ( | ||
| 48 | 'surfeature' => 'pos', | ||
| 49 | 'decode_map' => | ||
| 50 | { | ||
| 51 | # AA: adverb, general (aka, inru, melum, anal, pinnar) | ||
| 52 | 'AA' => ['pos' => 'adv'], | ||
| 53 | # CC: coordinating conjunction (marrum = and; allatu = or) | ||
| 54 | 'CC' => ['pos' => 'conj', 'conjtype' => 'coor'], | ||
| 55 | # DD: determiner, general (inta, anta, intap, enta, antap) | ||
| 56 | 'DD' => ['pos' => 'adj', 'prontype' => 'prn'], | ||
| 57 | # II: interjection, general (aha = aha) | ||
| 58 | 'II' => ['pos' => 'int'], | ||
| 59 | # JJ: adjective, general (mattiya, oru, katanta, putiya, munnal) | ||
| 60 | 'JJ' => ['pos' => 'adj'], | ||
| 61 | # Jd: participial adjective? | ||
| 62 | 'Jd' => ['pos' => 'adj', 'verbform' => 'part'], | ||
| 63 | # NN: common noun (warkali = chair, peruwtu = bus) | ||
| 64 | 'NN' => ['pos' => 'noun', 'nountype' => 'com'], | ||
| 65 | # NE: proper name (intiya, ilangkai, atimuka, pakistan, kirikket) | ||
| 66 | 'NE' => ['pos' => 'noun', 'nountype' => 'prop'], | ||
| 67 | # NO: oblique noun (intiya, amerikka, tamilaka, carvateca, manila) | ||
| 68 | # What does 'oblique' mean in this context? | ||
| 69 | # Only one tag found in the corpus: NO--3SN--. Does it apply to location names only? | ||
| 70 | 'NO' => ['pos' => 'noun', 'nountype' => 'prop', 'other' => {'nountype' => 'oblique'}], | ||
| 71 | # NP: participial noun (otiyaval = she who ran; utaviyavar = he/she who helped) | ||
| 72 | 'NP' => ['pos' => 'noun', 'verbform' => 'part'], | ||
| 73 | # postposition | ||
| 74 | 'PP' => ['pos' => 'adp', 'adpostype' => 'post'], | ||
| 75 | # QQ: quantifier, general (mika, mikap, mikac, atikam, atika) | ||
| 76 | 'QQ' => ['pos' => 'adj', 'prontype' => 'prn', 'numtype' => 'card'], | ||
| 77 | # Rh: reflexive pronoun (tannaip, tanakku, tamakk, tanatu) | ||
| 78 | 'Rh' => ['pos' => 'noun', 'prontype' => 'prs', 'reflex' => 'yes'], | ||
| 79 | # Ri: interrogative pronoun (yAr = who, evan = who he, etu = which, enna = what) | ||
| 80 | 'Ri' => ['pos' => 'noun', 'prontype' => 'int'], | ||
| 81 | # Rp: personal pronoun (wAn = I, nIngkal = you, tAn = he/she, itu = it, wAm = we, avarkal = they, anaittum = they) | ||
| 82 | 'Rp' => ['pos' => 'noun', 'prontype' => 'prs'], | ||
| 83 | # RB: general referential pronoun (yarum = anyone; etuvum = anything) | ||
| 84 | 'RB' => ['pos' => 'noun', 'prontype' => 'ind'], | ||
| 85 | # RF: specific indefinite referential pronoun (yaro = someone; etuvo = something) | ||
| 86 | # Not found in the corpus. | ||
| 87 | 'RF' => ['pos' => 'noun', 'prontype' => 'ind'], | ||
| 88 | # RG: non-specific indefinite pronoun (yaravatu = someone, at least; etavatu = something, at least) | ||
| 89 | # Not found in the corpus. | ||
| 90 | 'RG' => ['pos' => 'noun', 'prontype' => 'ind'], | ||
| 91 | # Tb: comparative particle (kAttilum = than, vita = than) | ||
| 92 | 'Tb' => ['pos' => 'part', 'other' => {'parttype' => 'comp'}], | ||
| 93 | # Tc: connective particle (um = also, and) | ||
| 94 | 'Tc' => ['pos' => 'part'], | ||
| 95 | # Td: adjectival particle (??? - see also Jd, participial adjectives) | ||
| 96 | # Td-D----A ... enra (17 occurrences) | ||
| 97 | # Td-P----A ... enkira (3 occurrences) | ||
| 98 | 'Td' => ['pos' => 'part', 'verbform' => 'part', 'other' => {'parttype' => 'adj'}], | ||
| 99 | # Te: interrogative particle (A) | ||
| 100 | 'Te' => ['pos' => 'part', 'other' => {'parttype' => 'int'}], | ||
| 101 | # Tf: civility particle (um = may please: varavum = may you please come) | ||
| 102 | 'Tf' => ['pos' => 'part'], | ||
| 103 | # Tg: particle, general (Ana, Aka, Akav, Akat, Akak) | ||
| 104 | 'Tg' => ['pos' => 'part'], | ||
| 105 | # Tk: intensifier particle (E = very, indeed, itself) | ||
| 106 | 'Tk' => ['pos' => 'part', 'other' => {'parttype' => 'intens'}], | ||
| 107 | # Tl: particle "Avatu" = "at least" | ||
| 108 | 'Tl' => ['pos' => 'part', 'other' => {'parttype' => 'atlst'}], | ||
| 109 | # Tm: particle "mattum" = "only" | ||
| 110 | 'Tm' => ['pos' => 'part', 'other' => {'parttype' => 'only'}], | ||
| 111 | # Tn: particle complementizing nouns (pati, mAtiri = manner, way; pOtu = when) | ||
| 112 | 'Tn' => ['pos' => 'part', 'other' => {'parttype' => 'noun'}], | ||
| 113 | # To: particle of doubt or indefiniteness (O) | ||
| 114 | 'To' => ['pos' => 'part', 'other' => {'parttype' => 'doubt'}], | ||
| 115 | # Tq: emphatic particle (tAn: rAmantAn = it was Ram) | ||
| 116 | 'Tq' => ['pos' => 'part', 'other' => {'parttype' => 'emph'}], | ||
| 117 | # Ts: concessive particle (um: Otiyum = although ran; utavinAlum = even if helps) | ||
| 118 | 'Ts' => ['pos' => 'part', 'other' => {'parttype' => 'conc'}], | ||
| 119 | # Tt-T----A: verbal partic(ip?)le (enru, ena, enr, enat, enak, enav) | ||
| 120 | # See also Vt? I am adding a non-empty verbform just to make sure that tense will be output as 'T', not as '-'. | ||
| 121 | 'Tt' => ['pos' => 'part', 'other' => {'parttype' => 'verb'}, 'verbform' => 'inf'], | ||
| 122 | # Tv: inclusive particle (um = also: rAmanum = also Raman) | ||
| 123 | 'Tv' => ['pos' => 'part', 'other' => {'parttype' => 'incl'}], | ||
| 124 | # Tw-T----A: conditional verbal particle (enrAl) | ||
| 125 | # See also Vw? | ||
| 126 | 'Tw' => ['pos' => 'part', 'verbform' => 'fin', 'mood' => 'cnd', 'other' => {'parttype' => 'cnd'}], | ||
| 127 | # Tz: verbal noun particle (enpatu, etuppat, kotuppat) | ||
| 128 | # See also Vz? | ||
| 129 | 'Tz' => ['pos' => 'part', 'verbform' => 'ger', 'other' => {'parttype' => 'ger'}], | ||
| 130 | # TS: immediacy particle (um: vawtatum = as soon as came; otiyatum = as soon as ran) | ||
| 131 | 'TS' => ['pos' => 'part', 'other' => {'parttype' => 'imm'}], | ||
| 132 | # U=: number expressed using digits | ||
| 133 | 'U=' => ['pos' => 'num', 'numform' => 'digit'], | ||
| 134 | # Ux: cardinal number (iru, ayiram, munru, latcam, irantu) | ||
| 135 | 'Ux' => ['pos' => 'num', 'numtype' => 'card'], | ||
| 136 | # Uy: ordinal number (mutal, irantavatu, 1992-m, 1-m, 21-m) | ||
| 137 | 'Uy' => ['pos' => 'adj', 'numtype' => 'ord'], | ||
| 138 | # Vj: lexical verb, imperative (irungkal; Otu = run, utavu = help) | ||
| 139 | 'Vj' => ['pos' => 'verb', 'verbform' => 'fin', 'mood' => 'imp'], | ||
| 140 | # Vr: lexical verb, finite form (terikiratu, terivikkiratu, irukkiratu, kUrukiratu, nilavukiratu) | ||
| 141 | 'Vr' => ['pos' => 'verb', 'verbform' => 'fin', 'mood' => 'ind'], | ||
| 142 | # Vt: lexical verb, verbal participle (vawtu = having come; Oti = having run; utavi = having helped) | ||
| 143 | 'Vt' => ['pos' => 'verb', 'verbform' => 'part'], | ||
| 144 | # Vu: lexical verb, infinitive (ceyyap, terivikkap, valangkap, ceyya, niyamikkap) | ||
| 145 | 'Vu' => ['pos' => 'verb', 'verbform' => 'inf'], | ||
| 146 | # Vw: lexical verb, conditional (vawtal = if come; otinal = if ran; utavinal = if helped) | ||
| 147 | 'Vw' => ['pos' => 'verb', 'verbform' => 'fin', 'mood' => 'cnd'], | ||
| 148 | # Vz: lexical verb, verbal noun (uyirilappat, nampuvat, ceyalpatuvatark, povat, virippatu) | ||
| 149 | # vawtatu = the thing that came; otiyatu = the thing that ran | ||
| 150 | 'Vz' => ['pos' => 'verb', 'verbform' => 'ger'], | ||
| 151 | # VR: auxiliary verb, finite form (varukiratu, irukkiratu) | ||
| 152 | 'VR' => ['pos' => 'verb', 'verbtype' => 'aux', 'verbform' => 'fin', 'mood' => 'ind'], | ||
| 153 | # VT: auxiliary verb, verbal participle (kontu, vittu, vantu, kont, vant) | ||
| 154 | 'VT' => ['pos' => 'verb', 'verbtype' => 'aux', 'verbform' => 'part'], | ||
| 155 | # VU: auxiliary verb, infinitive (vitak, vitap, kolla, vita) | ||
| 156 | 'VU' => ['pos' => 'verb', 'verbtype' => 'aux', 'verbform' => 'inf'], | ||
| 157 | # VW: auxiliary verb, conditional (vittal, iruntal, vantal, vitil, vaittal) | ||
| 158 | 'VW' => ['pos' => 'verb', 'verbtype' => 'aux', 'verbform' => 'fin', 'mood' => 'cnd'], | ||
| 159 | # VZ: auxiliary verb, verbal noun (ullat, kollal, ullatu, varal) | ||
| 160 | 'VZ' => ['pos' => 'verb', 'verbtype' => 'aux', 'verbform' => 'ger'], | ||
| 161 | # unknown | ||
| 162 | 'XX' => [], | ||
| 163 | # Z#: sentence-terminating punctuation. | ||
| 164 | 'Z#' => ['pos' => 'punc', 'punctype' => 'peri'], | ||
| 165 | # Z:: commas and other punctuation | ||
| 166 | 'Z:' => ['pos' => 'punc', 'punctype' => 'comm'] | ||
| 167 | }, | ||
| 168 | 'encode_map' => | ||
| 169 | { | ||
| 170 | 'pos' => { 'noun' => { 'prontype' => { '' => { 'other/nountype' => { 'oblique' => 'NO', | ||
| 171 | '@' => { 'case' => { '' => 'NO', | ||
| 172 | '@' => { 'nountype' => { 'prop' => 'NE', | ||
| 173 | '@' => { 'verbform' => { 'part' => 'NP', | ||
| 174 | '@' => 'NN' }}}}}}}}, | ||
| 175 | '@' => { 'reflex' => { 'yes' => 'Rh', | ||
| 176 | '@' => { 'prontype' => { 'int' => 'Ri', | ||
| 177 | 'prs' => 'Rp', | ||
| 178 | '@' => 'RB' }}}}}}, | ||
| 179 | 'adj' => { 'prontype' => { '' => { 'numtype' => { 'card' => 'Ux', | ||
| 180 | 'ord' => 'Uy', | ||
| 181 | '@' => { 'verbform' => { 'part' => 'Jd', | ||
| 182 | '@' => 'JJ' }}}}, | ||
| 183 | '@' => { 'numtype' => { 'card' => 'QQ', | ||
| 184 | '@' => 'DD' }}}}, | ||
| 185 | 'num' => { 'prontype' => { '' => { 'numform' => { 'digit' => 'U=', | ||
| 186 | '@' => { 'numtype' => { 'ord' => 'Uy', | ||
| 187 | '@' => 'Ux' }}}}, | ||
| 188 | '@' => 'QQ' }}, | ||
| 189 | 'verb' => { 'verbtype' => { 'aux' => { 'verbform' => { 'inf' => 'VU', | ||
| 190 | 'ger' => 'VZ', | ||
| 191 | 'part' => 'VT', | ||
| 192 | 'trans' => 'VT', | ||
| 193 | '@' => { 'mood' => { 'cnd' => 'VW', | ||
| 194 | '@' => 'VR' }}}}, | ||
| 195 | '@' => { 'verbform' => { 'inf' => 'Vu', | ||
| 196 | 'ger' => 'Vz', | ||
| 197 | 'part' => 'Vt', | ||
| 198 | 'trans' => 'Vt', | ||
| 199 | '@' => { 'mood' => { 'imp' => 'Vj', | ||
| 200 | 'cnd' => 'Vw', | ||
| 201 | '@' => 'Vr' }}}}}}, | ||
| 202 | 'adv' => 'AA', | ||
| 203 | 'adp' => 'PP', | ||
| 204 | 'conj' => 'CC', | ||
| 205 | 'part' => { 'other/parttype' => { 'imm' => 'TS', | ||
| 206 | 'comp' => 'Tb', | ||
| 207 | 'adj' => 'Td', | ||
| 208 | 'int' => 'Te', | ||
| 209 | 'intens' => 'Tk', | ||
| 210 | 'atlst' => 'Tl', | ||
| 211 | 'only' => 'Tm', | ||
| 212 | 'noun' => 'Tn', | ||
| 213 | 'doubt' => 'To', | ||
| 214 | 'emph' => 'Tq', | ||
| 215 | 'conc' => 'Ts', | ||
| 216 | 'verb' => 'Tt', | ||
| 217 | 'incl' => 'Tv', | ||
| 218 | 'cnd' => 'Tw', | ||
| 219 | 'ger' => 'Tz', | ||
| 220 | '@' => { 'verbform' => { 'inf' => 'Tt', | ||
| 221 | 'fin' => 'Tw', | ||
| 222 | 'ger' => 'Tz', | ||
| 223 | 'part' => 'Td', | ||
| 224 | '@' => 'Tg' }}}}, | ||
| 225 | 'int' => 'II', | ||
| 226 | 'punc' => { 'punctype' => { 'peri' => 'Z#', | ||
| 227 | 'excl' => 'Z#', | ||
| 228 | 'qest' => 'Z#', | ||
| 229 | '@' => 'Z:' }}, | ||
| 230 | 'sym' => 'Z:', | ||
| 231 | '@' => 'XX' } | ||
| 232 | } | ||
| 233 | ); | ||
| 234 | # 3. CASE #################### | ||
| 235 | $atoms{case} = $self->create_simple_atom | ||
| 236 | ( | ||
| 237 | 'intfeature' => 'case', | ||
| 238 | 'simple_decode_map' => | ||
| 239 | { | ||
| 240 | 'A' => 'acc', | ||
| 241 | 'B' => 'ben', | ||
| 242 | 'C' => 'abl', | ||
| 243 | 'D' => 'dat', | ||
| 244 | 'I' => 'ins', | ||
| 245 | 'G' => 'gen', | ||
| 246 | 'L' => 'loc', | ||
| 247 | 'N' => 'nom', | ||
| 248 | # sociative = comitative | ||
| 249 | 'S' => 'com' | ||
| 250 | } | ||
| 251 | ); | ||
| 252 | # 4. TENSE #################### | ||
| 253 | $atoms{tense} = $self->create_atom | ||
| 254 | ( | ||
| 255 | 'surfeature' => 'tense', | ||
| 256 | 'decode_map' => | ||
| 257 | { | ||
| 258 | 'D' => ['tense' => 'past'], | ||
| 259 | 'P' => ['tense' => 'pres'], | ||
| 260 | 'F' => ['tense' => 'fut'], | ||
| 261 | # tenseless form, e.g. the negative auxiliary "illai" | ||
| 262 | # We cannot map it (bidirectionally) to the empty value because we do not want 'T' to appear in tags for non-verbs. | ||
| 263 | 'T' => [] | ||
| 264 | }, | ||
| 265 | 'encode_map' => | ||
| 266 | { | ||
| 267 | 'tense' => { 'past' => 'D', | ||
| 268 | 'pres' => 'P', | ||
| 269 | 'fut' => 'F', | ||
| 270 | '@' => { 'verbform' => { '' => '', | ||
| 271 | '@' => 'T' }}} | ||
| 272 | } | ||
| 273 | ); | ||
| 274 | # 5. PERSON #################### | ||
| 275 | $atoms{person} = $self->create_simple_atom | ||
| 276 | ( | ||
| 277 | 'intfeature' => 'person', | ||
| 278 | 'simple_decode_map' => | ||
| 279 | { | ||
| 280 | '1' => '1', | ||
| 281 | '2' => '2', | ||
| 282 | '3' => '3' | ||
| 283 | } | ||
| 284 | ); | ||
| 285 | # 6. NUMBER #################### | ||
| 286 | $atoms{number} = $self->create_simple_atom | ||
| 287 | ( | ||
| 288 | 'intfeature' => 'number', | ||
| 289 | 'simple_decode_map' => | ||
| 290 | { | ||
| 291 | 'S' => 'sing', | ||
| 292 | 'P' => 'plur' | ||
| 293 | } | ||
| 294 | ); | ||
| 295 | # 7. GENDER #################### | ||
| 296 | $atoms{gender} = $self->create_atom | ||
| 297 | ( | ||
| 298 | 'surfeature' => 'gender', | ||
| 299 | 'decode_map' => | ||
| 300 | { | ||
| 301 | 'A' => ['gender' => 'com', 'animacy' => 'anim'], | ||
| 302 | 'I' => ['gender' => 'com', 'animacy' => 'inan'], | ||
| 303 | 'F' => ['gender' => 'fem'], | ||
| 304 | 'M' => ['gender' => 'masc'], | ||
| 305 | 'N' => ['gender' => 'neut'], | ||
| 306 | 'H' => ['gender' => 'com', 'polite' => 'form'] | ||
| 307 | }, | ||
| 308 | 'encode_map' => | ||
| 309 | { | ||
| 310 | 'gender' => { 'masc' => 'M', | ||
| 311 | 'fem' => 'F', | ||
| 312 | 'com' => { 'polite' => { 'form' => 'H', | ||
| 313 | '@' => { 'animacy' => { 'inan' => 'I', | ||
| 314 | '@' => 'A' }}}}, | ||
| 315 | 'neut' => 'N' } | ||
| 316 | } | ||
| 317 | ); | ||
| 318 | # 8. VOICE #################### | ||
| 319 | $atoms{voice} = $self->create_simple_atom | ||
| 320 | ( | ||
| 321 | 'intfeature' => 'voice', | ||
| 322 | 'simple_decode_map' => | ||
| 323 | { | ||
| 324 | 'A' => 'act', | ||
| 325 | # Only the passive auxiliary verb "patu" ("experience") is tagged with "P". All other verbs receive "A". | ||
| 326 | 'P' => 'pass' | ||
| 327 | } | ||
| 328 | ); | ||
| 329 | # 9. POLARITY #################### | ||
| 330 | $atoms{polarity} = $self->create_simple_atom | ||
| 331 | ( | ||
| 332 | 'intfeature' => 'polarity', | ||
| 333 | 'simple_decode_map' => | ||
| 334 | { | ||
| 335 | 'A' => 'pos', | ||
| 336 | 'N' => 'neg' | ||
| 337 | } | ||
| 338 | ); | ||
| 339 | return \%atoms; | ||
| 340 | } | ||
| 341 | |||
| 342 | |||
| 343 | |||
| 344 | #------------------------------------------------------------------------------ | ||
| 345 | # Creates the list of surface features (character positions) that can appear | ||
| 346 | # with particular parts of speech. | ||
| 347 | #------------------------------------------------------------------------------ | ||
| 348 | sub _create_features_pos | ||
| 349 | { | ||
| 350 | my $self = shift; | ||
| 351 | my %features = | ||
| 352 | ( | ||
| 353 | 'A' => ['morphpos', 'gender', 'number', 'case', 'degree'], | ||
| 354 | 'D' => ['degree'], | ||
| 355 | 'E' => ['adpostype', 'case'], | ||
| 356 | 'G' => ['voice', 'gender', 'number', 'case', 'degree'], | ||
| 357 | 'N' => ['morphpos', 'gender', 'number', 'case'], | ||
| 358 | 'O' => ['conditionality'], | ||
| 359 | 'P' => ['morphpos', 'gender', 'number', 'case', 'agglutination'], | ||
| 360 | 'S' => ['morphpos', 'gender', 'number', 'case'], | ||
| 361 | 'T' => ['conditionality'], | ||
| 362 | 'V' => ['verbform', 'aspect', 'number', 'person', 'polarity'], | ||
| 363 | 'VL' => ['verbform', 'aspect', 'number', 'person', 'gender', 'polarity'] | ||
| 364 | ); | ||
| 365 | return \%features; | ||
| 366 | } | ||
| 367 | |||
| 368 | |||
| 369 | |||
| 370 | #------------------------------------------------------------------------------ | ||
| 371 | # Decodes a physical tag (string) and returns the corresponding feature | ||
| 372 | # structure. | ||
| 373 | #------------------------------------------------------------------------------ | ||
| 374 | sub decode | ||
| 375 | { | ||
| 376 | my $self = shift; | ||
| 377 | my $tag = shift; | ||
| 378 | my $fs = Lingua::Interset::FeatureStructure->new(); | ||
| 379 | $fs->set_tagset('ta::tamiltb'); | ||
| 380 | my $atoms = $self->atoms(); | ||
| 381 | my @chars = split(//, $tag); | ||
| 382 | $atoms->{pos}->decode_and_merge_hard($chars[0].$chars[1], $fs); | ||
| 383 | $atoms->{case}->decode_and_merge_hard($chars[2], $fs); | ||
| 384 | $atoms->{tense}->decode_and_merge_hard($chars[3], $fs); | ||
| 385 | $atoms->{person}->decode_and_merge_hard($chars[4], $fs); | ||
| 386 | $atoms->{number}->decode_and_merge_hard($chars[5], $fs); | ||
| 387 | $atoms->{gender}->decode_and_merge_hard($chars[6], $fs); | ||
| 388 | $atoms->{voice}->decode_and_merge_hard($chars[7], $fs); | ||
| 389 | $atoms->{polarity}->decode_and_merge_hard($chars[8], $fs); | ||
| 390 | return $fs; | ||
| 391 | } | ||
| 392 | |||
| 393 | |||
| 394 | |||
| 395 | #------------------------------------------------------------------------------ | ||
| 396 | # Takes feature structure and returns the corresponding physical tag (string). | ||
| 397 | #------------------------------------------------------------------------------ | ||
| 398 | sub encode | ||
| 399 | { | ||
| 400 | my $self = shift; | ||
| 401 | my $fs = shift; # Lingua::Interset::FeatureStructure | ||
| 402 | my $atoms = $self->atoms(); | ||
| 403 | my $pos = $atoms->{pos}->encode($fs); | ||
| 404 | my $tag = $pos.'-------'; | ||
| 405 | my @tag = split(//, $tag); | ||
| 406 | my @features = ('pos', 'subpos', 'case', 'tense', 'person', 'number', 'gender', 'voice', 'polarity'); | ||
| 407 | for(my $i = 2; $i<9; $i++) | ||
| 408 | { | ||
| 409 | my $atag = $atoms->{$features[$i]}->encode($fs); | ||
| 410 | # If we got undef, there is something wrong with our encoding tables. | ||
| 411 | if(!defined($atag)) | ||
| 412 | { | ||
| 413 | print STDERR ("\n", $fs->as_string(), "\n"); | ||
| 414 | confess("Cannot encode '$features[$i]'"); | ||
| 415 | } | ||
| 416 | if($atag ne '') | ||
| 417 | { | ||
| 418 | $tag[$i] = $atag; | ||
| 419 | } | ||
| 420 | } | ||
| 421 | $tag = join('', @tag); | ||
| 422 | return $tag; | ||
| 423 | } | ||
| 424 | |||
| 425 | |||
| 426 | |||
| 427 | #------------------------------------------------------------------------------ | ||
| 428 | # Returns reference to list of known tags. | ||
| 429 | # The tags were collected from the corpus. | ||
| 430 | # 233 tags found. | ||
| 431 | #------------------------------------------------------------------------------ | ||
| 432 | sub list | ||
| 433 | { | ||
| 434 | my $self = shift; | ||
| 435 | my $list = <<end_of_list | ||
| 436 | AA------- | ||
| 437 | CC------- | ||
| 438 | DD------- | ||
| 439 | JJ------- | ||
| 440 | Jd-D----A | ||
| 441 | Jd-F----A | ||
| 442 | Jd-P----A | ||
| 443 | Jd-T----A | ||
| 444 | Jd-T----N | ||
| 445 | NEA-3PA-- | ||
| 446 | NEA-3PN-- | ||
| 447 | NEA-3SH-- | ||
| 448 | NEA-3SN-- | ||
| 449 | NED-3PA-- | ||
| 450 | NED-3PN-- | ||
| 451 | NED-3SH-- | ||
| 452 | NED-3SN-- | ||
| 453 | NEG-3SH-- | ||
| 454 | NEG-3SN-- | ||
| 455 | NEI-3PA-- | ||
| 456 | NEL-3PA-- | ||
| 457 | NEL-3PN-- | ||
| 458 | NEL-3SN-- | ||
| 459 | NEN-3PA-- | ||
| 460 | NEN-3SH-- | ||
| 461 | NEN-3SN-- | ||
| 462 | NNA-3PA-- | ||
| 463 | NNA-3PN-- | ||
| 464 | NNA-3SH-- | ||
| 465 | NNA-3SN-- | ||
| 466 | NND-3PA-- | ||
| 467 | NND-3PN-- | ||
| 468 | NND-3SH-- | ||
| 469 | NND-3SN-- | ||
| 470 | NNG-3PA-- | ||
| 471 | NNG-3PN-- | ||
| 472 | NNG-3SH-- | ||
| 473 | NNG-3SN-- | ||
| 474 | NNI-3PA-- | ||
| 475 | NNI-3PN-- | ||
| 476 | NNI-3SN-- | ||
| 477 | NNL-3PA-- | ||
| 478 | NNL-3PN-- | ||
| 479 | NNL-3SH-- | ||
| 480 | NNL-3SN-- | ||
| 481 | NNN-3PA-- | ||
| 482 | NNN-3PN-- | ||
| 483 | NNN-3SH-- | ||
| 484 | NNN-3SM-- | ||
| 485 | NNN-3SN-- | ||
| 486 | NNS-3SA-- | ||
| 487 | NNS-3SN-- | ||
| 488 | NO--3SN-- | ||
| 489 | NPDF3PH-A | ||
| 490 | NPLF3PH-A | ||
| 491 | NPND3PH-A | ||
| 492 | NPND3SH-A | ||
| 493 | NPNF3PA-A | ||
| 494 | NPNF3PH-A | ||
| 495 | NPNF3SH-A | ||
| 496 | NPNP3SH-A | ||
| 497 | NPNT3SM-A | ||
| 498 | PP------- | ||
| 499 | QQ------- | ||
| 500 | RBA-3SA-- | ||
| 501 | RBD-3SA-- | ||
| 502 | RBN-3SA-- | ||
| 503 | RBN-3SN-- | ||
| 504 | RhA-1SA-- | ||
| 505 | RhD-1SA-- | ||
| 506 | RhD-3SA-- | ||
| 507 | RhG-3PA-- | ||
| 508 | RhG-3SA-- | ||
| 509 | RiG-3SA-- | ||
| 510 | RiN-3SA-- | ||
| 511 | RiN-3SN-- | ||
| 512 | RpA-1PA-- | ||
| 513 | RpA-2SH-- | ||
| 514 | RpA-3PA-- | ||
| 515 | RpA-3PN-- | ||
| 516 | RpA-3SN-- | ||
| 517 | RpD-1SA-- | ||
| 518 | RpD-2PA-- | ||
| 519 | RpD-3PA-- | ||
| 520 | RpD-3SH-- | ||
| 521 | RpD-3SN-- | ||
| 522 | RpG-1PA-- | ||
| 523 | RpG-1SA-- | ||
| 524 | RpG-2SH-- | ||
| 525 | RpG-3PA-- | ||
| 526 | RpG-3SH-- | ||
| 527 | RpG-3SN-- | ||
| 528 | RpI-1PA-- | ||
| 529 | RpI-3PA-- | ||
| 530 | RpL-3SN-- | ||
| 531 | RpN-1PA-- | ||
| 532 | RpN-1SA-- | ||
| 533 | RpN-2PA-- | ||
| 534 | RpN-2SH-- | ||
| 535 | RpN-3PA-- | ||
| 536 | RpN-3PN-- | ||
| 537 | RpN-3SA-- | ||
| 538 | RpN-3SH-- | ||
| 539 | RpN-3SN-- | ||
| 540 | TS------- | ||
| 541 | Tb------- | ||
| 542 | Td-D----A | ||
| 543 | Td-P----A | ||
| 544 | Te------- | ||
| 545 | Tg------- | ||
| 546 | Tk------- | ||
| 547 | Tl------- | ||
| 548 | Tm------- | ||
| 549 | Tn------- | ||
| 550 | To------- | ||
| 551 | Tq------- | ||
| 552 | Ts------- | ||
| 553 | Tt-T----A | ||
| 554 | Tv------- | ||
| 555 | Tw-T----A | ||
| 556 | TzAF3SN-A | ||
| 557 | TzIF3SN-A | ||
| 558 | TzNF3SN-A | ||
| 559 | U=------- | ||
| 560 | U=D-3SN-A | ||
| 561 | U=L-3SN-A | ||
| 562 | Ux------- | ||
| 563 | UxA-3SN-A | ||
| 564 | UxD-3SN-A | ||
| 565 | UxL-3SN-- | ||
| 566 | UxL-3SN-A | ||
| 567 | UxN-3SH-- | ||
| 568 | Uy------- | ||
| 569 | VR-D1SAAA | ||
| 570 | VR-D3PHAA | ||
| 571 | VR-D3PHPA | ||
| 572 | VR-D3PNAA | ||
| 573 | VR-D3PNPA | ||
| 574 | VR-D3SHAA | ||
| 575 | VR-D3SHPA | ||
| 576 | VR-D3SNAA | ||
| 577 | VR-D3SNPA | ||
| 578 | VR-F3PAAA | ||
| 579 | VR-F3PHPA | ||
| 580 | VR-F3SHAA | ||
| 581 | VR-F3SNAA | ||
| 582 | VR-F3SNPA | ||
| 583 | VR-P1PAAA | ||
| 584 | VR-P2PHAA | ||
| 585 | VR-P3PAAA | ||
| 586 | VR-P3PAPA | ||
| 587 | VR-P3PHAA | ||
| 588 | VR-P3PHPA | ||
| 589 | VR-P3PNAA | ||
| 590 | VR-P3PNPA | ||
| 591 | VR-P3SHAA | ||
| 592 | VR-P3SNAA | ||
| 593 | VR-P3SNPA | ||
| 594 | VR-T1PAAA | ||
| 595 | VR-T1SAAA | ||
| 596 | VR-T3PAAA | ||
| 597 | VR-T3PHAA | ||
| 598 | VR-T3PNAA | ||
| 599 | VR-T3SHAA | ||
| 600 | VR-T3SN-N | ||
| 601 | VR-T3SNAA | ||
| 602 | VT-T---AA | ||
| 603 | VT-T---PA | ||
| 604 | VU-T---AA | ||
| 605 | VU-T---PA | ||
| 606 | VW-T---AA | ||
| 607 | VW-T---PA | ||
| 608 | VZAF3SNAA | ||
| 609 | VZAT3SNAA | ||
| 610 | VZDD3SNAA | ||
| 611 | VZDD3SNPA | ||
| 612 | VZIT3SNAA | ||
| 613 | VZND3SNAA | ||
| 614 | VZND3SNPA | ||
| 615 | VZNF3SNAA | ||
| 616 | VZNT3SNAA | ||
| 617 | Vj-T2PAAA | ||
| 618 | Vr-D1P-AA | ||
| 619 | Vr-D1SAAA | ||
| 620 | Vr-D3PAAA | ||
| 621 | Vr-D3PHAA | ||
| 622 | Vr-D3PNAA | ||
| 623 | Vr-D3SHAA | ||
| 624 | Vr-D3SNAA | ||
| 625 | Vr-F1P-AA | ||
| 626 | Vr-F3PHAA | ||
| 627 | Vr-F3PNAA | ||
| 628 | Vr-F3SHAA | ||
| 629 | Vr-F3SNAA | ||
| 630 | Vr-P1P-AA | ||
| 631 | Vr-P1PAAA | ||
| 632 | Vr-P1SAAA | ||
| 633 | Vr-P2PAAA | ||
| 634 | Vr-P2PHAA | ||
| 635 | Vr-P3PHAA | ||
| 636 | Vr-P3PNAA | ||
| 637 | Vr-P3SHAA | ||
| 638 | Vr-P3SNAA | ||
| 639 | Vr-T1SAAA | ||
| 640 | Vr-T2SH-N | ||
| 641 | Vr-T3PNAA | ||
| 642 | Vr-T3SNAA | ||
| 643 | Vt-T----N | ||
| 644 | Vt-T---AA | ||
| 645 | Vu-T---AA | ||
| 646 | Vu-T---PA | ||
| 647 | Vw-T---AA | ||
| 648 | VzAD3SNAA | ||
| 649 | VzAF3SNAA | ||
| 650 | VzDD3SNAA | ||
| 651 | VzDF3SNAA | ||
| 652 | VzDF3SNPA | ||
| 653 | VzGD3SNAA | ||
| 654 | VzID3SNAA | ||
| 655 | VzIF3SNAA | ||
| 656 | VzIT3SNAA | ||
| 657 | VzLD3SNAA | ||
| 658 | VzLF3SNAA | ||
| 659 | VzLT3SNAA | ||
| 660 | VzND3PNAA | ||
| 661 | VzND3SNAA | ||
| 662 | VzND3SNPA | ||
| 663 | VzNF3SNAA | ||
| 664 | VzNP3SNAA | ||
| 665 | VzNT3SN-N | ||
| 666 | VzNT3SNAA | ||
| 667 | Z#------- | ||
| 668 | Z:------- | ||
| 669 | end_of_list | ||
| 670 | ; | ||
| 671 | my @list = split(/\r?\n/, $list); | ||
| 672 | return \@list; | ||
| 673 | } | ||
| 674 | |||
| 675 | |||
| 676 | |||
| 677 | 1; | ||
| 678 | |||
| 679 | __END__ | ||
| 680 | |||
| 681 | =pod | ||
| 682 | |||
| 683 | =encoding UTF-8 | ||
| 684 | |||
| 685 | =head1 NAME | ||
| 686 | |||
| 687 | Lingua::Interset::Tagset::TA::Tamiltb - Driver for the tagset of the (Prague) Tamil Dependency Treebank (TamilTB) | ||
| 688 | |||
| 689 | =head1 VERSION | ||
| 690 | |||
| 691 | version 3.015 | ||
| 692 | |||
| 693 | =head1 SYNOPSIS | ||
| 694 | |||
| 695 | use Lingua::Interset::Tagset::SK::Snk; | ||
| 696 | my $driver = Lingua::Interset::Tagset::SK::Snk->new(); | ||
| 697 | my $fs = $driver->decode('SSms1'); | ||
| 698 | |||
| 699 | or | ||
| 700 | |||
| 701 | use Lingua::Interset qw(decode); | ||
| 702 | my $fs = decode('sk::snk', 'SSms1'); | ||
| 703 | |||
| 704 | =head1 DESCRIPTION | ||
| 705 | |||
| 706 | Interset driver for the tags of the Slovak National Corpus (Slovenský národný korpus). | ||
| 707 | |||
| 708 | L<http://ufal.mff.cuni.cz/~ramasamy/tamiltb/0.1/morph_annotation.html> | ||
| 709 | |||
| 710 | =head1 AUTHORS | ||
| 711 | |||
| 712 | Dan Zeman <zeman@ufal.mff.cuni.cz>, | ||
| 713 | Loganathan Ramasamy <ramasamy@ufal.mff.cuni.cz> | ||
| 714 | |||
| 715 | =head1 SEE ALSO | ||
| 716 | |||
| 717 | L<Lingua::Interset>, | ||
| 718 | L<Lingua::Interset::Tagset>, | ||
| 719 | L<Lingua::Interset::FeatureStructure> | ||
| 720 | |||
| 721 | =head1 AUTHOR | ||
| 722 | |||
| 723 | Dan Zeman <zeman@ufal.mff.cuni.cz> | ||
| 724 | |||
| 725 | =head1 COPYRIGHT AND LICENSE | ||
| 726 | |||
| 727 | This software is copyright (c) 2019 by Univerzita Karlova (Charles University). | ||
| 728 | |||
| 729 | This is free software; you can redistribute it and/or modify it under | ||
| 730 | the same terms as the Perl 5 programming language system itself. | ||
| 731 | |||
| 732 | =cut |