from pathlib import Path
import json


def conj(frm, alph):
    """
    Retrieve appropriate conjugation dictionaries

    Parameters
    ----------
    frm : str
        A string used to determine the formality
    alph : str
        A string used to determine the type of alphabet

    Returns
    -------
    list of dicts
        a list of dictionaries containing appropriate conjugations
    """

    dir_path = Path(__file__).parents[0]
    path = f'{dir_path}/data/conjugations.json'

    with open(path, 'r', encoding='utf-8') as file:
        conjugations = json.load(file)['subjective']

    # retrieve conjugations
    past = conjugations[frm][alph]['past']
    present = conjugations[frm][alph]['present']
    perfect = conjugations[frm][alph]['perfect']
    imperative = conjugations[frm][alph]['imperative']
    return [past, present, perfect, imperative]