From 537f480d32d3f8fef6f0e859a43f8c1eb4ac1e81 Mon Sep 17 00:00:00 2001 From: =?utf8?q?G=C3=BCnter=20Milde?= Date: Tue, 8 May 2018 22:32:41 +0200 Subject: [PATCH] =?utf8?q?Python-Skripte:=20unterst=C3=BCtze=20sprachauszu?= =?utf8?q?g.py=20--stil=3Dmodern.?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- skripte/python/edit_tools/sprachauszug.py | 8 ++++ skripte/python/edit_tools/wortliste.py | 66 ++++++++++++++++--------------- 2 files changed, 43 insertions(+), 31 deletions(-) diff --git a/skripte/python/edit_tools/sprachauszug.py b/skripte/python/edit_tools/sprachauszug.py index 5334b28..5578334 100755 --- a/skripte/python/edit_tools/sprachauszug.py +++ b/skripte/python/edit_tools/sprachauszug.py @@ -27,6 +27,8 @@ from wortliste import (WordEntry, ShortEntry, verblasst, fremdwortsilben, # >>> from sprachauszug import traditionell # >>> traditionell(u'Psy-ch>> traditionell(u'An>> from sprachauszug import modern # >>> modern(u'Psy-ch>> modern(u'An Feb-ru-ar # Hy-d-rant -> Hyd-rant # Ar-th-ri-tis -> Arth-ri-tis -# +# # :: def fremdwortsilben(wort, style='traditional'): @@ -1883,16 +1883,16 @@ def fremdwortsilben(wort, style='traditional'): # Ma-g-net -> Ma-gnet # Pro-g-nose -> Pro-gnose # Si-g-net -> Si-gnet - +# # Keine Übergeneralisierung: -# +# # >>> woerter = u'Seg-ler bast-le Ad-ler' # >>> for wort in woerter.split(): # ... print wort, '->', fremdwortsilben(wort) # Seg-ler -> Seg-ler # bast-le -> bast-le # Ad-ler -> Ad-ler - +# # wegen Übergeneralisierung nicht möglich: # Ap-ri-kose -> Apri-kose # ig-no-rie-ren -> igno-rie-ren @@ -1923,7 +1923,7 @@ def fremdwortsilben(wort, style='traditional'): # in-te-r>es-sant -> in-ter>es-sant # Li-n Lin Päd>> for wort in blasse.split(): # ... print wort, '->', verblasst(wort, 'modern') # hi-n hi-nauf @@ -1966,38 +1966,42 @@ def verblasst(wort, style='traditional'): # ab ab Ab Pros>> blasse = (u'Bür-ger=in<..i-tia-ti-ve Pä-..d>> blasse = (u'Bür-ger=in<.i-ti-a-ti-ve Pä-..d>> for wort in blasse.split(): # ... print wort, '->', verblasst(wort) -# Bür-ger=in<..i-tia-ti-ve -> Bür-ger=in<..itia-ti-ve +# Bür-ger=in<.i-ti-a-ti-ve -> Bür-ger=in<.iti-a-ti-ve # Pä-..d Päd>> for wort in blasse.split(): +# ... print wort, '->', verblasst(wort, 'modern') +# Bür-ger=in<.i-ti-a-ti-ve -> Bür-ger=ini-ti-a-ti-ve +# Pä-..d Pä-..de-..rast +# +# # scoretext() # ------------ - -# Füge Trennmöglichkeiten am Wortanfang und -ende zu, die normalerweise -# verboten sind aber in Notentexten gebraucht werden. - +# +# Füge Trennmöglichkeiten am Wortanfang und -ende zu, die nach K79 (bzw. §107 +# E2 des Regelwerkes) verboten sind aber in Notentexten gebraucht werden. +# # >>> from wortliste import scoretext # # >>> scoretext(u'Abend') # u'A.bend' # >>> scoretext(u'Ra-dio') # u'Ra-di.o' - +# # Das gleiche gilt für Trennmöglichkeiten am Anfang/Ende von Teilwörtern: - +# # >>> scoretext(u'Eis=ano-ma-lie') # u'Eis=a.no-ma-lie' # >>> scoretext(u'Ra-dio>> scoretext(u'Ai-chin-ger'), scoretext(u'Ai-da') # (u'Ai-chin-ger', u'A.i-da') # >>> scoretext(u'Ma-rie'), scoretext(u'Li-nie') @@ -2016,7 +2020,7 @@ def verblasst(wort, style='traditional'): # (u'A.go-nie', u'Be-go-ni.e') # >>> scoretext(u'Kom-pa-nie'), scoretext(u'Kas-ta-nie'), scoretext(u'Ge-ra-nie') # (u'Kom-pa-nie', u'Kas-ta-ni.e', u'Ge-ra-ni.e') - +# # ungelöst: Knie / Kni.e # pl. # :: @@ -2050,10 +2054,10 @@ def scoretext(word): if 'oo' in match.group(0) and match.group(0) != 'oo<': continue # …ie außer "-(l)inie", Iphigenie, Kastanie, Geranie, Begonie - if ('ie' in match.group(0) - and not word[:match.end()].endswith(u'i-nie') # Linie, - and not word[:match.end()].endswith(u'ta-nie') # Kastanie, - and not word[:match.end()].endswith(u'ra-nie') # Geranie, + if ('ie' in match.group(0) + and not word[:match.end()].endswith(u'i-nie') # Linie, + and not word[:match.end()].endswith(u'ta-nie') # Kastanie, + and not word[:match.end()].endswith(u'ra-nie') # Geranie, and not word[:match.end()].endswith(u'e-go-nie') # Begonie != Agonie and not word == u'Iphi-ge-nie'): continue @@ -2061,7 +2065,7 @@ def scoretext(word): if 'ue' in match.group(0) and re.search(u'[^aeät]ue([<>=]|$)', word[:match.end()], flags=re.IGNORECASE): continue - + word = ''.join((word[:match.start()], match.expand(u'\\1.\\2\\3'), scoretext(word[match.end():]))) break @@ -2148,9 +2152,9 @@ def ableitung1901(wort, keep_key=False): # Nord=osten # >>> print ableitung1901(u'Po-ly>> print ableitung1901(u'the-is-tisch') # the-i-stisch # @@ -2264,13 +2268,13 @@ def ableitung1901(wort, keep_key=False): return wort # Tests: - +# # Ein-Vokal-Silben auch schon 1901 erlaubt: - +# # >>> print ableitung1901(u'ver