Skip to content

Commit

Permalink
Ajusted layout issues and classification parameters.
Browse files Browse the repository at this point in the history
  • Loading branch information
maiquelcraash committed May 9, 2018
1 parent 355c771 commit 1d16124
Show file tree
Hide file tree
Showing 7 changed files with 41 additions and 11 deletions.
9 changes: 9 additions & 0 deletions KeepCalm Chrome Extension/css/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ img.logo {
margin-right: auto;
max-width: 250px;
}
p,
h3,
h4,
h5 {
Expand Down Expand Up @@ -44,6 +45,14 @@ section#keepcalm-content .info {
section#keepcalm-content .info h4 {
font-weight: 200;
}
section#keepcalm-content .info p {
font-size: 10pt;
}
section#keepcalm-content .info .feedback .center {
display: table;
margin-left: auto;
margin-right: auto;
}
section#keepcalm-content .info .feedback .feedback-btn {
color: white;
font-weight: 700;
Expand Down
14 changes: 12 additions & 2 deletions KeepCalm Chrome Extension/css/style.less
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@ body {
margin-left: 15px;
}

img.logo{
img.logo {
display: block;
margin-left: auto;
margin-right: auto;
max-width: 250px;
}

h3, h4, h5 {
p, h3, h4, h5 {
text-align: center;
}

Expand Down Expand Up @@ -56,7 +56,17 @@ section#keepcalm-content {
font-weight: 200;
}

p {
font-size: 10pt;
}

.feedback {
.center {
display: table;
margin-left: auto;
margin-right: auto;
}

.feedback-btn {
color: white;
font-weight: 700;
Expand Down
18 changes: 14 additions & 4 deletions KeepCalm Chrome Extension/js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,13 @@ document.addEventListener('DOMContentLoaded', function () {

//creates results components
const titleElement = document.createElement('div');
titleElement.innerHTML = `O texto <b> "${response.text}"</b> foi classificado como:"`;
titleElement.innerHTML = `O texto <b> "${response.text}"</b> foi classificado como:`;
const resultElement = document.createElement('h3');
resultElement.innerText = response.effectiveResult + " (" + response.percentuals[response.effectiveResult] + "%)";
resultElement.innerText = response.effectiveResult;

const percentual = document.createElement('p');
percentual.innerText = "(Percentual de agressividade: " + response.percentuals["Agressivo"] + "%)";


if (response.effectiveResult === "Agressivo") {
clearClassList(statusIcon);
Expand All @@ -34,14 +38,20 @@ document.addEventListener('DOMContentLoaded', function () {

//creates feedback buttons
let feedbackDiv = document.createElement("div");
let div = document.createElement("div");

div.classList.add("center");
div.appendChild(createFeedbackButton("AGREE", activityID));
div.appendChild(createFeedbackButton("DISAGREE", activityID));

feedbackDiv.classList.add("feedback");
feedbackDiv.appendChild(createFeedbackButton("AGREE", activityID));
feedbackDiv.appendChild(createFeedbackButton("DISAGREE", activityID));
feedbackDiv.append(div);

//puts all together
infoContainer.innerHTML = "";
infoContainer.appendChild(titleElement);
infoContainer.appendChild(resultElement);
infoContainer.appendChild(percentual);
infoContainer.appendChild(feedbackDiv);
}
else {
Expand Down
4 changes: 2 additions & 2 deletions KeepCalm Chrome Extension/manifest.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"manifest_version": 2,
"name": "KeepCalm Beta 0.10",
"name": "KeepCalm Beta 0.11",
"description": "Detecção de Agressividade",
"version": "0.10",
"version": "0.11",
"browser_action": {
"default_popup": "popup.html",
"default_title": "KeepCalm",
Expand Down
1 change: 1 addition & 0 deletions KeepCalm Chrome Extension/popup.html
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
</div>
<div class="info">
<div class="feedback">
<div></div>
</div>
</div>
</section>
Expand Down
2 changes: 1 addition & 1 deletion config/properties.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
exports.QUERY_LIMIT = 2000000;

/* Classifier Config */
exports.EFFECTIVE_PERCENTUAL = 71; // Ponto de corte entre agressivo e não agressivo
exports.EFFECTIVE_PERCENTUAL = 65; // Ponto de corte entre agressivo e não agressivo
exports.CLASSIFIER_ALGORITHM = "NB"; //"NB" (Nayve Bayes) or "LR" (Linear Regression)

if (process.env.NODE_ENV === "development") {
Expand Down
4 changes: 2 additions & 2 deletions controller/classifierController.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@
if (activity.feedback === true) {
trainClassification = classification;
}
else {
else if (activity.feedback === false) {
if (classification === "Agressivo") {
trainClassification = "Não Agressivo";
}
Expand All @@ -104,7 +104,7 @@
}

classifier.addDocument(trainText, trainClassification);
})
});

console.log("\nTraining algorithm...");
classifier.train();
Expand Down

0 comments on commit 1d16124

Please sign in to comment.