From 5cb6e6fda15c9920b3c18e55094df94c8fddc351 Mon Sep 17 00:00:00 2001 From: =?utf8?q?G=C3=BCnter=20Milde?= Date: Tue, 20 Sep 2016 10:33:32 +0200 Subject: [PATCH] Python-Skripte: Korrekturen nach Sortierung. --- skripte/python/edit_tools/expand_teilwoerter.py | 5 +++-- skripte/python/edit_tools/hyphenate_neueintraege.py | 7 +++---- .../trennstellenkategorisierung/abgleich_neueintraege.py | 12 ++++++++---- 3 files changed, 14 insertions(+), 10 deletions(-) diff --git a/skripte/python/edit_tools/expand_teilwoerter.py b/skripte/python/edit_tools/expand_teilwoerter.py index 866781f..ba1e2aa 100644 --- a/skripte/python/edit_tools/expand_teilwoerter.py +++ b/skripte/python/edit_tools/expand_teilwoerter.py @@ -197,7 +197,8 @@ def expand_words(entries): # print "problematisch", unicode(entry) continue if len(part_entries) == 1: # nichts neues - if part_entries[-1] == 'Stan' # geogr. Namen (z.B. Afghanistan) + continue + if part_entries[-1] == 'Stan': # geogr. Namen (z.B. Afghanistan) continue for e in part_entries: key = e[0] @@ -210,7 +211,7 @@ def expand_words(entries): if key.endswith('s') and (key[:-1] in entries or key[:-1].title() in entries): continue # Bindungs-S (z.B. "Ab neu.todo +Bsp: python hyphenate_neueintraege.py < missing-words.txt > neu.tod ``neu.todo`` kann (nach Durchsicht!!) mit `prepare_patch.py neu` in die Wortliste eingepflegt werden.³ @@ -49,10 +49,9 @@ import sys, os, codecs, glob, copy, optparse sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) - +# import patuse, trennstellenkategorisierung from wortliste import WordFile, WordEntry, join_word, toggle_case, sortkey_duden -from abgleich_neueintraege import print_proposal -import patuse +from trennstellenkategorisierung.abgleich_neueintraege import print_proposal from patuse.hyphenation import Hyphenator # Trenne mit Hyphenator:: diff --git a/skripte/python/trennstellenkategorisierung/abgleich_neueintraege.py b/skripte/python/trennstellenkategorisierung/abgleich_neueintraege.py index 0fc7e9e..62421d8 100755 --- a/skripte/python/trennstellenkategorisierung/abgleich_neueintraege.py +++ b/skripte/python/trennstellenkategorisierung/abgleich_neueintraege.py @@ -29,8 +29,12 @@ Bsp: python abgleich_neueintraege.py < dict-fail.txt > neu.todo import sys, os, codecs, optparse from collections import defaultdict # Wörterbuch mit Default -from wortliste import WordFile, WordEntry, join_word, toggle_case, sortkey_duden -from expand_teilwoerter import expand_wordfile + +# path for local Python modules (parent dir of this file's dir) +sys.path.insert(0, + os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) +from edit_tools.wortliste import WordFile, WordEntry, join_word, toggle_case, sortkey_duden +from edit_tools.expand_teilwoerter import expand_words # Funktionen # ----------- @@ -846,8 +850,8 @@ if __name__ == '__main__': if os.path.getmtime(options.wortliste) <= cache_mtime: words = WordFile(cache).asdict() else: - words = expand_wordfile(wordfile) - + words = expand_words(wordfile.asdict()) + # Aussortieren von Wörtern, die zu "false positives" führen:: # Wörter, die oft als Endungen auftauchen: -- 2.11.4.GIT