Skip to content

Commit 4831a31

Browse files
committed
Changes to add holonyms
1 parent 2de630f commit 4831a31

File tree

3 files changed

+12
-3
lines changed

3 files changed

+12
-3
lines changed

wordnet/nltk.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,8 @@ def normalize_result(result):
3434
"definition" : result.definition,
3535
"lemmas" : [lemma.name for lemma in result.lemmas()],
3636
"hyponyms" : [name_format(r) for r in result.hyponyms()],
37-
"hypernyms" : [name_format(r) for r in result.hypernyms()]
37+
"hypernyms" : [name_format(r) for r in result.hypernyms()],
38+
"holonyms" : [name_format(r) for r in result.member_holonyms()]
3839
}
3940

4041
def search(keyword):

wordnet/settings.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
SECRET_KEY = "django-insecure-b7mt&=fxn8&u7xf2c!ttl39@a2h1=r$kgr+lin7kt_3#^wb!75"
2525

2626
# SECURITY WARNING: don't run with debug turned on in production!
27-
# DEBUG = True
27+
DEBUG = True
2828

2929
ALLOWED_HOSTS = [ "wordnet.altlab.dev", "altlab-itw", "localhost" , "vm-dev", "127.0.0.1" ]
3030

wordnet/templates/wordnet/index.html

+9-1
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ <h1>{{search}}</h1>
2222
<th scope="col">Lemmas</th>
2323
<th scope="col">Hyponyms</th>
2424
<th scope="col">Hypernyms</th>
25+
<th scope="col">Holonyms</th>
2526
</tr></thead>
2627
<tbody>
2728
{% for result in results %}
@@ -47,7 +48,14 @@ <h1>{{search}}</h1>
4748
<a href="{{main_url}}?search={{hypernym|urlencode}}">
4849
{{hypernym}}
4950
</a><br/>
50-
{% endfor %}</td>
51+
{% endfor %}
52+
</td>
53+
td>{% for holonym in result.holonyms %}
54+
<a href="{{main_url}}?search={{holonym|urlencode}}">
55+
{{holonym}}
56+
</a><br/>
57+
{% endfor %}
58+
</td>
5159
</tr>
5260
{% endfor %}
5361
</tbody>

0 commit comments

Comments
 (0)