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


Python UI.render_info方法代码示例

本文整理汇总了Python中UI.render_info方法的典型用法代码示例。如果您正苦于以下问题:Python UI.render_info方法的具体用法?Python UI.render_info怎么用?Python UI.render_info使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在UI的用法示例。


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

示例1: print_blocks_for_selected_meaning

# 需要导入模块: import UI [as 别名]
# 或者: from UI import render_info [as 别名]
 def print_blocks_for_selected_meaning(self):
     """ This methods prints the block strings for the selected meaning. 
     
     Example:
     --------
         For the word '안녕', the blocks will be ['안', '녕']
     """
     UI.render_info('print blocks for selected meaning')
     UI.render_info([block.get_str() for block in self.blocks[self.selected_meaning]])
     return [block.get_str() for block in self.blocks[self.selected_meaning]]
开发者ID:yunux,项目名称:AsianWordAnalyzer,代码行数:12,代码来源:Thai.py

示例2: compute_blocks

# 需要导入模块: import UI [as 别名]
# 或者: from UI import render_info [as 别名]
    def compute_blocks(self, compute_ethym=False):
        """ Compute the blocks given the input string.

        Output:
            Returns a list of lists of blocks, i.e. 
            [ [b11, ..., b1n1], [b21, ..., b2n2], ...], where each list of 
            blocks [bi1, ..., bini] corresponds to a possible meaning of the 
            input string.

        Note: 
            In this CSV dictionnary based implemenation, only one meaning is 
            available.            
        """
        if DEBUG:
            UI.render_info('compute_blocks() called for word ' + self.string)        
        
        suffixes = {'하다':'하다 verb particule', \
            '합니다': 'formal 하다 ending', \
            '하세요': 'formal imperative form of 하다', \
              '요': 'politeness particle'}
              
        detected_suffix = ''
        # for suffix in suffixes.keys():
        #     if self.string.endswith(suffix):
        #         detected_suffix = suffix
        #         continue
        body = self.string[0:len(self.string)-len(detected_suffix)]
        #if not compute_ethym:
            #blocks = [Block(body[i]) for i in range(len(body)) if body[i] != ' ']
        blocks = compute_blocks_re(body)
        # else:
        #     hanja = get_hanja(body)
        #     if DEBUG:
        #         UI.render_info(hanja)
        #     blocks = [Block(body[i], ethym=hanja[i]) for i in range(len(body)) if body[i] != ' ']

        # if detected_suffix:
        #     suffix_desc = 'Suffix: ' + suffixes[detected_suffix]
        #     blocks.append(Block(detected_suffix, ethym=suffix_desc))

        if DEBUG:
            for block in blocks:
                UI.render_info(block.get_string())

        return [blocks]
开发者ID:yunux,项目名称:AsianWordAnalyzer,代码行数:47,代码来源:Thai.py

示例3: compute_blocks

# 需要导入模块: import UI [as 别名]
# 或者: from UI import render_info [as 别名]
    def compute_blocks(self, compute_ethym=False):
        """ Compute the blocks given the input string.

        Output:
            Returns a list of lists of blocks, i.e.
            [ [b11, ..., b1n1], [b21, ..., b2n2], ...], where each list of
            blocks [bi1, ..., bini] corresponds to a possible meaning of the
            input string.

        Note:
            In this CSV dictionnary based implemenation, only one meaning is
            available.
        """
        if DEBUG:
            UI.render_info('compute_blocks() called for word ' + self.string)

        suffixes = {u'하다':u'하다 verb particule', \
            u'합니다': u'formal 하다 ending', \
            u'하세요': u'formal imperative form of 하다', \
              u'요': u'politeness particle'}

        detected_suffix = ''
        for suffix in suffixes.keys():
            if self.string.endswith(suffix):
                detected_suffix = suffix
                continue
        body = self.string[0:len(self.string)-len(detected_suffix)]

        if not compute_ethym:
            blocks = [Block(body[i]) for i in range(len(body)) if body[i] != ' ']
        else:
            ethym = get_hanja(body)
            if DEBUG:
                UI.render_info(ethym)
            blocks = [Block(body[i], ethym=ethym[i], \
                        meaning=get_hanja_meaning(ethym[i])) \
                        for i in range(len(body)) if body[i] != ' ']

        if detected_suffix:
            suffix_desc = 'Suffix: ' + suffixes[detected_suffix]
            blocks.append(Block(detected_suffix, meaning=suffix_desc))

        return [blocks]
开发者ID:yunux,项目名称:AsianWordAnalyzer,代码行数:45,代码来源:Korean.py

示例4: tuple

# 需要导入模块: import UI [as 别名]
# 或者: from UI import render_info [as 别名]
    _uu8 = lambda *tt: tuple(_u8(t) for t in tt)


DEBUG = True

#==============================================================================
# AWA MAIN
#==============================================================================

#UI.render_empty()

# Entree
UI.render_top()

if DEBUG:
    UI.render_info('Python version ' + str(sys.version_info.major))


# Main
form = cgi.FieldStorage()
if 'word' in form.keys():
    input_str = form["word"].value
    language = detect_language(_u(input_str))
    if DEBUG:
        UI.render_info(language)


    if language == 'korean':
        from Korean import get_words_with_block
        from Korean import KoreanWord as Word
    elif language == 'thai':
开发者ID:yunux,项目名称:AsianWordAnalyzer,代码行数:33,代码来源:awa.py


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