Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
{
"cells": [
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"import pyLDAvis\n",
"import pyLDAvis.sklearn\n",
"pyLDAvis.enable_notebook()\n",
"from __future__ import print_function\n",
"import nltk\n",
"\n",
"#Collection of all Tweet text for topic modelling \n",
"data_dump=data['Tweets_Cln'].str.cat(sep=', ')\n",
"\n",
"#Making sure we have just alphbest and numerals \n",
"words = set(nltk.corpus.words.words())\n",
"data_dump= \" \".join(w for w in nltk.wordpunct_tokenize(data_dump) \\\n",
" if w.lower() in words and w.isalpha())"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.7.0"
}
},
"nbformat": 4,
"nbformat_minor": 2
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.