Форум сайта python.su
0
привет! нужна помощь!
код взять из генсим, я удалила stopworts через NLTK.
помогите pls убрать знаки препинания.
огромное спасибо!
import logging
logging.basicConfig(format= ‘%(asctime)s : %(levelname)s : %(message)s’, level=logging.INFO)
import re
from gensim import corpora, models, similarities
from nltk.corpus import stopwords
from nltk.tokenize import word_tokenize
documents = [“Human machine, interface for lab abc, computer applications”,
“A survey: of user opinion - of computer system response time”]
stoplist = set(stopwords.words(“english”))
??????b = re.sub(ur'^*||\s(?
$)(?u)', “ ”, documents)
texts = [
for document in documents]
dictionary = corpora.Dictionary(texts)
dictionary.save('/tmp/deerwester.dict') # store the dictionary, for future reference
new_doc = “Human computer interaction”
new_vec = dictionary.doc2bow(new_doc.lower().split())
corpus =
corpora.MmCorpus.serialize('/tmp/deerwester.mm', corpus) # store to disk, for later use
from pprint import pprint # pretty-printer
pprint(texts)
print(dictionary)
print(new_vec)
print(corpus)
Отредактировано Irina_n (Фев. 29, 2016 14:45:40)
Офлайн
221
Код нужно оборачивать в теги code
Офлайн
61
Кто понял что требуется сделать? 0_о
Офлайн
26
ZerG
documents
Офлайн
253
ajib6ept:) Вы невнимательно посмотрели не он а она.
Стоп-слова он удалил
Офлайн