* Add case expansion to Brown clusters

This commit is contained in:
Matthew Honnibal 2015-05-31 05:50:50 +02:00
parent 5ab0f233a1
commit c037f80638

View File

@ -52,6 +52,14 @@ def _read_clusters(loc):
clusters[word] = cluster clusters[word] = cluster
else: else:
clusters[word] = '0' clusters[word] = '0'
# Expand clusters with re-casing
for word, cluster in clusters.items():
if word.lower() not in clusters:
clusters[word.lower()] = cluster
if word.title() not in clusters:
clusters[word.title()] = cluster
if word.upper() not in clusters
clusters[word.upper()] = cluster
return clusters return clusters