mirror of
https://github.com/explosion/spaCy.git
synced 2024-12-26 18:06:29 +03:00
* Add case expansion to Brown clusters
This commit is contained in:
parent
5ab0f233a1
commit
c037f80638
|
@ -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
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user