#test data
lines = ['razrazraz,rabotay', 'vilkoy, rabotay, razrazraz', 'kak ya vilkoy chistit to budu?']
uniWords = {0: 'raz', 1:'vilkoy', 2: 'bratishka', 3: 'rabota'}
matrix = [[0 for col in uniWords] for row in lines]
for index, line in enumerate(lines):
for key, val in uniWords.items():
matrix[index][key] = line.count(val)
print(matrix)
I3Rlc3QgZGF0YQpsaW5lcyA9IFsncmF6cmF6cmF6LHJhYm90YXknLCAndmlsa295LCByYWJvdGF5LCByYXpyYXpyYXonLCAna2FrIHlhIHZpbGtveSBjaGlzdGl0IHRvIGJ1ZHU/J10KdW5pV29yZHMgPSB7MDogJ3JheicsIDE6J3ZpbGtveScsIDI6ICdicmF0aXNoa2EnLCAzOiAncmFib3RhJ30KIAogCm1hdHJpeCA9IFtbMCBmb3IgY29sIGluIHVuaVdvcmRzXSBmb3Igcm93IGluIGxpbmVzXQogCiAKZm9yIGluZGV4LCBsaW5lIGluIGVudW1lcmF0ZShsaW5lcyk6CiAgICBmb3Iga2V5LCB2YWwgaW4gdW5pV29yZHMuaXRlbXMoKToKICAgICAgICBtYXRyaXhbaW5kZXhdW2tleV0gPSBsaW5lLmNvdW50KHZhbCkKIApwcmludChtYXRyaXgp
[[3, 0, 0, 1], [3, 1, 0, 1], [0, 1, 0, 0]]