Hi Björn, Ich habe das Gedicht gerade aus deiner Lektion gestartet und war doch überrascht, was für ein Unterschied es im Vergleich zu einer normalen Textdatei ist (Ich hatte das Gedicht vorher noch nicht in KTouch getest, obwohl ich es dafür geschrieben habe). Ich war etwa 20% langsamer; ich vermute mal, weil die Worthäufigkeit anders war als in normalen Texten.
Teilweise war es für mich auch ein Test, wie komplex die Texte sein können, die man mit der Neo Grundreihe hinbekommt (und es sind nichtmal o und s drin :) ). Mit ASDF JKLÖ wäre das ganze deutlich schwerer gewesen (auch wenn es auch Dichter gibt, die nur mit einem Vokal Gedichte schreiben...). Ich hatte allerdings etwas Hilfe dabei: Ich habe heute auch ein kleines Python Skript geschrieben, das aus einer beliebigen Textdatei alle Wörter extrahiert, in denen *nur* bestimmte Zeichen vorkommen. Damit konnte ich dann für die Texte trainieren, die ich selbst schreiben will. Und die Standardbuchstaben sind eben die aus der Neo Grundreihe :) Eigentlich hatte ich mir das zum trainieren geschrieben, bin dann aber auf die Idee mit dem Gedicht gekommen. Mit ./wordfilter.py *txt Gibt es alle Wörter aus, die auf der Grundreihe getippt werden können, und ./wordfilter.py --length 1 *txt | sort | uniq Gibt jedes Wort nur einmal aus (braucht eine Unix Shell mit GNU tools). ./wordfilter --letters eanr *txt Gibt Zeilen mit Wörtern aus, die nur e, a, n und r enthalten. Außer "er" und "an" sind das bei meinen Texten z.B. noch "rar", "rannen", "Narren", "Arena", "Anna" und ein paar weitere. Allerdings sind die Worthäufigkeits-Verteilungen in Gedichten daraus natürlich extrem weit von der Verteilung in wirklichen Texten entfernt (sonst wäre das Gedicht recht langweilig :) ). Das Skript braucht aktuell Python 3 (http://python.org), aber wenn es jemanden interessiert kann ich es in unter einer Minute auf Python 2 umschreiben :) Falls gewünscht, kann ich die Worte auch noch zufällig ordnen... (wären etwa sechs Zeilen, inklusive Dokumentation :) ). Lieben Gruß, Arne Am Mittwoch, 9. September 2009 18:53:38 schrieb Bjoern Laessig: > Ich habe das ganze mal in eine ktouch Lektion (xml file) eingebaut. Dann > kann man es einfach laden oder in das ktouch Lektionen-Verzeichnis werfen. > http://www.ength.de/user/leo/project/ktouch/grundreihengedicht-ktouch_lectu > re.xml > > Und wo wir einmal bei ktouch Lektionen sind: > > Wer für typespeed trainieren will, dem habe ich mal die deutschen Worte > in eine Lektion gepackt … Schillers Glocke kommt auch noch irgendwann :-) > http://www.ength.de/user/leo/project/ktouch/german_typespeed-ktouch_lecture > .xml > > Ach da hängt auch noch einen xml schemadatei dran, die ist selbst anhand > von anderen ktouch lektionen erstellt (dagegen prüfe ich meine > selbtgeschriebenen) und ja ich weiß das es einen in ktouch eingebauten > Editor gibt. > http://www.ength.de/user/leo/project/ktouch/ktouch-lectures.xsd > > > Würde mich freuen zu hören, was ihr davon haltet :) > > Ich finde es prima … mehr davon wär gut :-) > > Björn L. > --- --- --- --- --- --- --- --- --- Unpolitisch sein heißt politisch sein, ohne es zu merken. - Arne (http://draketo.de) --- --- --- --- --- --- --- --- ---
#!/usr/bin/env python3 """wordfilter - extract words from a set of normal textfiles and keep only those which contain only of a defined set of letters. This allows you to train for texts which are relevant to you. usage: - wordfilter.py --letters uiaenrtd --remove ",." --length 12 README *.txt Get all words from the text files which only contain the specified letters but ignore (and remove) ',' and '.'. Output them in lines of length words (default 12) Default is to show only words which can be typed with the basic row in the neo keymap - that's what I'm writing this program for :) - wordfilter.py --help print this help text. """ __copyright__ = """ wordfilter - extract words which contain only specific letters. ----------------------------------------------------------------- © 2009 Copyright by Arne Babenhauserheide This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA """ # First we parse the basic command line arguments to get good reaction times from sys import argv if not argv[1:] or "--help" in argv: print(__doc__) # we need to be able to read the files def read_file(path): """Read a file and @return: the file content as a string.""" f = open(path) data = f.read() f.close() return data # Also we need to be able to split splti a file into wrods and filter out the words which have letters we don't want. def get_and_filter_words(text, letters="uiaenrtd", remove=",."): """Split the text into words and filter out all words which have undefined letters. Before filtering remove the letters given by remove. @param text: The text to parse. @param letters: The letters words are allowed to contain. @remove: The letters which get removed before filtering. @return: A list of fitting words. """ # First split the text by newlines and spaces raw_words = text.split() # now remove the letters to ignore words = [] for word in [list(word) for word in raw_words]: for letter in remove: if letter in word: word.remove(letter) words.append("".join(word)) # Now filter out unwanted words raw_words = words words = [] for word in raw_words: # simply go to the next word, if one of the letters in the word is not in our letters. valid = True for letter in word: if not letter.lower() in letters: valid = False if not valid: continue words.append(word) # we're already done return words ### Self-Test if __name__ == "__main__": # First read and remove the options from the argv if "--letters" in argv: letters = argv[argv.index("--letters") + 1] argv.remove("--letters") argv.remove(letters) else: letters = "uiaenrtd" if "--remove" in argv: remove = argv[argv.index("--remove") + 1] argv.remove("--remove") argv.remove(remove) else: remove = ",." if "--length" in argv: length = argv[argv.index("--length") + 1] argv.remove("--length") argv.remove(length) length = int(length) else: length = 12 # Now read all files word_lists = [get_and_filter_words(read_file(path), letters, remove) for path in argv[1:]] words = [] for i in word_lists: words.extend(i) # and print all words in sets of 12 i = 0 while i*length < len(words): for word in words[i*length : (i+1)*length]: print(word, end=" ") print() i += 1
signature.asc
Description: This is a digitally signed message part.