mirror of
https://github.com/lovell/sharp.git
synced 2025-07-09 10:30:15 +02:00
Docs: keyword search improvements
This commit is contained in:
parent
53dd313e97
commit
fabe720b9b
File diff suppressed because one or more lines are too long
@ -1,65 +1,6 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
const stopWords = [
|
const stopWords = require('./stop-words');
|
||||||
'a',
|
|
||||||
'about',
|
|
||||||
'all',
|
|
||||||
'already',
|
|
||||||
'always',
|
|
||||||
'an',
|
|
||||||
'and',
|
|
||||||
'any',
|
|
||||||
'are',
|
|
||||||
'as',
|
|
||||||
'at',
|
|
||||||
'be',
|
|
||||||
'been',
|
|
||||||
'by',
|
|
||||||
'can',
|
|
||||||
'do',
|
|
||||||
'does',
|
|
||||||
'each',
|
|
||||||
'either',
|
|
||||||
'etc',
|
|
||||||
'for',
|
|
||||||
'from',
|
|
||||||
'get',
|
|
||||||
'gets',
|
|
||||||
'has',
|
|
||||||
'have',
|
|
||||||
'how',
|
|
||||||
'if',
|
|
||||||
'in',
|
|
||||||
'is',
|
|
||||||
'it',
|
|
||||||
'its',
|
|
||||||
'may',
|
|
||||||
'more',
|
|
||||||
'much',
|
|
||||||
'no',
|
|
||||||
'not',
|
|
||||||
'of',
|
|
||||||
'on',
|
|
||||||
'or',
|
|
||||||
'over',
|
|
||||||
'set',
|
|
||||||
'sets',
|
|
||||||
'should',
|
|
||||||
'that',
|
|
||||||
'the',
|
|
||||||
'their',
|
|
||||||
'there',
|
|
||||||
'therefore',
|
|
||||||
'these',
|
|
||||||
'this',
|
|
||||||
'to',
|
|
||||||
'use',
|
|
||||||
'using',
|
|
||||||
'when',
|
|
||||||
'which',
|
|
||||||
'will',
|
|
||||||
'with'
|
|
||||||
];
|
|
||||||
|
|
||||||
const extractDescription = (str) =>
|
const extractDescription = (str) =>
|
||||||
str
|
str
|
||||||
@ -71,10 +12,13 @@ const extractDescription = (str) =>
|
|||||||
.trim();
|
.trim();
|
||||||
|
|
||||||
const extractKeywords = (str) =>
|
const extractKeywords = (str) =>
|
||||||
str
|
[
|
||||||
.split(/[ -/]/)
|
...new Set(
|
||||||
.map((word) => word.toLowerCase().replace(/[^a-z]/g, ''))
|
str
|
||||||
.filter((word) => word.length > 2 && !stopWords.includes(word))
|
.split(/[ -/]/)
|
||||||
.join(' ');
|
.map((word) => word.toLowerCase().replace(/[^a-z]/g, ''))
|
||||||
|
.filter((word) => word.length > 2 && !stopWords.includes(word))
|
||||||
|
)
|
||||||
|
].join(' ');
|
||||||
|
|
||||||
module.exports = { extractDescription, extractKeywords };
|
module.exports = { extractDescription, extractKeywords };
|
||||||
|
71
docs/search-index/stop-words.js
Normal file
71
docs/search-index/stop-words.js
Normal file
@ -0,0 +1,71 @@
|
|||||||
|
'use strict';
|
||||||
|
|
||||||
|
module.exports = [
|
||||||
|
'about',
|
||||||
|
'after',
|
||||||
|
'all',
|
||||||
|
'already',
|
||||||
|
'alternative',
|
||||||
|
'always',
|
||||||
|
'and',
|
||||||
|
'any',
|
||||||
|
'are',
|
||||||
|
'been',
|
||||||
|
'before',
|
||||||
|
'can',
|
||||||
|
'containing',
|
||||||
|
'default',
|
||||||
|
'does',
|
||||||
|
'each',
|
||||||
|
'either',
|
||||||
|
'etc',
|
||||||
|
'for',
|
||||||
|
'from',
|
||||||
|
'get',
|
||||||
|
'gets',
|
||||||
|
'given',
|
||||||
|
'has',
|
||||||
|
'have',
|
||||||
|
'how',
|
||||||
|
'image',
|
||||||
|
'its',
|
||||||
|
'may',
|
||||||
|
'more',
|
||||||
|
'most',
|
||||||
|
'much',
|
||||||
|
'must',
|
||||||
|
'non',
|
||||||
|
'not',
|
||||||
|
'occur',
|
||||||
|
'occurs',
|
||||||
|
'over',
|
||||||
|
'perform',
|
||||||
|
'performs',
|
||||||
|
'provide',
|
||||||
|
'provided',
|
||||||
|
'set',
|
||||||
|
'sets',
|
||||||
|
'should',
|
||||||
|
'spelling',
|
||||||
|
'support',
|
||||||
|
'supported',
|
||||||
|
'take',
|
||||||
|
'that',
|
||||||
|
'the',
|
||||||
|
'their',
|
||||||
|
'there',
|
||||||
|
'therefore',
|
||||||
|
'these',
|
||||||
|
'this',
|
||||||
|
'use',
|
||||||
|
'used',
|
||||||
|
'using',
|
||||||
|
'value',
|
||||||
|
'values',
|
||||||
|
'when',
|
||||||
|
'which',
|
||||||
|
'while',
|
||||||
|
'will',
|
||||||
|
'with',
|
||||||
|
'without'
|
||||||
|
];
|
Loading…
x
Reference in New Issue
Block a user