Skip to content
← Back to Community
spellcheck.py
Profile icon
PYer

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:

image
Other possible results:
image
image
image

Voters
Profile icon
CoolJames1610
Profile icon
CodingGoose
Profile icon
Acer123
Profile icon
hamzawsome7
Profile icon
bonnym512
Profile icon
Atari7
Profile icon
Pythonier
Profile icon
TristanMisja
Profile icon
SilentShadowBla
Profile icon
DJWang
Comments
hotnewtop
Profile icon
DJWang
Profile icon
PYer

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

Profile icon
SamuelPKuld

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

Profile icon
PYer

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

Profile icon
SamuelPKuld

Okay @PYer

Profile icon
DJWang

@TheFlooBearer Haha no I didn't

Profile icon
SamuelPKuld
Profile icon
DJWang
Profile icon
PYer

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

Profile icon
hamzawsome7

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'

Profile icon
hamzawsome7

@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))

Profile icon
PYer

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

Profile icon
JoseOr1j

Looks very promising and cool! Keep it up.

Profile icon
PYer

thanks! @JoseOr1j

Profile icon
Andi_Chin

I like this program

Profile icon
PYer

thanks! @Andi_Chin

Profile icon
SixBeeps
Profile icon
PYer

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]

Profile icon
MrEconomical

i'd give it an e

Profile icon
[deleted]
Profile icon
mwilki7

2.7182818284590452353602874713527

Profile icon
SixBeeps

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