Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
bb5cc38
add: commits from another branch that was done
imOscarCrespo Aug 22, 2019
cb39245
fix: remove consoles
imOscarCrespo Aug 22, 2019
b4a9821
fix(docu): two typos errors and two broken links
guinii Aug 22, 2019
cb3fea4
refactor: reduction code with same functionality && area of the butto…
imOscarCrespo Aug 23, 2019
dbc459c
chore(deps): bump node-nlp from 3.4.0 to 3.6.0 (#200)
dependabot-preview[bot] Aug 26, 2019
15e1677
chore(deps): bump aws-sdk from 2.513.0 to 2.517.0 (#201)
dependabot-preview[bot] Aug 26, 2019
27c96a5
chore(deps-dev): bump eslint-plugin-jest from 22.15.0 to 22.15.2 (#195)
dependabot-preview[bot] Aug 26, 2019
860717c
chore(deps): bump @types/jest from 24.0.17 to 24.0.18 (#193)
dependabot-preview[bot] Aug 26, 2019
c64b5d7
chore(deps-dev): bump @types/node from 12.7.1 to 12.7.2 (#185)
dependabot-preview[bot] Aug 26, 2019
1399b99
chore(deps-dev): bump core-js from 3.2.0 to 3.2.1 (#179)
dependabot-preview[bot] Aug 26, 2019
0259c57
chore(deps-dev): bump react-hot-loader from 4.12.10 to 4.12.11 (#176)
dependabot-preview[bot] Aug 26, 2019
d1a7071
Contentful/fix reply buttons (#149)
dpinol Aug 26, 2019
1575860
chore(core/react): improve typing for CoreBot and add for NodeApp
dpinol Jul 29, 2019
9a2cb5c
chore(core/react) bump to 0.9.0-alpha.7
dpinol Jul 30, 2019
822e009
chore(contentful): release 0.9.13 with sdk-capabilities
dpinol Jul 31, 2019
39af7b5
chore(dynamo): release 0.9.11 with sdk-capabilities
dpinol Jul 31, 2019
f7fe881
feature(contenful): 0.9.14 support keywords with only 1 stopword
dpinol Jul 31, 2019
bef346b
chore(contenful): prepare for using Spanish snowball stemmer
dpinol Jul 31, 2019
9d63708
chore(contenful): hola/hi added as stopword
dpinol Aug 6, 2019
d1622a6
chore(contenful): 0.9.15 test search when 2 contents share the same k…
dpinol Aug 6, 2019
d72d4e3
refactor: sendInput function refactorized for not repeating code
imOscarCrespo Aug 23, 2019
998c328
feat: change variable name of the map
imOscarCrespo Aug 26, 2019
a6f9bae
feat: change persistent menu on render in dev-app
imOscarCrespo Aug 26, 2019
de7b9e8
fix: second parameter of map deleted
imOscarCrespo Aug 26, 2019
8a5833d
add: commits from another branch that was done
imOscarCrespo Aug 22, 2019
1501d99
fix: remove consoles
imOscarCrespo Aug 22, 2019
a023db0
refactor: reduction code with same functionality && area of the butto…
imOscarCrespo Aug 23, 2019
bdb8b39
merge with master
imOscarCrespo Aug 26, 2019
c07fcd4
fix: remove isRegex variable, never used
imOscarCrespo Aug 26, 2019
73e2e4a
fix: remove function that was created only for testing
imOscarCrespo Aug 26, 2019
e3900d1
add: commits from another branch that was done
imOscarCrespo Aug 22, 2019
93f5f2e
fix: remove consoles
imOscarCrespo Aug 22, 2019
663aa16
refactor: reduction code with same functionality && area of the butto…
imOscarCrespo Aug 23, 2019
59b2215
add: commits from another branch that was done
imOscarCrespo Aug 22, 2019
c74aa68
fix: remove consoles
imOscarCrespo Aug 22, 2019
56920f7
Merge branch 'persistentMenuBotonic' of github.com:hubtype/botonic in…
imOscarCrespo Aug 26, 2019
ce08f84
add: commits from another branch that was done
imOscarCrespo Aug 22, 2019
7294ace
fix: remove consoles
imOscarCrespo Aug 22, 2019
656fc70
refactor: reduction code with same functionality && area of the butto…
imOscarCrespo Aug 23, 2019
cd40dd2
add: commits from another branch that was done
imOscarCrespo Aug 22, 2019
4139112
fix: remove consoles
imOscarCrespo Aug 22, 2019
2933f70
fix: remove isRegex variable, never used
imOscarCrespo Aug 26, 2019
bcd0e2c
add: commits from another branch that was done
imOscarCrespo Aug 22, 2019
817a8d4
fix: remove consoles
imOscarCrespo Aug 22, 2019
4922212
add: commits from another branch that was done
imOscarCrespo Aug 22, 2019
8833455
fix: remove consoles
imOscarCrespo Aug 22, 2019
9709d23
merge
imOscarCrespo Aug 26, 2019
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
chore(contenful): 0.9.15 test search when 2 contents share the same k…
…eyword
  • Loading branch information
dpinol committed Aug 26, 2019
commit d1622a65a9ae6acb5b51028089898a9872e794ef
2 changes: 1 addition & 1 deletion packages/botonic-plugin-contentful/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/botonic-plugin-contentful/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"postversion": "git push && git push --tags"
},
"name": "@botonic/plugin-contentful",
"version": "0.9.14",
"version": "0.9.15",
"main": "lib/index.js",
"types": "lib/index.d.ts",
"repository": {
Expand Down
2 changes: 2 additions & 0 deletions packages/botonic-plugin-contentful/src/nlp/keywords.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ export enum MatchType {
ALL_WORDS_IN_KEYWORDS_MIXED_UP
}

export const MATCH_TYPES = Object.values(MatchType).map(m => m as MatchType);

export class KeywordsParser<M> {
private readonly candidates = [] as CandidateWithKeywords<M>[];

Expand Down
35 changes: 32 additions & 3 deletions packages/botonic-plugin-contentful/tests/nlp/keywords.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,19 +24,28 @@ function testFindKeywords(locale: string, matchType: MatchType) {
test.each<any>([
// found at start with multiword keyword
['k w A end', { A: ['k w A', 'kwB'] }, ['A']],

// found at end (after normalizing)
['start kwA. ', { A: ['kwA', 'kwB'] }, ['A']],

// two keywords found for same model at middle
['start kwA1 kwA2 end', { A: ['kwA1', 'kwA2'] }, ['A']],

// no keywords found
['kwC kwD', { A: ['kwA'], B: ['kwB'] }, []],

// keywords found for 2 models
['kwA kwB', { A: ['kwA'], B: ['kwB'] }, ['A', 'B']],

// BUG does not detect keywords which only contain stopwords when input contains other (no stopwords) words
['sobres enormes', { ONLY_STOPWORD: ['kw1', 'sobre'] }, []],

// does not false positive with keywords which only contain stopwords
['something else', { ONLY_STOPWORD: ['kw1', 'otro'] }, []],
['', { ONLY_STOPWORD: ['kw1', 'otro'] }, []]
['', { ONLY_STOPWORD: ['kw1', 'otro'] }, []],

// a keyword is shared by 2 contents
['informacion kw1', { A: ['kw1', 'unKw'], B: ['kw1', 'otroKw'] }, ['A', 'B']]
])(
'TEST: find keywords of "%s" with KEYWORDS_AND_OTHERS_FOUND',
testFindKeywords('es', MatchType.KEYWORDS_AND_OTHERS_FOUND)
Expand All @@ -45,13 +54,19 @@ test.each<any>([
test.each<any>([
// found with multiword keyword
['k w A', { A: ['k w A', 'kwB'] }, ['A']],

// found with single word
['kwA', { A: ['kwA', 'kwB'] }, ['A']],

// detects keywords which only contain stopwords
['sobres', { ONLY_STOPWORD: ['kw1', 'sobre'] }, ['ONLY_STOPWORD']],

// does not false positive with keywords which only contain stopwords
['other', { ONLY_STOPWORD: ['kw1', 'otro'] }, []],
['', { ONLY_STOPWORD: ['kw1', 'otro'] }, []]
['', { ONLY_STOPWORD: ['kw1', 'otro'] }, []],

// a keyword is shared by 2 contents
['kw1 kw2', { A: ['kw1 kw2', 'unKw'], B: ['kw1 kw2', 'otroKw'] }, ['A', 'B']]
])(
'TEST: find keywords of "%s" with ONLY_KEYWORDS_FOUND',
testFindKeywords('es', MatchType.ONLY_KEYWORDS_FOUND)
Expand All @@ -60,10 +75,13 @@ test.each<any>([
test.each<any>([
// exact words
['comprar', { A: ['k w A', 'comprar'] }, ['A']],

// different word endings
['compras', { A: ['k w A', 'comprar'] }, ['A']],

// no keywords found
['kwC kwD', { A: ['kwA'], B: ['kwB'] }, []],

// keywords found for 2 models
['kwAB', { A: ['kwAB'], B: ['kwAB'] }, ['A', 'B']]
])(
Expand All @@ -79,15 +97,26 @@ test.each<any>([
test.each<any>([
// keyword with 3 words, words in between, different order
['wc foo wb bar wa', { A: ['wa wb wc', 'other'] }, ['A']],

// keyword with 1 word, found
['foo wa bar', { A: ['wa', 'other'] }, ['A']],

// keyword with 2 words, only 1 found
['wb', { A: ['wa wb', 'other'] }, []],

// keywords which only contain stopwords
['sobres', { ONLY_STOPWORD: ['kw1', 'sobre'] }, ['ONLY_STOPWORD']],

// does not false positive with keywords which only contain stopwords
['something else', { ONLY_STOPWORD: ['kw1', 'otro'] }, []],
['', { ONLY_STOPWORD: ['kw1', 'otro'] }, []]
['', { ONLY_STOPWORD: ['kw1', 'otro'] }, []],

// a keyword is shared by 2 contents
[
'kw1 enmedio kw2',
{ A: ['kw1 kw2', 'unKw'], B: ['kw1 kw2', 'otroKw'] },
['A', 'B']
]
])(
'TEST: find keywords of "%s" with ALL_WORDS_IN_KEYWORDS_MIXED_UP',
testFindKeywords('es', MatchType.ALL_WORDS_IN_KEYWORDS_MIXED_UP)
Expand Down