Skip to content

Instantly share code, notes, and snippets.

@menzenski
Last active December 23, 2015 18:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save menzenski/6678878 to your computer and use it in GitHub Desktop.
Save menzenski/6678878 to your computer and use it in GitHub Desktop.
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