I wrote a simple function.
def common_long_words(text):
sorted(w for w in set(text) if len(w) > 7 and (FreqDist(text))[w] > 7)
This is stuck.
Also, [w for w in set(text5) if len(w) > 7 and FreqDist(text5)[w] > 7
fails. It just get stuck.
However, this works:
fdist5 = FreqDist(text5)
[w for w in set(text5) if len(w) > 7 and fdist5[w] > 7
Does it not work like that in python? Why is that? Also, why is it stuck, if this is wrong, it should come out as an error, syntax or runtime.
This works, flawlessly and fast:
>>> def common_long_words(text):
... fdist = FreqDist(text)
... print(sorted(w for w in set(text) if len(w) > 7 and fdist[w] > 7))
...
>>> for t in all_texts:
... common_long_words(t)