@anonymous/

DraftyUnrealisticDataset

Python

No description

fork
loading
Files
  • main.py
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
p=lambda a,b:{a[:i]+b[j:]for i in range(1,len(a))for j in range(1,len(b))if((a[i-1]in'aeiou')^(b[j]in'aeiou'))*0**(a in a[:i]+b[j:]or b in a[:i]+b[j:])}

test = {
        ('lion', 'tiger'): {'liger', 'ler', 'liger', 'lir', 'lioger', 'lior'},
        ('tiger', 'lion'): {'tion', 'ton', 'tin', 'tigion', 'tigon', 'tigen'},
        ('spoon', 'fork'): {'sork', 'spork', 'spork', 'spok', 'spoork', 'spook'},
        ('smoke', 'fog'): {'sog', 'smog', 'smog', 'smokog'},
        ('gallop', 'triumph'): {'giumph', 'gumph', 'gariumph', 'gamph', 'gaph', 'gah', 'galiumph', 'galumph', 'galliumph', 'gallumph', 'galloriumph', 'gallomph', 'galloh'},
        ('breakfast', 'lunch'): {'bunch', 'brunch', 'brench', 'brech', 'breh', 'breanch', 'breach', 'breah', 'breakunch', 'breakfunch', 'breakfanch', 'breakfach', 'breakfah', 'breakfasunch'},
        ('two', 'words'): {'tords'},
        ('harry', 'ginny'): {'hinny', 'hanny', 'hany', 'hay', 'harinny', 'harrinny'},
}

for words, res in test.items():
    print('\n', words)
    list(map(print, p(*words)))
    assert sorted(res) == sorted(p(*words))