diff options
author | James Maa <jmaa@berkeley.edu> | 2024-05-23 15:23:10 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-05-23 22:23:10 +0000 |
commit | d6aa6737821f5db61e932714322f2401f86b5200 (patch) | |
tree | a8d95dab4c7f6ebe1140bb894a919bc666761ab6 /ext/js/language/language-transforms.js | |
parent | bbb19669c27a4216ae11937650da173165e72978 (diff) |
Basic Spanish Transforms (#908)
* Spanish transforms
* Add more spanish transforms
* Address comments
* Fix types
* Undo prefix change
Diffstat (limited to 'ext/js/language/language-transforms.js')
-rw-r--r-- | ext/js/language/language-transforms.js | 18 |
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 + }; +} |