Beispiel #1
0
 def test_sentiment_1(self):
     text = "Không tin tưởng vào ngân hàng BIDV "
     actual = sentiment(text)
     expected = "TRADEMARK#NEGATIVE"
     self.assertEquals(actual[0], expected)
Beispiel #2
0
 def test_sentiment_2(self):
     text = "Bạn ra ngân hàng hỏi luôn cho nhanh giải đáp qua đây ko ăn thua lắm."
     actual = sentiment(text)
     expected = "CUSTOMER SUPPORT#NEGATIVE"
     self.assertEquals(actual[0], expected)
Beispiel #3
0

nineties_score = nineties['Lyrics'] 
nineties_score = nineties_score.to_string()
nineties_score = ''.join(nineties_score)

thousands_score = thousands['Lyrics'] 
thousands_score = thousands_score.to_string()
thousands_score = ''.join(thousands_score)

tens_score = tens['Lyrics'] 
tens_score = tens_score.to_string()
tens_score = ''.join(tens_score)
#print(file)
from model import sentiment
func = sentiment()
six_data = func.tokener(sixties_score)

seven_data = func.tokener(seventies_score)

eight_data = func.tokener(eighties_score)

nine_data = func.tokener(nineties_score)

thousand_data = func.tokener(thousands_score)

ten_data = func.tokener(tens_score)

data = {'Year': ['1960s', '1970s', '1980s', '1990s', '2000s', '2010s'],
        'Sentiment Score': [six_data, seven_data, eight_data, nine_data, thousand_data, ten_data]
        }
Beispiel #4
0
from os.path import join, dirname
import sys
from languageflow.board import Board
from languageflow.log import MultilabelLogger
from languageflow.log.tfidf import TfidfLogger
from load_data import load_dataset
from model import sentiment

data_file = join(dirname(dirname(dirname(dirname(__file__)))), "data", "fb_bank", "corpus", "test.xlsx")

X_test, y_test = load_dataset(data_file)
y_test = [tuple(item) for item in y_test]
y_pred = sentiment(X_test)

log_folder = join(dirname(__file__), "analyze")
model_folder = join(dirname(__file__), "model")

board = Board(log_folder=log_folder)

MultilabelLogger.log(X_test, y_test, y_pred, log_folder=log_folder)
TfidfLogger.log(model_folder=model_folder, log_folder=log_folder)

board.serve(port=62010)
Beispiel #5
0
 def test_sentiment(self):
     sentence = "Thật tuyệt vời"
     tags = "POSITIVE"
     actual = sentiment(sentence)
     self.assertEquals(tags, actual[0])
Beispiel #6
0
import model as s

print(s.sentiment("This movie was awesome! The acting was great, plot was wonderful"))
print(s.sentiment("This movie was utter junk. I don't see what the point was at all. Horrible movie, 0/10"))
Beispiel #7
0
 def test_sentiment_5(self):
     sentence = "Vietcombank là lũ lừa đảo"
     tags = "NEGATIVE"
     actual = sentiment(sentence)
     self.assertEquals(tags, actual[0])
Beispiel #8
0
 def test_sentiment_3(self):
     text = "Tháng này tiền banking bị thu phí 3 lần liên tục đề nghị vietcombank xem xét lại "
     actual = sentiment(text)
     expected = "INTEREST RATE#NEGATIVE"
     self.assertEquals(actual[0], expected)
Beispiel #9
0
 def test_sentiment_3(self):
     sentence = "Dịch vụ rắc rối."
     tags = "NEGATIVE"
     actual = sentiment(sentence)
     self.assertEquals(tags, actual[0])
Beispiel #10
0
 def test_sentiment_4(self):
     sentence = "Thật sự mình rất hài lòng khi làm việc với VietcomBank"
     actual = sentiment(sentence)
     expected = "POSITIVE"
     self.assertEquals(expected, actual[0])
Beispiel #11
0
 def test_sentiment_2(self):
     sentence = "Không tin tưởng vào ngân hàng BIDV."
     tags = "NEGATIVE"
     actual = sentiment(sentence)
     self.assertEquals(tags, actual[0])
Beispiel #12
0
 def test_sentiment_1(self):
     sentence = "Nhân viên BIDV dễ thương nhiệt tình lắm ạ"
     tags = "POSITIVE"
     actual = sentiment(sentence)
     self.assertEquals(tags, actual[0])
Beispiel #13
0
config.word_num = len(SENTENCE.vocab)

print("Labels:", LABEL.vocab.itos)
print("Vocabulary Size: {}".format(config.words_num))

if args.resume_snapshot:
    if args.cuda:
        model = torch.load(
            args.resume_snapshot,
            map_location=lambda storage, location: storage.cuda(args.gpu))
    else:
        model = torch.load(args.resume_snapshot,
                           map_location=lambda storage, location: storage)
else:
    if args.data == 'SST1':
        model = sentiment(config)
    if args.cuda:
        model.cuda()
        print("Shift model to GPU")

parameter = filter(lambda p: p.requires_grad, model.parameters())

optimizer = torch.optim.Adadelta(parameter,
                                 lr=args.lr,
                                 weight_decay=args.weight_decay)
criterion = nn.MarginRankingLoss()

early_stop = False
best_dev_acc = 0
iteration = 0
iters_not_improved = 0
Beispiel #14
0
 def test_sentiment_3(self):
     text = "VCB Mobile B@bking. Chuyển rất nhanh. Giao diện đẹp, thân thiện. Dễ thao tác"
     actual = sentiment(text)
     expected = "INTERNET BANKING#POSITIVE"
     self.assertEquals(actual[0], expected)
Beispiel #15
0
 def test_sentiment_7(self):
     sentence = "éo tin"
     tags = "NEGATIVE"
     actual = sentiment(sentence)
     self.assertEquals(tags, actual[0])
Beispiel #16
0
 def test_sentiment(self):
     text = "Gọi mấy lần mà lúc nào cũng là các chuyên viên đang bận hết ạ "
     actual = sentiment(text)
     expected = "CUSTOMER SUPPORT#NEGATIVE"
     self.assertEquals(actual[0], expected)
Beispiel #17
0
 def test_sentiment_1(self):
     text = "Chúc mừng VCB, luôn thành công và tạo niềm tin cho khách hàng an tâm khi đồng hành cùng VCB."
     actual = sentiment(text)
     expected = "TRADEMARK#POSITIVE"
     self.assertEquals(actual[0], expected)