Skip to content

Commit

Permalink
¯\_(ツ)_/¯
Browse files Browse the repository at this point in the history
Decisions need to be made on the database and how the server will be hosted befor a database can be created. Preferably a linux computer, because it is better for MySQL. Additionally, we could find an online database, but it will probably cost money, so I would not recommend.
  • Loading branch information
Chyan214 committed Oct 28, 2019
1 parent dea5c80 commit afad055
Show file tree
Hide file tree
Showing 3 changed files with 59 additions and 4 deletions.
13 changes: 11 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,24 @@ CS506 Project
## Installation
Installations and downloads required before running the application
### Downloads
* (optional test data) Reddit World News Database: https://www.kaggle.com/rootuser/worldnews-on-reddit
* (optional test data) Reddit World News Database: https://www.kaggle.com/rootuser/worldnews-on-reddit
* MySQL documentation: https://dev.mysql.com/doc/mysql-getting-started/en/
* Recommended Database/Downloads:
* free remote mysql(100MB cap): https://remotemysql.com/
* Community Server: https://dev.mysql.com/downloads/mysql/
* Visual Studio database: https://dev.mysql.com/downloads/windows/visualstudio/
* MySQL WorkBench: https://dev.mysql.com/downloads/workbench/
* General mySQL installer: https://dev.mysql.com/downloads/installer/

<small> Currently looking at Google News vector space </small>

### Library installs
### Installs
* `pip install beautifulsoup4`
* `pip install spacy`
* `python -m spacy download en_core_web_sm`
* `pip install --upgrade gensim`
* `pip install Flask`
* `pip install Flask-MySQLdb`

<small>Note: 'en_core_web_sm' installation is subject to change for higher accuracy</small>

Expand Down
46 changes: 46 additions & 0 deletions extension/backend/server/app.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
from flask import Flask
from flask_mysqldb import MySQL

# requires a hosting site for database

app = Flask(__name__)

# configure database
# probably should use extern variables for this infomation
# documentation https://flask-mysqldb.readthedocs.io/en/latest/
app.config['MYSQL_HOST'] = ''
app.config['MYSQL_USER'] = ''
app.config['MYSQL_PASSWORD'] = ''
app.config['MYSQL_DB'] = ''

# instanization of mysql object
mysql = MySQL(app)

@app.route('/')
# sample section where infomation if placed into database
def home():
# create cursor object
# allows us to execute querries
cursor = mysql.connection.cursor()
# insert info into the user model
cursor.execute("INSERT INTO user(name,email) VALUES(%s,%s)", (name,email))
# saves the changes
mysql.conntection.commit()
cursor.close()
return 'Flask'

@app.route('/users')
# sample code how infomation is retrieved from database
def users():
cursor = mysql.connection.cursor()
# returns the number of rows in user model in database
resultValue = cur.execute("SELECT * FROM users")
if resultValue > 0: # e.g. there is something inside of the database
# returns all of rows which has been fetched by the cursor
userDetails = cursor.fetchall()
for user in userDetails:
print(user[0]) # username
print(user[0]) # user email

if __name__ == "__main__":
app.run()
4 changes: 2 additions & 2 deletions extension/backend/tokenizer_files/Documentation.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class Paragraph:

Methods:

preprocessing(<type=spacy.Doc object> text):
preprocessing(text):
Lemmatize non-stop words, removes punctuation, lowercase all non proper nouns

Parameters
Expand Down Expand Up @@ -49,7 +49,7 @@ Methods:
each sentence[x] is a sentence in the given text


predict(claim, <type=List(str)> text):
predict(claim, text):
Predicts which paragraph/setences is most similar to the given claim using
the loaded vector space

Expand Down

0 comments on commit afad055

Please sign in to comment.