__init__.py 文件源码

python
阅读 18 收藏 0 点赞 0 评论 0

项目:Taigabot 作者: FrozenPigs 项目源码 文件源码
def set_offset(self,off,whence=0):
        """Set the offset of the tokenization routine.

        For more details on the purpose of the tokenization offset,
        see the documentation of the 'enchant.tokenize' module.
        The optional argument whence indicates the method by
        which to change the offset:
            * 0 (the default) treats <off> as an increment
            * 1 treats <off> as a distance from the start
            * 2 treats <off> as a distance from the end
        """
        if whence == 0:
            self._tokens.set_offset(self._tokens.offset + off)
        elif whence == 1:
            assert(off > 0)
            self._tokens.set_offset(off)
        elif whence == 2:
            assert(off > 0)
            self._tokens.set_offset(len(self._text) - 1 - off)
        else:
            raise ValueError("Invalid value for whence: %s"%(whence,))
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号