#NEWLINE# def __init__( self , src_lang , tg_lang , wordnet_pos = None ) : #NEWLINE# #INDENT# if ( ( src_lang != 'en' ) and ( src_lang not in wn . wordnet . langs ( ) ) ) : #NEWLINE# #INDENT# print ( 'The language' , src_lang , 'is not supported by Open Multilingual Wordnet\n' ) #NEWLINE# self . src_lang = '' #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# self . src_lang = src_lang #NEWLINE# #UNINDENT# if ( ( tg_lang != 'en' ) and ( tg_lang not in wn . wordnet . langs ( ) ) ) : #NEWLINE# #INDENT# print ( 'The language' , tg_lang , 'is not supported by Open Multilingual Wordnet\n' ) #NEWLINE# self . tg_lang = '' #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# self . tg_lang = tg_lang #NEWLINE# #UNINDENT# if ( wordnet_pos is not None ) : #NEWLINE# #INDENT# self . pos_dict = defaultdict ( ( lambda : None ) ) #NEWLINE# for line in open ( wordnet_pos ) : #NEWLINE# #INDENT# a_pair = line [ : ( - 1 ) ] . decode ( 'utf-8' ) . split ( '\t' ) #NEWLINE# if ( len ( a_pair ) != 2 ) : #NEWLINE# #INDENT# sys . stderr . write ( 'Incorrect format of the mapping file' ) #NEWLINE# #UNINDENT# self . pos_dict [ a_pair [ 0 ] ] = a_pair [ 1 ] #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# self . pos_dict = None