class_docstr: 可用于监控某个数值，并通过 :meth:`is_better_results` 等接口检测结果是否变得更好。
  
  :param monitor: 监控的 metric 值：
  
      * 为 ``None``
       将尝试使用 :class:`~fastNLP.core.controllers.Trainer` 中设置 `monitor` 值（如果有设置）；
      * 为 ``str``
       尝试直接使用该名称从 ``evaluation`` 结果中寻找，如果在 ``evaluation`` 结果中没有找到完全一致的名称，将
       使用 最长公共字符串算法 从 ``evaluation`` 结果中找到最匹配的那个作为 ``monitor`` ；
      * 为 :class:`Callable`
       接受参数为 ``evaluation`` 的结果(字典类型)，返回一个 ``float`` 值作为 ``monitor`` 的结果，如果当前结果中没有相关
       的 ``monitor`` 值请返回 ``None`` ；
  :param larger_better: monitor 是否为越大越好；
docstr: 获取 monitor 的值，如果 monitor 没有直接找到，会尝试使用 **最长公共字符串算法** 匹配的方式寻找。
  
  :param results: 评测结果；
  :return: monitor 的值；如果为 ``None`` ，表明此次没有找到合适的monitor；
docstr_tok: ["\u83b7\u53d6","monitor","\u7684\u503c\uff0c\u5982\u679c","monitor","\u6ca1\u6709\u76f4\u63a5\u627e\u5230\uff0c\u4f1a\u5c1d\u8bd5\u4f7f\u7528","*","*","\u6700\u957f\u516c\u5171\u5b57\u7b26\u4e32\u7b97\u6cd5","*","*","\u5339\u914d\u7684\u65b9\u5f0f\u5bfb\u627e\u3002",":","param","results",":","\u8bc4\u6d4b\u7ed3\u679c\uff1b",":","return",":","monitor","\u7684\u503c\uff1b\u5982\u679c\u4e3a","``","None","``","\uff0c\u8868\u660e\u6b64\u6b21\u6ca1\u6709\u627e\u5230\u5408\u9002\u7684monitor\uff1b"]
code: def get_monitor_value(self, results: Dict) -> Union[float, None]:
      """
      获取 monitor 的值，如果 monitor 没有直接找到，会尝试使用 **最长公共字符串算法** 匹配的方式寻找。
  
      :param results: 评测结果；
      :return: monitor 的值；如果为 ``None`` ，表明此次没有找到合适的monitor；
      """
      if len(results) == 0 or self.monitor is None:
          return None
      # 保证所有的 tensor 都被转换为了 python 特定的类型
      results = self.itemize_results(results)
      use_monitor, monitor_value = _get_monitor_value(
          monitor=self.monitor,
          real_monitor=self._real_monitor,
          res=results,
      )
      if monitor_value is None:
          return monitor_value
      # 第一次运行
      if (
          isinstance(self.monitor, str)
          and self._real_monitor == self.monitor
          and use_monitor != self.monitor
      ):
          logger.rank_zero_warning(
              f"We can not find monitor:`{self.monitor}` for `{self.log_name}` in the "
              f"evaluation result (with keys as "
              f"{list(results.keys())}), we use the `{use_monitor}` as the monitor.",
              once=True,
          )
      # 检测到此次和上次不同。
      elif (
          isinstance(self.monitor, str)
          and self._real_monitor != self.monitor
          and use_monitor != self._real_monitor
      ):
          logger.rank_zero_warning(
              f"Change of monitor detected for `{self.log_name}`. "
              f"The expected monitor is:`{self.monitor}`, last used monitor is:"
              f"`{self._real_monitor}` and current monitor is:`{use_monitor}`. Please consider using a "
              f"customized monitor function when the evaluation results are varying between validation."
          )
  
      self._real_monitor = use_monitor
      return monitor_value
  
imports: from typing import Dict, Union, Any
  from abc import ABC
  import functools
  from fastNLP.core.utils import apply_to_collection
  from fastNLP.core.callbacks import Callback
  from fastNLP.core.callbacks.utils import _get_monitor_value
  from fastNLP.core.log import logger
  from fastNLP.core.utils.utils import _check_valid_parameters_number
label_desc: Use image node_id 4 for calling the ResultsMonitor obj's underlying member method code with example usage: obj.get_monitor_value(results) and returns: monitor_value, None, monitor_value