class_docstr: Predictor for the :class:`~allennlp.models.bidaf.SemanticRoleLabeler` model.
docstr: The SRL model has a slightly different API from other models, as the model is run
  forward for every verb in the sentence. This means that for a single sentence, we need
  to generate a ``List[Instance]``, where the length of this list corresponds to the number
  of verbs in the sentence. Additionally, all of these verbs share the same return dictionary
  after being passed through the model (as really we care about all the frames of the sentence
  together, rather than separately).
  
  Parameters
  ----------
  json_dict : ``JsonDict``, required.
      JSON that looks like ``{"sentence": "..."}``.
  
  Returns
  -------
  instances : ``List[Instance]``
      One instance per verb.
docstr_tok: ["The","SRL","model","has","a","slightly","different","API","from","other","models",",","as","the","model","is","run","forward","for","every","verb","in","the","sentence",".","This","means","that","for","a","single","sentence",",","we","need","to","generate","a","``","List","[","Instance","]","``",",","where","the","length","of","this","list","corresponds","to","the","number","of","verbs","in","the","sentence",".","Additionally",",","all","of","these","verbs","share","the","same","return","dictionary","after","being","passed","through","the","model","(","as","really","we","care","about","all","the","frames","of","the","sentence","together",",","rather","than","separately",")",".","Parameters","--","--","--","--","--","json_dict",":","``","JsonDict","``",",","required",".","JSON","that","looks","like","``","{","``","sentence","''",":","``","...","''","}","``",".","Returns","--","--","--","-","instances",":","``","List","[","Instance","]","``","One","instance","per","verb","."]
code: def _sentence_to_srl_instances(self, json_dict):
      """
      The SRL model has a slightly different API from other models, as the model is run
      forward for every verb in the sentence. This means that for a single sentence, we need
      to generate a ``List[Instance]``, where the length of this list corresponds to the number
      of verbs in the sentence. Additionally, all of these verbs share the same return dictionary
      after being passed through the model (as really we care about all the frames of the sentence
      together, rather than separately).
  
      Parameters
      ----------
      json_dict : ``JsonDict``, required.
          JSON that looks like ``{"sentence": "..."}``.
  
      Returns
      -------
      instances : ``List[Instance]``
          One instance per verb.
      """
      sentence = json_dict["sentence"]
      tokens = self._tokenizer.split_words(sentence)
      words = [token.text for token in tokens]
      instances = []
      for i, word in enumerate(tokens):
          if word.pos_ == "VERB":
              verb_labels = [0 for _ in words]
              verb_labels[i] = 1
              instance = self._dataset_reader.text_to_instance(
                  tokens, verb_labels
              )
              instances.append(instance)
      return instances
  
file_path: magnitude/pymagnitude/third_party/allennlp/predictors/semantic_role_labeler.py
imports: from __future__ import absolute_import
  from allennlp.common.util import JsonDict, sanitize, group_by_count
  from allennlp.data import DatasetReader, Instance
  from allennlp.data.tokenizers.word_splitter import SpacyWordSplitter
  from allennlp.models import Model
  from allennlp.predictors.predictor import Predictor
label_desc: Use image node_id 5 for calling the SemanticRoleLabelerPredictor obj's underlying member method code with example usage: obj._sentence_to_srl_instances(json_dict) and returns: instances