# clue-codebert
from clue_oodeval.core import CLUE
from clue_oodeval.utils import EvaluationUtil
from pathlib import Path
TESTS_DIR = Path(__file__).parent / "test_files"
import json

with open(TESTS_DIR / "reference.json",'r',encoding='utf-8') as f:
    reference = json.load(f)
with open(TESTS_DIR / "candidate_human.json",'r',encoding='utf-8') as f:
    candidate = json.load(f)
print("calculate clue-codebert ...")
clue_sim, clue_simce, clue_simca, clue_simcm, clue_simcr = 0, 0, 0, 0, 0
EvaluationUtil.MODEL_PATH_BASE = "xxxxx" # set your huggingface model cache path
EvaluationUtil.MODEL_PATH_BASE = "/home/zhangmanqing/xbx/OODEval/hf_models/" # set your huggingface model cache path
EvaluationUtil.set_base_model("codebert-base") # set model
clue = CLUE(reference,candidate,EvaluationUtil.calc_similarity_batch("codebert-base"))
clue.setBestWeights()
clue.RunCLUE()
clue_sim = clue.getCLUE()
clue_simce = clue.getSimCE()
clue_simca = clue.getSimCA()
clue_simcm = clue.getSimCM()
clue_simcr = clue.getSimCR()

print(f"clue : {clue_sim}")
print(f"clue-class : {clue_simce}")
print(f"clue-attribute: {clue_simca}")
print(f"clue-method: {clue_simcm}")
print(f"clue-relation: {clue_simcr}")