mycorpus.txtApostroph Drehen in x92
Human where's machine interface for lab abc computer applications
A where's survey of user opinion of computer system response time
stopwords.txt
let's
ain't
there's
Der folgende Code
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
folgende Ausgabe
ergibtset(['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'])
Warum springt der Apostroph im zweiten Satz in \ x92?
Verwenden Sie niemals Microsoft-Editoren, wenn Sie ASCII-Texte schreiben möchten. Wenn Sie sie verwenden möchten, müssen Sie mit cp1252 umgehen (was auch das "Anführungszeichen" enthält). – Bakuriu