def kwe_by_tfidf(text, top=10, pos=None, with_weight=False):
    """

    :param text:
    :param top:
    :param pos:
    :param with_weight:
    :return:
    """
    if pos is None:
        pos = ['ns', 'n', 'vn', 'v', 'nr']
    kw = jieba.analyse.extract_tags(text, topK=top, withWeight=True,
                                    allowPOS=pos)
    if not with_weight:
        kw = [x[0] for x in kw]
    return kw
def kwe_by_tfidf ( text , top = 10 , pos = None , with_weight = False ) : if pos is None : pos = [ 'ns' , 'n' , 'vn' , 'v' , 'nr' ] kw = jieba . analyse . extract_tags ( text , topK = top , withWeight = True , allowPOS = pos ) if not with_weight : kw = [ x [ 0 ] for x in kw ] return kw
:param text:
    :param top:
    :param pos:
    :param with_weight:
    :return: