# -*- encoding: iso-8859-1 -*-

"""druckt Lemmata mit Kleinbuchstaben in die Datei wlLowerInWDGtxt.
"""

import re, sys
sys.path.append("../")
import classEntry02


def printTxt(entryList, count):
	p = classEntry02.Entry(entryList)
	f = open("../../../res/teilergebnisse/02wlLowerInWdg.txt", "a")
	
	[f.write("enthält Kleinbuchstaben: ID: " + p.getIdent() + "\t" + 
		"WL1: " + lem + "\n")
		for lem in p.getWl1()
		if lem.islower()]
	[f.write("enthält Kleinbuchstaben: ID: " + p.getIdent() + "\t" + 
		"WL2: " + lem + "\n")
		for lem in p.getWl2()
		if lem.islower()]
		
		
if __name__ == "__main__":
	lexicon = open("../../../res/01WAT.txt")
	wholeEntry = []
	countEntry = 0
	line = lexicon.readline()
	while line:
		line = line.strip()
		if re.search("ID:", line):
			if wholeEntry and wholeEntry[0] is not "":
				countEntry += 1
				printTxt(wholeEntry, countEntry)
			wholeEntry = []
		wholeEntry.append(line)
		line = lexicon.readline()
	printTxt(wholeEntry, countEntry)
	print "Anzahl der Einträge: ", countEntry
