<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def evaluate_dir(sample_dir):
 """Evaluate all recordings in `sample_dir`. Parameters sample_dir : string The path to a directory with *.inkml files. Returns ------- list of dictionaries Each dictionary contains the keys 'filename' and 'results', where 'results' itself is a list of dictionaries. Each of the results has the keys 'latex' and 'probability' """

    results = []
    if sample_dir[-1] == "/":
        sample_dir = sample_dir[:-1]
    for filename in glob.glob("%s/*.inkml" % sample_dir):
        results.append(evaluate_inkml(filename))
    return results