Last active
December 23, 2015 18:49
-
-
Save menzenski/6678878 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def save_results(dictionary): | |
"""Save the list of possible diminutive stems in a text file.""" | |
# generate a file name for the saved list of diminutive stems | |
list_of_dim_stems = 'diminutive_stems.txt' | |
# write the list of diminutive stems to that file | |
with codecs.open(list_of_dim_stems, "w", encoding="utf-8") as stream: | |
for item in dictionary.keys(): | |
word = item | |
freq = dictionary[item] | |
stream.write("%s %r\n" % (word, freq)) | |
def main(): | |
print "%r tokens" % len(tokens) | |
print "%r distinct stems" % len(set(stemlist)) | |
print "%r diminutives" % len(diminutives) | |
print "%r distinct possible diminutive stems" % len(set(diminutives)) | |
save_results(dim_fd) | |
if __name__ == "__main__": | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment