so this is #2. and it is not trivial since there is no good way to do it. There is a thread here where I try to do that - matching a space onto another - in which there is also a link to a machine-learnt curated example in SC.
Let me know if that helps or not. I can try to explain better.