Skip to content
This repository has been archived by the owner on Oct 10, 2024. It is now read-only.

Typo checker and fixer added - Closes #771 #788

Merged
merged 2 commits into from
Nov 8, 2023

Conversation

juhandergod
Copy link
Contributor

@juhandergod juhandergod commented Oct 20, 2023

Fixes Issue

Closes #771

Changes proposed

Hey,
This PR fixes the issue for checking words with typos (#771). In the issue there were different discussions about using some type of NLTK spell checker library. For that use case I added typo-js-ts lib with defined dictionary for US language. In addition I added some additional logic to remove the non alphabetic characters from each word, and if those characters are removed, then it can check for the typos, and use the first suggestion for that word.

++
I added a testing dependency to the project (called jest) to test my new functionaly and cover some older components.
Updated the Readme, and the build.yml workflow.

Added:

  • Created typoFixer component using the typo-js-ts dependency for spell checking

  • Created unit tests for typoFixer component ( typoFixer.test.ts )

  • Created unit test for stripSpecialCharacter component (stripSpecialCharacter.test.ts )

  • Added dependencies:

    • typo-js-ts dependency - Spell checker dependency
  • Added en_US dictionary for typo-js-ts dependency:

    • (en_US.aff, en_US.dic)
  • Added dev-dependencies for testing with jest:

    • @babel/preset-env
    • @babel/preset-typescript
    • @jest/globals
    • @types/jest
    • jest
    • ts-jest

Changed:

  • Updated package.json scripts section with a new script for running tests
  • Updated README.md with Running the tests section
  • Updated build.yml github workflow action with run tests step
  • Updated dependencies:
    • mongoose upgraded to version 6.4.6
    • @types/express upgraded to version 4.17.20
    • @types/node upgaded to version 14.18.63
    • typescript upgraded to version 4.9.5

Check List (Check all the applicable boxes)

  • My code follows the code style of this project.
  • My change requires changes to the documentation.
  • I have updated the documentation accordingly.
  • All new and existing tests passed.
  • This PR does not contain plagiarized content.
  • The title of my pull request is a short description of the requested changes.

Screenshots

image

Note to reviewers

Should I update the changelog, or is that generated automatically?

@juhandergod juhandergod marked this pull request as ready for review October 21, 2023 12:50
Copy link
Member

@eddiejaoude eddiejaoude left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the pull request. Some of my thoughts...

✅ great you added tests 🚀

Would this not cause a problem when people use a word like picking?

@juhandergod
Copy link
Contributor Author

Hey @eddiejaoude , thanks for your response.

I added one test case to check if it will fix the word picking or not. It will remain the same.

But you are right. This addition can produce false positives. That's the reason why I added these libraries for typo-js-ts locally. This can be changed anytime, and fix any false positive issues.
I tried it locally to produce some false positives, but I couldn't.

Copy link
Member

@eddiejaoude eddiejaoude left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the contribution 👍 It looks good 🚀

Personally I prefer to have the test files in the tests directory, but this can always be moved later

@eddiejaoude eddiejaoude merged commit 5bba98f into EddieHubCommunity:main Nov 8, 2023
2 checks passed
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[BUG] Can't find duplicate letter words
2 participants