<s> from sys import argv , exit , stdin <EOL> from cmd import Cmd <EOL> import codecs , sys <EOL> from transliterate import * <EOL> def usage ( ) : <EOL> return u"<STR_LIT>" <EOL> class CmdTransliterate ( Cmd ) : <EOL> def __init__ ( self ) : <EOL> Cmd . __init__ ( self ) <EOL> self . prompt = u"<STR_LIT>" <EOL> self . phonetic_table = azhagi . Transliteration . table <EOL> def do_EOF ( self , line ) : <EOL> print ( "<STR_LIT:\n>" ) <EOL> return True <EOL> def default ( self , line ) : <EOL> if ( line == "<STR_LIT>" ) : <EOL> exit ( <NUM_LIT:0> ) <EOL> print ( iterative_transliterate ( self . phonetic_table , line ) ) <EOL> return <EOL> if __name__ == u"<STR_LIT:__main__>" : <EOL> if not argv [ <NUM_LIT:1> : ] : <EOL> CmdTransliterate ( ) . cmdloop ( ) <EOL> for fname in argv [ <NUM_LIT:1> : ] : <EOL> try : <EOL> if fname == u"<STR_LIT>" : <EOL> CmdTransliterate ( ) . cmdloop ( ) <EOL> exit ( <NUM_LIT:0> ) <EOL> with open ( fname ) as fileHandle : <EOL> phonetic_table = azhagi . Transliteration . table <EOL> output = iterative_transliterate ( phonetic_table , fileHandle . read ( ) ) <EOL> print ( output ) <EOL> except Exception as fileOrConvException : <EOL> print ( u"<STR_LIT>" % ( fname , str ( fileOrConvException ) ) ) <EOL> raise fileOrConvException </s>
