Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

daq-proc

Package Overview
Dependencies
Maintainers
1
Versions
22
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

daq-proc - npm Package Compare versions

Comparing version 4.0.0 to 4.0.1

dist/daq-proc.4.0.1.js

31

demo/query-processing/query-processor-app.js
// exposing the underlying libraries in a transparent way
const {highlight, leven} = dqp
const { highlight, lvm } = dqp
const index = ['a', 'adding', 'and', 'at', 'be', 'better', 'by', 'can', 'ensuring', 'even', 'get', 'gets', 'good', 'input', 'interesting', 'it', 'item', 'just', 'least', 'levenshtein', 'limit', 'long', 'longer', 'lots', 'make', 'match', 'matcher', 'maximum', 'maybe', 'more', 'need', 'nice', 'of', 'query', 'resembles', 'result', 'search', 'seems', 'so', 'some', 'text', 'that', 'the', 'this', 'to', 'we', 'will', 'with', 'words', 'work']

@@ -29,11 +30,27 @@ // Populating div with only meaningful words

// Listen to change on selection input and initiate a hit highlighting
document.getElementById('fuzzy').onchange = function () {
hitHighlight()
}
// calculate item highlighted
const hitHighlight = function () {
const querytext = document.getElementById('querytext').value.split(' ')
const itemtext = 'some text that resembles a search result item with lots of nice words to match at least some of the query input and we can make it longer by adding even more interesting text so that maximum words limit gets interesting'.split(' ')
let querytext = document.getElementById('querytext').value.split(' ')
const itemtext = 'some text that resembles a search result item with lots of nice words to match at least some of the query input and we can make it longer by adding even more interesting text so that maximum words limit gets interesting and it seems we need some more text to make the maximum words work better maybe this long text can be good and it will just get better and better the longer we make it ensuring lots of words that the query and levenshtein matcher can match'.split(' ')
const itemmaxwords = document.getElementById('maxwords').value
// console.log(querytext)
// console.log(itemtext)
// console.log(itemmaxwords)
const hitHighlighted = highlight(querytext, itemtext, { itemMaxWords: itemmaxwords })
const fuzzyMatching = document.getElementById('fuzzy').checked
let matchedQuery = ''
// remove empty values in query array, to not get stupid matches from '' to 'a' for example.
querytext = querytext.filter(function (word) {
return word !== ''
})
if (fuzzyMatching) {
matchedQuery = lvm.levenMatch(querytext, index, { distance: 1 }).flat()
} else {
matchedQuery = querytext
}
console.log(matchedQuery)
const hitHighlighted = highlight(matchedQuery, itemtext, { itemMaxWords: itemmaxwords })
console.log('Hit(s) highlighted: ' + hitHighlighted)

@@ -40,0 +57,0 @@ populateItem(hitHighlighted)

{
"name": "daq-proc",
"version": "4.0.0",
"version": "4.0.1",
"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.",

@@ -27,3 +27,3 @@ "main": "index.js",

"ngraminator": "^2.0.4",
"hit-highlighter": "2.0.1",
"hit-highlighter": "2.0.3",
"cheerio": "1.0.0-rc.3",

@@ -30,0 +30,0 @@ "leven-match": "1.0.0",

@@ -22,3 +22,3 @@ # daq-proc

* [`cheerio`](https://github.com/cheeriojs/cheerio) - Here specifically used to extract text from all- or parts of the HTML.
* [`cheerio`](https://github.com/cheeriojs/cheerio) - Here specifically used to extract text from all- or parts of some HTML.
* [`eklem-headline-parser`](https://github.com/eklem/eklem-headline-parser) - Determines the most relevant keywords in a headline by considering article context

@@ -29,3 +29,3 @@ * [`hit-highlighter`](https://github.com/eklem/hit-highlighter) - Higlighting hits from a query in a result item.

* [`stopword`](https://github.com/fergiemcdowall/stopword) - Removes stopwords from an array of words. To keep your index small and remove all words without a scent of information and/or remove stopwords from the query, making the search engine work less hard to find relevant results.
* [`words'n'numbers`](https://github.com/eklem/words-n-numbers) - Extract words and optionally numbers from a string of text into arrays. Arrays that can be fed to `stopword`, `eklem-headline-parser`, `ngraminator` and `hit-highlighter`.
* [`words'n'numbers`](https://github.com/eklem/words-n-numbers) - Extract words and optionally numbers from a string of text into arrays. Arrays that can be fed to `stopword`, `eklem-headline-parser`, `leven-match`, `ngraminator` and `hit-highlighter`.

@@ -32,0 +32,0 @@ ## Browser

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc