Skip to content

Commit

Permalink
Changes to add holonyms
Browse files Browse the repository at this point in the history
  • Loading branch information
fbanados committed Nov 22, 2024
1 parent 2de630f commit 4831a31
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
3 changes: 2 additions & 1 deletion wordnet/nltk.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ def normalize_result(result):
"definition" : result.definition,
"lemmas" : [lemma.name for lemma in result.lemmas()],
"hyponyms" : [name_format(r) for r in result.hyponyms()],
"hypernyms" : [name_format(r) for r in result.hypernyms()]
"hypernyms" : [name_format(r) for r in result.hypernyms()],
"holonyms" : [name_format(r) for r in result.member_holonyms()]
}

def search(keyword):
Expand Down
2 changes: 1 addition & 1 deletion wordnet/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
SECRET_KEY = "django-insecure-b7mt&=fxn8&u7xf2c!ttl39@a2h1=r$kgr+lin7kt_3#^wb!75"

# SECURITY WARNING: don't run with debug turned on in production!
# DEBUG = True
DEBUG = True

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

Expand Down
10 changes: 9 additions & 1 deletion wordnet/templates/wordnet/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ <h1>{{search}}</h1>
<th scope="col">Lemmas</th>
<th scope="col">Hyponyms</th>
<th scope="col">Hypernyms</th>
<th scope="col">Holonyms</th>
</tr></thead>
<tbody>
{% for result in results %}
Expand All @@ -47,7 +48,14 @@ <h1>{{search}}</h1>
<a href="{{main_url}}?search={{hypernym|urlencode}}">
{{hypernym}}
</a><br/>
{% endfor %}</td>
{% endfor %}
</td>
td>{% for holonym in result.holonyms %}
<a href="{{main_url}}?search={{holonym|urlencode}}">
{{holonym}}
</a><br/>
{% endfor %}
</td>
</tr>
{% endfor %}
</tbody>
Expand Down

0 comments on commit 4831a31

Please sign in to comment.