class_docstr: Represents a parameter dictionary with a history, and contains other functionality around
  parameter passing and validation for AllenNLP.
  
  There are currently two benefits of a ``Params`` object over a plain dictionary for parameter
  passing:
  
  #. We handle a few kinds of parameter validation, including making sure that parameters
     representing discrete choices actually have acceptable values, and making sure no extra
     parameters are passed.
  #. We log all parameter reads, including default values.  This gives a more complete
     specification of the actual parameters used than is given in a JSON file, because
     those may not specify what default values were used, whereas this will log them.
  
  The convention for using a ``Params`` object in AllenNLP is that you will consume the parameters
  as you read them, so that there are none left when you've read everything you expect.  This
  lets us easily validate that you didn't pass in any `extra` parameters, just by making sure
  that the parameter dictionary is empty.  You should do this when you're done handling
  parameters, by calling :func:`Params.assert_empty`.
docstr: Returns Ordered Dict of Params from list of partial order preferences.
  
  Parameters
  ----------
  preference_orders: List[List[str]], optional
      ``preference_orders`` is list of partial preference orders. ["A", "B", "C"] means
      "A" > "B" > "C". For multiple preference_orders first will be considered first.
      Keys not found, will have last but alphabetical preference. Default Preferences:
      ``[["dataset_reader", "iterator", "model", "train_data_path", "validation_data_path",
      "test_data_path", "trainer", "vocabulary"], ["type"]]``
code: def as_ordered_dict(self, preference_orders=None):
      """
      Returns Ordered Dict of Params from list of partial order preferences.
  
      Parameters
      ----------
      preference_orders: List[List[str]], optional
          ``preference_orders`` is list of partial preference orders. ["A", "B", "C"] means
          "A" > "B" > "C". For multiple preference_orders first will be considered first.
          Keys not found, will have last but alphabetical preference. Default Preferences:
          ``[["dataset_reader", "iterator", "model", "train_data_path", "validation_data_path",
          "test_data_path", "trainer", "vocabulary"], ["type"]]``
      """
      params_dict = self.as_dict(quiet=True)
      if not preference_orders:
          preference_orders = []
          preference_orders.append(
              [
                  "dataset_reader",
                  "iterator",
                  "model",
                  "train_data_path",
                  "validation_data_path",
                  "test_data_path",
                  "trainer",
                  "vocabulary",
              ]
          )
          preference_orders.append(["type"])
  
      def order_func(key):
          # Makes a tuple to use for ordering.  The tuple is an index into each of the `preference_orders`,
          # followed by the key itself.  This gives us integer sorting if you have a key in one of the
          # `preference_orders`, followed by alphabetical ordering if not.
          order_tuple = [
              order.index(key) if key in order else len(order)
              for order in preference_orders
          ]
          return order_tuple + [key]
  
      def order_dict(dictionary, order_func):
          # Recursively orders dictionary according to scoring order_func
          result = OrderedDict()
          for key, val in sorted(
              list(dictionary.items()),
              key=lambda item: order_func(item[0]),
          ):
              result[key] = (
                  order_dict(val, order_func)
                  if isinstance(val, dict)
                  else val
              )
          return result
  
      return order_dict(params_dict, order_func)
  
imports: from __future__ import with_statement
  from __future__ import absolute_import
  from collections import MutableMapping, OrderedDict
  import copy
  import json
  import logging
  import os
  from io import open
  from allennlp.common.checks import ConfigurationError
  from allennlp.common.file_utils import cached_path
label_desc: Use image node_id 21 for calling the Params obj's underlying member method code with example usage: obj.as_ordered_dict(preference_orders) and returns: order_dict, unknown, result