I am building out a parser for a well-known track & field meet management software output file (sample output).

I can parse this manually, and put items into my object model (overview below), but it's a bit time intensive, and it's going to have manual issues.

FYI, I'm using C# but I have no problem crossing boundaries into better/more appropriate languages here.

I've tried/thought about a couple different ways at this, and they are all just meh.

  • Use a StringReader to parse each line, one-at-a-time, until I run into the "event separators", then try to gather that data together. Parse after.
  • Use a Regex.Split against a regex that looks something like Event\s+\d*\s+(Girls|Boys)\s+(.*)\n[=]+\n(.*)\n[=]+ to split the input string into similar chunks. Parse after.
  • Use Amazon Mechanical Turk and hiring a small army of humans to do this work for me.
  • Suck it up and keep doing this manually.

So, it's entirely possible that I'm going about this all wrong, and I should be using some language/pattern/concept that I don't even know exists. Any help here would be greatly appreciated.

Keep in mind that I don't actually need the code to do the parsing, I am just looking for the idea behind it.

The (simplified) object model looks something like this:

  • Meet
    • Name
    • Date
    • Location
  • School
    • Name
  • Athlete
    • Name
    • Gender
    • Graduation Year
  • Performance
    • MeetId
    • SchoolId
    • Data (the actual time, height, or distance)
  • AthletePerformance
    • AthleteId
    • PerformanceId
  • Have you looked into writing the grammar for the file format? There are already a bunch of them. – l0b0 Apr 12 '18 at 7:14
  • I havent @l0b0, but I will absolutely look into it. I knew there was something I was missing. – Tony Morris Apr 12 '18 at 15:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.