Skip to content

Instantly share code, notes, and snippets.

@ajitesh123
Created May 27, 2019 20:23
Show Gist options
  • Save ajitesh123/3d8bd5fe87eabf29eec3ef922e439151 to your computer and use it in GitHub Desktop.
Save ajitesh123/3d8bd5fe87eabf29eec3ef922e439151 to your computer and use it in GitHub Desktop.
Display the source blob
Display the rendered blob
Raw
{
"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