Skip to content

explore how to re-use code from functions that are very similar efficiently #9

Description

@atn38

relates to #8.

for example, whatever functions I write to get annotations and get geographic coverage would be very similar at their core:

  • loop through each EML document in a corpus
  • if there's a X element at the dataset level, parse and record it
  • loop through each entity group and then each entity in a group, if there's a X element at the entity level,parse and record it
  • within each entity loop through each attribute, if there's a X element at the attribute level parse and record it

X can be:
methods
coverage
annotations
(any others)

I'd like to not write the same function over and over again, and not have to edit all these separate text files for any sort of editing or debugging. A possible solution is to have the shell function(s), e.g. get_annotations(), actually call or return a template function which takes a function from the parse_() family as an argument.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions