///
class ContentUnit {
public categories : Array = [];
public addCategory (...nouns : Array) {
this.categories.push(new ContentDifferential(...nouns));
return this;
}
public isMatch (cu : ContentUnit) {
return ContentDifferential.isMatch(this.categories, cu.categories);
}
public getScore () {
let score = 0;
this.categories.forEach(diff => {
score += diff.score;
});
return score / this.categories.length;
}
public matchAgainst (a : Array) : Array {
for (let i = 0; i < a.length; i++) {
if (a[i].isMatch(this)) {
return [i];
}
}
}
}