MCPcopy Create free account
hub / github.com/Vishal-raj-1/Awesome-JavaScript-Projects / getSentiment

Function getSentiment

assets/js/SentimentAnalysis.js:29–54  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

27setup();
28
29function getSentiment() {
30 // setup the html environment
31 statusEl.style.display = "inline-block";
32 warning.style.display = "none";
33 score.style.display = "none";
34 thoughts.style.display = "none";
35
36 // get the values from the input
37 const text = inputBox.value;
38 if (text === "") {
39 statusEl.style.display = "none";
40 warning.style.display = "flex";
41 return;
42 }
43
44 // make the prediction
45 const prediction = sentiment.predict(text);
46
47 statusEl.style.display = "none";
48 // display sentiment result on html page
49
50 score.style.display = "flex";
51
52 sentimentResult.innerHTML = prediction.score;
53 sentimentType(prediction.score);
54}
55
56function sentimentType(score) {
57 thoughts.style.display = "flex";

Callers

nothing calls this directly

Calls 1

sentimentTypeFunction · 0.85

Tested by

no test coverage detected