String matching queries with multiple languages

Правка en4, от swordx, 2023-07-31 20:31:23

Given a text and search query which could consist of multiple languages lets say polish and english, you need to find whether the given search query is substring of the input text or not.

There is an added condition, you are allowed to replace any substring with its corresponding meaning in other language. For example, given the following mapping:

ó - u
ł - ou
ż - zg

You can replace ó with u and vice versa, same for ł and ż

Following are some example inputs and output as per the above mentioned mapping.

Text | Term | Result

soł | u | false

soł | ou | true

soł | ł | true

sou | ł | true

Explanation for second test case: input text is 'soł', since ł can be replaced with ou, and input text will become soou, and the search query is 'ou', the result is true.

Could anyone suggest some optimal solution for this problem. Please let me know in the comments if the problem statement is unclear.

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en4 Английский swordx 2023-07-31 20:31:23 8
en3 Английский swordx 2023-07-31 20:30:55 72
en2 Английский swordx 2023-07-30 11:22:46 224 (published)
en1 Английский swordx 2023-07-30 11:18:45 748 Initial revision (saved to drafts)