bytileAggregator.py 文件源码

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

项目:project-fortis 作者: CatalystCode 项目源码 文件源码
def create_keyword_regex(keyword):
    print 'create_keyword_regex'
    # import nltk
    ensure_package_path()
    from nltk.tokenize import wordpunct_tokenize as tokenize
    print 'tokenize ==> %s' % (keyword)
    tokens = tokenize(keyword)
    pattern = '\\s+'.join(tokens)
    pattern = '\\b%s\\b' % pattern
    print 'compile pattern ==> %s' % (pattern)
    return re.compile(pattern, re.I | re.UNICODE)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号