Share your repls and programming experiences

← Back to all posts
spellcheck.py
h
PYer (2754)

spellcheck.py

This is a python library I coded to generate spelling suggestions. I was going to implement it into a chat robot later but I haven't done it yet. It basically checks for similarity between a typed word and a list of words. It runs throught 3 test cases to compare the order, position, and count of all letters in both words.
I hope you like it, and I'm interested to see what people (if any) create with this! I have supplied a few examples below of code and output:


Other possible results:


Commentshotnewtop
PYer (2754)

the example limit is 0.4. obviously no colors matched your query. if you had looked at the code you can see that you have the option to change it, or run it a different way. its the module I'm sharing. you aren't supposed to run the code but create code with it. If you didn't understand from the description, this is a module not a game or something. @DJWang

TheFlooBearer (7)

(In his defense, I think he was joking)@PYer

PYer (2754)

hmmmmmm... I thought he maybe believed it was a chatbot. @TheFlooBearer

PYer (2754)

the examples don't include all colors. its the module I'm sharing. you aren't supposed to run the code but create code. If you didn't understand from the description, this is a module not a game or something. @DJWang

hamzawsome7 (0)

when i run this code on my chatbot, it doesnt work

it looks like this:

import spellcheck
feeling = input("Hi, how are you feeling today? ")
feeling = feeling.lower()
goodfeel = 'cheerful contented delighted ecstatic elated glad joyful joyous jubilant lively merry overjoyed peaceful pleasant pleased thrilled upbeat'.split()

while feeling in goodfeel:
print('Cool...')
break

meant = spellcheck.comp_list(typ, opts, minsim=0.4)
print('Did you mean:', ', '.join(meant))

there are multiple errors including s=that there is a break without a loop. Also after changing the if to a while to solve that problem it says module 'spellcheck' has no attribute 'comp_list'

hamzawsome7 (0)

@hamzawsome7 the current code is:

import spellcheck
feeling = input("Hi, how are you feeling today? ")
feeling = feeling.lower()
goodfeel = 'cheerful contented delighted ecstatic elated glad joyful joyous jubilant lively merry overjoyed peaceful pleasant pleased thrilled upbeat'.split()

while feeling in goodfeel:
print('Cool...')
break

meant = spellcheck.comp_list(feeling, goodfeel, minsim=0.4)
print('Did you mean:', ', '.join(meant))

PYer (2754)

that code doesn't make logical sense. the position of the break does not make any sense. With some editing, I think I made it work like you wanted it to:

import spellcheck
feeling = input("Hi, how are you feeling today? ")
feeling = feeling.lower()
goodfeel = 'cheerful contented delighted ecstatic elated glad joyful joyous jubilant lively merry overjoyed peaceful pleasant pleased thrilled upbeat'.split()

if feeling in goodfeel:
  print('Cool...')
else:
  meant = spellcheck.comp_list(feeling, goodfeel, minsim=0.4)
  print('Did you mean:', ', '.join(meant))

@hamzawsome7

JoseOr1j (0)

Looks very promising and cool! Keep it up.

PYer (2754)

the examples don't include all colors. its the module I'm sharing. you aren't supposed to run the code but create code. If you didn't understand from the description, this is a module not a game or [email protected]

mwilki7 (867)

2.7182818284590452353602874713527

SixBeeps (1403)

@mwilki7 lim x→∞ (x + (1/x))^x