class_docstr: A simple query corrector based on a mapping of field names to
  :class:`Corrector` objects, and a list of ``("fieldname", "text")`` tuples
  to correct. And terms in the query that appear in list of term tuples are
  corrected using the appropriate corrector.
class_docstr_tok: ["A","simple","query","corrector","based","on","a","mapping","of","field","names","to",":","class",":","`","Corrector","`","objects",",","and","a","list","of","``","(","``","fieldname","''",",","``","text","''",")","``","tuples","to","correct",".","And","terms","in","the","query","that","appear","in","list","of","term","tuples","are","corrected","using","the","appropriate","corrector","."]
docstr: :param correctors: a dictionary mapping field names to
      :class:`Corrector` objects.
  :param terms: a sequence of ``("fieldname", "text")`` tuples
      representing terms to be corrected.
  :param aliases: a dictionary mapping field names in the query to
      field names for spelling suggestions.
  :param prefix: suggested replacement words must share this number of
      initial characters with the original word. Increasing this even to
      just ``1`` can dramatically speed up suggestions, and may be
      justifiable since spellling mistakes rarely involve the first
      letter of a word.
  :param maxdist: the maximum number of "edits" (insertions, deletions,
      subsitutions, or transpositions of letters) allowed between the
      original word and any suggestion. Values higher than ``2`` may be
      slow.
docstr_tok: [":","param","correctors",":","a","dictionary","mapping","field","names","to",":","class",":","`","Corrector","`","objects",".",":","param","terms",":","a","sequence","of","``","(","``","fieldname","''",",","``","text","''",")","``","tuples","representing","terms","to","be","corrected",".",":","param","aliases",":","a","dictionary","mapping","field","names","in","the","query","to","field","names","for","spelling","suggestions",".",":","param","prefix",":","suggested","replacement","words","must","share","this","number","of","initial","characters","with","the","original","word",".","Increasing","this","even","to","just","``","1","``","can","dramatically","speed","up","suggestions",",","and","may","be","justifiable","since","spellling","mistakes","rarely","involve","the","first","letter","of","a","word",".",":","param","maxdist",":","the","maximum","number","of","``","edits","''","(","insertions",",","deletions",",","subsitutions",",","or","transpositions","of","letters",")","allowed","between","the","original","word","and","any","suggestion",".","Values","higher","than","``","2","``","may","be","slow","."]
code: def __init__(
      self, correctors, terms, aliases=None, prefix=0, maxdist=2
  ):
      """
      :param correctors: a dictionary mapping field names to
          :class:`Corrector` objects.
      :param terms: a sequence of ``("fieldname", "text")`` tuples
          representing terms to be corrected.
      :param aliases: a dictionary mapping field names in the query to
          field names for spelling suggestions.
      :param prefix: suggested replacement words must share this number of
          initial characters with the original word. Increasing this even to
          just ``1`` can dramatically speed up suggestions, and may be
          justifiable since spellling mistakes rarely involve the first
          letter of a word.
      :param maxdist: the maximum number of "edits" (insertions, deletions,
          subsitutions, or transpositions of letters) allowed between the
          original word and any suggestion. Values higher than ``2`` may be
          slow.
      """
  
      self.correctors = correctors
      self.aliases = aliases or {}
      self.termset = frozenset(terms)
      self.prefix = prefix
      self.maxdist = maxdist
  
imports: from bisect import bisect_left
  from heapq import heappush, heapreplace
  from whoosh import highlight
  from whoosh.compat import iteritems, xrange
label_desc: Use image node_id 1 to create a new SimpleQueryCorrector object from inherited base classes: QueryCorrector with example: obj = SimpleQueryCorrector(correctors, terms, aliases, prefix, maxdist)