It might be worse splitting this out into another function (e.g. `postings_from_file`) - this one function is pretty deeply nested.