From 38ed4dc5c71b51f117fe78a3d4b2bbb0171aaec6 Mon Sep 17 00:00:00 2001 From: toasted-nutbread Date: Mon, 26 Apr 2021 20:00:03 -0400 Subject: Improve kifuku detection to not include suru nouns (#1621) --- ext/js/display/display-generator.js | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) (limited to 'ext/js') diff --git a/ext/js/display/display-generator.js b/ext/js/display/display-generator.js index 9a90502e..53a004c1 100644 --- a/ext/js/display/display-generator.js +++ b/ext/js/display/display-generator.js @@ -783,17 +783,27 @@ class DisplayGenerator { } _isVerbOrAdjective(wordClasses) { + let isVerbOrAdjective = false; + let isSuruVerb = false; + let isNoun = false; for (const wordClass of wordClasses) { switch (wordClass) { case 'v1': case 'v5': - case 'vs': case 'vk': case 'vz': case 'adj-i': - return true; + isVerbOrAdjective = true; + break; + case 'vs': + isVerbOrAdjective = true; + isSuruVerb = true; + break; + case 'n': + isNoun = true; + break; } } - return false; + return isVerbOrAdjective && !(isSuruVerb && isNoun); } } -- cgit v1.2.3