AIPHES / emnlp19-moverscore

MoverScore: Text Generation Evaluating with Contextualized Embeddings and Earth Mover Distance
MIT License
197 stars 34 forks source link

Show the score value of sentences #7

Closed zysNLP closed 4 years ago

zysNLP commented 4 years ago

Hi, as you mentioned in your readme:

from moverscore import get_idf_dict, word_mover_score from collections import defaultdict idf_dict_hyp = get_idf_dict(translations) # idf_dict_hyp = defaultdict(lambda: 1.) idf_dict_ref = get_idf_dict(references) # idf_dict_ref = defaultdict(lambda: 1.) scores = word_mover_score(references, translations, idf_dict_ref, idf_dict_hyp, \ n_gram=1, remove_subwords=True)

I tried to make: translations = ['I have a good idea.'] references = ['so what did you see?']

After I execute these codes, I got scores=['1.0'], I think it is a wrong results. In my .moverscore dir I got files: ['MNLI_BERT.zip', 'config.json', 'MT', 'pytorch_model.bin', 'vocab.txt']

So could you please show an example for several pairs of sentences especially scores between them?

andyweizhao commented 4 years ago

I got the score very differently from you.

from collections import defaultdict
idf_dict_ref = defaultdict(lambda: 1.)
idf_dict_hyp = defaultdict(lambda: 1.)

translations = ['I have a good idea.']
references = ['so what did you see?']

print(word_mover_score(references, translations, idf_dict_ref, idf_dict_hyp, [],
                                        n_gram=1, remove_subwords=True, batch_size=48))
[0.14760867319451942]