aboutsummaryrefslogtreecommitdiff
path: root/ext/bg/js/dictionary.js
diff options
context:
space:
mode:
authorsiikamiika <siikamiika@users.noreply.github.com>2017-10-19 18:35:42 +0300
committersiikamiika <siikamiika@users.noreply.github.com>2017-10-19 18:35:42 +0300
commitf54f909701453bac563c9cb5ec75fde23e087e8e (patch)
tree856e4253b6fc51a2df8421a5c69fe84b36f53092 /ext/bg/js/dictionary.js
parent04def645214b4c0ae2833f5ea7d9c3274192aa09 (diff)
merged mode: rewrite term frequency (use score)
Diffstat (limited to 'ext/bg/js/dictionary.js')
-rw-r--r--ext/bg/js/dictionary.js29
1 files changed, 16 insertions, 13 deletions
diff --git a/ext/bg/js/dictionary.js b/ext/bg/js/dictionary.js
index 97716e65..ee056273 100644
--- a/ext/bg/js/dictionary.js
+++ b/ext/bg/js/dictionary.js
@@ -318,21 +318,24 @@ function dictTagsSort(tags) {
});
}
-function dictJmdictTermTagsRare(tags) {
- const rareTags = [
- 'ik',
- 'iK',
- 'ok',
- 'oK',
- 'io',
- 'oik'
- ];
+function dictTermTagScore(tags) {
+ let score = 0;
+
+ const tagScores = {
+ 'ik': -5,
+ 'iK': -5,
+ 'ok': -5,
+ 'oK': -5,
+ 'io': -5,
+ 'oik': -5,
+ 'P': 10
+ };
+
for (const tag of tags) {
- if (rareTags.includes(tag)) {
- return true;
- }
+ score += tagScores[tag] || 0;
}
- return false;
+
+ return score;
}
function dictFieldSplit(field) {