46 lines
1.0 KiB
Plaintext
46 lines
1.0 KiB
Plaintext
|
.. Copyright (C) 2001-2019 NLTK Project
|
||
|
.. For license information, see LICENSE.TXT
|
||
|
|
||
|
.. -*- coding: utf-8 -*-
|
||
|
|
||
|
=============
|
||
|
METEOR tests
|
||
|
=============
|
||
|
|
||
|
No Allignment test
|
||
|
------------------
|
||
|
|
||
|
>>> from nltk.translate import meteor
|
||
|
|
||
|
If the candidate has no alignment to any of the references, the METEOR score is 0.
|
||
|
|
||
|
>>> round(meteor(
|
||
|
... ['The candidate has no alignment to any of the references'],
|
||
|
... 'John loves Mary'
|
||
|
... ),4)
|
||
|
0.0
|
||
|
|
||
|
Tests based on wikipedia examples
|
||
|
---------------------------------
|
||
|
|
||
|
Testing on `wikipedia examples <https://en.wikipedia.org/wiki/METEOR#Examples>`_
|
||
|
|
||
|
>>> same_res = round(meteor(
|
||
|
... ['The cat sat on the mat'],
|
||
|
... 'The cat sat on the mat'
|
||
|
... ),4)
|
||
|
>>> abs(same_res - 0.9977) < 1e-2
|
||
|
True
|
||
|
|
||
|
>>> meteor(
|
||
|
... ['The cat sat on the mat'],
|
||
|
... 'on the mat sat the cat'
|
||
|
... )
|
||
|
0.5
|
||
|
|
||
|
>>> round(meteor(
|
||
|
... ['The cat sat on the mat'],
|
||
|
... 'The cat was sat on the mat'
|
||
|
... ),4)
|
||
|
0.9654
|