new-words

diff new-words.py @ 45:5f90e44eecfc

new-words.py: turn words filtering and grouping on and off
author Igor Chubin <igor@chub.in>
date Fri Feb 04 06:18:50 2011 +0100 (2011-02-04)
parents 7eb1a8c3eade
children d708e2c1bad8
line diff
     1.1 --- a/new-words.py	Fri Jan 28 21:45:58 2011 +0100
     1.2 +++ b/new-words.py	Fri Feb 04 06:18:50 2011 +0100
     1.3 @@ -404,7 +404,8 @@
     1.4  
     1.5      stats = {}
     1.6      stats['total'] = sum(words[x] for x in words.keys())
     1.7 -    words = substract_dictionary(words, vocabulary)
     1.8 +    if 'FILTER_WORDS' in os.environ and os.environ['FILTER_WORDS'] == 'YES':
     1.9 +        words = substract_dictionary(words, vocabulary)
    1.10  
    1.11      stats['total_unknown'] = sum(words[x] for x in words.keys())
    1.12      stats['total_known'] = stats['total'] - stats['total_unknown']
    1.13 @@ -425,7 +426,8 @@
    1.14          words_with_freq.append((words[k], k))
    1.15  
    1.16      wgw = find_wordgroups_weights(words_with_freq, normalizator)
    1.17 -    words_with_freq = sorted(
    1.18 +    if 'WORDS_GROUPING' in os.environ and os.environ['WORDS_GROUPING'] == 'YES':
    1.19 +        words_with_freq = sorted(
    1.20                  words_with_freq,
    1.21                  cmp=lambda x,y:compare_word_pairs(x,y, wgw, normalizator, linked_words),
    1.22                  reverse=True)