I hope this is what you're looking for...

I hope that the long-ass chunk of code that I've written is the
"constructor" that you were looking for... Also, I have changed the name
of the parsing function back to parseDataFile since I have written it to
work with both the training data and the test data.