daq-proc
Advanced tools
Comparing version 4.0.1 to 5.0.0
// exposing the underlying libraries in a transparent way | ||
const {wnn, sw, ngraminator, ehp} = dqp | ||
const { wnn, sw, ngraminator, ehp } = dqp | ||
// Listen to key up on headlinetext and initiate a daq-proc | ||
document.getElementById("languageSelected").onchange = function() { | ||
document.getElementById('languageSelected').onchange = function () { | ||
daqProc() | ||
@@ -10,3 +10,3 @@ } | ||
// Listen to key up on headlinetext and initiate a daq-proc | ||
document.getElementById("headlinetext").onkeyup = function() { | ||
document.getElementById('headlinetext').onkeyup = function () { | ||
daqProc() | ||
@@ -16,3 +16,3 @@ } | ||
// Listen to key up on bodytext and initiate daq-proc | ||
document.getElementById("bodytext").onkeyup = function() { | ||
document.getElementById('bodytext').onkeyup = function () { | ||
daqProc() | ||
@@ -24,6 +24,8 @@ } | ||
// Extract array of words and populate | ||
let headlineString = document.getElementById("headlinetext").value | ||
let headlineString = document.getElementById('headlinetext').value | ||
let bodyString = document.getElementById("bodytext").value | ||
let headlineArray = wnn.extract(headlineString, {regex:wnn.wordsAndNumbers, toLowercase: true}) | ||
let bodyArray = wnn.extract(bodyString, {regex:wnn.wordsAndNumbers, toLowercase: true}) | ||
let emojiString = headlineString.concat(' ', bodyString) | ||
let headlineArray = wnn.extract(headlineString, { regex: wnn.wordsNumbersEmojis, toLowercase: true }) | ||
let bodyArray = wnn.extract(bodyString, { regex: wnn.wordsNumbersEmojis, toLowercase: true }) | ||
let emojiArray = wnn.extract(emojiString, { regex: wnn.emojis }) | ||
populate(JSON.stringify(headlineArray, 2, ' '), 'headlineArrDiv') | ||
@@ -48,2 +50,6 @@ populate(JSON.stringify(bodyArray, 2, ' '), 'bodyArrDiv') | ||
// Emoji population | ||
emojiArray = [...new Set(emojiArray)] | ||
populate(JSON.stringify(emojiArray, 2, ' '), 'emojisFoundDiv') | ||
// Calculating keywords | ||
@@ -55,3 +61,3 @@ let keywords = ehp.findKeywords(headlineStopped, bodyStopped, 5) | ||
// Populating HTML elements with results | ||
const populate = function(result, elementToPopulate) { | ||
const populate = function (result, elementToPopulate) { | ||
const node = document.createElement('pre') | ||
@@ -66,2 +72,2 @@ node.innerHTML = result | ||
document.getElementById(elementToEmpty).innerHTML = '' | ||
} | ||
} |
{ | ||
"name": "daq-proc", | ||
"version": "4.0.1", | ||
"version": "5.0.0", | ||
"description": "Simple document processor to make search running in the browser and node.js a little better. Supports 50+ languages. Removes stopwords (smaller index and less irrelevant hits), extract keywords to filter on and prepares ngrams for auto-complete functionality.", | ||
@@ -23,3 +23,3 @@ "main": "index.js", | ||
"dependencies": { | ||
"words-n-numbers": "^2.0.3", | ||
"words-n-numbers": "^3.0.0", | ||
"stopword": "^1.0.1", | ||
@@ -31,3 +31,3 @@ "eklem-headline-parser": "^2.0.5", | ||
"leven-match": "1.0.0", | ||
"snyk": "^1.327.0" | ||
"snyk": "^1.330.2" | ||
}, | ||
@@ -34,0 +34,0 @@ "devDependencies": { |
@@ -14,3 +14,3 @@ # daq-proc | ||
* [document processor](https://eklem.github.io/daq-proc/demo/document-processing/). It showcases the document processor end. Just add some words and figure it out. | ||
* [query processor](https://eklem.github.io/daq-proc/demo/query-processing/) (lacking `leven-match` showcase, just hit-highlighter for now). | ||
* [query processor](https://eklem.github.io/daq-proc/demo/query-processing/). Showcases hit highlighting and truncating text if needed. Possible to turn fuzzy matching on/off. | ||
@@ -17,0 +17,0 @@ [![Screenshot of the daq-proc broser demo](./demo/document-processing/daq-proc-demo-screenshot.png)](https://eklem.github.io/daq-proc/demo/) |
@@ -17,7 +17,7 @@ const test = require('tape') | ||
// Extract array of words from title / headline | ||
const headlineArray = wnn.extract(headlineString, { regex: wnn.wordsAndNumbers, toLowercase: true }) | ||
const headlineArray = wnn.extract(headlineString, { regex: wnn.wordsNumbers, toLowercase: true }) | ||
t.deepEqual(headlineArray, ['saudi', 'arabia', 'vows', 'to', 'respond', 'to', 'oil', 'attacks', 'with', 'necessary', 'measures']) | ||
// Extract array of words from bodytext / story | ||
const bodyArray = wnn.extract(bodyString, { regex: wnn.wordsAndNumbers, toLowercase: true }) | ||
const bodyArray = wnn.extract(bodyString, { regex: wnn.wordsNumbers, toLowercase: true }) | ||
t.deepEqual(bodyArray, ['saudi', 'arabia', 'says', 'it', 'will', 'respond', 'with', 'necessary', 'measures', 'to', 'attacks', 'on', 'two', 'oil', 'facilities', 'as', 'it', 'reiterated', 'the', 'accusation', 'that', 'iran', 'was', 'behind', 'them', 'minister', 'of', 'state', 'for', 'foreign', 'affairs', 'adel', 'al', 'jubeir', 'said', 'the', 'weapons', 'used', 'were', 'iranian', 'and', 'vowed', 'to', 'release', 'the', 'full', 'findings', 'of', 'the', 'investigation', 'iran', 'denies', 'involvement', 'in', 'the', 'attacks', 'earlier', 'a', 'senior', 'iranian', 'military', 'official', 'said', 'iran', 'was', 'ready', 'to', 'destroy', 'any', 'aggressor', 'after', 'the', 'us', 'announced', 'it', 'was', 'sending', 'troops', 'to', 'saudi', 'arabia', 'iranian', 'backed', 'houthi', 'rebels', 'in', 'yemen', 'have', 'said', 'they', 'were', 'responsible', 'for', 'the', 'drone', 'and', 'missile', 'strikes', 'on', '14', 'september', 'that', 'affected', 'the', 'global', 'oil', 'supply', 'tensions', 'between', 'the', 'us', 'and', 'iran', 'have', 'escalated', 'since', 'us', 'president', 'donald', 'trump', 'abandoned', 'a', 'deal', 'limiting', 'iran', 's', 'nuclear', 'activities', 'last', 'year', 'and', 'reinstated', 'sanctions', 'speaking', 'to', 'reporters', 'in', 'riyadh', 'mr', 'jubeir', 'said', 'saudi', 'arabia', 'was', 'in', 'consultation', 'with', 'its', 'allies', 'and', 'would', 'take', 'necessary', 'and', 'suitable', 'measures', 'after', 'its', 'investigation', 'was', 'complete', 'without', 'giving', 'details', 'of', 'possible', 'actions', 'he', 'repeated', 'that', 'the', 'strikes', 'targeting', 'the', 'abqaiq', 'oil', 'facility', 'and', 'the', 'khurais', 'oil', 'field', 'had', 'come', 'from', 'the', 'north', 'and', 'not', 'from', 'yemen', 'but', 'did', 'not', 'give', 'a', 'specific', 'location', 'and', 'urged', 'the', 'international', 'community', 'to', 'take', 'a', 'stand', 'the', 'kingdom', 'calls', 'upon', 'the', 'international', 'community', 'to', 'assume', 'its', 'responsibility', 'in', 'condemning', 'those', 'that', 'stand', 'behind', 'this', 'act', 'and', 'to', 'take', 'a', 'firm', 'and', 'clear', 'position', 'against', 'this', 'reckless', 'behaviour', 'that', 'threatens', 'the', 'global', 'economy', 'he', 'said', 'the', 'saudi', 'defence', 'ministry', 'showed', 'off', 'on', 'wednesday', 'what', 'it', 'said', 'were', 'the', 'remains', 'of', 'drones', 'and', 'cruise', 'missiles', 'proving', 'iranian', 'involvement', 'the', 'us', 'has', 'also', 'accused', 'iran', 'of', 'being', 'behind', 'the', 'attacks', 'and', 'unnamed', 'senior', 'officials', 'have', 'told', 'us', 'media', 'that', 'the', 'evidence', 'suggests', 'the', 'strikes', 'originated', 'in', 'the', 'south', 'of', 'iran', 'on', 'friday', 'secretary', 'of', 'defence', 'mark', 'esper', 'said', 'the', 'us', 'would', 'send', 'a', 'yet', 'to', 'be', 'decided', 'number', 'of', 'troops', 'to', 'saudi', 'arabia', 'to', 'boost', 'the', 'country', 's', 'air', 'and', 'missile', 'defences', 'president', 'trump', 'then', 'announced', 'new', 'sanctions', 'against', 'iran', 'focusing', 'on', 'the', 'country', 's', 'central', 'bank', 'and', 'its', 'sovereign', 'wealth', 'fund', 'while', 'signalling', 'that', 'he', 'wanted', 'to', 'avoid', 'military', 'conflict', 'the', 'news', 'conference', 'in', 'the', 'glittering', 'halls', 'of', 'saudi', 'arabia', 's', 'foreign', 'ministry', 'was', 'fairly', 'predictable', 'in', 'its', 'customary', 'condemnation', 'of', 'iran', 'the', 'islamic', 'republic', 'said', 'the', 'eloquent', 'and', 'softly', 'spoken', 'minister', 'of', 'state', 'for', 'foreign', 'affairs', 'was', 'to', 'blame', 'for', 'all', 'the', 'mischief', 'making', 'in', 'the', 'region', 'including', 'more', 'than', '260', 'ballistic']) | ||
@@ -24,0 +24,0 @@ |
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
3736351
24
3267
+ Addedwords-n-numbers@3.0.2(transitive)
- Removedwords-n-numbers@2.0.3(transitive)
Updatedsnyk@^1.330.2
Updatedwords-n-numbers@^3.0.0