Skip to content

Replacements that are themselves mistakes #435

@EdwardBetts

Description

@EdwardBetts

Some of the suggested replacements in dictionary.txt are listed as mistakes themselves.

Examples:

mimimise->minimise
minimise->minimize
orginal->orignal
orignal->original
passtime->pasttime
pasttime->pastime
shrinked->shrunk
srinkd->shrinked
srinked->shrinked
tranfering->transfering
transfering->transferring

Code to find these mistakes:

bad_words, new_words = {}, set()
lines = [line[:-1] for line in open('dictionary.txt')]

for line in lines:
    orig, replacements = line.split('->')
    bad_words[orig] = {word.strip() for word in replacements.split(',')}
    new_words.update(bad_words[orig])

highlight = {word for word in new_words if word in bad_words and word not in bad_words[word]}
for line in lines:
    if any(word in line for word in highlight):
        print(line)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions