aboutsummaryrefslogtreecommitdiff
path: root/ext/js/language/language-transforms.js
diff options
context:
space:
mode:
Diffstat (limited to 'ext/js/language/language-transforms.js')
-rw-r--r--ext/js/language/language-transforms.js18
1 files changed, 18 insertions, 0 deletions
diff --git a/ext/js/language/language-transforms.js b/ext/js/language/language-transforms.js
index ee8af88b..f3e36560 100644
--- a/ext/js/language/language-transforms.js
+++ b/ext/js/language/language-transforms.js
@@ -52,3 +52,21 @@ export function prefixInflection(inflectedPrefix, deinflectedPrefix, conditionsI
conditionsOut
};
}
+
+/**
+ * @param {string} inflectedWord
+ * @param {string} deinflectedWord
+ * @param {string[]} conditionsIn
+ * @param {string[]} conditionsOut
+ * @returns {import('language-transformer').Rule}
+ */
+export function wholeWordInflection(inflectedWord, deinflectedWord, conditionsIn, conditionsOut) {
+ const regex = new RegExp('^' + inflectedWord + '$');
+ return {
+ type: 'wholeWord',
+ isInflected: regex,
+ deinflect: () => deinflectedWord,
+ conditionsIn,
+ conditionsOut
+ };
+}