class_docstr: Converts featuresets and labeled featuresets to ARFF-formatted
  strings, appropriate for input into Weka.
  
  Features and classes can be specified manually in the constructor, or may
  be determined from data using ``from_train``.
docstr: Constructs an ARFF_Formatter instance with class labels and feature
  types determined from the given data. Handles boolean, numeric and
  string (note: not nominal) types.
docstr_tok: ["Constructs","an","ARFF_Formatter","instance","with","class","labels","and","feature","types","determined","from","the","given","data",".","Handles","boolean",",","numeric","and","string","(","note",":","not","nominal",")","types","."]
code: def from_train(tokens):
      """
      Constructs an ARFF_Formatter instance with class labels and feature
      types determined from the given data. Handles boolean, numeric and
      string (note: not nominal) types.
      """
      # Find the set of all attested labels.
      labels = {label for (tok, label) in tokens}
  
      # Determine the types of all features.
      features = {}
      for tok, label in tokens:
          for fname, fval in tok.items():
              if issubclass(type(fval), bool):
                  ftype = "{True, False}"
              elif issubclass(type(fval), (int, float, bool)):
                  ftype = "NUMERIC"
              elif issubclass(type(fval), str):
                  ftype = "STRING"
              elif fval is None:
                  continue  # can't tell the type.
              else:
                  raise ValueError("Unsupported value type %r" % ftype)
  
              if features.get(fname, ftype) != ftype:
                  raise ValueError("Inconsistent type for %s" % fname)
              features[fname] = ftype
      features = sorted(features.items())
  
      return ARFF_Formatter(labels, features)
  
imports: import os
  import re
  import subprocess
  import tempfile
  import time
  import zipfile
  from sys import stdin
  from nltk.classify.api import ClassifierI
  from nltk.internals import config_java, java
  from nltk.probability import DictionaryProbDist
label_desc: Use image node_id 5 for calling the ARFF_Formatter obj's underlying member method code with example usage: obj.from_train(tokens) and returns: ARFF_Formatter