Commit 56fb62b9 authored by Joel Oksanen's avatar Joel Oksanen
Browse files

Major refactors in order to make server the main source folder

parent 57b5fe71
......@@ -42,14 +42,14 @@ class SentimentAnalyzer:
return self.expr_clf.predict([instance.vector for instance in instances])
semeval_2014_train_path = 'data/SemEval-2014/SemEval_2014_Laptop_Train_with_labelled_parse_trees.xml'
semeval_2014_test_path = 'data/SemEval-2014/SemEval_2014_Laptop_Test_with_labelled_parse_trees.xml'
semeval_2014_train_path = 'server/agent/SA/data/SemEval-2014/SemEval_2014_Laptop_Train_with_labelled_parse_trees.xml'
semeval_2014_test_path = 'server/agent/SA/data/SemEval-2014/SemEval_2014_Laptop_Test_with_labelled_parse_trees.xml'
amazon_train_path = 'data/Amazon/amazon_camera_train.xml'
amazon_test_path = 'data/Amazon/amazon_camera_test2.xml' # 'data/Amazon/prepared_amazon_camera_reviews.xml'
semeval_train_path = 'data/SemEval-2016/ABSA16_Laptops_Train_SB1_v2_with_labelled_parse_trees.xml'
semeval_test_path = 'data/SemEval-2016/ABSA16_Laptops_Test_with_labelled_parse_trees.xml' #
tweet_train_path = 'data/acl-14-short-data/tweet_train_with_labelled_parse_trees.xml'
tweet_test_path = 'data/acl-14-short-data/tweet_test_with_labelled_parse_trees.xml'
semeval_train_path = 'server/agent/SA/data/SemEval-2016/ABSA16_Laptops_Train_SB1_v2_with_labelled_parse_trees.xml'
semeval_test_path = 'server/agent/SA/data/SemEval-2016/ABSA16_Laptops_Test_with_labelled_parse_trees.xml' #
tweet_train_path = 'server/agent/SA/data/acl-14-short-data/tweet_train_with_labelled_parse_trees.xml'
tweet_test_path = 'server/agent/SA/data/acl-14-short-data/tweet_test_with_labelled_parse_trees.xml'
train_path = semeval_2014_train_path
test_path = semeval_2014_test_path
......
......@@ -7,7 +7,7 @@ from nltk.stem import PorterStemmer
class Vectorizer:
sentiment_lexicon = pd.read_csv('data/SocialSent/2000.tsv', index_col=0, header=None, names=['mean', 'std'], sep='\t', error_bad_lines=False)
sentiment_lexicon = pd.read_csv('server/agent/SA/data/SocialSent/2000.tsv', index_col=0, header=None, names=['mean', 'std'], sep='\t', error_bad_lines=False)
negations = ['not', 'no', 'never', 'n\'t', 'neither', 'seldom', 'hardly']
copulas = ['is', '\'s', 'was', 'were']
adjetives_and_nouns = ['JJ', 'JJR', 'JJS', 'ADJP', 'NN', 'NNS', 'NP']
......
from nltk.tokenize import sent_tokenize
import re
from review_tokenizer import ReviewTokenizer
from agent.review_tokenizer import ReviewTokenizer
from anytree import PostOrderIter
import pickle
from argument import *
from agent.argument import *
from functools import reduce
from SA.bert_analyzer import BertAnalyzer
from agent.SA.bert_analyzer import BertAnalyzer
class Agent:
sentiment_threshold = 0.95
......@@ -14,7 +14,7 @@ class Agent:
def __init__(self):
# load classifier
f = open('camera_review_classifier.pickle', 'rb')
f = open('agent/camera_review_classifier.pickle', 'rb')
self.classifier = pickle.load(f)
f.close()
......
import nltk
from nltk.tokenize import sent_tokenize
import pandas as pd
import re
from nltk.sentiment.vader import SentimentIntensityAnalyzer
from anytree import Node, PostOrderIter
from anytree import PostOrderIter
from functools import reduce
from matplotlib import pyplot
from scipy.stats import pearsonr
from sklearn.metrics import mean_absolute_error
import pickle
from review_tokenizer import tokenize_review, reduce_noise
from argument import *
from server.agent.review_tokenizer import tokenize_review, reduce_noise
from server.agent.argument import *
reviewables = [camera, image, video, battery, flash, audio, price, shipping, lens, zoom, af]
features = [image, video, battery, flash, audio, price, shipping, lens, zoom, af]
......@@ -165,7 +164,7 @@ def get_strengths(qbaf):
#############
all_reviews = pd.read_csv('camera_prepared_data.tsv', sep='\t', error_bad_lines=False)
all_reviews = pd.read_csv('amazon_data/camera_prepared_data.tsv', sep='\t', error_bad_lines=False)
camera_strengths = []
star_rating_averages = []
......
from argumentquery import ArgumentQuery
from dataloader import DataLoader
from argument import *
from agent import Agent
from agent.argumentquery import ArgumentQuery
from agent.argument import *
from agent.agent import Agent
import inflect
from nltk.stem.snowball import SnowballStemmer
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment