I have 13 different words. I need to get permutations like all combinations of these words:
word1 word2 word3 word4 word5 word6 word7 word8 word9 word10 word11 word12 word13
But the combinations only should be 12 words long.
I have already a script to do this in python:
import time
start = time.time()
items = ['word1', 'word2', 'word3', 'word4', 'word5', 'word6', 'word7', 'word8', 'word9', 'word10, 'word11', 'word12', 'word13']
from itertools import permutations
for p in permutations(items, 12):
print(p)
print 'It took', time.time()-start, 'seconds.'
But it's too slow, and takes 24 seconds when the combinations are only 4 words long.
With a javascript tool it only took 1 second for up to 9 different words; but when trying 10 different words the browser crashed.
Is there a fast efficient way to do this? Maybe with awk
?
EDIT:
This is not the same question as Generating permutations using bash because this question has 13 separated words, and the answers in the other thread do not work with words.
Kind Regards.