Garrafao / durel_system_annotators

3 stars 0 forks source link

Remove duplicate code in xl_lexeme_annotate.py and random_annotate.py #35

Closed AinaIanemahy closed 8 months ago

AinaIanemahy commented 8 months ago

These lines appear in both files:

if debug:
    logging.basicConfig(format='%(levelname)s:%(message)s', level=logging.DEBUG)
    logging.info("Debug mode is on.")

if usage_dir is None:
    raise ValueError("usage_dir is None")
if debug:
    logging.info(f"Using directory '{usage_dir}' for usage data.")

if custom_dir is None:
    custom_dir = usage_dir
if debug:
    logging.info(f"Using directory '{custom_dir}' to store judgements.")

if custom_filename is None:
    custom_filename = "judgements.csv"
if debug:
    logging.info(f"Using filename '{custom_filename}' to store judgements.")`

We should extract this passage to remove the duplicate.

shafqatvirk commented 8 months ago

So, we can extract this code and put it into a separate file to avoid the duplicates. Is that right?

AinaIanemahy commented 8 months ago

Yes. I have started working on that and I think that the two scripts are actually so similar that it might make sense to merge them. I have to think about it a bit more.

AinaIanemahy commented 8 months ago

I have resolved this by merging the two annotation scripts. 5031ea3