3 from WordMirror
import WordMirrorNounInflection
;
5 def print_xml(inflection
, noun
): #{
7 casesymbols
= { "Nominative": "nom", "Dative": "dat", "Accusative": "acc", "Genitive": "gen" };
9 numbersymbols
= { "No Article": "sg", "Plural No Article": "pl" };
11 print ' <pardef n="' + noun
+ '__n">';
13 gender
= inflection
['Gender'];
18 for key
in inflection
.keys(): #{
19 if(key
in ['Gender', 'Word Type', 'Plural']): #{
23 for (case
, infl1
) in inflection
[key
].items(): #{
24 if(key
not in numbersymbols
.keys()): #{
28 for infl2
in infl1
.split("/"): #{
29 print ' <e> <!-- ' + key
+ ' -->';
36 print ' <l>' + infl2
.replace(noun
, '') + '</l>';
39 print ' <r><s n="n"/><s n="' + gender
+ '"/><s n="' + casesymbols
[case
] +'"/><s n="' + numbersymbols
[key
] + '"/></r>';
49 print 'python printnounxml.py <noun>';
52 if __name__
== "__main__": #{
55 if(len(sys
.argv
) <= 1): #{
59 inflect
= WordMirrorNounInflection(sys
.argv
[1]);
60 print_xml(inflect
, sys
.argv
[1]);