import gensim
from gensim.models import FastText

# Get the text file
text_file = open("text_file.txt", "r")
text = text_file.read()
text_file.close()

# Create an Unsupervised model
model = FastText(vector_size=200, window=10, min_count=5, sample=1e-2, workers=4)

# Train the model
model.build_vocab(text)
model.train(text, total_examples=model.corpus_count, epochs=50)

# Ask the model a question
question = "What is the most common word in the text file?"
question_words = question.split()
answer = model.predict_classes(question_words)

# Print the answer
print(answer)


WARNING:gensim.models.word2vec:Each 'sentences' item should be a list of words (usually unicode strings). First item here is instead plain <class 'str'>.
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-8-e9818bdd8881> in <cell line: 19>()
     17 question = "What is the most common word in the text file?"
     18 question_words = question.split()
---> 19 answer = model.predict_classes(question_words)
     20 
     21 # Print the answer

AttributeError: 'FastText' object has no attribute 'predict_classes'
 Provide two versions of response separated with exactly 6 asterisk symbols: ******.
user