MLH-Fellowship / orientation-project-python-23.SUM.A

Orientation Project (Python) for 23.SUM.A
1 stars 12 forks source link

Feat/spell check on content #38

Open galadd opened 1 year ago

galadd commented 1 year ago

Description: This pull request addresses https://github.com/MLH-Fellowship/orientation-project-python-23.SUM.A/issues/11 Spell check on content added by user. It aims to check that Experience, Education and Skill do not contain any spelling errors.

Key Changes: The spell_check function has been written to utils.py, and function implementation to function experience, education and skill for both post and put method request in app.py.

Benefits: This would help in situations where a user has made an error during inputs. The function returns its correction

Testing: The test covers the format of return, which is to return the misspelled word alongside the sentence or phrase it was in. Test covers the post and put request for each of experience, education and skill

galadd commented 1 year ago

@Henoven I am done with the issue. Please, review

wrussell1999 commented 1 year ago

@galadd before this gets merged, can you clarify how this works and what it's actually doing to check spelling?

galadd commented 1 year ago

Hello @wrussell1999

The user input is checked for spelling errors before any other operations are performed on it. This is done for POST and PUT methods. (Right after req = request.get_json()). It iterates through each word, and check s if the spelling is in the dictionary. It ignores cases like logo links, special names and numbers. If there's a spelling error, it returns this format

[    
    {        
        "before": "Hellq there",        
        "after": "Hello there"    
    }
]
Henoven commented 1 year ago

Hello @wrussell1999

The user input is checked for spelling errors before any other operations are performed on it. This is done for POST and PUT methods. (Right after req = request.get_json()). It iterates through each word, and check s if the spelling is in the dictionary. It ignores cases like logo links, special names and numbers. If there's a spelling error, it returns this format

[    
    {        
        "before": "Hellq there",        
        "after": "Hello there"    
    }
]

Firstly, congratulations on the PR @galadd ! It has a great description, behavior testing, and improved O(n) efficiency.

Regarding the behavior, I want to make sure I understand it correctly and address some potential edge cases. It seems that the feature performs a spelling check every time a user makes a POST or PUT request, which is fantastic. However, I noticed that we don't currently provide an option for the user to request this review. In issue #11, it was mentioned that the user should be able to request this revision. With the current implementation, users don't have the choice to opt out of a spelling review. What if they don't want a review because they are using acronyms or words in a language other than English? Are we considering these scenarios?

To tackle these concerns, I have a couple of ideas for simple solutions that can cover these edge cases:

Let me know what you think about these suggestions!

galadd commented 1 year ago

Let me know what you think about these suggestions!

This makes sense. My initial approach to it was to leave values that could potentially be acronyms or in other languages unchanged. But I'll look to the specifically requesting for a review

galadd commented 1 year ago

Hello @Henoven

Thank you very much for the review I have just added the update. Please review, and let me know if there's anything else I need to clarify

galadd commented 1 year ago

@Henoven