#NEWLINE# def get_wordlist( wordlist_name ) : #NEWLINE# #INDENT# '\n    Get and iterator of specified word list.\n\n    :param wordlist_name: Word list name\n    :type wordlist_name: basestring\n\n    :return: iterator with each line of file.\n    :rtype: str\n    ' #NEWLINE# if ( not isinstance ( wordlist_name , str ) ) : #NEWLINE# #INDENT# raise TypeError ( ( "Expected basestring, got '%s' instead" % type ( e ) ) ) #NEWLINE# #UNINDENT# word_list_name = join ( get_data_folder ( ) , wordlist_name ) #NEWLINE# try : #NEWLINE# #INDENT# with open ( word_list_name , 'rU' ) as f : #NEWLINE# #INDENT# for word in f : #NEWLINE# #INDENT# ( yield word . replace ( '\n' , '' ) . replace ( '\r' , '' ) ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# except IOError as e : #NEWLINE# #INDENT# raise PlecostWordListNotFound ( ( "Wordlist '%s' not found. Error: %s" % ( wordlist_name , e ) ) )