Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Separating suffixes using a dictionary

I need to separate all possible suffixes (about 1000) from a given word. I am thinking about using a dict.

In doing so I would have suffixes as keys (and some additional information about the suffixes as values needed in the further process). If the longest possible suffix is 4 letters long I would search the dict for all possible combinations. For example: Given a word: 'abcdefg' I would search the dict for 'g','fg','efg' and 'defg'.

I have done some research and haven't found much similar uses of the dict. Could this be a viable solution or am I missing something here? Help much appriciated.

like image 315
root Avatar asked Dec 06 '25 09:12

root


1 Answers

If the suffixes aren't too long, your solution sounds fine -- it's only a few dictionary look-ups per word, and dictionary look-ups are fast. I don't think any more complex solution (like using a trie) would be worth it here. For only removing the suffix, you could also use a set instead of a dictionary, but since you need additional information for each suffix, a dictionary seems to be the natural choice.

like image 147
Sven Marnach Avatar answered Dec 07 '25 21:12

Sven Marnach



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!