Open-Tamil : anagrams / palindrome / combinations / generate all valid sub words
My recent work from this weekend added some tools to the solthiruthi – framework for word play #75 . This change introduces easy ways to do,
- Generate Anagrams
- Generate Combinations of words
- Check if word is a plaindrome
Combinagrams – all sub-words
Particularly you can use the open-tamil API listed below, to generate list of all sub-words within a word.
e.g.
import tamil
from solthiruthi.dictionary import *
TVU_dict = DictionaryBuilder.create(TamilVU)
word = u’சவால்’
q=list(tamil.wordutils.combinagrams(word,TVU_dict))
print(u”|”.join(q))
which gives you the output, ச|வா|வால்|வாசல்|சவால்
Algorithm
The algorithm for combinagrams makes use of combination generators, and filters each permutations further generated from every such combination using a publicly avialable word-list like the Tamil VU dictionary provided with open-tamil.
Finally we get a list of all possible legal words from a given word.