Skip to content

Quick question about tags #1418

@daxida

Description

@daxida
  • Are tags / raw_tags expected to be sorted / unique, and if so, at which point of the program: only at the end, during the whole program etc.?
  • For non-en editions, are raw_tags expected to be removed once they are translated into tags?

While the docs state that:

we move tags that could be converted to tags to "tags" or "topics" field.

I understand this as expected to be removed once they are translated but the snippet seems to be deleting every raw_tag. I would expect something like:

def translate_raw_tags(data: WordEntry):
    raw_tags = []
    for raw_tag in data.raw_tags:
        if raw_tag in TAGS:
            data.tags.append(TAGS[raw_tag])
        elif raw_tag in TOPICS:
            data.topics.append(TOPICS[raw_tag])
        else:
            raw_tags.append(raw_tag)
    data.raw_tags = raw_tags

Also, somewhat related, the type hint of this generic translate_raw_tags seems to be violated in a couple languages that I've checked, where it is called with a Form list, Sound etc.

                sound = Sound(ipa=ipa, raw_tags=raw_tags)
                translate_raw_tags(sound)

I perfectly understand why this happens but it remains a bit confusing on first sight.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions