errorcorrectionzoo/eczoo_data

Find unlinked code names and attach links to them

Closed this issue · 7 comments

Each code in the zoo has a "name", "short_name" and "code_id" parameter in the YML file. However, the description and other parameters where there is lots of text describing a given code may link to other codes via the hyperref protocol (see template.yml). The protocol includes a "name" of the other code and its code ID, but not all code IDs have been put in. The goal is to find every instance of the "name" of a code and replace it with the corresponding hyperref command linking to its code_id.

I was hoping you could write a script that does this for me so that I can re-run it as I populate the zoo later on. The script should

  • collect all code_id's, code_names, and code short_names from the eczoo_data repo and store them in a list (of roughly 550x3 entries). If a code does not have a short name, then define code_short_name to be code_name without the "code" string at the end if there is such a string, and otherwise define code_short_name to be code_name. For example code_name = "Repetition code", code short_name should be "repetition".
  • In the YML file of each code X, and for each code Y in the above list excluding X, case-insesitive-find all instances of "Y code name" and "Y code short name" within the descriptive parameters of the YML file of X ("description", "protection", all "features", "realizations", "notes", and any "detail" sub-parameter inside "relations"; DO NOT change code_id parameters).
  • Print out the few lines in which the script has found something to be replaced and ask for input (Y/N) from the command line as to whether the script should replace it. If Y, then replace with \hyperref[code:Y_code_id]{Y code name}. If N, move onto the next instance.
  • Take care not to ask to double link already linked codes, e.g., \hyperref[code:Y_code_id]{\hyperref[code:Y_code_id]{Y code name}}. In other words, once the script runs once, then next time it runs it should ideally be prompting about newly added potential references.

For example, find every instance of "repetition code" inside the descriptive parameters of the text and replace it with \hyperref[code:quantum_repetition]{repetition code}.

Hi, Can I work on this issue?

@valbert4 I'd like to work on this and have created a draft PR for the same. Before making the rest of the changes, I wanted to make sure I was working in the right direction.

Hi all, thanks for the interest. I've updated the description to make it more precise. I hope we can converge together on this, as I'm still not sure my request is 100% precise. But the spirit of it I hope is clear: I would like a bot that finds all potential hyperlink connectors between codes (see https://www.wikiwand.com/en/Wikipedia_bots) and prompts me to add a link or not for each one.

@valbert4 please assign this issue to @kvathupo when possible.

I dunno how; he's not showing up.
image

@kvathupo can you comment here so you can be assigned?

Comment !