From 40b29cb0d3ff90094c44dd4cb7abd087a0fd9598 Mon Sep 17 00:00:00 2001 From: toasted-nutbread Date: Wed, 28 Apr 2021 21:57:49 -0400 Subject: Add pitch categories template helper (#1636) * Move utility function * Expose dictionary entry as a hidden property for internal use * Add pitchCategories helper --- ext/js/language/dictionary-data-util.js | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'ext/js/language') diff --git a/ext/js/language/dictionary-data-util.js b/ext/js/language/dictionary-data-util.js index 0a3be234..81d1c290 100644 --- a/ext/js/language/dictionary-data-util.js +++ b/ext/js/language/dictionary-data-util.js @@ -188,6 +188,31 @@ class DictionaryDataUtil { return disambiguations; } + static isNonNounVerbOrAdjective(wordClasses) { + let isVerbOrAdjective = false; + let isSuruVerb = false; + let isNoun = false; + for (const wordClass of wordClasses) { + switch (wordClass) { + case 'v1': + case 'v5': + case 'vk': + case 'vz': + case 'adj-i': + isVerbOrAdjective = true; + break; + case 'vs': + isVerbOrAdjective = true; + isSuruVerb = true; + break; + case 'n': + isNoun = true; + break; + } + } + return isVerbOrAdjective && !(isSuruVerb && isNoun); + } + // Private static _createFrequencyGroupsFromMap(map) { -- cgit v1.2.3