commit ede6d2f6d0486eb8c8deee6e06b2d59d1f535acc
parent 206f36ab963df86f5de6134226696814ce45376e
Author: Antoine Amarilli <a3nm@a3nm.net>
Date: Tue, 13 Mar 2012 14:44:12 +0100
description
Diffstat:
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/frhyme.py b/frhyme.py
@@ -1,7 +1,7 @@
#!/usr/bin/python3 -O
-#TODO
-"""description"""
+"""Try to guess the last few phonemes of a French word, by a lookup in a
+precompiled trie"""
import os
import json
@@ -34,7 +34,6 @@ def add_dict(a, b):
return dict( [ (n, a.get(n, 0)+b.get(n, 0)) for n in set(a)|set(b) ] )
def do_lookup(trie, key):
- #print(key)
if len(key) == 0 or key[0] not in trie[1].keys():
return trie2list(trie)
return do_lookup(trie[1][key[0]], key[1:])