本文整理汇总了Python中Base.getClassAsInt方法的典型用法代码示例。如果您正苦于以下问题:Python Base.getClassAsInt方法的具体用法?Python Base.getClassAsInt怎么用?Python Base.getClassAsInt使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Base
的用法示例。
在下文中一共展示了Base.getClassAsInt方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: parenLetter
# 需要导入模块: import Base [as 别名]
# 或者: from Base import getClassAsInt [as 别名]
def parenLetter(word, postbase):
""" returns the letter that should be picked from inside of the ()'s in postbase notation """
letter = ''
classnum = Base.getClassAsInt(word)
for c in getParenOptions(postbase):
if c == 'g' and classnum == 2:
letter = 'g'
elif c == 'ng' and classnum <= 4:
letter = 'ng'
elif c == 's' and classnum <= 4:
letter = 's'
elif c == 't' and classnum >= 5:
letter = 't'
elif c == 'u' and classnum >= 3:
letter = 'c'
return letter
示例2: stripPostbase
# 需要导入模块: import Base [as 别名]
# 或者: from Base import getClassAsInt [as 别名]
def stripPostbase(word, postbase):
""" removes a postbase from a word. see wiki for info reguarding postbase syntax """
print("Removing postbase:\t%s" % postbase)
word = stripEZStuff(word, postbase)
# detect which letters in parenthesis we need to remove if any
removeParen = isParensStripped(word, postbase)
if removeParen:
word = word[:-1]
if word[-1] == "\'":
word = word[:-1] + 'e'
elif not removeParen and Base.getClassAsInt(word) >= 5:
# for postbases with 't' in parenthesis: 't' only gets added if word ends in consonant
# if we removed a 't' then the word must be class V or VI. If we didn't need to remove
# a 't' then then the word must end in a vowel. If the word claims to be V or VI but we
# didn't need to remove anything then the word should be a class III or IV instead.
word = word + 'e'
print("Base Form:\t\t%s" % word)
print('')