Skip to content

Commit

Permalink
improved code when reading the paper
Browse files Browse the repository at this point in the history
  • Loading branch information
angelosalatino committed Aug 1, 2019
1 parent b375792 commit 6566dd7
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 22 deletions.
31 changes: 20 additions & 11 deletions classifier/semanticmodule.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,19 +42,28 @@ def set_paper(self, paper):
is already merged or a dictionary {"title": "","abstract": "","keywords": ""}.
"""
if isinstance(paper, dict):
t_paper = paper
self.paper = ""
for key in list(t_paper.keys()):
self.paper = self.paper + t_paper[key] + ". "
try:
if isinstance(paper, dict):
t_paper = paper
self.paper = ""
try:
for key in list(t_paper.keys()):
self.paper = self.paper + t_paper[key] + ". "
except TypeError:
pass
print(paper)


self.paper = self.paper.strip()
elif isinstance(paper, str):
self.paper = paper.strip()
self.paper = self.paper.strip()
elif isinstance(paper, str):
self.paper = paper.strip()

else:
raise TypeError("Error: Field format must be either 'json' or 'text'")
return
except TypeError:
pass

else:
raise TypeError("Error: Field format must be either 'json' or 'text'")
return



Expand Down
31 changes: 20 additions & 11 deletions classifier/syntacticmodule.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,19 +39,28 @@ def set_paper(self, paper):
"""

if isinstance(paper, dict):
t_paper = paper
self.paper = ""
for key in list(t_paper.keys()):
self.paper = self.paper + t_paper[key] + ". "
try:
if isinstance(paper, dict):
t_paper = paper
self.paper = ""
try:
for key in list(t_paper.keys()):
self.paper = self.paper + t_paper[key] + ". "
except TypeError:
pass
print(paper)


self.paper = self.paper.strip()
elif isinstance(paper, str):
self.paper = paper.strip()
self.paper = self.paper.strip()
elif isinstance(paper, str):
self.paper = paper.strip()

else:
raise TypeError("Error: Field format must be either 'json' or 'text'")
return
except TypeError:
pass

else:
raise TypeError("Error: Field format must be either 'json' or 'text'")
return

def set_min__similarity(self, msm):
"""Function that sets a different value for the similarity.
Expand Down

0 comments on commit 6566dd7

Please sign in to comment.