class_docstr: Lexer for the esoteric BrainFuck language.
class_docstr_tok: ["Lexer","for","the","esoteric","BrainFuck","language","."]
docstr: It's safe to assume that a program which mostly consists of + -
  and < > is brainfuck.
docstr_tok: ["It","'s","safe","to","assume","that","a","program","which","mostly","consists","of","+","-","and","<",">","is","brainfuck","."]
code: def analyse_text(text):
      """It's safe to assume that a program which mostly consists of + -
      and < > is brainfuck."""
      plus_minus_count = 0
      greater_less_count = 0
  
      range_to_check = max(256, len(text))
  
      for c in text[:range_to_check]:
          if c == "+" or c == "-":
              plus_minus_count += 1
          if c == "<" or c == ">":
              greater_less_count += 1
  
      if plus_minus_count > (0.25 * range_to_check):
          return 1.0
      if greater_less_count > (0.25 * range_to_check):
          return 1.0
  
      result = 0
      if "[-]" in text:
          result += 0.5
  
      return result
  
file_path: catboost/contrib/python/Pygments/py3/pygments/lexers/esoteric.py
imports: from pygments.lexer import RegexLexer, include, words, bygroups
  from pygments.token import Comment, Operator, Keyword, Name, String, Number, Punctuation, Error, Whitespace
label_desc: Use image node_id 1 for calling the BrainfuckLexer obj's underlying member method code with example usage: obj.analyse_text(text) and returns: result, int, int