Interset/Tagset/FA/Conll.pm untested

filter: Statementstmt 0.0% 0 / 177 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 13 Podpod 0.0% 0 / 7 totaltotal 0.0% 0 / 197 CC 1 SCAR 6.9
CC
1
Cov
0%
get_tagset_id
2.0
_create_atoms
2.0
_create_features_all
2.0
CRAP 2.0
1 # ABSTRACT: Driver for the tagset of the Persian Dependency Treebank (in the CoNLL-X format).
2 # Copyright © 2012, 2014, 2017 Dan Zeman <zeman@ufal.mff.cuni.cz>
3  
4 package Lingua::Interset::Tagset::FA::Conll;
5 use strict;
6 use warnings;
7 our $VERSION = '3.015';
8  
9 use utf8;
10 use open ':utf8';
11 use namespace::autoclean;
12 use Moose;
13 extends 'Lingua::Interset::Tagset::Conll';
14  
15  
16  
17 #------------------------------------------------------------------------------
18 # Returns the tagset id that should be set as the value of the 'tagset' feature
19 # during decoding. Every derived class must (re)define this method! The result
20 # should correspond to the last two parts in package name, lowercased.
21 # Specifically, it should be the ISO 639-2 language code, followed by '::' and
22 # a language-specific tagset id. Example: 'cs::multext'.
23 #------------------------------------------------------------------------------
24 sub get_tagset_id
25 {
26 return 'fa::conll';
27 }
28  
29  
30  
31 #------------------------------------------------------------------------------
32 # Creates atomic drivers for surface features.
33 # Tagset documentation is at
34 # https://wiki.ufal.ms.mff.cuni.cz/_media/user:zeman:treebanks:persian-dependency-treebank-version-0.1-annotation-manual-and-user-guide.pdf
35 #------------------------------------------------------------------------------
36 sub _create_atoms
37 {
38 my $self = shift;
39 my %atoms;
40 # PART OF SPEECH ####################
41 $atoms{pos} = $self->create_atom
42 (
43 'tagset' => 'fa::conll',
44 'surfeature' => 'pos',
45 'decode_map' =>
46 {
47 # This table uses pos and subpos (the CPOS and POS columns of the CoNLL format) as input.
48 # coarse ADJ: adjective
49 "ADJ\tAJP" => ['pos' => 'adj', 'degree' => 'pos'], # dígr, islámí, bzrg, jdíd, mxtlf
50 "ADJ\tAJCM" => ['pos' => 'adj', 'degree' => 'cmp'], # bíštr, bíš, bhtr, bíštrí, kmtr
51 "ADJ\tAJSUP" => ['pos' => 'adj', 'degree' => 'sup'], # bhtrín, mhmtrín, bzrgtrín, bíštrín, qwítrín
52 "ADJ\t_" => ['pos' => 'adj'], # wláyí, xúdsáxte, wárd, xúbí (undocumented)
53 # coarse ADR: address term
54 # pre-noun morpheme to "make the noun the address of the speaker" (i.e. an interjection introducing a vocative phrase?)
55 # í = hey!, hallo!; yá = or (???); áháí = hey!
56 "ADR\tPRADR" => ['pos' => 'int', 'case' => 'voc', 'other' => {'side' => 'pre'}],
57 # post-noun morpheme to "make the noun the address of the speaker"
58 # only "á", sometimes (15 times) as a bound morpheme, sometimes (3 times) as an isolated word
59 "ADR\tPOSADR" => ['pos' => 'int', 'case' => 'voc', 'other' => {'side' => 'post'}],
60 # coarse ADV
61 "ADV\tSADV" => ['pos' => 'adv'], # hm, níz, htí, ne, xílí (genuine adverbs)
62 "ADV\tAVP" => ['pos' => 'adv', 'degree' => 'pos'], # hm, tnhá, dígr, xúb, ps (positive adjectives modifying verbs)
63 "ADV\tAVCM" => ['pos' => 'adv', 'degree' => 'cmp'], # bíštr, bíš, kmtr, bhtr, zúdtr (comparative adjectives modifying verbs)
64 "ADV\tAVSUP" => ['pos' => 'adv', 'degree' => 'sup'], # dúbáre
65 # coarse CL (undocumented)
66 "CL\tMEAS" => ['pos' => 'noun'], # kílú (only one occurrence of this one word form) + one N MEAS: qášq
67 # coarse CONJ: coordinating conjunction
68 "CONJ\tCONJ" => ['pos' => 'conj', 'conjtype' => 'coor'], # w, yá, amá, wlí, ke
69 # coarse IDEN
70 "IDEN\tIDEN" => ['pos' => 'noun', 'other' => {'nountype' => 'title'}], # imám, dktr, šhíd, síd, áytalláh (titles used with personal names)
71 # coarse N: noun
72 "N\tANM" => ['pos' => 'noun', 'animacy' => 'anim'], # xdá, ksí, ansán, xadáwand, nfr
73 "N\tIANM" => ['pos' => 'noun', 'animacy' => 'inan'], # sál, kár, írán, rúz, dst
74 # coarse PART: particle
75 "PART\tPART" => ['pos' => 'part'], # áyá, ke, mgr, rá, dígr
76 # coarse POSNUM: number following a noun
77 "POSNUM\tPOSNUM" => ['pos' => 'num', 'other' => {'numtype' => 'post'}], # awl, dúm, súm, čhárm, nxst (post-noun numeral)
78 # coarse POSTP: postposition
79 "POSTP\tPOSTP" => ['pos' => 'adp', 'adpostype' => 'post'], # rá, čún, az, rfte, mrá
80 # coarse PR: pronoun
81 "PR\tSEPER" => ['pos' => 'noun', 'prontype' => 'prs'], # mn, tú, aw, má, šmá, ánhá (separate personal pronoun)
82 "PR\tJOPER" => ['pos' => 'noun', 'prontype' => 'prs', 'variant' => 'short'], # m, t, š, mán, tán, šán (enclitic personal pronoun)
83 "PR\tDEMON" => ['pos' => 'noun', 'prontype' => 'dem'], # án, ín, hmín, čnán, ánjá (demonstrative pronoun)
84 "PR\tINTG" => ['pos' => 'noun', 'prontype' => 'int'], # če, kjá, čgúne, čí, črá (interrogative pronoun)
85 "PR\tCREFX" => ['pos' => 'noun', 'prontype' => 'prs', 'reflex' => 'yes'], # xod, xwíš, hm, ykdígr, hmdígr (common reflexive pronoun)
86 "PR\tUCREFX" => ['pos' => 'noun', 'prontype' => 'prs', 'reflex' => 'yes'], # (noncommon reflexive pronoun: not present in data)
87 "PR\tRECPR" => ['pos' => 'noun', 'prontype' => 'rcp'], # (reciprocal pronoun: not present in data)
88 "PR\t_" => ['pos' => 'noun', 'prontype' => 'prs'], # hm, ykdígr, hmdígr, xúdš, xúdšán ###!!! The '_' fine POS also occurs with adjectives!
89 # coarse PREM (pre-modifier of nouns, i.e. determiner?)
90 # exclamatory determiner: expresses speaker's surprise towards the modified noun ("WHAT a surprise!")
91 # če = what, čqdr = how much, how many, án = it, čnd = several, ajb = wonder, surprise
92 "PREM\tEXAJ" => ['pos' => 'adj', 'prontype' => 'exc'],
93 # interrogative determiner
94 # če = what, kdám = which, čnd = several, kdámín = what
95 "PREM\tQUAJ" => ['pos' => 'adj', 'prontype' => 'int'],
96 # demonstrative determiner
97 # ín = this, án = it, hmán = same, hmín = same, čnín = such
98 "PREM\tDEMAJ" => ['pos' => 'adj', 'prontype' => 'dem'],
99 # "ambiguous" (per the documentation) => total, indefinite or negative determiner
100 # hr = each/any/every, čnd = several/a few, híč = any/no/none, brxí = some, hme = all/every
101 "PREM\tAMBAJ" => ['pos' => 'adj', 'prontype' => 'tot|ind|neg'],
102 # coarse PRENUM (pre-noun numeral)
103 "PRENUM\tPRENUM" => ['pos' => 'num', 'other' => {'numtype' => 'pre'}], # ek, do, se, úlín, čhár
104 # coarse PREP: preposition
105 "PREP\tPREP" => ['pos' => 'adp', 'adpostype' => 'prep'], # be, dr, az, bá, bráí
106 "PREP\tPOST" => ['pos' => 'adp', 'adpostype' => 'post'], # zmn
107 "PREP\tPOSTP" => ['pos' => 'adp', 'adpostype' => 'post'], # ps
108 # coarse PSUS (pseudo-sentence; instead of verb)
109 # káš = if; ne = not; angár = if; yacní = namely; bale = yes
110 "PSUS\tPSUS" => ['pos' => 'part', 'parttype' => 'mod'], # káš, ne, angár, ya'aní, ble
111 # coarse PUNC: punctuation
112 "PUNC\tPUNC" => ['pos' => 'punc'], # ., ,, ?, !, "
113 # coarse V: verb
114 "V\tACT" => ['pos' => 'verb', 'voice' => 'act'], # míknnd, hstnd, dárnd, mídhnd, mítwánnd
115 "V\tPASS" => ['pos' => 'verb', 'voice' => 'pass'], # míšúnd, šde, dádemíšúnd, zádemíšúnd, gdárdemíšúnd
116 "V\tMODL" => ['pos' => 'verb', 'verbtype' => 'mod'], # báyd, nbáyd, mítwán, nmítwánd, míšúd
117 # coarse SUBR (subordinating conjunction)
118 "SUBR\tSUBR" => ['pos' => 'conj', 'conjtype' => 'sub'], # ke, agr, tá, zírá, čún
119 },
120 'encode_map' =>
121 {
122 'pos' => { 'noun' => { 'prontype' => { 'prs' => { 'reflex' => { 'yes' => "PR\tCREFX",
123 '@' => { 'variant' => { 'short' => "PR\tJOPER",
124 '@' => "PR\tSEPER" }}}},
125 'rcp' => "PR\tRECPR",
126 'dem' => "PR\tDEMON",
127 'int' => "PR\tINTG",
128 '@' => { 'other/nountype' => { 'title' => "IDEN\tIDEN",
129 '@' => { 'animacy' => { 'anim' => "N\tANM",
130 '@' => "N\tIANM" }}}}}},
131 'adj' => { 'prontype' => { 'dem' => "PREM\tDEMAJ",
132 'int' => "PREM\tQUAJ",
133 'exc' => "PREM\tEXAJ",
134 'tot' => "PREM\tAMBAJ",
135 'ind' => "PREM\tAMBAJ",
136 'neg' => "PREM\tAMBAJ",
137 '@' => { 'degree' => { 'sup' => "ADJ\tAJSUP",
138 'cmp' => "ADJ\tAJCM",
139 '@' => "ADJ\tAJP" }}}},
140 'num' => { 'other/numtype' => { 'post' => "POSNUM\tPOSNUM",
141 '@' => "PRENUM\tPRENUM" }},
142 'verb' => { 'verbtype' => { 'mod' => "V\tMODL",
143 '@' => { 'voice' => { 'pass' => "V\tPASS",
144 '@' => "V\tACT" }}}},
145 'adv' => { 'degree' => { 'pos' => "ADV\tAVP",
146 'cmp' => "ADV\tAVCM",
147 'sup' => "ADV\tAVSUP",
148 '@' => "ADV\tSADV" }},
149 'adp' => { 'adpostype' => { 'post' => "POSTP\tPOSTP",
150 '@' => "PREP\tPREP" }},
151 'conj' => { 'conjtype' => { 'sub' => "SUBR\tSUBR",
152 '@' => "CONJ\tCONJ" }},
153 'part' => { 'parttype' => { 'mod' => "PSUS\tPSUS",
154 '@' => "PART\tPART" }},
155 'punc' => "PUNC\tPUNC",
156 'int' => { 'other/side' => { 'post' => "ADR\tPOSADR",
157 '@' => "ADR\tPRADR" }}}
158 }
159 );
160 # ATTACHMENT TYPE ####################
161 # Orthographic words may have been broken into parts during tokenization in order to show syntactic relations between morphemes. Examples:
162 # didämäš => didäm|äš (äš is object of the verb didäm)
163 # mära => mä (contracted form of the personal pronoun män) | ra (postposition, could play object or complement adposition of the verb)
164 # The attachment feature makes restoration of orthographic words possible.
165 $atoms{attachment} = $self->create_atom
166 (
167 'tagset' => 'fa::conll',
168 'surfeature' => 'attachment',
169 'decode_map' =>
170 {
171 'ISO' => ['other' => {'attachment' => 'isolated'}], # isolated word
172 'PRV' => ['other' => {'attachment' => 'previous'}], # attached to the previous word
173 'NXT' => ['other' => {'attachment' => 'next'}] # attached to the next word
174 },
175 'encode_map' =>
176 {
177 'other/attachment' => { 'isolated' => 'ISO',
178 'previous' => 'PRV',
179 'next' => 'NXT',
180 '@' => 'ISO' }
181 }
182 );
183 # PERSON ####################
184 $atoms{person} = $self->create_simple_atom
185 (
186 'intfeature' => 'person',
187 'simple_decode_map' =>
188 {
189 '1' => '1', # mn, xúdm, án, má, xúdmán
190 '2' => '2', # tú, xúdt, šmá, xúdtán, šmáhá
191 '3' => '3' # ú, án, ín, ánhá, ánán
192 }
193 );
194 # NUMBER ####################
195 $atoms{number} = $self->create_simple_atom
196 (
197 'intfeature' => 'number',
198 'simple_decode_map' =>
199 {
200 'SING' => 'sing', # xdá, ksí, ansán, xdáwnd, nfr
201 'PLUR' => 'plur' # mrdm, ksání, dígrán, afrád, znán
202 }
203 );
204 # VERB FORM, MOOD, TENSE AND ASPECT ####################
205 # Here is a website that helps understand Persian verb forms: http://www.jahanshiri.ir/pvc/en/
206 # Some of the examples below are from the website, some from the PDF documentation of the treebank and some directly from the data.
207 # The transliterations of the three sources differ.
208 $atoms{tma} = $self->create_atom
209 (
210 'surfeature' => 'tma',
211 'decode_map' =>
212 {
213 # There are 12 past tenses in Persian. Even some (not all) periphrastic tenses have their dedicated tags because
214 # the participating verb forms are put together in one token in the treebank. Progressive tenses with the auxiliary
215 # verb dáštan (to have) are not tagged, the auxiliary verb is tokenized separately (but note that some other tenses,
216 # that are not called progressive in Persian, partially cover the meaning of the English continuous/progressive tenses).
217 # The remaining past tenses can be classified along three dimensions:
218 # aspect (normal vs. imperfect); narativeness; precedent vs. non-precedent
219 # The tenses that are called narrative in Persian grammar roughly correspond to the English present perfect.
220 # The tenses that are called precedent in Persian grammar roughly correspond to the English past perfect.
221 # Example verb is xordän = to eat.
222 # Simple past (indicative preterite)
223 # xordäm = I ate
224 # past stem + past ending
225 # raftam = I went; rafti = you went; raft = he went; raftim = we went; raftid = you went; raftand = they went
226 # Treebank examples: krd = did; búd = was; dášt = had
227 'GS' => ['verbform' => 'fin', 'mood' => 'ind', 'tense' => 'past', 'aspect' => 'perf'],
228 # Narrative past (indicative perfect)
229 # xordeäm = I have eaten
230 # past participle + past ending
231 # rafteam = I have gone; raftei = you have gone; rafte = he has gone; rafteim = we have gone; rafteid = you have gone; rafteand = they have gone
232 # Án ketáb rá čand bár xwándeam. = I have read that book several times.
233 # Treebank examples: krde ast = he has been; krde = he has been; ámde ast = he has come
234 'GN' => ['verbform' => 'fin', 'mood' => 'ind', 'tense' => 'past', 'evident' => 'nfh', 'aspect' => 'perf'],
235 # Precedent past (indicative pluperfect)
236 # xorde budäm = I had eaten
237 # past participle of main verb + past simple of auxiliary budan (to be)
238 # rafte budam = I had gone; rafte budi = you had gone; rafte bud = he had gone; rafte budim = we had gone; rafte budid = you had gone; rafte budand = they have gone
239 # Vaght-i ke residim, ánhá rafte budand. = By the time we arrived, they had gone.
240 # Treebank examples: krde búd = he had been; dáde búd = he had been; zde búd = he had struck
241 'GB' => ['verbform' => 'fin', 'mood' => 'ind', 'tense' => 'pqp', 'aspect' => 'perf'],
242 # Past imperfect (indicative imperfective preterite)
243 # mixordäm = I was eating
244 # mi + past stem + past ending
245 # miraftam; mirafti; miraft; miraftim; miraftid; miraftand
246 # Hamiše mixwást engelisi yád begirad. = He always wanted to learn English.
247 # Treebank examples: míkrd = would, was; mízd = drew, played; mídád = would, was
248 'GES' => ['verbform' => 'fin', 'mood' => 'ind', 'tense' => 'past', 'aspect' => 'imp'],
249 # Narrative imperfect (indicative imperfective perfect?)
250 # mixordeäm = I have been eating
251 # mi + past participle + past ending
252 # mirafteam; miraftei; mirafte; mirafteim; mirafteid; mirafteand
253 # Engelisi mixwánde? = Has she been studying English?
254 # Treebank examples: míkrde ast = he has been, he have had; mídánste = he knew; míkrde = he did
255 'GNES' => ['verbform' => 'fin', 'mood' => 'ind', 'tense' => 'past', 'evident' => 'nfh', 'aspect' => 'imp'],
256 # Precedent imperfect (indicative imperfective pluperfect)
257 # mixorde budäm = I had been eating
258 # mi + past participle of main verb + past simple of auxiliary budan (to be)
259 # mirafte budam; mirafte budi; mirafte bud; mirafte budim; mirafte budid; mirafte budand
260 # No treebank examples found.
261 'GBES' => ['verbform' => 'fin', 'mood' => 'ind', 'tense' => 'pqp', 'aspect' => 'imp'],
262 # Indicative present
263 # mixoräm = I am eating, I eat
264 # am = I am; i = you are; ast = he is; im = we are; id = you are; and = they are
265 # dáram = I have; dári = you have; dárad = he has; dárim = we have; dárid = you have; dárand = they have
266 # mibandam = I close; mibandi = you close; mibandad = he closes; mibandim = we close; mibandid = you close; mibandand = they close
267 # Treebank examples: ast = he is; míknd = he does; dárd = it has, there is
268 'H' => ['verbform' => 'fin', 'mood' => 'ind', 'tense' => 'pres', 'aspect' => 'imp'],
269 # Indicative future (simple)
270 # xahäm xord = I will eat
271 # auxiliary verb xwástan (to want) in present simple + main verb in apocopated infinitive
272 # xwáham raft = I will go; xwáhi raft = you will go; xwáhad raft = he will go; xwáhim raft = we will go; xwáhid raft = you will go; xwáhand raft = they will go
273 # Treebank examples: xwáhd krd = he will do; xwáhd šd = he will be; xwáhd búd = he will/would be; xwáhd dád = he will give
274 'AY' => ['verbform' => 'fin', 'mood' => 'ind', 'tense' => 'fut'],
275 # Imperative
276 # boxor = eat
277 # It is made from subjunctive present simple.
278 # benevis = write!; benevisim = let's write!; benevisid = write!
279 # Treebank examples: kn = do; báš = remember; bgw = tell
280 'HA' => ['verbform' => 'fin', 'mood' => 'imp'],
281 # Subjunctive past simple/narrative (subjunctive preterite)
282 # xorde bašäm ~ I would have eaten
283 # past participle of main verb + auxiliary verb budan (to be) in subjunctive present simple
284 # rafte bášam ~ I would have gone; rafte báši; rafte bášad; rafte bášim; rafte bášid; rafte bášand
285 # Treebank examples: krde bášd; dášte bášd; dáde bášd
286 'GEL' => ['verbform' => 'fin', 'mood' => 'sub', 'tense' => 'past', 'aspect' => 'perf'],
287 # Subjunctive precedent narrative (subjunctive pluperfect)
288 # xorde bude bašäm ~ I would have had eaten
289 # past participle of main verb + auxiliary verb budan (to be) in subjunctive past narrative
290 # rafte bude bášam ~ I would have had gone; rafte bude báši; rafte bude bášad; rafte bude bášim; rafte bude bášid; rafte bude bášand
291 # No treebank examples found.
292 'GBEL' => ['verbform' => 'fin', 'mood' => 'sub', 'tense' => 'pqp', 'aspect' => 'perf'],
293 # Subjunctive past narrative imperfect (subjunctive imperfective preterite)
294 # mixorde bašäm ~ I would have been eating
295 # mi + past participle of main verb + auxiliary verb budan (to be) in subjunctive present simple
296 # mirafte bášam ~ I would have been going; mirafte báši; mirafte bášad; mirafte bášim; mirafte bášid; mirafte bášand
297 # Treebank example: brmígrdánídm
298 'GESEL' => ['verbform' => 'fin', 'mood' => 'sub', 'tense' => 'past', 'aspect' => 'imp'],
299 # Subjunctive past precedent narrative imperfect (subjunctive imperfective pluperfect)
300 # mixorde bude bašäm ~ I would have had been eating
301 # mi + past participle of main verb + auxiliary verb budan (to be) in subjunctive past narrative
302 # mirafte bude bášam ~ I would have had been going; mirafte bude báši; mirafte bude bášad; mirafte bude bášim; mirafte bude bášid; mirafte bude bášand
303 # Treebank example: bde (???)
304 'GBESE' => ['verbform' => 'fin', 'mood' => 'sub', 'tense' => 'pqp', 'aspect' => 'imp'],
305 # Subjunctive present
306 # boxoräm = I would eat
307 # be + present stem + present ending (but the "be-" prefix is often omitted in light-verb constructions)
308 # benevisam = I would write; benevisi = you would write; benevisad = he would write; benevisim = we would write; benevisid = you would write; benevisand = they would write
309 # Treebank examples: knd = he would do; bášd = he would be; bknd = he would do; dárd = there would be; dhd = he would give
310 'HEL' => ['verbform' => 'fin', 'mood' => 'sub', 'tense' => 'pres'],
311 },
312 'encode_map' =>
313 {
314 'mood' => { 'imp' => 'HA',
315 'sub' => { 'tense' => { 'pres' => 'HEL',
316 'past' => { 'aspect' => { 'imp' => 'GESEL',
317 '@' => 'GEL' }},
318 'pqp' => { 'aspect' => { 'imp' => 'GBESE',
319 '@' => 'GBEL' }}}},
320 '@' => { 'tense' => { 'fut' => 'AY',
321 'pres' => 'H',
322 'past' => { 'evident' => { 'nfh' => { 'aspect' => { 'imp' => 'GNES',
323 '@' => 'GN' }},
324 '@' => { 'aspect' => { 'imp' => 'GES',
325 '@' => 'GS' }}}},
326 'pqp' => { 'aspect' => { 'imp' => 'GBES',
327 '@' => 'GB' }}}}}
328 }
329 );
330 return \%atoms;
331 }
332  
333  
334  
335 #------------------------------------------------------------------------------
336 # Creates the list of all surface CoNLL features that can appear in the FEATS
337 # column. This list will be used in decode().
338 #------------------------------------------------------------------------------
339 sub _create_features_all
340 {
341 my $self = shift;
342 my @features = ('person', 'attachment', 'number', 'tma');
343 return \@features;
344 }
345  
346  
347  
348 #------------------------------------------------------------------------------
349 # Creates the list of surface CoNLL features that can appear in the FEATS
350 # column with particular parts of speech. This list will be used in encode().
351 #------------------------------------------------------------------------------
352 sub _create_features_pos
353 {
354 my $self = shift;
355 my %features =
356 (
357 'NC' => ['gender', 'number', 'case', 'def'],
358 'V.gerund' => ['mood', 'number', 'gender', 'definiteness', 'case']
359 );
360 return \%features;
361 }
362  
363  
364  
365 #------------------------------------------------------------------------------
366 # Decodes a physical tag (string) and returns the corresponding feature
367 # structure.
368 #------------------------------------------------------------------------------
369 sub decode
370 {
371 my $self = shift;
372 my $tag = shift;
373 my $fs = $self->decode_conll($tag, 'both');
374 # Default feature values. Used to improve collaboration with other drivers.
375 # ... nothing yet ...
376 return $fs;
377 }
378  
379  
380  
381 #------------------------------------------------------------------------------
382 # Takes feature structure and returns the corresponding physical tag (string).
383 #------------------------------------------------------------------------------
384 sub encode
385 {
386 my $self = shift;
387 my $fs = shift; # Lingua::Interset::FeatureStructure
388 my $atoms = $self->atoms();
389 my ($pos, $subpos) = split(/\t/, $atoms->{pos}->encode($fs));
390 my $fpos = $subpos;
391 my $feature_names = $self->features_all(); ###!!!$self->get_feature_names($fpos);
392 my $tag = $self->encode_conll($fs, $pos, $subpos, $feature_names);
393 return $tag;
394 }
395  
396  
397  
398 #------------------------------------------------------------------------------
399 # Returns reference to list of known tags.
400 # Tags were collected from the corpus, 880 distinct tags found:
401 # Returns reference to list of known tags.
402 # cat train.conll test.conll |\
403 # perl -pe '@x = split(/\s+/, $_); $_ = "$x[3]\t$x[4]\t$x[5]\n"' |\
404 # sort -u | wc -l
405 # 880
406 # 271 after cleaning and adding 'other'-resistant tags
407 #------------------------------------------------------------------------------
408 sub list
409 {
410 my $self = shift;
411 my $list = <<end_of_list
412 ADJ AJCM attachment=ISO
413 ADJ AJCM attachment=NXT
414 ADJ AJP attachment=ISO
415 ADJ AJP attachment=ISO|number=SING
416 ADJ AJP attachment=NXT
417 ADJ AJP attachment=PRV
418 ADJ AJSUP attachment=ISO
419 ADR POSADR attachment=ISO
420 ADR POSADR attachment=PRV
421 ADR PRADR attachment=ISO
422 ADV AVCM attachment=ISO
423 ADV AVP attachment=ISO
424 ADV AVP attachment=NXT
425 ADV AVSUP attachment=ISO
426 ADV SADV attachment=ISO
427 ADV SADV attachment=NXT
428 ADV SADV attachment=PRV
429 CONJ CONJ attachment=ISO
430 IDEN IDEN attachment=ISO
431 IDEN IDEN attachment=ISO|number=SING
432 N ANM attachment=ISO
433 N ANM attachment=ISO|number=PLUR
434 N ANM attachment=ISO|number=SING
435 N ANM attachment=NXT|number=PLUR
436 N ANM attachment=NXT|number=SING
437 N IANM attachment=ISO
438 N IANM attachment=ISO|number=PLUR
439 N IANM attachment=ISO|number=SING
440 N IANM attachment=NXT|number=PLUR
441 N IANM attachment=NXT|number=SING
442 N IANM attachment=PRV|number=SING
443 PART PART attachment=ISO
444 PART PART attachment=PRV
445 POSNUM POSNUM attachment=ISO
446 POSTP POSTP attachment=ISO
447 POSTP POSTP attachment=NXT
448 POSTP POSTP attachment=PRV
449 PR CREFX attachment=ISO
450 PR CREFX attachment=ISO|number=SING
451 PR CREFX person=1|attachment=ISO|number=PLUR
452 PR CREFX person=1|attachment=ISO|number=SING
453 PR CREFX person=1|attachment=PRV|number=PLUR
454 PR CREFX person=1|attachment=PRV|number=SING
455 PR CREFX person=2|attachment=ISO|number=PLUR
456 PR CREFX person=2|attachment=ISO|number=SING
457 PR CREFX person=3|attachment=ISO|number=PLUR
458 PR CREFX person=3|attachment=ISO|number=SING
459 PR DEMON attachment=ISO
460 PR DEMON attachment=ISO|number=PLUR
461 PR DEMON attachment=ISO|number=SING
462 PR DEMON attachment=NXT|number=SING
463 PR DEMON attachment=PRV|number=SING
464 PR DEMON person=1|attachment=ISO|number=PLUR
465 PR DEMON person=1|attachment=ISO|number=SING
466 PR DEMON person=1|attachment=NXT|number=PLUR
467 PR DEMON person=3|attachment=ISO
468 PR DEMON person=3|attachment=ISO|number=PLUR
469 PR DEMON person=3|attachment=ISO|number=SING
470 PR DEMON person=3|attachment=NXT|number=SING
471 PR INTG attachment=ISO
472 PR INTG attachment=ISO|number=SING
473 PR INTG attachment=NXT
474 PR INTG attachment=NXT|number=SING
475 PR INTG person=1|attachment=ISO|number=SING
476 PR INTG person=3|attachment=ISO|number=SING
477 PR JOPER person=1|attachment=ISO|number=PLUR
478 PR JOPER person=1|attachment=ISO|number=SING
479 PR JOPER person=1|attachment=NXT|number=SING
480 PR JOPER person=1|attachment=PRV|number=PLUR
481 PR JOPER person=1|attachment=PRV|number=SING
482 PR JOPER person=2|attachment=ISO|number=PLUR
483 PR JOPER person=2|attachment=ISO|number=SING
484 PR JOPER person=2|attachment=PRV|number=PLUR
485 PR JOPER person=2|attachment=PRV|number=SING
486 PR JOPER person=3|attachment=ISO|number=PLUR
487 PR JOPER person=3|attachment=ISO|number=SING
488 PR JOPER person=3|attachment=NXT|number=SING
489 PR JOPER person=3|attachment=PRV|number=PLUR
490 PR JOPER person=3|attachment=PRV|number=SING
491 PR SEPER attachment=ISO
492 PR SEPER attachment=ISO|number=PLUR
493 PR SEPER attachment=ISO|number=SING
494 PR SEPER person=1|attachment=ISO|number=PLUR
495 PR SEPER person=1|attachment=ISO|number=SING
496 PR SEPER person=1|attachment=NXT|number=PLUR
497 PR SEPER person=1|attachment=NXT|number=SING
498 PR SEPER person=1|attachment=PRV|number=PLUR
499 PR SEPER person=1|attachment=PRV|number=SING
500 PR SEPER person=2|attachment=ISO|number=PLUR
501 PR SEPER person=2|attachment=ISO|number=SING
502 PR SEPER person=2|attachment=NXT|number=PLUR
503 PR SEPER person=2|attachment=NXT|number=SING
504 PR SEPER person=3|attachment=ISO|number=PLUR
505 PR SEPER person=3|attachment=ISO|number=SING
506 PR SEPER person=3|attachment=NXT|number=PLUR
507 PR SEPER person=3|attachment=NXT|number=SING
508 PR SEPER person=3|attachment=PRV|number=SING
509 PREM AMBAJ attachment=ISO
510 PREM DEMAJ attachment=ISO
511 PREM DEMAJ attachment=PRV
512 PREM EXAJ attachment=ISO
513 PREM QUAJ attachment=ISO
514 PRENUM PRENUM attachment=ISO
515 PREP PREP attachment=ISO
516 PREP PREP attachment=NXT
517 PREP PREP attachment=PRV
518 PSUS PSUS attachment=ISO
519 PSUS PSUS attachment=NXT
520 PUNC PUNC attachment=ISO
521 PUNC PUNC attachment=PRV
522 SUBR SUBR attachment=ISO
523 SUBR SUBR attachment=PRV
524 V ACT attachment=ISO|number=PLUR|tma=AY
525 V ACT attachment=ISO|number=PLUR|tma=GN
526 V ACT attachment=ISO|number=PLUR|tma=GS
527 V ACT attachment=ISO|number=PLUR|tma=H
528 V ACT attachment=ISO|number=PLUR|tma=HEL
529 V ACT attachment=ISO|number=SING|tma=GB
530 V ACT attachment=ISO|number=SING|tma=GEL
531 V ACT attachment=ISO|number=SING|tma=H
532 V ACT attachment=ISO|number=SING|tma=HEL
533 V ACT attachment=ISO|tma=H
534 V ACT attachment=ISO|tma=HEL
535 V ACT person=1|attachment=ISO|number=PLUR|tma=AY
536 V ACT person=1|attachment=ISO|number=PLUR|tma=GB
537 V ACT person=1|attachment=ISO|number=PLUR|tma=GEL
538 V ACT person=1|attachment=ISO|number=PLUR|tma=GES
539 V ACT person=1|attachment=ISO|number=PLUR|tma=GN
540 V ACT person=1|attachment=ISO|number=PLUR|tma=GS
541 V ACT person=1|attachment=ISO|number=PLUR|tma=H
542 V ACT person=1|attachment=ISO|number=PLUR|tma=HEL
543 V ACT person=1|attachment=ISO|number=SING|tma=AY
544 V ACT person=1|attachment=ISO|number=SING|tma=GB
545 V ACT person=1|attachment=ISO|number=SING|tma=GBESE
546 V ACT person=1|attachment=ISO|number=SING|tma=GEL
547 V ACT person=1|attachment=ISO|number=SING|tma=GES
548 V ACT person=1|attachment=ISO|number=SING|tma=GESEL
549 V ACT person=1|attachment=ISO|number=SING|tma=GN
550 V ACT person=1|attachment=ISO|number=SING|tma=GNES
551 V ACT person=1|attachment=ISO|number=SING|tma=GS
552 V ACT person=1|attachment=ISO|number=SING|tma=H
553 V ACT person=1|attachment=ISO|number=SING|tma=HA
554 V ACT person=1|attachment=ISO|number=SING|tma=HEL
555 V ACT person=1|attachment=NXT|number=PLUR|tma=H
556 V ACT person=1|attachment=NXT|number=SING|tma=GS
557 V ACT person=1|attachment=NXT|number=SING|tma=H
558 V ACT person=1|attachment=PRV|number=PLUR|tma=AY
559 V ACT person=1|attachment=PRV|number=PLUR|tma=H
560 V ACT person=1|attachment=PRV|number=SING|tma=AY
561 V ACT person=1|attachment=PRV|number=SING|tma=H
562 V ACT person=1|attachment=PRV|number=SING|tma=HEL
563 V ACT person=2|attachment=ISO|number=PLUR
564 V ACT person=2|attachment=ISO|number=PLUR|tma=AY
565 V ACT person=2|attachment=ISO|number=PLUR|tma=GB
566 V ACT person=2|attachment=ISO|number=PLUR|tma=GEL
567 V ACT person=2|attachment=ISO|number=PLUR|tma=GES
568 V ACT person=2|attachment=ISO|number=PLUR|tma=GN
569 V ACT person=2|attachment=ISO|number=PLUR|tma=GNES
570 V ACT person=2|attachment=ISO|number=PLUR|tma=GS
571 V ACT person=2|attachment=ISO|number=PLUR|tma=H
572 V ACT person=2|attachment=ISO|number=PLUR|tma=HA
573 V ACT person=2|attachment=ISO|number=PLUR|tma=HEL
574 V ACT person=2|attachment=ISO|number=SING|tma=AY
575 V ACT person=2|attachment=ISO|number=SING|tma=GB
576 V ACT person=2|attachment=ISO|number=SING|tma=GEL
577 V ACT person=2|attachment=ISO|number=SING|tma=GES
578 V ACT person=2|attachment=ISO|number=SING|tma=GN
579 V ACT person=2|attachment=ISO|number=SING|tma=GS
580 V ACT person=2|attachment=ISO|number=SING|tma=H
581 V ACT person=2|attachment=ISO|number=SING|tma=HA
582 V ACT person=2|attachment=ISO|number=SING|tma=HEL
583 V ACT person=2|attachment=NXT|number=PLUR|tma=H
584 V ACT person=2|attachment=PRV|number=PLUR|tma=H
585 V ACT person=2|attachment=PRV|number=SING|tma=H
586 V ACT person=2|attachment=PRV|number=SING|tma=HA
587 V ACT person=3|attachment=ISO|number=PLUR|tma=AY
588 V ACT person=3|attachment=ISO|number=PLUR|tma=GB
589 V ACT person=3|attachment=ISO|number=PLUR|tma=GEL
590 V ACT person=3|attachment=ISO|number=PLUR|tma=GES
591 V ACT person=3|attachment=ISO|number=PLUR|tma=GN
592 V ACT person=3|attachment=ISO|number=PLUR|tma=GNES
593 V ACT person=3|attachment=ISO|number=PLUR|tma=GS
594 V ACT person=3|attachment=ISO|number=PLUR|tma=H
595 V ACT person=3|attachment=ISO|number=PLUR|tma=HA
596 V ACT person=3|attachment=ISO|number=PLUR|tma=HEL
597 V ACT person=3|attachment=ISO|number=SING
598 V ACT person=3|attachment=ISO|number=SING|tma=AY
599 V ACT person=3|attachment=ISO|number=SING|tma=GB
600 V ACT person=3|attachment=ISO|number=SING|tma=GEL
601 V ACT person=3|attachment=ISO|number=SING|tma=GES
602 V ACT person=3|attachment=ISO|number=SING|tma=GN
603 V ACT person=3|attachment=ISO|number=SING|tma=GNES
604 V ACT person=3|attachment=ISO|number=SING|tma=GS
605 V ACT person=3|attachment=ISO|number=SING|tma=H
606 V ACT person=3|attachment=ISO|number=SING|tma=HA
607 V ACT person=3|attachment=ISO|number=SING|tma=HEL
608 V ACT person=3|attachment=NXT|number=PLUR|tma=GES
609 V ACT person=3|attachment=NXT|number=PLUR|tma=GS
610 V ACT person=3|attachment=NXT|number=PLUR|tma=H
611 V ACT person=3|attachment=NXT|number=SING|tma=GES
612 V ACT person=3|attachment=NXT|number=SING|tma=GS
613 V ACT person=3|attachment=NXT|number=SING|tma=H
614 V ACT person=3|attachment=PRV|number=PLUR|tma=H
615 V ACT person=3|attachment=PRV|number=SING|tma=AY
616 V ACT person=3|attachment=PRV|number=SING|tma=GS
617 V ACT person=3|attachment=PRV|number=SING|tma=H
618 V MODL attachment=ISO|number=SING|tma=H
619 V MODL attachment=ISO|number=SING|tma=HEL
620 V MODL attachment=ISO|tma=GEL
621 V MODL attachment=ISO|tma=GES
622 V MODL attachment=ISO|tma=GS
623 V MODL attachment=ISO|tma=H
624 V MODL attachment=ISO|tma=HEL
625 V MODL attachment=NXT|tma=HEL
626 V MODL person=1|attachment=ISO|number=PLUR|tma=H
627 V MODL person=1|attachment=ISO|number=SING|tma=H
628 V MODL person=2|attachment=ISO|number=SING|tma=H
629 V MODL person=3|attachment=ISO|number=PLUR|tma=H
630 V MODL person=3|attachment=ISO|number=SING|tma=GES
631 V MODL person=3|attachment=ISO|number=SING|tma=GNES
632 V MODL person=3|attachment=ISO|number=SING|tma=GS
633 V MODL person=3|attachment=ISO|number=SING|tma=H
634 V MODL person=3|attachment=ISO|number=SING|tma=HEL
635 V PASS attachment=ISO|number=SING|tma=GEL
636 V PASS person=1|attachment=ISO|number=PLUR|tma=AY
637 V PASS person=1|attachment=ISO|number=PLUR|tma=GB
638 V PASS person=1|attachment=ISO|number=PLUR|tma=GES
639 V PASS person=1|attachment=ISO|number=PLUR|tma=GN
640 V PASS person=1|attachment=ISO|number=PLUR|tma=GS
641 V PASS person=1|attachment=ISO|number=PLUR|tma=H
642 V PASS person=1|attachment=ISO|number=PLUR|tma=HEL
643 V PASS person=1|attachment=ISO|number=SING|tma=AY
644 V PASS person=1|attachment=ISO|number=SING|tma=GB
645 V PASS person=1|attachment=ISO|number=SING|tma=GES
646 V PASS person=1|attachment=ISO|number=SING|tma=GN
647 V PASS person=1|attachment=ISO|number=SING|tma=GS
648 V PASS person=1|attachment=ISO|number=SING|tma=H
649 V PASS person=1|attachment=ISO|number=SING|tma=HEL
650 V PASS person=2|attachment=ISO|number=PLUR|tma=AY
651 V PASS person=2|attachment=ISO|number=PLUR|tma=GB
652 V PASS person=2|attachment=ISO|number=PLUR|tma=GEL
653 V PASS person=2|attachment=ISO|number=PLUR|tma=GN
654 V PASS person=2|attachment=ISO|number=PLUR|tma=GS
655 V PASS person=2|attachment=ISO|number=PLUR|tma=H
656 V PASS person=2|attachment=ISO|number=PLUR|tma=HA
657 V PASS person=2|attachment=ISO|number=PLUR|tma=HEL
658 V PASS person=2|attachment=ISO|number=SING|tma=GB
659 V PASS person=2|attachment=ISO|number=SING|tma=GES
660 V PASS person=2|attachment=ISO|number=SING|tma=GN
661 V PASS person=2|attachment=ISO|number=SING|tma=GS
662 V PASS person=2|attachment=ISO|number=SING|tma=H
663 V PASS person=2|attachment=ISO|number=SING|tma=HA
664 V PASS person=2|attachment=ISO|number=SING|tma=HEL
665 V PASS person=3|attachment=ISO|number=PLUR|tma=AY
666 V PASS person=3|attachment=ISO|number=PLUR|tma=GB
667 V PASS person=3|attachment=ISO|number=PLUR|tma=GEL
668 V PASS person=3|attachment=ISO|number=PLUR|tma=GES
669 V PASS person=3|attachment=ISO|number=PLUR|tma=GN
670 V PASS person=3|attachment=ISO|number=PLUR|tma=GS
671 V PASS person=3|attachment=ISO|number=PLUR|tma=H
672 V PASS person=3|attachment=ISO|number=PLUR|tma=HA
673 V PASS person=3|attachment=ISO|number=PLUR|tma=HEL
674 V PASS person=3|attachment=ISO|number=SING|tma=AY
675 V PASS person=3|attachment=ISO|number=SING|tma=GB
676 V PASS person=3|attachment=ISO|number=SING|tma=GEL
677 V PASS person=3|attachment=ISO|number=SING|tma=GES
678 V PASS person=3|attachment=ISO|number=SING|tma=GN
679 V PASS person=3|attachment=ISO|number=SING|tma=GNES
680 V PASS person=3|attachment=ISO|number=SING|tma=GS
681 V PASS person=3|attachment=ISO|number=SING|tma=H
682 V PASS person=3|attachment=ISO|number=SING|tma=HEL
683 end_of_list
684 ;
685 # Protect from editors that replace tabs by spaces.
686 $list =~ s/ \s+/\t/sg;
687 my @list = split(/\r?\n/, $list);
688 return \@list;
689 }
690  
691  
692  
693 1;
694  
695 __END__
696  
697 =pod
698  
699 =encoding UTF-8
700  
701 =head1 NAME
702  
703 Lingua::Interset::Tagset::FA::Conll - Driver for the tagset of the Persian Dependency Treebank (in the CoNLL-X format).
704  
705 =head1 VERSION
706  
707 version 3.015
708  
709 =head1 SYNOPSIS
710  
711 use Lingua::Interset::Tagset::FA::Conll;
712 my $driver = Lingua::Interset::Tagset::FA::Conll->new();
713 my $fs = $driver->decode("N\tANM\tattachment=ISO|number=SING");
714  
715 or
716  
717 use Lingua::Interset qw(decode);
718 my $fs = decode('fa::conll', "N\tANM\tattachment=ISO|number=SING");
719  
720 =head1 DESCRIPTION
721  
722 Interset driver for the tagset of the Persian Dependency Treebank (in the
723 CoNLL-X format).
724 CoNLL tagsets in Interset are traditionally three values separated by tabs.
725 The values come from the CoNLL columns CPOS, POS and FEAT.
726  
727 Tagset documentation is at
728 L<https://wiki.ufal.ms.mff.cuni.cz/_media/user:zeman:treebanks:persian-dependency-treebank-version-0.1-annotation-manual-and-user-guide.pdf>
729  
730 =head1 SEE ALSO
731  
732 L<Lingua::Interset>,
733 L<Lingua::Interset::Tagset>,
734 L<Lingua::Interset::Tagset::Conll>,
735 L<Lingua::Interset::FeatureStructure>
736  
737 =head1 AUTHOR
738  
739 Dan Zeman <zeman@ufal.mff.cuni.cz>
740  
741 =head1 COPYRIGHT AND LICENSE
742  
743 This software is copyright (c) 2019 by Univerzita Karlova (Charles University).
744  
745 This is free software; you can redistribute it and/or modify it under
746 the same terms as the Perl 5 programming language system itself.
747  
748 =cut