File size: 3,810 Bytes
21baa2f | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 |
'''
Created on ูกูฅโ/ู ูฆโ/ูขู ูกู
@Created by: Muhammad Altabba
'''
from ....Controllers.Morphology.Entities.Cliticless import Cliticless;
from ....Controllers.Morphology.Entities.DerivedCliticless import DerivedCliticless;
from ....Controllers.Morphology.Entities.Particle import *;
class SurfaceFormMorphemes(object):
"""
# PyUML: Do not remove this line! # XMI_ID:_qyiSdY35Ed-gg8GOK1TmhA
"""
'''
Morphemes of Word in the Surface Form.
'''
VoweledForm = '';
Proclitics = [];
#ููุงุตู ุจุงุฏุฆุฉ
#ู
ุตูููุฉ ู
ู Particle
#Particle.State = ParticleConstants.State.Proclitic
Enclitics = [];
#ููุงุตู ุฎุชุงู
ูุฉ
#ู
ุตูููุฉ ู
ู Particle
#Particle.State = ParticleConstants.State.Enclitic
Cliticless = Cliticless();
#ุฅู
ุง ู
ู ุงูุตูู
#DerivedCliticless ุฃู UnderivedCliticless
__Certainty = 0;
# ู
ูุฏุงุฑ ุงูุซูุฉ ูุชูุงุฑุฏ ูุฐู ุงูููู
ุฉ ู
ุน ูุฐุง ุงููุณู ู
ู ุงูููุงุตู
def GetCertainty(self):
return self.__Certainty;
pass
def AddCertainty(self, value):
if(self.__Certainty >= 0 and value >= 0):
self.__Certainty = self.__Certainty + value - self.__Certainty * value;
elif(self.__Certainty <= 0 and value <= 0):
self.__Certainty = self.__Certainty + value + self.__Certainty * value;
else:
self.__Certainty = (self.__Certainty + value) / (1 - min(abs(self.__Certainty), abs(value)));
pass
def __init__(self, proclitics, cliticless, enclitics, fillVoweledForm = True):
'''
Constructor
'''
self.Proclitics = proclitics;
self.Cliticless = cliticless;
if(type(self.Cliticless) is DerivedCliticless):
self.Cliticless.UpdateInternalEnclitic();
if(self.Cliticless.InternalEnclitic != None):
enclitics = [x for x in enclitics];
enclitics.insert(0, self.Cliticless.InternalEnclitic);
self.Enclitics = enclitics;
self.__Certainty = 0;
if(fillVoweledForm == True):
self.FillVoweledForm();
else:
self.VoweledForm = '';
pass
def FillVoweledForm(self, forceFilling = True):
'''
ุงูุญุตูู ุนูู ุงูููู
ุฉ ู
ูุดูููุฉ
'''
if(self.VoweledForm != '' and forceFilling == False):
return;
proclitics = ''.join([p.VoweledForm for p in self.Proclitics]);
procliticsString = ''.join(proclitics);
enclitics = [p.VoweledForm for p in self.Enclitics];
if(type(self.Cliticless) is DerivedCliticless and len(enclitics) > 0 \
and self.Cliticless.InternalEnclitic != None):
enclitics.remove(enclitics[0]);
encliticsString = ''.join(enclitics);
self.VoweledForm = ''.join([procliticsString, self.Cliticless.VoweledForm, encliticsString]);
pass
def __str__(self):
str = '';
str += '\t\tProclitics:' + self.Proclitics.__str__();
str += '\t\tEnclitics:' + self.Enclitics.__str__();
# str += '\t\tPrefixes:' + self.Prefixes.__str__();
# str += '\t\tSuffixes:' + self.Suffixes.__str__();
# str += '\t\tCliticlessForm:' + self.CliticlessForm;
# str += '\t\tStem:' + self.Stem;
# if(self.Root != None and self.Root.String != None):
# str += '\t\tRoot:' + self.Root.String;
# if(self.UnoweledPattern.String != None):
# str += '\t\tPattern:'+self.UnoweledPattern.String;
# if(self.VoweledPattern != None):
# str += '\t\tPattern:'+self.VoweledPattern.VoweledForm;
return str;
pass
|