from typing import Dict
import json


def get_unambiguous_roots(base_forms_file: str) -> Dict[str, Dict[str, str]]:
    """Get the list of words repleaceable with an unambiguous lemma.

    This is a dictionary having the ISO 3-letter code of each language as
    a key, and as values dictionaries mapping words with their dictionary
    form. When a word has multiple possible senses or base forms, it's
    omitted.
    Since this data is generated from en.wiktionary, some languages are
    missing and some have very little data.
    """
    ret = {}
    with open(base_forms_file) as f:
        for line in f:
            form = json.loads(line)
            lang = form['lang']
            if lang not in ret:
                ret[lang] = {}
            if len(form['base_forms']) == 1:
                ret[lang][form['word']] = form['base_forms'][0]
    return ret