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

Grapheme label error #47

Closed
upskyy opened this issue Jul 16, 2021 · 0 comments
Closed

Grapheme label error #47

upskyy opened this issue Jul 16, 2021 · 0 comments
Assignees
Labels
Projects

Comments

@upskyy
Copy link
Member

upskyy commented Jul 16, 2021

Information

The graphene label value needs to be corrected.

def generate_grapheme_labels(grapheme_transcripts, vocab_path: str):
    vocab_list = list()
    vocab_freq = list()

    for grapheme_transcript in grapheme_transcripts:
        graphemes = grapheme_transcript.split()
        for grapheme in graphemes:
            if grapheme not in vocab_list:
                vocab_list.append(grapheme)
                vocab_freq.append(1)
            else:
                vocab_freq[vocab_list.index(grapheme)] += 1

    vocab_freq, vocab_list = zip(*sorted(zip(vocab_freq, vocab_list), reverse=True))
    vocab_dict = {
        'id': [0, 1, 2, 3],
        'grpm': ['<pad>', '<sos>', '<eos>', '<blank>'],
        'freq': [0, 0, 0, 0]
    }

    for idx, (grpm, freq) in enumerate(zip(vocab_list, vocab_freq)):
        vocab_dict['id'].append(idx + 3)
        vocab_dict['grpm'].append(grpm)
        vocab_dict['freq'].append(freq)

    label_df = pd.DataFrame(vocab_dict)
    label_df.to_csv(vocab_path, encoding="utf-8", index=False)

Expected behavior

vocab_dict['id'].append(idx + 3) -> vocab_dict['id'].append(idx + 4)

@upskyy upskyy self-assigned this Jul 16, 2021
@upskyy upskyy added this to In progress in Scrum Jul 16, 2021
@upskyy upskyy added the BUG Something isn't working label Jul 16, 2021
sooftware pushed a commit that referenced this issue Jul 16, 2021
@upskyy upskyy mentioned this issue Jul 16, 2021
sooftware added a commit that referenced this issue Jul 16, 2021
@sooftware sooftware moved this from In progress to DONE in Scrum Jul 16, 2021
@upskyy upskyy added DONE and removed BUG Something isn't working labels Jul 16, 2021
@upskyy upskyy closed this as completed Jul 16, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Scrum
DONE
Development

No branches or pull requests

1 participant