Spaces:
Sleeping
Sleeping
Commit Β·
21a1897
1
Parent(s): a755cd8
further suppress WordNet warnings
Browse files
.ipynb_checkpoints/chinesemeteor-checkpoint.py
CHANGED
|
@@ -13,7 +13,7 @@
|
|
| 13 |
# See the License for the specific language governing permissions and
|
| 14 |
# limitations under the License.
|
| 15 |
"""
|
| 16 |
-
|
| 17 |
"""
|
| 18 |
import jieba_fast as jieba
|
| 19 |
import datasets
|
|
@@ -25,6 +25,10 @@ import nltk
|
|
| 25 |
import evaluate
|
| 26 |
import re
|
| 27 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 28 |
# Download once
|
| 29 |
nltk.download("wordnet", quiet=True)
|
| 30 |
nltk.download("omw-1.4", quiet=True)
|
|
@@ -87,7 +91,7 @@ Examples:
|
|
| 87 |
to use the function.
|
| 88 |
|
| 89 |
>>> cmeteor = evaluate.load("raptorkwok/chinesemeteor")
|
| 90 |
-
>>> results = cmeteor.compute(references=["
|
| 91 |
>>> print(results)
|
| 92 |
{'meteor': 0.5111111111111111, 'scores': [0.5111111111111111]}
|
| 93 |
"""
|
|
|
|
| 13 |
# See the License for the specific language governing permissions and
|
| 14 |
# limitations under the License.
|
| 15 |
"""
|
| 16 |
+
Chinese METEOR β with Jieba pre-segmentation + CwnGraph Chinese WordNet
|
| 17 |
"""
|
| 18 |
import jieba_fast as jieba
|
| 19 |
import datasets
|
|
|
|
| 25 |
import evaluate
|
| 26 |
import re
|
| 27 |
|
| 28 |
+
# suppress WordNet warnings
|
| 29 |
+
import warnings
|
| 30 |
+
warnings.filterwarnings("ignore")
|
| 31 |
+
|
| 32 |
# Download once
|
| 33 |
nltk.download("wordnet", quiet=True)
|
| 34 |
nltk.download("omw-1.4", quiet=True)
|
|
|
|
| 91 |
to use the function.
|
| 92 |
|
| 93 |
>>> cmeteor = evaluate.load("raptorkwok/chinesemeteor")
|
| 94 |
+
>>> results = cmeteor.compute(references=["ζε¨ι裑ει£―"], predictions=["ζε¨ιε
εζι£―"])
|
| 95 |
>>> print(results)
|
| 96 |
{'meteor': 0.5111111111111111, 'scores': [0.5111111111111111]}
|
| 97 |
"""
|
chinesemeteor.py
CHANGED
|
@@ -13,7 +13,7 @@
|
|
| 13 |
# See the License for the specific language governing permissions and
|
| 14 |
# limitations under the License.
|
| 15 |
"""
|
| 16 |
-
|
| 17 |
"""
|
| 18 |
import jieba_fast as jieba
|
| 19 |
import datasets
|
|
@@ -25,6 +25,10 @@ import nltk
|
|
| 25 |
import evaluate
|
| 26 |
import re
|
| 27 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 28 |
# Download once
|
| 29 |
nltk.download("wordnet", quiet=True)
|
| 30 |
nltk.download("omw-1.4", quiet=True)
|
|
@@ -87,7 +91,7 @@ Examples:
|
|
| 87 |
to use the function.
|
| 88 |
|
| 89 |
>>> cmeteor = evaluate.load("raptorkwok/chinesemeteor")
|
| 90 |
-
>>> results = cmeteor.compute(references=["
|
| 91 |
>>> print(results)
|
| 92 |
{'meteor': 0.5111111111111111, 'scores': [0.5111111111111111]}
|
| 93 |
"""
|
|
|
|
| 13 |
# See the License for the specific language governing permissions and
|
| 14 |
# limitations under the License.
|
| 15 |
"""
|
| 16 |
+
Chinese METEOR β with Jieba pre-segmentation + CwnGraph Chinese WordNet
|
| 17 |
"""
|
| 18 |
import jieba_fast as jieba
|
| 19 |
import datasets
|
|
|
|
| 25 |
import evaluate
|
| 26 |
import re
|
| 27 |
|
| 28 |
+
# suppress WordNet warnings
|
| 29 |
+
import warnings
|
| 30 |
+
warnings.filterwarnings("ignore")
|
| 31 |
+
|
| 32 |
# Download once
|
| 33 |
nltk.download("wordnet", quiet=True)
|
| 34 |
nltk.download("omw-1.4", quiet=True)
|
|
|
|
| 91 |
to use the function.
|
| 92 |
|
| 93 |
>>> cmeteor = evaluate.load("raptorkwok/chinesemeteor")
|
| 94 |
+
>>> results = cmeteor.compute(references=["ζε¨ι裑ει£―"], predictions=["ζε¨ιε
εζι£―"])
|
| 95 |
>>> print(results)
|
| 96 |
{'meteor': 0.5111111111111111, 'scores': [0.5111111111111111]}
|
| 97 |
"""
|