frhyme

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

commit 574f4f5f11a4e9a7143c61a0105b885b01caba63
parent 7857286c54883210b0ce5ce3c319ef7ac85fc16b
Author: Antoine Amarilli <a3nm@a3nm.net>
Date:   Sun, 12 Jun 2011 19:29:09 -0400

remove old file

Diffstat:
rendertrie.py | 32--------------------------------
1 file changed, 0 insertions(+), 32 deletions(-)

diff --git a/rendertrie.py b/rendertrie.py @@ -1,32 +0,0 @@ -#!/usr/bin/env python3 - -"""Read json trie in stdin, trim unneeded branches and output json dump -to stdout""" - -import json -import sys - -trie = json.load(sys.stdin) - -def trie2list(trie, mul, prefix): - v, c = trie - if c == {}: - return [mul, prefix] - else: - l = [] - for child in c.keys(): - l += trie2list(c[child], float(c[child][0]) / v, child+prefix) - return l - -def render(trie): - """Render the trie""" - if linear(trie[0]): - # no need for children, there is no more doubt - trie[1] = {} - for child in trie[1].values(): - compress(child) - -compress(trie) - -print(json.dumps(trie)) -