csvfile = codecs.open('TEST5.csv','wb') csvfile.write(u'\ufeff'.encode('utf8')) writer = csv.writer(csvfile) ph = Phonologist(from_file='asdasds') ph.words + list(Syllables) ph.phrases = list(Phrases) ph.prhases[0] = Phrases ph.prhases[0].words = list(Words) ph.syllables + list(Syllables) W = Words.loadfile("manolowords.txt") S = Syllables(W) writer.writerow(["Goyo"]) writer.writerow(["Basic Count"]) writer.writerow(['', "Words","Syllables","+Stress(Syllables)","-Stress(Syllables"]) for vow in span_vowels: words = sum(W.token_by_symbol(vow).values()) syllables = sum(S.token_by_symbol(vow).values()) stressedcount = sum(S.stressed_token_by_symbol(vow).values()) unstressedcount = sum(S.unstressed_token_by_symbol(vow).values()) writer.writerow([vow, words, syllables, stressedcount, unstressedcount]) SY = Symbols(S)
# -*- encoding: utf-8 -*- import csv import codecs from phonologist import Words, Nsyllables from collections import OrderedDict span_vowells = ["a","e","i","o","u"] csvfile = codecs.open('beta.csv','wb') csvfile.write(u'\ufeff'.encode('utf8')) writer = csv.writer(csvfile) W = Words("VisualTest.txt") S = Nsyllables(W) writer.writerow(["Elika"]) writer.writerow(["Basic Count"]) writer.writerow([" ", "Words","Syllables","+Stress","-Stress"]) for vow in span_vowells: words = sum(W.return_tokens_words(vow).values()) syllables = sum(S.return_tokens_sylls(vow).values()) stressedcount = sum(S.stressed_target_sylls(vow).values()) unstressedcount = sum(S.unstressed_target_sylls(vow).values()) writer.writerow([vow, words, syllables, stressedcount, unstressedcount]) writer.writerow([" "]) writer.writerow([" "]) writer.writerow(["Environment Count"])