Upload folder using huggingface_hub
Browse filesThis view is limited to 50 files because it contains too many changes. See raw diff
- .gitattributes +11 -0
- annotations/annotation_1/2024.findings-emnlp.548.pdf +3 -0
- annotations/annotation_1/PEDANTS-LLM-Evaluation/.coverage +0 -0
- annotations/annotation_1/PEDANTS-LLM-Evaluation/LICENSE +21 -0
- annotations/annotation_1/PEDANTS-LLM-Evaluation/MANIFEST.in +2 -0
- annotations/annotation_1/PEDANTS-LLM-Evaluation/README.md +13 -0
- annotations/annotation_1/PEDANTS-LLM-Evaluation/__init__.py +62 -0
- annotations/annotation_1/PEDANTS-LLM-Evaluation/qa_metrics/.coverage +0 -0
- annotations/annotation_1/PEDANTS-LLM-Evaluation/qa_metrics/__init__.py +43 -0
- annotations/annotation_1/PEDANTS-LLM-Evaluation/qa_metrics/classifier/lr_classifier.pkl +3 -0
- annotations/annotation_1/PEDANTS-LLM-Evaluation/qa_metrics/classifier/main_classifier.pkl +3 -0
- annotations/annotation_1/PEDANTS-LLM-Evaluation/qa_metrics/classifier/rule_classifier.pkl +3 -0
- annotations/annotation_1/PEDANTS-LLM-Evaluation/qa_metrics/classifier/tf-idf_vectorizer.pkl +3 -0
- annotations/annotation_1/PEDANTS-LLM-Evaluation/qa_metrics/classifier/tfidf_vectorizer.pkl +3 -0
- annotations/annotation_1/PEDANTS-LLM-Evaluation/qa_metrics/classifier/type_classifier.pkl +3 -0
- annotations/annotation_1/PEDANTS-LLM-Evaluation/qa_metrics/em.py +26 -0
- annotations/annotation_1/PEDANTS-LLM-Evaluation/qa_metrics/f1.py +74 -0
- annotations/annotation_1/PEDANTS-LLM-Evaluation/qa_metrics/models/final_classifier.pkl +3 -0
- annotations/annotation_1/PEDANTS-LLM-Evaluation/qa_metrics/models/label_enc_qtype.pkl +3 -0
- annotations/annotation_1/PEDANTS-LLM-Evaluation/qa_metrics/models/label_enc_rule.pkl +3 -0
- annotations/annotation_1/PEDANTS-LLM-Evaluation/qa_metrics/models/lr_classifier.pkl +3 -0
- annotations/annotation_1/PEDANTS-LLM-Evaluation/qa_metrics/models/main_classifier.pkl +3 -0
- annotations/annotation_1/PEDANTS-LLM-Evaluation/qa_metrics/models/question_type_classifier.pkl +3 -0
- annotations/annotation_1/PEDANTS-LLM-Evaluation/qa_metrics/models/rule_classifier.pkl +3 -0
- annotations/annotation_1/PEDANTS-LLM-Evaluation/qa_metrics/models/tf-idf_vectorizer.pkl +3 -0
- annotations/annotation_1/PEDANTS-LLM-Evaluation/qa_metrics/models/tfidf_vectorizer.pkl +3 -0
- annotations/annotation_1/PEDANTS-LLM-Evaluation/qa_metrics/models/type_classifier.pkl +3 -0
- annotations/annotation_1/PEDANTS-LLM-Evaluation/qa_metrics/pedant.py +0 -0
- annotations/annotation_1/PEDANTS-LLM-Evaluation/qa_metrics/prompt_llm.py +168 -0
- annotations/annotation_1/PEDANTS-LLM-Evaluation/qa_metrics/prompt_open_llm.py +39 -0
- annotations/annotation_1/PEDANTS-LLM-Evaluation/qa_metrics/transformerMatcher.py +340 -0
- annotations/annotation_1/PEDANTS-LLM-Evaluation/qa_metrics/utils/__init__.py +0 -0
- annotations/annotation_1/PEDANTS-LLM-Evaluation/qa_metrics/utils/tools.py +225 -0
- annotations/annotation_1/_envcheck_stderr.txt +0 -0
- annotations/annotation_1/_envcheck_stdout.txt +20 -0
- annotations/annotation_1/_runner_stderr.txt +2 -0
- annotations/annotation_1/_runner_stdout.txt +14 -0
- annotations/annotation_1/canonical.py +654 -0
- annotations/annotation_1/function_info.json +641 -0
- annotations/annotation_1/htmlcov/.gitignore +2 -0
- annotations/annotation_1/htmlcov/canonical_py.html +0 -0
- annotations/annotation_1/htmlcov/class_index.html +123 -0
- annotations/annotation_1/htmlcov/coverage_html_cb_6fb7b396.js +733 -0
- annotations/annotation_1/htmlcov/favicon_32_cb_58284776.png +3 -0
- annotations/annotation_1/htmlcov/function_index.html +211 -0
- annotations/annotation_1/htmlcov/index.html +111 -0
- annotations/annotation_1/htmlcov/keybd_closed_cb_ce680311.png +3 -0
- annotations/annotation_1/htmlcov/status.json +1 -0
- annotations/annotation_1/htmlcov/style_cb_6b508a39.css +377 -0
- annotations/annotation_1/htmlcov/z_24a0e69e886c375e___init___py.html +97 -0
.gitattributes
CHANGED
|
@@ -58,3 +58,14 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
| 58 |
# Video files - compressed
|
| 59 |
*.mp4 filter=lfs diff=lfs merge=lfs -text
|
| 60 |
*.webm filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 58 |
# Video files - compressed
|
| 59 |
*.mp4 filter=lfs diff=lfs merge=lfs -text
|
| 60 |
*.webm filter=lfs diff=lfs merge=lfs -text
|
| 61 |
+
annotations/annotation_1/2024.findings-emnlp.548.pdf filter=lfs diff=lfs merge=lfs -text
|
| 62 |
+
annotations/annotation_10/simpo.pdf filter=lfs diff=lfs merge=lfs -text
|
| 63 |
+
annotations/annotation_100/2309.17272v3.pdf filter=lfs diff=lfs merge=lfs -text
|
| 64 |
+
annotations/annotation_101/paper.pdf filter=lfs diff=lfs merge=lfs -text
|
| 65 |
+
annotations/annotation_102/paper.pdf filter=lfs diff=lfs merge=lfs -text
|
| 66 |
+
annotations/annotation_103/paper.pdf filter=lfs diff=lfs merge=lfs -text
|
| 67 |
+
annotations/annotation_104/LLM-Pruner/lm-evaluation-harness/lm_eval/datasets/bigbench_resources/hyperbaton.json filter=lfs diff=lfs merge=lfs -text
|
| 68 |
+
annotations/annotation_104/paper.pdf filter=lfs diff=lfs merge=lfs -text
|
| 69 |
+
annotations/annotation_105/MIXTURE[[:space:]]OF[[:space:]]EXPERTS[[:space:]]MADE[[:space:]]PERSONALIZED[[:space:]]FEDERATED[[:space:]]PROMPT[[:space:]]LEARNING[[:space:]]FOR[[:space:]]VISIONLANGUAGE[[:space:]]MODELS.pdf filter=lfs diff=lfs merge=lfs -text
|
| 70 |
+
annotations/annotation_106/GradSafe[[:space:]]Detecting[[:space:]]Jailbreak[[:space:]]Prompts[[:space:]]for[[:space:]]LLMs[[:space:]]via[[:space:]]Safety-Critical[[:space:]]Gradient[[:space:]]Analysis.pdf filter=lfs diff=lfs merge=lfs -text
|
| 71 |
+
annotations/annotation_107/GenArtist[[:space:]]Multimodal[[:space:]]LLM[[:space:]]as[[:space:]]an[[:space:]]Agent[[:space:]]for[[:space:]]Unified[[:space:]]Image[[:space:]]Generation[[:space:]]and[[:space:]]Editing.pdf filter=lfs diff=lfs merge=lfs -text
|
annotations/annotation_1/2024.findings-emnlp.548.pdf
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:c6bd915dbc737256782d9889be8ccd2b54b4f1184052702a49f4cf87522681a2
|
| 3 |
+
size 601152
|
annotations/annotation_1/PEDANTS-LLM-Evaluation/.coverage
ADDED
|
Binary file (53.2 kB). View file
|
|
|
annotations/annotation_1/PEDANTS-LLM-Evaluation/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
MIT License
|
| 2 |
+
|
| 3 |
+
Copyright (c) [2024] [Zongxia Li]
|
| 4 |
+
|
| 5 |
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
| 6 |
+
of this software and associated documentation files (the "Software"), to deal
|
| 7 |
+
in the Software without restriction, including without limitation the rights
|
| 8 |
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
| 9 |
+
copies of the Software, and to permit persons to whom the Software is
|
| 10 |
+
furnished to do so, subject to the following conditions:
|
| 11 |
+
|
| 12 |
+
The above copyright notice and this permission notice shall be included in all
|
| 13 |
+
copies or substantial portions of the Software.
|
| 14 |
+
|
| 15 |
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
| 16 |
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
| 17 |
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
| 18 |
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
| 19 |
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
| 20 |
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
| 21 |
+
SOFTWARE.
|
annotations/annotation_1/PEDANTS-LLM-Evaluation/MANIFEST.in
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
|
|
|
| 1 |
+
graft qa_metrics/qa_metricsmetrics/classifier
|
| 2 |
+
include download_lr.py
|
annotations/annotation_1/PEDANTS-LLM-Evaluation/README.md
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# QA-Evaluation-Metrics 📊
|
| 2 |
+
|
| 3 |
+
[](https://pypi.org/project/qa-metrics/)
|
| 4 |
+
[](https://colab.research.google.com/drive/1Ke23KIeHFdPWad0BModmcWKZ6jSbF5nI?usp=sharing)
|
| 5 |
+
|
| 6 |
+
> Check out the main [Repo](https://github.com/zli12321/qa_metrics)
|
| 7 |
+
|
| 8 |
+
> `pip install qa-metrics` is all you need!
|
| 9 |
+
|
| 10 |
+
> A fast and lightweight Python package for evaluating question-answering models and prompting of black-box and open-source large language models.
|
| 11 |
+
|
| 12 |
+
> 🤗 Huggingface [Model](https://huggingface.co/zli12321/roberta-large-qa-evaluator) and [Dataset](https://huggingface.co/datasets/zli12321/pedants_qa_evaluation_bench)
|
| 13 |
+
|
annotations/annotation_1/PEDANTS-LLM-Evaluation/__init__.py
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# qa_evaluators/__init__.py
|
| 2 |
+
|
| 3 |
+
import requests
|
| 4 |
+
import os
|
| 5 |
+
from .qa_metrics.em import em_match
|
| 6 |
+
from .qa_metrics.f1 import f1_match
|
| 7 |
+
from .qa_metrics.pedant import CFMatcher
|
| 8 |
+
from .qa_metrics.transformerMatcher import TransformerMatcher # assuming bem.py contains a function to download BERT
|
| 9 |
+
|
| 10 |
+
def download(model_name):
|
| 11 |
+
if model_name.lower() == 'bert':
|
| 12 |
+
# Download BERT model
|
| 13 |
+
url = 'https://drive.google.com/file/d/1ena_zUd42ju_5R3wKBidKdKuJYmF-IE_/view?usp=sharing'
|
| 14 |
+
model_dir = os.path.join(os.path.dirname(__file__), 'transformer_models')
|
| 15 |
+
model_path = os.path.join(model_dir, 'ae_tuned_bert.bin')
|
| 16 |
+
|
| 17 |
+
if not os.path.exists(model_dir):
|
| 18 |
+
os.makedirs(model_dir)
|
| 19 |
+
|
| 20 |
+
if not os.path.isfile(model_path):
|
| 21 |
+
print("Downloading BERT Matching model...")
|
| 22 |
+
response = requests.get(url, stream=True)
|
| 23 |
+
|
| 24 |
+
if response.status_code == 200:
|
| 25 |
+
with open(model_path, 'wb') as f:
|
| 26 |
+
f.write(response.content)
|
| 27 |
+
print("Download complete.")
|
| 28 |
+
else:
|
| 29 |
+
print("Failed to download the model. Status code:", response.status_code)
|
| 30 |
+
# else:
|
| 31 |
+
# print("BERT model already exists.")
|
| 32 |
+
|
| 33 |
+
return model_path
|
| 34 |
+
if model_name.lower() == 'cfm':
|
| 35 |
+
clf_url = 'https://github.com/zli12321/qa_metrics/raw/master/qa_metrics/classifier/lr_classifier'
|
| 36 |
+
vectorizer_url = 'https://github.com/zli12321/qa_metrics/raw/master/qa_metrics/classifier/tf-idf_vectorizer'
|
| 37 |
+
model_dir = os.path.join(os.path.dirname(__file__), 'classifier')
|
| 38 |
+
model_path = os.path.join(model_dir, 'lr_classifier.pkl')
|
| 39 |
+
vectorizer_path = os.path.join(model_dir, 'tf-idf_vectorizer.pkl')
|
| 40 |
+
|
| 41 |
+
if not os.path.exists(model_dir):
|
| 42 |
+
os.makedirs(model_dir)
|
| 43 |
+
|
| 44 |
+
if not os.path.isfile(model_path):
|
| 45 |
+
print("Downloading CF Matching model...")
|
| 46 |
+
response = requests.get(clf_url, stream=True)
|
| 47 |
+
if response.status_code == 200:
|
| 48 |
+
with open(model_path, 'wb') as f:
|
| 49 |
+
f.write(response.content)
|
| 50 |
+
print("Download clf model complete.")
|
| 51 |
+
else:
|
| 52 |
+
print("Failed to download the model. Status code:", response.status_code)
|
| 53 |
+
|
| 54 |
+
if not os.path.isfile(vectorizer_path):
|
| 55 |
+
print("Downloading CF Matching model tokenizer...")
|
| 56 |
+
response = requests.get(vectorizer_url, stream=True)
|
| 57 |
+
if response.status_code == 200:
|
| 58 |
+
with open(vectorizer_path, 'wb') as f:
|
| 59 |
+
f.write(response.content)
|
| 60 |
+
print("Download clf model complete.")
|
| 61 |
+
else:
|
| 62 |
+
print("Failed to download the model. Status code:", response.status_code)
|
annotations/annotation_1/PEDANTS-LLM-Evaluation/qa_metrics/.coverage
ADDED
|
Binary file (53.2 kB). View file
|
|
|
annotations/annotation_1/PEDANTS-LLM-Evaluation/qa_metrics/__init__.py
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import requests
|
| 2 |
+
import os
|
| 3 |
+
from .utils.tools import download_link
|
| 4 |
+
|
| 5 |
+
|
| 6 |
+
def download(model_name):
|
| 7 |
+
# if model_name.lower() == 'bert':
|
| 8 |
+
# # Download BERT model
|
| 9 |
+
# model_url = 'https://drive.google.com/file/d/1ena_zUd42ju_5R3wKBidKdKuJYmF-IE_/view?usp=sharing'
|
| 10 |
+
# tokenizer_url = 'https://drive.google.com/file/d/1gpmCgHKX-zLpShDr-kDrotS0Fk6F8Ht1/view?usp=sharing'
|
| 11 |
+
# tokenizer_config_url = 'https://drive.google.com/file/d/1kxMwo9dD-gzgDuZMZAP64GmD_KLTofUh/view?usp=sharing'
|
| 12 |
+
# config_url = 'https://drive.google.com/file/d/14d3X6BbrDrKYlnwOYBDlW7_sjK5u2Msw/view?usp=sharing'
|
| 13 |
+
# vocab_url = 'https://drive.google.com/file/d/1N_kiKtJFvsIv8cwb-6ZOwXpqOi6ZLEEl/view?usp=sharing'
|
| 14 |
+
|
| 15 |
+
# model_dir = os.path.join(os.path.dirname(__file__), 'transformer_models/bert')
|
| 16 |
+
# model_path = os.path.join(model_dir, 'ae_tuned_bert.bin')
|
| 17 |
+
# tokenizer_path = os.path.join(model_dir, 'tokenizer.json')
|
| 18 |
+
# tokenizer_config_path = os.path.join(model_dir, 'tokenizer_config.json')
|
| 19 |
+
# config_path = os.path.join(model_dir, 'config.json')
|
| 20 |
+
# vocab_path = os.path.join(model_dir, 'vocab.txt')
|
| 21 |
+
|
| 22 |
+
# if not os.path.exists(model_dir):
|
| 23 |
+
# os.makedirs(model_dir)
|
| 24 |
+
|
| 25 |
+
# download_link(model_path, model_url, 'Fine-tuned BERT model')
|
| 26 |
+
# download_link(tokenizer_path, tokenizer_url, 'BERT tokenizer')
|
| 27 |
+
# download_link(tokenizer_config_path, tokenizer_config_url, 'BERT tokenizer config')
|
| 28 |
+
# download_link(config_path, config_url, 'BERT config')
|
| 29 |
+
# download_link(vocab_path, vocab_url, 'BERT vocab')
|
| 30 |
+
|
| 31 |
+
|
| 32 |
+
if model_name.lower() == 'cfm':
|
| 33 |
+
clf_url = 'https://github.com/zli12321/qa_metrics/raw/master/qa_metrics/classifier/lr_classifier'
|
| 34 |
+
vectorizer_url = 'https://github.com/zli12321/qa_metrics/raw/master/qa_metrics/classifier/tf-idf_vectorizer'
|
| 35 |
+
model_dir = os.path.join(os.path.dirname(__file__), 'classifier')
|
| 36 |
+
model_path = os.path.join(model_dir, 'lr_classifier.pkl')
|
| 37 |
+
vectorizer_path = os.path.join(model_dir, 'tf-idf_vectorizer.pkl')
|
| 38 |
+
|
| 39 |
+
if not os.path.exists(model_dir):
|
| 40 |
+
os.makedirs(model_dir)
|
| 41 |
+
|
| 42 |
+
download_link(model_path, clf_url, 'CF Matching model')
|
| 43 |
+
download_link(vectorizer_path, vectorizer_url, 'CF Matching model tokenizer')
|
annotations/annotation_1/PEDANTS-LLM-Evaluation/qa_metrics/classifier/lr_classifier.pkl
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:4c132d47ea40c352831c158671d7b11a445769b9402cf13f4698ea10b6f59ab1
|
| 3 |
+
size 752736
|
annotations/annotation_1/PEDANTS-LLM-Evaluation/qa_metrics/classifier/main_classifier.pkl
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:088d3a3f71b32b8a76faa5afbc329eb39bea13bcb6a4cb7a42640b9662878360
|
| 3 |
+
size 307
|
annotations/annotation_1/PEDANTS-LLM-Evaluation/qa_metrics/classifier/rule_classifier.pkl
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:ff5761ea5a7f84bc9911bf9f4ca5248b18a4125298c79f8122b834c04d323b63
|
| 3 |
+
size 5260696
|
annotations/annotation_1/PEDANTS-LLM-Evaluation/qa_metrics/classifier/tf-idf_vectorizer.pkl
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:4d869e2f0b121789920e9da416549c3b96da9548cb603d73c5d0c314c9a10920
|
| 3 |
+
size 2960256
|
annotations/annotation_1/PEDANTS-LLM-Evaluation/qa_metrics/classifier/tfidf_vectorizer.pkl
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:a5f8a0abda292facc189fa378bb5be59f18c3e87fb094e28b00d6ffdec4ea824
|
| 3 |
+
size 455
|
annotations/annotation_1/PEDANTS-LLM-Evaluation/qa_metrics/classifier/type_classifier.pkl
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:e9a823f3f4417d7f68a6e47f78d7ad9fff9266d21f65350e4233fb429d15ee1a
|
| 3 |
+
size 15780968
|
annotations/annotation_1/PEDANTS-LLM-Evaluation/qa_metrics/em.py
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import string
|
| 2 |
+
from .utils.tools import normalize_answer, remove_punctuation
|
| 3 |
+
|
| 4 |
+
def em_match(reference, candidate):
|
| 5 |
+
if isinstance(reference, list) and isinstance(candidate, list):
|
| 6 |
+
reference = [remove_punctuation(normalize_answer(str(ele))) for ele in reference]
|
| 7 |
+
candidate = [remove_punctuation(normalize_answer(str(ele))) for ele in candidate]
|
| 8 |
+
elif isinstance(reference, list):
|
| 9 |
+
reference = [remove_punctuation(normalize_answer(str(ele))) for ele in reference]
|
| 10 |
+
candidate = [remove_punctuation(normalize_answer(str(candidate)))]
|
| 11 |
+
elif isinstance(candidate, list):
|
| 12 |
+
candidate = [remove_punctuation(normalize_answer(str(ele))) for ele in candidate]
|
| 13 |
+
reference = [remove_punctuation(normalize_answer(str(reference)))]
|
| 14 |
+
else:
|
| 15 |
+
'''
|
| 16 |
+
Normalize the strings
|
| 17 |
+
'''
|
| 18 |
+
reference = [remove_punctuation(normalize_answer(str(reference)))]
|
| 19 |
+
candidate = [remove_punctuation(normalize_answer(str(candidate)))]
|
| 20 |
+
|
| 21 |
+
for ref in reference:
|
| 22 |
+
for can in candidate:
|
| 23 |
+
if ref in can:
|
| 24 |
+
return True
|
| 25 |
+
|
| 26 |
+
return False
|
annotations/annotation_1/PEDANTS-LLM-Evaluation/qa_metrics/f1.py
ADDED
|
@@ -0,0 +1,74 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from .utils.tools import normalize_answer, remove_punctuation, lemmatize_text
|
| 2 |
+
|
| 3 |
+
'''
|
| 4 |
+
Return the F1 score, precision, and recall of the candidate answer given the reference answer
|
| 5 |
+
'''
|
| 6 |
+
def f1_score_with_precision_recall(reference, candidate):
|
| 7 |
+
# Split the strings into sets of words
|
| 8 |
+
reference = lemmatize_text(normalize_answer(str(reference)))
|
| 9 |
+
candidate = lemmatize_text(normalize_answer(str(candidate)))
|
| 10 |
+
words_reference = set(reference.split())
|
| 11 |
+
words_candidate = set(candidate.split())
|
| 12 |
+
|
| 13 |
+
# Calculate true positives, false positives, and false negatives
|
| 14 |
+
tp = len(words_reference.intersection(words_candidate))
|
| 15 |
+
fp = len(words_reference - words_candidate)
|
| 16 |
+
fn = len(words_candidate - words_reference)
|
| 17 |
+
|
| 18 |
+
# Calculate precision and recall
|
| 19 |
+
precision = tp / (tp + fp) if (tp + fp) > 0 else 0
|
| 20 |
+
recall = tp / (tp + fn) if (tp + fn) > 0 else 0
|
| 21 |
+
|
| 22 |
+
# Calculate F1 score
|
| 23 |
+
f1_score = 2 * (precision * recall) / (precision + recall) if (precision + recall) > 0 else 0
|
| 24 |
+
|
| 25 |
+
return {'f1': f1_score, 'precision': precision, 'recall': recall}
|
| 26 |
+
|
| 27 |
+
|
| 28 |
+
'''
|
| 29 |
+
Return the F1 score of the candidate answer given the reference answer
|
| 30 |
+
'''
|
| 31 |
+
def f1_score(reference, candidate):
|
| 32 |
+
f1_stats = f1_score_with_precision_recall(reference, candidate)
|
| 33 |
+
return f1_stats['f1']
|
| 34 |
+
|
| 35 |
+
|
| 36 |
+
|
| 37 |
+
'''
|
| 38 |
+
Given a reference answer and a candidate answer, return True if the F1 score is greater than the threshold
|
| 39 |
+
'''
|
| 40 |
+
def f1_match(reference, candidate, threshold=0.5):
|
| 41 |
+
if isinstance(reference, list) and isinstance(candidate, list):
|
| 42 |
+
references = [lemmatize_text(normalize_answer(str(ele))) for ele in reference]
|
| 43 |
+
candidates = [lemmatize_text(normalize_answer(str(ele))) for ele in candidate]
|
| 44 |
+
|
| 45 |
+
f1_scores = []
|
| 46 |
+
for reference in references:
|
| 47 |
+
for candidate in candidates:
|
| 48 |
+
f1_scores.append(f1_score(reference, candidate))
|
| 49 |
+
|
| 50 |
+
return max(f1_scores) > threshold
|
| 51 |
+
elif isinstance(reference, list):
|
| 52 |
+
references = [lemmatize_text(normalize_answer(str(ele))) for ele in reference]
|
| 53 |
+
candidate = lemmatize_text(normalize_answer(str(candidate)))
|
| 54 |
+
|
| 55 |
+
f1_scores = []
|
| 56 |
+
for reference in references:
|
| 57 |
+
f1_scores.append(f1_score(reference, candidate))
|
| 58 |
+
|
| 59 |
+
return max(f1_scores) > threshold
|
| 60 |
+
elif isinstance(candidate, list):
|
| 61 |
+
candidates = [lemmatize_text(normalize_answer(str(ele))) for ele in candidate]
|
| 62 |
+
reference = lemmatize_text(normalize_answer(str(reference)))
|
| 63 |
+
|
| 64 |
+
f1_scores = []
|
| 65 |
+
for candidate in candidates:
|
| 66 |
+
f1_scores.append(f1_score(reference, candidate))
|
| 67 |
+
|
| 68 |
+
return max(f1_scores) > threshold
|
| 69 |
+
else:
|
| 70 |
+
reference = lemmatize_text(normalize_answer(str(reference)))
|
| 71 |
+
candidate = lemmatize_text(normalize_answer(str(candidate)))
|
| 72 |
+
|
| 73 |
+
return f1_score(reference, candidate) > threshold
|
| 74 |
+
|
annotations/annotation_1/PEDANTS-LLM-Evaluation/qa_metrics/models/final_classifier.pkl
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:c1f4fee96190ea87bf740fcd15b2b2cc000b107f0efd0580290f8c8be4ea9cde
|
| 3 |
+
size 760
|
annotations/annotation_1/PEDANTS-LLM-Evaluation/qa_metrics/models/label_enc_qtype.pkl
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:439c4e315a6a6e00c0f7eb07f03cf8b41762f5cec34e23e06d9c426a43f5b39e
|
| 3 |
+
size 467
|
annotations/annotation_1/PEDANTS-LLM-Evaluation/qa_metrics/models/label_enc_rule.pkl
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:1c6e62b427892abf8379e6ece5b02518c6b153a3a43c049aaef17d8f9407edf1
|
| 3 |
+
size 383
|
annotations/annotation_1/PEDANTS-LLM-Evaluation/qa_metrics/models/lr_classifier.pkl
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:4c132d47ea40c352831c158671d7b11a445769b9402cf13f4698ea10b6f59ab1
|
| 3 |
+
size 752736
|
annotations/annotation_1/PEDANTS-LLM-Evaluation/qa_metrics/models/main_classifier.pkl
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:088d3a3f71b32b8a76faa5afbc329eb39bea13bcb6a4cb7a42640b9662878360
|
| 3 |
+
size 307
|
annotations/annotation_1/PEDANTS-LLM-Evaluation/qa_metrics/models/question_type_classifier.pkl
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:c1f4fee96190ea87bf740fcd15b2b2cc000b107f0efd0580290f8c8be4ea9cde
|
| 3 |
+
size 760
|
annotations/annotation_1/PEDANTS-LLM-Evaluation/qa_metrics/models/rule_classifier.pkl
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:c1f4fee96190ea87bf740fcd15b2b2cc000b107f0efd0580290f8c8be4ea9cde
|
| 3 |
+
size 760
|
annotations/annotation_1/PEDANTS-LLM-Evaluation/qa_metrics/models/tf-idf_vectorizer.pkl
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:4d869e2f0b121789920e9da416549c3b96da9548cb603d73c5d0c314c9a10920
|
| 3 |
+
size 2960256
|
annotations/annotation_1/PEDANTS-LLM-Evaluation/qa_metrics/models/tfidf_vectorizer.pkl
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:057cbbfb4f5936e7b5e66856bf25d1fb46a0413143c0e7528ba137d2c2d024d1
|
| 3 |
+
size 2
|
annotations/annotation_1/PEDANTS-LLM-Evaluation/qa_metrics/models/type_classifier.pkl
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:e9a823f3f4417d7f68a6e47f78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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import os, requests
|
| 2 |
+
from typing import Union, List
|
| 3 |
+
import openai
|
| 4 |
+
from openai import OpenAI
|
| 5 |
+
|
| 6 |
+
|
| 7 |
+
'''
|
| 8 |
+
This file support calling OPENAI, Anthropic, and Cohere API nd get model prompt for text generation and completion
|
| 9 |
+
'''
|
| 10 |
+
|
| 11 |
+
class CloseLLM:
|
| 12 |
+
def __init__(self):
|
| 13 |
+
self.openai = None
|
| 14 |
+
self.anthropic = None
|
| 15 |
+
|
| 16 |
+
def set_openai_api_key(self, api_key):
|
| 17 |
+
os.environ["OPENAI_API_KEY"] = api_key
|
| 18 |
+
self.openai = OpenAI(api_key=api_key)
|
| 19 |
+
|
| 20 |
+
def set_anthropic_api_key(self, api_key):
|
| 21 |
+
os.environ["ANTHROPIC_API_KEY"] = api_key
|
| 22 |
+
api_key = os.environ["ANTHROPIC_API_KEY"]
|
| 23 |
+
|
| 24 |
+
'''
|
| 25 |
+
Calls openai gpt functions. Given a message, it returns the response from the model. All parameters are at OPENAI's default value unless you specify it.
|
| 26 |
+
'''
|
| 27 |
+
def prompt_gpt(self, prompt: str,
|
| 28 |
+
model_engine: str='gpt-3.5-turbo',
|
| 29 |
+
frequency_penalty: float = 0,
|
| 30 |
+
logit_bias: dict = None,
|
| 31 |
+
max_tokens: int = None, # Assuming `inf` implies no limit, thus defaulting to `None`
|
| 32 |
+
n: int = 1,
|
| 33 |
+
presence_penalty: float = 0,
|
| 34 |
+
stop: Union[str, List[str]] = None, # Type hint for either a string or a list
|
| 35 |
+
stream: bool = False,
|
| 36 |
+
temperature: float = 0.7,
|
| 37 |
+
top_p: float = 1,
|
| 38 |
+
user: str = None):
|
| 39 |
+
'''
|
| 40 |
+
Function to interact with an AI model using given parameters.
|
| 41 |
+
|
| 42 |
+
:param model: Model string, specifying which AI model to use.
|
| 43 |
+
:param messages: Array of messages to be processed by the model.
|
| 44 |
+
:param frequency_penalty: Adjusts frequency of repeated content in generations.
|
| 45 |
+
:param logit_bias: Map of logit modifiers to adjust model's output.
|
| 46 |
+
:param max_tokens: Maximum number of tokens to generate.
|
| 47 |
+
:param n: Number of completions to generate.
|
| 48 |
+
:param presence_penalty: Adjusts likelihood of new content in generations.
|
| 49 |
+
:param stop: Sequence(s) at which text generation will be stopped.
|
| 50 |
+
:param stream: Whether to stream the output.
|
| 51 |
+
:param temperature: Controls randomness of generations.
|
| 52 |
+
:param top_p: Controls diversity of generations via nucleus sampling.
|
| 53 |
+
:param user: Optional user identifier.
|
| 54 |
+
:return: The output from the model.
|
| 55 |
+
# Get the OpenAI API key from the environment variable
|
| 56 |
+
openai.api_key = os.environ["OPENAI_API_KEY"]
|
| 57 |
+
'''
|
| 58 |
+
|
| 59 |
+
try:
|
| 60 |
+
# Send the request to the OpenAI API
|
| 61 |
+
# response = client.completions.create(engine=model_engine,
|
| 62 |
+
# prompt=prompt,
|
| 63 |
+
# max_tokens=max_tokens,
|
| 64 |
+
# temperature=temperature,
|
| 65 |
+
# n=1, # Number of responses to generate
|
| 66 |
+
# stop=None)
|
| 67 |
+
|
| 68 |
+
# # Extract the generated response from the API response
|
| 69 |
+
# generated_text = response.choices[0].text.strip()
|
| 70 |
+
|
| 71 |
+
# return generated_text
|
| 72 |
+
|
| 73 |
+
completion = self.openai.chat.completions.create(
|
| 74 |
+
model=model_engine,
|
| 75 |
+
messages=[{"role": "user", "content": prompt}],
|
| 76 |
+
max_tokens=max_tokens,
|
| 77 |
+
temperature=temperature,
|
| 78 |
+
n=1, # Number of responses to generate
|
| 79 |
+
stop=None
|
| 80 |
+
)
|
| 81 |
+
|
| 82 |
+
message_content = completion.choices[0].message.content
|
| 83 |
+
|
| 84 |
+
return message_content
|
| 85 |
+
except Exception as e:
|
| 86 |
+
# message = [{ "role": "user", "content": prompt}]
|
| 87 |
+
# answer = client.chat.completions.create(model = model_engine,
|
| 88 |
+
# messages=message,
|
| 89 |
+
# frequency_penalty=frequency_penalty,
|
| 90 |
+
# logit_bias=logit_bias,
|
| 91 |
+
# max_tokens=max_tokens,
|
| 92 |
+
# n=n,
|
| 93 |
+
# presence_penalty=presence_penalty,
|
| 94 |
+
# stop=stop,
|
| 95 |
+
# temperature=temperature,
|
| 96 |
+
# top_p=top_p,
|
| 97 |
+
# stream=stream,
|
| 98 |
+
# user=user)
|
| 99 |
+
|
| 100 |
+
try:
|
| 101 |
+
# return answer.choices[0].message.content
|
| 102 |
+
completion = self.openai.completions.create(
|
| 103 |
+
model=model_engine,
|
| 104 |
+
prompt=prompt,
|
| 105 |
+
frequency_penalty=frequency_penalty,
|
| 106 |
+
max_tokens=max_tokens,
|
| 107 |
+
n=n,
|
| 108 |
+
presence_penalty=presence_penalty,
|
| 109 |
+
stop=stop,
|
| 110 |
+
temperature=temperature,
|
| 111 |
+
top_p=top_p,
|
| 112 |
+
stream=stream
|
| 113 |
+
)
|
| 114 |
+
|
| 115 |
+
return completion.choices[0].text
|
| 116 |
+
except openai.APIError as e:
|
| 117 |
+
print(f"OpenAI API returned an API Error: {e}")
|
| 118 |
+
return None
|
| 119 |
+
|
| 120 |
+
except KeyError:
|
| 121 |
+
print("OpenAI API key not found in the environment variables.")
|
| 122 |
+
return None
|
| 123 |
+
|
| 124 |
+
|
| 125 |
+
def prompt_claude(self, prompt, model_engine="claude-v1", anthropic_version="2023-06-01", max_tokens_to_sample=100, temperature=0.7):
|
| 126 |
+
# Set up the API endpoint URL
|
| 127 |
+
url = "https://api.anthropic.com/v1/complete"
|
| 128 |
+
|
| 129 |
+
# Set up the request headers
|
| 130 |
+
headers = {
|
| 131 |
+
"Content-Type": "application/json",
|
| 132 |
+
"X-API-Key": os.environ["ANTHROPIC_API_KEY"],
|
| 133 |
+
"anthropic-version": anthropic_version
|
| 134 |
+
}
|
| 135 |
+
|
| 136 |
+
|
| 137 |
+
# print(conversation_history)
|
| 138 |
+
conversation_history = "Human: " + prompt + "\nAssistant:"
|
| 139 |
+
|
| 140 |
+
# Set up the request payload
|
| 141 |
+
payload = {
|
| 142 |
+
"prompt": conversation_history,
|
| 143 |
+
"model": model_engine,
|
| 144 |
+
"max_tokens_to_sample": max_tokens_to_sample,
|
| 145 |
+
"temperature": temperature
|
| 146 |
+
}
|
| 147 |
+
|
| 148 |
+
try:
|
| 149 |
+
# Send the request to the Anthropic API
|
| 150 |
+
response = requests.post(url, json=payload, headers=headers)
|
| 151 |
+
|
| 152 |
+
# Check if the request was successful
|
| 153 |
+
if response.status_code == 200:
|
| 154 |
+
response_data = response.json()
|
| 155 |
+
generated_text = response_data["completion"]
|
| 156 |
+
return generated_text.strip()
|
| 157 |
+
else:
|
| 158 |
+
print(f"Anthropic API request failed with status code: {response.status_code}")
|
| 159 |
+
print(f"Error message: {response.text}")
|
| 160 |
+
return None
|
| 161 |
+
|
| 162 |
+
except requests.exceptions.RequestException as e:
|
| 163 |
+
print(f"An error occurred while calling the Anthropic API: {e}")
|
| 164 |
+
return None
|
| 165 |
+
|
| 166 |
+
except KeyError:
|
| 167 |
+
print("Anthropic API key not found in the environment variables.")
|
| 168 |
+
return None
|
annotations/annotation_1/PEDANTS-LLM-Evaluation/qa_metrics/prompt_open_llm.py
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Assume openai>=1.0.0
|
| 2 |
+
from openai import OpenAI
|
| 3 |
+
|
| 4 |
+
|
| 5 |
+
'''
|
| 6 |
+
Supports Various Open-Sources LLMs by calling API functions:
|
| 7 |
+
# model="lizpreciatior/lzlv_70b_fp16_hf",
|
| 8 |
+
# model="meta-llama/Llama-2-70b-chat-hf",
|
| 9 |
+
model="meta-llama/Llama-2-7b-chat-hf",
|
| 10 |
+
model="meta-llama/Llama-2-13b-chat-hf",
|
| 11 |
+
# model="01-ai/Yi-34B-Chat",
|
| 12 |
+
# model="google/gemma-7b-it",
|
| 13 |
+
# model="llava-hf/llava-1.5-7b-hf",
|
| 14 |
+
# model="mistralai/Mixtral-8x7B-Instruct-v0.1"
|
| 15 |
+
See link for API key and models: https://deepinfra.com/models
|
| 16 |
+
'''
|
| 17 |
+
|
| 18 |
+
class OpenLLM:
|
| 19 |
+
def __init__(self):
|
| 20 |
+
self.openai = None
|
| 21 |
+
|
| 22 |
+
def set_deepinfra_api_key(self, api_key):
|
| 23 |
+
self.openai = OpenAI(
|
| 24 |
+
api_key=api_key,
|
| 25 |
+
base_url="https://api.deepinfra.com/v1/openai",
|
| 26 |
+
)
|
| 27 |
+
|
| 28 |
+
def prompt(self, prompt, model_engine="mistralai/Mixtral-8x7B-Instruct-v0.1", temperature=0.7, max_tokens=100, top_p=0.5):
|
| 29 |
+
chat_completion = self.openai.chat.completions.create(
|
| 30 |
+
model = model_engine,
|
| 31 |
+
temperature=temperature,
|
| 32 |
+
top_p=top_p,
|
| 33 |
+
max_tokens=max_tokens,
|
| 34 |
+
# num_return_sequences=2,
|
| 35 |
+
messages=[{"role": "user", "content": prompt}],
|
| 36 |
+
)
|
| 37 |
+
|
| 38 |
+
return chat_completion.choices[0].message.content
|
| 39 |
+
|
annotations/annotation_1/PEDANTS-LLM-Evaluation/qa_metrics/transformerMatcher.py
ADDED
|
@@ -0,0 +1,340 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
+
def __init__(self, model='bert'):
|
| 7 |
+
self.device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
|
| 8 |
+
print(f"Using device: {self.device}")
|
| 9 |
+
'''
|
| 10 |
+
Fetch the model and tokenizer from the local directory
|
| 11 |
+
'''
|
| 12 |
+
current_dir = os.path.dirname(__file__)
|
| 13 |
+
|
| 14 |
+
if model == 'bert':
|
| 15 |
+
from transformers import BertForSequenceClassification, BertTokenizer, BertConfig
|
| 16 |
+
model_dir = os.path.join(current_dir, 'transformer_models/bert')
|
| 17 |
+
|
| 18 |
+
# Ensure the target directory exists
|
| 19 |
+
if not os.path.exists(model_dir):
|
| 20 |
+
os.makedirs(model_dir)
|
| 21 |
+
|
| 22 |
+
model_path = 'zli12321/answer_equivalence_bert'
|
| 23 |
+
config= BertConfig.from_pretrained(model_path)
|
| 24 |
+
self.model = BertForSequenceClassification.from_pretrained(model_path, config=config, cache_dir=model_dir).to(self.device)
|
| 25 |
+
self.tokenizer = BertTokenizer.from_pretrained(model_path, cache_dir=model_dir)
|
| 26 |
+
if model == 'distilbert':
|
| 27 |
+
from transformers import DistilBertForSequenceClassification, DistilBertConfig, DistilBertTokenizer
|
| 28 |
+
model_dir = os.path.join(current_dir, 'transformer_models/distilbert')
|
| 29 |
+
|
| 30 |
+
# Ensure the target directory exists
|
| 31 |
+
if not os.path.exists(model_dir):
|
| 32 |
+
os.makedirs(model_dir)
|
| 33 |
+
|
| 34 |
+
model_path = 'zli12321/answer_equivalence_distilbert'
|
| 35 |
+
|
| 36 |
+
self.tokenizer = DistilBertTokenizer.from_pretrained(model_path)
|
| 37 |
+
config = DistilBertConfig.from_pretrained(model_path, hidden_dropout_prob=0.1, attention_probs_dropout_prob=0.1)
|
| 38 |
+
self.model = DistilBertForSequenceClassification.from_pretrained(model_path, config=config).to(self.device)
|
| 39 |
+
elif model == 'distilroberta':
|
| 40 |
+
from transformers import RobertaForSequenceClassification, RobertaTokenizer, RobertaConfig
|
| 41 |
+
model_dir = os.path.join(current_dir, 'transformer_models/distilroberta')
|
| 42 |
+
|
| 43 |
+
# Ensure the target directory exists
|
| 44 |
+
if not os.path.exists(model_dir):
|
| 45 |
+
os.makedirs(model_dir)
|
| 46 |
+
|
| 47 |
+
model_path = 'zli12321/answer_equivalence_distilroberta'
|
| 48 |
+
|
| 49 |
+
config = RobertaConfig.from_pretrained(model_path, hidden_dropout_prob=0.1, attention_probs_dropout_prob=0.1)
|
| 50 |
+
self.model = RobertaForSequenceClassification.from_pretrained(model_path, cache_dir=model_dir).to(self.device)
|
| 51 |
+
self.tokenizer = RobertaTokenizer.from_pretrained(model_path, cache_dir=model_dir)
|
| 52 |
+
elif model == 'roberta':
|
| 53 |
+
from transformers import RobertaForSequenceClassification, RobertaTokenizer, RobertaConfig
|
| 54 |
+
model_dir = os.path.join(current_dir, 'transformer_models/roberta')
|
| 55 |
+
|
| 56 |
+
# Ensure the target directory exists
|
| 57 |
+
if not os.path.exists(model_dir):
|
| 58 |
+
os.makedirs(model_dir)
|
| 59 |
+
|
| 60 |
+
model_path = 'zli12321/answer_equivalence_roberta'
|
| 61 |
+
config = RobertaConfig.from_pretrained(model_path, hidden_dropout_prob=0.1, attention_probs_dropout_prob=0.1)
|
| 62 |
+
self.model = RobertaForSequenceClassification.from_pretrained(model_path, cache_dir=model_dir).to(self.device)
|
| 63 |
+
self.tokenizer = RobertaTokenizer.from_pretrained(model_path, cache_dir=model_dir)
|
| 64 |
+
elif model == 'roberta-large':
|
| 65 |
+
from transformers import RobertaForSequenceClassification, RobertaTokenizer, RobertaConfig
|
| 66 |
+
model_dir = os.path.join(current_dir, 'transformer_models/roberta-large')
|
| 67 |
+
|
| 68 |
+
# Ensure the target directory exists
|
| 69 |
+
if not os.path.exists(model_dir):
|
| 70 |
+
os.makedirs(model_dir)
|
| 71 |
+
|
| 72 |
+
model_path = 'zli12321/answer_equivalence_roberta-large'
|
| 73 |
+
config = RobertaConfig.from_pretrained(model_path, hidden_dropout_prob=0.1, attention_probs_dropout_prob=0.1)
|
| 74 |
+
self.model = RobertaForSequenceClassification.from_pretrained(model_path, cache_dir=model_dir).to(self.device)
|
| 75 |
+
self.tokenizer = RobertaTokenizer.from_pretrained(model_path, cache_dir=model_dir)
|
| 76 |
+
elif model == 'tiny-bert':
|
| 77 |
+
from transformers import AutoTokenizer, AutoModelForSequenceClassification
|
| 78 |
+
model_dir = os.path.join(current_dir, 'transformer_models/tiny_bert')
|
| 79 |
+
|
| 80 |
+
# Ensure the target directory exists
|
| 81 |
+
if not os.path.exists(model_dir):
|
| 82 |
+
os.makedirs(model_dir)
|
| 83 |
+
|
| 84 |
+
model_path = 'zli12321/answer_equivalence_tiny_bert'
|
| 85 |
+
config= AutoModelForSequenceClassification.from_pretrained(model_path, hidden_dropout_prob=0.1, attention_probs_dropout_prob=0.1)
|
| 86 |
+
self.model = AutoModelForSequenceClassification.from_pretrained(model_path, config=config, cache_dir=model_dir).to(self.device)
|
| 87 |
+
self.tokenizer = AutoTokenizer.from_pretrained(model_path, cache_dir=model_dir)
|
| 88 |
+
else:
|
| 89 |
+
model_path = model
|
| 90 |
+
if 'roberta' in model.lower():
|
| 91 |
+
from transformers import RobertaForSequenceClassification, RobertaTokenizer, RobertaConfig
|
| 92 |
+
model_dir = os.path.join(current_dir, 'transformer_models/' + model_path)
|
| 93 |
+
|
| 94 |
+
# Ensure the target directory exists
|
| 95 |
+
if not os.path.exists(model_dir):
|
| 96 |
+
os.makedirs(model_dir)
|
| 97 |
+
|
| 98 |
+
config = RobertaConfig.from_pretrained(model_path, hidden_dropout_prob=0.1, attention_probs_dropout_prob=0.1)
|
| 99 |
+
self.model = RobertaForSequenceClassification.from_pretrained(model_path, cache_dir=model_dir).to(self.device)
|
| 100 |
+
self.tokenizer = RobertaTokenizer.from_pretrained(model_path, cache_dir=model_dir)
|
| 101 |
+
elif 'distilbert' in model.lower():
|
| 102 |
+
from transformers import DistilBertForSequenceClassification, DistilBertConfig, DistilBertTokenizer
|
| 103 |
+
model_dir = os.path.join(current_dir, 'transformer_models/distilbert')
|
| 104 |
+
|
| 105 |
+
# Ensure the target directory exists
|
| 106 |
+
if not os.path.exists(model_dir):
|
| 107 |
+
os.makedirs(model_dir)
|
| 108 |
+
self.tokenizer = DistilBertTokenizer.from_pretrained(model_path)
|
| 109 |
+
config = DistilBertConfig.from_pretrained(model_path, hidden_dropout_prob=0.1, attention_probs_dropout_prob=0.1)
|
| 110 |
+
self.model = DistilBertForSequenceClassification.from_pretrained(model_path, config=config).to(self.device)
|
| 111 |
+
elif 'tiny-bert' in model.lower():
|
| 112 |
+
from transformers import AutoTokenizer, AutoModelForSequenceClassification
|
| 113 |
+
model_dir = os.path.join(current_dir, 'transformer_models/tiny_bert')
|
| 114 |
+
|
| 115 |
+
# Ensure the target directory exists
|
| 116 |
+
if not os.path.exists(model_dir):
|
| 117 |
+
os.makedirs(model_dir)
|
| 118 |
+
|
| 119 |
+
config= AutoModelForSequenceClassification.from_pretrained(model_path, hidden_dropout_prob=0.1, attention_probs_dropout_prob=0.1)
|
| 120 |
+
self.model = AutoModelForSequenceClassification.from_pretrained(model_path, config=config, cache_dir=model_dir).to(self.device)
|
| 121 |
+
self.tokenizer = AutoTokenizer.from_pretrained(model_path, cache_dir=model_dir)
|
| 122 |
+
elif 'bert' in model.lower():
|
| 123 |
+
from transformers import BertForSequenceClassification, BertTokenizer, BertConfig
|
| 124 |
+
model_dir = os.path.join(current_dir, 'transformer_models/bert')
|
| 125 |
+
|
| 126 |
+
# Ensure the target directory exists
|
| 127 |
+
if not os.path.exists(model_dir):
|
| 128 |
+
os.makedirs(model_dir)
|
| 129 |
+
|
| 130 |
+
config= BertConfig.from_pretrained(model_path)
|
| 131 |
+
self.model = BertForSequenceClassification.from_pretrained(model_path, config=config, cache_dir=model_dir).to(self.device)
|
| 132 |
+
self.tokenizer = BertTokenizer.from_pretrained(model_path, cache_dir=model_dir)
|
| 133 |
+
|
| 134 |
+
def download_latest_model(self, model='roberta'):
|
| 135 |
+
current_dir = os.path.dirname(__file__)
|
| 136 |
+
model_file = "model.safetensors"
|
| 137 |
+
|
| 138 |
+
if model == 'bert':
|
| 139 |
+
from transformers import BertForSequenceClassification, BertTokenizer, BertConfig
|
| 140 |
+
model_dir = os.path.join(current_dir, 'transformer_models/bert')
|
| 141 |
+
|
| 142 |
+
# Ensure the target directory exists
|
| 143 |
+
if not os.path.exists(model_dir):
|
| 144 |
+
os.makedirs(model_dir)
|
| 145 |
+
|
| 146 |
+
model_path = 'zli12321/answer_equivalence_bert'
|
| 147 |
+
config= BertConfig.from_pretrained(model_path)
|
| 148 |
+
self.model = BertForSequenceClassification.from_pretrained(model_path, config=config, cache_dir=model_dir, model_file=model_file).to(self.device)
|
| 149 |
+
self.tokenizer = BertTokenizer.from_pretrained(model_path, cache_dir=model_dir)
|
| 150 |
+
if model == 'distilbert':
|
| 151 |
+
from transformers import DistilBertForSequenceClassification, DistilBertConfig, DistilBertTokenizer
|
| 152 |
+
model_dir = os.path.join(current_dir, 'transformer_models/distilbert')
|
| 153 |
+
|
| 154 |
+
# Ensure the target directory exists
|
| 155 |
+
if not os.path.exists(model_dir):
|
| 156 |
+
os.makedirs(model_dir)
|
| 157 |
+
|
| 158 |
+
model_path = 'zli12321/answer_equivalence_distilbert'
|
| 159 |
+
|
| 160 |
+
self.tokenizer = DistilBertTokenizer.from_pretrained(model_path)
|
| 161 |
+
config = DistilBertConfig.from_pretrained(model_path, hidden_dropout_prob=0.1, attention_probs_dropout_prob=0.1)
|
| 162 |
+
self.model = DistilBertForSequenceClassification.from_pretrained(model_path, config=config, model_file=model_file).to(self.device)
|
| 163 |
+
elif model == 'distilroberta':
|
| 164 |
+
from transformers import RobertaForSequenceClassification, RobertaTokenizer, RobertaConfig
|
| 165 |
+
model_dir = os.path.join(current_dir, 'transformer_models/distilroberta')
|
| 166 |
+
|
| 167 |
+
# Ensure the target directory exists
|
| 168 |
+
if not os.path.exists(model_dir):
|
| 169 |
+
os.makedirs(model_dir)
|
| 170 |
+
|
| 171 |
+
model_path = 'zli12321/answer_equivalence_distilroberta'
|
| 172 |
+
|
| 173 |
+
config = RobertaConfig.from_pretrained(model_path, hidden_dropout_prob=0.1, attention_probs_dropout_prob=0.1)
|
| 174 |
+
self.model = RobertaForSequenceClassification.from_pretrained(model_path, cache_dir=model_dir, model_file=model_file).to(self.device)
|
| 175 |
+
self.tokenizer = RobertaTokenizer.from_pretrained(model_path, cache_dir=model_dir)
|
| 176 |
+
elif model == 'roberta':
|
| 177 |
+
from transformers import RobertaForSequenceClassification, RobertaTokenizer, RobertaConfig
|
| 178 |
+
model_dir = os.path.join(current_dir, 'transformer_models/roberta')
|
| 179 |
+
|
| 180 |
+
# Ensure the target directory exists
|
| 181 |
+
if not os.path.exists(model_dir):
|
| 182 |
+
os.makedirs(model_dir)
|
| 183 |
+
|
| 184 |
+
model_path = 'zli12321/answer_equivalence_roberta'
|
| 185 |
+
config = RobertaConfig.from_pretrained(model_path, hidden_dropout_prob=0.1, attention_probs_dropout_prob=0.1)
|
| 186 |
+
self.model = RobertaForSequenceClassification.from_pretrained(model_path, cache_dir=model_dir, model_file=model_file).to(self.device)
|
| 187 |
+
self.tokenizer = RobertaTokenizer.from_pretrained(model_path, cache_dir=model_dir)
|
| 188 |
+
elif model == 'roberta-large':
|
| 189 |
+
from transformers import RobertaForSequenceClassification, RobertaTokenizer, RobertaConfig
|
| 190 |
+
model_dir = os.path.join(current_dir, 'transformer_models/roberta-large')
|
| 191 |
+
|
| 192 |
+
# Ensure the target directory exists
|
| 193 |
+
if not os.path.exists(model_dir):
|
| 194 |
+
os.makedirs(model_dir)
|
| 195 |
+
|
| 196 |
+
model_path = 'zli12321/answer_equivalence_roberta-large'
|
| 197 |
+
config = RobertaConfig.from_pretrained(model_path, hidden_dropout_prob=0.1, attention_probs_dropout_prob=0.1)
|
| 198 |
+
self.model = RobertaForSequenceClassification.from_pretrained(model_path, cache_dir=model_dir, model_file=model_file).to(self.device)
|
| 199 |
+
self.tokenizer = RobertaTokenizer.from_pretrained(model_path, cache_dir=model_dir)
|
| 200 |
+
|
| 201 |
+
'''
|
| 202 |
+
Return the confidence score between the reference and candidate answers.
|
| 203 |
+
reference, candidate, and question are strings.
|
| 204 |
+
'''
|
| 205 |
+
def get_score(self, reference, candidate, question):
|
| 206 |
+
if em_match(reference, candidate) == True:
|
| 207 |
+
return 1.0
|
| 208 |
+
input_text = "[CLS] " +str(candidate) + " [SEP] " +str(reference) + " [SEP] " +question + " [SEP]"
|
| 209 |
+
inputs = self.tokenizer.encode_plus(
|
| 210 |
+
input_text,
|
| 211 |
+
add_special_tokens=True,
|
| 212 |
+
max_length=512,
|
| 213 |
+
padding='max_length',
|
| 214 |
+
truncation=True,
|
| 215 |
+
return_tensors='pt'
|
| 216 |
+
)
|
| 217 |
+
|
| 218 |
+
input_ids = inputs['input_ids'].to(self.device)
|
| 219 |
+
attention_mask = inputs['attention_mask'].to(self.device)
|
| 220 |
+
|
| 221 |
+
self.model.eval()
|
| 222 |
+
with torch.no_grad():
|
| 223 |
+
outputs = self.model(input_ids, attention_mask=attention_mask)
|
| 224 |
+
|
| 225 |
+
# Apply sigmoid to the logits to get the probability score for each class
|
| 226 |
+
probabilities = torch.sigmoid(outputs.logits).squeeze()
|
| 227 |
+
|
| 228 |
+
# Convert to numpy
|
| 229 |
+
probabilities = probabilities.cpu().numpy()
|
| 230 |
+
|
| 231 |
+
# Assuming that you are interested in the second class (usually 'correct')
|
| 232 |
+
# Make sure the index (here [1]) corresponds to the correct class in your case
|
| 233 |
+
score = probabilities[1] if len(probabilities.shape) > 0 else probabilities
|
| 234 |
+
|
| 235 |
+
return score
|
| 236 |
+
|
| 237 |
+
'''
|
| 238 |
+
Returns the classifier confidence score for the candidate answer matching judgment if the reference and candidate answers
|
| 239 |
+
are lists. The reference and candidate answers can lists of strings or just strings. The question is a string.
|
| 240 |
+
'''
|
| 241 |
+
def get_scores(self, reference, candidate, question):
|
| 242 |
+
# Calculate the F1 score between the referee and candidate
|
| 243 |
+
confidece_scores = {}
|
| 244 |
+
if isinstance(reference, list) and isinstance(candidate, list):
|
| 245 |
+
references = [str(ele) for ele in reference]
|
| 246 |
+
candidates = [str(ele) for ele in candidate]
|
| 247 |
+
question =str(question)
|
| 248 |
+
|
| 249 |
+
for candidate in candidates:
|
| 250 |
+
for reference in references:
|
| 251 |
+
if reference not in confidece_scores:
|
| 252 |
+
confidece_scores[reference] = {}
|
| 253 |
+
confidece_scores[reference][candidate] = self.get_score(reference, candidate, question)
|
| 254 |
+
|
| 255 |
+
return confidece_scores
|
| 256 |
+
elif isinstance(reference, list):
|
| 257 |
+
references = [str(ele) for ele in reference]
|
| 258 |
+
candidates =str(candidate)
|
| 259 |
+
question =str(question)
|
| 260 |
+
|
| 261 |
+
for reference in references:
|
| 262 |
+
confidece_scores[reference] = {}
|
| 263 |
+
confidece_scores[reference][candidate] = self.get_score(reference, candidate, question)
|
| 264 |
+
|
| 265 |
+
return confidece_scores
|
| 266 |
+
elif isinstance(candidate, list):
|
| 267 |
+
candidates = [str(ele) for ele in candidate]
|
| 268 |
+
reference =str(reference)
|
| 269 |
+
question =str(question)
|
| 270 |
+
|
| 271 |
+
if reference not in confidece_scores:
|
| 272 |
+
confidece_scores[reference] = {}
|
| 273 |
+
|
| 274 |
+
for candidate in candidates:
|
| 275 |
+
confidece_scores[reference][candidate] = self.get_score(reference, candidate, question)
|
| 276 |
+
|
| 277 |
+
return confidece_scores
|
| 278 |
+
else:
|
| 279 |
+
confidece_scores[reference] = {}
|
| 280 |
+
confidece_scores[reference][candidate] = self.get_score(reference, candidate, question)
|
| 281 |
+
|
| 282 |
+
return confidece_scores
|
| 283 |
+
|
| 284 |
+
'''
|
| 285 |
+
Given a list of reference, candidate, and a question, return the pair with the highest confidence score.
|
| 286 |
+
'''
|
| 287 |
+
def get_highest_score(self, reference, candidate, question):
|
| 288 |
+
confidence_scores = self.get_scores(reference, candidate, question)
|
| 289 |
+
|
| 290 |
+
max_score = -1
|
| 291 |
+
max_pair = (None, None)
|
| 292 |
+
|
| 293 |
+
for reference, candidates in confidence_scores.items():
|
| 294 |
+
for candidate, score in candidates.items():
|
| 295 |
+
if score > max_score:
|
| 296 |
+
max_score = score
|
| 297 |
+
max_pair = (reference, candidate)
|
| 298 |
+
|
| 299 |
+
return max_pair, max_score
|
| 300 |
+
|
| 301 |
+
'''
|
| 302 |
+
Input your reference and candidate answers, and the question.
|
| 303 |
+
Return True if the candidate answer is above the threshold value. Else, False.
|
| 304 |
+
'''
|
| 305 |
+
def transformer_match(self, reference, candidate, question, threshold=0.5):
|
| 306 |
+
if em_match(reference, candidate) == True:
|
| 307 |
+
return True
|
| 308 |
+
judgment = False
|
| 309 |
+
if isinstance(reference, list) and isinstance(candidate, list):
|
| 310 |
+
candidates = [str(ele) for ele in candidate]
|
| 311 |
+
references = [str(ele) for ele in reference]
|
| 312 |
+
for candidate in candidates:
|
| 313 |
+
if judgment == False:
|
| 314 |
+
for reference in references:
|
| 315 |
+
model_score = self.get_score(reference, candidate, question)
|
| 316 |
+
if model_score > threshold:
|
| 317 |
+
judgment = True
|
| 318 |
+
|
| 319 |
+
return judgment
|
| 320 |
+
elif isinstance(reference, list):
|
| 321 |
+
references = [str(ele) for ele in reference]
|
| 322 |
+
candidate =str(candidate)
|
| 323 |
+
for reference in references:
|
| 324 |
+
model_score = self.get_score(reference, candidate, question)
|
| 325 |
+
if model_score > threshold:
|
| 326 |
+
judgment = True
|
| 327 |
+
|
| 328 |
+
return judgment
|
| 329 |
+
elif isinstance(candidate, list):
|
| 330 |
+
candidates = [str(ele) for ele in candidate]
|
| 331 |
+
reference =str(reference)
|
| 332 |
+
for candidate in candidates:
|
| 333 |
+
model_score = self.get_score(reference, candidate, question)
|
| 334 |
+
if model_score > threshold:
|
| 335 |
+
judgment = True
|
| 336 |
+
|
| 337 |
+
return judgment
|
| 338 |
+
else:
|
| 339 |
+
model_score = self.get_score(reference, candidate, question)
|
| 340 |
+
return True if model_score > threshold else False
|
annotations/annotation_1/PEDANTS-LLM-Evaluation/qa_metrics/utils/__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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import string
|
| 2 |
+
import contractions
|
| 3 |
+
import requests
|
| 4 |
+
import os
|
| 5 |
+
import regex
|
| 6 |
+
from datetime import datetime
|
| 7 |
+
import regex, contractions, string, unicodedata
|
| 8 |
+
import tqdm as tqdm
|
| 9 |
+
import nltk
|
| 10 |
+
from nltk.stem import WordNetLemmatizer
|
| 11 |
+
from nltk.corpus import wordnet
|
| 12 |
+
from nltk.tokenize import word_tokenize
|
| 13 |
+
|
| 14 |
+
nltk.download('averaged_perceptron_tagger')
|
| 15 |
+
nltk.download('punkt')
|
| 16 |
+
nltk.download('wordnet')
|
| 17 |
+
nltk.download('omw-1.4')
|
| 18 |
+
|
| 19 |
+
lemmatizer = WordNetLemmatizer()
|
| 20 |
+
|
| 21 |
+
def fix_answer(s):
|
| 22 |
+
def remove_articles(text):
|
| 23 |
+
return regex.sub(r'\b(a|an|the)\b', ' ', text)
|
| 24 |
+
|
| 25 |
+
def white_space_fix(text):
|
| 26 |
+
return ' '.join(text.split())
|
| 27 |
+
|
| 28 |
+
def remove_punc(text):
|
| 29 |
+
exclude = set(string.punctuation)
|
| 30 |
+
return ''.join(ch for ch in text if ch not in exclude)
|
| 31 |
+
|
| 32 |
+
def lower(text):
|
| 33 |
+
return text.lower()
|
| 34 |
+
|
| 35 |
+
return white_space_fix(remove_articles(remove_punc(lower(s))))
|
| 36 |
+
|
| 37 |
+
def normalize_answer(text, lower=True):
|
| 38 |
+
if isinstance(text, list):
|
| 39 |
+
result = []
|
| 40 |
+
for ele in text:
|
| 41 |
+
ele = str(ele)
|
| 42 |
+
if lower:
|
| 43 |
+
ele = ele.lower()
|
| 44 |
+
translator = str.maketrans('', '', string.punctuation)
|
| 45 |
+
ele = ele.translate(translator)
|
| 46 |
+
result.append(fix_answer(' '.join(ele.split())))
|
| 47 |
+
return result
|
| 48 |
+
else:
|
| 49 |
+
text = str(text)
|
| 50 |
+
if lower:
|
| 51 |
+
text = text.lower()
|
| 52 |
+
translator = str.maketrans('', '', string.punctuation)
|
| 53 |
+
text = text.translate(translator)
|
| 54 |
+
return fix_answer(' '.join(text.split()))
|
| 55 |
+
|
| 56 |
+
def calculate_f1_score_with_precision(str1, str2):
|
| 57 |
+
# Split the strings into sets of words
|
| 58 |
+
str1 = fix_answer(contractions.fix(normalize_answer(str1)))
|
| 59 |
+
str2 = fix_answer(contractions.fix(normalize_answer(str2)))
|
| 60 |
+
words_str1 = set(str1.split())
|
| 61 |
+
words_str2 = set(str2.split())
|
| 62 |
+
|
| 63 |
+
# Calculate true positives, false positives, and false negatives
|
| 64 |
+
tp = len(words_str1.intersection(words_str2))
|
| 65 |
+
fp = len(words_str1 - words_str2)
|
| 66 |
+
fn = len(words_str2 - words_str1)
|
| 67 |
+
|
| 68 |
+
# Calculate precision and recall
|
| 69 |
+
precision = tp / (tp + fp) if (tp + fp) > 0 else 0
|
| 70 |
+
recall = tp / (tp + fn) if (tp + fn) > 0 else 0
|
| 71 |
+
|
| 72 |
+
# Calculate F1 score
|
| 73 |
+
f1_score = 2 * (precision * recall) / (precision + recall) if (precision + recall) > 0 else 0
|
| 74 |
+
|
| 75 |
+
return f1_score, precision, recall
|
| 76 |
+
|
| 77 |
+
def remove_punctuation(text):
|
| 78 |
+
def remove_articles(text):
|
| 79 |
+
return regex.sub(r'\b(a|an|the)\b', ' ', text)
|
| 80 |
+
|
| 81 |
+
def white_space_fix(text):
|
| 82 |
+
return ' '.join(text.split())
|
| 83 |
+
|
| 84 |
+
def remove_punc(text):
|
| 85 |
+
exclude = set(string.punctuation)
|
| 86 |
+
return ''.join(ch for ch in text if ch not in exclude)
|
| 87 |
+
|
| 88 |
+
def lower(text):
|
| 89 |
+
try:
|
| 90 |
+
return text.lower()
|
| 91 |
+
except:
|
| 92 |
+
return ''
|
| 93 |
+
|
| 94 |
+
return white_space_fix(remove_articles(remove_punc(lower(text))))
|
| 95 |
+
|
| 96 |
+
def download_link(file, url, name):
|
| 97 |
+
# if not os.path.isfile(file):
|
| 98 |
+
# print("Downloading {}...".format(name))
|
| 99 |
+
try:
|
| 100 |
+
response = requests.get(url, stream=True)
|
| 101 |
+
|
| 102 |
+
if response.status_code == 200:
|
| 103 |
+
with open(file, 'wb') as f:
|
| 104 |
+
f.write(response.content)
|
| 105 |
+
# print("Download {} complete.".format(name))
|
| 106 |
+
else:
|
| 107 |
+
print("Failed to download the model. Status code:", response.status_code)
|
| 108 |
+
except:
|
| 109 |
+
if not os.path.isfile(file):
|
| 110 |
+
print("Failed to download the model. Check your internet connection.")
|
| 111 |
+
|
| 112 |
+
def file_needs_update(url, file_path):
|
| 113 |
+
"""
|
| 114 |
+
Check if the file at the given path needs to be updated based on the
|
| 115 |
+
Last-Modified header from the file URL.
|
| 116 |
+
"""
|
| 117 |
+
try:
|
| 118 |
+
response = requests.head(url)
|
| 119 |
+
if response.status_code == 200 and 'Last-Modified' in response.headers:
|
| 120 |
+
remote_last_modified = requests.utils.parsedate_to_datetime(response.headers['Last-Modified'])
|
| 121 |
+
if not os.path.exists(file_path):
|
| 122 |
+
return True # File does not exist, needs download.
|
| 123 |
+
local_last_modified = datetime.fromtimestamp(os.path.getmtime(file_path), tz=remote_last_modified.tzinfo)
|
| 124 |
+
return remote_last_modified > local_last_modified
|
| 125 |
+
except requests.RequestException as e:
|
| 126 |
+
# print(f"Error checking if file needs update: {e}")
|
| 127 |
+
pass
|
| 128 |
+
return False
|
| 129 |
+
|
| 130 |
+
def f1_score_with_precision_recall(reference, candidate):
|
| 131 |
+
# Split the strings into sets of words
|
| 132 |
+
reference = remove_punctuation(normalize_answer(str(reference)))
|
| 133 |
+
candidate = remove_punctuation(normalize_answer(str(candidate)))
|
| 134 |
+
words_reference = set(reference.split())
|
| 135 |
+
words_candidate = set(candidate.split())
|
| 136 |
+
|
| 137 |
+
# Calculate true positives, false positives, and false negatives
|
| 138 |
+
tp = len(words_reference.intersection(words_candidate))
|
| 139 |
+
fp = len(words_reference - words_candidate)
|
| 140 |
+
fn = len(words_candidate - words_reference)
|
| 141 |
+
|
| 142 |
+
# Calculate precision and recall
|
| 143 |
+
precision = tp / (tp + fp) if (tp + fp) > 0 else 0
|
| 144 |
+
recall = tp / (tp + fn) if (tp + fn) > 0 else 0
|
| 145 |
+
|
| 146 |
+
# Calculate F1 score
|
| 147 |
+
f1_score = 2 * (precision * recall) / (precision + recall) if (precision + recall) > 0 else 0
|
| 148 |
+
|
| 149 |
+
return {'f1': f1_score, 'precision': precision, 'recall': recall}
|
| 150 |
+
|
| 151 |
+
def normalize_apostrophe(text):
|
| 152 |
+
return text.replace("’", "'")
|
| 153 |
+
|
| 154 |
+
def preprocess(text):
|
| 155 |
+
text = normalize_apostrophe(text.strip()).lower()
|
| 156 |
+
return text
|
| 157 |
+
|
| 158 |
+
def normalize_answer(text, lower=True):
|
| 159 |
+
def remove_punctuation(s):
|
| 160 |
+
# Use unicodedata to remove any punctuation (English and non-English)
|
| 161 |
+
return ''.join(
|
| 162 |
+
char for char in s if not unicodedata.category(char).startswith('P')
|
| 163 |
+
)
|
| 164 |
+
|
| 165 |
+
if isinstance(text, list):
|
| 166 |
+
result = []
|
| 167 |
+
for ele in text:
|
| 168 |
+
ele = str(ele)
|
| 169 |
+
if lower:
|
| 170 |
+
ele = ele.lower()
|
| 171 |
+
ele = remove_punctuation(ele)
|
| 172 |
+
result.append(preprocess(fix_answer(' '.join(ele.split()))))
|
| 173 |
+
return result
|
| 174 |
+
else:
|
| 175 |
+
text = str(text)
|
| 176 |
+
if lower:
|
| 177 |
+
text = text.lower()
|
| 178 |
+
text = remove_punctuation(text)
|
| 179 |
+
return preprocess(fix_answer(' '.join(text.split())))
|
| 180 |
+
|
| 181 |
+
def lemmatize_text(text):
|
| 182 |
+
# Initialize lemmatizer
|
| 183 |
+
|
| 184 |
+
# Helper function to get POS tag for better lemmatization
|
| 185 |
+
def get_wordnet_pos(word):
|
| 186 |
+
"""Map POS tag to first character lemmatize() accepts."""
|
| 187 |
+
tag = nltk.pos_tag([word])[0][1][0].upper()
|
| 188 |
+
tag_dict = {"J": wordnet.ADJ, # Adjective
|
| 189 |
+
"N": wordnet.NOUN, # Noun
|
| 190 |
+
"V": wordnet.VERB, # Verb
|
| 191 |
+
"R": wordnet.ADV} # Adverb
|
| 192 |
+
|
| 193 |
+
return tag_dict.get(tag, wordnet.NOUN) # Default to noun if unknown
|
| 194 |
+
|
| 195 |
+
# Tokenize the text
|
| 196 |
+
words = word_tokenize(text)
|
| 197 |
+
|
| 198 |
+
# Lemmatize each word
|
| 199 |
+
lemmatized_words = [lemmatizer.lemmatize(word, get_wordnet_pos(word)) for word in words]
|
| 200 |
+
|
| 201 |
+
# Join lemmatized words back into a sentence
|
| 202 |
+
lemmatized_sentence = ' '.join(lemmatized_words)
|
| 203 |
+
|
| 204 |
+
return lemmatized_sentence
|
| 205 |
+
|
| 206 |
+
def calculate_f1_score_with_precision(str1, str2):
|
| 207 |
+
# Split the strings into sets of words
|
| 208 |
+
str1 = fix_answer(contractions.fix(normalize_answer(str1)))
|
| 209 |
+
str2 = fix_answer(contractions.fix(normalize_answer(str2)))
|
| 210 |
+
words_str1 = set(str1.split())
|
| 211 |
+
words_str2 = set(str2.split())
|
| 212 |
+
|
| 213 |
+
# Calculate true positives, false positives, and false negatives
|
| 214 |
+
tp = len(words_str1.intersection(words_str2))
|
| 215 |
+
fp = len(words_str1 - words_str2)
|
| 216 |
+
fn = len(words_str2 - words_str1)
|
| 217 |
+
|
| 218 |
+
# Calculate precision and recall
|
| 219 |
+
precision = tp / (tp + fp) if (tp + fp) > 0 else 0
|
| 220 |
+
recall = tp / (tp + fn) if (tp + fn) > 0 else 0
|
| 221 |
+
|
| 222 |
+
# Calculate F1 score
|
| 223 |
+
f1_score = 2 * (precision * recall) / (precision + recall) if (precision + recall) > 0 else 0
|
| 224 |
+
|
| 225 |
+
return f1_score, precision, recall
|
annotations/annotation_1/_envcheck_stderr.txt
ADDED
|
File without changes
|
annotations/annotation_1/_envcheck_stdout.txt
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
============================= test session starts ==============================
|
| 2 |
+
platform linux -- Python 3.10.19, pytest-8.4.1, pluggy-1.6.0
|
| 3 |
+
rootdir: /home/linus/code/research_code_gen/code_agent_clean/work_dir/dataset/annotations/annotation_1/PEDANTS-LLM-Evaluation/qa_metrics
|
| 4 |
+
plugins: cov-6.2.1, timeout-2.4.0, anyio-4.12.1
|
| 5 |
+
collected 14 items
|
| 6 |
+
|
| 7 |
+
test.py .............. [100%]
|
| 8 |
+
|
| 9 |
+
=============================== warnings summary ===============================
|
| 10 |
+
../../../../../../../../../miniconda3/envs/test_281/lib/python3.10/site-packages/nltk/metrics/aline.py:41
|
| 11 |
+
/home/linus/miniconda3/envs/test_281/lib/python3.10/site-packages/nltk/metrics/aline.py:41: UserWarning: The NumPy module was reloaded (imported a second time). This can in some cases result in small but subtle issues and is discouraged.
|
| 12 |
+
import numpy as np
|
| 13 |
+
|
| 14 |
+
-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
|
| 15 |
+
- generated xml file: /home/linus/code/research_code_gen/code_agent_clean/work_dir/dataset/annotations/annotation_1/pytest_report/report.xml -
|
| 16 |
+
================================ tests coverage ================================
|
| 17 |
+
_______________ coverage: platform linux, python 3.10.19-final-0 _______________
|
| 18 |
+
|
| 19 |
+
Coverage JSON written to file /home/linus/code/research_code_gen/code_agent_clean/work_dir/dataset/annotations/annotation_1/jsoncov
|
| 20 |
+
======================== 14 passed, 1 warning in 7.33s =========================
|
annotations/annotation_1/_runner_stderr.txt
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
|
|
|
| 1 |
+
bash: cannot set terminal process group (2046): Inappropriate ioctl for device
|
| 2 |
+
bash: no job control in this shell
|
annotations/annotation_1/_runner_stdout.txt
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
[1m============================= test session starts ==============================[0m
|
| 2 |
+
platform linux -- Python 3.10.18, pytest-8.4.1, pluggy-1.6.0
|
| 3 |
+
rootdir: /home/linus/back/2025_9_15/dataset/annotations/annotation_1/PEDANTS-LLM-Evaluation/qa_metrics
|
| 4 |
+
plugins: cov-6.2.1, timeout-2.4.0
|
| 5 |
+
collected 14 items
|
| 6 |
+
|
| 7 |
+
test.py [32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m [100%][0m
|
| 8 |
+
|
| 9 |
+
- generated xml file: /home/linus/back/2025_9_15/dataset/annotations/annotation_1/pytest_report/report.xml -
|
| 10 |
+
================================ tests coverage ================================
|
| 11 |
+
_______________ coverage: platform linux, python 3.10.18-final-0 _______________
|
| 12 |
+
|
| 13 |
+
Coverage JSON written to file /home/linus/back/2025_9_15/dataset/annotations/annotation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|
+
import numpy as np
|
| 5 |
+
import os
|
| 6 |
+
|
| 7 |
+
class PEDANT:
|
| 8 |
+
"""
|
| 9 |
+
Implements the PEDANTS (Precise Answer Normalizations for DetermininT
|
| 10 |
+
equivalence via Semantic Similarity) evaluation metric as described in the
|
| 11 |
+
paper "PEDANTS: Cheap but Effective and Interpretable Answer Equivalence".
|
| 12 |
+
|
| 13 |
+
PEDANTS aims to provide an efficient, interpretable, and stable evaluation
|
| 14 |
+
for short-form and factoid question answering (QA) answer correctness (AC),
|
| 15 |
+
going beyond simple Exact Match (EM) or token F1 scores.
|
| 16 |
+
It uses a two-level classification approach based on learned features,
|
| 17 |
+
including question types, applicable AC rules, token overlap metrics,
|
| 18 |
+
and TF-IDF representations.
|
| 19 |
+
|
| 20 |
+
Functionality and Paper Correspondence:
|
| 21 |
+
- Initialization (`__init__`): Loads pre-trained models necessary for PEDANTS.
|
| 22 |
+
This includes the main logistic regression classifier (`self.model`),
|
| 23 |
+
a TF-IDF vectorizer (`self.tokenizer`), a classifier to predict
|
| 24 |
+
AC rule features (`self.rule_model`, corresponds to F(R) in the paper ),
|
| 25 |
+
and a classifier to predict question type features (`self.type_model`,
|
| 26 |
+
corresponds to F(T) in the paper ). The models are downloaded
|
| 27 |
+
if not present locally.
|
| 28 |
+
- Feature Construction (`construct_features`): This method prepares the input
|
| 29 |
+
features for the main classifier. It calculates F1, precision, and recall
|
| 30 |
+
between the reference and candidate answers (`get_f1_features`),
|
| 31 |
+
predicts rule probabilities/log-probabilities (`get_rule_features`),
|
| 32 |
+
predicts type probabilities/log-probabilities (`get_type_features`),
|
| 33 |
+
and computes TF-IDF vectors for the concatenated input text
|
| 34 |
+
("[CLS] q [SEP] a [SEP] ã [SEP]"). These features are then
|
| 35 |
+
combined (stacked horizontally).
|
| 36 |
+
- Scoring (`get_score`, `get_scores`): Calculates the confidence score
|
| 37 |
+
(probability of correctness) for a given question, reference, and
|
| 38 |
+
candidate answer. `get_scores` handles cases where reference
|
| 39 |
+
and/or candidate are lists of answers.
|
| 40 |
+
- Evaluation (`evaluate`): Provides a binary judgment (True/False for correct/incorrect)
|
| 41 |
+
based on the model's prediction.
|
| 42 |
+
- Rule/Type Prediction (`get_judgement_rule`, `get_question_type`): Allows direct
|
| 43 |
+
access to the intermediate predictions of the rule and type classifiers
|
| 44 |
+
(F(R) and F(T)).
|
| 45 |
+
|
| 46 |
+
Discrepancies between Code and Paper:
|
| 47 |
+
- Feature Set in `construct_features`: The paper (Section 3.1) primarily describes
|
| 48 |
+
the final feature set as TF-IDF encodings, token scores (F1, P, R), and the
|
| 49 |
+
outputs (probabilities) from F(R) and F(T) concatenated.
|
| 50 |
+
The code implements this in the `else` block of the `with_log_probas` check:
|
| 51 |
+
`hstack([f1, p, r, rule_feats, type_feats, in_texts])`.
|
| 52 |
+
However, the `if with_log_probas==True:` block constructs a different feature
|
| 53 |
+
set including log probabilities (`rule_log`, `type_log`) :
|
| 54 |
+
`hstack([rule_feats, rule_log, type_feats, type_log, in_texts, f1, p, r])`.
|
| 55 |
+
The paper does not explicitly mention using log probabilities as features
|
| 56 |
+
for the final classifier in Section 3.1.
|
| 57 |
+
- Exact Match Shortcut: The `get_score` and `evaluate` methods include a
|
| 58 |
+
check `if reference in candidate:` to return 1.0 or True directly. This acts
|
| 59 |
+
as an initial exact match (or substring) check before invoking the full
|
| 60 |
+
PEDANTS model. While sensible for efficiency, this specific shortcut isn't
|
| 61 |
+
detailed as part of the core PEDANTS feature construction/classification
|
| 62 |
+
pipeline described in the paper.
|
| 63 |
+
|
| 64 |
+
Implementation Details (Not Explicitly in Paper):
|
| 65 |
+
- Model Storage/Loading: Uses `joblib` to load pre-trained models (`.pkl` files).
|
| 66 |
+
- Model Downloading: Defines specific URLs (GitHub raw content) for model files
|
| 67 |
+
and includes logic (`__init__`, `download_latest_model`) to download them using
|
| 68 |
+
an assumed `download_link` function if they don't exist locally. The paper
|
| 69 |
+
mentions the models but not the specific hosting or download mechanism.
|
| 70 |
+
- Helper Functions: Relies on external functions `normalize_answer`,
|
| 71 |
+
`lemmatize_text`, `download_link`, and `calculate_f1_score_with_precision`,
|
| 72 |
+
whose specific implementations are not part of this class definition but are
|
| 73 |
+
assumed based on the paper's text processing description.
|
| 74 |
+
- Input Data Structure: Internally uses dictionaries like
|
| 75 |
+
`{'reference': ..., 'candidate': ..., 'question': ...}` to pass data between methods.
|
| 76 |
+
- Rule Text: The `get_judgement_rule` method contains a hardcoded list of the
|
| 77 |
+
text descriptions for the 7 AC rules defined in Table 1 of the paper.
|
| 78 |
+
- Handling Multiple Answers: `get_scores` and `evaluate` contain explicit logic
|
| 79 |
+
to handle inputs where `reference` and/or `candidate` are lists, iterating
|
| 80 |
+
through pairs.
|
| 81 |
+
- Confidence Score Extraction: `get_score` returns `pred_probas[0][0]`, implying
|
| 82 |
+
the main model (`self.model`) outputs probabilities for multiple classes (likely
|
| 83 |
+
'correct' and 'incorrect') and the score corresponds to the probability of the
|
| 84 |
+
first class ('correct').
|
| 85 |
+
"""
|
| 86 |
+
def __init__(self):
|
| 87 |
+
"""
|
| 88 |
+
Initializes the PEDANT evaluator.
|
| 89 |
+
|
| 90 |
+
Sets up file paths for the required models (classifier, vectorizer,
|
| 91 |
+
rule classifier, type classifier), defines their download URLs,
|
| 92 |
+
downloads the models if they are not found locally, and loads them
|
| 93 |
+
using joblib.
|
| 94 |
+
|
| 95 |
+
This corresponds to loading the pre-trained components described in
|
| 96 |
+
Section 3.1 of the paper. The specific paths, URLs, and
|
| 97 |
+
download mechanism are implementation details.
|
| 98 |
+
"""
|
| 99 |
+
current_dir = os.path.dirname(__file__)
|
| 100 |
+
model_dir = os.path.join(current_dir, 'classifier')
|
| 101 |
+
# Define local paths for model files
|
| 102 |
+
model_path = os.path.join(model_dir, 'lr_classifier.pkl') # Final AC classifier
|
| 103 |
+
vectorizer_path = os.path.join(model_dir, 'tf-idf_vectorizer.pkl') # TF-IDF vectorizer
|
| 104 |
+
rule_clf_path = os.path.join(model_dir, 'rule_classifier.pkl') # Rule classifier F(R)
|
| 105 |
+
type_clf_path = os.path.join(model_dir, 'type_classifier.pkl') # Type classifier F(T)
|
| 106 |
+
|
| 107 |
+
# Define URLs to download models from (Implementation Detail)
|
| 108 |
+
clf_url = 'https://github.com/zli12321/pedant_models/raw/refs/heads/main/lr_classifier.pkl'
|
| 109 |
+
rule_clf_url = 'https://github.com/zli12321/pedant_models/raw/refs/heads/main/rule_classifier.pkl'
|
| 110 |
+
type_clf_url = 'https://github.com/zli12321/pedant_models/raw/refs/heads/main/type_classifier.pkl'
|
| 111 |
+
vectorizer_url = 'https://github.com/zli12321/pedant_models/raw/refs/heads/main/tf-idf_vectorizer.pkl'
|
| 112 |
+
|
| 113 |
+
|
| 114 |
+
# Download models if necessary (Implementation Detail)
|
| 115 |
+
# The 'if True:' seems redundant, likely placeholder or debug code.
|
| 116 |
+
if True:
|
| 117 |
+
if not os.path.exists(model_dir):
|
| 118 |
+
os.makedirs(model_dir)
|
| 119 |
+
try:
|
| 120 |
+
# Assumes download_link handles download and saving to path
|
| 121 |
+
download_link(model_path, clf_url, 'PEDANT model')
|
| 122 |
+
download_link(vectorizer_path, vectorizer_url, 'Tokenizer')
|
| 123 |
+
download_link(rule_clf_path, rule_clf_url, 'Rule feature extractor')
|
| 124 |
+
download_link(type_clf_path, type_clf_url, 'Type feature extractor')
|
| 125 |
+
except Exception as e:
|
| 126 |
+
# Simple error handling (Implementation Detail)
|
| 127 |
+
print(f"Warning: Model download failed. {e}")
|
| 128 |
+
pass # Continue if download fails, assuming models might exist
|
| 129 |
+
|
| 130 |
+
# Load models using joblib (Implementation Detail)
|
| 131 |
+
try:
|
| 132 |
+
self.model = joblib.load(model_path) # Corresponds to the final LR classifier
|
| 133 |
+
self.tokenizer = joblib.load(vectorizer_path) # Corresponds to the TF-IDF vectorizer
|
| 134 |
+
self.rule_model = joblib.load(rule_clf_path) # Corresponds to F(R)
|
| 135 |
+
self.type_model = joblib.load(type_clf_path) # Corresponds to F(T)
|
| 136 |
+
except FileNotFoundError:
|
| 137 |
+
print("Error: Could not load required model files. Please ensure they are downloaded correctly.")
|
| 138 |
+
# Optionally raise an exception or handle this more gracefully
|
| 139 |
+
raise
|
| 140 |
+
|
| 141 |
+
def download_latest_model(self):
|
| 142 |
+
"""
|
| 143 |
+
Explicitly triggers the download of the latest model files.
|
| 144 |
+
|
| 145 |
+
This function re-runs the download logic from __init__.
|
| 146 |
+
Useful if models need to be updated or download failed initially.
|
| 147 |
+
The mechanism itself is an implementation detail not specified in the paper.
|
| 148 |
+
"""
|
| 149 |
+
current_dir = os.path.dirname(__file__)
|
| 150 |
+
model_dir = os.path.join(current_dir, 'classifier')
|
| 151 |
+
model_path = os.path.join(model_dir, 'lr_classifier.pkl')
|
| 152 |
+
vectorizer_path = os.path.join(model_dir, 'tf-idf_vectorizer.pkl')
|
| 153 |
+
rule_clf_path = os.path.join(model_dir, 'rule_classifier.pkl')
|
| 154 |
+
type_clf_path = os.path.join(model_dir, 'type_classifier.pkl')
|
| 155 |
+
|
| 156 |
+
if not os.path.exists(model_dir):
|
| 157 |
+
os.makedirs(model_dir)
|
| 158 |
+
|
| 159 |
+
# Define URLs to download models from (Implementation Detail)
|
| 160 |
+
clf_url = 'https://github.com/zli12321/pedant_models/raw/refs/heads/main/lr_classifier.pkl'
|
| 161 |
+
rule_clf_url = 'https://github.com/zli12321/pedant_models/raw/refs/heads/main/rule_classifier.pkl'
|
| 162 |
+
type_clf_url = 'https://github.com/zli12321/pedant_models/raw/refs/heads/main/type_classifier.pkl'
|
| 163 |
+
vectorizer_url = 'https://github.com/zli12321/pedant_models/raw/refs/heads/main/tf-idf_vectorizer.pkl'
|
| 164 |
+
|
| 165 |
+
print('Attempting to download latest models to:', model_dir)
|
| 166 |
+
# Assumes download_link handles potential overwrites or versioning if needed
|
| 167 |
+
try:
|
| 168 |
+
download_link(model_path, clf_url, 'PEDANT model')
|
| 169 |
+
download_link(vectorizer_path, vectorizer_url, 'Tokenizer')
|
| 170 |
+
download_link(rule_clf_path, rule_clf_url, 'Rule feature extractor')
|
| 171 |
+
download_link(type_clf_path, type_clf_url, 'Type feature extractor')
|
| 172 |
+
|
| 173 |
+
# Reload models after downloading
|
| 174 |
+
self.model = joblib.load(model_path)
|
| 175 |
+
self.tokenizer = joblib.load(vectorizer_path)
|
| 176 |
+
self.rule_model = joblib.load(rule_clf_path)
|
| 177 |
+
self.type_model = joblib.load(type_clf_path)
|
| 178 |
+
print("Models downloaded and reloaded successfully.")
|
| 179 |
+
except Exception as e:
|
| 180 |
+
print(f"Error during model download/reload: {e}")
|
| 181 |
+
|
| 182 |
+
|
| 183 |
+
def get_rule_features(self, data):
|
| 184 |
+
"""
|
| 185 |
+
Predicts the AC rule probabilities using the rule classifier F(R).
|
| 186 |
+
|
| 187 |
+
Args:
|
| 188 |
+
data: A list of dictionaries, each containing 'question', 'reference',
|
| 189 |
+
and 'candidate' strings.
|
| 190 |
+
|
| 191 |
+
Returns:
|
| 192 |
+
A tuple containing:
|
| 193 |
+
- numpy array of predicted probabilities for each rule for each input.
|
| 194 |
+
- numpy array of predicted log-probabilities for each rule.
|
| 195 |
+
|
| 196 |
+
Functionality and Paper Correspondence:
|
| 197 |
+
- Implements the prediction step for the rule feature extractor F(R).
|
| 198 |
+
- Takes concatenated, normalized, and lemmatized Q, Ref, Cand as input,
|
| 199 |
+
consistent with the paper's description for F(R) input.
|
| 200 |
+
- Uses the TF-IDF tokenizer (`self.tokenizer`) and also incorporates
|
| 201 |
+
F1, Precision, and Recall features (`self.get_f1_features`) as input
|
| 202 |
+
to the rule model, which matches the description for F(R)'s input
|
| 203 |
+
in Algorithm 1.
|
| 204 |
+
- The paper mentions F(R) is a logistic regression classifier.
|
| 205 |
+
The code calls `predict_proba` and `predict_log_proba`, typical methods
|
| 206 |
+
for probabilistic classifiers like Logistic Regression in scikit-learn.
|
| 207 |
+
"""
|
| 208 |
+
# Prepare input text: "[CLS] Q [SEP] Ref [SEP] Cand [SEP]"
|
| 209 |
+
# Apply normalization and lemmatization as described in paper
|
| 210 |
+
inputs = ['[CLS] ' + lemmatize_text(normalize_answer(str(ele['question']))) + \
|
| 211 |
+
' [SEP] ' + lemmatize_text(normalize_answer(str(ele['reference']))) + \
|
| 212 |
+
' [SEP] ' + lemmatize_text(normalize_answer(str(ele['candidate']))) + \
|
| 213 |
+
' [SEP]' for ele in data]
|
| 214 |
+
# Get F1, Precision, Recall features
|
| 215 |
+
f1, p, r = self.get_f1_features(data)
|
| 216 |
+
# Apply TF-IDF vectorization
|
| 217 |
+
inputs = self.tokenizer.transform(inputs)
|
| 218 |
+
# Combine TF-IDF vectors with F1, P, R scores for rule model input
|
| 219 |
+
combined_features = hstack([inputs, f1, p, r])
|
| 220 |
+
# Predict probabilities and log probabilities using the rule model F(R)
|
| 221 |
+
return self.rule_model.predict_proba(combined_features), \
|
| 222 |
+
self.rule_model.predict_log_proba(combined_features)
|
| 223 |
+
|
| 224 |
+
def get_type_features(self, data):
|
| 225 |
+
"""
|
| 226 |
+
Predicts the question type probabilities using the type classifier F(T).
|
| 227 |
+
|
| 228 |
+
Args:
|
| 229 |
+
data: A list of dictionaries, each containing 'question' and 'reference'.
|
| 230 |
+
Note: It only uses question and reference, not candidate, as per paper.
|
| 231 |
+
|
| 232 |
+
Returns:
|
| 233 |
+
A tuple containing:
|
| 234 |
+
- numpy array of predicted probabilities for each type for each input.
|
| 235 |
+
- numpy array of predicted log-probabilities for each type.
|
| 236 |
+
|
| 237 |
+
Functionality and Paper Correspondence:
|
| 238 |
+
- Implements the prediction step for the type feature extractor F(T).
|
| 239 |
+
- Takes concatenated, normalized, and lemmatized Q, Ref as input, which
|
| 240 |
+
matches the paper's description for F(T) input.
|
| 241 |
+
- Uses the TF-IDF tokenizer (`self.tokenizer`).
|
| 242 |
+
- The paper mentions F(T) is a logistic regression classifier.
|
| 243 |
+
The code calls `predict_proba` and `predict_log_proba`.
|
| 244 |
+
"""
|
| 245 |
+
# Prepare input text: "[CLS] Q [SEP] Ref [SEP]"
|
| 246 |
+
# Apply normalization and lemmatization as described in paper
|
| 247 |
+
inputs = ['[CLS] ' + lemmatize_text(normalize_answer(str(ele['question']))) + \
|
| 248 |
+
' [SEP] ' + lemmatize_text(normalize_answer(str(ele['reference']))) + \
|
| 249 |
+
' [SEP]' for ele in data]
|
| 250 |
+
# Apply TF-IDF vectorization
|
| 251 |
+
inputs = self.tokenizer.transform(inputs)
|
| 252 |
+
# Predict probabilities and log probabilities using the type model F(T)
|
| 253 |
+
return self.type_model.predict_proba(inputs), \
|
| 254 |
+
self.type_model.predict_log_proba(inputs)
|
| 255 |
+
|
| 256 |
+
def get_f1_features(self, rule_data):
|
| 257 |
+
"""
|
| 258 |
+
Calculates token-level F1, Precision, and Recall scores.
|
| 259 |
+
|
| 260 |
+
Args:
|
| 261 |
+
rule_data: A list of dictionaries, each containing 'reference' and
|
| 262 |
+
'candidate' strings.
|
| 263 |
+
|
| 264 |
+
Returns:
|
| 265 |
+
A tuple containing numpy arrays (reshaped to Nx1) for:
|
| 266 |
+
- F1 scores
|
| 267 |
+
- Precision scores
|
| 268 |
+
- Recall scores
|
| 269 |
+
|
| 270 |
+
Functionality and Paper Correspondence:
|
| 271 |
+
- Computes standard token-based F1, P, R metrics between reference
|
| 272 |
+
and candidate answers after normalization and lemmatization.
|
| 273 |
+
- These scores are used as features for both the rule classifier F(R)
|
| 274 |
+
and the final PEDANTS classifier.
|
| 275 |
+
- Relies on an external `calculate_f1_score_with_precision` function
|
| 276 |
+
(Implementation Detail).
|
| 277 |
+
"""
|
| 278 |
+
f1_scores, precisions, recalls = [], [], []
|
| 279 |
+
|
| 280 |
+
for i in range(len(rule_data)):
|
| 281 |
+
# Normalize and lemmatize texts before calculating scores
|
| 282 |
+
ref_proc = lemmatize_text(normalize_answer(str(rule_data[i]['reference'])))
|
| 283 |
+
cand_proc = lemmatize_text(normalize_answer(str(rule_data[i]['candidate'])))
|
| 284 |
+
# Assumes calculate_f1_score_with_precision returns (f1, p, r)
|
| 285 |
+
f1, p, r = calculate_f1_score_with_precision(ref_proc, cand_proc)
|
| 286 |
+
f1_scores.append(f1)
|
| 287 |
+
precisions.append(p)
|
| 288 |
+
recalls.append(r)
|
| 289 |
+
|
| 290 |
+
# Reshape to column vectors (Nx1) for use with hstack
|
| 291 |
+
f1_scores=np.array(f1_scores).reshape(-1, 1)
|
| 292 |
+
precisions=np.array(precisions).reshape(-1, 1)
|
| 293 |
+
recalls=np.array(recalls).reshape(-1, 1)
|
| 294 |
+
|
| 295 |
+
return f1_scores, precisions, recalls
|
| 296 |
+
|
| 297 |
+
def construct_features(self, data, with_log_probas=False):
|
| 298 |
+
"""
|
| 299 |
+
Constructs the final feature vector for the PEDANTS classifier.
|
| 300 |
+
|
| 301 |
+
Args:
|
| 302 |
+
data: A list of dictionaries, each containing 'question', 'reference',
|
| 303 |
+
and 'candidate'.
|
| 304 |
+
with_log_probas (bool): If True, includes log probabilities from rule/type
|
| 305 |
+
classifiers in the feature set. Defaults to False.
|
| 306 |
+
|
| 307 |
+
Returns:
|
| 308 |
+
A sparse matrix where each row is the concatenated feature vector for
|
| 309 |
+
an input triplet (q, a, ã).
|
| 310 |
+
|
| 311 |
+
Functionality and Paper Correspondence:
|
| 312 |
+
- Orchestrates the feature extraction process described in Section 3.1.
|
| 313 |
+
- Prepares the "[CLS] Q [SEP] Ref [SEP] Cand [SEP]" input format.
|
| 314 |
+
- Calls `get_f1_features`, `get_rule_features`, `get_type_features`.
|
| 315 |
+
- Applies TF-IDF vectorization (`self.tokenizer`).
|
| 316 |
+
- Concatenates features using `hstack`.
|
| 317 |
+
- The `else` block (`with_log_probas=False`) corresponds most closely to the
|
| 318 |
+
feature set described in the paper for the final classifier:
|
| 319 |
+
Token scores (f1,p,r), Rule features (probabilities), Type features
|
| 320 |
+
(probabilities), and TF-IDF encodings. The order here is
|
| 321 |
+
[f1, p, r, rule_feats, type_feats, in_texts].
|
| 322 |
+
- The `if` block (`with_log_probas=True`) adds log probabilities, which is
|
| 323 |
+
a deviation or alternative configuration not explicitly described for the
|
| 324 |
+
final classifier features in the main text of the paper. The order
|
| 325 |
+
here is [rule_feats, rule_log, type_feats, type_log, in_texts, f1, p, r].
|
| 326 |
+
"""
|
| 327 |
+
in_texts_raw = []
|
| 328 |
+
for ele in data:
|
| 329 |
+
# Prepare raw text for TF-IDF: "[CLS] Q [SEP] Ref [SEP] Cand [SEP]"
|
| 330 |
+
text = '[CLS] ' + lemmatize_text(normalize_answer(str(ele['question']))) + \
|
| 331 |
+
' [SEP] ' + lemmatize_text(normalize_answer(str(ele['reference']))) + \
|
| 332 |
+
' [SEP] ' + lemmatize_text(normalize_answer(str(ele['candidate']))) + \
|
| 333 |
+
' [SEP]'
|
| 334 |
+
in_texts_raw.append(text)
|
| 335 |
+
|
| 336 |
+
# Apply TF-IDF vectorization
|
| 337 |
+
in_texts_tfidf = self.tokenizer.transform(in_texts_raw) #
|
| 338 |
+
|
| 339 |
+
# Get F1, Precision, Recall features
|
| 340 |
+
f1, p, r = self.get_f1_features(data) #
|
| 341 |
+
|
| 342 |
+
# Get Rule features (probabilities and log probabilities)
|
| 343 |
+
rule_feats, rule_log = self.get_rule_features(data) # Corresponds to F(R) output
|
| 344 |
+
|
| 345 |
+
# Get Type features (probabilities and log probabilities)
|
| 346 |
+
type_feats, type_log = self.get_type_features(data) # Corresponds to F(T) output
|
| 347 |
+
|
| 348 |
+
# Combine features based on the flag (Discrepancy noted above)
|
| 349 |
+
if with_log_probas==True:
|
| 350 |
+
# Includes log probabilities - not explicitly mentioned for final classifier in paper
|
| 351 |
+
all_feats = hstack([rule_feats, rule_log, type_feats, type_log, in_texts_tfidf, f1, p, r])
|
| 352 |
+
else:
|
| 353 |
+
# This combination aligns better with the paper's description
|
| 354 |
+
# Order: F1, P, R, Rule Probs, Type Probs, TF-IDF
|
| 355 |
+
all_feats = hstack([f1, p, r, rule_feats, type_feats, in_texts_tfidf])
|
| 356 |
+
# Example commented-out alternative order (Implementation Detail)
|
| 357 |
+
# all_feats = hstack([type_feats, in_texts_tfidf, f1, p, r])
|
| 358 |
+
|
| 359 |
+
return all_feats
|
| 360 |
+
|
| 361 |
+
def get_score(self, reference, candidate, question):
|
| 362 |
+
"""
|
| 363 |
+
Calculates the PEDANTS confidence score for a single QA pair.
|
| 364 |
+
|
| 365 |
+
Args:
|
| 366 |
+
reference (str): The reference answer.
|
| 367 |
+
candidate (str): The candidate answer.
|
| 368 |
+
question (str): The question.
|
| 369 |
+
|
| 370 |
+
Returns:
|
| 371 |
+
float: The confidence score (probability of correctness) between 0.0 and 1.0.
|
| 372 |
+
|
| 373 |
+
Functionality and Paper Correspondence:
|
| 374 |
+
- Provides the core evaluation score output by PEDANTS.
|
| 375 |
+
- Preprocesses inputs (normalization, lemmatization).
|
| 376 |
+
- Constructs the feature vector using `construct_features`.
|
| 377 |
+
- Uses the main logistic regression model (`self.model`) to predict the
|
| 378 |
+
probability of correctness.
|
| 379 |
+
- Extracts the probability of the first class (assumed 'correct').
|
| 380 |
+
- Includes an exact match shortcut (`if reference in candidate:`), which is
|
| 381 |
+
an implementation detail not described in the paper's core model.
|
| 382 |
+
"""
|
| 383 |
+
# Preprocessing
|
| 384 |
+
reference_proc = lemmatize_text(normalize_answer(str(reference)))
|
| 385 |
+
candidate_proc = lemmatize_text(normalize_answer(str(candidate)))
|
| 386 |
+
question_proc = lemmatize_text(normalize_answer(str(question)))
|
| 387 |
+
|
| 388 |
+
# Exact match shortcut (Implementation Detail/Heuristic)
|
| 389 |
+
if reference_proc in candidate_proc:
|
| 390 |
+
return 1.0
|
| 391 |
+
|
| 392 |
+
# Prepare data in the expected dictionary format
|
| 393 |
+
data = [{
|
| 394 |
+
'reference': reference_proc,
|
| 395 |
+
'candidate': candidate_proc,
|
| 396 |
+
'question': question_proc
|
| 397 |
+
}]
|
| 398 |
+
|
| 399 |
+
# Construct features (using the default `with_log_probas=False`)
|
| 400 |
+
feature = self.construct_features(data)
|
| 401 |
+
# Predict probabilities using the final logistic regression model
|
| 402 |
+
pred_probas = self.model.predict_proba(feature)
|
| 403 |
+
# Return the probability of the first class (assumed 'correct')
|
| 404 |
+
return pred_probas[0][0]
|
| 405 |
+
|
| 406 |
+
def get_scores(self, reference, candidate, question):
|
| 407 |
+
"""
|
| 408 |
+
Calculates PEDANTS confidence scores when reference and/or candidate
|
| 409 |
+
answers might be lists.
|
| 410 |
+
|
| 411 |
+
Args:
|
| 412 |
+
reference (str or list): Reference answer(s).
|
| 413 |
+
candidate (str or list): Candidate answer(s).
|
| 414 |
+
question (str): The question.
|
| 415 |
+
|
| 416 |
+
Returns:
|
| 417 |
+
dict: A nested dictionary storing scores for all reference-candidate pairs.
|
| 418 |
+
Format: {ref1: {cand1: score1, cand2: score2}, ref2: ...}
|
| 419 |
+
|
| 420 |
+
Functionality and Paper Correspondence:
|
| 421 |
+
- Extends `get_score` to handle multiple answers by iterating through all
|
| 422 |
+
possible pairs. This multi-answer handling is an implementation choice
|
| 423 |
+
built upon the single-pair `get_score` function. The paper focuses on
|
| 424 |
+
evaluating a single (q, a, ã) triplet.
|
| 425 |
+
"""
|
| 426 |
+
confidence_scores = {}
|
| 427 |
+
# Ensure reference and candidate are lists for iteration
|
| 428 |
+
references = reference if isinstance(reference, list) else [reference]
|
| 429 |
+
candidates = candidate if isinstance(candidate, list) else [candidate]
|
| 430 |
+
|
| 431 |
+
# Iterate through all pairs and get scores
|
| 432 |
+
for ref in references:
|
| 433 |
+
if ref not in confidence_scores:
|
| 434 |
+
confidence_scores[ref] = {}
|
| 435 |
+
for cand in candidates:
|
| 436 |
+
# Calls the single-pair scoring function
|
| 437 |
+
score = self.get_score(ref, cand, question)
|
| 438 |
+
confidence_scores[ref][cand] = score
|
| 439 |
+
|
| 440 |
+
return confidence_scores
|
| 441 |
+
|
| 442 |
+
|
| 443 |
+
def get_question_type(self, reference, question):
|
| 444 |
+
"""
|
| 445 |
+
Predicts the type(s) of the question using the type classifier F(T).
|
| 446 |
+
|
| 447 |
+
Args:
|
| 448 |
+
reference (str or list): The reference answer(s). Used with the question
|
| 449 |
+
as input to the type classifier.
|
| 450 |
+
question (str): The question.
|
| 451 |
+
|
| 452 |
+
Returns:
|
| 453 |
+
str or list: The predicted question type(s) (e.g., 'who', 'what').
|
| 454 |
+
Returns a list of unique types if reference is a list.
|
| 455 |
+
|
| 456 |
+
Functionality and Paper Correspondence:
|
| 457 |
+
- Provides direct access to the predictions of the F(T) classifier.
|
| 458 |
+
- Uses "[CLS] Q [SEP] Ref [SEP]" input format and TF-IDF.
|
| 459 |
+
- Handles list input for references (Implementation Detail).
|
| 460 |
+
- Returns the predicted class label directly (`predict` method).
|
| 461 |
+
"""
|
| 462 |
+
if isinstance(reference, list):
|
| 463 |
+
# Handle multiple references
|
| 464 |
+
inputs_raw = ['[CLS] ' + lemmatize_text(normalize_answer(str(question))) + \
|
| 465 |
+
' [SEP] ' + lemmatize_text(normalize_answer(str(ref))) + \
|
| 466 |
+
' [SEP]' for ref in reference]
|
| 467 |
+
inputs_tfidf = self.tokenizer.transform(inputs_raw)
|
| 468 |
+
# Predict types for all references
|
| 469 |
+
outs = self.type_model.predict(inputs_tfidf)
|
| 470 |
+
# Return unique predicted types
|
| 471 |
+
return list(set(outs))
|
| 472 |
+
else:
|
| 473 |
+
# Handle single reference
|
| 474 |
+
inputs_raw = ['[CLS] ' + lemmatize_text(normalize_answer(str(question))) + \
|
| 475 |
+
' [SEP] ' + lemmatize_text(normalize_answer(str(reference))) + \
|
| 476 |
+
' [SEP]']
|
| 477 |
+
inputs_tfidf = self.tokenizer.transform(inputs_raw)
|
| 478 |
+
# Predict and return the single type
|
| 479 |
+
return self.type_model.predict(inputs_tfidf)[0]
|
| 480 |
+
|
| 481 |
+
def get_judgement_rule(self, reference, candidate, question):
|
| 482 |
+
"""
|
| 483 |
+
Predicts the applicable AC rule(s) using the rule classifier F(R).
|
| 484 |
+
|
| 485 |
+
Args:
|
| 486 |
+
reference (str or list): The reference answer(s).
|
| 487 |
+
candidate (str): The candidate answer.
|
| 488 |
+
question (str): The question.
|
| 489 |
+
|
| 490 |
+
Returns:
|
| 491 |
+
str or list: The description(s) of the predicted rule(s) from Table 1.
|
| 492 |
+
Returns a list of unique rule descriptions if reference is a list.
|
| 493 |
+
|
| 494 |
+
Functionality and Paper Correspondence:
|
| 495 |
+
- Provides direct access to the predictions of the F(R) classifier.
|
| 496 |
+
- Uses "[CLS] Q [SEP] Ref [SEP] Cand [SEP]" input format, TF-IDF, and
|
| 497 |
+
F1/P/R features.
|
| 498 |
+
- Handles list input for references (Implementation Detail).
|
| 499 |
+
- Returns the predicted class label (`predict` method) and maps it to the
|
| 500 |
+
rule description text.
|
| 501 |
+
- Contains a hardcoded list of rule descriptions matching Table 1.
|
| 502 |
+
(Implementation Detail).
|
| 503 |
+
- Note: The code maps the predicted index `idx` directly to `rules[idx]`. If the
|
| 504 |
+
classifier outputs 1-based indices (as suggested by `[0]-1` later), this might
|
| 505 |
+
be slightly off unless the classes are 0-indexed internally. The `[0]-1` in the
|
| 506 |
+
`else` block suggests the model might output 1-based indices, requiring adjustment.
|
| 507 |
+
"""
|
| 508 |
+
# Hardcoded rule descriptions from paper Table 1(Implementation Detail)
|
| 509 |
+
rules_text = [
|
| 510 |
+
'Widely recognized aliases, pseudonyms that are commonly associated with referred answer entities are acceptable.', # R1
|
| 511 |
+
'Exact dates, years, numerical values are required unless the question specifically asks for approximations.', # R2
|
| 512 |
+
'The answer provides less detail but should include the essential and correct information required by the question (specificity level 1).', # R3
|
| 513 |
+
'The answer contains additional information that does not contradict the question or initial answer (specificity level 2).', # R4
|
| 514 |
+
'A high degree of word overlap does not establish equivalence. The answer must be contextually and semantically accurate.', # R5
|
| 515 |
+
'Any irrelevant or inaccurate description related to the question should be considered incorrect.', # R6
|
| 516 |
+
'The response is correct but not in the initially provided list.' # R7
|
| 517 |
+
]
|
| 518 |
+
|
| 519 |
+
if isinstance(reference, list):
|
| 520 |
+
# Handle multiple references
|
| 521 |
+
data = [{'question': question, 'reference': ref, 'candidate': candidate}
|
| 522 |
+
for ref in reference]
|
| 523 |
+
inputs_raw = ['[CLS] ' + lemmatize_text(normalize_answer(str(ele['question']))) + \
|
| 524 |
+
' [SEP] ' + lemmatize_text(normalize_answer(str(ele['reference']))) + \
|
| 525 |
+
' [SEP] ' + lemmatize_text(normalize_answer(str(ele['candidate']))) + \
|
| 526 |
+
' [SEP]' for ele in data]
|
| 527 |
+
f1, p, r = self.get_f1_features(data)
|
| 528 |
+
inputs_tfidf = self.tokenizer.transform(inputs_raw)
|
| 529 |
+
combined_features = hstack([inputs_tfidf, f1, p, r]) # Input for F(R)
|
| 530 |
+
# Predict rule indices
|
| 531 |
+
out_rule_indices = self.rule_model.predict(combined_features)
|
| 532 |
+
# Map indices to rule text descriptions
|
| 533 |
+
# Assuming predict returns 0-based indices matching rules_text list
|
| 534 |
+
predicted_rules = [rules_text[idx] for idx in out_rule_indices if 0 <= idx < len(rules_text)]
|
| 535 |
+
return list(set(predicted_rules)) # Return unique rule descriptions
|
| 536 |
+
else:
|
| 537 |
+
# Handle single reference
|
| 538 |
+
data = [{'question': question, 'reference': reference, 'candidate': candidate}]
|
| 539 |
+
inputs_raw = ['[CLS] ' + lemmatize_text(normalize_answer(str(ele['question']))) + \
|
| 540 |
+
' [SEP] ' + lemmatize_text(normalize_answer(str(ele['reference']))) + \
|
| 541 |
+
' [SEP] ' + lemmatize_text(normalize_answer(str(ele['candidate']))) + \
|
| 542 |
+
' [SEP]' for ele in data]
|
| 543 |
+
f1, p, r = self.get_f1_features(data)
|
| 544 |
+
inputs_tfidf = self.tokenizer.transform(inputs_raw)
|
| 545 |
+
combined_features = hstack([inputs_tfidf, f1, p, r]) # Input for F(R)
|
| 546 |
+
# Predict rule index
|
| 547 |
+
predicted_index = self.rule_model.predict(combined_features)[0]
|
| 548 |
+
# Map index to rule text description.
|
| 549 |
+
# The '-1' suggests the model might output 1-based indices.
|
| 550 |
+
# Adjusting to be safe for 0-based list index.
|
| 551 |
+
rule_index = predicted_index - 1 if predicted_index > 0 else 0 # Map potentially 1-based to 0-based
|
| 552 |
+
if 0 <= rule_index < len(rules_text):
|
| 553 |
+
return rules_text[rule_index]
|
| 554 |
+
else:
|
| 555 |
+
return "Unknown Rule Index" # Handle invalid index
|
| 556 |
+
|
| 557 |
+
def get_highest_score(self, reference, candidate, question):
|
| 558 |
+
"""
|
| 559 |
+
Finds the reference-candidate pair with the highest PEDANTS score.
|
| 560 |
+
|
| 561 |
+
Args:
|
| 562 |
+
reference (str or list): Reference answer(s).
|
| 563 |
+
candidate (str or list): Candidate answer(s).
|
| 564 |
+
question (str): The question.
|
| 565 |
+
|
| 566 |
+
Returns:
|
| 567 |
+
tuple: ( (best_ref, best_cand), max_score )
|
| 568 |
+
|
| 569 |
+
Functionality and Paper Correspondence:
|
| 570 |
+
- A utility function built on top of `get_scores`. It provides a way to select
|
| 571 |
+
the 'best' match when multiple references or candidates are provided, based
|
| 572 |
+
on the PEDANTS score. This specific strategy (highest score wins) is an
|
| 573 |
+
implementation choice for handling multiple answers, not explicitly detailed
|
| 574 |
+
as part of the core PEDANTS definition in the paper.
|
| 575 |
+
"""
|
| 576 |
+
# Get scores for all pairs
|
| 577 |
+
confidence_scores = self.get_scores(reference, candidate, question)
|
| 578 |
+
|
| 579 |
+
max_score = -1.0
|
| 580 |
+
max_pair = (None, None)
|
| 581 |
+
|
| 582 |
+
# Find the pair with the maximum score
|
| 583 |
+
for ref, candidates_dict in confidence_scores.items():
|
| 584 |
+
for cand, score in candidates_dict.items():
|
| 585 |
+
if score > max_score:
|
| 586 |
+
max_score = score
|
| 587 |
+
max_pair = (ref, cand)
|
| 588 |
+
|
| 589 |
+
return max_pair, max_score
|
| 590 |
+
|
| 591 |
+
|
| 592 |
+
def evaluate(self, reference, candidate, question):
|
| 593 |
+
"""
|
| 594 |
+
Evaluates whether the candidate answer is correct based on PEDANTS,
|
| 595 |
+
handling list inputs for reference and candidate answers.
|
| 596 |
+
|
| 597 |
+
Args:
|
| 598 |
+
reference (str or list): Reference answer(s).
|
| 599 |
+
candidate (str or list): Candidate answer(s).
|
| 600 |
+
question (str): The question.
|
| 601 |
+
|
| 602 |
+
Returns:
|
| 603 |
+
bool: True if any reference-candidate pair is judged correct by the
|
| 604 |
+
PEDANTS model (or passes the exact match shortcut), False otherwise.
|
| 605 |
+
|
| 606 |
+
Functionality and Paper Correspondence:
|
| 607 |
+
- Provides a binary correctness judgment.
|
| 608 |
+
- Preprocesses inputs (normalization, lemmatization).
|
| 609 |
+
- Handles list inputs by checking all pairs. If any pair is deemed correct
|
| 610 |
+
(either by the model prediction 'correct' or the exact match shortcut),
|
| 611 |
+
it returns True. This aggregation logic for multiple answers is an
|
| 612 |
+
implementation detail.
|
| 613 |
+
- Uses the exact match shortcut (`if reference in candidate:`) before
|
| 614 |
+
constructing features and calling the model (Implementation Detail).
|
| 615 |
+
- Constructs features for all relevant pairs using `construct_features`.
|
| 616 |
+
- Uses the main model's `predict` method to get class labels ('correct'/'incorrect').
|
| 617 |
+
"""
|
| 618 |
+
# Preprocess inputs first
|
| 619 |
+
references_proc = [lemmatize_text(normalize_answer(str(ele))) for ele in reference] if isinstance(reference, list) else [lemmatize_text(normalize_answer(str(reference)))]
|
| 620 |
+
candidates_proc = [lemmatize_text(normalize_answer(str(ele))) for ele in candidate] if isinstance(candidate, list) else [lemmatize_text(normalize_answer(str(candidate)))]
|
| 621 |
+
question_proc = lemmatize_text(normalize_answer(str(question)))
|
| 622 |
+
|
| 623 |
+
input_pairs_for_model = [] # Store pairs that need model evaluation
|
| 624 |
+
|
| 625 |
+
# Check all pairs for exact match shortcut first
|
| 626 |
+
for cand_p in candidates_proc:
|
| 627 |
+
for ref_p in references_proc:
|
| 628 |
+
if ref_p in cand_p: # Exact match shortcut (Implementation Detail)
|
| 629 |
+
return True
|
| 630 |
+
else:
|
| 631 |
+
# If no shortcut, add to list for model prediction
|
| 632 |
+
input_pairs_for_model.append({
|
| 633 |
+
'reference': ref_p,
|
| 634 |
+
'candidate': cand_p,
|
| 635 |
+
'question': question_proc
|
| 636 |
+
})
|
| 637 |
+
|
| 638 |
+
# If no pairs passed the shortcut and there are pairs to check
|
| 639 |
+
if not input_pairs_for_model:
|
| 640 |
+
# This happens if inputs were empty lists or only one empty string was passed initially.
|
| 641 |
+
# Or if the only pair passed the shortcut check already returned True.
|
| 642 |
+
return False # Or handle based on desired behavior for empty/shortcut cases
|
| 643 |
+
|
| 644 |
+
|
| 645 |
+
# Construct features and predict for pairs needing model evaluation
|
| 646 |
+
features = self.construct_features(input_pairs_for_model)
|
| 647 |
+
preds = self.model.predict(features) # Get class labels
|
| 648 |
+
|
| 649 |
+
# Check if any prediction is 'correct'
|
| 650 |
+
if "correct" in preds:
|
| 651 |
+
return True # Judged correct by the model
|
| 652 |
+
|
| 653 |
+
# If no pair passed the shortcut and no pair was predicted as 'correct'
|
| 654 |
+
return False
|
annotations/annotation_1/function_info.json
ADDED
|
@@ -0,0 +1,641 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
[
|
| 2 |
+
{
|
| 3 |
+
"function_name": "PEDANT.__init__",
|
| 4 |
+
"file_path": "qa_metrics/pedant.py",
|
| 5 |
+
"function_calls": [
|
| 6 |
+
{
|
| 7 |
+
"function_call_name": "os.path.dirname()",
|
| 8 |
+
"functionality": "Return the directory name of pathname.",
|
| 9 |
+
"input": "path (str or bytes) - Path to get the directory name from.",
|
| 10 |
+
"output": "Directory name (str or bytes).",
|
| 11 |
+
"location_or_namespace": "os.path"
|
| 12 |
+
},
|
| 13 |
+
{
|
| 14 |
+
"function_call_name": "os.path.join()",
|
| 15 |
+
"functionality": "Join one or more path components intelligently.",
|
| 16 |
+
"input": "*paths (str or bytes) - Multiple path components.",
|
| 17 |
+
"output": "Joined path (str or bytes).",
|
| 18 |
+
"location_or_namespace": "os.path"
|
| 19 |
+
},
|
| 20 |
+
{
|
| 21 |
+
"function_call_name": "os.path.exists()",
|
| 22 |
+
"functionality": "Return True if path refers to an existing path or an open file descriptor.",
|
| 23 |
+
"input": "path (str or bytes) - Path to check.",
|
| 24 |
+
"output": "Boolean indicating existence.",
|
| 25 |
+
"location_or_namespace": "os.path"
|
| 26 |
+
},
|
| 27 |
+
{
|
| 28 |
+
"function_call_name": "os.makedirs()",
|
| 29 |
+
"functionality": "Recursive directory creation function.",
|
| 30 |
+
"input": "name (str), mode (int, optional), exist_ok (bool, optional)",
|
| 31 |
+
"output": "None",
|
| 32 |
+
"location_or_namespace": "os"
|
| 33 |
+
},
|
| 34 |
+
{
|
| 35 |
+
"function_call_name": "download_link()",
|
| 36 |
+
"functionality": "Downloads a file from a URL to a local path (Assumed function).",
|
| 37 |
+
"input": "path (str), url (str), name (str)",
|
| 38 |
+
"output": "",
|
| 39 |
+
"location_or_namespace": "qa_metrics/utils/tools.py"
|
| 40 |
+
},
|
| 41 |
+
{
|
| 42 |
+
"function_call_name": "print()",
|
| 43 |
+
"functionality": "Prints objects to the text stream file.",
|
| 44 |
+
"input": "*objects, sep=' ', end='\\n', file=sys.stdout, flush=False",
|
| 45 |
+
"output": "None",
|
| 46 |
+
"location_or_namespace": "builtins"
|
| 47 |
+
},
|
| 48 |
+
{
|
| 49 |
+
"function_call_name": "joblib.load()",
|
| 50 |
+
"functionality": "Load an object pickled with joblib.dump.",
|
| 51 |
+
"input": "filename (str or pathlib.Path), mmap_mode (str, optional)",
|
| 52 |
+
"output": "The loaded object.",
|
| 53 |
+
"location_or_namespace": "joblib"
|
| 54 |
+
}
|
| 55 |
+
]
|
| 56 |
+
},
|
| 57 |
+
{
|
| 58 |
+
"function_name": "PEDANT.download_latest_model",
|
| 59 |
+
"file_path": "qa_metrics/pedant.py",
|
| 60 |
+
"function_calls": [
|
| 61 |
+
{
|
| 62 |
+
"function_call_name": "os.path.dirname()",
|
| 63 |
+
"functionality": "Return the directory name of pathname.",
|
| 64 |
+
"input": "path (str or bytes) - Path to get the directory name from.",
|
| 65 |
+
"output": "Directory name (str or bytes).",
|
| 66 |
+
"location_or_namespace": "os.path"
|
| 67 |
+
},
|
| 68 |
+
{
|
| 69 |
+
"function_call_name": "os.path.join()",
|
| 70 |
+
"functionality": "Join one or more path components intelligently.",
|
| 71 |
+
"input": "*paths (str or bytes) - Multiple path components.",
|
| 72 |
+
"output": "Joined path (str or bytes).",
|
| 73 |
+
"location_or_namespace": "os.path"
|
| 74 |
+
},
|
| 75 |
+
{
|
| 76 |
+
"function_call_name": "os.path.exists()",
|
| 77 |
+
"functionality": "Return True if path refers to an existing path or an open file descriptor.",
|
| 78 |
+
"input": "path (str or bytes) - Path to check.",
|
| 79 |
+
"output": "Boolean indicating existence.",
|
| 80 |
+
"location_or_namespace": "os.path"
|
| 81 |
+
},
|
| 82 |
+
{
|
| 83 |
+
"function_call_name": "os.makedirs()",
|
| 84 |
+
"functionality": "Recursive directory creation function.",
|
| 85 |
+
"input": "name (str), mode (int, optional), exist_ok (bool, optional)",
|
| 86 |
+
"output": "None",
|
| 87 |
+
"location_or_namespace": "os"
|
| 88 |
+
},
|
| 89 |
+
{
|
| 90 |
+
"function_call_name": "print()",
|
| 91 |
+
"functionality": "Prints objects to the text stream file.",
|
| 92 |
+
"input": "*objects, sep=' ', end='\\n', file=sys.stdout, flush=False",
|
| 93 |
+
"output": "None",
|
| 94 |
+
"location_or_namespace": "builtins"
|
| 95 |
+
},
|
| 96 |
+
{
|
| 97 |
+
"function_call_name": "download_link()",
|
| 98 |
+
"functionality": "Downloads a file from a URL to a local path (Assumed function).",
|
| 99 |
+
"input": "path (str), url (str), name (str)",
|
| 100 |
+
"output": "",
|
| 101 |
+
"location_or_namespace": "qa_metrics/utils/tools.py"
|
| 102 |
+
},
|
| 103 |
+
{
|
| 104 |
+
"function_call_name": "joblib.load()",
|
| 105 |
+
"functionality": "Load an object pickled with joblib.dump.",
|
| 106 |
+
"input": "filename (str or pathlib.Path), mmap_mode (str, optional)",
|
| 107 |
+
"output": "The loaded object.",
|
| 108 |
+
"location_or_namespace": "joblib"
|
| 109 |
+
}
|
| 110 |
+
]
|
| 111 |
+
},
|
| 112 |
+
{
|
| 113 |
+
"function_name": "PEDANT.get_rule_features",
|
| 114 |
+
"file_path": "qa_metrics/pedant.py",
|
| 115 |
+
"function_calls": [
|
| 116 |
+
{
|
| 117 |
+
"function_call_name": "lemmatize_text()",
|
| 118 |
+
"functionality": "Applies lemmatization to the input text (Assumed function).",
|
| 119 |
+
"input": "text (str)",
|
| 120 |
+
"output": "Lemmatized text (str).",
|
| 121 |
+
"location_or_namespace": "qa_metrics/utils/tools.py"
|
| 122 |
+
},
|
| 123 |
+
{
|
| 124 |
+
"function_call_name": "normalize_answer()",
|
| 125 |
+
"functionality": "Normalizes the answer text (e.g., lowercasing, removing punctuation) (Assumed function).",
|
| 126 |
+
"input": "text (str)",
|
| 127 |
+
"output": "Normalized text (str).",
|
| 128 |
+
"location_or_namespace": "qa_metrics/utils/tools.py"
|
| 129 |
+
},
|
| 130 |
+
{
|
| 131 |
+
"function_call_name": "str()",
|
| 132 |
+
"functionality": "Return a string version of object.",
|
| 133 |
+
"input": "object",
|
| 134 |
+
"output": "String representation of object.",
|
| 135 |
+
"location_or_namespace": "builtins"
|
| 136 |
+
},
|
| 137 |
+
{
|
| 138 |
+
"function_call_name": "self.get_f1_features()",
|
| 139 |
+
"functionality": "Calculates token-level F1, Precision, and Recall scores.",
|
| 140 |
+
"input": "rule_data (list of dict)",
|
| 141 |
+
"output": "Tuple of numpy arrays (f1_scores, precisions, recalls).",
|
| 142 |
+
"location_or_namespace": "self (PEDANT)"
|
| 143 |
+
},
|
| 144 |
+
{
|
| 145 |
+
"function_call_name": "self.tokenizer.transform()",
|
| 146 |
+
"functionality": "Transforms text data into TF-IDF vectors using the loaded tokenizer.",
|
| 147 |
+
"input": "raw_documents (iterable)",
|
| 148 |
+
"output": "Sparse matrix of TF-IDF vectors.",
|
| 149 |
+
"location_or_namespace": "self.tokenizer (loaded TF-IDF vectorizer)"
|
| 150 |
+
},
|
| 151 |
+
{
|
| 152 |
+
"function_call_name": "hstack()",
|
| 153 |
+
"functionality": "Stack sparse matrices horizontally (column wise).",
|
| 154 |
+
"input": "blocks (sequence of sparse matrices), format=None, dtype=None",
|
| 155 |
+
"output": "Stacked sparse matrix.",
|
| 156 |
+
"location_or_namespace": "scipy.sparse"
|
| 157 |
+
},
|
| 158 |
+
{
|
| 159 |
+
"function_call_name": "self.rule_model.predict_proba()",
|
| 160 |
+
"functionality": "Predicts class probabilities using the loaded rule classifier.",
|
| 161 |
+
"input": "X (array-like or sparse matrix)",
|
| 162 |
+
"output": "Array of class probabilities.",
|
| 163 |
+
"location_or_namespace": "self.rule_model (loaded classifier)"
|
| 164 |
+
},
|
| 165 |
+
{
|
| 166 |
+
"function_call_name": "self.rule_model.predict_log_proba()",
|
| 167 |
+
"functionality": "Predicts class log-probabilities using the loaded rule classifier.",
|
| 168 |
+
"input": "X (array-like or sparse matrix)",
|
| 169 |
+
"output": "Array of class log-probabilities.",
|
| 170 |
+
"location_or_namespace": "self.rule_model (loaded classifier)"
|
| 171 |
+
}
|
| 172 |
+
]
|
| 173 |
+
},
|
| 174 |
+
{
|
| 175 |
+
"function_name": "PEDANT.get_type_features",
|
| 176 |
+
"file_path": "qa_metrics/pedant.py",
|
| 177 |
+
"function_calls": [
|
| 178 |
+
{
|
| 179 |
+
"function_call_name": "lemmatize_text()",
|
| 180 |
+
"functionality": "Applies lemmatization to the input text (Assumed function).",
|
| 181 |
+
"input": "text (str)",
|
| 182 |
+
"output": "Lemmatized text (str).",
|
| 183 |
+
"location_or_namespace": "qa_metrics/utils/tools.py"
|
| 184 |
+
},
|
| 185 |
+
{
|
| 186 |
+
"function_call_name": "normalize_answer()",
|
| 187 |
+
"functionality": "Normalizes the answer text (e.g., lowercasing, removing punctuation) (Assumed function).",
|
| 188 |
+
"input": "text (str)",
|
| 189 |
+
"output": "Normalized text (str).",
|
| 190 |
+
"location_or_namespace": "qa_metrics/utils/tools.py"
|
| 191 |
+
},
|
| 192 |
+
{
|
| 193 |
+
"function_call_name": "str()",
|
| 194 |
+
"functionality": "Return a string version of object.",
|
| 195 |
+
"input": "object",
|
| 196 |
+
"output": "String representation of object.",
|
| 197 |
+
"location_or_namespace": "builtins"
|
| 198 |
+
},
|
| 199 |
+
{
|
| 200 |
+
"function_call_name": "self.tokenizer.transform()",
|
| 201 |
+
"functionality": "Transforms text data into TF-IDF vectors using the loaded tokenizer.",
|
| 202 |
+
"input": "raw_documents (iterable)",
|
| 203 |
+
"output": "Sparse matrix of TF-IDF vectors.",
|
| 204 |
+
"location_or_namespace": "self.tokenizer (loaded TF-IDF vectorizer)"
|
| 205 |
+
},
|
| 206 |
+
{
|
| 207 |
+
"function_call_name": "self.type_model.predict_proba()",
|
| 208 |
+
"functionality": "Predicts class probabilities using the loaded type classifier.",
|
| 209 |
+
"input": "X (array-like or sparse matrix)",
|
| 210 |
+
"output": "Array of class probabilities.",
|
| 211 |
+
"location_or_namespace": "self.type_model (loaded classifier)"
|
| 212 |
+
},
|
| 213 |
+
{
|
| 214 |
+
"function_call_name": "self.type_model.predict_log_proba()",
|
| 215 |
+
"functionality": "Predicts class log-probabilities using the loaded type classifier.",
|
| 216 |
+
"input": "X (array-like or sparse matrix)",
|
| 217 |
+
"output": "Array of class log-probabilities.",
|
| 218 |
+
"location_or_namespace": "self.type_model (loaded classifier)"
|
| 219 |
+
}
|
| 220 |
+
]
|
| 221 |
+
},
|
| 222 |
+
{
|
| 223 |
+
"function_name": "PEDANT.get_f1_features",
|
| 224 |
+
"file_path": "qa_metrics/pedant.py",
|
| 225 |
+
"function_calls": [
|
| 226 |
+
{
|
| 227 |
+
"function_call_name": "len()",
|
| 228 |
+
"functionality": "Return the number of items in a container.",
|
| 229 |
+
"input": "container",
|
| 230 |
+
"output": "Integer length.",
|
| 231 |
+
"location_or_namespace": "builtins"
|
| 232 |
+
},
|
| 233 |
+
{
|
| 234 |
+
"function_call_name": "range()",
|
| 235 |
+
"functionality": "Returns a sequence of numbers.",
|
| 236 |
+
"input": "stop or start, stop[, step]",
|
| 237 |
+
"output": "Range object.",
|
| 238 |
+
"location_or_namespace": "builtins"
|
| 239 |
+
},
|
| 240 |
+
{
|
| 241 |
+
"function_call_name": "lemmatize_text()",
|
| 242 |
+
"functionality": "Applies lemmatization to the input text (Assumed function).",
|
| 243 |
+
"input": "text (str)",
|
| 244 |
+
"output": "Lemmatized text (str).",
|
| 245 |
+
"location_or_namespace": "qa_metrics/utils/tools.py"
|
| 246 |
+
},
|
| 247 |
+
{
|
| 248 |
+
"function_call_name": "normalize_answer()",
|
| 249 |
+
"functionality": "Normalizes the answer text (e.g., lowercasing, removing punctuation) (Assumed function).",
|
| 250 |
+
"input": "text (str)",
|
| 251 |
+
"output": "Normalized text (str).",
|
| 252 |
+
"location_or_namespace": "qa_metrics/utils/tools.py"
|
| 253 |
+
},
|
| 254 |
+
{
|
| 255 |
+
"function_call_name": "str()",
|
| 256 |
+
"functionality": "Return a string version of object.",
|
| 257 |
+
"input": "object",
|
| 258 |
+
"output": "String representation of object.",
|
| 259 |
+
"location_or_namespace": "builtins"
|
| 260 |
+
},
|
| 261 |
+
{
|
| 262 |
+
"function_call_name": "calculate_f1_score_with_precision()",
|
| 263 |
+
"functionality": "Calculates token-level F1, precision, and recall (Assumed function).",
|
| 264 |
+
"input": "reference_text (str), candidate_text (str)",
|
| 265 |
+
"output": "Tuple (f1, precision, recall).",
|
| 266 |
+
"location_or_namespace": "qa_metrics/utils/tools.py"
|
| 267 |
+
},
|
| 268 |
+
{
|
| 269 |
+
"function_call_name": "list.append()",
|
| 270 |
+
"functionality": "Append object to the end of the list.",
|
| 271 |
+
"input": "object",
|
| 272 |
+
"output": "None",
|
| 273 |
+
"location_or_namespace": "list"
|
| 274 |
+
},
|
| 275 |
+
{
|
| 276 |
+
"function_call_name": "np.array()",
|
| 277 |
+
"functionality": "Create a NumPy array.",
|
| 278 |
+
"input": "object, dtype=None, copy=True, order='K', subok=False, ndmin=0",
|
| 279 |
+
"output": "NumPy array.",
|
| 280 |
+
"location_or_namespace": "numpy"
|
| 281 |
+
},
|
| 282 |
+
{
|
| 283 |
+
"function_call_name": "numpy.ndarray.reshape()",
|
| 284 |
+
"functionality": "Gives a new shape to an array without changing its data.",
|
| 285 |
+
"input": "shape (int or tuple of ints), order='C'",
|
| 286 |
+
"output": "Reshaped array.",
|
| 287 |
+
"location_or_namespace": "numpy.ndarray"
|
| 288 |
+
}
|
| 289 |
+
]
|
| 290 |
+
},
|
| 291 |
+
{
|
| 292 |
+
"function_name": "PEDANT.construct_features",
|
| 293 |
+
"file_path": "qa_metrics/pedant.py",
|
| 294 |
+
"function_calls": [
|
| 295 |
+
{
|
| 296 |
+
"function_call_name": "lemmatize_text()",
|
| 297 |
+
"functionality": "Applies lemmatization to the input text (Assumed function).",
|
| 298 |
+
"input": "text (str)",
|
| 299 |
+
"output": "Lemmatized text (str).",
|
| 300 |
+
"location_or_namespace": "qa_metrics/utils/tools.py"
|
| 301 |
+
},
|
| 302 |
+
{
|
| 303 |
+
"function_call_name": "normalize_answer()",
|
| 304 |
+
"functionality": "Normalizes the answer text (e.g., lowercasing, removing punctuation) (Assumed function).",
|
| 305 |
+
"input": "text (str)",
|
| 306 |
+
"output": "Normalized text (str).",
|
| 307 |
+
"location_or_namespace": "qa_metrics/utils/tools.py"
|
| 308 |
+
},
|
| 309 |
+
{
|
| 310 |
+
"function_call_name": "str()",
|
| 311 |
+
"functionality": "Return a string version of object.",
|
| 312 |
+
"input": "object",
|
| 313 |
+
"output": "String representation of object.",
|
| 314 |
+
"location_or_namespace": "builtins"
|
| 315 |
+
},
|
| 316 |
+
{
|
| 317 |
+
"function_call_name": "list.append()",
|
| 318 |
+
"functionality": "Append object to the end of the list.",
|
| 319 |
+
"input": "object",
|
| 320 |
+
"output": "None",
|
| 321 |
+
"location_or_namespace": "list"
|
| 322 |
+
},
|
| 323 |
+
{
|
| 324 |
+
"function_call_name": "self.tokenizer.transform()",
|
| 325 |
+
"functionality": "Transforms text data into TF-IDF vectors using the loaded tokenizer.",
|
| 326 |
+
"input": "raw_documents (iterable)",
|
| 327 |
+
"output": "Sparse matrix of TF-IDF vectors.",
|
| 328 |
+
"location_or_namespace": "self.tokenizer (loaded TF-IDF vectorizer)"
|
| 329 |
+
},
|
| 330 |
+
{
|
| 331 |
+
"function_call_name": "self.get_f1_features()",
|
| 332 |
+
"functionality": "Calculates token-level F1, Precision, and Recall scores.",
|
| 333 |
+
"input": "rule_data (list of dict)",
|
| 334 |
+
"output": "Tuple of numpy arrays (f1_scores, precisions, recalls).",
|
| 335 |
+
"location_or_namespace": "self (PEDANT)"
|
| 336 |
+
},
|
| 337 |
+
{
|
| 338 |
+
"function_call_name": "self.get_rule_features()",
|
| 339 |
+
"functionality": "Predicts the AC rule probabilities using the rule classifier F(R).",
|
| 340 |
+
"input": "data (list of dict)",
|
| 341 |
+
"output": "Tuple (probabilities array, log-probabilities array).",
|
| 342 |
+
"location_or_namespace": "self (PEDANT)"
|
| 343 |
+
},
|
| 344 |
+
{
|
| 345 |
+
"function_call_name": "self.get_type_features()",
|
| 346 |
+
"functionality": "Predicts the question type probabilities using the type classifier F(T).",
|
| 347 |
+
"input": "data (list of dict)",
|
| 348 |
+
"output": "Tuple (probabilities array, log-probabilities array).",
|
| 349 |
+
"location_or_namespace": "self (PEDANT)"
|
| 350 |
+
},
|
| 351 |
+
{
|
| 352 |
+
"function_call_name": "hstack()",
|
| 353 |
+
"functionality": "Stack sparse matrices horizontally (column wise).",
|
| 354 |
+
"input": "blocks (sequence of sparse matrices), format=None, dtype=None",
|
| 355 |
+
"output": "Stacked sparse matrix.",
|
| 356 |
+
"location_or_namespace": "scipy.sparse"
|
| 357 |
+
}
|
| 358 |
+
]
|
| 359 |
+
},
|
| 360 |
+
{
|
| 361 |
+
"function_name": "PEDANT.get_score",
|
| 362 |
+
"file_path": "qa_metrics/pedant.py",
|
| 363 |
+
"function_calls": [
|
| 364 |
+
{
|
| 365 |
+
"function_call_name": "lemmatize_text()",
|
| 366 |
+
"functionality": "Applies lemmatization to the input text (Assumed function).",
|
| 367 |
+
"input": "text (str)",
|
| 368 |
+
"output": "Lemmatized text (str).",
|
| 369 |
+
"location_or_namespace": "qa_metrics/utils/tools.py"
|
| 370 |
+
},
|
| 371 |
+
{
|
| 372 |
+
"function_call_name": "normalize_answer()",
|
| 373 |
+
"functionality": "Normalizes the answer text (e.g., lowercasing, removing punctuation) (Assumed function).",
|
| 374 |
+
"input": "text (str)",
|
| 375 |
+
"output": "Normalized text (str).",
|
| 376 |
+
"location_or_namespace": "qa_metrics/utils/tools.py"
|
| 377 |
+
},
|
| 378 |
+
{
|
| 379 |
+
"function_call_name": "str()",
|
| 380 |
+
"functionality": "Return a string version of object.",
|
| 381 |
+
"input": "object",
|
| 382 |
+
"output": "String representation of object.",
|
| 383 |
+
"location_or_namespace": "builtins"
|
| 384 |
+
},
|
| 385 |
+
{
|
| 386 |
+
"function_call_name": "self.construct_features()",
|
| 387 |
+
"functionality": "Constructs the final feature vector for the PEDANTS classifier.",
|
| 388 |
+
"input": "data (list of dict), with_log_probas=False (default)",
|
| 389 |
+
"output": "Sparse matrix of features.",
|
| 390 |
+
"location_or_namespace": "self (PEDANT)"
|
| 391 |
+
},
|
| 392 |
+
{
|
| 393 |
+
"function_call_name": "self.model.predict_proba()",
|
| 394 |
+
"functionality": "Predicts class probabilities using the main loaded classifier.",
|
| 395 |
+
"input": "X (array-like or sparse matrix)",
|
| 396 |
+
"output": "Array of class probabilities.",
|
| 397 |
+
"location_or_namespace": "self.model (loaded classifier)"
|
| 398 |
+
}
|
| 399 |
+
]
|
| 400 |
+
},
|
| 401 |
+
{
|
| 402 |
+
"function_name": "PEDANT.get_scores",
|
| 403 |
+
"file_path": "qa_metrics/pedant.py",
|
| 404 |
+
"function_calls": [
|
| 405 |
+
{
|
| 406 |
+
"function_call_name": "isinstance()",
|
| 407 |
+
"functionality": "Return whether an object is an instance of a class or of a subclass thereof.",
|
| 408 |
+
"input": "object, classinfo",
|
| 409 |
+
"output": "Boolean.",
|
| 410 |
+
"location_or_namespace": "builtins"
|
| 411 |
+
},
|
| 412 |
+
{
|
| 413 |
+
"function_call_name": "self.get_score()",
|
| 414 |
+
"functionality": "Calculates the PEDANTS confidence score for a single QA pair.",
|
| 415 |
+
"input": "reference (str), candidate (str), question (str)",
|
| 416 |
+
"output": "Confidence score (float).",
|
| 417 |
+
"location_or_namespace": "self (PEDANT)"
|
| 418 |
+
}
|
| 419 |
+
]
|
| 420 |
+
},
|
| 421 |
+
{
|
| 422 |
+
"function_name": "PEDANT.get_question_type",
|
| 423 |
+
"file_path": "qa_metrics/pedant.py",
|
| 424 |
+
"function_calls": [
|
| 425 |
+
{
|
| 426 |
+
"function_call_name": "isinstance()",
|
| 427 |
+
"functionality": "Return whether an object is an instance of a class or of a subclass thereof.",
|
| 428 |
+
"input": "object, classinfo",
|
| 429 |
+
"output": "Boolean.",
|
| 430 |
+
"location_or_namespace": "builtins"
|
| 431 |
+
},
|
| 432 |
+
{
|
| 433 |
+
"function_call_name": "lemmatize_text()",
|
| 434 |
+
"functionality": "Applies lemmatization to the input text (Assumed function).",
|
| 435 |
+
"input": "text (str)",
|
| 436 |
+
"output": "Lemmatized text (str).",
|
| 437 |
+
"location_or_namespace": "qa_metrics/utils/tools.py"
|
| 438 |
+
},
|
| 439 |
+
{
|
| 440 |
+
"function_call_name": "normalize_answer()",
|
| 441 |
+
"functionality": "Normalizes the answer text (e.g., lowercasing, removing punctuation) (Assumed function).",
|
| 442 |
+
"input": "text (str)",
|
| 443 |
+
"output": "Normalized text (str).",
|
| 444 |
+
"location_or_namespace": "qa_metrics/utils/tools.py"
|
| 445 |
+
},
|
| 446 |
+
{
|
| 447 |
+
"function_call_name": "str()",
|
| 448 |
+
"functionality": "Return a string version of object.",
|
| 449 |
+
"input": "object",
|
| 450 |
+
"output": "String representation of object.",
|
| 451 |
+
"location_or_namespace": "builtins"
|
| 452 |
+
},
|
| 453 |
+
{
|
| 454 |
+
"function_call_name": "self.tokenizer.transform()",
|
| 455 |
+
"functionality": "Transforms text data into TF-IDF vectors using the loaded tokenizer.",
|
| 456 |
+
"input": "raw_documents (iterable)",
|
| 457 |
+
"output": "Sparse matrix of TF-IDF vectors.",
|
| 458 |
+
"location_or_namespace": "self.tokenizer (loaded TF-IDF vectorizer)"
|
| 459 |
+
},
|
| 460 |
+
{
|
| 461 |
+
"function_call_name": "self.type_model.predict()",
|
| 462 |
+
"functionality": "Predicts class labels using the loaded type classifier.",
|
| 463 |
+
"input": "X (array-like or sparse matrix)",
|
| 464 |
+
"output": "Array of predicted class labels.",
|
| 465 |
+
"location_or_namespace": "self.type_model (loaded classifier)"
|
| 466 |
+
},
|
| 467 |
+
{
|
| 468 |
+
"function_call_name": "list()",
|
| 469 |
+
"functionality": "Create a new list object.",
|
| 470 |
+
"input": "iterable (optional)",
|
| 471 |
+
"output": "List.",
|
| 472 |
+
"location_or_namespace": "builtins"
|
| 473 |
+
},
|
| 474 |
+
{
|
| 475 |
+
"function_call_name": "set()",
|
| 476 |
+
"functionality": "Create a new set object.",
|
| 477 |
+
"input": "iterable (optional)",
|
| 478 |
+
"output": "Set.",
|
| 479 |
+
"location_or_namespace": "builtins"
|
| 480 |
+
}
|
| 481 |
+
]
|
| 482 |
+
},
|
| 483 |
+
{
|
| 484 |
+
"function_name": "PEDANT.get_judgement_rule",
|
| 485 |
+
"file_path": "qa_metrics/pedant.py",
|
| 486 |
+
"function_calls": [
|
| 487 |
+
{
|
| 488 |
+
"function_call_name": "isinstance()",
|
| 489 |
+
"functionality": "Return whether an object is an instance of a class or of a subclass thereof.",
|
| 490 |
+
"input": "object, classinfo",
|
| 491 |
+
"output": "Boolean.",
|
| 492 |
+
"location_or_namespace": "builtins"
|
| 493 |
+
},
|
| 494 |
+
{
|
| 495 |
+
"function_call_name": "lemmatize_text()",
|
| 496 |
+
"functionality": "Applies lemmatization to the input text (Assumed function).",
|
| 497 |
+
"input": "text (str)",
|
| 498 |
+
"output": "Lemmatized text (str).",
|
| 499 |
+
"location_or_namespace": "qa_metrics/utils/tools.py"
|
| 500 |
+
},
|
| 501 |
+
{
|
| 502 |
+
"function_call_name": "normalize_answer()",
|
| 503 |
+
"functionality": "Normalizes the answer text (e.g., lowercasing, removing punctuation) (Assumed function).",
|
| 504 |
+
"input": "text (str)",
|
| 505 |
+
"output": "Normalized text (str).",
|
| 506 |
+
"location_or_namespace": "qa_metrics/utils/tools.py"
|
| 507 |
+
},
|
| 508 |
+
{
|
| 509 |
+
"function_call_name": "str()",
|
| 510 |
+
"functionality": "Return a string version of object.",
|
| 511 |
+
"input": "object",
|
| 512 |
+
"output": "String representation of object.",
|
| 513 |
+
"location_or_namespace": "builtins"
|
| 514 |
+
},
|
| 515 |
+
{
|
| 516 |
+
"function_call_name": "self.get_f1_features()",
|
| 517 |
+
"functionality": "Calculates token-level F1, Precision, and Recall scores.",
|
| 518 |
+
"input": "rule_data (list of dict)",
|
| 519 |
+
"output": "Tuple of numpy arrays (f1_scores, precisions, recalls).",
|
| 520 |
+
"location_or_namespace": "self (PEDANT)"
|
| 521 |
+
},
|
| 522 |
+
{
|
| 523 |
+
"function_call_name": "self.tokenizer.transform()",
|
| 524 |
+
"functionality": "Transforms text data into TF-IDF vectors using the loaded tokenizer.",
|
| 525 |
+
"input": "raw_documents (iterable)",
|
| 526 |
+
"output": "Sparse matrix of TF-IDF vectors.",
|
| 527 |
+
"location_or_namespace": "self.tokenizer (loaded TF-IDF vectorizer)"
|
| 528 |
+
},
|
| 529 |
+
{
|
| 530 |
+
"function_call_name": "hstack()",
|
| 531 |
+
"functionality": "Stack sparse matrices horizontally (column wise).",
|
| 532 |
+
"input": "blocks (sequence of sparse matrices), format=None, dtype=None",
|
| 533 |
+
"output": "Stacked sparse matrix.",
|
| 534 |
+
"location_or_namespace": "scipy.sparse"
|
| 535 |
+
},
|
| 536 |
+
{
|
| 537 |
+
"function_call_name": "self.rule_model.predict()",
|
| 538 |
+
"functionality": "Predicts class labels using the loaded rule classifier.",
|
| 539 |
+
"input": "X (array-like or sparse matrix)",
|
| 540 |
+
"output": "Array of predicted class labels.",
|
| 541 |
+
"location_or_namespace": "self.rule_model (loaded classifier)"
|
| 542 |
+
},
|
| 543 |
+
{
|
| 544 |
+
"function_call_name": "list()",
|
| 545 |
+
"functionality": "Create a new list object.",
|
| 546 |
+
"input": "iterable (optional)",
|
| 547 |
+
"output": "List.",
|
| 548 |
+
"location_or_namespace": "builtins"
|
| 549 |
+
},
|
| 550 |
+
{
|
| 551 |
+
"function_call_name": "set()",
|
| 552 |
+
"functionality": "Create a new set object.",
|
| 553 |
+
"input": "iterable (optional)",
|
| 554 |
+
"output": "Set.",
|
| 555 |
+
"location_or_namespace": "builtins"
|
| 556 |
+
},
|
| 557 |
+
{
|
| 558 |
+
"function_call_name": "len()",
|
| 559 |
+
"functionality": "Return the number of items in a container.",
|
| 560 |
+
"input": "container",
|
| 561 |
+
"output": "Integer length.",
|
| 562 |
+
"location_or_namespace": "builtins"
|
| 563 |
+
}
|
| 564 |
+
]
|
| 565 |
+
},
|
| 566 |
+
{
|
| 567 |
+
"function_name": "PEDANT.get_highest_score",
|
| 568 |
+
"file_path": "qa_metrics/pedant.py",
|
| 569 |
+
"function_calls": [
|
| 570 |
+
{
|
| 571 |
+
"function_call_name": "self.get_scores()",
|
| 572 |
+
"functionality": "Calculates PEDANTS confidence scores when reference and/or candidate answers might be lists.",
|
| 573 |
+
"input": "reference (str or list), candidate (str or list), question (str)",
|
| 574 |
+
"output": "Nested dictionary of scores.",
|
| 575 |
+
"location_or_namespace": "self (PEDANT)"
|
| 576 |
+
},
|
| 577 |
+
{
|
| 578 |
+
"function_call_name": "dict.items()",
|
| 579 |
+
"functionality": "Return a new view of the dictionary's items ((key, value) pairs).",
|
| 580 |
+
"input": "None",
|
| 581 |
+
"output": "Dictionary view object.",
|
| 582 |
+
"location_or_namespace": "dict"
|
| 583 |
+
}
|
| 584 |
+
]
|
| 585 |
+
},
|
| 586 |
+
{
|
| 587 |
+
"function_name": "PEDANT.evaluate",
|
| 588 |
+
"file_path": "qa_metrics/pedant.py",
|
| 589 |
+
"function_calls": [
|
| 590 |
+
{
|
| 591 |
+
"function_call_name": "isinstance()",
|
| 592 |
+
"functionality": "Return whether an object is an instance of a class or of a subclass thereof.",
|
| 593 |
+
"input": "object, classinfo",
|
| 594 |
+
"output": "Boolean.",
|
| 595 |
+
"location_or_namespace": "builtins"
|
| 596 |
+
},
|
| 597 |
+
{
|
| 598 |
+
"function_call_name": "lemmatize_text()",
|
| 599 |
+
"functionality": "Applies lemmatization to the input text (Assumed function).",
|
| 600 |
+
"input": "text (str)",
|
| 601 |
+
"output": "Lemmatized text (str).",
|
| 602 |
+
"location_or_namespace": "qa_metrics/utils/tools.py"
|
| 603 |
+
},
|
| 604 |
+
{
|
| 605 |
+
"function_call_name": "normalize_answer()",
|
| 606 |
+
"functionality": "Normalizes the answer text (e.g., lowercasing, removing punctuation) (Assumed function).",
|
| 607 |
+
"input": "text (str)",
|
| 608 |
+
"output": "Normalized text (str).",
|
| 609 |
+
"location_or_namespace": "qa_metrics/utils/tools.py"
|
| 610 |
+
},
|
| 611 |
+
{
|
| 612 |
+
"function_call_name": "str()",
|
| 613 |
+
"functionality": "Return a string version of object.",
|
| 614 |
+
"input": "object",
|
| 615 |
+
"output": "String representation of object.",
|
| 616 |
+
"location_or_namespace": "builtins"
|
| 617 |
+
},
|
| 618 |
+
{
|
| 619 |
+
"function_call_name": "list.append()",
|
| 620 |
+
"functionality": "Append object to the end of the list.",
|
| 621 |
+
"input": "object",
|
| 622 |
+
"output": "None",
|
| 623 |
+
"location_or_namespace": "list"
|
| 624 |
+
},
|
| 625 |
+
{
|
| 626 |
+
"function_call_name": "self.construct_features()",
|
| 627 |
+
"functionality": "Constructs the final feature vector for the PEDANTS classifier.",
|
| 628 |
+
"input": "data (list of dict), with_log_probas=False (default)",
|
| 629 |
+
"output": "Sparse matrix of features.",
|
| 630 |
+
"location_or_namespace": "self (PEDANT)"
|
| 631 |
+
},
|
| 632 |
+
{
|
| 633 |
+
"function_call_name": "self.model.predict()",
|
| 634 |
+
"functionality": "Predicts class labels using the main loaded classifier.",
|
| 635 |
+
"input": "X (array-like or sparse matrix)",
|
| 636 |
+
"output": "Array of predicted class labels.",
|
| 637 |
+
"location_or_namespace": "self.model (loaded classifier)"
|
| 638 |
+
}
|
| 639 |
+
]
|
| 640 |
+
}
|
| 641 |
+
]
|
annotations/annotation_1/htmlcov/.gitignore
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Created by coverage.py
|
| 2 |
+
*
|
annotations/annotation_1/htmlcov/canonical_py.html
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
annotations/annotation_1/htmlcov/class_index.html
ADDED
|
@@ -0,0 +1,123 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<!DOCTYPE html>
|
| 2 |
+
<html lang="en">
|
| 3 |
+
<head>
|
| 4 |
+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
| 5 |
+
<title>Coverage report</title>
|
| 6 |
+
<link rel="icon" sizes="32x32" href="favicon_32_cb_58284776.png">
|
| 7 |
+
<link rel="stylesheet" href="style_cb_6b508a39.css" type="text/css">
|
| 8 |
+
<script src="coverage_html_cb_6fb7b396.js" defer></script>
|
| 9 |
+
</head>
|
| 10 |
+
<body class="indexfile">
|
| 11 |
+
<header>
|
| 12 |
+
<div class="content">
|
| 13 |
+
<h1>Coverage report:
|
| 14 |
+
<span class="pc_cov">73%</span>
|
| 15 |
+
</h1>
|
| 16 |
+
<aside id="help_panel_wrapper">
|
| 17 |
+
<input id="help_panel_state" type="checkbox">
|
| 18 |
+
<label for="help_panel_state">
|
| 19 |
+
<img id="keyboard_icon" src="keybd_closed_cb_ce680311.png" alt="Show/hide keyboard shortcuts">
|
| 20 |
+
</label>
|
| 21 |
+
<div id="help_panel">
|
| 22 |
+
<p class="legend">Shortcuts on this page</p>
|
| 23 |
+
<div class="keyhelp">
|
| 24 |
+
<p>
|
| 25 |
+
<kbd>f</kbd>
|
| 26 |
+
<kbd>n</kbd>
|
| 27 |
+
<kbd>s</kbd>
|
| 28 |
+
<kbd>m</kbd>
|
| 29 |
+
<kbd>x</kbd>
|
| 30 |
+
<kbd>c</kbd>
|
| 31 |
+
change column sorting
|
| 32 |
+
</p>
|
| 33 |
+
<p>
|
| 34 |
+
<kbd>[</kbd>
|
| 35 |
+
<kbd>]</kbd>
|
| 36 |
+
prev/next file
|
| 37 |
+
</p>
|
| 38 |
+
<p>
|
| 39 |
+
<kbd>?</kbd> show/hide this help
|
| 40 |
+
</p>
|
| 41 |
+
</div>
|
| 42 |
+
</div>
|
| 43 |
+
</aside>
|
| 44 |
+
<form id="filter_container">
|
| 45 |
+
<input id="filter" type="text" value="" placeholder="filter...">
|
| 46 |
+
<div>
|
| 47 |
+
<input id="hide100" type="checkbox" >
|
| 48 |
+
<label for="hide100">hide covered</label>
|
| 49 |
+
</div>
|
| 50 |
+
</form>
|
| 51 |
+
<h2>
|
| 52 |
+
<a class="button" href="index.html">Files</a>
|
| 53 |
+
<a class="button" href="function_index.html">Functions</a>
|
| 54 |
+
<a class="button current">Classes</a>
|
| 55 |
+
</h2>
|
| 56 |
+
<p class="text">
|
| 57 |
+
<a class="nav" href="https://coverage.readthedocs.io/en/7.10.6">coverage.py v7.10.6</a>,
|
| 58 |
+
created at 2025-09-03 15:10 -0500
|
| 59 |
+
</p>
|
| 60 |
+
</div>
|
| 61 |
+
</header>
|
| 62 |
+
<main id="index">
|
| 63 |
+
<table class="index" data-sortable>
|
| 64 |
+
<thead>
|
| 65 |
+
<tr class="tablehead" title="Click to sort">
|
| 66 |
+
<th id="file" class="name left" aria-sort="none" data-shortcut="f">File<span class="arrows"></span></th>
|
| 67 |
+
<th id="region" class="name left" aria-sort="none" data-default-sort-order="ascending" data-shortcut="n">class<span class="arrows"></span></th>
|
| 68 |
+
<th id="statements" aria-sort="none" data-default-sort-order="descending" data-shortcut="s">statements<span class="arrows"></span></th>
|
| 69 |
+
<th id="missing" aria-sort="none" data-default-sort-order="descending" data-shortcut="m">missing<span class="arrows"></span></th>
|
| 70 |
+
<th id="excluded" aria-sort="none" data-default-sort-order="descending" data-shortcut="x">excluded<span class="arrows"></span></th>
|
| 71 |
+
<th id="coverage" class="right" aria-sort="none" data-shortcut="c">coverage<span class="arrows"></span></th>
|
| 72 |
+
</tr>
|
| 73 |
+
</thead>
|
| 74 |
+
<tbody>
|
| 75 |
+
<tr class="region">
|
| 76 |
+
<td class="name left"><a href="canonical_py.html#t7">canonical.py</a></td>
|
| 77 |
+
<td class="name left"><a href="canonical_py.html#t7"><data value='PEDANT'>PEDANT</data></a></td>
|
| 78 |
+
<td>158</td>
|
| 79 |
+
<td>48</td>
|
| 80 |
+
<td>0</td>
|
| 81 |
+
<td class="right" data-ratio="110 158">70%</td>
|
| 82 |
+
</tr>
|
| 83 |
+
<tr class="region">
|
| 84 |
+
<td class="name left"><a href="canonical_py.html">canonical.py</a></td>
|
| 85 |
+
<td class="name left"><a href="canonical_py.html"><data value=''><span class='no-noun'>(no class)</span></data></a></td>
|
| 86 |
+
<td>18</td>
|
| 87 |
+
<td>0</td>
|
| 88 |
+
<td>0</td>
|
| 89 |
+
<td class="right" data-ratio="18 18">100%</td>
|
| 90 |
+
</tr>
|
| 91 |
+
</tbody>
|
| 92 |
+
<tfoot>
|
| 93 |
+
<tr class="total">
|
| 94 |
+
<td class="name left">Total</td>
|
| 95 |
+
<td class="name left"> </td>
|
| 96 |
+
<td>176</td>
|
| 97 |
+
<td>48</td>
|
| 98 |
+
<td>0</td>
|
| 99 |
+
<td class="right" data-ratio="128 176">73%</td>
|
| 100 |
+
</tr>
|
| 101 |
+
</tfoot>
|
| 102 |
+
</table>
|
| 103 |
+
<p id="no_rows">
|
| 104 |
+
No items found using the specified filter.
|
| 105 |
+
</p>
|
| 106 |
+
</main>
|
| 107 |
+
<footer>
|
| 108 |
+
<div class="content">
|
| 109 |
+
<p>
|
| 110 |
+
<a class="nav" href="https://coverage.readthedocs.io/en/7.10.6">coverage.py v7.10.6</a>,
|
| 111 |
+
created at 2025-09-03 15:10 -0500
|
| 112 |
+
</p>
|
| 113 |
+
</div>
|
| 114 |
+
<aside class="hidden">
|
| 115 |
+
<a id="prevFileLink" class="nav" href=""></a>
|
| 116 |
+
<a id="nextFileLink" class="nav" href=""></a>
|
| 117 |
+
<button type="button" class="button_prev_file" data-shortcut="["></button>
|
| 118 |
+
<button type="button" class="button_next_file" data-shortcut="]"></button>
|
| 119 |
+
<button type="button" class="button_show_hide_help" data-shortcut="?"></button>
|
| 120 |
+
</aside>
|
| 121 |
+
</footer>
|
| 122 |
+
</body>
|
| 123 |
+
</html>
|
annotations/annotation_1/htmlcov/coverage_html_cb_6fb7b396.js
ADDED
|
@@ -0,0 +1,733 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
// Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0
|
| 2 |
+
// For details: https://github.com/nedbat/coveragepy/blob/master/NOTICE.txt
|
| 3 |
+
|
| 4 |
+
// Coverage.py HTML report browser code.
|
| 5 |
+
/*jslint browser: true, sloppy: true, vars: true, plusplus: true, maxerr: 50, indent: 4 */
|
| 6 |
+
/*global coverage: true, document, window, $ */
|
| 7 |
+
|
| 8 |
+
coverage = {};
|
| 9 |
+
|
| 10 |
+
// General helpers
|
| 11 |
+
function debounce(callback, wait) {
|
| 12 |
+
let timeoutId = null;
|
| 13 |
+
return function(...args) {
|
| 14 |
+
clearTimeout(timeoutId);
|
| 15 |
+
timeoutId = setTimeout(() => {
|
| 16 |
+
callback.apply(this, args);
|
| 17 |
+
}, wait);
|
| 18 |
+
};
|
| 19 |
+
};
|
| 20 |
+
|
| 21 |
+
function checkVisible(element) {
|
| 22 |
+
const rect = element.getBoundingClientRect();
|
| 23 |
+
const viewBottom = Math.max(document.documentElement.clientHeight, window.innerHeight);
|
| 24 |
+
const viewTop = 30;
|
| 25 |
+
return !(rect.bottom < viewTop || rect.top >= viewBottom);
|
| 26 |
+
}
|
| 27 |
+
|
| 28 |
+
function on_click(sel, fn) {
|
| 29 |
+
const elt = document.querySelector(sel);
|
| 30 |
+
if (elt) {
|
| 31 |
+
elt.addEventListener("click", fn);
|
| 32 |
+
}
|
| 33 |
+
}
|
| 34 |
+
|
| 35 |
+
// Helpers for table sorting
|
| 36 |
+
function getCellValue(row, column = 0) {
|
| 37 |
+
const cell = row.cells[column] // nosemgrep: eslint.detect-object-injection
|
| 38 |
+
if (cell.childElementCount == 1) {
|
| 39 |
+
var child = cell.firstElementChild;
|
| 40 |
+
if (child.tagName === "A") {
|
| 41 |
+
child = child.firstElementChild;
|
| 42 |
+
}
|
| 43 |
+
if (child instanceof HTMLDataElement && child.value) {
|
| 44 |
+
return child.value;
|
| 45 |
+
}
|
| 46 |
+
}
|
| 47 |
+
return cell.innerText || cell.textContent;
|
| 48 |
+
}
|
| 49 |
+
|
| 50 |
+
function rowComparator(rowA, rowB, column = 0) {
|
| 51 |
+
let valueA = getCellValue(rowA, column);
|
| 52 |
+
let valueB = getCellValue(rowB, column);
|
| 53 |
+
if (!isNaN(valueA) && !isNaN(valueB)) {
|
| 54 |
+
return valueA - valueB;
|
| 55 |
+
}
|
| 56 |
+
return valueA.localeCompare(valueB, undefined, {numeric: true});
|
| 57 |
+
}
|
| 58 |
+
|
| 59 |
+
function sortColumn(th) {
|
| 60 |
+
// Get the current sorting direction of the selected header,
|
| 61 |
+
// clear state on other headers and then set the new sorting direction.
|
| 62 |
+
const currentSortOrder = th.getAttribute("aria-sort");
|
| 63 |
+
[...th.parentElement.cells].forEach(header => header.setAttribute("aria-sort", "none"));
|
| 64 |
+
var direction;
|
| 65 |
+
if (currentSortOrder === "none") {
|
| 66 |
+
direction = th.dataset.defaultSortOrder || "ascending";
|
| 67 |
+
}
|
| 68 |
+
else if (currentSortOrder === "ascending") {
|
| 69 |
+
direction = "descending";
|
| 70 |
+
}
|
| 71 |
+
else {
|
| 72 |
+
direction = "ascending";
|
| 73 |
+
}
|
| 74 |
+
th.setAttribute("aria-sort", direction);
|
| 75 |
+
|
| 76 |
+
const column = [...th.parentElement.cells].indexOf(th)
|
| 77 |
+
|
| 78 |
+
// Sort all rows and afterwards append them in order to move them in the DOM.
|
| 79 |
+
Array.from(th.closest("table").querySelectorAll("tbody tr"))
|
| 80 |
+
.sort((rowA, rowB) => rowComparator(rowA, rowB, column) * (direction === "ascending" ? 1 : -1))
|
| 81 |
+
.forEach(tr => tr.parentElement.appendChild(tr));
|
| 82 |
+
|
| 83 |
+
// Save the sort order for next time.
|
| 84 |
+
if (th.id !== "region") {
|
| 85 |
+
let th_id = "file"; // Sort by file if we don't have a column id
|
| 86 |
+
let current_direction = direction;
|
| 87 |
+
const stored_list = localStorage.getItem(coverage.INDEX_SORT_STORAGE);
|
| 88 |
+
if (stored_list) {
|
| 89 |
+
({th_id, direction} = JSON.parse(stored_list))
|
| 90 |
+
}
|
| 91 |
+
localStorage.setItem(coverage.INDEX_SORT_STORAGE, JSON.stringify({
|
| 92 |
+
"th_id": th.id,
|
| 93 |
+
"direction": current_direction
|
| 94 |
+
}));
|
| 95 |
+
if (th.id !== th_id || document.getElementById("region")) {
|
| 96 |
+
// Sort column has changed, unset sorting by function or class.
|
| 97 |
+
localStorage.setItem(coverage.SORTED_BY_REGION, JSON.stringify({
|
| 98 |
+
"by_region": false,
|
| 99 |
+
"region_direction": current_direction
|
| 100 |
+
}));
|
| 101 |
+
}
|
| 102 |
+
}
|
| 103 |
+
else {
|
| 104 |
+
// Sort column has changed to by function or class, remember that.
|
| 105 |
+
localStorage.setItem(coverage.SORTED_BY_REGION, JSON.stringify({
|
| 106 |
+
"by_region": true,
|
| 107 |
+
"region_direction": direction
|
| 108 |
+
}));
|
| 109 |
+
}
|
| 110 |
+
}
|
| 111 |
+
|
| 112 |
+
// Find all the elements with data-shortcut attribute, and use them to assign a shortcut key.
|
| 113 |
+
coverage.assign_shortkeys = function () {
|
| 114 |
+
document.querySelectorAll("[data-shortcut]").forEach(element => {
|
| 115 |
+
document.addEventListener("keypress", event => {
|
| 116 |
+
if (event.target.tagName.toLowerCase() === "input") {
|
| 117 |
+
return; // ignore keypress from search filter
|
| 118 |
+
}
|
| 119 |
+
if (event.key === element.dataset.shortcut) {
|
| 120 |
+
element.click();
|
| 121 |
+
}
|
| 122 |
+
});
|
| 123 |
+
});
|
| 124 |
+
};
|
| 125 |
+
|
| 126 |
+
// Create the events for the filter box.
|
| 127 |
+
coverage.wire_up_filter = function () {
|
| 128 |
+
// Populate the filter and hide100 inputs if there are saved values for them.
|
| 129 |
+
const saved_filter_value = localStorage.getItem(coverage.FILTER_STORAGE);
|
| 130 |
+
if (saved_filter_value) {
|
| 131 |
+
document.getElementById("filter").value = saved_filter_value;
|
| 132 |
+
}
|
| 133 |
+
const saved_hide100_value = localStorage.getItem(coverage.HIDE100_STORAGE);
|
| 134 |
+
if (saved_hide100_value) {
|
| 135 |
+
document.getElementById("hide100").checked = JSON.parse(saved_hide100_value);
|
| 136 |
+
}
|
| 137 |
+
|
| 138 |
+
// Cache elements.
|
| 139 |
+
const table = document.querySelector("table.index");
|
| 140 |
+
const table_body_rows = table.querySelectorAll("tbody tr");
|
| 141 |
+
const no_rows = document.getElementById("no_rows");
|
| 142 |
+
|
| 143 |
+
// Observe filter keyevents.
|
| 144 |
+
const filter_handler = (event => {
|
| 145 |
+
// Keep running total of each metric, first index contains number of shown rows
|
| 146 |
+
const totals = new Array(table.rows[0].cells.length).fill(0);
|
| 147 |
+
// Accumulate the percentage as fraction
|
| 148 |
+
totals[totals.length - 1] = { "numer": 0, "denom": 0 }; // nosemgrep: eslint.detect-object-injection
|
| 149 |
+
|
| 150 |
+
var text = document.getElementById("filter").value;
|
| 151 |
+
// Store filter value
|
| 152 |
+
localStorage.setItem(coverage.FILTER_STORAGE, text);
|
| 153 |
+
const casefold = (text === text.toLowerCase());
|
| 154 |
+
const hide100 = document.getElementById("hide100").checked;
|
| 155 |
+
// Store hide value.
|
| 156 |
+
localStorage.setItem(coverage.HIDE100_STORAGE, JSON.stringify(hide100));
|
| 157 |
+
|
| 158 |
+
// Hide / show elements.
|
| 159 |
+
table_body_rows.forEach(row => {
|
| 160 |
+
var show = false;
|
| 161 |
+
// Check the text filter.
|
| 162 |
+
for (let column = 0; column < totals.length; column++) {
|
| 163 |
+
cell = row.cells[column];
|
| 164 |
+
if (cell.classList.contains("name")) {
|
| 165 |
+
var celltext = cell.textContent;
|
| 166 |
+
if (casefold) {
|
| 167 |
+
celltext = celltext.toLowerCase();
|
| 168 |
+
}
|
| 169 |
+
if (celltext.includes(text)) {
|
| 170 |
+
show = true;
|
| 171 |
+
}
|
| 172 |
+
}
|
| 173 |
+
}
|
| 174 |
+
|
| 175 |
+
// Check the "hide covered" filter.
|
| 176 |
+
if (show && hide100) {
|
| 177 |
+
const [numer, denom] = row.cells[row.cells.length - 1].dataset.ratio.split(" ");
|
| 178 |
+
show = (numer !== denom);
|
| 179 |
+
}
|
| 180 |
+
|
| 181 |
+
if (!show) {
|
| 182 |
+
// hide
|
| 183 |
+
row.classList.add("hidden");
|
| 184 |
+
return;
|
| 185 |
+
}
|
| 186 |
+
|
| 187 |
+
// show
|
| 188 |
+
row.classList.remove("hidden");
|
| 189 |
+
totals[0]++;
|
| 190 |
+
|
| 191 |
+
for (let column = 0; column < totals.length; column++) {
|
| 192 |
+
// Accumulate dynamic totals
|
| 193 |
+
cell = row.cells[column] // nosemgrep: eslint.detect-object-injection
|
| 194 |
+
if (cell.classList.contains("name")) {
|
| 195 |
+
continue;
|
| 196 |
+
}
|
| 197 |
+
if (column === totals.length - 1) {
|
| 198 |
+
// Last column contains percentage
|
| 199 |
+
const [numer, denom] = cell.dataset.ratio.split(" ");
|
| 200 |
+
totals[column]["numer"] += parseInt(numer, 10); // nosemgrep: eslint.detect-object-injection
|
| 201 |
+
totals[column]["denom"] += parseInt(denom, 10); // nosemgrep: eslint.detect-object-injection
|
| 202 |
+
}
|
| 203 |
+
else {
|
| 204 |
+
totals[column] += parseInt(cell.textContent, 10); // nosemgrep: eslint.detect-object-injection
|
| 205 |
+
}
|
| 206 |
+
}
|
| 207 |
+
});
|
| 208 |
+
|
| 209 |
+
// Show placeholder if no rows will be displayed.
|
| 210 |
+
if (!totals[0]) {
|
| 211 |
+
// Show placeholder, hide table.
|
| 212 |
+
no_rows.style.display = "block";
|
| 213 |
+
table.style.display = "none";
|
| 214 |
+
return;
|
| 215 |
+
}
|
| 216 |
+
|
| 217 |
+
// Hide placeholder, show table.
|
| 218 |
+
no_rows.style.display = null;
|
| 219 |
+
table.style.display = null;
|
| 220 |
+
|
| 221 |
+
const footer = table.tFoot.rows[0];
|
| 222 |
+
// Calculate new dynamic sum values based on visible rows.
|
| 223 |
+
for (let column = 0; column < totals.length; column++) {
|
| 224 |
+
// Get footer cell element.
|
| 225 |
+
const cell = footer.cells[column]; // nosemgrep: eslint.detect-object-injection
|
| 226 |
+
if (cell.classList.contains("name")) {
|
| 227 |
+
continue;
|
| 228 |
+
}
|
| 229 |
+
|
| 230 |
+
// Set value into dynamic footer cell element.
|
| 231 |
+
if (column === totals.length - 1) {
|
| 232 |
+
// Percentage column uses the numerator and denominator,
|
| 233 |
+
// and adapts to the number of decimal places.
|
| 234 |
+
const match = /\.([0-9]+)/.exec(cell.textContent);
|
| 235 |
+
const places = match ? match[1].length : 0;
|
| 236 |
+
const { numer, denom } = totals[column]; // nosemgrep: eslint.detect-object-injection
|
| 237 |
+
cell.dataset.ratio = `${numer} ${denom}`;
|
| 238 |
+
// Check denom to prevent NaN if filtered files contain no statements
|
| 239 |
+
cell.textContent = denom
|
| 240 |
+
? `${(numer * 100 / denom).toFixed(places)}%`
|
| 241 |
+
: `${(100).toFixed(places)}%`;
|
| 242 |
+
}
|
| 243 |
+
else {
|
| 244 |
+
cell.textContent = totals[column]; // nosemgrep: eslint.detect-object-injection
|
| 245 |
+
}
|
| 246 |
+
}
|
| 247 |
+
});
|
| 248 |
+
|
| 249 |
+
document.getElementById("filter").addEventListener("input", debounce(filter_handler));
|
| 250 |
+
document.getElementById("hide100").addEventListener("input", debounce(filter_handler));
|
| 251 |
+
|
| 252 |
+
// Trigger change event on setup, to force filter on page refresh
|
| 253 |
+
// (filter value may still be present).
|
| 254 |
+
document.getElementById("filter").dispatchEvent(new Event("input"));
|
| 255 |
+
document.getElementById("hide100").dispatchEvent(new Event("input"));
|
| 256 |
+
};
|
| 257 |
+
coverage.FILTER_STORAGE = "COVERAGE_FILTER_VALUE";
|
| 258 |
+
coverage.HIDE100_STORAGE = "COVERAGE_HIDE100_VALUE";
|
| 259 |
+
|
| 260 |
+
// Set up the click-to-sort columns.
|
| 261 |
+
coverage.wire_up_sorting = function () {
|
| 262 |
+
document.querySelectorAll("[data-sortable] th[aria-sort]").forEach(
|
| 263 |
+
th => th.addEventListener("click", e => sortColumn(e.target))
|
| 264 |
+
);
|
| 265 |
+
|
| 266 |
+
// Look for a localStorage item containing previous sort settings:
|
| 267 |
+
let th_id = "file", direction = "ascending";
|
| 268 |
+
const stored_list = localStorage.getItem(coverage.INDEX_SORT_STORAGE);
|
| 269 |
+
if (stored_list) {
|
| 270 |
+
({th_id, direction} = JSON.parse(stored_list));
|
| 271 |
+
}
|
| 272 |
+
let by_region = false, region_direction = "ascending";
|
| 273 |
+
const sorted_by_region = localStorage.getItem(coverage.SORTED_BY_REGION);
|
| 274 |
+
if (sorted_by_region) {
|
| 275 |
+
({
|
| 276 |
+
by_region,
|
| 277 |
+
region_direction
|
| 278 |
+
} = JSON.parse(sorted_by_region));
|
| 279 |
+
}
|
| 280 |
+
|
| 281 |
+
const region_id = "region";
|
| 282 |
+
if (by_region && document.getElementById(region_id)) {
|
| 283 |
+
direction = region_direction;
|
| 284 |
+
}
|
| 285 |
+
// If we are in a page that has a column with id of "region", sort on
|
| 286 |
+
// it if the last sort was by function or class.
|
| 287 |
+
let th;
|
| 288 |
+
if (document.getElementById(region_id)) {
|
| 289 |
+
th = document.getElementById(by_region ? region_id : th_id);
|
| 290 |
+
}
|
| 291 |
+
else {
|
| 292 |
+
th = document.getElementById(th_id);
|
| 293 |
+
}
|
| 294 |
+
th.setAttribute("aria-sort", direction === "ascending" ? "descending" : "ascending");
|
| 295 |
+
th.click()
|
| 296 |
+
};
|
| 297 |
+
|
| 298 |
+
coverage.INDEX_SORT_STORAGE = "COVERAGE_INDEX_SORT_2";
|
| 299 |
+
coverage.SORTED_BY_REGION = "COVERAGE_SORT_REGION";
|
| 300 |
+
|
| 301 |
+
// Loaded on index.html
|
| 302 |
+
coverage.index_ready = function () {
|
| 303 |
+
coverage.assign_shortkeys();
|
| 304 |
+
coverage.wire_up_filter();
|
| 305 |
+
coverage.wire_up_sorting();
|
| 306 |
+
|
| 307 |
+
on_click(".button_prev_file", coverage.to_prev_file);
|
| 308 |
+
on_click(".button_next_file", coverage.to_next_file);
|
| 309 |
+
|
| 310 |
+
on_click(".button_show_hide_help", coverage.show_hide_help);
|
| 311 |
+
};
|
| 312 |
+
|
| 313 |
+
// -- pyfile stuff --
|
| 314 |
+
|
| 315 |
+
coverage.LINE_FILTERS_STORAGE = "COVERAGE_LINE_FILTERS";
|
| 316 |
+
|
| 317 |
+
coverage.pyfile_ready = function () {
|
| 318 |
+
// If we're directed to a particular line number, highlight the line.
|
| 319 |
+
var frag = location.hash;
|
| 320 |
+
if (frag.length > 2 && frag[1] === "t") {
|
| 321 |
+
document.querySelector(frag).closest(".n").classList.add("highlight");
|
| 322 |
+
coverage.set_sel(parseInt(frag.substr(2), 10));
|
| 323 |
+
}
|
| 324 |
+
else {
|
| 325 |
+
coverage.set_sel(0);
|
| 326 |
+
}
|
| 327 |
+
|
| 328 |
+
on_click(".button_toggle_run", coverage.toggle_lines);
|
| 329 |
+
on_click(".button_toggle_mis", coverage.toggle_lines);
|
| 330 |
+
on_click(".button_toggle_exc", coverage.toggle_lines);
|
| 331 |
+
on_click(".button_toggle_par", coverage.toggle_lines);
|
| 332 |
+
|
| 333 |
+
on_click(".button_next_chunk", coverage.to_next_chunk_nicely);
|
| 334 |
+
on_click(".button_prev_chunk", coverage.to_prev_chunk_nicely);
|
| 335 |
+
on_click(".button_top_of_page", coverage.to_top);
|
| 336 |
+
on_click(".button_first_chunk", coverage.to_first_chunk);
|
| 337 |
+
|
| 338 |
+
on_click(".button_prev_file", coverage.to_prev_file);
|
| 339 |
+
on_click(".button_next_file", coverage.to_next_file);
|
| 340 |
+
on_click(".button_to_index", coverage.to_index);
|
| 341 |
+
|
| 342 |
+
on_click(".button_show_hide_help", coverage.show_hide_help);
|
| 343 |
+
|
| 344 |
+
coverage.filters = undefined;
|
| 345 |
+
try {
|
| 346 |
+
coverage.filters = localStorage.getItem(coverage.LINE_FILTERS_STORAGE);
|
| 347 |
+
} catch(err) {}
|
| 348 |
+
|
| 349 |
+
if (coverage.filters) {
|
| 350 |
+
coverage.filters = JSON.parse(coverage.filters);
|
| 351 |
+
}
|
| 352 |
+
else {
|
| 353 |
+
coverage.filters = {run: false, exc: true, mis: true, par: true};
|
| 354 |
+
}
|
| 355 |
+
|
| 356 |
+
for (cls in coverage.filters) {
|
| 357 |
+
coverage.set_line_visibilty(cls, coverage.filters[cls]); // nosemgrep: eslint.detect-object-injection
|
| 358 |
+
}
|
| 359 |
+
|
| 360 |
+
coverage.assign_shortkeys();
|
| 361 |
+
coverage.init_scroll_markers();
|
| 362 |
+
coverage.wire_up_sticky_header();
|
| 363 |
+
|
| 364 |
+
document.querySelectorAll("[id^=ctxs]").forEach(
|
| 365 |
+
cbox => cbox.addEventListener("click", coverage.expand_contexts)
|
| 366 |
+
);
|
| 367 |
+
|
| 368 |
+
// Rebuild scroll markers when the window height changes.
|
| 369 |
+
window.addEventListener("resize", coverage.build_scroll_markers);
|
| 370 |
+
};
|
| 371 |
+
|
| 372 |
+
coverage.toggle_lines = function (event) {
|
| 373 |
+
const btn = event.target.closest("button");
|
| 374 |
+
const category = btn.value
|
| 375 |
+
const show = !btn.classList.contains("show_" + category);
|
| 376 |
+
coverage.set_line_visibilty(category, show);
|
| 377 |
+
coverage.build_scroll_markers();
|
| 378 |
+
coverage.filters[category] = show;
|
| 379 |
+
try {
|
| 380 |
+
localStorage.setItem(coverage.LINE_FILTERS_STORAGE, JSON.stringify(coverage.filters));
|
| 381 |
+
} catch(err) {}
|
| 382 |
+
};
|
| 383 |
+
|
| 384 |
+
coverage.set_line_visibilty = function (category, should_show) {
|
| 385 |
+
const cls = "show_" + category;
|
| 386 |
+
const btn = document.querySelector(".button_toggle_" + category);
|
| 387 |
+
if (btn) {
|
| 388 |
+
if (should_show) {
|
| 389 |
+
document.querySelectorAll("#source ." + category).forEach(e => e.classList.add(cls));
|
| 390 |
+
btn.classList.add(cls);
|
| 391 |
+
}
|
| 392 |
+
else {
|
| 393 |
+
document.querySelectorAll("#source ." + category).forEach(e => e.classList.remove(cls));
|
| 394 |
+
btn.classList.remove(cls);
|
| 395 |
+
}
|
| 396 |
+
}
|
| 397 |
+
};
|
| 398 |
+
|
| 399 |
+
// Return the nth line div.
|
| 400 |
+
coverage.line_elt = function (n) {
|
| 401 |
+
return document.getElementById("t" + n)?.closest("p");
|
| 402 |
+
};
|
| 403 |
+
|
| 404 |
+
// Set the selection. b and e are line numbers.
|
| 405 |
+
coverage.set_sel = function (b, e) {
|
| 406 |
+
// The first line selected.
|
| 407 |
+
coverage.sel_begin = b;
|
| 408 |
+
// The next line not selected.
|
| 409 |
+
coverage.sel_end = (e === undefined) ? b+1 : e;
|
| 410 |
+
};
|
| 411 |
+
|
| 412 |
+
coverage.to_top = function () {
|
| 413 |
+
coverage.set_sel(0, 1);
|
| 414 |
+
coverage.scroll_window(0);
|
| 415 |
+
};
|
| 416 |
+
|
| 417 |
+
coverage.to_first_chunk = function () {
|
| 418 |
+
coverage.set_sel(0, 1);
|
| 419 |
+
coverage.to_next_chunk();
|
| 420 |
+
};
|
| 421 |
+
|
| 422 |
+
coverage.to_prev_file = function () {
|
| 423 |
+
window.location = document.getElementById("prevFileLink").href;
|
| 424 |
+
}
|
| 425 |
+
|
| 426 |
+
coverage.to_next_file = function () {
|
| 427 |
+
window.location = document.getElementById("nextFileLink").href;
|
| 428 |
+
}
|
| 429 |
+
|
| 430 |
+
coverage.to_index = function () {
|
| 431 |
+
location.href = document.getElementById("indexLink").href;
|
| 432 |
+
}
|
| 433 |
+
|
| 434 |
+
coverage.show_hide_help = function () {
|
| 435 |
+
const helpCheck = document.getElementById("help_panel_state")
|
| 436 |
+
helpCheck.checked = !helpCheck.checked;
|
| 437 |
+
}
|
| 438 |
+
|
| 439 |
+
// Return a string indicating what kind of chunk this line belongs to,
|
| 440 |
+
// or null if not a chunk.
|
| 441 |
+
coverage.chunk_indicator = function (line_elt) {
|
| 442 |
+
const classes = line_elt?.className;
|
| 443 |
+
if (!classes) {
|
| 444 |
+
return null;
|
| 445 |
+
}
|
| 446 |
+
const match = classes.match(/\bshow_\w+\b/);
|
| 447 |
+
if (!match) {
|
| 448 |
+
return null;
|
| 449 |
+
}
|
| 450 |
+
return match[0];
|
| 451 |
+
};
|
| 452 |
+
|
| 453 |
+
coverage.to_next_chunk = function () {
|
| 454 |
+
const c = coverage;
|
| 455 |
+
|
| 456 |
+
// Find the start of the next colored chunk.
|
| 457 |
+
var probe = c.sel_end;
|
| 458 |
+
var chunk_indicator, probe_line;
|
| 459 |
+
while (true) {
|
| 460 |
+
probe_line = c.line_elt(probe);
|
| 461 |
+
if (!probe_line) {
|
| 462 |
+
return;
|
| 463 |
+
}
|
| 464 |
+
chunk_indicator = c.chunk_indicator(probe_line);
|
| 465 |
+
if (chunk_indicator) {
|
| 466 |
+
break;
|
| 467 |
+
}
|
| 468 |
+
probe++;
|
| 469 |
+
}
|
| 470 |
+
|
| 471 |
+
// There's a next chunk, `probe` points to it.
|
| 472 |
+
var begin = probe;
|
| 473 |
+
|
| 474 |
+
// Find the end of this chunk.
|
| 475 |
+
var next_indicator = chunk_indicator;
|
| 476 |
+
while (next_indicator === chunk_indicator) {
|
| 477 |
+
probe++;
|
| 478 |
+
probe_line = c.line_elt(probe);
|
| 479 |
+
next_indicator = c.chunk_indicator(probe_line);
|
| 480 |
+
}
|
| 481 |
+
c.set_sel(begin, probe);
|
| 482 |
+
c.show_selection();
|
| 483 |
+
};
|
| 484 |
+
|
| 485 |
+
coverage.to_prev_chunk = function () {
|
| 486 |
+
const c = coverage;
|
| 487 |
+
|
| 488 |
+
// Find the end of the prev colored chunk.
|
| 489 |
+
var probe = c.sel_begin-1;
|
| 490 |
+
var probe_line = c.line_elt(probe);
|
| 491 |
+
if (!probe_line) {
|
| 492 |
+
return;
|
| 493 |
+
}
|
| 494 |
+
var chunk_indicator = c.chunk_indicator(probe_line);
|
| 495 |
+
while (probe > 1 && !chunk_indicator) {
|
| 496 |
+
probe--;
|
| 497 |
+
probe_line = c.line_elt(probe);
|
| 498 |
+
if (!probe_line) {
|
| 499 |
+
return;
|
| 500 |
+
}
|
| 501 |
+
chunk_indicator = c.chunk_indicator(probe_line);
|
| 502 |
+
}
|
| 503 |
+
|
| 504 |
+
// There's a prev chunk, `probe` points to its last line.
|
| 505 |
+
var end = probe+1;
|
| 506 |
+
|
| 507 |
+
// Find the beginning of this chunk.
|
| 508 |
+
var prev_indicator = chunk_indicator;
|
| 509 |
+
while (prev_indicator === chunk_indicator) {
|
| 510 |
+
probe--;
|
| 511 |
+
if (probe <= 0) {
|
| 512 |
+
return;
|
| 513 |
+
}
|
| 514 |
+
probe_line = c.line_elt(probe);
|
| 515 |
+
prev_indicator = c.chunk_indicator(probe_line);
|
| 516 |
+
}
|
| 517 |
+
c.set_sel(probe+1, end);
|
| 518 |
+
c.show_selection();
|
| 519 |
+
};
|
| 520 |
+
|
| 521 |
+
// Returns 0, 1, or 2: how many of the two ends of the selection are on
|
| 522 |
+
// the screen right now?
|
| 523 |
+
coverage.selection_ends_on_screen = function () {
|
| 524 |
+
if (coverage.sel_begin === 0) {
|
| 525 |
+
return 0;
|
| 526 |
+
}
|
| 527 |
+
|
| 528 |
+
const begin = coverage.line_elt(coverage.sel_begin);
|
| 529 |
+
const end = coverage.line_elt(coverage.sel_end-1);
|
| 530 |
+
|
| 531 |
+
return (
|
| 532 |
+
(checkVisible(begin) ? 1 : 0)
|
| 533 |
+
+ (checkVisible(end) ? 1 : 0)
|
| 534 |
+
);
|
| 535 |
+
};
|
| 536 |
+
|
| 537 |
+
coverage.to_next_chunk_nicely = function () {
|
| 538 |
+
if (coverage.selection_ends_on_screen() === 0) {
|
| 539 |
+
// The selection is entirely off the screen:
|
| 540 |
+
// Set the top line on the screen as selection.
|
| 541 |
+
|
| 542 |
+
// This will select the top-left of the viewport
|
| 543 |
+
// As this is most likely the span with the line number we take the parent
|
| 544 |
+
const line = document.elementFromPoint(0, 0).parentElement;
|
| 545 |
+
if (line.parentElement !== document.getElementById("source")) {
|
| 546 |
+
// The element is not a source line but the header or similar
|
| 547 |
+
coverage.select_line_or_chunk(1);
|
| 548 |
+
}
|
| 549 |
+
else {
|
| 550 |
+
// We extract the line number from the id
|
| 551 |
+
coverage.select_line_or_chunk(parseInt(line.id.substring(1), 10));
|
| 552 |
+
}
|
| 553 |
+
}
|
| 554 |
+
coverage.to_next_chunk();
|
| 555 |
+
};
|
| 556 |
+
|
| 557 |
+
coverage.to_prev_chunk_nicely = function () {
|
| 558 |
+
if (coverage.selection_ends_on_screen() === 0) {
|
| 559 |
+
// The selection is entirely off the screen:
|
| 560 |
+
// Set the lowest line on the screen as selection.
|
| 561 |
+
|
| 562 |
+
// This will select the bottom-left of the viewport
|
| 563 |
+
// As this is most likely the span with the line number we take the parent
|
| 564 |
+
const line = document.elementFromPoint(document.documentElement.clientHeight-1, 0).parentElement;
|
| 565 |
+
if (line.parentElement !== document.getElementById("source")) {
|
| 566 |
+
// The element is not a source line but the header or similar
|
| 567 |
+
coverage.select_line_or_chunk(coverage.lines_len);
|
| 568 |
+
}
|
| 569 |
+
else {
|
| 570 |
+
// We extract the line number from the id
|
| 571 |
+
coverage.select_line_or_chunk(parseInt(line.id.substring(1), 10));
|
| 572 |
+
}
|
| 573 |
+
}
|
| 574 |
+
coverage.to_prev_chunk();
|
| 575 |
+
};
|
| 576 |
+
|
| 577 |
+
// Select line number lineno, or if it is in a colored chunk, select the
|
| 578 |
+
// entire chunk
|
| 579 |
+
coverage.select_line_or_chunk = function (lineno) {
|
| 580 |
+
var c = coverage;
|
| 581 |
+
var probe_line = c.line_elt(lineno);
|
| 582 |
+
if (!probe_line) {
|
| 583 |
+
return;
|
| 584 |
+
}
|
| 585 |
+
var the_indicator = c.chunk_indicator(probe_line);
|
| 586 |
+
if (the_indicator) {
|
| 587 |
+
// The line is in a highlighted chunk.
|
| 588 |
+
// Search backward for the first line.
|
| 589 |
+
var probe = lineno;
|
| 590 |
+
var indicator = the_indicator;
|
| 591 |
+
while (probe > 0 && indicator === the_indicator) {
|
| 592 |
+
probe--;
|
| 593 |
+
probe_line = c.line_elt(probe);
|
| 594 |
+
if (!probe_line) {
|
| 595 |
+
break;
|
| 596 |
+
}
|
| 597 |
+
indicator = c.chunk_indicator(probe_line);
|
| 598 |
+
}
|
| 599 |
+
var begin = probe + 1;
|
| 600 |
+
|
| 601 |
+
// Search forward for the last line.
|
| 602 |
+
probe = lineno;
|
| 603 |
+
indicator = the_indicator;
|
| 604 |
+
while (indicator === the_indicator) {
|
| 605 |
+
probe++;
|
| 606 |
+
probe_line = c.line_elt(probe);
|
| 607 |
+
indicator = c.chunk_indicator(probe_line);
|
| 608 |
+
}
|
| 609 |
+
|
| 610 |
+
coverage.set_sel(begin, probe);
|
| 611 |
+
}
|
| 612 |
+
else {
|
| 613 |
+
coverage.set_sel(lineno);
|
| 614 |
+
}
|
| 615 |
+
};
|
| 616 |
+
|
| 617 |
+
coverage.show_selection = function () {
|
| 618 |
+
// Highlight the lines in the chunk
|
| 619 |
+
document.querySelectorAll("#source .highlight").forEach(e => e.classList.remove("highlight"));
|
| 620 |
+
for (let probe = coverage.sel_begin; probe < coverage.sel_end; probe++) {
|
| 621 |
+
coverage.line_elt(probe).querySelector(".n").classList.add("highlight");
|
| 622 |
+
}
|
| 623 |
+
|
| 624 |
+
coverage.scroll_to_selection();
|
| 625 |
+
};
|
| 626 |
+
|
| 627 |
+
coverage.scroll_to_selection = function () {
|
| 628 |
+
// Scroll the page if the chunk isn't fully visible.
|
| 629 |
+
if (coverage.selection_ends_on_screen() < 2) {
|
| 630 |
+
const element = coverage.line_elt(coverage.sel_begin);
|
| 631 |
+
coverage.scroll_window(element.offsetTop - 60);
|
| 632 |
+
}
|
| 633 |
+
};
|
| 634 |
+
|
| 635 |
+
coverage.scroll_window = function (to_pos) {
|
| 636 |
+
window.scroll({top: to_pos, behavior: "smooth"});
|
| 637 |
+
};
|
| 638 |
+
|
| 639 |
+
coverage.init_scroll_markers = function () {
|
| 640 |
+
// Init some variables
|
| 641 |
+
coverage.lines_len = document.querySelectorAll("#source > p").length;
|
| 642 |
+
|
| 643 |
+
// Build html
|
| 644 |
+
coverage.build_scroll_markers();
|
| 645 |
+
};
|
| 646 |
+
|
| 647 |
+
coverage.build_scroll_markers = function () {
|
| 648 |
+
const temp_scroll_marker = document.getElementById("scroll_marker")
|
| 649 |
+
if (temp_scroll_marker) temp_scroll_marker.remove();
|
| 650 |
+
// Don't build markers if the window has no scroll bar.
|
| 651 |
+
if (document.body.scrollHeight <= window.innerHeight) {
|
| 652 |
+
return;
|
| 653 |
+
}
|
| 654 |
+
|
| 655 |
+
const marker_scale = window.innerHeight / document.body.scrollHeight;
|
| 656 |
+
const line_height = Math.min(Math.max(3, window.innerHeight / coverage.lines_len), 10);
|
| 657 |
+
|
| 658 |
+
let previous_line = -99, last_mark, last_top;
|
| 659 |
+
|
| 660 |
+
const scroll_marker = document.createElement("div");
|
| 661 |
+
scroll_marker.id = "scroll_marker";
|
| 662 |
+
document.getElementById("source").querySelectorAll(
|
| 663 |
+
"p.show_run, p.show_mis, p.show_exc, p.show_exc, p.show_par"
|
| 664 |
+
).forEach(element => {
|
| 665 |
+
const line_top = Math.floor(element.offsetTop * marker_scale);
|
| 666 |
+
const line_number = parseInt(element.querySelector(".n a").id.substr(1));
|
| 667 |
+
|
| 668 |
+
if (line_number === previous_line + 1) {
|
| 669 |
+
// If this solid missed block just make previous mark higher.
|
| 670 |
+
last_mark.style.height = `${line_top + line_height - last_top}px`;
|
| 671 |
+
}
|
| 672 |
+
else {
|
| 673 |
+
// Add colored line in scroll_marker block.
|
| 674 |
+
last_mark = document.createElement("div");
|
| 675 |
+
last_mark.id = `m${line_number}`;
|
| 676 |
+
last_mark.classList.add("marker");
|
| 677 |
+
last_mark.style.height = `${line_height}px`;
|
| 678 |
+
last_mark.style.top = `${line_top}px`;
|
| 679 |
+
scroll_marker.append(last_mark);
|
| 680 |
+
last_top = line_top;
|
| 681 |
+
}
|
| 682 |
+
|
| 683 |
+
previous_line = line_number;
|
| 684 |
+
});
|
| 685 |
+
|
| 686 |
+
// Append last to prevent layout calculation
|
| 687 |
+
document.body.append(scroll_marker);
|
| 688 |
+
};
|
| 689 |
+
|
| 690 |
+
coverage.wire_up_sticky_header = function () {
|
| 691 |
+
const header = document.querySelector("header");
|
| 692 |
+
const header_bottom = (
|
| 693 |
+
header.querySelector(".content h2").getBoundingClientRect().top -
|
| 694 |
+
header.getBoundingClientRect().top
|
| 695 |
+
);
|
| 696 |
+
|
| 697 |
+
function updateHeader() {
|
| 698 |
+
if (window.scrollY > header_bottom) {
|
| 699 |
+
header.classList.add("sticky");
|
| 700 |
+
}
|
| 701 |
+
else {
|
| 702 |
+
header.classList.remove("sticky");
|
| 703 |
+
}
|
| 704 |
+
}
|
| 705 |
+
|
| 706 |
+
window.addEventListener("scroll", updateHeader);
|
| 707 |
+
updateHeader();
|
| 708 |
+
};
|
| 709 |
+
|
| 710 |
+
coverage.expand_contexts = function (e) {
|
| 711 |
+
var ctxs = e.target.parentNode.querySelector(".ctxs");
|
| 712 |
+
|
| 713 |
+
if (!ctxs.classList.contains("expanded")) {
|
| 714 |
+
var ctxs_text = ctxs.textContent;
|
| 715 |
+
var width = Number(ctxs_text[0]);
|
| 716 |
+
ctxs.textContent = "";
|
| 717 |
+
for (var i = 1; i < ctxs_text.length; i += width) {
|
| 718 |
+
key = ctxs_text.substring(i, i + width).trim();
|
| 719 |
+
ctxs.appendChild(document.createTextNode(contexts[key]));
|
| 720 |
+
ctxs.appendChild(document.createElement("br"));
|
| 721 |
+
}
|
| 722 |
+
ctxs.classList.add("expanded");
|
| 723 |
+
}
|
| 724 |
+
};
|
| 725 |
+
|
| 726 |
+
document.addEventListener("DOMContentLoaded", () => {
|
| 727 |
+
if (document.body.classList.contains("indexfile")) {
|
| 728 |
+
coverage.index_ready();
|
| 729 |
+
}
|
| 730 |
+
else {
|
| 731 |
+
coverage.pyfile_ready();
|
| 732 |
+
}
|
| 733 |
+
});
|
annotations/annotation_1/htmlcov/favicon_32_cb_58284776.png
AD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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<!DOCTYPE html>
|
| 2 |
+
<html lang="en">
|
| 3 |
+
<head>
|
| 4 |
+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
| 5 |
+
<title>Coverage report</title>
|
| 6 |
+
<link rel="icon" sizes="32x32" href="favicon_32_cb_58284776.png">
|
| 7 |
+
<link rel="stylesheet" href="style_cb_6b508a39.css" type="text/css">
|
| 8 |
+
<script src="coverage_html_cb_6fb7b396.js" defer></script>
|
| 9 |
+
</head>
|
| 10 |
+
<body class="indexfile">
|
| 11 |
+
<header>
|
| 12 |
+
<div class="content">
|
| 13 |
+
<h1>Coverage report:
|
| 14 |
+
<span class="pc_cov">73%</span>
|
| 15 |
+
</h1>
|
| 16 |
+
<aside id="help_panel_wrapper">
|
| 17 |
+
<input id="help_panel_state" type="checkbox">
|
| 18 |
+
<label for="help_panel_state">
|
| 19 |
+
<img id="keyboard_icon" src="keybd_closed_cb_ce680311.png" alt="Show/hide keyboard shortcuts">
|
| 20 |
+
</label>
|
| 21 |
+
<div id="help_panel">
|
| 22 |
+
<p class="legend">Shortcuts on this page</p>
|
| 23 |
+
<div class="keyhelp">
|
| 24 |
+
<p>
|
| 25 |
+
<kbd>f</kbd>
|
| 26 |
+
<kbd>n</kbd>
|
| 27 |
+
<kbd>s</kbd>
|
| 28 |
+
<kbd>m</kbd>
|
| 29 |
+
<kbd>x</kbd>
|
| 30 |
+
<kbd>c</kbd>
|
| 31 |
+
change column sorting
|
| 32 |
+
</p>
|
| 33 |
+
<p>
|
| 34 |
+
<kbd>[</kbd>
|
| 35 |
+
<kbd>]</kbd>
|
| 36 |
+
prev/next file
|
| 37 |
+
</p>
|
| 38 |
+
<p>
|
| 39 |
+
<kbd>?</kbd> show/hide this help
|
| 40 |
+
</p>
|
| 41 |
+
</div>
|
| 42 |
+
</div>
|
| 43 |
+
</aside>
|
| 44 |
+
<form id="filter_container">
|
| 45 |
+
<input id="filter" type="text" value="" placeholder="filter...">
|
| 46 |
+
<div>
|
| 47 |
+
<input id="hide100" type="checkbox" >
|
| 48 |
+
<label for="hide100">hide covered</label>
|
| 49 |
+
</div>
|
| 50 |
+
</form>
|
| 51 |
+
<h2>
|
| 52 |
+
<a class="button" href="index.html">Files</a>
|
| 53 |
+
<a class="button current">Functions</a>
|
| 54 |
+
<a class="button" href="class_index.html">Classes</a>
|
| 55 |
+
</h2>
|
| 56 |
+
<p class="text">
|
| 57 |
+
<a class="nav" href="https://coverage.readthedocs.io/en/7.10.6">coverage.py v7.10.6</a>,
|
| 58 |
+
created at 2025-09-03 15:10 -0500
|
| 59 |
+
</p>
|
| 60 |
+
</div>
|
| 61 |
+
</header>
|
| 62 |
+
<main id="index">
|
| 63 |
+
<table class="index" data-sortable>
|
| 64 |
+
<thead>
|
| 65 |
+
<tr class="tablehead" title="Click to sort">
|
| 66 |
+
<th id="file" class="name left" aria-sort="none" data-shortcut="f">File<span class="arrows"></span></th>
|
| 67 |
+
<th id="region" class="name left" aria-sort="none" data-default-sort-order="ascending" data-shortcut="n">function<span class="arrows"></span></th>
|
| 68 |
+
<th id="statements" aria-sort="none" data-default-sort-order="descending" data-shortcut="s">statements<span class="arrows"></span></th>
|
| 69 |
+
<th id="missing" aria-sort="none" data-default-sort-order="descending" data-shortcut="m">missing<span class="arrows"></span></th>
|
| 70 |
+
<th id="excluded" aria-sort="none" data-default-sort-order="descending" data-shortcut="x">excluded<span class="arrows"></span></th>
|
| 71 |
+
<th id="coverage" class="right" aria-sort="none" data-shortcut="c">coverage<span class="arrows"></span></th>
|
| 72 |
+
</tr>
|
| 73 |
+
</thead>
|
| 74 |
+
<tbody>
|
| 75 |
+
<tr class="region">
|
| 76 |
+
<td class="name left"><a href="canonical_py.html#t86">canonical.py</a></td>
|
| 77 |
+
<td class="name left"><a href="canonical_py.html#t86"><data value='init__'>PEDANT.__init__</data></a></td>
|
| 78 |
+
<td>29</td>
|
| 79 |
+
<td>7</td>
|
| 80 |
+
<td>0</td>
|
| 81 |
+
<td class="right" data-ratio="22 29">76%</td>
|
| 82 |
+
</tr>
|
| 83 |
+
<tr class="region">
|
| 84 |
+
<td class="name left"><a href="canonical_py.html#t141">canonical.py</a></td>
|
| 85 |
+
<td class="name left"><a href="canonical_py.html#t141"><data value='download_latest_model'>PEDANT.download_latest_model</data></a></td>
|
| 86 |
+
<td>25</td>
|
| 87 |
+
<td>25</td>
|
| 88 |
+
<td>0</td>
|
| 89 |
+
<td class="right" data-ratio="0 25">0%</td>
|
| 90 |
+
</tr>
|
| 91 |
+
<tr class="region">
|
| 92 |
+
<td class="name left"><a href="canonical_py.html#t183">canonical.py</a></td>
|
| 93 |
+
<td class="name left"><a href="canonical_py.html#t183"><data value='get_rule_features'>PEDANT.get_rule_features</data></a></td>
|
| 94 |
+
<td>5</td>
|
| 95 |
+
<td>0</td>
|
| 96 |
+
<td>0</td>
|
| 97 |
+
<td class="right" data-ratio="5 5">100%</td>
|
| 98 |
+
</tr>
|
| 99 |
+
<tr class="region">
|
| 100 |
+
<td class="name left"><a href="canonical_py.html#t224">canonical.py</a></td>
|
| 101 |
+
<td class="name left"><a href="canonical_py.html#t224"><data value='get_type_features'>PEDANT.get_type_features</data></a></td>
|
| 102 |
+
<td>3</td>
|
| 103 |
+
<td>0</td>
|
| 104 |
+
<td>0</td>
|
| 105 |
+
<td class="right" data-ratio="3 3">100%</td>
|
| 106 |
+
</tr>
|
| 107 |
+
<tr class="region">
|
| 108 |
+
<td class="name left"><a href="canonical_py.html#t256">canonical.py</a></td>
|
| 109 |
+
<td class="name left"><a href="canonical_py.html#t256"><data value='get_f1_features'>PEDANT.get_f1_features</data></a></td>
|
| 110 |
+
<td>12</td>
|
| 111 |
+
<td>0</td>
|
| 112 |
+
<td>0</td>
|
| 113 |
+
<td class="right" data-ratio="12 12">100%</td>
|
| 114 |
+
</tr>
|
| 115 |
+
<tr class="region">
|
| 116 |
+
<td class="name left"><a href="canonical_py.html#t297">canonical.py</a></td>
|
| 117 |
+
<td class="name left"><a href="canonical_py.html#t297"><data value='construct_features'>PEDANT.construct_features</data></a></td>
|
| 118 |
+
<td>12</td>
|
| 119 |
+
<td>1</td>
|
| 120 |
+
<td>0</td>
|
| 121 |
+
<td class="right" data-ratio="11 12">92%</td>
|
| 122 |
+
</tr>
|
| 123 |
+
<tr class="region">
|
| 124 |
+
<td class="name left"><a href="canonical_py.html#t361">canonical.py</a></td>
|
| 125 |
+
<td class="name left"><a href="canonical_py.html#t361"><data value='get_score'>PEDANT.get_score</data></a></td>
|
| 126 |
+
<td>9</td>
|
| 127 |
+
<td>0</td>
|
| 128 |
+
<td>0</td>
|
| 129 |
+
<td class="right" data-ratio="9 9">100%</td>
|
| 130 |
+
</tr>
|
| 131 |
+
<tr class="region">
|
| 132 |
+
<td class="name left"><a href="canonical_py.html#t406">canonical.py</a></td>
|
| 133 |
+
<td class="name left"><a href="canonical_py.html#t406"><data value='get_scores'>PEDANT.get_scores</data></a></td>
|
| 134 |
+
<td>10</td>
|
| 135 |
+
<td>0</td>
|
| 136 |
+
<td>0</td>
|
| 137 |
+
<td class="right" data-ratio="10 10">100%</td>
|
| 138 |
+
</tr>
|
| 139 |
+
<tr class="region">
|
| 140 |
+
<td class="name left"><a href="canonical_py.html#t443">canonical.py</a></td>
|
| 141 |
+
<td class="name left"><a href="canonical_py.html#t443"><data value='get_question_type'>PEDANT.get_question_type</data></a></td>
|
| 142 |
+
<td>8</td>
|
| 143 |
+
<td>3</td>
|
| 144 |
+
<td>0</td>
|
| 145 |
+
<td class="right" data-ratio="5 8">62%</td>
|
| 146 |
+
</tr>
|
| 147 |
+
<tr class="region">
|
| 148 |
+
<td class="name left"><a href="canonical_py.html#t481">canonical.py</a></td>
|
| 149 |
+
<td class="name left"><a href="canonical_py.html#t481"><data value='get_judgement_rule'>PEDANT.get_judgement_rule</data></a></td>
|
| 150 |
+
<td>20</td>
|
| 151 |
+
<td>10</td>
|
| 152 |
+
<td>0</td>
|
| 153 |
+
<td class="right" data-ratio="10 20">50%</td>
|
| 154 |
+
</tr>
|
| 155 |
+
<tr class="region">
|
| 156 |
+
<td class="name left"><a href="canonical_py.html#t557">canonical.py</a></td>
|
| 157 |
+
<td class="name left"><a href="canonical_py.html#t557"><data value='get_highest_score'>PEDANT.get_highest_score</data></a></td>
|
| 158 |
+
<td>9</td>
|
| 159 |
+
<td>0</td>
|
| 160 |
+
<td>0</td>
|
| 161 |
+
<td class="right" data-ratio="9 9">100%</td>
|
| 162 |
+
</tr>
|
| 163 |
+
<tr class="region">
|
| 164 |
+
<td class="name left"><a href="canonical_py.html#t592">canonical.py</a></td>
|
| 165 |
+
<td class="name left"><a href="canonical_py.html#t592"><data value='evaluate'>PEDANT.evaluate</data></a></td>
|
| 166 |
+
<td>16</td>
|
| 167 |
+
<td>2</td>
|
| 168 |
+
<td>0</td>
|
| 169 |
+
<td class="right" data-ratio="14 16">88%</td>
|
| 170 |
+
</tr>
|
| 171 |
+
<tr class="region">
|
| 172 |
+
<td class="name left"><a href="canonical_py.html">canonical.py</a></td>
|
| 173 |
+
<td class="name left"><a href="canonical_py.html"><data value=''><span class='no-noun'>(no function)</span></data></a></td>
|
| 174 |
+
<td>18</td>
|
| 175 |
+
<td>0</td>
|
| 176 |
+
<td>0</td>
|
| 177 |
+
<td class="right" data-ratio="18 18">100%</td>
|
| 178 |
+
</tr>
|
| 179 |
+
</tbody>
|
| 180 |
+
<tfoot>
|
| 181 |
+
<tr class="total">
|
| 182 |
+
<td class="name left">Total</td>
|
| 183 |
+
<td class="name left"> </td>
|
| 184 |
+
<td>176</td>
|
| 185 |
+
<td>48</td>
|
| 186 |
+
<td>0</td>
|
| 187 |
+
<td class="right" data-ratio="128 176">73%</td>
|
| 188 |
+
</tr>
|
| 189 |
+
</tfoot>
|
| 190 |
+
</table>
|
| 191 |
+
<p id="no_rows">
|
| 192 |
+
No items found using the specified filter.
|
| 193 |
+
</p>
|
| 194 |
+
</main>
|
| 195 |
+
<footer>
|
| 196 |
+
<div class="content">
|
| 197 |
+
<p>
|
| 198 |
+
<a class="nav" href="https://coverage.readthedocs.io/en/7.10.6">coverage.py v7.10.6</a>,
|
| 199 |
+
created at 2025-09-03 15:10 -0500
|
| 200 |
+
</p>
|
| 201 |
+
</div>
|
| 202 |
+
<aside class="hidden">
|
| 203 |
+
<a id="prevFileLink" class="nav" href=""></a>
|
| 204 |
+
<a id="nextFileLink" class="nav" href=""></a>
|
| 205 |
+
<button type="button" class="button_prev_file" data-shortcut="["></button>
|
| 206 |
+
<button type="button" class="button_next_file" data-shortcut="]"></button>
|
| 207 |
+
<button type="button" class="button_show_hide_help" data-shortcut="?"></button>
|
| 208 |
+
</aside>
|
| 209 |
+
</footer>
|
| 210 |
+
</body>
|
| 211 |
+
</html>
|
annotations/annotation_1/htmlcov/index.html
ADDED
|
@@ -0,0 +1,111 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<!DOCTYPE html>
|
| 2 |
+
<html lang="en">
|
| 3 |
+
<head>
|
| 4 |
+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
| 5 |
+
<title>Coverage report</title>
|
| 6 |
+
<link rel="icon" sizes="32x32" href="favicon_32_cb_58284776.png">
|
| 7 |
+
<link rel="stylesheet" href="style_cb_6b508a39.css" type="text/css">
|
| 8 |
+
<script src="coverage_html_cb_6fb7b396.js" defer></script>
|
| 9 |
+
</head>
|
| 10 |
+
<body class="indexfile">
|
| 11 |
+
<header>
|
| 12 |
+
<div class="content">
|
| 13 |
+
<h1>Coverage report:
|
| 14 |
+
<span class="pc_cov">73%</span>
|
| 15 |
+
</h1>
|
| 16 |
+
<aside id="help_panel_wrapper">
|
| 17 |
+
<input id="help_panel_state" type="checkbox">
|
| 18 |
+
<label for="help_panel_state">
|
| 19 |
+
<img id="keyboard_icon" src="keybd_closed_cb_ce680311.png" alt="Show/hide keyboard shortcuts">
|
| 20 |
+
</label>
|
| 21 |
+
<div id="help_panel">
|
| 22 |
+
<p class="legend">Shortcuts on this page</p>
|
| 23 |
+
<div class="keyhelp">
|
| 24 |
+
<p>
|
| 25 |
+
<kbd>f</kbd>
|
| 26 |
+
<kbd>s</kbd>
|
| 27 |
+
<kbd>m</kbd>
|
| 28 |
+
<kbd>x</kbd>
|
| 29 |
+
<kbd>c</kbd>
|
| 30 |
+
change column sorting
|
| 31 |
+
</p>
|
| 32 |
+
<p>
|
| 33 |
+
<kbd>[</kbd>
|
| 34 |
+
<kbd>]</kbd>
|
| 35 |
+
prev/next file
|
| 36 |
+
</p>
|
| 37 |
+
<p>
|
| 38 |
+
<kbd>?</kbd> show/hide this help
|
| 39 |
+
</p>
|
| 40 |
+
</div>
|
| 41 |
+
</div>
|
| 42 |
+
</aside>
|
| 43 |
+
<form id="filter_container">
|
| 44 |
+
<input id="filter" type="text" value="" placeholder="filter...">
|
| 45 |
+
<div>
|
| 46 |
+
<input id="hide100" type="checkbox" >
|
| 47 |
+
<label for="hide100">hide covered</label>
|
| 48 |
+
</div>
|
| 49 |
+
</form>
|
| 50 |
+
<h2>
|
| 51 |
+
<a class="button current">Files</a>
|
| 52 |
+
<a class="button" href="function_index.html">Functions</a>
|
| 53 |
+
<a class="button" href="class_index.html">Classes</a>
|
| 54 |
+
</h2>
|
| 55 |
+
<p class="text">
|
| 56 |
+
<a class="nav" href="https://coverage.readthedocs.io/en/7.10.6">coverage.py v7.10.6</a>,
|
| 57 |
+
created at 2025-09-03 15:10 -0500
|
| 58 |
+
</p>
|
| 59 |
+
</div>
|
| 60 |
+
</header>
|
| 61 |
+
<main id="index">
|
| 62 |
+
<table class="index" data-sortable>
|
| 63 |
+
<thead>
|
| 64 |
+
<tr class="tablehead" title="Click to sort">
|
| 65 |
+
<th id="file" class="name left" aria-sort="none" data-shortcut="f">File<span class="arrows"></span></th>
|
| 66 |
+
<th id="statements" aria-sort="none" data-default-sort-order="descending" data-shortcut="s">statements<span class="arrows"></span></th>
|
| 67 |
+
<th id="missing" aria-sort="none" data-default-sort-order="descending" data-shortcut="m">missing<span class="arrows"></span></th>
|
| 68 |
+
<th id="excluded" aria-sort="none" data-default-sort-order="descending" data-shortcut="x">excluded<span class="arrows"></span></th>
|
| 69 |
+
<th id="coverage" class="right" aria-sort="none" data-shortcut="c">coverage<span class="arrows"></span></th>
|
| 70 |
+
</tr>
|
| 71 |
+
</thead>
|
| 72 |
+
<tbody>
|
| 73 |
+
<tr class="region">
|
| 74 |
+
<td class="name left"><a href="canonical_py.html">canonical.py</a></td>
|
| 75 |
+
<td>176</td>
|
| 76 |
+
<td>48</td>
|
| 77 |
+
<td>0</td>
|
| 78 |
+
<td class="right" data-ratio="128 176">73%</td>
|
| 79 |
+
</tr>
|
| 80 |
+
</tbody>
|
| 81 |
+
<tfoot>
|
| 82 |
+
<tr class="total">
|
| 83 |
+
<td class="name left">Total</td>
|
| 84 |
+
<td>176</td>
|
| 85 |
+
<td>48</td>
|
| 86 |
+
<td>0</td>
|
| 87 |
+
<td class="right" data-ratio="128 176">73%</td>
|
| 88 |
+
</tr>
|
| 89 |
+
</tfoot>
|
| 90 |
+
</table>
|
| 91 |
+
<p id="no_rows">
|
| 92 |
+
No items found using the specified filter.
|
| 93 |
+
</p>
|
| 94 |
+
</main>
|
| 95 |
+
<footer>
|
| 96 |
+
<div class="content">
|
| 97 |
+
<p>
|
| 98 |
+
<a class="nav" href="https://coverage.readthedocs.io/en/7.10.6">coverage.py v7.10.6</a>,
|
| 99 |
+
created at 2025-09-03 15:10 -0500
|
| 100 |
+
</p>
|
| 101 |
+
</div>
|
| 102 |
+
<aside class="hidden">
|
| 103 |
+
<a id="prevFileLink" class="nav" href="canonical_py.html"></a>
|
| 104 |
+
<a id="nextFileLink" class="nav" href="canonical_py.html"></a>
|
| 105 |
+
<button type="button" class="button_prev_file" data-shortcut="["></button>
|
| 106 |
+
<button type="button" class="button_next_file" data-shortcut="]"></button>
|
| 107 |
+
<button type="button" class="button_show_hide_help" data-shortcut="?"></button>
|
| 108 |
+
</aside>
|
| 109 |
+
</footer>
|
| 110 |
+
</body>
|
| 111 |
+
</html>
|
annotations/annotation_1/htmlcov/keybd_closed_cb_ce680311.png
ADDED
|
Git LFS Details
|
annotations/annotation_1/htmlcov/status.json
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
{"note":"This file is an internal implementation detail to speed up HTML report generation. Its format can change at any time. You might be looking for the JSON report: https://coverage.rtfd.io/cmd.html#cmd-json","format":5,"version":"7.10.6","globals":"d044071beaa9db33c4e3d198fba71bd0","files":{"canonical_py":{"hash":"4dda8a5b6671d9b1601b54ae094c740d","index":{"url":"canonical_py.html","file":"canonical.py","description":"","nums":{"precision":0,"n_files":1,"n_statements":176,"n_excluded":0,"n_missing":48,"n_branches":0,"n_partial_branches":0,"n_missing_branches":0}}}}}
|
annotations/annotation_1/htmlcov/style_cb_6b508a39.css
ADDED
|
@@ -0,0 +1,377 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
@charset "UTF-8";
|
| 2 |
+
/* Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0 */
|
| 3 |
+
/* For details: https://github.com/nedbat/coveragepy/blob/master/NOTICE.txt */
|
| 4 |
+
/* Don't edit this .css file. Edit the .scss file instead! */
|
| 5 |
+
html, body, h1, h2, h3, p, table, td, th { margin: 0; padding: 0; border: 0; font-weight: inherit; font-style: inherit; font-size: 100%; font-family: inherit; vertical-align: baseline; }
|
| 6 |
+
|
| 7 |
+
body { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Ubuntu, Cantarell, "Helvetica Neue", sans-serif; font-size: 1em; background: #fff; color: #000; }
|
| 8 |
+
|
| 9 |
+
@media (prefers-color-scheme: dark) { body { background: #1e1e1e; } }
|
| 10 |
+
|
| 11 |
+
@media (prefers-color-scheme: dark) { body { color: #eee; } }
|
| 12 |
+
|
| 13 |
+
html > body { font-size: 16px; }
|
| 14 |
+
|
| 15 |
+
a:active, a:focus { outline: 2px dashed #007acc; }
|
| 16 |
+
|
| 17 |
+
p { font-size: .875em; line-height: 1.4em; }
|
| 18 |
+
|
| 19 |
+
table { border-collapse: collapse; }
|
| 20 |
+
|
| 21 |
+
td { vertical-align: top; }
|
| 22 |
+
|
| 23 |
+
table tr.hidden { display: none !important; }
|
| 24 |
+
|
| 25 |
+
p#no_rows { display: none; font-size: 1.15em; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Ubuntu, Cantarell, "Helvetica Neue", sans-serif; }
|
| 26 |
+
|
| 27 |
+
a.nav { text-decoration: none; color: inherit; }
|
| 28 |
+
|
| 29 |
+
a.nav:hover { text-decoration: underline; color: inherit; }
|
| 30 |
+
|
| 31 |
+
.hidden { display: none; }
|
| 32 |
+
|
| 33 |
+
header { background: #f8f8f8; width: 100%; z-index: 2; border-bottom: 1px solid #ccc; }
|
| 34 |
+
|
| 35 |
+
@media (prefers-color-scheme: dark) { header { background: black; } }
|
| 36 |
+
|
| 37 |
+
@media (prefers-color-scheme: dark) { header { border-color: #333; } }
|
| 38 |
+
|
| 39 |
+
header .content { padding: 1rem 3.5rem; }
|
| 40 |
+
|
| 41 |
+
header h2 { margin-top: .5em; font-size: 1em; }
|
| 42 |
+
|
| 43 |
+
header h2 a.button { font-family: inherit; font-size: inherit; border: 1px solid; border-radius: .2em; background: #eee; color: inherit; text-decoration: none; padding: .1em .5em; margin: 1px calc(.1em + 1px); cursor: pointer; border-color: #ccc; }
|
| 44 |
+
|
| 45 |
+
@media (prefers-color-scheme: dark) { header h2 a.button { background: #333; } }
|
| 46 |
+
|
| 47 |
+
@media (prefers-color-scheme: dark) { header h2 a.button { border-color: #444; } }
|
| 48 |
+
|
| 49 |
+
header h2 a.button.current { border: 2px solid; background: #fff; border-color: #999; cursor: default; }
|
| 50 |
+
|
| 51 |
+
@media (prefers-color-scheme: dark) { header h2 a.button.current { background: #1e1e1e; } }
|
| 52 |
+
|
| 53 |
+
@media (prefers-color-scheme: dark) { header h2 a.button.current { border-color: #777; } }
|
| 54 |
+
|
| 55 |
+
header p.text { margin: .5em 0 -.5em; color: #666; font-style: italic; }
|
| 56 |
+
|
| 57 |
+
@media (prefers-color-scheme: dark) { header p.text { color: #aaa; } }
|
| 58 |
+
|
| 59 |
+
header.sticky { position: fixed; left: 0; right: 0; height: 2.5em; }
|
| 60 |
+
|
| 61 |
+
header.sticky .text { display: none; }
|
| 62 |
+
|
| 63 |
+
header.sticky h1, header.sticky h2 { font-size: 1em; margin-top: 0; display: inline-block; }
|
| 64 |
+
|
| 65 |
+
header.sticky .content { padding: 0.5rem 3.5rem; }
|
| 66 |
+
|
| 67 |
+
header.sticky .content p { font-size: 1em; }
|
| 68 |
+
|
| 69 |
+
header.sticky ~ #source { padding-top: 6.5em; }
|
| 70 |
+
|
| 71 |
+
main { position: relative; z-index: 1; }
|
| 72 |
+
|
| 73 |
+
footer { margin: 1rem 3.5rem; }
|
| 74 |
+
|
| 75 |
+
footer .content { padding: 0; color: #666; font-style: italic; }
|
| 76 |
+
|
| 77 |
+
@media (prefers-color-scheme: dark) { footer .content { color: #aaa; } }
|
| 78 |
+
|
| 79 |
+
#index { margin: 1rem 0 0 3.5rem; }
|
| 80 |
+
|
| 81 |
+
h1 { font-size: 1.25em; display: inline-block; }
|
| 82 |
+
|
| 83 |
+
#filter_container { float: right; margin: 0 2em 0 0; line-height: 1.66em; }
|
| 84 |
+
|
| 85 |
+
#filter_container #filter { width: 10em; padding: 0.2em 0.5em; border: 2px solid #ccc; background: #fff; color: #000; }
|
| 86 |
+
|
| 87 |
+
@media (prefers-color-scheme: dark) { #filter_container #filter { border-color: #444; } }
|
| 88 |
+
|
| 89 |
+
@media (prefers-color-scheme: dark) { #filter_container #filter { background: #1e1e1e; } }
|
| 90 |
+
|
| 91 |
+
@media (prefers-color-scheme: dark) { #filter_container #filter { color: #eee; } }
|
| 92 |
+
|
| 93 |
+
#filter_container #filter:focus { border-color: #007acc; }
|
| 94 |
+
|
| 95 |
+
#filter_container :disabled ~ label { color: #ccc; }
|
| 96 |
+
|
| 97 |
+
@media (prefers-color-scheme: dark) { #filter_container :disabled ~ label { color: #444; } }
|
| 98 |
+
|
| 99 |
+
#filter_container label { font-size: .875em; color: #666; }
|
| 100 |
+
|
| 101 |
+
@media (prefers-color-scheme: dark) { #filter_container label { color: #aaa; } }
|
| 102 |
+
|
| 103 |
+
header button { font-family: inherit; font-size: inherit; border: 1px solid; border-radius: .2em; background: #eee; color: inherit; text-decoration: none; padding: .1em .5em; margin: 1px calc(.1em + 1px); cursor: pointer; border-color: #ccc; }
|
| 104 |
+
|
| 105 |
+
@media (prefers-color-scheme: dark) { header button { background: #333; } }
|
| 106 |
+
|
| 107 |
+
@media (prefers-color-scheme: dark) { header button { border-color: #444; } }
|
| 108 |
+
|
| 109 |
+
header button:active, header button:focus { outline: 2px dashed #007acc; }
|
| 110 |
+
|
| 111 |
+
header button.run { background: #eeffee; }
|
| 112 |
+
|
| 113 |
+
@media (prefers-color-scheme: dark) { header button.run { background: #373d29; } }
|
| 114 |
+
|
| 115 |
+
header button.run.show_run { background: #dfd; border: 2px solid #00dd00; margin: 0 .1em; }
|
| 116 |
+
|
| 117 |
+
@media (prefers-color-scheme: dark) { header button.run.show_run { background: #373d29; } }
|
| 118 |
+
|
| 119 |
+
header button.mis { background: #ffeeee; }
|
| 120 |
+
|
| 121 |
+
@media (prefers-color-scheme: dark) { header button.mis { background: #4b1818; } }
|
| 122 |
+
|
| 123 |
+
header button.mis.show_mis { background: #fdd; border: 2px solid #ff0000; margin: 0 .1em; }
|
| 124 |
+
|
| 125 |
+
@media (prefers-color-scheme: dark) { header button.mis.show_mis { background: #4b1818; } }
|
| 126 |
+
|
| 127 |
+
header button.exc { background: #f7f7f7; }
|
| 128 |
+
|
| 129 |
+
@media (prefers-color-scheme: dark) { header button.exc { background: #333; } }
|
| 130 |
+
|
| 131 |
+
header button.exc.show_exc { background: #eee; border: 2px solid #808080; margin: 0 .1em; }
|
| 132 |
+
|
| 133 |
+
@media (prefers-color-scheme: dark) { header button.exc.show_exc { background: #333; } }
|
| 134 |
+
|
| 135 |
+
header button.par { background: #ffffd5; }
|
| 136 |
+
|
| 137 |
+
@media (prefers-color-scheme: dark) { header button.par { background: #650; } }
|
| 138 |
+
|
| 139 |
+
header button.par.show_par { background: #ffa; border: 2px solid #bbbb00; margin: 0 .1em; }
|
| 140 |
+
|
| 141 |
+
@media (prefers-color-scheme: dark) { header button.par.show_par { background: #650; } }
|
| 142 |
+
|
| 143 |
+
#help_panel, #source p .annotate.long { display: none; position: absolute; z-index: 999; background: #ffffcc; border: 1px solid #888; border-radius: .2em; color: #333; padding: .25em .5em; }
|
| 144 |
+
|
| 145 |
+
#source p .annotate.long { white-space: normal; float: right; top: 1.75em; right: 1em; height: auto; }
|
| 146 |
+
|
| 147 |
+
#help_panel_wrapper { float: right; position: relative; }
|
| 148 |
+
|
| 149 |
+
#keyboard_icon { margin: 5px; }
|
| 150 |
+
|
| 151 |
+
#help_panel_state { display: none; }
|
| 152 |
+
|
| 153 |
+
#help_panel { top: 25px; right: 0; padding: .75em; border: 1px solid #883; color: #333; }
|
| 154 |
+
|
| 155 |
+
#help_panel .keyhelp p { margin-top: .75em; }
|
| 156 |
+
|
| 157 |
+
#help_panel .legend { font-style: italic; margin-bottom: 1em; }
|
| 158 |
+
|
| 159 |
+
.indexfile #help_panel { width: 25em; }
|
| 160 |
+
|
| 161 |
+
.pyfile #help_panel { width: 18em; }
|
| 162 |
+
|
| 163 |
+
#help_panel_state:checked ~ #help_panel { display: block; }
|
| 164 |
+
|
| 165 |
+
kbd { border: 1px solid black; border-color: #888 #333 #333 #888; padding: .1em .35em; font-family: SFMono-Regular, Menlo, Monaco, Consolas, monospace; font-weight: bold; background: #eee; border-radius: 3px; }
|
| 166 |
+
|
| 167 |
+
#source { padding: 1em 0 1em 3.5rem; font-family: SFMono-Regular, Menlo, Monaco, Consolas, monospace; }
|
| 168 |
+
|
| 169 |
+
#source p { position: relative; white-space: pre; }
|
| 170 |
+
|
| 171 |
+
#source p * { box-sizing: border-box; }
|
| 172 |
+
|
| 173 |
+
#source p .n { float: left; text-align: right; width: 3.5rem; box-sizing: border-box; margin-left: -3.5rem; padding-right: 1em; color: #999; user-select: none; }
|
| 174 |
+
|
| 175 |
+
@media (prefers-color-scheme: dark) { #source p .n { color: #777; } }
|
| 176 |
+
|
| 177 |
+
#source p .n.highlight { background: #ffdd00; }
|
| 178 |
+
|
| 179 |
+
#source p .n a { scroll-margin-top: 6em; text-decoration: none; color: #999; }
|
| 180 |
+
|
| 181 |
+
@media (prefers-color-scheme: dark) { #source p .n a { color: #777; } }
|
| 182 |
+
|
| 183 |
+
#source p .n a:hover { text-decoration: underline; color: #999; }
|
| 184 |
+
|
| 185 |
+
@media (prefers-color-scheme: dark) { #source p .n a:hover { color: #777; } }
|
| 186 |
+
|
| 187 |
+
#source p .t { display: inline-block; width: 100%; box-sizing: border-box; margin-left: -.5em; padding-left: 0.3em; border-left: 0.2em solid #fff; }
|
| 188 |
+
|
| 189 |
+
@media (prefers-color-scheme: dark) { #source p .t { border-color: #1e1e1e; } }
|
| 190 |
+
|
| 191 |
+
#source p .t:hover { background: #f2f2f2; }
|
| 192 |
+
|
| 193 |
+
@media (prefers-color-scheme: dark) { #source p .t:hover { background: #282828; } }
|
| 194 |
+
|
| 195 |
+
#source p .t:hover ~ .r .annotate.long { display: block; }
|
| 196 |
+
|
| 197 |
+
#source p .t .com { color: #008000; font-style: italic; line-height: 1px; }
|
| 198 |
+
|
| 199 |
+
@media (prefers-color-scheme: dark) { #source p .t .com { color: #6a9955; } }
|
| 200 |
+
|
| 201 |
+
#source p .t .key { font-weight: bold; line-height: 1px; }
|
| 202 |
+
|
| 203 |
+
#source p .t .str, #source p .t .fst { color: #0451a5; }
|
| 204 |
+
|
| 205 |
+
@media (prefers-color-scheme: dark) { #source p .t .str, #source p .t .fst { color: #9cdcfe; } }
|
| 206 |
+
|
| 207 |
+
#source p.mis .t { border-left: 0.2em solid #ff0000; }
|
| 208 |
+
|
| 209 |
+
#source p.mis.show_mis .t { background: #fdd; }
|
| 210 |
+
|
| 211 |
+
@media (prefers-color-scheme: dark) { #source p.mis.show_mis .t { background: #4b1818; } }
|
| 212 |
+
|
| 213 |
+
#source p.mis.show_mis .t:hover { background: #f2d2d2; }
|
| 214 |
+
|
| 215 |
+
@media (prefers-color-scheme: dark) { #source p.mis.show_mis .t:hover { background: #532323; } }
|
| 216 |
+
|
| 217 |
+
#source p.mis.mis2 .t { border-left: 0.2em dotted #ff0000; }
|
| 218 |
+
|
| 219 |
+
#source p.mis.mis2.show_mis .t { background: #ffeeee; }
|
| 220 |
+
|
| 221 |
+
@media (prefers-color-scheme: dark) { #source p.mis.mis2.show_mis .t { background: #351b1b; } }
|
| 222 |
+
|
| 223 |
+
#source p.mis.mis2.show_mis .t:hover { background: #f2d2d2; }
|
| 224 |
+
|
| 225 |
+
@media (prefers-color-scheme: dark) { #source p.mis.mis2.show_mis .t:hover { background: #532323; } }
|
| 226 |
+
|
| 227 |
+
#source p.run .t { border-left: 0.2em solid #00dd00; }
|
| 228 |
+
|
| 229 |
+
#source p.run.show_run .t { background: #dfd; }
|
| 230 |
+
|
| 231 |
+
@media (prefers-color-scheme: dark) { #source p.run.show_run .t { background: #373d29; } }
|
| 232 |
+
|
| 233 |
+
#source p.run.show_run .t:hover { background: #d2f2d2; }
|
| 234 |
+
|
| 235 |
+
@media (prefers-color-scheme: dark) { #source p.run.show_run .t:hover { background: #404633; } }
|
| 236 |
+
|
| 237 |
+
#source p.run.run2 .t { border-left: 0.2em dotted #00dd00; }
|
| 238 |
+
|
| 239 |
+
#source p.run.run2.show_run .t { background: #eeffee; }
|
| 240 |
+
|
| 241 |
+
@media (prefers-color-scheme: dark) { #source p.run.run2.show_run .t { background: #2b2e24; } }
|
| 242 |
+
|
| 243 |
+
#source p.run.run2.show_run .t:hover { background: #d2f2d2; }
|
| 244 |
+
|
| 245 |
+
@media (prefers-color-scheme: dark) { #source p.run.run2.show_run .t:hover { background: #404633; } }
|
| 246 |
+
|
| 247 |
+
#source p.exc .t { border-left: 0.2em solid #808080; }
|
| 248 |
+
|
| 249 |
+
#source p.exc.show_exc .t { background: #eee; }
|
| 250 |
+
|
| 251 |
+
@media (prefers-color-scheme: dark) { #source p.exc.show_exc .t { background: #333; } }
|
| 252 |
+
|
| 253 |
+
#source p.exc.show_exc .t:hover { background: #e2e2e2; }
|
| 254 |
+
|
| 255 |
+
@media (prefers-color-scheme: dark) { #source p.exc.show_exc .t:hover { background: #3c3c3c; } }
|
| 256 |
+
|
| 257 |
+
#source p.exc.exc2 .t { border-left: 0.2em dotted #808080; }
|
| 258 |
+
|
| 259 |
+
#source p.exc.exc2.show_exc .t { background: #f7f7f7; }
|
| 260 |
+
|
| 261 |
+
@media (prefers-color-scheme: dark) { #source p.exc.exc2.show_exc .t { background: #292929; } }
|
| 262 |
+
|
| 263 |
+
#source p.exc.exc2.show_exc .t:hover { background: #e2e2e2; }
|
| 264 |
+
|
| 265 |
+
@media (prefers-color-scheme: dark) { #source p.exc.exc2.show_exc .t:hover { background: #3c3c3c; } }
|
| 266 |
+
|
| 267 |
+
#source p.par .t { border-left: 0.2em solid #bbbb00; }
|
| 268 |
+
|
| 269 |
+
#source p.par.show_par .t { background: #ffa; }
|
| 270 |
+
|
| 271 |
+
@media (prefers-color-scheme: dark) { #source p.par.show_par .t { background: #650; } }
|
| 272 |
+
|
| 273 |
+
#source p.par.show_par .t:hover { background: #f2f2a2; }
|
| 274 |
+
|
| 275 |
+
@media (prefers-color-scheme: dark) { #source p.par.show_par .t:hover { background: #6d5d0c; } }
|
| 276 |
+
|
| 277 |
+
#source p.par.par2 .t { border-left: 0.2em dotted #bbbb00; }
|
| 278 |
+
|
| 279 |
+
#source p.par.par2.show_par .t { background: #ffffd5; }
|
| 280 |
+
|
| 281 |
+
@media (prefers-color-scheme: dark) { #source p.par.par2.show_par .t { background: #423a0f; } }
|
| 282 |
+
|
| 283 |
+
#source p.par.par2.show_par .t:hover { background: #f2f2a2; }
|
| 284 |
+
|
| 285 |
+
@media (prefers-color-scheme: dark) { #source p.par.par2.show_par .t:hover { background: #6d5d0c; } }
|
| 286 |
+
|
| 287 |
+
#source p .r { position: absolute; top: 0; right: 2.5em; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Ubuntu, Cantarell, "Helvetica Neue", sans-serif; }
|
| 288 |
+
|
| 289 |
+
#source p .annotate { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Ubuntu, Cantarell, "Helvetica Neue", sans-serif; color: #666; padding-right: .5em; }
|
| 290 |
+
|
| 291 |
+
@media (prefers-color-scheme: dark) { #source p .annotate { color: #ddd; } }
|
| 292 |
+
|
| 293 |
+
#source p .annotate.short:hover ~ .long { display: block; }
|
| 294 |
+
|
| 295 |
+
#source p .annotate.long { width: 30em; right: 2.5em; }
|
| 296 |
+
|
| 297 |
+
#source p input { display: none; }
|
| 298 |
+
|
| 299 |
+
#source p input ~ .r label.ctx { cursor: pointer; border-radius: .25em; }
|
| 300 |
+
|
| 301 |
+
#source p input ~ .r label.ctx::before { content: "▶ "; }
|
| 302 |
+
|
| 303 |
+
#source p input ~ .r label.ctx:hover { background: #e8f4ff; color: #666; }
|
| 304 |
+
|
| 305 |
+
@media (prefers-color-scheme: dark) { #source p input ~ .r label.ctx:hover { background: #0f3a42; } }
|
| 306 |
+
|
| 307 |
+
@media (prefers-color-scheme: dark) { #source p input ~ .r label.ctx:hover { color: #aaa; } }
|
| 308 |
+
|
| 309 |
+
#source p input:checked ~ .r label.ctx { background: #d0e8ff; color: #666; border-radius: .75em .75em 0 0; padding: 0 .5em; margin: -.25em 0; }
|
| 310 |
+
|
| 311 |
+
@media (prefers-color-scheme: dark) { #source p input:checked ~ .r label.ctx { background: #056; } }
|
| 312 |
+
|
| 313 |
+
@media (prefers-color-scheme: dark) { #source p input:checked ~ .r label.ctx { color: #aaa; } }
|
| 314 |
+
|
| 315 |
+
#source p input:checked ~ .r label.ctx::before { content: "▼ "; }
|
| 316 |
+
|
| 317 |
+
#source p input:checked ~ .ctxs { padding: .25em .5em; overflow-y: scroll; max-height: 10.5em; }
|
| 318 |
+
|
| 319 |
+
#source p label.ctx { color: #999; display: inline-block; padding: 0 .5em; font-size: .8333em; }
|
| 320 |
+
|
| 321 |
+
@media (prefers-color-scheme: dark) { #source p label.ctx { color: #777; } }
|
| 322 |
+
|
| 323 |
+
#source p .ctxs { display: block; max-height: 0; overflow-y: hidden; transition: all .2s; padding: 0 .5em; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Ubuntu, Cantarell, "Helvetica Neue", sans-serif; white-space: nowrap; background: #d0e8ff; border-radius: .25em; margin-right: 1.75em; text-align: right; }
|
| 324 |
+
|
| 325 |
+
@media (prefers-color-scheme: dark) { #source p .ctxs { background: #056; } }
|
| 326 |
+
|
| 327 |
+
#index { font-family: SFMono-Regular, Menlo, Monaco, Consolas, monospace; font-size: 0.875em; }
|
| 328 |
+
|
| 329 |
+
#index table.index { margin-left: -.5em; }
|
| 330 |
+
|
| 331 |
+
#index td, #index th { text-align: right; padding: .25em .5em; border-bottom: 1px solid #eee; }
|
| 332 |
+
|
| 333 |
+
@media (prefers-color-scheme: dark) { #index td, #index th { border-color: #333; } }
|
| 334 |
+
|
| 335 |
+
#index td.name, #index th.name { text-align: left; width: auto; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Ubuntu, Cantarell, "Helvetica Neue", sans-serif; min-width: 15em; }
|
| 336 |
+
|
| 337 |
+
#index th { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Ubuntu, Cantarell, "Helvetica Neue", sans-serif; font-style: italic; color: #333; cursor: pointer; }
|
| 338 |
+
|
| 339 |
+
@media (prefers-color-scheme: dark) { #index th { color: #ddd; } }
|
| 340 |
+
|
| 341 |
+
#index th:hover { background: #eee; }
|
| 342 |
+
|
| 343 |
+
@media (prefers-color-scheme: dark) { #index th:hover { background: #333; } }
|
| 344 |
+
|
| 345 |
+
#index th .arrows { color: #666; font-size: 85%; font-family: sans-serif; font-style: normal; pointer-events: none; }
|
| 346 |
+
|
| 347 |
+
#index th[aria-sort="ascending"], #index th[aria-sort="descending"] { white-space: nowrap; background: #eee; padding-left: .5em; }
|
| 348 |
+
|
| 349 |
+
@media (prefers-color-scheme: dark) { #index th[aria-sort="ascending"], #index th[aria-sort="descending"] { background: #333; } }
|
| 350 |
+
|
| 351 |
+
#index th[aria-sort="ascending"] .arrows::after { content: " ▲"; }
|
| 352 |
+
|
| 353 |
+
#index th[aria-sort="descending"] .arrows::after { content: " ▼"; }
|
| 354 |
+
|
| 355 |
+
#index td.name { font-size: 1.15em; }
|
| 356 |
+
|
| 357 |
+
#index td.name a { text-decoration: none; color: inherit; }
|
| 358 |
+
|
| 359 |
+
#index td.name .no-noun { font-style: italic; }
|
| 360 |
+
|
| 361 |
+
#index tr.total td, #index tr.total_dynamic td { font-weight: bold; border-top: 1px solid #ccc; border-bottom: none; }
|
| 362 |
+
|
| 363 |
+
#index tr.region:hover { background: #eee; }
|
| 364 |
+
|
| 365 |
+
@media (prefers-color-scheme: dark) { #index tr.region:hover { background: #333; } }
|
| 366 |
+
|
| 367 |
+
#index tr.region:hover td.name { text-decoration: underline; color: inherit; }
|
| 368 |
+
|
| 369 |
+
#scroll_marker { position: fixed; z-index: 3; right: 0; top: 0; width: 16px; height: 100%; background: #fff; border-left: 1px solid #eee; will-change: transform; }
|
| 370 |
+
|
| 371 |
+
@media (prefers-color-scheme: dark) { #scroll_marker { background: #1e1e1e; } }
|
| 372 |
+
|
| 373 |
+
@media (prefers-color-scheme: dark) { #scroll_marker { border-color: #333; } }
|
| 374 |
+
|
| 375 |
+
#scroll_marker .marker { background: #ccc; position: absolute; min-height: 3px; width: 100%; }
|
| 376 |
+
|
| 377 |
+
@media (prefers-color-scheme: dark) { #scroll_marker .marker { background: #444; } }
|
annotations/annotation_1/htmlcov/z_24a0e69e886c375e___init___py.html
ADDED
|
@@ -0,0 +1,97 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<!DOCTYPE html>
|
| 2 |
+
<html lang="en">
|
| 3 |
+
<head>
|
| 4 |
+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
| 5 |
+
<title>Coverage for qa_metrics/utils/__init__.py: 100%</title>
|
| 6 |
+
<link rel="icon" sizes="32x32" href="favicon_32_cb_58284776.png">
|
| 7 |
+
<link rel="stylesheet" href="style_cb_6b508a39.css" type="text/css">
|
| 8 |
+
<script src="coverage_html_cb_6fb7b396.js" defer></script>
|
| 9 |
+
</head>
|
| 10 |
+
<body class="pyfile">
|
| 11 |
+
<header>
|
| 12 |
+
<div class="content">
|
| 13 |
+
<h1>
|
| 14 |
+
<span class="text">Coverage for </span><b>qa_metrics/utils/__init__.py</b>:
|
| 15 |
+
<span class="pc_cov">100%</span>
|
| 16 |
+
</h1>
|
| 17 |
+
<aside id="help_panel_wrapper">
|
| 18 |
+
<input id="help_panel_state" type="checkbox">
|
| 19 |
+
<label for="help_panel_state">
|
| 20 |
+
<img id="keyboard_icon" src="keybd_closed_cb_ce680311.png" alt="Show/hide keyboard shortcuts">
|
| 21 |
+
</label>
|
| 22 |
+
<div id="help_panel">
|
| 23 |
+
<p class="legend">Shortcuts on this page</p>
|
| 24 |
+
<div class="keyhelp">
|
| 25 |
+
<p>
|
| 26 |
+
<kbd>r</kbd>
|
| 27 |
+
<kbd>m</kbd>
|
| 28 |
+
<kbd>x</kbd>
|
| 29 |
+
toggle line displays
|
| 30 |
+
</p>
|
| 31 |
+
<p>
|
| 32 |
+
<kbd>j</kbd>
|
| 33 |
+
<kbd>k</kbd>
|
| 34 |
+
next/prev highlighted chunk
|
| 35 |
+
</p>
|
| 36 |
+
<p>
|
| 37 |
+
<kbd>0</kbd> (zero) top of page
|
| 38 |
+
</p>
|
| 39 |
+
<p>
|
| 40 |
+
<kbd>1</kbd> (one) first highlighted chunk
|
| 41 |
+
</p>
|
| 42 |
+
<p>
|
| 43 |
+
<kbd>[</kbd>
|
| 44 |
+
<kbd>]</kbd>
|
| 45 |
+
prev/next file
|
| 46 |
+
</p>
|
| 47 |
+
<p>
|
| 48 |
+
<kbd>u</kbd> up to the index
|
| 49 |
+
</p>
|
| 50 |
+
<p>
|
| 51 |
+
<kbd>?</kbd> show/hide this help
|
| 52 |
+
</p>
|
| 53 |
+
</div>
|
| 54 |
+
</div>
|
| 55 |
+
</aside>
|
| 56 |
+
<h2>
|
| 57 |
+
<span class="text">0 statements </span>
|
| 58 |
+
<button type="button" class="run button_toggle_run" value="run" data-shortcut="r" title="Toggle lines run">0<span class="text"> run</span></button>
|
| 59 |
+
<button type="button" class="mis show_mis button_toggle_mis" value="mis" data-shortcut="m" title="Toggle lines missing">0<span class="text"> missing</span></button>
|
| 60 |
+
<button type="button" class="exc show_exc button_toggle_exc" value="exc" data-shortcut="x" title="Toggle lines excluded">0<span class="text"> excluded</span></button>
|
| 61 |
+
</h2>
|
| 62 |
+
<p class="text">
|
| 63 |
+
<a id="prevFileLink" class="nav" href="z_404f632fe58a503b_transformerMatcher_py.html">« prev</a>
|
| 64 |
+
<a id="indexLink" class="nav" href="index.html">^ index</a>
|
| 65 |
+
<a id="nextFileLink" class="nav" href="z_24a0e69e886c375e_tools_py.html">» next</a>
|
| 66 |
+
|
| 67 |
+
<a class="nav" href="https://coverage.readthedocs.io/en/7.10.6">coverage.py v7.10.6</a>,
|
| 68 |
+
created at 2025-09-03 15:09 -0500
|
| 69 |
+
</p>
|
| 70 |
+
<aside class="hidden">
|
| 71 |
+
<button type="button" class="button_next_chunk" data-shortcut="j"></button>
|
| 72 |
+
<button type="button" class="button_prev_chunk" data-shortcut="k"></button>
|
| 73 |
+
<button type="button" class="button_top_of_page" data-shortcut="0"></button>
|
| 74 |
+
<button type="button" class="button_first_chunk" data-shortcut="1"></button>
|
| 75 |
+
<button type="button" class="button_prev_file" data-shortcut="["></button>
|
| 76 |
+
<button type="button" class="button_next_file" data-shortcut="]"></button>
|
| 77 |
+
<button type="button" class="button_to_index" data-shortcut="u"></button>
|
| 78 |
+
<button type="button" class="button_show_hide_help" data-shortcut="?"></button>
|
| 79 |
+
</aside>
|
| 80 |
+
</div>
|
| 81 |
+
</header>
|
| 82 |
+
<main id="source">
|
| 83 |
+
</main>
|
| 84 |
+
<footer>
|
| 85 |
+
<div class="content">
|
| 86 |
+
<p>
|
| 87 |
+
<a class="nav" href="z_404f632fe58a503b_transformerMatcher_py.html">« prev</a>
|
| 88 |
+
<a class="nav" href="index.html">^ index</a>
|
| 89 |
+
<a class="nav" href="z_24a0e69e886c375e_tools_py.html">» next</a>
|
| 90 |
+
|
| 91 |
+
<a class="nav" href="https://coverage.readthedocs.io/en/7.10.6">coverage.py v7.10.6</a>,
|
| 92 |
+
created at 2025-09-03 15:09 -0500
|
| 93 |
+
</p>
|
| 94 |
+
</div>
|
| 95 |
+
</footer>
|
| 96 |
+
</body>
|
| 97 |
+
</html>
|