Skip to content

dshahaf/snap-sentiment

Repository files navigation

Sentiment Analysis (SNAP)


Links

###Most Useful

###Sentiment Analysis

###Django Documentation

###Related Repositories

Commands

Activating virtualenv

source venv/bin/activate

Generating Gensim dictionaries and corpuses

python
from engine.corpus import Corpus
c = Corpus()
c.saveGensim(None)

Getting the LDA from a dictionary and corpus (example topic: ufo)

python
import logging, gensim, bz2
logging.basicConfig(format='%(asctime)s : %(levelname)s : %(message)s', level=logging.INFO)
id2word = gensim.corpora.Dictionary.load('engine/james_data/ufo/gensim_dictionary.txt')
mm = gensim.corpora.MmCorpus('engine/james_data/ufo/gensim_corpus.mm')
lda = gensim.models.ldamodel.LdaModel(corpus=mm, id2word=id2word, num_topics=50, update_every=1, chunksize=10000, passes=1)
lda.print_topics(50)

Running Django server

python manage.py runserver

Creating Django project

python manage.py startproject <project-name>

Creating Django app (run in the same directory as manage.py)

python manage.py startapp <app-name>

Collect static files

python manage.py collectstatic

Syncing DB

python manage.py syncdb

Shell

python manage.py shell

Compile Less

npm install -g less

Archive

###Django advice

  • If you plan to use a database, edit the DATABASES setting in sentiment/settings.py.
  • Start your first app by running python manage.py startapp [appname].