Skip to content

Instantly share code, notes, and snippets.

@frenzy2106
Created March 18, 2020 09:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save frenzy2106/0a51ea0f776da57b81a1a49363583577 to your computer and use it in GitHub Desktop.
Save frenzy2106/0a51ea0f776da57b81a1a49363583577 to your computer and use it in GitHub Desktop.
#finding the average words present per comment
print(corpus[0])
print(corpus_tokens[0:2])
num_of_words_in_doc =[]
for doc in corpus_tokens:
num_of_words_in_doc.append(len(doc))
print("Average number of words: ", np.average(num_of_words_in_doc))
# Padding the sequences
corpus_pad = keras.preprocessing.sequence.pad_sequences(corpus_tokens,maxlen=25,padding='post')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment