Skip to content

Commit

Permalink
Merge pull request #179 from Cyberjusticelab/65/remove-util-pythonpat…
Browse files Browse the repository at this point in the history
…h-function

 [#65] Fixes all lints, and removes unused util functions
  • Loading branch information
lancelafontaine committed Nov 14, 2017
2 parents 7e713da + 5689ebb commit d93520a
Show file tree
Hide file tree
Showing 11 changed files with 7 additions and 38 deletions.
3 changes: 0 additions & 3 deletions src/backend_service/app.py
Expand Up @@ -3,9 +3,6 @@
from flask import Flask, request, abort, make_response, jsonify
from flask_cors import CORS

import util
util.load_src_dir_to_sys_path()

from controllers import conversationController, legalController
from postgresql_db import database

Expand Down
3 changes: 0 additions & 3 deletions src/backend_service/app_test.py
Expand Up @@ -4,9 +4,6 @@

from werkzeug.datastructures import FileStorage

import util

util.load_src_dir_to_sys_path()
from services import fileService
from services.staticStrings import StaticStrings

Expand Down
4 changes: 0 additions & 4 deletions src/backend_service/controllers/conversationController.py
@@ -1,10 +1,6 @@
import json

from flask import jsonify, abort, make_response

import util

util.load_src_dir_to_sys_path()
from postgresql_db.models import *
from services import nlpService, fileService
from services.staticStrings import *
Expand Down
8 changes: 0 additions & 8 deletions src/backend_service/util.py

This file was deleted.

2 changes: 1 addition & 1 deletion src/ml_service/feature_extraction/main.py
Expand Up @@ -8,7 +8,7 @@
from outputs.output import Log

'''
Improvement:
Improvement:
1 - Commands can be imporoved for this class. Now a little basic
2 - Perhaps clear previous output directories of the models etc.
'''
Expand Down
2 changes: 1 addition & 1 deletion src/ml_service/outputs/output.py
Expand Up @@ -66,7 +66,7 @@ def save_text_file(self, filename, text, protocol='a'):
__rel_path = filename
file_path = os.path.join(self.__output_dir, __rel_path)
file = open(file_path, protocol)
if not type(text) == list:
if not isinstance(text, list):
text = [text]
for lines in text:
file.writelines(lines)
Expand Down
4 changes: 2 additions & 2 deletions src/ml_service/word_vectors/related_word_fetcher.py
Expand Up @@ -7,7 +7,7 @@
from outputs.output import Log

"""
This python module is used to fill in missing keys from the
This python module is used to fill in missing keys from the
word vector model. This script attempts to find the closest
similar word to the one given. The end goal will enable every
word to be vectorized.
Expand All @@ -18,7 +18,7 @@

"""
Cache is a dictionary which stores keys<words not found>
and maps them to values<words found>
and maps them to values<words found>
"""

cache = {}
Expand Down
4 changes: 1 addition & 3 deletions src/nlp_service/app.py
Expand Up @@ -3,10 +3,8 @@
from flask import Flask
from flask import request

import util
from controllers import nlpController

util.load_src_dir_to_sys_path()
from postgresql_db import database

# Flask Setup
Expand All @@ -18,7 +16,7 @@
"""
These functions establishes HTTP routes for the core functionality of the src/nlp_service/controllers/nlpController.py
The core functionality of classify_claim_category and classify_fact_value are explained further in the file mentioned above
"""


Expand Down
3 changes: 0 additions & 3 deletions src/nlp_service/controllers/nlpController.py
@@ -1,8 +1,5 @@
from flask import jsonify, abort, make_response

import util

util.load_src_dir_to_sys_path()
from postgresql_db.models import *
from rasa.rasa_classifier import RasaClassifier
from services import mlService
Expand Down
4 changes: 2 additions & 2 deletions src/nlp_service/rasa/rasa_classifier.py
Expand Up @@ -26,7 +26,7 @@ def __init__(self):
"""
Training method that trains the data sets from facts and problem categories separately
force_train=False will ensure the saved models are used
initialize_interpreters=True so the interpreters get initialized due to the models already being present
initialize_interpreters=True so the interpreters get initialized due to the models already being present
result: creates models on trained data
"""

Expand Down Expand Up @@ -63,7 +63,7 @@ def classify_fact(self, fact_name, message):
Training the interpreters one by one
training_data_dir: Directory where data is held on our project
interpreter_dict: dictionary of interpreters that will hold the interpreters
force_train: set ti either true or false so it knows if it should train new models (if empty dir) or use the old ones already present
force_train: set ti either true or false so it knows if it should train new models (if empty dir) or use the old ones already present
initialized_interpreters: won't attempt to initialize interpreters if there are no models
:returns dict of the fact with intent and entities
"""
Expand Down
8 changes: 0 additions & 8 deletions src/nlp_service/util.py

This file was deleted.

0 comments on commit d93520a

Please sign in to comment.