Write and retrieve vocabulary from a file