Skip to content

Commit

Permalink
fixes #91: replace newline and space like characters with a space for…
Browse files Browse the repository at this point in the history
… meteor (#94)

* fixes #91: replace newline and space like characters with a space for meteor
* remove redundant space replacement
  • Loading branch information
kracwarlock authored Feb 10, 2020
1 parent 8461665 commit 95af2dc
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion nlgeval/pycocoevalcap/meteor/meteor.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import atexit
import logging
import os
import re
import subprocess
import sys
import threading
Expand Down Expand Up @@ -99,8 +100,9 @@ def method(self):

def _stat(self, hypothesis_str, reference_list):
# SCORE ||| reference 1 words ||| reference n words ||| hypothesis words
hypothesis_str = hypothesis_str.replace('|||', '').replace(' ', ' ')
hypothesis_str = hypothesis_str.replace('|||', '')
score_line = ' ||| '.join(('SCORE', ' ||| '.join(reference_list), hypothesis_str))
score_line = re.sub(r'\s+', ' ', score_line)
self.meteor_p.stdin.write(enc(score_line))
self.meteor_p.stdin.write(enc('\n'))
self.meteor_p.stdin.flush()
Expand Down

0 comments on commit 95af2dc

Please sign in to comment.