POS-Tagger невероятно медленный

я используюnltk генерировать n-граммы из предложений, сначала удаляя заданные стоп-слова. Тем не мение,nltk.pos_tag() очень медленно занимает до 0,6 сек на моем процессоре (Intel i7).

Выход:

['The first time I went, and was completely taken by the live jazz band and atmosphere, I ordered the Lobster Cobb Salad.']
0.620481014252
["It's simply the best meal in NYC."]
0.640982151031
['You cannot go wrong at the Red Eye Grill.']
0.644664049149

Код:

for sentence in source:

    nltk_ngrams = None

    if stop_words is not None:   
        start = time.time()
        sentence_pos = nltk.pos_tag(word_tokenize(sentence))
        print time.time() - start

        filtered_words = [word for (word, pos) in sentence_pos if pos not in stop_words]
    else:
        filtered_words = ngrams(sentence.split(), n)

Это действительно так медленно или я здесь что-то не так делаю?

Ответы на вопрос(3)

Ваш ответ на вопрос