random bugfixes
This commit is contained in:
parent
eeb5ef4948
commit
1855013f8b
@ -101,7 +101,7 @@ class Knowledge {
|
||||
static arrangement
|
||||
|
||||
constructor(definition) {
|
||||
Knowledge.fullSemanticNetwork = new SemanticNetwork(definition)
|
||||
Knowledge.semanticNetwork = new SemanticNetwork(definition)
|
||||
Knowledge.agentSemanticNetwork = new AgentSemanticNetwork(definition)
|
||||
Knowledge.arrangement = new Arrangement()
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
class Shop {
|
||||
productsSimilarityScore(name1, name2) {
|
||||
static productsSimilarityScore(name1, name2) {
|
||||
const [ o1, o2 ] = [name1, name2].map(name => Knowledge.semanticNetwork.findByName(name))
|
||||
if (!o1 || !o2)
|
||||
throw new Error("names should be in semantic network!")
|
||||
@ -10,7 +10,7 @@ class Shop {
|
||||
|
||||
const set = new Set([...o1[p], ...o2[p]])
|
||||
const matching = o1[p].reduce((s, v) => s + (o2[p].indexOf(v) >= 0 ? 1 : 0), 0)
|
||||
return matching / [...set].lengthsss
|
||||
return matching / [...set].length
|
||||
}
|
||||
|
||||
const [ l, c ] = [calcScore('locations'), calcScore('categories')]
|
||||
|
Loading…
Reference in New Issue
Block a user