Last active
August 29, 2015 14:15
-
-
Save JoFrhwld/9b68f9a59e61446a939a to your computer and use it in GitHub Desktop.
non initial onset /n/
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
from nltk.corpus import cmudict | |
import string | |
import re | |
the_dict = cmudict.dict() | |
the_dict2 = {word: [string.join(x, sep = " ") | |
for x in entries] | |
for word, entries in the_dict.items()} | |
two_n = {word: entries | |
for word, entries in the_dict2.items() | |
if any([re.search(r'.+N [AEIOU].*N [AEIOU][^N]+', entry) | |
for entry in entries])} | |
print(repr(len(two_n))) | |
for x in sorted(two_n.keys()): | |
print("\t" + x) | |
three_n = {word: entries | |
for word, entries in the_dict2.items() | |
if any([re.search(r'.+N [AEIOU].*N [AEIOU].*N [AEIOU][^N]+', entry) | |
for entry in entries])} | |
print(repr(len(three_n))) | |
for x in sorted(three_n.keys()): | |
print("\t" + x) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment