• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python makeunicode.u函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: enable_metainfo

    def enable_metainfo(self, key, value=True):
        """ Enable/Disable a meta information or raise a MetaKeyError exception.

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

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

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


示例17: __centaine_cmn

 def __centaine_cmn(self, number):
     if number < 100:
         return self.dizaine(number)
     if number >= 100 and number < 1000:
         if (number % 100) != 0:
             if (number % 100) > 0 and (number % 100) < 10:
                 return self.dizaine(int(number/100)) + u("百零") + self.dizaine(number % 100)
             return self.dizaine(int(number/100)) + u("百") + self.dizaine(number % 100)
         else:
             return self.dizaine(int(number/100)) + u("百")
     return str(number)
开发者ID:gmontcheuil,项目名称:sppas,代码行数:11,代码来源:num2letter.py


示例18: __milliards_pol

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

        if number >= 1000000000 and number < 2000000000:
            return u("miliard") + self.millions(int(number % 1000000000))

        if number >= 2000000000 and number < 1000000000000:
            return self.centaine(int(number/1000000000)) + u(" miliardy ") + self.millions(int(number % 1000000000))

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


示例19: __milliards_fra

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

        if number >= 1000000000 and number < 2000000000:
            return u("un-milliard-") + self.millions(int(number % 1000000000))

        if number >= 2000000000 and number < 1000000000000:
            return self.centaine(int(number/1000000000)) + u("-milliards-") + self.millions(int(number % 1000000000))

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


示例20: __milliers_pol

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

        n = number / 1000
        r = number % 1000
        if number < 2000:
            s = u("tysięcy")
        else:
            s = u("%s tysiące") % self.centaine(n)
        if r == 0:
            return s
        return u("%s %s") % (s, self.centaine(r))
开发者ID:gmontcheuil,项目名称:sppas,代码行数:13,代码来源:num2letter.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python sppy.csarray函数代码示例发布时间:2022-05-27
下一篇:
Python util.prompt_for_user_token函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap