Skip to content

Backend of a mobile chat application with emoji reactions and NLP-generated emoji suggestions.

License

Notifications You must be signed in to change notification settings

emote-chat/server

Repository files navigation

Emote

A mobile chat application with emoji reactions and NLP-generated emoji suggestions.

CircleCI

header

Database Setup for UNIX-based Systems

  1. Install PostgreSQL major version 11. We recommend using homebrew.
  2. Switch to the postgres UNIX account: sudo -i -u postgres
  3. Create a username and password (replace username with desired username): createuser username --pwprompt
  4. Enter password to be used for the user you just created
  5. To create a database (replace database with desired database name): createdb database
  6. To exit the postgres UNIX account: exit
  7. Create a file named .env at the root of the project with the variables in .env.example and replace with the host, user, user password and database information for the databases you'll be using for development and testing respectively. DEV_DB_HOST and TEST_DB_HOST default to localhost so you don't have to include those variables if you plan to use localhost. It is suggested that you specify separate tables for DEV_DB_NAME and TEST_DB_NAME since the test suites will wipe the test database clean before running each test suite. Please note that production database information is only accessible to the project owners.

Setup

Installation

npm install

Run Server

OS X, Linux and Windows:

npm start

Run Tests

npm test

NLP

Installation

  1. Don't forget to define TWITTER_USER, TWITTER_PASS, TWITTER_KEY and TWITTER_SECRET in your .env file. Refer to the .env.example to be sure you define the necessary environment variables.
  2. If planning to get more data using a twitter stream, download this ChromeDriver zip file, unzip it and copy the executable into the nlp directory.
  3. Create the virtual env after updating the dependencies to the latest compatible versions (NOTE: we have separate _env.yml files for MacOS and Linux OS - the latter of which works with Ubuntu):
# update dependencies specified in the yml to latest compatible versions
conda env update -f nlp/REPLACE_WITH_YOUR_OS_ENV.yml --prune
# create conda virtual environment named emote from yml
conda env create -f nlp/REPLACE_WITH_YOUR_OS_ENV.yml
  1. Activate the Anaconda virtual env:
conda activate emote

Get More Data

  • To use twitter stream (live tweets; note that you must have Twitter login verification (2-factor authentication) temporarily turned off as the script uses your username and password to authenticate you along with your app key and secret to acquire the proper oauth v1.0 credentials — v2.0 is not available for streams):
python nlp/twitter.py
  • To use twitter search and get 100 tweets at a time:
python nlp/twitter.py -se

Read Tweets Pickle

python nlp/read.py

Train Model Using Tweets Data

python nlp/train.py

Test Model

python nlp/test_predictions.py 'message to test'

Current model pred_proba order: 😂, 😍, 😞, 😮

Start Flask App for Emoji Prediction Endpoint

export FLASK_APP=nlp/app.py
python -m flask run

Contributing

  1. Fork the repository
  2. Create your feature branch on the forked repo (git checkout -b feature/fooBar)
  3. Commit your changes to the forked repo (git commit -am 'Added fooBar that does x, y, z')
  4. Push the branch back to your forked repo (git push origin feature/fooBar)
  5. Create a pull request from your fork

Contributors

License

Distributed under the Apache v2.0 license. See the LICENSE for more information.

Resources

  • README template used is located here

About

Backend of a mobile chat application with emoji reactions and NLP-generated emoji suggestions.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published