How to use the autocorrect.spell function in autocorrect

To help you get started, we’ve selected a few autocorrect examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github kengz / aiva / lib / py / convo_classifier.py View on Github external
def clean_input(text):
    # first clean out symbols
    text = re.sub(r'[^\w]', ' ', text)
    # then tokenize
    text = text.split()
    # then correct all spellings
    text = map(spell, text)
    text = " ".join(text)
    return text
github NITDgpOS / MemeFinder / scraper / ocr.py View on Github external
# write the grayscale image to disk as a temporary file so we can
        # apply OCR to it
        filename = "scraper/{}.png".format(os.getpid())
        cv2.imwrite(filename, gray)

        # load the image as a PIL/Pillow image, apply OCR, and then delete
        # the temporary file
        text = pytesseract.image_to_string(Image.open(filename))
        os.remove(filename)
        text = text.strip().split()
        chars_to_remove = ['.', '!', ':']
        extracted = list()
        for t in text:
            for c in chars_to_remove:
                t = t.replace(c, '')
            extracted.append(spell(t))
        return(' '.join(extracted))

    except BaseException as e:
        print(e)
github keiffster / program-y / src / programy / spelling / autocorrection.py View on Github external
def correct(self, phrase):
        words = phrase.split()
        correct = [spell(word).upper() for word in words]
        return ' '.join(correct)
github 5hirish / adam_qas / qas / qa_init.py View on Github external
def spell_check(input_question):

    pattern = "\w"
    prog = re.compile(pattern)

    input_question_word_list = input_question.split()
    en_dict = enchant.Dict("en_US")
    for word_index in input_question_word_list:
        if (not en_dict.check(input_question_word_list[word_index]) and
                prog.match(input_question_word_list[word_index]) is None):
            correct_word = spell(input_question_word_list[word_index])
            input_question_word_list[word_index] = correct_word
    return " ".join(input_question_word_list)
github helloram52 / automated-event-extraction / Main.py View on Github external
def performSpellCorrection(featureObj):
    checker = SpellChecker("en_US", featureObj.getText())
    for word in checker:
        word.replace(spell(word.word))

    featureObj.getLexicalFeatures().setSpellCorrection(checker.get_text())

    return featureObj
github SaurabhThube / ocr-Template-matching- / pesp.py View on Github external
#for method in methods:
            for i in s:
                template = cv2.imread(i,0)
                res = cv2.matchTemplate(cropped,template,eval(methods[5]))
                min_val, max_val, min_loc, max_loc = cv2.minMaxLoc(res)
                if min_val
github pemagrg1 / NLP-Flask-Website / api.py View on Github external
def spell_check():
    text = request.form['text']
    spells = [spell(w) for w in (nltk.word_tokenize(text))]
    result = {
        "result": " ".join(spells)
    }
    result = {str(key): value for key, value in result.items()}
    return jsonify(result=result)