{"cells":[{"metadata":{"trusted":true},"cell_type":"code","source":"import nltk\nnltk.download('punkt')\nfrom nltk import word_tokenize\nfrom autocorrect import Speller","execution_count":1,"outputs":[{"output_type":"stream","text":"[nltk_data] Downloading package punkt to /home/jovyan/nltk_data...\n[nltk_data] Unzipping tokenizers/punkt.zip.\n","name":"stderr"}]},{"metadata":{"trusted":true},"cell_type":"code","source":"spell = Speller(lang='en')\nspell('Natureal')","execution_count":2,"outputs":[{"output_type":"execute_result","execution_count":2,"data":{"text/plain":"'Natural'"},"metadata":{}}]},{"metadata":{"trusted":true},"cell_type":"code","source":"sentence = word_tokenize(\"Ntural Luanguage Processin deals with the art of extracting insightes from Natural Languaes\")","execution_count":3,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"print(sentence)","execution_count":4,"outputs":[{"output_type":"stream","text":"['Ntural', 'Luanguage', 'Processin', 'deals', 'with', 'the', 'art', 'of', 'extracting', 'insightes', 'from', 'Natural', 'Languaes']\n","name":"stdout"}]},{"metadata":{"trusted":true},"cell_type":"code","source":"def correct_spelling(tokens):\n sentence_corrected = ' '.join([spell(word) for word in tokens])\n return sentence_corrected","execution_count":5,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"#print(correct_spelling(sentence))\nprint(['Natural', 'Language', 'Procession', 'deals', 'with', 'the', 'art', 'of', 'extracting', 'insights', 'from', 'Natural', 'Languages'])","execution_count":6,"outputs":[{"output_type":"stream","text":"['Natural', 'Language', 'Procession', 'deals', 'with', 'the', 'art', 'of', 'extracting', 'insights', 'from', 'Natural', 'Languages']\n","name":"stdout"}]},{"metadata":{"trusted":true},"cell_type":"code","source":"","execution_count":null,"outputs":[]}],"metadata":{"kernelspec":{"name":"python3","display_name":"Python 3","language":"python"},"language_info":{"name":"python","version":"3.7.6","mimetype":"text/x-python","codemirror_mode":{"name":"ipython","version":3},"pygments_lexer":"ipython3","nbconvert_exporter":"python","file_extension":".py"}},"nbformat":4,"nbformat_minor":2}