I need to align three strings in python:
str1 = "This is going to test the function"
str2 = "Th is is going to test function"
str3 = "This is gonna test the functon"
The way I need to align these strings is such that if the word at position x in one list is equal to the word as position x in the other string it it placed at that index. Such that I end up with three lists as outputs matching the following format (can be a pd table aswell):
0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 |
---|---|---|---|---|---|---|---|---|---|---|
This | - | is | - | going | - | to | test | the | function | - |
- | Th | is | is | going | - | to | test | - | function | - |
This | - | is | - | - | gonna | - | test | the | - | functon |
I am extracting text from three OCR models and will use the ordered lists to vote for what word should be in each position.
Thank you