'Find the token span of the answer in the context for this example.
If a token span cannot be found, return None. Otherwise, torchify.'

def _build_ex(self, ex):

    if (not ('text' in ex)):
        return
    inputs = {}
    fields = ex['text'].strip().split('\n')
    if (len(fields) < 2):
        raise RuntimeError('Invalid    input.    Is    task    a    QA    task?')
    (document, question) = ('    '.join(fields[:(-1)]), fields[(-1)])
    inputs['document'] = self.word_dict.tokenize(document)
    inputs['question'] = self.word_dict.tokenize(question)
    inputs['target'] = None
    if ('labels' in ex):
        inputs['target'] = self._find_target(inputs['document'], ex['labels'])
        if (inputs['target'] is None):
            return
    inputs = vectorize(self.opt, inputs, self.word_dict, self.feature_dict)
    return (inputs + (document, self.word_dict.span_tokenize(document)))
