these formats are for download:
how we know in which is the useful for us..
please tell me for word similarity which for mate best for download...
Creating a list is quite a memory-intensive method of computing those results.
As you become more familiar with Python, generators can lead to very space efficient programmes.
Generally, if you are building a list to produce summary statistics, you are wasting lots of memory. Consider these two code examples:
>>> nouns = list(wn.all_synsets('n'))
>>> len([synset for synset in nouns if synset.hyponyms()!= True])
82115
>>> nouns = wn.all_synsets('n')
>>> len(n for n in nouns if not n.hyponyms())
You are also getting an AttributeError. Try something like this.
>>> len(n for n in nouns if hasattr('hyponyms', n) and not n.hyponyms())
Understanding generators is extremely useful. Search for "beazley generators" without quotes to find one of the best slide decks on them. I would do that myself, but I'm on my phone.
Oh that's right. Do this instead:
sum(1 for n in nouns ...)
That will give an equivalent value to len().