Interset/Tagset/JA/Conll.pm untested

filter: Statementstmt 0.0% 0 / 260 Branchbran 0.0% 0 / 12 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 13 Podpod 0.0% 0 / 7 totaltotal 0.0% 0 / 292 CC 7 SCAR 27.1
CC
7
Cov
0%
encode
42.0
decode
6.0
get_tagset_id
2.0
CRAP 15.1
1 # ABSTRACT: Driver for the Japanese tagset of the CoNLL 2006 Shared Task (derived from the TüBa J/S Verbmobil treebank).
2 # Copyright © 2011, 2012, 2014, 2017 Dan Zeman <zeman@ufal.mff.cuni.cz>
3 # Copyright © 2011 Loganathan Ramasamy <ramasamy@ufal.mff.cuni.cz>
4  
5 package Lingua::Interset::Tagset::JA::Conll;
6 use strict;
7 use warnings;
8 our $VERSION = '3.015';
9  
10 use utf8;
11 use open ':utf8';
12 use namespace::autoclean;
13 use Moose;
14 extends 'Lingua::Interset::Tagset::Conll';
15  
16  
17  
18 #------------------------------------------------------------------------------
19 # Returns the tagset id that should be set as the value of the 'tagset' feature
20 # during decoding. Every derived class must (re)define this method! The result
21 # should correspond to the last two parts in package name, lowercased.
22 # Specifically, it should be the ISO 639-2 language code, followed by '::' and
23 # a language-specific tagset id. Example: 'cs::multext'.
24 #------------------------------------------------------------------------------
25 sub get_tagset_id
26 {
27 return 'ja::conll';
28 }
29  
30  
31  
32 #------------------------------------------------------------------------------
33 # Creates atomic drivers for surface features.
34 #------------------------------------------------------------------------------
35 sub _create_atoms
36 {
37 my $self = shift;
38 my %atoms;
39 # PART OF SPEECH ####################
40 # /net/data/conll/2006/ja/doc/fine2coarse.table
41 $atoms{pos} = $self->create_atom
42 (
43 'surfeature' => 'pos',
44 'decode_map' =>
45 {
46 # to, su, shi, o, i; e.g. "to" could be also ITJ, P, PQ, Pcnj, PSSa
47 '--' => [],
48 '.' => ['pos' => 'punc', 'punctype' => 'peri'], # sentence-final punctuation (.)
49 ',' => ['pos' => 'punc', 'punctype' => 'comm'], # comma (,)
50 '?' => ['pos' => 'punc', 'punctype' => 'qest'], # question mark (?)
51 # adjective other (onaji, iroNna, taishita, iroirona, korekorekouiu)
52 'ADJ' => ['pos' => 'adj'],
53 # adjective demonstrative (sono, kono, koNna, soNna, ano)
54 'ADJdem' => ['pos' => 'adj', 'prontype' => 'dem'],
55 # adjective conditional (-reba, -tara) (yoroshikereba, nakereba, yokereba, chikakereba, takakunakereba) [yoroshikereba = if you please]
56 'ADJicnd' => ['pos' => 'adj', 'mood' => 'cnd', 'other' => {'adjtype' => 'i'}],
57 # i-adjective, -i ending (yoroshii, ii, nai, chikai, osoi) [yoroshii = good]
58 'ADJifin' => ['pos' => 'adj', 'verbform' => 'fin', 'other' => {'adjtype' => 'i'}],
59 # Finite adjective can also occur with the feature "ta" (yokatta, yoroshikatta, tookatta, nakatta) [yokatta = was good].
60 # i-adjective, -ku ending (yoroshiku, arigatou, ohayou, hayaku, yoku)
61 # These are actually adverbs derived from adjectives.
62 # [adverb; yoroshiku = well, properly; best regards ("please treat me favourably")]
63 'ADJiku' => ['pos' => 'adv', 'other' => {'adjtype' => 'i', 'advtype' => 'ku'}],
64 # i-adjective, -kute ending (nakute, chikakute, yasukute, takakute, yokute)
65 # [converb/transgressive/participle form of adjective; str. 74]
66 'ADJite' => ['pos' => 'adv', 'verbform' => 'conv', 'other' => {'adjtype' => 'i', 'advtype' => 'kute'}],
67 # n-adjective, concatenating "-na; PV" (daijoubu, kekkou, beNri, hajimete, muri) [daijoubu = safe; all right; kekkou = nice, fine]
68 'ADJ_n' => ['pos' => 'adj', 'other' => {'adjtype' => 'n'}],
69 # adjectival suffix "na" (na) [dame na = bad]
70 'ADJsf' => ['pos' => 'adj', 'other' => {'adjtype' => 'sf'}],
71 # adjective, -teki ending (jikaNteki, gutaiteki, kojiNteki, nedaNteki, nitteiteki) [-teki = -like; jikaNteki = time-like, temporal]
72 'ADJteki' => ['pos' => 'adj', 'other' => {'adjtype' => 'teki'}],
73 # adjective interrogative (dono, doNna, douitta, douiu) [dono = which, what, how]
74 'ADJwh' => ['pos' => 'adj', 'prontype' => 'int'],
75 # adverb (chotto, mou, mata, dekireba, daitai) [chotto = just a minute; mou = more, already; mata = moreover]
76 'ADV' => ['pos' => 'adv'],
77 # adverb demonstrative (sou, kou, so) [sou = so]
78 'ADVdem' => ['pos' => 'adv', 'prontype' => 'dem'],
79 # adverb of degree (ichibaN, sukoshi, chotto, amari, soNnani) [ichibaN = best, first]
80 'ADVdgr' => ['pos' => 'adv', 'advtype' => 'deg'],
81 # adverb of time, not numeric (mazu, sassoku, sakihodo, sakki, toriaezu) [mazu = first; sassoku = immediately; sakihodo = not long ago, just now]
82 'ADVtmp' => ['pos' => 'adv', 'advtype' => 'tim'],
83 # adverb interrogative (dou, ikaga, doushite) [dou, ikaga = how, in what way]
84 'ADVwh' => ['pos' => 'adv', 'prontype' => 'int'],
85 # cardinal numeral (ichi, ni, saN, hyaku) [ichi = one, ni = two, saN = three]
86 'CD' => ['pos' => 'num', 'numtype' => 'card'],
87 # cardinal numeral with unit [CD-shitsu, biN, kiro] (mittsu, hitotsu, ichinichi, futatsu, ichido)
88 'CDU' => ['pos' => 'num', 'numtype' => 'card', 'other' => {'numtype' => 'unit'}],
89 # cardinal numeral with date unit (juugatsu, juuninichi, nigatsu, tooka, mikka) [juugatsu = ten-month, October; juuninichi = twelve-day, twelfth day of the month]
90 'CDdate' => ['pos' => 'adv', 'advtype' => 'tim', 'other' => {'advtype' => 'date'}],
91 # cardinal numeral with time unit (gojuppuN, juuichiji, juuji, saNjuugofuN, juugofuN) [gojuppuN = fifty minutes; juuichiji = eleven o'clock]
92 'CDtime' => ['pos' => 'adv', 'advtype' => 'tim', 'other' => {'advtype' => 'time'}],
93 # conjunction, sentence-initial or between nominals (dewa, de, soredewa, ato, soshitara) [soredewa = now, so; ato = after]
94 'CNJ' => ['pos' => 'conj'],
95 # greeting [koNnichiwa = hello; otsukaresama = thank you very much; sayounara = good bye]
96 'GR' => ['pos' => 'int', 'other' => {'inttype' => 'greeting'}],
97 # interjection (hai, ee, to, e, a) [hai = yes]
98 'ITJ' => ['pos' => 'int'],
99 # formal noun (hou, no, koto, nano, naN) [watakushi no hou = on my part, my way (watakushi = I)]
100 'NF' => ['pos' => 'noun', 'other' => {'nountype' => 'formal'}],
101 # common noun (hoteru = hotel, biN = jar, hikouki = airplane, shiNguru = single, kaeri = return)
102 'NN' => ['pos' => 'noun', 'nountype' => 'com'],
103 # demonstrative pronoun (sore = that, kochira = here, sochira = there, kore = this, soko = there)
104 'Ndem' => ['pos' => 'noun', 'prontype' => 'dem'],
105 # suffix to nominal phrase (hatsu, chaku, gurai, keiyu, hodo) [hatsu = departure, chaku = arrival, keiyu = via] [NP(furaNkufuruto/NAMEloc/COMP keiyu/Nsf/HD) = via Frankfurt]
106 'Nsf' => ['pos' => 'noun', 'other' => {'nountype' => 'sf'}],
107 # temporal noun (ima = now, hi = day, asa = morning, yuugata = evening, koNdo = this time)
108 'Ntmp' => ['pos' => 'noun', 'advtype' => 'tim'],
109 # another tag for temporal noun? (kayoubi = Tuesday, getsuyoubi = Monday, suiyoubi = Wednesday, gogo = afternoon, kiNyoubi = Friday)
110 'NT' => ['pos' => 'noun', 'advtype' => 'tim', 'other' => {'nountype' => 'weekday'}],
111 # interrogative pronoun (dochira = where, itsu = when, naNji = what time, dore = which, docchi = which way, which one)
112 'Nwh' => ['pos' => 'noun', 'prontype' => 'int'],
113 # personal pronoun (watashi = I, watakushi = I, boku = I, atashi = I, atakushi = I)
114 'PRON' => ['pos' => 'noun', 'prontype' => 'prs'],
115 # verbal (predicative) noun, VN-suru = make-VN (onegai, shuppatsu, yoyaku, kaNkou, shuchhou) [onegai = please; shuppatsu = departure; yoyaku = reservation]
116 'VN' => ['pos' => 'noun', 'other' => {'nountype' => 'lightverb'}],
117 # proper noun (doNjobaNni = Don Giovanni, kurisumasu, zeNnikkuubiN, omamori, nihoNkoukuubiN)
118 'NAME' => ['pos' => 'noun', 'nountype' => 'prop'],
119 # name of location (hanoofaa = Hannover, doitsu = Germany, kaNkuu = Kansai International Airport, furaNkufuruto = Frankfurt, roNdoN = London)
120 'NAMEloc' => ['pos' => 'noun', 'nountype' => 'prop', 'nametype' => 'geo'],
121 # name of organization (rufutohaNza = Lufthansa; jaru = JAL, Japan Airlines; rufutohaNzakoukuu, nihoNkoukuu, zeNnikkuu)
122 'NAMEorg' => ['pos' => 'noun', 'nountype' => 'prop', 'nametype' => 'com'],
123 # name of person (matsumoto, miyake, kitahara, yoshikawa, tsutsui)
124 'NAMEper' => ['pos' => 'noun', 'nountype' => 'prop', 'nametype' => 'prs'],
125 # postposition / particle [np];[pp] (ni, de, kara, made, to)
126 'P' => ['pos' => 'adp', 'adpostype' => 'post'],
127 # adjectival particle [vp];[ap] (youna, you, mitai, rashii, sou)
128 # PADJ also occurs with the feature 'kute' (the only form is rashikute)
129 'PADJ' => ['pos' => 'adp', 'adpostype' => 'post', 'other' => {'parttype' => 'adj'}],
130 # adverbial particle [vp];[ap] (youni, fuuni, shidai, nagara, hodo)
131 'PADV' => ['pos' => 'adp', 'adpostype' => 'post', 'other' => {'parttype' => 'adv'}],
132 # title suffix to personal name: okamoto saN = Mr./Ms. Okamoto
133 # (saN, sama)
134 'PNsf' => ['pos' => 'noun', 'other' => {'nountype' => 'title'}],
135 # particle of quotation (to, te, naNte, toka, ka, tte)
136 'PQ' => ['pos' => 'adp', 'adpostype' => 'post', 'other' => {'parttype' => 'quot'}],
137 # accusative particle [np] (o)
138 'Pacc' => ['pos' => 'adp', 'adpostype' => 'post', 'case' => 'acc'],
139 # coordinating conjunction / particle (to = and; ka, ya = or; toka, nari)
140 'Pcnj' => ['pos' => 'conj', 'conjtype' => 'coor'],
141 # focus particle (wa, mo, demo, koso, nara, sae)
142 'Pfoc' => ['pos' => 'adp', 'adpostype' => 'post', 'other' => {'parttype' => 'focus'}],
143 # genitive particle [np] (no)
144 'Pgen' => ['pos' => 'adp', 'adpostype' => 'post', 'case' => 'gen'],
145 # nominative particle [np] (ga)
146 'Pnom' => ['pos' => 'adp', 'adpostype' => 'post', 'case' => 'nom'],
147 # S-end (clause-final) particle (ka, ne, yo, na, kana)
148 'PSE' => ['pos' => 'part', 'other' => {'parttype' => 'send'}],
149 # S-conjunctive particle "and" (node, to, shi, kara, nanode)
150 'PSSa' => ['pos' => 'part', 'other' => {'parttype' => 'sand'}],
151 # S-conjunctive particle "but" (ga, keredomo, kedo, kedomo, keredo)
152 'PSSb' => ['pos' => 'part', 'other' => {'parttype' => 'sbut'}],
153 # S-conjunctive particle question (ka)
154 'PSSq' => ['pos' => 'part', 'other' => {'parttype' => 'qest'}],
155 # What they call "particle verb" is regarded by other authors a copula ("to be").
156 # particle verb+cond (deshitara, dattara, deshitaraba)
157 'PVcnd' => ['pos' => 'verb', 'verbtype' => 'cop', 'verbform' => 'fin', 'mood' => 'cnd'],
158 # particle verb+tens (feature ta: da, deshita, datta; feature u: desu, deshou, darou)
159 'PVfin' => ['pos' => 'verb', 'verbtype' => 'cop', 'verbform' => 'fin', 'mood' => 'ind'],
160 # particle verb-tens (de, deshite)
161 'PVte' => ['pos' => 'verb', 'verbtype' => 'cop', 'verbform' => 'conv'],
162 # noun prefix (yaku, dai, yoku, maru, Frau)
163 'PreN' => ['pos' => 'noun', 'other' => {'nountype' => 'pref'}],
164 # unit (maruku, biN, meetoru, kiro, shitsu) [maruku = mark, meetoru = meter, kiro = kilo]
165 'UNIT' => ['pos' => 'noun', 'other' => {'nountype' => 'unit'}],
166 # verb-tense (ittari, nitari, tomarezu, shirabetari, tanoshimetari) [ittari = and go; nitari = barge]
167 'V' => ['pos' => 'verb'],
168 # verb-tense, stem and 1st/2nd/5th base (mi, tore, nomi, kimari, kiki, tabe) [mi = look at, tabe = eat]
169 'Vbas' => ['pos' => 'verb', 'other' => {'verbform' => 'base'}],
170 # verb conditional (shimashitara, shitara, areba, arimashitara, dekimashitara) [str. 160]
171 'Vcnd' => ['pos' => 'verb', 'mood' => 'cnd'],
172 # finite verb + tense (-ru, -ta, -masu, -maseN)
173 # Finite verbs occur with three different features:
174 # eN (sumimaseN, arimaseN, kamaimaseN, suimaseN, shiremaseN) [honorific negative future] [str. 61]
175 # ta (wakarimashita, gozaimashita, itta, kashikomarimashita, hanareta) [past] [str. 61]
176 # u (iu, aru, arimasu, narimasu, omoimasu) [present or afirmative future?] [str. 61]
177 'Vfin' => ['pos' => 'verb', 'verbform' => 'fin', 'mood' => 'ind'],
178 # verb imperative (gomeNnasai, kudasai, ie, nome, shiro, kimero) [gomeNnasai = pardon me; kudasai = please do]
179 'Vimp' => ['pos' => 'verb', 'verbform' => 'fin', 'mood' => 'imp'],
180 # verb tense, -te/-de ending [transgressive?] (aite, shite, tsuite, natte, arimashite) [str. 73]
181 'Vte' => ['pos' => 'verb', 'verbform' => 'conv'],
182 # Verbal adjectives
183 # -sou verbal adjective [str. 153]
184 # (ikesou, arisou, toresou, owarisou, awanasasou)
185 # [dono atari ikesou desu ka = how do I go around]
186 'VADJ_n' => ['pos' => 'adj', 'other' => {'adjtype' => 'vn'}],
187 # -nai/-tai verbal adjective [str. 67]
188 # (shitai, mitai, ikitai, kimetai, itadakitai)
189 'VADJi' => ['pos' => 'adj', 'other' => {'adjtype' => 'vi'}],
190 # VADJi can also occur with the feature 'kute' (kimenakute, ikanakute, noranakute, wakaranakute, okanakute)
191 # VADJi can also occur with the feature 'ta' (inakatta, ikitakatta, kiitenakatta, dekinakatta)
192 # verbal adjective conditional -nakereba (shinakereba, konakereba, ikanakereba, sashitsukaenakereba, iwanakereba) [shinakereba = unless one does something]
193 'VADJicnd' => ['pos' => 'adj', 'mood' => 'cnd', 'other' => {'adjtype' => 'vicnd'}],
194 # auxiliary verb - tense (mitari, shimattari) [str. 181]
195 'VAUX' => ['pos' => 'verb', 'verbtype' => 'aux'],
196 # auxiliary verb - tense (itadaki) [itadaku = to take]
197 'VAUXbas' => ['pos' => 'verb', 'verbtype' => 'aux', 'other' => {'verbform' => 'base'}],
198 # auxiliary verb conditional (itadakereba, okanakereba, itadaitara, itadakimashitara, mitara)
199 'VAUXcnd' => ['pos' => 'verb', 'verbtype' => 'aux', 'mood' => 'cnd'],
200 # finite auxiliary verb +tense following V (iru, ita, kuru, shimau)
201 # Finite auxiliary verbs occur with three different features:
202 # eN (imaseN, orimaseN, mimaseN, itadakemaseN, shimaimaseN)
203 # ta (ita, mita, imashita, kita, oita, itadaita)
204 # u (iru, okimasu, imasu, orimasu, itadakimasu)
205 'VAUXfin' => ['pos' => 'verb', 'verbtype' => 'aux', 'verbform' => 'fin', 'mood' => 'ind'],
206 # finite auxiliary verb imperative (kudasai, kure)
207 'VAUXimp' => ['pos' => 'verb', 'verbtype' => 'aux', 'verbform' => 'fin', 'mood' => 'imp'],
208 # auxiliary verb -tense -te/-de ending transgressive (imashite, orimashite, itadaite, oite, shimatte)
209 'VAUXte' => ['pos' => 'verb', 'verbtype' => 'aux', 'verbform' => 'conv'],
210 # Support verb (light verb) "suru"
211 # support verb -tense VN (shitari, shinagara)
212 'VS' => ['pos' => 'verb', 'verbtype' => 'light'],
213 # support verb -tense VN (shi)
214 'VSbas' => ['pos' => 'verb', 'verbtype' => 'light', 'other' => {'verbform' => 'base'}],
215 # support verb conditional (dekireba, sureba, dekitara, dekimashitara, shitara)
216 'VScnd' => ['pos' => 'verb', 'verbtype' => 'light', 'mood' => 'cnd'],
217 # finite support verb +tense VN (suru, shita)
218 # Finite support verbs occur with three different features:
219 # eN (shimaseN)
220 # ta (shita, shimashita, itashimashita, sareta, dekita)
221 # u (shimasu, itashimasu, suru, dekimasu, shimashou, dekiru)
222 'VSfin' => ['pos' => 'verb', 'verbtype' => 'light', 'verbform' => 'fin', 'mood' => 'ind'],
223 # finite support verb imperative (shiro)
224 'VSimp' => ['pos' => 'verb', 'verbtype' => 'light', 'verbform' => 'fin', 'mood' => 'imp'],
225 # support verb -tense, -te ending transgressive (shite, sasete, shimashite, sashite, sarete, itashimashite)
226 'VSte' => ['pos' => 'verb', 'verbtype' => 'light', 'verbform' => 'conv'],
227 'xxx' => [], # segmentation problem
228 },
229 'encode_map' =>
230 {
231 'pos' => { 'noun' => { 'prontype' => { '' => { 'nountype' => { 'prop' => { 'nametype' => { 'geo' => 'NAMEloc',
232 'com' => 'NAMEorg',
233 'prs' => 'NAMEper',
234 '@' => 'NAME' }},
235 '@' => { 'other/nountype' => { 'formal' => 'NF',
236 'sf' => 'Nsf',
237 'lightverb' => 'VN',
238 'weekday' => 'NT',
239 'title' => 'PNsf',
240 'unit' => 'UNIT',
241 'pref' => 'PreN',
242 '@' => { 'advtype' => { 'tim' => 'Ntmp',
243 '@' => 'NN' }}}}}},
244 'prs' => 'PRON',
245 'dem' => 'Ndem',
246 'int' => 'Nwh' }},
247 'adj' => { 'prontype' => { '' => { 'other/adjtype' => { 'i' => { 'mood' => { 'cnd' => 'ADJicnd',
248 '@' => { 'verbform' => { 'conv' => 'ADJite',
249 'part' => 'ADJite',
250 '@' => 'ADJifin' }}}},
251 'n' => 'ADJ_n',
252 'sf' => 'ADJsf',
253 'teki' => 'ADJteki',
254 'vi' => 'VADJi',
255 'vicnd'=> 'VADJicnd',
256 'vn' => 'VADJ_n',
257 '@' => { 'tense' => { 'past' => 'ADJifin',
258 '@' => 'ADJ' }}}},
259 'dem' => 'ADJdem',
260 'int' => 'ADJwh' }},
261 'num' => { 'other/numtype' => { 'unit' => 'CDU',
262 '@' => 'CD' }},
263 'verb' => { 'verbtype' => { 'cop' => { 'mood' => { 'cnd' => 'PVcnd',
264 '@' => { 'verbform' => { 'conv' => 'PVte',
265 'part' => 'PVte',
266 '@' => 'PVfin' }}}},
267 'aux' => { 'mood' => { 'cnd' => 'VAUXcnd',
268 'imp' => 'VAUXimp',
269 '@' => { 'verbform' => { 'conv' => 'VAUXte',
270 'part' => 'VAUXte',
271 'fin' => 'VAUXfin',
272 '@' => { 'other/verbform' => { 'base' => 'VAUXbas',
273 '@' => 'VAUX' }}}}}},
274 'light' => { 'mood' => { 'cnd' => 'VScnd',
275 'imp' => 'VSimp',
276 '@' => { 'verbform' => { 'conv' => 'VSte',
277 'part' => 'VSte',
278 'fin' => 'VSfin',
279 '@' => { 'other/verbform' => { 'base' => 'VSbas',
280 '@' => 'VS' }}}}}},
281 '@' => { 'mood' => { 'cnd' => 'Vcnd',
282 'imp' => 'Vimp',
283 '@' => { 'verbform' => { 'conv' => 'Vte',
284 'part' => 'Vte',
285 'fin' => 'Vfin',
286 '@' => { 'other/verbform' => { 'base' => 'Vbas',
287 '@' => 'V' }}}}}}}},
288 'adv' => { 'prontype' => { '' => { 'advtype' => { 'deg' => 'ADVdgr',
289 'tim' => { 'other/advtype' => { 'date' => 'CDdate',
290 'time' => 'CDtime',
291 '@' => 'ADVtmp' }},
292 '@' => { 'other/advtype' => { 'ku' => 'ADJiku',
293 'kute' => 'ADJite',
294 '@' => 'ADV' }}}},
295 'dem' => 'ADVdem',
296 'int' => 'ADVwh' }},
297 'adp' => { 'other/parttype' => { 'adj' => 'PADJ',
298 'adv' => 'PADV',
299 'quot' => 'PQ',
300 'focus' => 'Pfoc',
301 '@' => { 'verbform' => { 'conv' => 'PADJ',
302 '@' => { 'case' => { 'acc' => 'Pacc',
303 'gen' => 'Pgen',
304 'nom' => 'Pnom',
305 '@' => 'P' }}}}}},
306 'conj' => { 'conjtype' => { 'coor' => 'Pcnj',
307 '@' => 'CNJ' }},
308 'part' => { 'other/parttype' => { 'send' => 'PSE',
309 'sand' => 'PSSa',
310 'sbut' => 'PSSb',
311 'qest' => 'PSSq',
312 '@' => 'PSE' }},
313 'int' => { 'other/inttype' => { 'greeting' => 'GR',
314 '@' => 'ITJ' }},
315 'punc' => { 'punctype' => { 'peri' => '.',
316 'qest' => '?',
317 '@' => ',' }},
318 '@' => 'xxx' }
319 }
320 );
321 # FEATURE ####################
322 # Most tags do not have features.
323 # Those who have, have only one of four possible feature values: eN, kute, ta, u
324 $atoms{feature} = $self->create_atom
325 (
326 'surfeature' => 'feature',
327 'decode_map' =>
328 {
329 # eN is the suffix of the honorific negative future [str. 61]
330 # It occurs with the tags Vfin, VAUXfin, VSfin.
331 # examples:
332 # sumimaseN, arimaseN, kamaimaseN, suimaseN, shiremaseN
333 # yomimaseN = will not read
334 'eN' => ['tense' => 'fut', 'polarity' => 'neg', 'polite' => 'form'],
335 # ta is the suffix of the past tense (this includes the honorific "shita") [str. 61]
336 # It occurs with the tags ADJifin, PVfin, Vfin, VADJi, VAUXfin, VSfin.
337 # examples:
338 # wakarimashita, gozaimashita, itta, kashikomarimashita, hanareta
339 # yomimashita = did read, yomimaseNdeshita = did not read
340 'ta' => ['tense' => 'past'],
341 # u is the infinitive (citation form) suffix; masu (affirmative future and present) is also included here [str. 61]
342 # It occurs with the tags PVfin, Vfin, VAUXfin, VSfin.
343 # examples:
344 # iu, aru, arimasu, narimasu, omoimasu
345 # yomu = to read, yomimasu = will read
346 'u' => ['tense' => 'pres|fut'],
347 # kute is the transgressive suffix for adjectives [str. 74]
348 # In fact it is the suffix 'ku' that converts adjectives to adverbs, then 'te' that makes participles (cs:přechodník) from verbs, and here, from adjectives/adverbs.
349 # It occurs with the tags PADJ, VADJi.
350 # It does not occur with ADJ*! The ADJite subpos tag is used instead.
351 # It does not occur with PV*! The PVte subpos tag is used instead.
352 # examples:
353 # nakute, chikakute, yasukute, takakute, yokute
354 'kute' => ['other' => {'kute' => 'yes'}]
355 },
356 'encode_map' =>
357 {
358 'other/kute' => { 'yes' => 'kute',
359 '@' => { 'polarity' => { 'neg' => 'eN',
360 '@' => { 'tense' => { 'past' => 'ta',
361 'pres' => 'u',
362 'fut' => 'u' }}}}}
363 }
364 );
365 return \%atoms;
366 }
367  
368  
369  
370 #------------------------------------------------------------------------------
371 # Creates the list of all surface CoNLL features that can appear in the FEATS
372 # column. This list will be used in decode().
373 #------------------------------------------------------------------------------
374 sub _create_features_all
375 {
376 my $self = shift;
377 my @features = ('feature');
378 return \@features;
379 }
380  
381  
382  
383 #------------------------------------------------------------------------------
384 # Creates the list of surface CoNLL features that can appear in the FEATS
385 # column with particular parts of speech. This list will be used in encode().
386 #------------------------------------------------------------------------------
387 sub _create_features_pos
388 {
389 my $self = shift;
390 my %features =
391 (
392 '@' => []
393 );
394 return \%features;
395 }
396  
397  
398  
399 #------------------------------------------------------------------------------
400 # Decodes a physical tag (string) and returns the corresponding feature
401 # structure.
402 #------------------------------------------------------------------------------
403 sub decode
404 {
405 my $self = shift;
406 my $tag = shift;
407 my $fs = Lingua::Interset::FeatureStructure->new();
408 $fs->set_tagset('ja::conll');
409 my $atoms = $self->atoms();
410 # Three components: pos, subpos, features.
411 # example: N\tNN\t_
412 my ($pos, $subpos, $features) = split(/\s+/, $tag);
413 # The underscore character is used if there are no features.
414 $features = '' if($features eq '_');
415 my @features = split(/\|/, $features);
416 $atoms->{pos}->decode_and_merge_hard($subpos, $fs);
417 foreach my $feature (@features)
418 {
419 $atoms->{feature}->decode_and_merge_hard($feature, $fs);
420 }
421 return $fs;
422 }
423  
424  
425  
426 #------------------------------------------------------------------------------
427 # Takes feature structure and returns the corresponding physical tag (string).
428 #------------------------------------------------------------------------------
429 sub encode
430 {
431 my $self = shift;
432 my $fs = shift; # Lingua::Interset::FeatureStructure
433 my $atoms = $self->atoms();
434 my $subpos = $atoms->{pos}->encode($fs);
435 # POS tags available: -- . ADJ ADV CD CNJ GR ITJ N NAME NT P PS PUNC PV PreN UNIT V VADJ VAUX VS xxx
436 # We do not encode '--', we merge it with 'xxx'.
437 my @postags = ('ADJ', 'ADV', 'CD', 'CNJ', 'GR', 'ITJ', 'NAME', 'NT', 'N', 'PreN', 'PUNC', 'PS', 'PV', 'P', 'UNIT', 'VADJ', 'VAUX', 'VS', 'V', 'xxx');
438 my $pos = $subpos eq '.' ? '.' : 'xxx';
439 if($subpos =~ m/^(PRON|VN)$/)
440 {
441 $pos = 'N';
442 }
443 elsif($subpos =~ m/^[,?]$/)
444 {
445 $pos = 'PUNC';
446 }
447 else
448 {
449 foreach my $p (@postags)
450 {
451 if($subpos =~ m/^$p/)
452 {
453 $pos = $p;
454 last;
455 }
456 }
457 }
458 my $feature = $atoms->{feature}->encode($fs);
459 $feature = '_' if($feature eq '');
460 my $tag = "$pos\t$subpos\t$feature";
461 return $tag;
462 }
463  
464  
465  
466 #------------------------------------------------------------------------------
467 # Returns reference to list of known tags.
468 # Tags were collected from the corpus, 91 tags found.
469 # After cleaning: 90
470 #------------------------------------------------------------------------------
471 sub list
472 {
473 my $self = shift;
474 my $list = <<end_of_list
475 . . _
476 ADJ ADJ _
477 ADJ ADJ_n _
478 ADJ ADJdem _
479 ADJ ADJicnd _
480 ADJ ADJifin _
481 ADJ ADJifin ta
482 ADJ ADJiku _
483 ADJ ADJite _
484 ADJ ADJsf _
485 ADJ ADJteki _
486 ADJ ADJwh _
487 ADV ADV _
488 ADV ADVdem _
489 ADV ADVdgr _
490 ADV ADVtmp _
491 ADV ADVwh _
492 CD CD _
493 CD CDU _
494 CD CDdate _
495 CD CDtime _
496 CNJ CNJ _
497 GR GR _
498 ITJ ITJ _
499 N NF _
500 N NN _
501 N Ndem _
502 N Nsf _
503 N Ntmp _
504 N Nwh _
505 N PRON _
506 N VN _
507 NAME NAME _
508 NAME NAMEloc _
509 NAME NAMEorg _
510 NAME NAMEper _
511 NT NT _
512 P P _
513 P PADJ _
514 P PADJ kute
515 P PADV _
516 P PNsf _
517 P PQ _
518 P Pacc _
519 P Pcnj _
520 P Pfoc _
521 P Pgen _
522 P Pnom _
523 PS PSE _
524 PS PSSa _
525 PS PSSb _
526 PS PSSq _
527 PUNC , _
528 PUNC ? _
529 PV PVcnd _
530 PV PVfin ta
531 PV PVfin u
532 PV PVte _
533 PreN PreN _
534 UNIT UNIT _
535 V V _
536 V Vbas _
537 V Vcnd _
538 V Vfin eN
539 V Vfin ta
540 V Vfin u
541 V Vimp _
542 V Vte _
543 VADJ VADJ_n _
544 VADJ VADJi _
545 VADJ VADJi kute
546 VADJ VADJi ta
547 VADJ VADJicnd _
548 VAUX VAUX _
549 VAUX VAUXbas _
550 VAUX VAUXcnd _
551 VAUX VAUXfin eN
552 VAUX VAUXfin ta
553 VAUX VAUXfin u
554 VAUX VAUXimp _
555 VAUX VAUXte _
556 VS VS _
557 VS VSbas _
558 VS VScnd _
559 VS VSfin eN
560 VS VSfin ta
561 VS VSfin u
562 VS VSimp _
563 VS VSte _
564 xxx xxx _
565 end_of_list
566 ;
567 # Protect from editors that replace tabs by spaces.
568 $list =~ s/ \s+/\t/sg;
569 my @list = split(/\r?\n/, $list);
570 return \@list;
571 }
572  
573  
574  
575 1;
576  
577 __END__
578  
579 =pod
580  
581 =encoding UTF-8
582  
583 =head1 NAME
584  
585 Lingua::Interset::Tagset::JA::Conll - Driver for the Japanese tagset of the CoNLL 2006 Shared Task (derived from the TüBa J/S Verbmobil treebank).
586  
587 =head1 VERSION
588  
589 version 3.015
590  
591 =head1 SYNOPSIS
592  
593 use Lingua::Interset::Tagset::JA::Conll;
594 my $driver = Lingua::Interset::Tagset::JA::Conll->new();
595 my $fs = $driver->decode("N\tNN\t_");
596  
597 or
598  
599 use Lingua::Interset qw(decode);
600 my $fs = decode('ja::conll', "N\tNN\t_");
601  
602 =head1 DESCRIPTION
603  
604 Interset driver for the Japanese tagset of the CoNLL 2006 Shared Task.
605 CoNLL tagsets in Interset are traditionally three values separated by tabs.
606 The values come from the CoNLL columns CPOS, POS and FEAT. For Japanese,
607 these values are derived from the tagset of the TüBa J/S Verbmobil
608 treebank (Universität Tübingen).
609  
610 =head1 SEE ALSO
611  
612 L<Lingua::Interset>,
613 L<Lingua::Interset::Tagset>,
614 L<Lingua::Interset::Tagset::Conll>,
615 L<Lingua::Interset::FeatureStructure>
616  
617 =head1 AUTHOR
618  
619 Dan Zeman <zeman@ufal.mff.cuni.cz>
620  
621 =head1 COPYRIGHT AND LICENSE
622  
623 This software is copyright (c) 2019 by Univerzita Karlova (Charles University).
624  
625 This is free software; you can redistribute it and/or modify it under
626 the same terms as the Perl 5 programming language system itself.
627  
628 =cut