frhyme

guess the last phonemes of a French word
git clone https://a3nm.net/git/frhyme/
Log | Files | Refs | README

commit 418cde605745da91eb828f85db9706d033977017
parent ad7986c09871df0ac465b96b033d6647bd505bb0
Author: Antoine Amarilli <a3nm@a3nm.net>
Date:   Tue, 13 Mar 2012 12:08:43 +0100

fixes

Diffstat:
buildtrie.py | 6++----
1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/buildtrie.py b/buildtrie.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python3 +#!/usr/bin/python3 -O """From a list of values (arbitrary) and keys (words), create a trie representing this mapping""" @@ -35,15 +35,13 @@ while True: if not line: break line = line.split('\t') - value = line[1].rstrip()[-4:][::-1] - word = line[0].lower()[::-1] if len(line) == 2 else '' #print(word) #print(value) # a trailing space is used to mark termination of the word # this is useful in cases where a prefix of a word is a complete, # different word with a different value # two spaces because some data words have multiple spaces - insert(trie, word+' ', value) + insert(trie, line[0]+' ', line[1]) print(json.dumps(trie))