title: Python: Passing variables into Wordnet Synsets methods in NLTK
body: <p>I need to work on a project that require NLTK so I started learning Python two weeks ago but struggling to understand Python and NLTK. </p>
  
  <p>From the NLTK documentation, I can understand the following codes and they work well if I manually add the word apple and pear into the codes below.</p>
  
  <pre><code>from nltk.corpus import wordnet as wn
  
  apple = wn.synset('apple.n.01')
  pear = wn.synset('pear.n.01')
  
  print apple.lch_similarity(pear)
  
  Output: 2.53897387106
  </code></pre>
  
  <p>However, I need to use the NLTK to work with a list of items. For example, I have a list of items below and I would like to compare the items from list1 with list2 - for example: compare word1 from list1 with every word in list 2, then word2 from list1 with every word from list2 until all words in list1 is compared.</p>
  
  <pre><code>list1 = ["apple", "honey", "drinks", "flowers", "paper"]
  list2 = ["pear", "shell", "movie", "fire", "tree", "candle"]
  
  wordFromList1 = list1[0]
  wordFromList2 = list2[0]
  
  wordFromList1 = wn.synset(wordFromList1)
  wordFromList2 = wn.synset(wordFromList2)    
  
  print wordFromList1.lch_similarity(wordFromList2)
  </code></pre>
  
  <p>The codes above will of course gives an error. Can anyone show me how I can pass a <em>variable</em> into synset method [wn.synset(*pass_variable_in_here*)] so that I can use a double loop to get the lch_similarity values for them. Thank you.</p>