@classmethod
def _from_dict(cls, _dict):
    """Initialize a TrainingExample object from a json dictionary."""
    args = {}
    if 'document_id' in _dict:
        args['document_id'] = _dict.get('document_id')
    if 'cross_reference' in _dict:
        args['cross_reference'] = _dict.get('cross_reference')
    if 'relevance' in _dict:
        args['relevance'] = _dict.get('relevance')
    return cls(**args)
