Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Find unlinked code names and attach links to them #47

Closed
valbert4 opened this issue Dec 10, 2021 · 7 comments · Fixed by #304
Closed

Find unlinked code names and attach links to them #47

valbert4 opened this issue Dec 10, 2021 · 7 comments · Fixed by #304

Comments

@valbert4
Copy link
Member

valbert4 commented Dec 10, 2021

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}.

@valbert4 valbert4 changed the title Cute assignment: find unlinked code names and attach links to them Find unlinked code names and attach links to them May 10, 2022
@devilkiller-ag
Copy link

Hi, Can I work on this issue?

@alt-shreya
Copy link

@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.

@valbert4
Copy link
Member Author

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.

@natestemen
Copy link

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

@valbert4
Copy link
Member Author

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

@natestemen
Copy link

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

@kvathupo
Copy link
Contributor

Comment !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
5 participants