class_docstr: Wrapper for the LISP-formatted thesauruses distributed by Dekang Lin.
class_docstr_tok: ["Wrapper","for","the","LISP-formatted","thesauruses","distributed","by","Dekang","Lin","."]
docstr: Initialize the thesaurus.
  
  :param root: root directory containing thesaurus LISP files
  :type root: C{string}
  :param badscore: the score to give to words which do not appear in each other's sets of synonyms
  :type badscore: C{float}
docstr_tok: ["Initialize","the","thesaurus",".",":","param","root",":","root","directory","containing","thesaurus","LISP","files",":","type","root",":","C","{","string","}",":","param","badscore",":","the","score","to","give","to","words","which","do","not","appear","in","each","other","'s","sets","of","synonyms",":","type","badscore",":","C","{","float","}"]
code: def __init__(self, root, badscore=0.0):
      """
      Initialize the thesaurus.
  
      :param root: root directory containing thesaurus LISP files
      :type root: C{string}
      :param badscore: the score to give to words which do not appear in each other's sets of synonyms
      :type badscore: C{float}
      """
  
      super().__init__(root, r"sim[A-Z]\.lsp")
      self._thesaurus = defaultdict(
          LinThesaurusCorpusReader.__defaultdict_factory
      )
      self._badscore = badscore
      for path, encoding, fileid in self.abspaths(
          include_encoding=True, include_fileid=True
      ):
          with open(path) as lin_file:
              first = True
              for line in lin_file:
                  line = line.strip()
                  # Start of entry
                  if first:
                      key = LinThesaurusCorpusReader._key_re.sub(
                          r"\1", line
                      )
                      first = False
                  # End of entry
                  elif line == "))":
                      first = True
                  # Lines with pairs of ngrams and scores
                  else:
                      split_line = line.split("\t")
                      if len(split_line) == 2:
                          ngram, score = split_line
                          self._thesaurus[fileid][key][
                              ngram.strip('"')
                          ] = float(score)
  
file_path: nltk/nltk/corpus/reader/lin.py
imports: import re
  from collections import defaultdict
  from functools import reduce
  from nltk.corpus.reader import CorpusReader
label_desc: Use image node_id 2 to create a new LinThesaurusCorpusReader object from inherited base classes: CorpusReader with example: obj = LinThesaurusCorpusReader(root, badscore)