function applyPhonologicalRules(text: string): string {
  const rules = _getMemoizedRules(FbtHooks.getViewerContext().locale);
  let result = text;

  for (let i = 0; i < rules.length; i++) {
    const [regexp, replacement] = rules[i];
    result = result.replace(regexp, replacement);
  }

  // If we have no rules (or if we already applied them), remove the delimiters.
  return result.replace(/\x01/g, '');
}
Applies phonological rules (appropriate to the locale)
at the morpheme boundary when tokens are replaced with values.
For languages like Turkish, we allow translators to use shorthand
for a pattern of inflection (a suffix like '(y)i becomes 'i or 'yi or 'a or
'ye, etc. depending on context).

Input: Translated string with each {token} substituted with
       "\x01value\x01" (e.g., "\x01Ozgur\x01(y)i..." which was
       "{name}(y)i...")
Returns: String with phonological rules applied (e.g., "Ozguri...")