Comparing version 1.0.0 to 1.0.1
@@ -0,1 +1,4 @@ | ||
// exposing the underlying library in a transparent way | ||
const {wnn, sw, ngraminator, ehp} = dqp | ||
// Listen to key up on headlinetext and initiate a daq-proc | ||
@@ -16,4 +19,4 @@ document.getElementById("headlinetext").onkeyup = function() { | ||
let bodyString = document.getElementById("bodytext").value | ||
let headlineArray = dqp.wnn.extract(headlineString, dqp.wnn.en, {toLowercase: true}) | ||
let bodyArray = dqp.wnn.extract(bodyString, dqp.wnn.en, {toLowercase: true}) | ||
let headlineArray = wnn.extract(headlineString, wnn.en, {toLowercase: true}) | ||
let bodyArray = wnn.extract(bodyString, wnn.en, {toLowercase: true}) | ||
populate(JSON.stringify(headlineArray, 2, ' '), 'headlineArrDiv') | ||
@@ -23,4 +26,4 @@ populate(JSON.stringify(bodyArray, 2, ' '), 'bodyArrDiv') | ||
// Removing stopwords | ||
let headlineStopped = dqp.sw.removeStopwords(headlineArray) | ||
let bodyStopped = dqp.sw.removeStopwords(bodyArray) | ||
let headlineStopped = sw.removeStopwords(headlineArray) | ||
let bodyStopped = sw.removeStopwords(bodyArray) | ||
populate(JSON.stringify(headlineStopped, 2, ' '), 'headlineStoppedDiv') | ||
@@ -30,4 +33,4 @@ populate(JSON.stringify(bodyStopped, 2, ' '), 'bodyStoppedDiv') | ||
// Ngramming | ||
let headlineNgrams = dqp.ngraminator(headlineStopped, [2,3,4]) | ||
let bodyNgrams = dqp.ngraminator(bodyStopped, [2,3,4]) | ||
let headlineNgrams = ngraminator(headlineStopped, [2,3,4]) | ||
let bodyNgrams = ngraminator(bodyStopped, [2,3,4]) | ||
populate(JSON.stringify(headlineNgrams, 2, ' '), 'headlineNgramifiedDiv') | ||
@@ -37,3 +40,3 @@ populate(JSON.stringify(bodyNgrams, 2, ' '), 'bodyNgramifiedDiv') | ||
// Calculating keywords | ||
let keywords = dqp.ehp.findKeywords(headlineStopped, bodyStopped, 5) | ||
let keywords = ehp.findKeywords(headlineStopped, bodyStopped, 5) | ||
populate(JSON.stringify(keywords, 2, ' '), 'keywordsFoundDiv') | ||
@@ -40,0 +43,0 @@ } |
{ | ||
"name": "daq-proc", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"description": "Simple document processor for [nowsearch.xyz](https://github.com/eklem/nowsearch.xyz) to makes search running in the browser and node.js a little better. Removes stopwords (smaller index and less irrelevant hits), extract keywords to filter on and prepares ngrams for auto-complete functionality.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -32,7 +32,12 @@ # daq-proc | ||
<script> | ||
// exposing the underlying library in a transparent way | ||
const {wnn, sw, ngraminator, ehp} = dqp | ||
// input | ||
const headlineString = 'Document and query processing for the browser!' | ||
const bodyString = 'Yay! The day is here =) We now have document and query processing for the browser. It is mostly packaging 4 modules together in a browser distribution file. The modules are words-n-numbers, stopword, ngraminator and eklem-headline-parser' | ||
let headlineArray = dqp.wnn.extract(headlineString, undefined, {toLowercase: true}) | ||
let bodyArray = dqp.wnn.extract(bodyString, undefined, {toLowercase: true}) | ||
// extracting word arrays | ||
let headlineArray = wnn.extract(headlineString, undefined, {toLowercase: true}) | ||
let bodyArray = wnn.extract(bodyString, undefined, {toLowercase: true}) | ||
console.log('Word arrays: ') | ||
@@ -42,4 +47,5 @@ console.dir(headlineArray) | ||
let headlineStopped = dqp.sw.removeStopwords(headlineArray) | ||
let bodyStopped = dqp.sw.removeStopwords(bodyArray) | ||
// removing stopwords | ||
let headlineStopped = sw.removeStopwords(headlineArray) | ||
let bodyStopped = sw.removeStopwords(bodyArray) | ||
console.log('Stopword removed arrays: ') | ||
@@ -49,4 +55,5 @@ console.dir(headlineStopped) | ||
let headlineNgrams = dqp.ngraminator(headlineStopped, [2,3,4]) | ||
let bodyNgrams = dqp.ngraminator(bodyStopped, [2,3,4]) | ||
// n-grams | ||
let headlineNgrams = ngraminator(headlineStopped, [2,3,4]) | ||
let bodyNgrams = ngraminator(bodyStopped, [2,3,4]) | ||
console.log('Ngram arrays: ') | ||
@@ -56,3 +63,4 @@ console.dir(headlineNgrams) | ||
let keywords = dqp.ehp.findKeywords(headlineStopped, bodyStopped, 5) | ||
// calculating important keywords | ||
let keywords = ehp.findKeywords(headlineStopped, bodyStopped, 5) | ||
console.log('Keyword array: ') | ||
@@ -64,3 +72,3 @@ console.dir(keywords) | ||
### Node.js | ||
It's fully possible to use on Node.js too. The tests are both Node.js and the browser. But it's only wrapping 4 libraries for the ease of use in the browser, so I'm not sure why you would do that. [Holler if you disagree =)](https://github.com/eklem/daq-proc/issues/new). | ||
It's fully possible to use on Node.js too. The tests are both for Node.js and the browser. But it's only wrapping 4 libraries for the ease of use in the browser, so I'm not sure why you would do that. [Holler if you disagree =)](https://github.com/eklem/daq-proc/issues/new). | ||
@@ -67,0 +75,0 @@ [license-image]: http://img.shields.io/badge/license-MIT-blue.svg?style=flat |
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
1123886
17
165
78