Я преподал несколько вводных классов для интеллектуального анализа текста с помощью Python, и класс попробовал аналогичный метод с предоставленными практическими текстами. Некоторые студенты получили разные результаты для text1.similar(), чем другие.
Все версии и т.д. были одинаковыми.
Кто-нибудь знает, почему произошли эти различия? Спасибо.
Код, используемый в командной строке.
python
>>> import nltk
>>> nltk.download() #here you use the pop-up window to download texts
>>> from nltk.book import *
*** Introductory Examples for the NLTK Book ***
Loading text1, ..., text9 and sent1, ..., sent9
Type the name of the text or sentence to view it.
Type: 'texts()' or 'sents()' to list the materials.
text1: Moby Dick by Herman Melville 1851
text2: Sense and Sensibility by Jane Austen 1811
text3: The Book of Genesis
text4: Inaugural Address Corpus
text5: Chat Corpus
text6: Monty Python and the Holy Grail
text7: Wall Street Journal
text8: Personals Corpus
text9: The Man Who Was Thursday by G . K . Chesterton 1908
>>>>>> text1.similar("monstrous")
mean part maddens doleful gamesome subtly uncommon careful untoward
exasperate loving passing mouldy christian few true mystifying
imperial modifies contemptible
>>> text2.similar("monstrous")
very heartily so exceedingly remarkably as vast a great amazingly
extremely good sweet
Эти списки терминов, возвращаемых аналогичным методом, отличаются от пользователя к пользователю, у них много общего, но они не идентичны. Все пользователи использовали одну и ту же ОС и те же версии python и nltk.
Надеюсь, этот вопрос станет более ясным. Спасибо.