import os
import random
from typing import Any, Dict, List, Union

import numpy as np
import torch
from colorama import Fore, Style
from sklearn.metrics import f1_score
from sklearn.metrics import precision_recall_fscore_support as score
from sklearn.metrics import precision_score, recall_score


def highlight(input_: Any) -> str:
    input_ = str(input_)
    return str(Fore.YELLOW + str(input_) + Style.RESET_ALL)


def get_intent_labels(args: Any) -> List[str]:
    return [
        label.strip()
        for label in open(
            os.path.join(args.data_dir, args.intent_label_file), "r", encoding="utf-8"
        )
    ]


def get_slot_labels(args: Any) -> List[str]:
    return [
        label.strip()
        for label in open(
            os.path.join(args.data_dir, args.slot_label_file), "r", encoding="utf-8"
        )
    ]


def get_pos_labels(args: Any) -> List[str]:
    return [
        label.strip()
        for label in open(
            os.path.join(args.data_dir, args.pos_label_file), "r", encoding="utf-8"
        )
    ]


def set_torch_seed(seed: Any, no_cuda: bool) -> None:
    random.seed(seed)
    
np.random.seed(seed)