How to use the num2words.lang_FI.Options function in num2words

To help you get started, we’ve selected a few num2words examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github savoirfairelinux / num2words / num2words / lang_FI.py View on Github external
def to_cardinal(self, value, case='nominative', plural=False, prefer=None):
        case = NAME_TO_CASE[case]
        options = Options(False, case, plural, prefer)
        try:
            assert int(value) == value
        except (ValueError, TypeError, AssertionError):
            if case != NOM:
                raise NotImplementedError(
                    "Cases other than nominative are not implemented for "
                    "cardinal floating point numbers.")
            return self.to_cardinal_float(value)

        out = ""
        if value < 0:
            value = abs(value)
            out = self.negword

        if value >= self.MAXVAL:
            raise OverflowError(self.errmsg_toobig % (value, self.MAXVAL))
github savoirfairelinux / num2words / num2words / lang_FI.py View on Github external
def to_ordinal(self, value, case='nominative', plural=False, prefer=None):
        case = NAME_TO_CASE[case]
        options = Options(True, case, plural, prefer)

        self.verify_ordinal(value)
        if value >= self.MAXVAL:
            raise OverflowError(self.errmsg_toobig % (value, self.MAXVAL))

        val = self.splitnum(value, options)
        words, num = self.clean(val, options)
        return self.title(words)
github savoirfairelinux / num2words / num2words / lang_FI.py View on Github external
def variation(self, ordinal=None, case=None, plural=None, prefer=None):
        return Options(
            ordinal if ordinal is not None else self.ordinal,
            case if case is not None else self.case,
            plural if plural is not None else self.plural,
            prefer if prefer is not None else self.prefer,
        )