Skip to content

Commit

Permalink
i still don't understand how these imports work
Browse files Browse the repository at this point in the history
  • Loading branch information
jlherzberg committed Nov 6, 2019
1 parent 022b29d commit 710117f
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 7 deletions.
3 changes: 2 additions & 1 deletion lib/tagnews/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@
from .utils.load_data import load_data
from .utils.load_vectorizer import load_glove
from .senteval.eval import SentimentGoogler
from .senteval.police_words import police_words_list, bins

__all__ = [utils, crimetype, CrimeTags, GeoCoder, SentimentGoogler,
get_lat_longs_from_geostrings, load_data, load_glove]
get_lat_longs_from_geostrings, load_data, load_glove, police_words_list, bins]

__version__ = '1.2.4'
4 changes: 2 additions & 2 deletions lib/tagnews/senteval/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
from . import eval
from . import eval, police_words

__all__ = [eval]
__all__ = [eval, police_words]
6 changes: 3 additions & 3 deletions lib/tagnews/senteval/eval.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from google.cloud.language import enums
from google.cloud.language import types

from tagnews.senteval import police_words, bins
from tagnews.senteval.police_words import police_words_list, bins


def process_google_result(text):
Expand All @@ -12,7 +12,7 @@ def process_google_result(text):
for entity in sentiment.entities:
clean_entity = "".join(filter(str.isalpha, entity)).lower()

if clean_entity in police_words:
if clean_entity in police_words_list:

for mention in entity.mentions:
return mention.sentiment.score
Expand All @@ -21,7 +21,7 @@ def process_google_result(text):
class SentimentGoogler:
def __init__(self):
self.client = self.connect_to_client()
self.police_words = police_words
self.police_words = police_words_list

def run(self, doc_text):
sentiment_ = self.call_api(doc_text)
Expand Down
2 changes: 1 addition & 1 deletion lib/tagnews/senteval/police_words.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
police_words = ["police", "officer", "cop", "officers", "pigs"]
police_words_list = ["police", "officer", "cop", "officers", "pigs"]

bins = [.1, .2, .3, .4, .5, .6, .7, .8, .9, 1]

0 comments on commit 710117f

Please sign in to comment.