Skip to content

Commit

Permalink
Fixed monolingual mapping.
Browse files Browse the repository at this point in the history
  • Loading branch information
erikdab committed Jul 3, 2017
1 parent bd03c0c commit 6351c1c
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 9 deletions.
4 changes: 2 additions & 2 deletions pyrelaxmapper/conf.py
Expand Up @@ -61,8 +61,8 @@ def __init__(self, parser, wn_classes=None, constraint_types=None):

self._candidates = None
self._translater = None
self._manual = None
self._manual_missing = None
self._manual = {}
self._manual_missing = {}

# Others
self.pos = parser.get('relaxer', 'pos', fallback='').split(',')
Expand Down
8 changes: 2 additions & 6 deletions pyrelaxmapper/stats.py
Expand Up @@ -90,13 +90,10 @@ def stat_final(self):
# Coverage
manual, d_missing = self.status.manual, self.status.config.manual_missing()

# Accuracy, monosemous, polisemous
# Accuracy, monosemous, polysemous
# Use distance later!
correct = sum(target_id in self.status.manual.get(source_id, set())
correct = sum(target_id == self.status.manual.get(source_id, set())
for source_id, target_id in self.status.relaxed.items())
correct_2 = sum(target_id == manual_target_id
for source_id, target_id in self.status.relaxed.items()
for manual_target_id in self.status.manual.get(source_id, set()))
incorrect = len(self.status.relaxed) - correct
# Perfect, partial, false
accuracy = '{:.4f}%'.format(correct * 100 / len(self.status.relaxed)
Expand All @@ -120,7 +117,6 @@ def stat_final(self):
'relaxed': len(self.status.relaxed),
'n_no_connections': len(no_candidates),
'correct': correct,
'correct2': correct_2,
'incorrect': incorrect,
'accuracy': accuracy,
's_trans': translater.s_trans,
Expand Down
3 changes: 2 additions & 1 deletion pyrelaxmapper/translate.py
Expand Up @@ -34,7 +34,8 @@ def translate(self, o_lemma_synsets, d_lemma_synsets):
candidates_mono[source_synset].extend(d_lemma_synsets.get(trans)
for trans in translations)

return candidates_mono
self.candidates = candidates_mono
return self

log_title = type(self).__name__

Expand Down

0 comments on commit 6351c1c

Please sign in to comment.