Example #1
0
    def past_active(self):
        """
        Strong verbs

        I
        >>> verb = StrongOldNorseVerb()
        >>> verb.set_canonic_forms(["líta", "lítr", "leit", "litu", "litinn"])
        >>> verb.past_active()
        ['leit', 'leizt', 'leit', 'litum', 'lituð', 'litu']

        II
        >>> verb = StrongOldNorseVerb()
        >>> verb.set_canonic_forms(["bjóða", "býðr", "bauð", "buðu", "boðinn"])
        >>> verb.past_active()
        ['bauð', 'bautt', 'bauð', 'buðum', 'buðuð', 'buðu']

        III
        >>> verb = StrongOldNorseVerb()
        >>> verb.set_canonic_forms(["verða", "verðr", "varð", "urðu", "orðinn"])
        >>> verb.past_active()
        ['varð', 'vart', 'varð', 'urðum', 'urðuð', 'urðu']

        IV
        >>> verb = StrongOldNorseVerb()
        >>> verb.set_canonic_forms(["bera", "berr", "bar", "báru", "borinn"])
        >>> verb.past_active()
        ['bar', 'bart', 'bar', 'bárum', 'báruð', 'báru']

        V
        >>> verb = StrongOldNorseVerb()
        >>> verb.set_canonic_forms(["gefa", "gefr", "gaf", "gáfu", "gefinn"])
        >>> verb.past_active()
        ['gaf', 'gaft', 'gaf', 'gáfum', 'gáfuð', 'gáfu']

        VI
        >>> verb = StrongOldNorseVerb()
        >>> verb.set_canonic_forms(["fara", "ferr", "fór", "fóru", "farinn"])
        >>> verb.past_active()
        ['fór', 'fórt', 'fór', 'fórum', 'fóruð', 'fóru']

        VII
        >>> verb = StrongOldNorseVerb()
        >>> verb.set_canonic_forms(["ráða", "ræðr", "réð", "réðu", "ráðinn"])
        >>> verb.past_active()
        ['réð', 'rétt', 'réð', 'réðum', 'réðuð', 'réðu']

        :return:
        """

        forms = [
            self.sfg3et,
            add_t_ending(self.sfg3et), self.sfg3et,
            apply_u_umlaut(self.sfg3ft) + "m",
            apply_u_umlaut(self.sfg3ft) + "ð", self.sfg3ft
        ]
        return forms
Example #2
0
    def present_active(self):
        """
        Strong verbs

        I
        >>> verb = StrongOldNorseVerb()
        >>> verb.set_canonic_forms(["líta", "lítr", "leit", "litu", "litinn"])
        >>> verb.present_active()
        ['lít', 'lítr', 'lítr', 'lítum', 'lítið', 'líta']

        II
        >>> verb = StrongOldNorseVerb()
        >>> verb.set_canonic_forms(["bjóða", "býðr", "bauð", "buðu", "boðinn"])
        >>> verb.present_active()
        ['býð', 'býðr', 'býðr', 'bjóðum', 'bjóðið', 'bjóða']

        III
        >>> verb = StrongOldNorseVerb()
        >>> verb.set_canonic_forms(["verða", "verðr", "varð", "urðu", "orðinn"])
        >>> verb.present_active()
        ['verð', 'verðr', 'verðr', 'verðum', 'verðið', 'verða']

        IV
        >>> verb = StrongOldNorseVerb()
        >>> verb.set_canonic_forms(["bera", "berr", "bar", "báru", "borinn"])
        >>> verb.present_active()
        ['ber', 'berr', 'berr', 'berum', 'berið', 'bera']

        V
        >>> verb = StrongOldNorseVerb()
        >>> verb.set_canonic_forms(["gefa", "gefr", "gaf", "gáfu", "gefinn"])
        >>> verb.present_active()
        ['gef', 'gefr', 'gefr', 'gefum', 'gefið', 'gefa']

        VI
        >>> verb = StrongOldNorseVerb()
        >>> verb.set_canonic_forms(["fara", "ferr", "fór", "fóru", "farinn"])
        >>> verb.present_active()
        ['fer', 'ferr', 'ferr', 'förum', 'farið', 'fara']

        VII
        >>> verb = StrongOldNorseVerb()
        >>> verb.set_canonic_forms(["ráða", "ræðr", "réð", "réðu", "ráðinn"])
        >>> verb.present_active()
        ['ræð', 'ræðr', 'ræðr', 'ráðum', 'ráðið', 'ráða']

        :return:
        """
        forms = []
        singular_stem = self.sfg3en[:-1]
        forms.append(singular_stem)
        forms.append(self.sfg3en)
        forms.append(self.sfg3en)
        plural_stem = self.sng[:-1] if self.sng[-1] == "a" else self.sng
        forms.append(apply_u_umlaut(plural_stem) + "um")
        forms.append(plural_stem + "ið")
        forms.append(self.sng)
        return forms
Example #3
0
    def past_active(self):
        """
        Weak verbs
        I
        >>> verb = WeakOldNorseVerb()
        >>> verb.set_canonic_forms(["kalla", "kallaði", "kallaðinn"])
        >>> verb.past_active()
        ['kallaða', 'kallaðir', 'kallaði', 'kölluðum', 'kölluðuð', 'kölluðu']

        II
        >>> verb = WeakOldNorseVerb()
        >>> verb.set_canonic_forms(["mæla", "mælti", "mæltr"])
        >>> verb.past_active()
        ['mælta', 'mæltir', 'mælti', 'mæltum', 'mæltuð', 'mæltu']

        III
        >>> verb = WeakOldNorseVerb()
        >>> verb.set_canonic_forms(["telja", "taldi", "talinn"])
        >>> verb.past_active()
        ['talda', 'taldir', 'taldi', 'töldum', 'tölduð', 'töldu']

        IV
        >>> verb = WeakOldNorseVerb()
        >>> verb.set_canonic_forms(["vaka", "vakti", "vakat"])
        >>> verb.past_active()
        ['vakta', 'vaktir', 'vakti', 'vöktum', 'vöktuð', 'vöktu']

        :return:
        """
        forms = []
        stem = self.sfg3et[:-1]
        forms.append(stem + "a")
        forms.append(self.sfg3et + "r")
        forms.append(self.sfg3et)
        forms.append(apply_u_umlaut(stem) + "um")
        forms.append(apply_u_umlaut(stem) + "uð")
        forms.append(apply_u_umlaut(stem) + "u")
        return forms
Example #4
0
    def present_active(self):
        """
        Weak verbs
        I
        >>> verb = WeakOldNorseVerb()
        >>> verb.set_canonic_forms(["kalla", "kallaði", "kallaðinn"])
        >>> verb.present_active()
        ['kalla', 'kallar', 'kallar', 'köllum', 'kallið', 'kalla']

        II
        >>> verb = WeakOldNorseVerb()
        >>> verb.set_canonic_forms(["mæla", "mælti", "mæltr"])
        >>> verb.present_active()
        ['mæli', 'mælir', 'mælir', 'mælum', 'mælið', 'mæla']

        III
        >>> verb = WeakOldNorseVerb()
        >>> verb.set_canonic_forms(["telja", "taldi", "talinn"])
        >>> verb.present_active()
        ['tel', 'telr', 'telr', 'teljum', 'telið', 'telja']

        IV
        >>> verb = WeakOldNorseVerb()
        >>> verb.set_canonic_forms(["vaka", "vakti", "vakat"])
        >>> verb.present_active()
        ['vaki', 'vakir', 'vakir', 'vökum', 'vakið', 'vaka']

        :return:
        """
        forms = []
        stem_ending_by_j = self.sng[-1] == "a" and self.sng[-2] == "j"
        stem_ending_by_v = self.sng[-1] == "a" and self.sng[-2] == "v"
        stem = self.sng[:-1] if self.sng[-1] == "a" else self.sng
        if stem_ending_by_j or stem_ending_by_v:
            stem = stem[:-1]

        if self.subclass == 1:
            if stem_ending_by_v:
                forms.append(stem + "va")
                forms.append(stem + "r")
                forms.append(stem + "r")
                forms.append(apply_u_umlaut(stem) + "um")  # apply u umlaut
                forms.append(stem + "við")
                forms.append(stem + "va")
            elif stem_ending_by_j:
                forms.append(stem + "ja")
                forms.append(stem + "r")
                forms.append(stem + "r")
                forms.append(apply_u_umlaut(stem) + "jum")  # apply u umlaut
                forms.append(stem + "ið")
                forms.append(stem + "ja")
            else:
                forms.append(stem + "a")
                forms.append(stem + "ar")
                forms.append(stem + "ar")
                forms.append(apply_u_umlaut(stem) + "um")  # apply u umlaut
                forms.append(stem + "ið")
                forms.append(self.sng)

        elif self.subclass == 2:
            if stem_ending_by_v:
                forms.append(stem + "vi")
                forms.append(stem + "vir")
                forms.append(stem + "vir")
                forms.append(apply_u_umlaut(stem) + "um")  # apply u umlaut
                forms.append(stem + "við")
                forms.append(self.sng)

            elif stem_ending_by_j:
                forms.append(stem + "i")
                forms.append(stem + "ir")
                forms.append(stem + "ir")
                forms.append(apply_u_umlaut(stem) + "jum")  # apply u umlaut
                forms.append(stem + "ið")
                forms.append(self.sng)

            else:
                forms.append(stem + "i")
                forms.append(stem + "ir")
                forms.append(stem + "ir")
                forms.append(apply_u_umlaut(stem) + "um")  # apply u umlaut
                forms.append(stem + "ið")
                forms.append(self.sng)

        elif self.subclass == 3:
            if stem_ending_by_v:
                forms.append(stem)
                forms.append(stem + "r")
                forms.append(stem + "r")
                forms.append(apply_u_umlaut(stem) + "um")  # apply u umlaut
                forms.append(stem + "við")
                forms.append(self.sng)

            elif stem_ending_by_j:
                forms.append(stem)
                forms.append(stem + "r")
                forms.append(stem + "r")
                forms.append(apply_u_umlaut(stem) + "jum")  # apply u umlaut
                forms.append(stem + "ið")
                forms.append(self.sng)

            else:
                forms.append(stem)
                forms.append(stem + "r")
                forms.append(stem + "r")
                forms.append(apply_u_umlaut(stem) + "um")  # apply u umlaut
                forms.append(stem + "ið")
                forms.append(self.sng)

        elif self.subclass == 4:

            if stem_ending_by_v:
                forms.append(stem + "vi")
                forms.append(stem + "vir")
                forms.append(stem + "vir")
                forms.append(apply_u_umlaut(stem) + "um")  # apply u umlaut
                forms.append(stem + "við")
                forms.append(self.sng)

            elif stem_ending_by_j:
                forms.append(stem + "i")
                forms.append(stem + "ir")
                forms.append(stem + "ir")
                forms.append(apply_u_umlaut(stem) + "jum")  # apply u umlaut
                forms.append(stem + "ið")
                forms.append(self.sng)

            else:
                forms.append(stem + "i")
                forms.append(stem + "ir")
                forms.append(stem + "ir")
                forms.append(apply_u_umlaut(stem) + "um")  # apply u umlaut
                forms.append(stem + "ið")
                forms.append(self.sng)
        return forms
Example #5
0
    def past_participle(self):
        """
        Strong verbs

        I
        >>> verb = StrongOldNorseVerb()
        >>> verb.set_canonic_forms(["líta", "lítr", "leit", "litu", "litinn"])
        >>> verb.past_participle()
        [['litinn', 'litinn', 'litnum', 'litins', 'litnir', 'litna', 'litnum', 'litinna'], ['litin', 'litna', 'litinni', 'litinnar', 'litnar', 'litnar', 'litnum', 'litinna'], ['litit', 'litit', 'litnu', 'litins', 'litit', 'litit', 'litnum', 'litinna']]

        II
        >>> verb = StrongOldNorseVerb()
        >>> verb.set_canonic_forms(["bjóða", "býðr", "bauð", "buðu", "boðinn"])
        >>> verb.past_participle()
        [['boðinn', 'boðinn', 'boðnum', 'boðins', 'boðnir', 'boðna', 'boðnum', 'boðinna'], ['boðin', 'boðna', 'boðinni', 'boðinnar', 'boðnar', 'boðnar', 'boðnum', 'boðinna'], ['boðit', 'boðit', 'boðnu', 'boðins', 'boðit', 'boðit', 'boðnum', 'boðinna']]

        III
        >>> verb = StrongOldNorseVerb()
        >>> verb.set_canonic_forms(["verða", "verðr", "varð", "urðu", "orðinn"])
        >>> verb.past_participle()
        [['orðinn', 'orðinn', 'orðnum', 'orðins', 'orðnir', 'orðna', 'orðnum', 'orðinna'], ['orðin', 'orðna', 'orðinni', 'orðinnar', 'orðnar', 'orðnar', 'orðnum', 'orðinna'], ['orðit', 'orðit', 'orðnu', 'orðins', 'orðit', 'orðit', 'orðnum', 'orðinna']]

        IV
        >>> verb = StrongOldNorseVerb()
        >>> verb.set_canonic_forms(["bera", "berr", "bar", "báru", "borinn"])
        >>> verb.past_participle()
        [['borinn', 'borinn', 'bornum', 'borins', 'bornir', 'borna', 'bornum', 'borinna'], ['borin', 'borna', 'borinni', 'borinnar', 'bornar', 'bornar', 'bornum', 'borinna'], ['borit', 'borit', 'bornu', 'borins', 'borit', 'borit', 'bornum', 'borinna']]

        V
        >>> verb = StrongOldNorseVerb()
        >>> verb.set_canonic_forms(["gefa", "gefr", "gaf", "gáfu", "gefinn"])
        >>> verb.past_participle()
        [['gefinn', 'gefinn', 'gefnum', 'gefins', 'gefnir', 'gefna', 'gefnum', 'gefinna'], ['gefin', 'gefna', 'gefinni', 'gefinnar', 'gefnar', 'gefnar', 'gefnum', 'gefinna'], ['gefit', 'gefit', 'gefnu', 'gefins', 'gefit', 'gefit', 'gefnum', 'gefinna']]

        VI
        >>> verb = StrongOldNorseVerb()
        >>> verb.set_canonic_forms(["fara", "ferr", "fór", "fóru", "farinn"])
        >>> verb.past_participle()
        [['farinn', 'farinn', 'förnum', 'farins', 'farnir', 'farna', 'förnum', 'farinna'], ['farin', 'farna', 'farinni', 'farinnar', 'farnar', 'farnar', 'förnum', 'farinna'], ['farit', 'farit', 'förnu', 'farins', 'farit', 'farit', 'förnum', 'farinna']]

        VII
        >>> verb = StrongOldNorseVerb()
        >>> verb.set_canonic_forms(["ráða", "ræðr", "réð", "réðu", "ráðinn"])
        >>> verb.past_participle()
        [['ráðinn', 'ráðinn', 'ráðnum', 'ráðins', 'ráðnir', 'ráðna', 'ráðnum', 'ráðinna'], ['ráðin', 'ráðna', 'ráðinni', 'ráðinnar', 'ráðnar', 'ráðnar', 'ráðnum', 'ráðinna'], ['ráðit', 'ráðit', 'ráðnu', 'ráðins', 'ráðit', 'ráðit', 'ráðnum', 'ráðinna']]

        :return:
        """
        forms = []
        pp_stem = self.stgken[:-3]  # past participle stem
        pp_shortened_stem = self.stgken[:-1]  # past participle stem

        forms.append([])
        # masculine
        forms[0].append(pp_stem + "inn")
        forms[0].append(pp_stem + "inn")
        forms[0].append(apply_u_umlaut(pp_stem) + "num")
        forms[0].append(pp_stem + "ins")

        forms[0].append(pp_stem + "nir")
        forms[0].append(pp_stem + "na")
        forms[0].append(apply_u_umlaut(pp_stem) + "num")
        forms[0].append(pp_stem + "inna")

        # feminine
        forms.append([])
        forms[1].append(pp_stem + "in")
        forms[1].append(pp_stem + "na")
        forms[1].append(pp_stem + "inni")
        forms[1].append(pp_stem + "innar")

        forms[1].append(pp_stem + "nar")
        forms[1].append(pp_stem + "nar")
        forms[1].append(apply_u_umlaut(pp_stem) + "num")
        forms[1].append(pp_stem + "inna")

        # neuter
        forms.append([])
        forms[2].append(pp_stem + "it")
        forms[2].append(pp_stem + "it")
        forms[2].append(apply_u_umlaut(pp_stem) + "nu")
        forms[2].append(pp_stem + "ins")

        forms[2].append(pp_stem + "it")
        forms[2].append(pp_stem + "it")
        forms[2].append(apply_u_umlaut(pp_stem) + "num")
        forms[2].append(pp_stem + "inna")
        # pp_stem = self.stgken[:-1]  # past participle steù
        # pp_shortened_stem = self.stgken[:-1]  # past participle steù
        # # masculine
        # print(add_r_ending(pp_stem))
        # print(add_r_ending(pp_stem))
        # print(pp_stem + "an")
        # print(apply_u_umlaut(pp_stem) + "um")
        # print(pp_stem + "s")
        #
        # print(pp_stem + "ir")
        # print(pp_stem + "a")
        # print(apply_u_umlaut(pp_stem) + "um")
        # print(pp_stem + "ra")
        #
        # # feminine
        # print(apply_u_umlaut(pp_stem))
        # print(pp_stem + "a")
        # print(pp_stem + "ri")
        # print(pp_stem + "rar")
        #
        # print(pp_stem + "ar")
        # print(pp_stem + "ar")
        # print(apply_u_umlaut(pp_stem) + "um")
        # print(pp_stem + "ra")
        #
        # # neuter
        # print(add_t_ending(pp_stem))
        # print(add_t_ending(pp_stem))
        # print(apply_u_umlaut(pp_stem) + "u")
        # print(pp_stem + "s")
        #
        # print(apply_u_umlaut(pp_stem))
        # print(apply_u_umlaut(pp_stem))
        # print(apply_u_umlaut(pp_stem) + "um")
        # print(pp_stem + "ra")

        return forms
Example #6
0
    def past_participle(self):
        """

        Weak verbs
        I
        >>> verb = WeakOldNorseVerb()
        >>> verb.set_canonic_forms(["kalla", "kallaði", "kallaðr"])
        >>> verb.past_participle()
        [['kallaðr', 'kallaðan', 'kölluðum', 'kallaðs', 'kallaðir', 'kallaða', 'kölluðum', 'kallaðra'], ['kölluð', 'kallaða', 'kallaðri', 'kallaðrar', 'kallaðar', 'kallaðar', 'kölluðum', 'kallaðra'], ['kallatt', 'kallatt', 'kölluðu', 'kallaðs', 'kölluð', 'kölluð', 'kölluðum', 'kallaðra']]

        II
        >>> verb = WeakOldNorseVerb()
        >>> verb.set_canonic_forms(["mæla", "mælti", "mæltr"])
        >>> verb.past_participle()
        [['mæltr', 'mæltan', 'mæltum', 'mælts', 'mæltir', 'mælta', 'mæltum', 'mæltra'], ['mælt', 'mælta', 'mæltri', 'mæltrar', 'mæltar', 'mæltar', 'mæltum', 'mæltra'], ['mælt', 'mælt', 'mæltu', 'mælts', 'mælt', 'mælt', 'mæltum', 'mæltra']]

        III
        # >>> verb = WeakOldNorseVerb()
        # >>> verb.set_canonic_forms(["telja", "taldi", "talinn"])
        # >>> verb.past_participle()

        IV
        # >>> verb = WeakOldNorseVerb()
        # >>> verb.set_canonic_forms(["vaka", "vakti", "vakat"])
        # >>> verb.past_participle()

        :return:
        """
        forms = []
        if self.subclass in [1, 2]:
            pp_stem = self.stgken[:-1]  # past participle stem

            # masculine
            forms.append([])

            forms[0].append(add_r_ending(pp_stem))
            forms[0].append(pp_stem + "an")
            forms[0].append(apply_u_umlaut(pp_stem) + "um")
            forms[0].append(pp_stem + "s")

            forms[0].append(pp_stem + "ir")
            forms[0].append(pp_stem + "a")
            forms[0].append(apply_u_umlaut(pp_stem) + "um")
            forms[0].append(pp_stem + "ra")

            # feminine
            forms.append([])

            forms[1].append(apply_u_umlaut(pp_stem))
            forms[1].append(pp_stem + "a")
            forms[1].append(pp_stem + "ri")
            forms[1].append(pp_stem + "rar")

            forms[1].append(pp_stem + "ar")
            forms[1].append(pp_stem + "ar")
            forms[1].append(apply_u_umlaut(pp_stem) + "um")
            forms[1].append(pp_stem + "ra")

            # neuter
            forms.append([])

            forms[2].append(add_t_ending(pp_stem))
            forms[2].append(add_t_ending(pp_stem))
            forms[2].append(apply_u_umlaut(pp_stem) + "u")
            forms[2].append(pp_stem + "s")

            forms[2].append(apply_u_umlaut(pp_stem))
            forms[2].append(apply_u_umlaut(pp_stem))
            forms[2].append(apply_u_umlaut(pp_stem) + "um")
            forms[2].append(pp_stem + "ra")
        elif self.subclass in [3, 4]:
            pp_stem = self.stgken[:-1]  # past participle stem
            # masculine
            forms[0].append(add_r_ending(pp_stem))
            forms[0].append(pp_stem + "an")
            forms[0].append(apply_u_umlaut(pp_stem) + "um")
            forms[0].append(pp_stem + "s")

            forms[0].append(pp_stem + "ir")
            forms[0].append(pp_stem + "a")
            forms[0].append(apply_u_umlaut(pp_stem) + "um")
            forms[0].append(pp_stem + "ra")

            # feminine
            forms[1].append(apply_u_umlaut(pp_stem))
            forms[1].append(pp_stem + "a")
            forms[1].append(pp_stem + "ri")
            forms[1].append(pp_stem + "rar")

            forms[1].append(pp_stem + "ar")
            forms[1].append(pp_stem + "ar")
            forms[1].append(apply_u_umlaut(pp_stem) + "um")
            forms[1].append(pp_stem + "ra")

            # neuter
            forms[2].append(add_t_ending(pp_stem))
            forms[2].append(add_t_ending(pp_stem))
            forms[2].append(apply_u_umlaut(pp_stem) + "u")
            forms[2].append(pp_stem + "s")

            forms[2].append(apply_u_umlaut(pp_stem))
            forms[2].append(apply_u_umlaut(pp_stem))
            forms[2].append(apply_u_umlaut(pp_stem) + "um")
            forms[2].append(pp_stem + "ra")

        return forms
Example #7
0
def decline_strong_masculine_noun(ns: str, gs: str, np: str):
    """
    Gives the full declension of strong masculine nouns.

    >>> decline_strong_masculine_noun("armr", "arms", "armar")
    armr
    arm
    armi
    arms
    armar
    arma
    örmum
    arma

    # >>> decline_strong_masculine_noun("ketill", "ketils", "katlar")
    # ketill
    # ketil
    # katli
    # ketils
    # katlar
    # katla
    # kötlum
    # katla

    >>> decline_strong_masculine_noun("mór", "mós", "móar")
    mór
    mó
    mói
    mós
    móar
    móa
    móum
    móa

    >>> decline_strong_masculine_noun("hirðir", "hirðis", "hirðar")
    hirðir
    hirð
    hirði
    hirðis
    hirðar
    hirða
    hirðum
    hirða

    >>> decline_strong_masculine_noun("söngr", "söngs", "söngvar")
    söngr
    söng
    söngvi
    söngs
    söngvar
    söngva
    söngvum
    söngva

    >>> decline_strong_masculine_noun("gestr", "gests", "gestir")
    gestr
    gest
    gesti
    gests
    gestir
    gesti
    gestum
    gesta

    >>> decline_strong_masculine_noun("staðr", "staðar", "staðir")
    staðr
    stað
    staði
    staðar
    staðir
    staði
    stöðum
    staða

    # >>> decline_strong_masculine_noun("skjöldr", "skjaldar", "skildir")
    # skjöldr
    # skjöld
    # skildi
    # skjaldar
    # skildir
    # skjöldu
    # skjöldum
    # skjalda
    #
    # >>> decline_strong_masculine_noun("völlr", "vallar", "vellir")
    # völlr
    # völl
    # velli
    # vallar
    # vellir
    # völlu
    # völlum
    # valla
    #
    # >>> decline_strong_masculine_noun("fögnuðr", "fagnaðar", "fagnaðir")
    # fögnuðr
    # fögnuð
    # fagnaði
    # fagnaðar
    # fagnaðir
    # fögnuðu
    # fögnuðum
    # fagnaða

    a-stem
    armr, arm, armi, arms; armar, arma, örmum, arma
    ketill, ketil, katli, ketils; katlar, katla, kötlum, katla
    mór, mó, mó, mós; móar, móa, móm, móa
    hirðir, hirði, hirði, hirðis; hirðar, hirða, hirðum, hirða
    söngr, söng, söngvi, söngs; söngvar, söngva, söngvum, söngva

    i-stem
    gestr, gest, gest, gests; gestir, gesti, gestum, gesta
    staðr, stað stað, staðar; staðir, staði, stöðum, staða

    # u-stem
    # skjödr, skjöld, skildi, skjaldar; skildir, skjöldu, skjöldum, skjalda
    # völlr, völl, velli, vallar; vellir, völlu, völlum, valla
    # fögnuðr, fögnuð, fągnaði, fagnaðar; fagnaðir, fögnuðu, fögnuðum, fagnaða

    :param ns: nominative singular
    :param gs: genitive singular
    :param np: nominative plural
    :return:
    """
    np_syl = s.syllabify_ssp(np)

    last_np_syl = np_syl[-1]

    if last_np_syl.endswith("ar"):
        # a-stem
        common_stem = extract_common_stem(ns, gs, np)

        # nominative singular
        print(ns)

        # accusative singular
        print(common_stem)

        # dative singular
        if np[len(common_stem):][0] == "v":
            print(common_stem + "vi")
        else:
            print(common_stem + "i")

        # genitive singular
        print(gs)

        # nominative plural
        print(np)

        # accusative plural
        if last_np_syl.endswith("ar"):
            print(np[:-1])

        elif last_np_syl.endswith("ir"):
            print(np[:-1])

        # dative plural
        if np[len(common_stem):][0] == "v":
            print(apply_u_umlaut(common_stem) + "vum")

        elif np[len(common_stem):][0] == "j":
            print(apply_u_umlaut(common_stem) + "jum")
        else:
            print(apply_u_umlaut(common_stem) + "um")

        # genitive plural
        if np[len(common_stem):][0] == "v":
            print(common_stem + "va")
        elif np[len(common_stem):][0] == "j":
            print(common_stem + "ja")
        else:
            print(common_stem + "a")

    elif last_np_syl.endswith("ir"):
        # if has_u_umlaut(ns):
        #     # u-stem
        #     common_stem = ns[:-1]
        #
        #     # nominative singular
        #     print(ns)
        #
        #     # accusative singular
        #     print(common_stem)
        #
        #     # dative singular
        #     if np[len(common_stem):][0] == "v":
        #         print(common_stem + "vi")
        #     else:
        #         print(common_stem + "i")
        #
        #     # genitive singular
        #     print(gs)
        #
        #     common_stem_p = np[:-2]
        #     # nominative plural
        #     print(np)
        #
        #     # accusative plural
        #     print(apply_u_umlaut(common_stem_p)+"u")
        #
        #     # dative plural
        #     if np[len(common_stem):][0] == "v":
        #         print(apply_u_umlaut(common_stem_p) + "vum")
        #
        #     elif np[len(common_stem):][0] == "j":
        #         print(apply_u_umlaut(common_stem_p) + "jum")
        #     else:
        #         print(apply_u_umlaut(common_stem_p) + "um")
        #
        #     # genitive plural
        #     if np[len(common_stem):][0] == "v":
        #         print(common_stem_p + "va")
        #     elif np[len(common_stem):][0] == "j":
        #         print(common_stem_p + "ja")
        #     else:
        #         print(common_stem_p + "a")
        # else:

        # i-stem
        common_stem = extract_common_stem(ns, gs, np)

        # nominative singular
        print(ns)

        # accusative singular
        print(common_stem)

        # dative singular
        if np[len(common_stem):][0] == "v":
            print(common_stem + "vi")
        else:
            print(common_stem + "i")

        # genitive singular
        print(gs)

        # nominative plural
        print(np)

        # accusative plural
        print(np[:-1])

        # dative plural
        if np[len(common_stem):][0] == "v":
            print(apply_u_umlaut(common_stem) + "vum")

        elif np[len(common_stem):][0] == "j":
            print(apply_u_umlaut(common_stem) + "jum")
        else:
            print(apply_u_umlaut(common_stem) + "um")

        # genitive plural
        if np[len(common_stem):][0] == "v":
            print(common_stem + "va")
        elif np[len(common_stem):][0] == "j":
            print(common_stem + "ja")
        else:
            print(common_stem + "a")
Example #8
0
def decline_weak_masculine_noun(ns: str, gs: str, np: str):
    """
    Gives the full declension of weak masculine nouns.

    >>> decline_weak_masculine_noun("goði", "goða", "goðar")
    goði
    goða
    goða
    goða
    goðar
    goða
    goðum
    goða

    >>> decline_weak_masculine_noun("hluti", "hluta", "hlutar")
    hluti
    hluta
    hluta
    hluta
    hlutar
    hluta
    hlutum
    hluta

    >>> decline_weak_masculine_noun("arfi", "arfa", "arfar")
    arfi
    arfa
    arfa
    arfa
    arfar
    arfa
    örfum
    arfa

    >>> decline_weak_masculine_noun("bryti", "bryta", "brytjar")
    bryti
    bryta
    bryta
    bryta
    brytjar
    brytja
    brytjum
    brytja

    >>> decline_weak_masculine_noun("vöðvi", "vöðva", "vöðvar")
    vöðvi
    vöðva
    vöðva
    vöðva
    vöðvar
    vöðva
    vöðum
    vöðva

    The main pattern is:

    :param ns: nominative singular
    :param gs: genitive singular
    :param np: nominative plural
    :return:
    """
    # nominative singular
    print(ns)

    # accusative singular
    print(gs)

    # dative singular
    print(gs)

    # genitive singular
    print(gs)

    # nominative plural
    print(np)

    # accusative plural
    print(np[:-1])

    # dative plural
    if len(np) > 3 and np[-3] == "v":
        print(apply_u_umlaut(np[:-3]) + "um")
    else:
        print(apply_u_umlaut(np[:-2]) + "um")

    # genitive plural
    print(np[:-1])
Example #9
0
def decline_strong_neuter_noun(ns: str, gs: str, np: str):
    """
    Gives the full declension of strong neuter nouns.

    a-stem
    Most of strong neuter nouns follow the declensions of skip, land and herað.

    >>> decline_strong_neuter_noun("skip", "skips", "skip")
    skip
    skip
    skipi
    skips
    skip
    skip
    skipum
    skipa

    >>> decline_strong_neuter_noun("land", "lands", "lönd")
    land
    land
    landi
    lands
    lönd
    lönd
    löndum
    landa

    >>> decline_strong_neuter_noun("herað", "heraðs", "heruð")
    herað
    herað
    heraði
    heraðs
    heruð
    heruð
    heruðum
    heraða

    # >>> decline_strong_neuter_noun("kyn", "kyns", "kyn")
    # kyn
    # kyn
    # kyni
    # kyns
    # kyn
    # kyn
    # kynjum
    # kynja
    #
    # >>> decline_strong_neuter_noun("högg", "höggs", "högg")
    # högg
    # högg
    # höggvi
    # höggs
    # högg
    # högg
    # höggum
    # höggva

    >>> decline_strong_neuter_noun("kvæði", "kvæðis", "kvæði")
    kvæði
    kvæði
    kvæði
    kvæðis
    kvæði
    kvæði
    kvæðum
    kvæða

    :param ns: nominative singular
    :param gs: genitive singular
    :param np: nominative plural
    :return:
    """

    # nominative singular
    print(ns)

    # accusative singular
    print(ns)

    # dative singular
    if ns[-1] == "i":
        print(ns)
    # TODO  +"vi"
    else:
        print(ns + "i")

    # genitive singular
    print(gs)

    # nominative plural
    print(np)

    # accusative plural
    print(np)

    # dative plural
    if ns[-1] in CONSONANTS:
        print(apply_u_umlaut(np) + "um")
    else:
        print(apply_u_umlaut(np[:-1]) + "um")
    # TODO +"vum"

    # genitive plural
    if ns[-1] in CONSONANTS:
        print(ns + "a")
    # TODO + "va"
    else:
        print(ns[:-1] + "a")
Example #10
0
def decline_strong_feminine_noun(ns: str, gs: str, np: str):
    """
    Gives the full declension of strong feminine nouns.

    o macron-stem
    Most of strong feminine nouns follows the declension of rún and för.
    >>> decline_strong_feminine_noun("rún", "rúnar", "rúnar")
    rún
    rún
    rún
    rúnar
    rúnar
    rúnar
    rúnum
    rúna

    >>> decline_strong_feminine_noun("för", "farar", "farar")
    för
    för
    för
    farar
    farar
    farar
    förum
    fara

    >>> decline_strong_feminine_noun("kerling", "kerlingar", "kerlingar")
    kerling
    kerling
    kerlingu
    kerlingar
    kerlingar
    kerlingar
    kerlingum
    kerlinga

    >>> decline_strong_feminine_noun("skel", "skeljar", "skeljar")
    skel
    skel
    skel
    skeljar
    skeljar
    skeljar
    skeljum
    skelja

    >>> decline_strong_feminine_noun("ör", "örvar", "örvar")
    ör
    ör
    ör
    örvar
    örvar
    örvar
    örum
    örva

    >>> decline_strong_feminine_noun("heiðr", "heiðar", "heiðar")
    heiðr
    heiði
    heiði
    heiðar
    heiðar
    heiðar
    heiðum
    heiða

    i-stem

    >>> decline_strong_feminine_noun("öxl", "axlar", "axlir")
    öxl
    öxl
    öxl
    axlar
    axlir
    axlir
    öxlum
    axla

    >>> decline_strong_feminine_noun("höfn", "hafnar", "hafnir")
    höfn
    höfn
    höfn
    hafnar
    hafnir
    hafnir
    höfnum
    hafna

    >>> decline_strong_feminine_noun("norn", "nornar", "nornir")
    norn
    norn
    norn
    nornar
    nornir
    nornir
    nornum
    norna

    >>> decline_strong_feminine_noun("jörð", "jarðar", "jarðir")
    jörð
    jörð
    jörð
    jarðar
    jarðir
    jarðir
    jörðum
    jarða

    >>> decline_strong_feminine_noun("borg", "borgar", "borgir")
    borg
    borg
    borgu
    borgar
    borgir
    borgir
    borgum
    borga

    :param ns: nominative singular
    :param gs: genitive singular
    :param np: nominative plural
    :return:
    """

    # nominative singular
    print(ns)

    # accusative singular
    if len(ns) > 2 and ns[-1] == "r" and ns[-2] in CONSONANTS:
        print(ns[:-1] + "i")
    else:
        print(ns)

    # dative singular
    if len(ns) > 2 and ns[-1] == "r" and ns[-2] in CONSONANTS:
        print(ns[:-1] + "i")
    elif ns.endswith("ing") or ns.endswith("rg"):
        print(ns + "u")
    else:
        print(ns)

    # genitive singular
    print(gs)

    # nominative plural
    print(np)

    # accusative plural
    print(np)

    # dative plural
    # print("dative plural "+np[len(np[:-3]):][0])
    if np[len(np[:-3]):][0] == "v":
        print(apply_u_umlaut(np[:-2])[:-1] + "um")
    elif np[len(np[:-3]):][0] == "j":
        print(apply_u_umlaut(np[:-2]) + "um")
    else:
        print(apply_u_umlaut(np[:-2]) + "um")

    # genitive plural
    print(np[:-2] + "a")