Change similarity data structure into defaultdict