new-words
diff new-words.py @ 63:1b8b30ad7c95
vocabulary filename option
author | Igor Chubin <igor@chub.in> |
---|---|
date | Sat Nov 12 14:03:20 2011 +0100 (2011-11-12) |
parents | 3682038403ad |
children | 5a003076eb11 |
line diff
1.1 --- a/new-words.py Fri Nov 04 11:27:21 2011 +0100 1.2 +++ b/new-words.py Sat Nov 12 14:03:20 2011 +0100 1.3 @@ -29,6 +29,7 @@ 1.4 def __init__(self, language, linked_words={}): 1.5 stemmer_algorithm = { 1.6 'de' : 'german', 1.7 + 'fr' : 'french', 1.8 'en' : 'english', 1.9 'es' : 'spanish', 1.10 'ru' : 'russian', 1.11 @@ -232,6 +233,12 @@ 1.12 dest="show_tags") 1.13 1.14 parser.add_option( 1.15 + "-v", "--vocabulary-filename", 1.16 + help="use specified file as a vocabulary", 1.17 + action="store", 1.18 + dest="vocabulary_filename") 1.19 + 1.20 +parser.add_option( 1.21 "-2", "--two-words", 1.22 help="find 2 words' sequences", 1.23 action="store_true", 1.24 @@ -297,6 +304,8 @@ 1.25 return result 1.26 1.27 def voc_filename(): 1.28 + if 'vocabulary_filename' in config: 1.29 + return config['vocabulary_filename'] 1.30 return "%s/%s.txt"%(config['config_directory'], config['language']) 1.31 1.32 def load_vocabulary():