class_docstr: The UnitConversion logic adapter parse inputs to convert values
  between several metric units.
  
  For example:
      User: 'How many meters are in one kilometer?'
      Bot: '1000.0'
  
  :kwargs:
      * *language* (``object``) --
      The language is set to ``chatterbot.languages.ENG`` for English by default.
class_docstr_tok: ["The","UnitConversion","logic","adapter","parse","inputs","to","convert","values","between","several","metric","units",".","For","example",":","User",":","'How","many","meters","are","in","one","kilometer","?","'","Bot",":","'1000.0'",":","kwargs",":","*","*","language","*","(","``","object","``",")","--","The","language","is","set","to","``","chatterbot.languages.ENG","``","for","English","by","default","."]
code: def __init__(self, chatbot, **kwargs):
      super().__init__(chatbot, **kwargs)
      try:
          from pint import UnitRegistry
      except ImportError:
          message = (
              'Unable to import "pint".\n'
              'Please install "pint" before using the UnitConversion logic adapter:\n'
              "pip3 install pint"
          )
          raise OptionalDependencyImportError(message)
  
      self.language = kwargs.get("language", languages.ENG)
      self.cache = {}
      self.patterns = [
          (
              re.compile(
                  r"""
                     (([Hh]ow\s+many)\s+
                     (?P<target>\S+)\s+ # meter, celsius, hours
                     ((are)*\s*in)\s+
                     (?P<number>([+-]?\d+(?:\.\d+)?)|(a|an)|(%s[-\s]?)+)\s+
                     (?P<from>\S+)\s*) # meter, celsius, hours
                     """
                  % (parsing.numbers),
                  (re.VERBOSE | re.IGNORECASE),
              ),
              lambda m: self.handle_matches(m),
          ),
          (
              re.compile(
                  r"""
                     ((?P<number>([+-]?\d+(?:\.\d+)?)|(%s[-\s]?)+)\s+
                     (?P<from>\S+)\s+ # meter, celsius, hours
                     (to)\s+
                     (?P<target>\S+)\s*) # meter, celsius, hours
                     """
                  % (parsing.numbers),
                  (re.VERBOSE | re.IGNORECASE),
              ),
              lambda m: self.handle_matches(m),
          ),
          (
              re.compile(
                  r"""
                     ((?P<number>([+-]?\d+(?:\.\d+)?)|(a|an)|(%s[-\s]?)+)\s+
                     (?P<from>\S+)\s+ # meter, celsius, hours
                     (is|are)\s+
                     (how\s+many)*\s+
                     (?P<target>\S+)\s*) # meter, celsius, hours
                     """
                  % (parsing.numbers),
                  (re.VERBOSE | re.IGNORECASE),
              ),
              lambda m: self.handle_matches(m),
          ),
      ]
      self.unit_registry = UnitRegistry()
  
file_path: ChatterBot/chatterbot/logic/unit_conversion.py
imports: from chatterbot.logic import LogicAdapter
  from chatterbot.conversation import Statement
  from chatterbot.exceptions import OptionalDependencyImportError
  from chatterbot import languages
  from chatterbot import parsing
  from mathparse import mathparse
  import re
label_desc: Use image node_id 1 to create a new UnitConversion object from inherited base classes: LogicAdapter with example: obj = UnitConversion(chatbot)