commit b4c99425c0ddc4fb5349107e657bbb688d1a244a
parent 574f4f5f11a4e9a7143c61a0105b885b01caba63
Author: Antoine Amarilli <a3nm@a3nm.net>
Date: Sun, 12 Jun 2011 19:29:33 -0400
remove old files
Diffstat:
3 files changed, 0 insertions(+), 77 deletions(-)
diff --git a/make.sh b/make.sh
@@ -1,13 +0,0 @@
-#!/bin/bash
-
-# From a French text input and an exceptions dictionnary, prepare the
-# trie.
-
-./prepare.sh | # reformat the text
- ./detect.pl | # identify and label occurrences
- cat - $* | # add in exceptions
- sed 's/ h/ /' | # we don't keep the useless leading 'h' in the trie
- ./buildtrie.py | # prepare the trie
- ./compresstrie.py | # compress the trie
- ./majoritytrie.py # keep only the most frequent information
-
diff --git a/prepare.sh b/prepare.sh
@@ -1,6 +0,0 @@
-#!/bin/bash
-
-# Prepare a text for piping into detect.pl
-
-tr -c "a-zA-ZÀ-Ÿà-ÿ\n'-" "\n" | sed "s/'/'\n/"
-
diff --git a/trie2dot.py b/trie2dot.py
@@ -1,58 +0,0 @@
-#!/usr/bin/env python3
-
-"""Read json trie in stdin, trim unneeded branches and output json dump
-to stdout"""
-
-import json
-import sys
-from math import log
-
-trie = json.load(sys.stdin)
-
-free_id = 0
-
-def cget(d, k):
- if k in d.keys():
- return d[k]
- else:
- return 0
-
-def int2strbyte(i):
- s = hex(i).split('x')[1]
- if len(s) == 1:
- return '0' + s
- else:
- return s
-
-def fraction2rgb(fraction):
- n = int(255*fraction)
- return int2strbyte(n)+'00'+int2strbyte(255 - n)
-
-def total(x):
- key, node = x
- return sum(node[0].values())
-
-def to_dot(trie, prefix=''):
- global free_id
-
- values, children = trie
- my_id = free_id
- free_id += 1
- count = cget(values, "0") + cget(values, "1")
- fraction = cget(values, "1") / count
-
- # TODO illustrate count
- print("%d [label=\"%s\",color=\"#%s\",penwidth=%d]" % (my_id, prefix,
- fraction2rgb(fraction), 1+int(log(count))))
-
- for (key, child) in sorted(children.items(), key=total, reverse=True):
- i = to_dot(child, prefix+key)
- print("%d -> %d [penwidth=%d]" % (my_id, i,
- 1+int(log(total((None, child))))))
-
- return my_id
-
-# TODO aspect causes graphviz crash?
-print("digraph G {\naspect=\"1\"\n")
-to_dot(trie, 'h')
-print("}")