code: def parse_file(f):
      """Parses the WordNet wn_s.pl prolog file and returns two dictionaries:
      word2nums and num2words.
      """
  
      word2nums = defaultdict(list)
      num2words = defaultdict(list)
  
      for line in f:
          if not line.startswith("s("):
              continue
  
          line = line[2:]
          num = int(line[: line.find(",")])
          qt = line.find("'")
          line = line[qt + 1 :]
          qt = line.find("'")
          word = line[:qt].lower()
  
          if not word.isalpha():
              continue
  
          word2nums[word].append(num)
          num2words[num].append(word)
  
      return word2nums, num2words
  
file_path: whoosh/src/whoosh/lang/wordnet.py
imports: from collections import defaultdict
  from whoosh.compat import iterkeys, text_type
  from whoosh.fields import Schema, ID, STORED
label_desc: Use image node_id 1 for calling a global function with example usage: parse_file(f) and returns: word2nums,  num2words