class_docstr: Predictor for any model that takes in a sentence and returns
  a single class for it.  In particular, it can be used with
  the [`BasicClassifier`](../models/basic_classifier.md) model.
  
  Registered as a `Predictor` with name "text_classifier".
class_docstr_tok: ["Predictor","for","any","model","that","takes","in","a","sentence","and","returns","a","single","class","for","it",".","In","particular",",","it","can","be","used","with","the","[","`","BasicClassifier","`","]","(","..","\/models\/basic_classifier.md",")","model",".","Registered","as","a","`","Predictor","`","with","name","``","text_classifier","''","."]
docstr: Expects JSON that looks like `{"sentence": "..."}`.
  Runs the underlying model, and adds the `"label"` to the output.
docstr_tok: ["Expects","JSON","that","looks","like","`","{","``","sentence","''",":","``","...","''","}","`",".","Runs","the","underlying","model",",","and","adds","the","`","``","label","''","`","to","the","output","."]
code: def _json_to_instance(self, json_dict: JsonDict) -> Instance:
      """
      Expects JSON that looks like `{"sentence": "..."}`.
      Runs the underlying model, and adds the `"label"` to the output.
      """
      sentence = json_dict["sentence"]
      reader_has_tokenizer = (
          getattr(self._dataset_reader, "tokenizer", None) is not None
          or getattr(self._dataset_reader, "_tokenizer", None)
          is not None
      )
      if not reader_has_tokenizer:
          tokenizer = SpacyTokenizer()
          sentence = tokenizer.tokenize(sentence)
      return self._dataset_reader.text_to_instance(sentence)
  
file_path: allennlp/allennlp/predictors/text_classifier.py
imports: from typing import List, Dict
  import numpy
  from allennlp.common.util import JsonDict
  from allennlp.data import Instance
  from allennlp.predictors.predictor import Predictor
  from allennlp.data.fields import LabelField
  from allennlp.data.tokenizers.spacy_tokenizer import SpacyTokenizer
label_desc: Use image node_id 2 for calling the TextClassifierPredictor obj's underlying member method code with example usage: obj._json_to_instance(json_dict) and returns: self