()
| 27 | setup(); |
| 28 | |
| 29 | function 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 | |
| 56 | function sentimentType(score) { |
| 57 | thoughts.style.display = "flex"; |
nothing calls this directly
no test coverage detected