Skip to content
This repository has been archived by the owner on Jan 3, 2024. It is now read-only.

Commit

Permalink
Fix: Don't break if content in default language doesn't exist
Browse files Browse the repository at this point in the history
  • Loading branch information
suyashb95 committed Jul 15, 2018
1 parent 218ded3 commit 39ba274
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions WikiParse.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
RELATIONS = [
"synonyms", "antonyms", "hypernyms", "hyponyms",
"meronyms", "holonyms", "troponyms", "related terms",
"derived terms", "coordinate terms",
"coordinate terms",
]

UNWANTED_LIST = [
Expand Down Expand Up @@ -74,11 +74,11 @@ def get_word_data(self, language):
contents = self.soup.find_all('span', {'class': 'toctext'})
language_contents = []
start_index = None
if not start_index:
return []
for content in contents:
if content.text.lower() == language:
start_index = content.find_previous().text + '.'
if len(contents) != 0 and not start_index:
return []
for content in contents:
index = content.find_previous().text
if index.startswith(start_index):
Expand Down

0 comments on commit 39ba274

Please sign in to comment.