|
From: <fri...@us...> - 2009-01-15 15:39:31
|
Revision: 9662
http://zaf.svn.sourceforge.net/zaf/?rev=9662&view=rev
Author: friedelwolff
Date: 2009-01-15 15:39:12 +0000 (Thu, 15 Jan 2009)
Log Message:
-----------
Start the work on noun morphology. This adds support for simple possessives
Modified Paths:
--------------
trunk/dict/zu/hunspell/zu_aff.py
Modified: trunk/dict/zu/hunspell/zu_aff.py
===================================================================
--- trunk/dict/zu/hunspell/zu_aff.py 2009-01-15 14:33:45 UTC (rev 9661)
+++ trunk/dict/zu/hunspell/zu_aff.py 2009-01-15 15:39:12 UTC (rev 9662)
@@ -38,6 +38,13 @@
#TODO: auxilary verbs
#TODO: consider avoiding illegal reflexives
+#NOUNS:
+#TODO: locatives
+#TODO: locatives of class 1
+#TODO: possessive of class 1
+#TODO: review possessive of class 2a
+
+
from hunspell_format import *
import re
@@ -47,6 +54,8 @@
situative_prefixes = ["e", "be"]
concords = subject_morphemes + relative_prefixes + situative_prefixes
object_morphemes = ["ngi", "ku", "si", "ni", "m", "ba", "wu", "yi", "li", "wa", "zi", "lu", "bu"]
+possesive_morphemes = ["wa", "ba", "ya", "la", "sa", "za", "lwa", "kwa"]
+#bu -> ba
a_rules = [["a", "Y", "PFX"]]
"""prefixes only applicable to verbs ending on -a"""
@@ -224,6 +233,31 @@
pass
return group.rules
+def noun_rules(group, **kwargs):
+ """Generate the necessary rules to prepend the given prefix to a noun
+
+ It receives a string with the already built (complete) prefix and
+ returns a list of lists, with each list presenting one affix rule.
+ """
+ prefix = kwargs.pop('affix')
+ if prefix[-1] == 'a':
+ prefix = prefix[0:-1]
+ #prefix could now be "", which is probably ok:
+ # amamanzi (a)amadoda
+ group.add_rule(affix=prefix, condition="a", **kwargs)
+ group.add_rule(affix=prefix+'e', condition="i", strip="i", **kwargs)
+ group.add_rule(affix=prefix+'o', condition="u", strip="u", **kwargs)
+ return group.rules
+
+ if prefix[-1] == 'u':
+ prefix = prefix[0:-1]
+ # Any prefixes except the identifying copulative "ngu"/"wu"
+ group.add_rule(affix=prefix, condition="[ou]", **kwargs)
+ return group.rules
+
+ print >> sys.stderr, "got an unexpected noun prefix:", prefix
+ return group.rules
+
################################################################################
for i in concords:
@@ -507,4 +541,13 @@
locative_sfx.add_rule(affix="eni", strip="a", circumfix=True, morphology="LOC_sfx")
+ ### Nouns ###
+
+ noun = aff.add_group(prefix=True, flag="N")
+ # This group will contain most prefixes for nouns
+
+ for morpheme in possesive_morphemes:
+ noun_rules(noun, affix=morpheme, morphology="POSSESSIVE")
+
+
print aff.hunspell()
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|