def setUp(self): model_installed = uralicApi.is_language_installed("fin") model_installed2 = uralicApi.is_language_installed("swe") if not model_installed: #download the model, if it is not installed uralicApi.download("fin",False) if not model_installed2: #download the model, if it is not installed uralicApi.download("swe",False)
import logging from typing import Dict, Optional, List from uralicNLP import uralicApi from core.models import Slot, TemplateComponent from core.morphological_realizer import LanguageSpecificMorphologicalRealizer log = logging.getLogger(__name__) if not uralicApi.is_language_installed("fin"): uralicApi.download("fin") class FinnishUralicNLPMorphologicalRealizer( LanguageSpecificMorphologicalRealizer): def __init__(self): super().__init__("fi") self.case_map: Dict[str, str] = { "ssa": "Ine", "ssä": "Ine", "inessive": "Ine", "genitive": "Gen" } def realize(self, slot: Slot, left_context: List[TemplateComponent], right_context: List[TemplateComponent]) -> str: case: Optional[str] = slot.attributes.get("case") if case is None: return slot.value
import logging from typing import Dict, Optional, List from uralicNLP import uralicApi from core.models import Slot, TemplateComponent from core.morphological_realizer import LanguageSpecificMorphologicalRealizer log = logging.getLogger(__name__) if not uralicApi.is_language_installed("est"): uralicApi.download("est") class EstonianUralicNLPMorphologicalRealizer( LanguageSpecificMorphologicalRealizer): def __init__(self): super().__init__("ee") self.case_map: Dict[str, str] = { "ssa": "Ine", "ssä": "Ine", "inessive": "Ine", "genitive": "Gen" } def realize(self, slot: Slot, left_context: List[TemplateComponent], right_context: List[TemplateComponent]) -> str: case: Optional[str] = slot.attributes.get("case") if case is None: return slot.value