graph_of_words.py 文件源码

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

项目:TextAsGraphClassification 作者: NightmareNyx 项目源码 文件源码
def extract_terms_from_file(file_location, stopwords=None, lemmatize=None, stem=None, only_N_J=None):
    with open(file_location, 'r', encoding='iso-8859-1') as doc:
        terms = []
        for line in doc:
            terms.extend(re.compile('\w+').findall(line.lower()))

        # terms = re.compile('\w+').findall(doc
        #                                   .read()
        #                                   .replace('\n', '')
        #                                   .lower())
        return clean_terms(terms, stopwords, lemmatize, stem, only_N_J)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号