from_corpus reformat

The `max_id` logic wouldn't work well when a direct mapping is supplied (some ids from the mapping may be missing, if they are not in the corpus).

This patch copies the id=>word mapping directly. I also simplified the logic a bit and added comments. Let me know if this works for you @AndreasMadsen .