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

Multi-word mini-dictionary terms #1450

Closed
zmbc opened this issue Jul 15, 2021 · 1 comment
Closed

Multi-word mini-dictionary terms #1450

zmbc opened this issue Jul 15, 2021 · 1 comment

Comments

@zmbc
Copy link
Contributor

zmbc commented Jul 15, 2021

Right now, each word in a Translation must have a definition in a Mini-dictionary. In other words, the Translations are split on the space character to break them into chunks.

But this is not always the best way to split them, pedagogically. Certain phrases are more relevant to the lesson at the phrase level -- e.g. "post office" or "land animal" or "blue whale" -- especially when that concept is represented in the target language by a single word, or a completely different compound phrase. In that case, being able to look up the words "blue" and "whale" separately is no help at all.

Therefore, a useful feature would be able to manually override the behavior to join certain multi-word terms into single mini-dictionary entries. @kantord suggested curly braces around the phrase, e.g. {post office}. These would be underlined together, and mousing over them would bring up a single tooltip with the corresponding translation of the phrase.

I am happy to tackle implementing this feature.

@kantord
Copy link
Owner

kantord commented Jul 16, 2021

I think this can be implemented relatively easily by changing this line:

return [_define_word(course, word, reverse) for word in sentence.split()]

Although it's possible that other lines will have to be changed as well, in order to make sure that the curly braces don't show up in the final files.

Also, it probably makes sense to also make it so that {post office} will become a single chip in chip challenges? In that case, you'll also have to change the implementation here:

def get_chips_from_string(phrase):
return list(map(clean_word, phrase.split()))

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

No branches or pull requests

2 participants