当前位置: 首页>>代码示例>>Python>>正文


Python makeunicode.u函数代码示例

本文整理汇总了Python中sppas.src.utils.makeunicode.u函数的典型用法代码示例。如果您正苦于以下问题:Python u函数的具体用法?Python u怎么用?Python u使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了u函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: __milliers_ita

    def __milliers_ita(self,number):
        if number < 1000:
            return self.centaine(number)

        # Milliers
        if number == 1000:
            return u("mille")
        if number > 1000 and number < 2000:
            return u("mille-") + self.centaine(number % 1000)
        if number >= 2000 and number < 10000:
            if (number % 1000) != 0:
                return self.unite(int(number/1000)).strip() + u("-mila-") + self.centaine(number % 1000)
            return self.unite(int(number/1000)).strip() + u("-mila")

        # Dizaines de milliers
        if number == 10000:
            return u("diecimila")
        if number > 10000 and number < 100000:
            if (number % 1000) != 0:
                return self.dizaine(int(number/1000)).strip() + u("-mila-") + self.centaine(number % 1000)
            return self.dizaine(int(number/1000)) + u("-mila")

        # Centaines de milliers
        if number == 100000:
            return u("centomila")
        if number >= 100000 and number < 1000000:
            if (number % 1000) != 0:
                return self.centaine(int(number/1000)).strip() + u("-mila-") + self.centaine(int(number%1000))
            return self.centaine(int(number/1000)).strip() + u("mila-")

        return str(number)
开发者ID:gmontcheuil,项目名称:sppas,代码行数:31,代码来源:num2letter.py

示例2: __milliers_fra

    def __milliers_fra(self, number):
        if number < 1000:
            return self.centaine(number)

        # Milliers
        if number == 1000:
            return u("mille ")
        elif number > 1000 and number < 2000:
            return u("mille-") + self.centaine(number % 1000)
        elif number >= 2000 and number < 10000:
            if (number % 1000) == 0:
                return self.unite(int(number/1000)) + u("-mille-")
            return self.unite(int(number/1000)) + u("-mille-") + self.centaine(number % 1000)

        # Dizaines de milliers
        if number == 10000:
            return u("dix-mille")
        elif number > 10000 and number < 100000:
            if (number%1000) == 0:
                return self.dizaine(int(number/1000)) + u("-mille ")
            return self.dizaine(int(number/1000)) + u("-mille-") + self.centaine(number % 1000)

        # Centaines de milliers
        if number == 100000:
            return u("cent-mille")
        elif number >= 100000 and number < 1000000:
            if (number % 1000) == 0:
                return self.centaine(int(number/1000)) + u("-mille ")
            return self.centaine(int(number/1000)) + u("-mille-") + self.centaine(int(number % 1000))

        return str(number)
开发者ID:gmontcheuil,项目名称:sppas,代码行数:31,代码来源:num2letter.py

示例3: __parse_option

    def __parse_option(items):
        """ Parse an option.
        Convert an "Option" section of the parser into an "Option" instance.

        """
        oid = ""
        otype = "str"
        ovalue = ""
        otext = ""

        for name, value in items:

            if name == "type":
                otype = u(value)

            elif name == "id":
                oid = u(value)

            elif name == "value":
                ovalue = u(value)

            elif name == "text":
                otext = u(value)

        opt = sppasOption(oid)
        opt.set_type(otype)
        opt.set_value(ovalue)
        opt.set_text(otext)

        return opt
开发者ID:gmontcheuil,项目名称:sppas,代码行数:30,代码来源:cfgparser.py

示例4: __dizaine_cmn

 def __dizaine_cmn(self, number):
     if number < 10:
         _str = self.unite(number)
     elif 10 <= number < 100:
         if (number%10) == 0:
             _str = self.unite(int(number/10)) + u("十")
         else:
             _str = self.unite(int(number/10)) + u("十") + self.unite(number%10)
     return _str
开发者ID:gmontcheuil,项目名称:sppas,代码行数:9,代码来源:num2letter.py

示例5: __milliards_spa

 def __milliards_spa(self, number):
     if number < 1000000000:
         return self.millions(number)
     n = number / 1000000000
     r = number % 1000000000
     s = u("%s-mil-millones") % self.millions(n)
     if r == 0:
         return s
     else:
         return u("%s-%s") % (s, self.millions(r))
开发者ID:gmontcheuil,项目名称:sppas,代码行数:10,代码来源:num2letter.py

示例6: test_all

 def test_all(self):
     l = sppasVocabulary(VOCAB, nodump=True)
     self.assertEqual(len(l), 20)
     self.assertTrue(l.is_unk('toto'))
     self.assertFalse(l.is_unk('normale'))
     self.assertFalse(l.is_unk("isn't"))
     self.assertFalse(l.is_unk(u("đ")))
     l.add("être")
     self.assertTrue(l.is_in(u("être")))
     self.assertTrue(u("être") in l)
开发者ID:gmontcheuil,项目名称:sppas,代码行数:10,代码来源:test_vocab.py

示例7: pop_metainfo

    def pop_metainfo(self, key):
        """ Pop a meta information or raise a MetaKeyError exception.

        :param key: (str) The key of the meta-information

        """
        if u(key) not in self._metainfo.keys():
            raise MetaKeyError(key)

        del self._metainfo[u(key)]
开发者ID:gmontcheuil,项目名称:sppas,代码行数:10,代码来源:metainfo.py

示例8: __centaine_ita

 def __centaine_ita(self, number):
     if number < 100:
         return self.dizaine(number)
     if number == 100:
         return u("cento")
     if number > 100 and number <= 199:
         return u("cento-") + self.dizaine(number%100)
     if (number%100) == 0:
         return " " + self.unite(number % 100) + u("-cento")
     return " " + self.unite(int(number/100)) + u("-cento-") + self.dizaine(number % 100)
开发者ID:gmontcheuil,项目名称:sppas,代码行数:10,代码来源:num2letter.py

示例9: is_enable_metainfo

    def is_enable_metainfo(self, key):
        """ Return the status of a given key or raise a MetaKeyError exception.

        :param key: (str) The key of the meta-information

        """
        if u(key) not in self._metainfo:
            raise MetaKeyError(key)

        return self._metainfo[u(key)][0]
开发者ID:gmontcheuil,项目名称:sppas,代码行数:10,代码来源:metainfo.py

示例10: get_metainfo

    def get_metainfo(self, key):
        """ Return the value of a given key or raise a MetaKeyError exception.

        :param key: (str) The key of the meta-information

        """
        if u(key) not in self._metainfo:
            raise MetaKeyError(key)

        return self._metainfo[u(key)][1]
开发者ID:gmontcheuil,项目名称:sppas,代码行数:10,代码来源:metainfo.py

示例11: test_toe

    def test_toe(self):

        t = sppasTranscription()
        s = t.clean_toe(u(" /l-e-f-o~-n/ "))
        s = t.toe_spelling(s)
        self.assertEqual(s, u('/l-e-f-o~-n/'))

        s = t.clean_toe(u(" /le mot/ "))
        s = t.toe_spelling(s)
        self.assertEqual(s, u('/ le mot /'))
开发者ID:gmontcheuil,项目名称:sppas,代码行数:10,代码来源:test_normalize.py

示例12: __millions_ita

    def __millions_ita(self,number):
        if number < 1000000:
            return self.milliers(number)

        if number >= 1000000 and number < 2000000:
            return u("un-milione-") + self.milliers(int(number % 1000000))

        if number >= 2000000 and number < 1000000000:
            return self.centaine(int(number/1000000)).strip() + u("-milioni-") + self.milliers(int(number % 1000000))

        return str(number)
开发者ID:gmontcheuil,项目名称:sppas,代码行数:11,代码来源:num2letter.py

示例13: __milliers_eng

    def __milliers_eng(self, number):
        if number < 1000:
            return self.centaine(number)

        n = number / 1000
        r = number % 1000
        s = u("%s thousand") % self.centaine(n)
        if r == 0:
            return s
        else:
            return u("%s %s") % (s, self.centaine(r))
开发者ID:gmontcheuil,项目名称:sppas,代码行数:11,代码来源:num2letter.py

示例14: __millions_pol

    def __millions_pol(self, number):
        if number < 1000000:
            return self.milliers(number)

        if number >= 1000000 and number < 2000000:
            return u("milion ") + self.milliers(int(number % 1000000))

        if number >= 2000000 and number < 1000000000:
            return self.centaine(int(number/1000000)).strip() + u(" miliony ") + self.milliers(int(number % 1000000))

        return str(number)
开发者ID:gmontcheuil,项目名称:sppas,代码行数:11,代码来源:num2letter.py

示例15: __milliards_eng

    def __milliards_eng(self, number):
        if number < 1000000000:
            return self.millions(number)

        n = number / 1000000000
        r = number % 1000000000
        s = u("%s billion") % self.centaine(n)
        if r == 0:
            return s
        else:
            return u("%s %s") % (s, self.millions(r))
开发者ID:gmontcheuil,项目名称:sppas,代码行数:11,代码来源:num2letter.py


注:本文中的sppas.src.utils.makeunicode.u函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。