class_docstr: Returns a factored string if the model produces target factors. If there are no target factors the output
  is equivalent to StringOutputHandler
class_docstr_tok: ["Returns","a","factored","string","if","the","model","produces","target","factors",".","If","there","are","no","target","factors","the","output","is","equivalent","to","StringOutputHandler"]
code: def __init__(self, stream):
      self.stream = stream
  
imports: import json
  import sys
  from abc import ABC, abstractmethod
  from itertools import chain
  from typing import Optional
  import sockeye.constants
  from sockeye.utils import smart_open
  from .None import inference
label_desc: Use image node_id 1 to create a new FactoredStringOutputHandler object from inherited base classes: OutputHandler with example: obj = FactoredStringOutputHandler(stream)