[Wisp-cvs] wisp/users/dig tran.py,1.42,1.43
Status: Alpha
Brought to you by:
digg
From: <di...@us...> - 2003-04-22 13:54:20
|
Update of /cvsroot/wisp/wisp/users/dig In directory sc8-pr-cvs1:/tmp/cvs-serv3187 Modified Files: tran.py Log Message: implemented --show-words Index: tran.py =================================================================== RCS file: /cvsroot/wisp/wisp/users/dig/tran.py,v retrieving revision 1.42 retrieving revision 1.43 diff -u -d -r1.42 -r1.43 --- tran.py 22 Apr 2003 13:45:13 -0000 1.42 +++ tran.py 22 Apr 2003 13:54:16 -0000 1.43 @@ -455,13 +455,25 @@ def main (): global prep - opts, args = getopt(sys.argv[1:], 'o:', ['output=']) - if len(args) != 1: - raise 'Invalid argument count -- must be 1', args - prep = Preprocessor(args[0]) + opts, args = getopt(sys.argv[1:], 'o:', ['output=', 'show-words']) output_name = 'a.out' + show_words = 0 for opt, arg in opts: if opt in ('-o', '--output'): output_name = arg + if opt == '--show-words': show_words = 1 + if show_words: + wd = {} + for w in Meaning.keys(): + s = w.find(' ') + if s != -1: w = w[:s] + wd[w] = 1 + w = wd.keys() + w.sort() + print 'Internally known words:' + print ' ', ' '.join(w) + if len(args) != 1: + raise 'Invalid argument count -- must be 1', args + prep = Preprocessor(args[0]) mainloop() print 'TEXT'; Text.dump() print 'DATA'; Data.dump() |