summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTapio Lehtonen <tale@debian.org>2009-09-05 18:11:19 +0000
committerTapio Lehtonen <tale@debian.org>2009-09-05 18:11:19 +0000
commit8e933eec1826c44745a9a6f7fd0dab6815374c24 (patch)
tree24ef79d4a93c056791c8c1ccabc6421d8682c6dd
parentb8712cdc5c0013c4468d672460301a9a9f3ac5a3 (diff)
downloadinstallation-guide-8e933eec1826c44745a9a6f7fd0dab6815374c24.zip
Command enchant too restricted. Making my own command to produce list of words spelled wrong
-rwxr-xr-xpo/fi/make-fi-all.py53
1 files changed, 53 insertions, 0 deletions
diff --git a/po/fi/make-fi-all.py b/po/fi/make-fi-all.py
new file mode 100755
index 000000000..9c7ca12ae
--- /dev/null
+++ b/po/fi/make-fi-all.py
@@ -0,0 +1,53 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+import enchant
+
+def handleCommandLine():
+ """ Get arguments and options from command line. """
+ from optparse import OptionParser
+
+ usage = """usage: %prog [options] filename
+Print out unknown words found in filename. Options
+-p and --wordlist can be given several times."""
+ lhelpstr="""What language is the text to proofread? For example fi_FI."""
+ parser = OptionParser(usage=usage)
+ parser.set_defaults(verbose=True)
+ parser.add_option("-p", "--wordlist",
+ action="append", type="string", dest="wordlists",
+ help="File with OK words one per line.",
+ metavar="Wordlist")
+ parser.add_option("-d", "--language",
+ action="store", type="string", dest="language",
+ help=lhelpstr)
+ parser.add_option("-v", action="store_true", dest="verbose",
+ help="Be verbose.")
+ parser.add_option("-q", action="store_false", dest="verbose",
+ help="Be quiet.")
+
+ (options, args) = parser.parse_args()
+ if len(args) != 1:
+ parser.error("incorrect number of arguments")
+ if options.verbose:
+ if options.wordlists == []:
+ print "No extra wordlist files."
+ else:
+ print "Extra wordlists: ",
+ for f in options.wordlists:
+ print f + " ",
+ print
+ if options.language:
+ print "Proofreading using language ", options.language, "."
+ else:
+ print "Proofreading using default language."
+
+ return (options, args)
+
+
+if __name__ == "__main__":
+ o, a = handleCommandLine()
+ print o
+ print a
+
+
+