Comparing version 1.0.6 to 1.0.7
@@ -1,23 +0,36 @@ | ||
// Populating div with only meaningful words | ||
const populateStopwordsRemoved = function(result) { | ||
console.log('Boom') | ||
console.log(result) | ||
const node = document.createElement('span') | ||
node.innerHTML = result | ||
emptyElement('stopwordsRemoved') | ||
document.getElementById('stopwordsRemoved').appendChild(node) | ||
} | ||
const languageSelect = document.getElementById('languages') | ||
const sentenceInput = document.getElementById('text') | ||
const resultText = document.getElementById('stopwordsRemoved') | ||
// Listen to key up and initiate a stopword removal | ||
document.getElementById("text").onkeyup = function() { | ||
const oldString = document.getElementById("text").value.split(' ') | ||
const newString = sw.removeStopwords(oldString) | ||
console.log('oldString: ' + oldString) | ||
console.log('newString: ' + newString) | ||
populateStopwordsRemoved(newString.join(' ')) | ||
function updateSentence() { | ||
const language = languageSelect.value | ||
const oldString = sentenceInput.value.split(' ') | ||
const newString = sw.removeStopwords(oldString, sw[language]).join(' ') | ||
console.group('Stopwords applied') | ||
console.log('oldString:', oldString.join(' ')) | ||
console.log('newString:', newString) | ||
console.groupEnd() | ||
// Populate with only meaningful words | ||
resultText.textContent = newString | ||
} | ||
// Empty HTML element | ||
const emptyElement = function (element) { | ||
document.getElementById(element).innerHTML = '' | ||
} | ||
// Listen to events and initiate a stopword removal | ||
sentenceInput.addEventListener('keyup', updateSentence) | ||
// Configure the language select | ||
const allLanguages = Object.entries(sw) | ||
.filter(([key, val]) => Array.isArray(val)) | ||
.map((val) => val[0]) | ||
languageSelect.addEventListener('change', function (event) { | ||
languageSelect.value = event.target.value | ||
sentenceInput.focus() | ||
updateSentence() | ||
}) | ||
languageSelect.innerHTML = allLanguages | ||
.map((lang) => `<option value=${lang}>${lang}</option>`) | ||
.join('') | ||
languageSelect.value = 'en' |
{ | ||
"name": "stopword", | ||
"version": "1.0.6", | ||
"version": "1.0.7", | ||
"description": "A module for node.js and the browser that takes in text and returns text that is stripped of stopwords. Has pre-defined stopword lists for 54 languages and also takes lists with custom stopwords as input.", | ||
@@ -26,11 +26,11 @@ "main": "lib/stopword.js", | ||
"devDependencies": { | ||
"buffer": "6.0.3", | ||
"path-browserify": "1.0.1", | ||
"process": "0.11.10", | ||
"standard": "^16.0.0", | ||
"webpack": "^5.11.0", | ||
"webpack-cli": "^4.2.0", | ||
"stream-browserify": "3.0.0", | ||
"tape": "^5.0.1", | ||
"tape-run": "^8.0.0", | ||
"path-browserify": "1.0.1", | ||
"stream-browserify": "3.0.0", | ||
"process": "0.11.10", | ||
"buffer": "6.0.3" | ||
"webpack": "^5.11.0", | ||
"webpack-cli": "^4.2.0" | ||
}, | ||
@@ -37,0 +37,0 @@ "author": "Fergus McDowall", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
791011
3468