drime

French rhyme dictionary with web and CLI interface
git clone https://a3nm.net/git/drime/
Log | Files | Refs | README

commit 867643e14e7f8f50d58a7d05cfd3fe6723641947
parent 4da377ba38cfb840d3c45f3e3bc50e711e214823
Author: Antoine Amarilli <a3nm@a3nm.net>
Date:   Thu, 29 Sep 2011 15:20:48 +0200

remove syllable count from source (too crappy)

Diffstat:
make_db.py | 15+++++++--------
make_db.sh | 2+-
2 files changed, 8 insertions(+), 9 deletions(-)

diff --git a/make_db.py b/make_db.py @@ -89,13 +89,13 @@ class Word: return True return False - def __init__(self, word, phon, base, kind, freq, nsyl): + def __init__(self, word, phon, base, kind, freq): self.word = word self.phon = phon self.base = base self.kind = kind self.freq = freq - self.nsyl = [nsyl, nsyl] + self.nsyl = None self.redundant = False self.do_extends() @@ -113,8 +113,10 @@ class Word: self.extend(self.align_sum(align[0])) def extend(self, item): - self.nsyl = [min(self.nsyl[0], item), - max(self.nsyl[1], item)] + if self.nsyl == None: + self.nsyl = [item, item] + else: + self.nsyl = [min(self.nsyl[0], item), max(self.nsyl[1], item)] bases = {} #TODO transitive to the topmost base @@ -148,11 +150,8 @@ while True: freq = float(l.pop(0)) #print ("DBG for %s: %d and %d" % (word, int(l[0]), 1+len([x for x in l[1] #if x == ' ' or x == '-']))) - nsyl = max(int(l[0]), 1+len([x for x in l[1] if x == ' ' or x == '-'])) - l.pop(0) - l.pop(0) assert(len(l) == 0) - w = Word(word, phon, base, kind, freq, nsyl) + w = Word(word, phon, base, kind, freq) if word not in bases.keys(): bases[word] = [] bases[word].append(base) diff --git a/make_db.sh b/make_db.sh @@ -4,5 +4,5 @@ cd "$( dirname "$0" )" cat - additions | # add custom exceptions cut -f 1,2,3,4,7,8,9,10,24,28 | # select relevant fields - awk '{FS=" "; OFS=" "; print $1, $2, $3, $4, ($5+$6)/2 + 100*($7+$8)/2, $9, $10}' #| # aggregate frequencies + awk '{FS=" "; OFS=" "; print $1, $2, $3, $4, ($5+$6)/2 + 100*($7+$8)/2}' #| # aggregate frequencies #./make_db.py