def multisource_with_factors(tmp_path_factory):
    """
    Creates 2 sources with three factors each having 10 sentences.
    """
    data_dir = tmp_path_factory.mktemp("data")
    target = data_dir / 'target'
    with target.open(mode='w') as f:
        for s in [ 'target-%d' % i for i in range(10) ]:
            print(s, file=f)
    multisource = []
    for s in range(2):
        factors = []
        for f in range(3):
            name = 'source_%d_%d' % (s, f)
            factor = data_dir / name
            factors.append(str(factor))
            with factor.open(mode='w') as f:
                for i in range(10):
                    print(name + '-%d' % i, file=f)
        multisource.append(factors)
    model = tmp_path_factory.mktemp('model')
    return model, multisource, str(target)