Skip to content

Commit

Permalink
Merge pull request #48 from TitasDas/Fix-for-Issue#9
Browse files Browse the repository at this point in the history
Fix for issue #47
  • Loading branch information
fhamborg authored May 14, 2020
2 parents a2b517c + d1b6a2c commit 499713d
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions Giveme5W1H/extractor/extractors/cause_extractor.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,8 +127,8 @@ def _evaluate_tree(self, tree):
while sibling.label() == 'ADVP' and sibling.right_sibling() is not None:
sibling = sibling.right_sibling()

# NP-VP-NP pattern found .unicode_repr()
if sibling.label() == 'VP' and "('NP'" in sibling.unicode_repr():
# NP-VP-NP pattern found .__repr__()
if sibling.label() == 'VP' and "('NP'" in sibling.__repr__():
verbs = [t[0] for t in sibling.pos() if t[1][0] == 'V'][:3]
verb_synset = set()

Expand Down Expand Up @@ -214,8 +214,9 @@ def _evaluate_tree(self, tree):
# If we come along an adverb (RB) check the adverbials that indicate causation
candidates.append(deepcopy([pos[:i], pos[i - 1:], 'RB']))

elif token in self.causal_conjunctions and ' '.join([x['nlpToken']['originalText'] for x in tokens[i:]]).lower().startswith(
self.causal_conjunctions[token]):
elif token in self.causal_conjunctions and ' '.join(
[x['nlpToken']['originalText'] for x in tokens[i:]]).lower().startswith(
self.causal_conjunctions[token]):
# Check if token is a clausal conjunction indicating causation
start = i
if token not in self.causal_conjunctions_inclusive:
Expand Down Expand Up @@ -276,7 +277,7 @@ def _evaluate_candidates(self, document):
elif candidateObject.get_type() == 'RB':
# while not as significant as biclausal indicators, adverbials are mor significant as the verbs
score += self.weights[2]
else: # NP-VP-NP
else: # NP-VP-NP
score += self.weights[3]

if score > 0:
Expand Down

0 comments on commit 499713d

Please sign in to comment.