nltkor 1.2.9__tar.gz → 1.2.11__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {nltkor-1.2.9 → nltkor-1.2.11}/PKG-INFO +8 -2
- {nltkor-1.2.9 → nltkor-1.2.11}/README.md +150 -27
- {nltkor-1.2.9 → nltkor-1.2.11}/nltkor/__init__.py +1 -1
- {nltkor-1.2.9 → nltkor-1.2.11}/nltkor/tag/libs/config.py +0 -0
- {nltkor-1.2.9 → nltkor-1.2.11}/nltkor/tag/libs/network.c +123 -123
- {nltkor-1.2.9 → nltkor-1.2.11}/nltkor/tag/libs/reader.py +8 -3
- {nltkor-1.2.9 → nltkor-1.2.11}/nltkor/tag/libs/utils.py +0 -0
- {nltkor-1.2.9 → nltkor-1.2.11}/nltkor.egg-info/PKG-INFO +8 -2
- {nltkor-1.2.9 → nltkor-1.2.11}/setup.py +1 -1
- {nltkor-1.2.9 → nltkor-1.2.11}/LICENSE.txt +0 -0
- {nltkor-1.2.9 → nltkor-1.2.11}/nltkor/Kor_char.py +0 -0
- {nltkor-1.2.9 → nltkor-1.2.11}/nltkor/alignment/__init__.py +0 -0
- {nltkor-1.2.9 → nltkor-1.2.11}/nltkor/cider/__init__.py +0 -0
- {nltkor-1.2.9 → nltkor-1.2.11}/nltkor/cider/cider.py +0 -0
- {nltkor-1.2.9 → nltkor-1.2.11}/nltkor/cider/cider_scorer.py +0 -0
- {nltkor-1.2.9 → nltkor-1.2.11}/nltkor/distance/__init__.py +0 -0
- {nltkor-1.2.9 → nltkor-1.2.11}/nltkor/distance/wasserstein.py +0 -0
- {nltkor-1.2.9 → nltkor-1.2.11}/nltkor/etc.py +0 -0
- {nltkor-1.2.9 → nltkor-1.2.11}/nltkor/lazyimport.py +0 -0
- {nltkor-1.2.9 → nltkor-1.2.11}/nltkor/make_requirement.py +0 -0
- {nltkor-1.2.9 → nltkor-1.2.11}/nltkor/metrics/__init__.py +0 -0
- {nltkor-1.2.9 → nltkor-1.2.11}/nltkor/metrics/bartscore.py +0 -0
- {nltkor-1.2.9 → nltkor-1.2.11}/nltkor/metrics/bertscore.py +0 -0
- {nltkor-1.2.9 → nltkor-1.2.11}/nltkor/metrics/bleu_tensor.py +0 -0
- {nltkor-1.2.9 → nltkor-1.2.11}/nltkor/metrics/classical.py +0 -0
- {nltkor-1.2.9 → nltkor-1.2.11}/nltkor/metrics/entment.py +0 -0
- {nltkor-1.2.9 → nltkor-1.2.11}/nltkor/metrics/eval.py +0 -0
- {nltkor-1.2.9 → nltkor-1.2.11}/nltkor/metrics/mauve.py +0 -0
- {nltkor-1.2.9 → nltkor-1.2.11}/nltkor/metrics/mauve_utils.py +0 -0
- {nltkor-1.2.9 → nltkor-1.2.11}/nltkor/misc/__init__.py +0 -0
- {nltkor-1.2.9 → nltkor-1.2.11}/nltkor/misc/string2string_basic_functions.py +0 -0
- {nltkor-1.2.9 → nltkor-1.2.11}/nltkor/misc/string2string_default_tokenizer.py +0 -0
- {nltkor-1.2.9 → nltkor-1.2.11}/nltkor/misc/string2string_hash_functions.py +0 -0
- {nltkor-1.2.9 → nltkor-1.2.11}/nltkor/misc/string2string_word_embeddings.py +0 -0
- {nltkor-1.2.9 → nltkor-1.2.11}/nltkor/search/__init__.py +0 -0
- {nltkor-1.2.9 → nltkor-1.2.11}/nltkor/search/classical.py +0 -0
- {nltkor-1.2.9 → nltkor-1.2.11}/nltkor/search/faiss_search.py +0 -0
- {nltkor-1.2.9 → nltkor-1.2.11}/nltkor/search/kobert_tokenizer.py +0 -0
- {nltkor-1.2.9 → nltkor-1.2.11}/nltkor/sejong/__init__.py +0 -0
- {nltkor-1.2.9 → nltkor-1.2.11}/nltkor/sejong/__pycache__/__init__.cpython-38.pyc +0 -0
- {nltkor-1.2.9 → nltkor-1.2.11}/nltkor/sejong/__pycache__/__init__.cpython-39.pyc +0 -0
- {nltkor-1.2.9 → nltkor-1.2.11}/nltkor/sejong/__pycache__/sejong_download.cpython-38.pyc +0 -0
- {nltkor-1.2.9 → nltkor-1.2.11}/nltkor/sejong/__pycache__/sejong_download.cpython-39.pyc +0 -0
- {nltkor-1.2.9 → nltkor-1.2.11}/nltkor/sejong/__pycache__/ssem.cpython-38.pyc +0 -0
- {nltkor-1.2.9 → nltkor-1.2.11}/nltkor/sejong/__pycache__/ssem.cpython-39.pyc +0 -0
- {nltkor-1.2.9 → nltkor-1.2.11}/nltkor/sejong/ch.py +0 -0
- {nltkor-1.2.9 → nltkor-1.2.11}/nltkor/sejong/dict_semClassNum.txt +0 -0
- {nltkor-1.2.9 → nltkor-1.2.11}/nltkor/sejong/layer.txt +0 -0
- {nltkor-1.2.9 → nltkor-1.2.11}/nltkor/sejong/sejong_download.py +0 -0
- {nltkor-1.2.9 → nltkor-1.2.11}/nltkor/sejong/ssem.py +0 -0
- {nltkor-1.2.9 → nltkor-1.2.11}/nltkor/similarity/__init__.py +0 -0
- {nltkor-1.2.9 → nltkor-1.2.11}/nltkor/similarity/bartscore____.py +0 -0
- {nltkor-1.2.9 → nltkor-1.2.11}/nltkor/similarity/bertscore____.py +0 -0
- {nltkor-1.2.9 → nltkor-1.2.11}/nltkor/similarity/classical.py +0 -0
- {nltkor-1.2.9 → nltkor-1.2.11}/nltkor/similarity/cosine_similarity.py +0 -0
- {nltkor-1.2.9 → nltkor-1.2.11}/nltkor/tag/__init__.py +0 -0
- {nltkor-1.2.9 → nltkor-1.2.11}/nltkor/tag/espresso_tag.py +0 -0
- {nltkor-1.2.9 → nltkor-1.2.11}/nltkor/tag/libs/__init__.py +0 -0
- {nltkor-1.2.9 → nltkor-1.2.11}/nltkor/tag/libs/arguments.py +0 -0
- {nltkor-1.2.9 → nltkor-1.2.11}/nltkor/tag/libs/attributes.py +0 -0
- {nltkor-1.2.9 → nltkor-1.2.11}/nltkor/tag/libs/metadata.py +0 -0
- {nltkor-1.2.9 → nltkor-1.2.11}/nltkor/tag/libs/ner/__init__.py +0 -0
- {nltkor-1.2.9 → nltkor-1.2.11}/nltkor/tag/libs/ner/macmorphoreader.py +0 -0
- {nltkor-1.2.9 → nltkor-1.2.11}/nltkor/tag/libs/ner/ner_reader.py +0 -0
- {nltkor-1.2.9 → nltkor-1.2.11}/nltkor/tag/libs/parse/__init__.py +0 -0
- {nltkor-1.2.9 → nltkor-1.2.11}/nltkor/tag/libs/parse/parse_reader.py +0 -0
- {nltkor-1.2.9 → nltkor-1.2.11}/nltkor/tag/libs/pos/__init__.py +0 -0
- {nltkor-1.2.9 → nltkor-1.2.11}/nltkor/tag/libs/pos/macmorphoreader.py +0 -0
- {nltkor-1.2.9 → nltkor-1.2.11}/nltkor/tag/libs/pos/pos_reader.py +0 -0
- {nltkor-1.2.9 → nltkor-1.2.11}/nltkor/tag/libs/srl/__init__.py +0 -0
- {nltkor-1.2.9 → nltkor-1.2.11}/nltkor/tag/libs/srl/__srl_reader_.py +0 -0
- {nltkor-1.2.9 → nltkor-1.2.11}/nltkor/tag/libs/srl/srl_reader.py +0 -0
- {nltkor-1.2.9 → nltkor-1.2.11}/nltkor/tag/libs/srl/train_srl.py +0 -0
- {nltkor-1.2.9 → nltkor-1.2.11}/nltkor/tag/libs/taggers.py +0 -0
- {nltkor-1.2.9 → nltkor-1.2.11}/nltkor/tag/libs/word_dictionary.py +0 -0
- {nltkor-1.2.9 → nltkor-1.2.11}/nltkor/tag/libs/wsd/__init__.py +0 -0
- {nltkor-1.2.9 → nltkor-1.2.11}/nltkor/tag/libs/wsd/macmorphoreader.py +0 -0
- {nltkor-1.2.9 → nltkor-1.2.11}/nltkor/tag/libs/wsd/wsd_reader.py +0 -0
- {nltkor-1.2.9 → nltkor-1.2.11}/nltkor/tokenize/__init__.py +0 -0
- {nltkor-1.2.9 → nltkor-1.2.11}/nltkor/tokenize/ko_tokenize.py +0 -0
- {nltkor-1.2.9 → nltkor-1.2.11}/nltkor/trans.py +0 -0
- {nltkor-1.2.9 → nltkor-1.2.11}/nltkor.egg-info/SOURCES.txt +0 -0
- {nltkor-1.2.9 → nltkor-1.2.11}/nltkor.egg-info/dependency_links.txt +0 -0
- {nltkor-1.2.9 → nltkor-1.2.11}/nltkor.egg-info/requires.txt +0 -0
- {nltkor-1.2.9 → nltkor-1.2.11}/nltkor.egg-info/top_level.txt +0 -0
- {nltkor-1.2.9 → nltkor-1.2.11}/setup.cfg +0 -0
- {nltkor-1.2.9 → nltkor-1.2.11}/test/test.py +0 -0
- {nltkor-1.2.9 → nltkor-1.2.11}/test/testespresso.py +0 -0
@@ -1,6 +1,6 @@
|
|
1
|
-
Metadata-Version: 2.
|
1
|
+
Metadata-Version: 2.4
|
2
2
|
Name: nltkor
|
3
|
-
Version: 1.2.
|
3
|
+
Version: 1.2.11
|
4
4
|
Home-page: https://modi.changwon.ac.kr/air_cwnu/nlp_tool/nltk_ko.git
|
5
5
|
Keywords: string matching,pattern matching,edit distance,string to string correction,string to string matching,Levenshtein edit distance,Hamming distance,Damerau-Levenshtein distance,Jaro-Winkler distance,longest common subsequence,longest common substring,dynamic programming,approximate string matching,semantic similarity,natural language processing,NLP,information retrieval,rouge,sacrebleu,bertscore,bartscore,fasttext,glove,cosine similarity,Smith-Waterman,Needleman-Wunsch,Hirschberg,Karp-Rabin,Knuth-Morris-Pratt,Boyer-Moore
|
6
6
|
Classifier: Programming Language :: Python :: 3.7
|
@@ -34,3 +34,9 @@ Requires-Dist: bert_score
|
|
34
34
|
Requires-Dist: chardet
|
35
35
|
Requires-Dist: GPUtil
|
36
36
|
Requires-Dist: fasttext
|
37
|
+
Dynamic: classifier
|
38
|
+
Dynamic: home-page
|
39
|
+
Dynamic: keywords
|
40
|
+
Dynamic: license-file
|
41
|
+
Dynamic: requires-dist
|
42
|
+
Dynamic: requires-python
|
@@ -4,9 +4,10 @@
|
|
4
4
|
|
5
5
|
| 번호 | 날짜 | 작성자 | 내용 |
|
6
6
|
| ---- | --------- | ------ | ---------------- |
|
7
|
-
| 1 | 2024.4.1 | 김도원 | NLTKo 1.0.0
|
7
|
+
| 1 | 2024.4.1 | 김도원 | NLTKo 1.0.0 공개<br> string2string 기능 추가, METEOR Score 추가 |
|
8
8
|
| 2 | 2024.5.22 | 차정원 | NLTKo 1.1.0 공개 |
|
9
|
-
| 3 | 2025.2.5 | 이예나 | NLTKor 1.2.0
|
9
|
+
| 3 | 2025.2.5 | 이예나 | NLTKor 1.2.0 공개<br> bleu tensor 추가, entment 추가, accurancy norm 추가 |
|
10
|
+
| 4 | 2025.4.3 | 이예나 | NLTKor 1.2.10 업데이트<br> espresso 오류 수정 |
|
10
11
|
|
11
12
|
|
12
13
|
|
@@ -37,19 +38,20 @@
|
|
37
38
|
- [4.11 is_numConnection(Ch)](#411-is_numconnectionch)
|
38
39
|
- [5. 기본 평가 함수들](#5-기본-평가-함수들)
|
39
40
|
- [5.1 Accuracy](#51-accuracy)
|
40
|
-
- [5.2
|
41
|
-
- [5.3
|
42
|
-
- [5.4
|
43
|
-
- [5.5
|
44
|
-
- [5.6
|
45
|
-
- [5.7
|
46
|
-
- [5.8
|
47
|
-
- [5.9
|
48
|
-
- [5.
|
49
|
-
- [5.10
|
50
|
-
- [5.11
|
51
|
-
- [5.12
|
52
|
-
- [5.13
|
41
|
+
- [5.2 Accurancy norm](#52-accuracy-norm)
|
42
|
+
- [5.3 Precision](#53-precision)
|
43
|
+
- [5.4 Recall](#54-recall)
|
44
|
+
- [5.5 F1 score](#55-f1-score)
|
45
|
+
- [5.6 P@k (Precision at k), R@k (Recall ar k)](#56-pk-precision-at-k-rk-recall-ar-k)
|
46
|
+
- [5.7 Hit rate @ k](#57-hit-rate--k)
|
47
|
+
- [5.8 세종형식 품사태깅 결과 평가](#58-세종형식-품사태깅-결과-평가)
|
48
|
+
- [5.9 WER/CER](#59-wercer)
|
49
|
+
- [5.10 BLEU](#510-bleu)
|
50
|
+
- [5.10.1 BLEU for tensor](#5101-bleu-for-tensor)
|
51
|
+
- [5.11 ROUGE](#511-rouge)
|
52
|
+
- [5.12 CIDER](#512-cider)
|
53
|
+
- [5.13 METEOR](#513-meteor)
|
54
|
+
- [5.14 EntMent](#514-entment)
|
53
55
|
- [6 확장 평가 함수](#6-확장-평가-함수)
|
54
56
|
- [6.1 MAUVE](#61-mauve)
|
55
57
|
- [6.2 BERT Score](#62-bert-score)
|
@@ -146,6 +148,18 @@ apt install git
|
|
146
148
|
- `apt install pythonx.x-dev` (x.x는 사용자의 python 버전에 맞게 입력)
|
147
149
|
- `apt-get install pythonx.x-distutils` (x.x는 사용자의 python 버전에 맞게 입력)
|
148
150
|
|
151
|
+
- 만약 설치 도중 해당 에러가 발생한다면
|
152
|
+
```h
|
153
|
+
× Getting requirements to build wheel did not run successfully.
|
154
|
+
│ exit code: 1
|
155
|
+
╰─> See above for output.
|
156
|
+
```
|
157
|
+
|
158
|
+
```h
|
159
|
+
pip install wheel
|
160
|
+
```
|
161
|
+
로 wheel을 먼저 설치해야한다.
|
162
|
+
|
149
163
|
<div style="page-break-after: always;"></div>
|
150
164
|
|
151
165
|
## 3. 함수 설명
|
@@ -511,7 +525,96 @@ False
|
|
511
525
|
0.4
|
512
526
|
```
|
513
527
|
|
514
|
-
#### 5.2
|
528
|
+
#### 5.2 Accuracy norm
|
529
|
+
일반적으로 생성형 모델의 예측 정확도를 정규화(normalization)한 값을 의미한다.
|
530
|
+
```python
|
531
|
+
import torch
|
532
|
+
from transformers import AutoModelForCausalLM, AutoTokenizer
|
533
|
+
import time
|
534
|
+
import random
|
535
|
+
from nltkor.metrics import DefaultMetric
|
536
|
+
|
537
|
+
# 모델과 토크나이저 로드
|
538
|
+
model_name = 'gpt2-medium'
|
539
|
+
model = AutoModelForCausalLM.from_pretrained(model_name).cuda().eval()
|
540
|
+
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
541
|
+
|
542
|
+
# HellaSwag 형식의 임의 데이터 생성
|
543
|
+
examples = [
|
544
|
+
{
|
545
|
+
"input_text": "The boy threw a frisbee and",
|
546
|
+
"candidates": ["it landed on the roof.", "the dog chased it.", "it broke.", "it disappeared."],
|
547
|
+
"label": 1
|
548
|
+
},
|
549
|
+
{
|
550
|
+
"input_text": "The man started cooking by",
|
551
|
+
"candidates": ["turning on the stove.", "reading a book.", "watching TV.", "taking a nap."],
|
552
|
+
"label": 0
|
553
|
+
},
|
554
|
+
{
|
555
|
+
"input_text": "The girl put on her shoes and",
|
556
|
+
"candidates": ["went for a run.", "started sleeping.", "ate breakfast.", "watched TV."],
|
557
|
+
"label": 0
|
558
|
+
},
|
559
|
+
{
|
560
|
+
"input_text": "The cat jumped onto the table and",
|
561
|
+
"candidates": ["fell asleep.", "knocked over a glass.", "started barking.", "flew away."],
|
562
|
+
"label": 1
|
563
|
+
},
|
564
|
+
{
|
565
|
+
"input_text": "The boy opened the door and saw",
|
566
|
+
"candidates": ["a pizza delivery.", "nothing.", "a spaceship.", "an elephant."],
|
567
|
+
"label": 0
|
568
|
+
},
|
569
|
+
{
|
570
|
+
"input_text": "The woman picked up her phone and",
|
571
|
+
"candidates": ["called her friend.", "ate it.", "threw it away.", "danced."],
|
572
|
+
"label": 0
|
573
|
+
},
|
574
|
+
{
|
575
|
+
"input_text": "After finishing his homework, the student",
|
576
|
+
"candidates": ["went to sleep.", "built a house.", "flew a kite.", "started driving."],
|
577
|
+
"label": 0
|
578
|
+
},
|
579
|
+
{
|
580
|
+
"input_text": "The dog found a stick and",
|
581
|
+
"candidates": ["ran away with it.", "ate the sofa.", "drove a car.", "built a boat."],
|
582
|
+
"label": 0
|
583
|
+
},
|
584
|
+
{
|
585
|
+
"input_text": "She turned off the lights and",
|
586
|
+
"candidates": ["went to bed.", "started cooking.", "went jogging.", "washed her car."],
|
587
|
+
"label": 0
|
588
|
+
},
|
589
|
+
{
|
590
|
+
"input_text": "The chef tasted the soup and",
|
591
|
+
"candidates": ["smiled.", "cried loudly.", "threw it away.", "started singing."],
|
592
|
+
"label": 0
|
593
|
+
}
|
594
|
+
]
|
595
|
+
|
596
|
+
# 평가 실행 및 결과 출력
|
597
|
+
correct = 0
|
598
|
+
memory_usages = []
|
599
|
+
inference_times = []
|
600
|
+
|
601
|
+
for example in examples:
|
602
|
+
cor, metrics = DefaultMetric().accuracy_norm(model, tokenizer, example["input_text"], example["candidates"], example["label"])
|
603
|
+
correct += cor
|
604
|
+
memory_usages.append(metrics["reserved_memory"])
|
605
|
+
inference_times.append(metrics["inference_time"])
|
606
|
+
|
607
|
+
accuracy = correct / len(examples)
|
608
|
+
|
609
|
+
print(f"Accuracy: {accuracy * 100:.2f}%")
|
610
|
+
print(f"Time: {sum(inference_times)/len(inference_times)}, memory: {sum(memory_usages)/len(memory_usages)}")
|
611
|
+
```
|
612
|
+
```
|
613
|
+
Accuracy: 20.00
|
614
|
+
Time: 0.05374705195426941, memory: 1409.9
|
615
|
+
```
|
616
|
+
|
617
|
+
#### 5.3 Precision
|
515
618
|
|
516
619
|
'micro' precision은 'Accuracy'와 같이 $2/5 = 0.4$ 로 계산이 된다.
|
517
620
|
'macro' precision은 각 클래스별로 precision을 계산하여 평균을 낸다. 다음 예에서는 'a'=1/2, 'b' = 1/2, 'c' = 0, 'd' = 0. 따라서 1/4 = 0.25가 된다.
|
@@ -526,7 +629,7 @@ False
|
|
526
629
|
0.25
|
527
630
|
```
|
528
631
|
|
529
|
-
#### 5.
|
632
|
+
#### 5.4 Recall
|
530
633
|
|
531
634
|
```python
|
532
635
|
>>> from nltkor.metrics import DefaultMetric
|
@@ -538,7 +641,7 @@ False
|
|
538
641
|
0.25
|
539
642
|
```
|
540
643
|
|
541
|
-
#### 5.
|
644
|
+
#### 5.5 F1 score
|
542
645
|
|
543
646
|
```python
|
544
647
|
>>> from nltkor.metrics import DefaultMetric
|
@@ -550,7 +653,7 @@ False
|
|
550
653
|
0.25
|
551
654
|
```
|
552
655
|
|
553
|
-
#### 5.
|
656
|
+
#### 5.6 P@k (Precision at k), R@k (Recall ar k)
|
554
657
|
|
555
658
|
```python
|
556
659
|
>>> from nltkor.metrics import DefaultMetric
|
@@ -562,7 +665,7 @@ False
|
|
562
665
|
0.6666666666666666
|
563
666
|
```
|
564
667
|
|
565
|
-
#### 5.
|
668
|
+
#### 5.7 Hit rate @ k
|
566
669
|
|
567
670
|
'user', 'h_pred'는 정렬된 이중 리스트 형식이다. 다음 예제에서 k = 3이다. 이 경우에 'h_pred[:k]'까지만 평가한다.
|
568
671
|
|
@@ -574,7 +677,7 @@ False
|
|
574
677
|
0.25
|
575
678
|
```
|
576
679
|
|
577
|
-
#### 5.
|
680
|
+
#### 5.8 세종형식 품사태깅 결과 평가
|
578
681
|
|
579
682
|
다음 예제와 같은 품사 태깅 결과를 입력하여 성능을 측정한다.
|
580
683
|
|
@@ -604,7 +707,7 @@ False
|
|
604
707
|
(0.8, 0.8636363636363636, 0.8636363636363636, 0.8636363636363636)
|
605
708
|
```
|
606
709
|
|
607
|
-
#### 5.
|
710
|
+
#### 5.9 WER/CER
|
608
711
|
|
609
712
|
- wer (단어 오류율) : 두 입력 문장 사이의 단어 오류율 반환
|
610
713
|
- cer (음절 오류율) : 두 입력 문장 사이의 문자(음절) 오류율 반환
|
@@ -628,7 +731,7 @@ False
|
|
628
731
|
0.3333333333333333
|
629
732
|
```
|
630
733
|
|
631
|
-
#### 5.
|
734
|
+
#### 5.10 BLEU
|
632
735
|
|
633
736
|
- bleu_n : bleu-n(1,2,3,4) 스코어 반환
|
634
737
|
|
@@ -671,7 +774,27 @@ False
|
|
671
774
|
0.4001601601922499
|
672
775
|
```
|
673
776
|
|
674
|
-
#### 5.10
|
777
|
+
#### 5.10.1 BLEU for tensor
|
778
|
+
- 각 score의 값이 tensor 로 반환한다.
|
779
|
+
```python
|
780
|
+
>>> from nltk.translate.bleu_score import *
|
781
|
+
>>> from nltko.tokenize import Ko_tokenize
|
782
|
+
>>> can=torch.tensor([[1,2,3,4,5],[3,4,5,6,4]])
|
783
|
+
>>> ref=torch.tensor([[1,2,3,4,5],[3,5,6,7,10]])
|
784
|
+
>>> bleu_tensor(ref,can,1)
|
785
|
+
tensor(0.8000)
|
786
|
+
>>> bleu_tensor(ref,can,2)
|
787
|
+
tensor(0.6250)
|
788
|
+
>>> bleu_tensor(ref,can,3)
|
789
|
+
tensor(0.5000)
|
790
|
+
>>> bleu_tensor(ref,can,4)
|
791
|
+
tensor(0.5000)
|
792
|
+
>>> bleu_tensor(ref,can)
|
793
|
+
tensor(0.5946)
|
794
|
+
|
795
|
+
```
|
796
|
+
|
797
|
+
#### 5.11 ROUGE
|
675
798
|
|
676
799
|
※ rouge는 recall based score이며 l, s는 f-measure를 사용하며 n은 recall score이다.
|
677
800
|
|
@@ -725,7 +848,7 @@ False
|
|
725
848
|
0.8275862068965517
|
726
849
|
```
|
727
850
|
|
728
|
-
#### 5.
|
851
|
+
#### 5.12 CIDER
|
729
852
|
|
730
853
|
TF-IDF를 n-gram에 대한 가중치로 계산하고 참조 캡션과 생성 캡션에 대한 유사도를 측정
|
731
854
|
|
@@ -761,7 +884,7 @@ TF-IDF를 n-gram에 대한 가중치로 계산하고 참조 캡션과 생성 캡
|
|
761
884
|
0.1748041
|
762
885
|
```
|
763
886
|
|
764
|
-
#### 5.
|
887
|
+
#### 5.13 METEOR
|
765
888
|
|
766
889
|
- METEOR (Meter For Evaluation of Translation with Explicit Ordering )
|
767
890
|
|
@@ -787,7 +910,7 @@ TF-IDF를 n-gram에 대한 가중치로 계산하고 참조 캡션과 생성 캡
|
|
787
910
|
0.6303797468354431
|
788
911
|
```
|
789
912
|
|
790
|
-
#### 5.
|
913
|
+
#### 5.14 EntMent
|
791
914
|
|
792
915
|
- EntMent (Entity Mention Recall)
|
793
916
|
|
File without changes
|