【发布时间】:2019-03-07 11:40:48
【问题描述】:
我有英文句子列表(每个句子都是一个列表),我想获取 ngrams。 例如:
sentences = [['this', 'is', 'sentence', 'one'], ['hello','again']]
为了运行
nltk.utils.ngram
我需要将列表扁平化为:
sentences = ['this','is','sentence','one','hello','again']
但是我在
中得到了一个错误的bgram('一','你好')
。 最好的处理方法是什么?
谢谢!
【问题讨论】:
标签: python list nested nested-lists flatten