Exemple #1
0
def main():
    i = 0
    for line in fileinput.input():
        i += 1
        # not sure about the proper encoding to use
        # Perl actually does a better job on this, original encoding is CP950
        try:
            line = line.decode('utf8')
            if line.startswith('~t96;'):
                # should be a word ?
                entry = analyse_word_entry.parse_one(line)
                print(analyse_word_entry.html_of_entry(entry)).encode('utf8')
        except UnicodeDecodeError:
            print "encoding error on line", i
Exemple #2
0
def main():
    i = 0
    for line in fileinput.input():
        i += 1
        # not sure about the proper encoding to use
        # Perl actually does a better job on this, original encoding is CP950
        try:
            line = line.decode('utf8')
            if line.startswith('~t96;'):
                # should be a word ?
                entry = analyse_word_entry.parse_one(line)
                print (analyse_word_entry.html_of_entry(entry)).encode('utf8')
        except UnicodeDecodeError:
            print "encoding error on line", i
Exemple #3
0
def print_results(list_of_results):
    for entry in list_of_results:
        for h in entry['heteronyms']:
            print analyse_word_entry.html_of_entry(h).encode("utf8")
Exemple #4
0
def print_results(list_of_results):
    for entry in list_of_results:
        for h in entry["heteronyms"]:
            print analyse_word_entry.html_of_entry(h).encode("utf8")