15

我的语料库.txt

Human where's machine interface for lab abc computer applications   
A where's survey of user opinion of computer system response time

停用词.txt

let's
ain't
there's

以下代码

corpus = set()
for line in open("path\\to\\mycorpus.txt"):
    corpus.update(set(line.lower().split()))
print corpus

stoplist = set()
for line in open("C:\\Users\\Pankaj\\Desktop\\BTP\\stopwords_new.txt"):
    stoplist.add(line.lower().strip())
print stoplist

给出以下输出

set(['a', "where's", 'abc', 'for', 'of', 'system', 'lab', 'machine', 'applications', 'computer', 'survey', 'user', 'human', 'time', 'interface', 'opinion', 'response'])
set(['let\x92s', 'ain\x92t', 'there\x92s'])

为什么在第二组撇号变成 \x92 ?

4

1 回答 1

21
于 2013-03-22T06:39:56.770 回答