title: Check the similarity between two words with NLTK with Python
body: <p>I have a two lists and I want to check the similarity between each words in the two list and find out the maximum similarity.Here is my code,</p>
  
  <pre><code>from nltk.corpus import wordnet
  
  list1 = ['Compare', 'require']
  list2 = ['choose', 'copy', 'define', 'duplicate', 'find', 'how', 'identify', 'label', 'list', 'listen', 'locate', 'match', 'memorise', 'name', 'observe', 'omit', 'quote', 'read', 'recall', 'recite', 'recognise', 'record', 'relate', 'remember', 'repeat', 'reproduce', 'retell', 'select', 'show', 'spell', 'state', 'tell', 'trace', 'write']
  list = []
  
  for word1 in list1:
      for word2 in list2:
          wordFromList1 = wordnet.synsets(word1)[0]
          wordFromList2 = wordnet.synsets(word2)[0]
          s = wordFromList1.wup_similarity(wordFromList2)
          list.append(s)
  
  print(max(list)) 
  </code></pre>
  
  <p>But this will result an error:</p>
  
  <pre><code>wordFromList2 = wordnet.synsets(word2)[0]
          IndexError: list index out of range
  </code></pre>
  
  <p>Please help me to fix this.<br>
  Thanking you</p>