# HG changeset patch # User Igor Chubin # Date 1296796730 -3600 # Node ID 5f90e44eecfc432e59518c1ef7c3cf48538e8797 # Parent 7eb1a8c3eadeb8b2796327056eeaa62396353727 new-words.py: turn words filtering and grouping on and off diff -r 7eb1a8c3eade -r 5f90e44eecfc new-words-py.sh --- a/new-words-py.sh Fri Jan 28 21:45:58 2011 +0100 +++ b/new-words-py.sh Fri Feb 04 06:18:50 2011 +0100 @@ -12,6 +12,7 @@ -h print this screen -c show compressed wordlist: one word per group + -G turn off word grouping -k put higher words that are similar to the known words (only for English) -l lang override language settings -n non-interactive mode (don't run vi) @@ -82,10 +83,12 @@ FILTER_WORDS=YES SHOW_VOC_STAT=NO COMPRESSED_WORDLIST=NO -while getopts cl:sSkanNp:t:Tm:Mr:23 opt +WORDS_GROUPING=YES +while getopts Gcl:sSkanNp:t:Tm:Mr:23 opt do case "$opt" in c) COMPRESSED_WORDLIST=YES;; + G) WORDS_GROUPING=NO;; s) STAT_ONLY=YES;; S) SHOW_VOC_STAT=YES;; k) NEED_TO_USE_VOCABULARY_WHEN_SORT=YES;; @@ -141,6 +144,8 @@ STAT_ONLY="$STAT_ONLY" \ GROUP_WORDS_BY_TWO="$GROUP_WORDS_BY_TWO" \ GROUP_WORDS_BY_THREE="$GROUP_WORDS_BY_THREE" \ + WORDS_GROUPING="$WORDS_GROUPING" \ + FILTER_WORDS="$FILTER_WORDS" \ $NEW_WORDS_PY -l "$LANGUAGE" -f get_words_group_words_add_stat "$1" } diff -r 7eb1a8c3eade -r 5f90e44eecfc new-words.py --- a/new-words.py Fri Jan 28 21:45:58 2011 +0100 +++ b/new-words.py Fri Feb 04 06:18:50 2011 +0100 @@ -404,7 +404,8 @@ stats = {} stats['total'] = sum(words[x] for x in words.keys()) - words = substract_dictionary(words, vocabulary) + if 'FILTER_WORDS' in os.environ and os.environ['FILTER_WORDS'] == 'YES': + words = substract_dictionary(words, vocabulary) stats['total_unknown'] = sum(words[x] for x in words.keys()) stats['total_known'] = stats['total'] - stats['total_unknown'] @@ -425,7 +426,8 @@ words_with_freq.append((words[k], k)) wgw = find_wordgroups_weights(words_with_freq, normalizator) - words_with_freq = sorted( + if 'WORDS_GROUPING' in os.environ and os.environ['WORDS_GROUPING'] == 'YES': + words_with_freq = sorted( words_with_freq, cmp=lambda x,y:compare_word_pairs(x,y, wgw, normalizator, linked_words), reverse=True)