def _create_translation_file(feature_folder, dataset_name, translation,
    formula_id2index):
    """
    Write a loop-up file that contains the direct (record-wise) lookup
    information.

    Parameters
    ----------
    feature_folder :
        Path to the feature files.
    dataset_name :
        'traindata', 'validdata' or 'testdata'.
    translation : list of triples
        (raw data id, formula in latex, formula id)
    """
    translationfilename = '%s/translation-%s.csv' % (feature_folder,
        dataset_name)
    with open(translationfilename, 'w') as f:
        f.write('index,raw_data_id,latex,formula_id\n')
        for el in translation:
            f.write('%i,%i,%s,%i\n' % (formula_id2index[el[2]], el[0], el[1
                ], el[2]))
