def int_to_alphabetic(number):
"""Convert non-negative integer to base 26 representation using uppercase A-Z
as symbols. Can use this instead of numbers in feature delimiters because:
-- gives shorter full context model names (esp. with many features)
-- trivially, split-context-balanced.py expects delimiters to contain no digits
"""
assert number >= 0,"Function not intended to handle negative input values"
if number == 0:
return string.uppercase[0]
alphabetic = ""
current = number
while current!=0:
remainder = current % 26
remainder_string = string.uppercase[remainder]
alphabetic = remainder_string + alphabetic
current = current / 26
return alphabetic
评论列表
文章目录