'Transform the output file into an NLTK-style Valuation.
:return: A model if one is generated; None otherwise.
:rtype: sem.Valuation'

def _convert2val(self, valuation_str):

    valuation_standard_format = self._transform_output(valuation_str, 'standard')
    val = []
    for line in valuation_standard_format.splitlines(False):
        l = line.strip()
        if l.startswith('interpretation'):
            num_entities = int(l[(l.index('(') + 1):l.index(',')].strip())
        elif (l.startswith('function') and (l.find('_') == (-1))):
            name = l[(l.index('(') + 1):l.index(',')].strip()
            if is_indvar(name):
                name = name.upper()
            value = int(l[(l.index('[') + 1):l.index(']')].strip())
            val.append((name, MaceCommand._make_model_var(value)))
        elif l.startswith('relation'):
            l = l[(l.index('(') + 1):]
            if ('(' in l):
                name = l[:l.index('(')].strip()
                values = [int(v.strip()) for v in l[(l.index('[') + 1):l.index(']')].split(',')]
                val.append((name, MaceCommand._make_relation_set(num_entities, values)))
            else:
                name = l[:l.index(',')].strip()
                value = int(l[(l.index('[') + 1):l.index(']')].strip())
                val.append((name, (value == 1)))
    return Valuation(val)
