Neustrukturierung der Python Skripte als Paket.
[wortliste.git] / skripte / python / lang_s / de_Latf_quasihyph.py
blob507982f9f293840486c3d695796438dbf9590abf
1 #!/usr/bin/env python
2 # -*- coding: utf8 -*-
3 # :Copyright: © 2011 Günter Milde.
4 # Released without warranty under the terms of the
5 # GNU General Public License (v. 2 or later)
6 # :Id: $Id: $
8 # de_Latf_quasihyph.py:
9 # ============================================================
11 u"""Filter zum Wandeln von Wörtern mit Rund- und Lang-S in
12 Pseudo-Trennbeispiele (ausſagen -> aus-sagen)."""
14 import sys, optparse, re
17 usage = u'%prog [Optionen]\n' + __doc__
18 parser = optparse.OptionParser(usage=usage)
19 parser.add_option('-e', '--encoding', dest='encoding',
20 help=u'Kodierung der Ausgabe, '
21 u'Vorgabe "iso-8859-15"',
22 default='iso-8859-15')
24 (options, args) = parser.parse_args()
26 lines = (line.decode('utf-8') for line in sys.stdin)
28 words = (word.replace(u's', u's-').replace(u'ſ', u's').replace(u'-\n', u'\n')
29 for word in lines)
31 sys.stdout.writelines(line.encode(options.encoding) for line in words)