2

This is the question I am referring to.

I looked for answers online for quite a while and was unable to find anything. I then wrote up what I believe to be a detailed description with examples of my code (and not too much code), yet the question was not well received.

I'm not sure what I could have done to make it clearer/better. Any ideas?

9
  • 1
    one small thing that, at a glance, does seem like it's impacting: I understand the need to keep some stuff confidential, but you could be able to just post a dummy file to help others? Without such a file it feels like you may be missing the C part of your MCVE
    – Patrice
    Jun 18, 2018 at 19:34
  • What is your actual problem that you want to solve? I can go with Getting these methods to work the way I want them to isn't an issue, the problem is getting them to work with each of the documents. or That's when I ran into another problem or I'm trying to wrap my head around a solution for something like this
    – rene
    Jun 18, 2018 at 19:35
  • @csmckelvey "How can I identify headings with differing styles with one or more regular expressions assuming sometimes styles overlap between documents" Jun 18, 2018 at 19:36
  • @rene I just want to know what the best method is for identifying headings and subheadings given the information I provided. I'm not even sure if regex will work in this scenario. Jun 18, 2018 at 19:38
  • @Patrice I could do that, but I would need more than one because styles vary between them. Jun 18, 2018 at 19:38
  • @emsimpson92 I fully understand that. But since these varying styles are part of your issue right now, not providing these to the people who try to help you may be seen as an "incomplete" example
    – Patrice
    Jun 18, 2018 at 19:41
  • 1
    The risk with asking for the best method is it will be seen as asking for opinions and closed as such. So be very careful in phrasing questions like that.
    – rene
    Jun 18, 2018 at 19:44
  • 2
    That's why I didn't want to ask it like that lol Jun 18, 2018 at 19:45
  • I'm just having trouble understanding why some people would downvote a post without an explanation of why, where the answer isn't glaringly obvious. Jun 18, 2018 at 23:15

1 Answer 1

7

A couple of high-level suggestions:

  • Describe your goals up-front. You spend most of the question describing what you've tried and how it hasn't worked, but leave the actual goal fairly vague. You're trying to identify sections based on... what? It's good to describe what you've tried, but start off by clearly defining the problem you've tried to solve!

  • Don't presuppose the solution. Yes, it might involve regex - but as you've already found, regular expressions alone can be insufficient for identifying sections of ad-hoc formatted documents. There may be another approach entirely that is better suited.

On a more specific note: when I've had to do this sort of parsing, it's usually ended up involving many hours spent carefully describing the structure of the documents, followed by a relatively easy session of coding to identify which structure(s) apply to each and extract the relevant information (and then... Lots and lots of testing). Identifying the complete set of heuristics is the hard part, and it's not clear from your question that you've done this step - if you haven't, we probably can't help you as we lack access to the complete set of documents that you're hoping to parse!

3
  • Apparently what was a clear definition of my goals to me is not necessarily so clear for others. I'll rewrite it a bit and see if I can throw in some dummy files. Thanks. Jun 18, 2018 at 19:44
  • Does my updated description make it a bit more clear? Jun 18, 2018 at 20:02
  • 1
    It's a definite improvement. I believe the specific problem you're struggling with is the convention used to number headings? If so, stating that explicitly (in the question title even!) would speed comprehension.
    – Shog9
    Jun 20, 2018 at 1:28

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .