Comparing version 0.0.1 to 1.0.0
{ | ||
"name": "daq-proc", | ||
"version": "0.0.1", | ||
"version": "1.0.0", | ||
"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", |
@@ -11,2 +11,6 @@ # daq-proc | ||
Check out the [daq-proc interactive demo](https://eklem.github.io/daq-proc/demo/). Just add some words and figure it out. | ||
![Screenshot of the daq-proc broser demo](./demo/daq-proc-demo-screenshot.png) | ||
This library is not creating anything new, but just packaging 4 libraries that goes well togehter into one browser distribution file. Also showing how it may be usefull through tests and the interactive demo. | ||
@@ -23,32 +27,38 @@ | ||
Only Node.js for now, will make a browser example later | ||
### Browser | ||
```javascript | ||
const {wnn, sw, ngraminator, ehp} = require('../index.js') | ||
const headlineString = 'Lib Dems win Brecon and Radnorshire byelection, cutting Johnson Commons majority to one' | ||
const bodyString = 'Boris Johnson has suffered a major blow after the Tories were beaten by the Liberal Democrats in the Brecon and Radnorshire byelection. The victory for Jane Dodds means the new prime minister’s working majority in the House of Commons has been cut to just one. It will be seized on as a sign voters are concerned by Boris Johnson’s pledge to leave the EU without a deal if he deems it necessary. The Liberal Democrats won 13,826 votes with the Conservatives taking 12,401, a margin of 1,425 that overturned the Tories’ previous majority of more than 8,000. It was a sobering night for the Labour party (1,680 votes), which was beaten into fourth place by the Brexit party (3,331), and only just held on to its deposit. Ukip (242) came last behind the Monster Raving Loony party (334). In her acceptance speech, Dodds said: “I am incredibly humbled by the support. From every walk of life and every political persuasion, people have chosen to believe in my positive liberal vision for something better. “And by backing that liberal vision, people in Brecon and Radnorshire have sent a powerful message to Westminster: we demand better.” She continued: “People are desperately crying out for a different kind of politics. There is no time for tribalism when our country is faced with a Boris Johnson government and the threat of a no-deal Brexit. “My very first act as your MP when I arrive in Westminster will be to find Mr Boris Johnson, wherever he’s hiding, and tell him loud and clear: stop playing with the futures of our communities and rule out a no-deal Brexit.” The leader of the Liberal Democrats, Jo Swinson, who visited the constituency four times in the run-up to the byelection, said the results showed that the country didn\’t have to settle for Johnson or Jeremy Corbyn.' | ||
<script src="daq-proc.js"></script> | ||
let headlineArray = wnn.extract(headlineString, undefined, {toLowercase: true}) | ||
let bodyArray = wnn.extract(bodyString, undefined, {toLowercase: true}) | ||
console.log('Word arrays: ') | ||
console.dir(headlineArray) | ||
console.dir(bodyArray) | ||
<script> | ||
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 headlineStopped = sw.removeStopwords(headlineArray) | ||
let bodyStopped = sw.removeStopwords(bodyArray) | ||
console.log('Stopword removed arrays: ') | ||
console.dir(headlineStopped) | ||
console.dir(bodyStopped) | ||
let headlineArray = dqp.wnn.extract(headlineString, undefined, {toLowercase: true}) | ||
let bodyArray = dqp.wnn.extract(bodyString, undefined, {toLowercase: true}) | ||
console.log('Word arrays: ') | ||
console.dir(headlineArray) | ||
console.dir(bodyArray) | ||
let headlineNgrams = ngraminator(headlineStopped, [2,3,4]) | ||
let bodyNgrams = ngraminator(bodyStopped, [2,3,4]) | ||
console.log('Ngram arrays: ') | ||
console.dir(headlineNgrams) | ||
console.dir(bodyNgrams) | ||
let headlineStopped = dqp.sw.removeStopwords(headlineArray) | ||
let bodyStopped = dqp.sw.removeStopwords(bodyArray) | ||
console.log('Stopword removed arrays: ') | ||
console.dir(headlineStopped) | ||
console.dir(bodyStopped) | ||
let keywords = ehp.findKeywords(headlineStopped, bodyStopped, 5) | ||
console.log('Keyword array: ') | ||
console.dir(keywords) | ||
let headlineNgrams = dqp.ngraminator(headlineStopped, [2,3,4]) | ||
let bodyNgrams = dqp.ngraminator(bodyStopped, [2,3,4]) | ||
console.log('Ngram arrays: ') | ||
console.dir(headlineNgrams) | ||
console.dir(bodyNgrams) | ||
let keywords = dqp.ehp.findKeywords(headlineStopped, bodyStopped, 5) | ||
console.log('Keyword array: ') | ||
console.dir(keywords) | ||
</script> | ||
``` | ||
### 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). | ||
[license-image]: http://img.shields.io/badge/license-MIT-blue.svg?style=flat | ||
@@ -55,0 +65,0 @@ [license-url]: LICENSE |
@@ -8,3 +8,2 @@ const test = require('tape') | ||
const bodyString = 'Boris Johnson has suffered a major blow after the Tories were beaten by the Liberal Democrats in the Brecon and Radnorshire byelection. The victory for Jane Dodds means the new prime minister’s working majority in the House of Commons has been cut to just one. It will be seized on as a sign voters are concerned by Boris Johnson’s pledge to leave the EU without a deal if he deems it necessary. The Liberal Democrats won 13,826 votes with the Conservatives taking 12,401, a margin of 1,425 that overturned the Tories’ previous majority of more than 8,000. It was a sobering night for the Labour party (1,680 votes), which was beaten into fourth place by the Brexit party (3,331), and only just held on to its deposit. Ukip (242) came last behind the Monster Raving Loony party (334). In her acceptance speech, Dodds said: “I am incredibly humbled by the support. From every walk of life and every political persuasion, people have chosen to believe in my positive liberal vision for something better. “And by backing that liberal vision, people in Brecon and Radnorshire have sent a powerful message to Westminster: we demand better.” She continued: “People are desperately crying out for a different kind of politics. There is no time for tribalism when our country is faced with a Boris Johnson government and the threat of a no-deal Brexit. “My very first act as your MP when I arrive in Westminster will be to find Mr Boris Johnson, wherever he’s hiding, and tell him loud and clear: stop playing with the futures of our communities and rule out a no-deal Brexit.” The leader of the Liberal Democrats, Jo Swinson, who visited the constituency four times in the run-up to the byelection, said the results showed that the country didn\’t have to settle for Johnson or Jeremy Corbyn.' | ||
let headlineArray = wnn.extract(headlineString, undefined, {toLowercase: true}) | ||
@@ -11,0 +10,0 @@ let bodyArray = wnn.extract(bodyString, undefined, {toLowercase: true}) |
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
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
1051346
16
163
0
70