I try get the matrix embedding of my model but I can't because although this code gives no error it never ends running. The code is:

def fast_text(norm_corpus):
    wpt = nltk.WordPunctTokenizer()
    tokenized_corpus = [wpt.tokenize(document) for document in norm_corpus]
    # Set values for various parameters
    feature_size = 300
    # Word vector dimensionality
    window_context = 5
    # Context window size
    min_word_count = 1
    # Minimum word count
    sample = 1e-3
    ft_model = FastText(tokenized_corpus, size=feature_size, window=window_context,min_count=min_word_count,sample=sample, sg=i, iter=50)

    words = list(ft_model.wv.vocab)
    vectors = []
    for w in words:
    embedding_matrix = np.array(vectors)
    embedding_matrix = embedding_matrix.T

    return embedding_matrix

I don't know how fix it.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.