Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add spell checker project #24

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

40thieves
Copy link
Contributor

Changelist

Adds a spell checker project.

I expect this would be a solo project - at least as it stands - but welcome feedback on extensions etc. I initially thought this might be a bit bigger in scope, but many of the interesting aspects of this project are in asking questions about their approach (e.g. "what might happen if you replaced Basic English with real English?"), and I think those are difficult to write a very precise rubric like I think we're aiming for here. Having said that I still think this is a decent standalone project.

@40thieves 40thieves requested a review from a team November 23, 2024 12:01
Copy link
Member

@SallyMcGrath SallyMcGrath left a comment

Choose a reason for hiding this comment

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

Nice! Simple

It doesn't ask for tests. I think we probably want something, even just console.asserts?

Project-Spell-Checker/README.md Outdated Show resolved Hide resolved
Project-Spell-Checker/README.md Outdated Show resolved Hide resolved
Project-Spell-Checker/README.md Show resolved Hide resolved
@40thieves
Copy link
Contributor Author

Not sure how I missed the testing & lighthouse points, but have now copied them over. Agree that they are both requirements that we want.

Copy link
Member

@illicitonion illicitonion left a comment

Choose a reason for hiding this comment

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

I just did this project, it's cute, but assuming we're not requiring re-styling input to show invalid words, it feels a little simple? My implementation is ~20 lines of ~trivial code.

If we are requiring re-styling input... That's an interesting, but quite big challenge...


Your task is to build your own spell checker for a simplified language called ["Basic English"](https://en.wikipedia.org/wiki/Basic_English) that contains a much smaller set of words than regular English. Use the list provided in `words.json`.

Make a website where a user can write some text and then check if the text is valid Basic English. You must **focus on HTML and JavaScript**. Some CSS can be used, but the website's design **is not the focus of the assessment**. We will assess you on correct logic, not on a pretty UI that is incomplete.
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
Make a website where a user can write some text and then check if the text is valid Basic English. You must **focus on HTML and JavaScript**. Some CSS can be used, but the website's design **is not the focus of the assessment**. We will assess you on correct logic, not on a pretty UI that is incomplete.
Make a website where a user can write some text and then check if the text is valid Basic English. You must **focus on HTML and JavaScript**. Some CSS can be used, but the website's design **is not the focus of the assessment**. We will assess you on correct logic. You will not pass if you produce a pretty UI that has missing or incorrect logic.


Your website should display an input, which allows the user to write some text. Your website should also have some way of triggering a spell check on the text that the user has written.

When the spell check is triggered, your website should check every word that the user has typed to see if it exists in the Basic English word list that we have provided (in `words.json`).
Copy link
Member

Choose a reason for hiding this comment

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

How are we expecting them to pull in words.json? Copying + pasting the array into their code? Importing it somehow?


When the user changes the text in the input, the warning about misspelled words should be cleared.

The input text can sometimes include punctuation (such as commas or full stops). Your website should not identify words that include some punctuation as spelling mistakes. So for example, "make a cake, please" will not highlight "cake" as a spelling mistake. However, if a word that is not in the Basic English word list and is next to some punctuation, it still should be highlighted as a spelling mistake.
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
The input text can sometimes include punctuation (such as commas or full stops). Your website should not identify words that include some punctuation as spelling mistakes. So for example, "make a cake, please" will not highlight "cake" as a spelling mistake. However, if a word that is not in the Basic English word list and is next to some punctuation, it still should be highlighted as a spelling mistake.
The input text can sometimes include punctuation (such as commas or full stops). Your website should not identify words that include some punctuation as spelling mistakes. So for example, "make a cake, please" will not highlight "cake" as a spelling mistake. However, if a word that is not in the Basic English word list and is next to some punctuation (e.g. "cakez,"), it still should be highlighted as a spelling mistake.

"lip",
"liquid",
"list",
"little (less, least)",
Copy link
Member

Choose a reason for hiding this comment

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

We should probably split+flatten this?

"mountain",
"mouth",
"move",
"much (more, most)",
Copy link
Member

Choose a reason for hiding this comment

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

We should probably split+flatten this?


When the user changes the text in the input, the warning about misspelled words should be cleared.

The input text can sometimes include punctuation (such as commas or full stops). Your website should not identify words that include some punctuation as spelling mistakes. So for example, "make a cake, please" will not highlight "cake" as a spelling mistake. However, if a word that is not in the Basic English word list and is next to some punctuation, it still should be highlighted as a spelling mistake.
Copy link
Member

Choose a reason for hiding this comment

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

Do we want to specifically cover punctuation in words?

e.g. is I've invalid? Is deep-cut (deep and cut are both valid)?


When the spell check is triggered, your website should check every word that the user has typed to see if it exists in the Basic English word list that we have provided (in `words.json`).

If there are any words that aren't in the Basic English word list, you should consider those words as a spelling mistake. All spelling mistakes should be presented to the user underneath the input, along with some text explaining that the words are misspelled. They should be highlighted in some way that makes it obvious that there is a spelling mistake.
Copy link
Member

Choose a reason for hiding this comment

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

I'm a little confused about this wording, specifically around highlighting.

Is appending "The following words are misspelled: veritable, cheeze" under the input sufficient for this to pass? Or does highlighting suggest the input should also be restyled in some way?


When the user changes the text in the input, the warning about misspelled words should be cleared.

The input text can sometimes include punctuation (such as commas or full stops). Your website should not identify words that include some punctuation as spelling mistakes. So for example, "make a cake, please" will not highlight "cake" as a spelling mistake. However, if a word that is not in the Basic English word list and is next to some punctuation, it still should be highlighted as a spelling mistake.
Copy link
Member

Choose a reason for hiding this comment

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

Do we want to enumerate what characters we consider punctuation?

- The website has a way for the user to triggering a spell check
- When triggered, the spell check should check every word in the input to see if it exists in the Basic English word list
- If the word does not exist in the word list, then it should be highlighted below the input as a spelling mistake
- It should be obvious to the user that there is a spelling mistake, both with visuals and some explanatory text
Copy link
Member

Choose a reason for hiding this comment

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

Do we want to specify the behaviour if there are no spelling mistakes? e.g. display a positive "All good" message vs just showing nothing special?

@40thieves
Copy link
Contributor Author

40thieves commented Jan 7, 2025

If we are requiring re-styling input... That's an interesting, but quite big challenge...

I think this is probably over the line of complexity - it's a surprisingly difficult task, often even for quite senior folks!

I just did this project, it's cute, but assuming we're not requiring re-styling input to show invalid words, it feels a little simple? My implementation is ~20 lines of ~trivial code.

I think we touched on this on a call and my memory is that it sounded like you had some ideas about ramping up the difficulty a bit? (Or possibly could have been Sally?)

If that's not correct, then I think I might lean towards closing this PR. I think this works well as an interview question as it's simple to get something working but difficult to extend/make scalable.

EDIT: I think we need to answer this question before addressing the specific points you made above - no point in addressing them unless we know we want to keep this :)

@illicitonion
Copy link
Member

If we are requiring re-styling input... That's an interesting, but quite big challenge...

I think this is probably over the line of complexity - it's a surprisingly difficult task, often even for quite senior folks!

Agreed!

I think we touched on this on a call and my memory is that it sounded like you had some ideas about ramping up the difficulty a bit? (Or possibly could have been Sally?)

I think off the top of my head possible extensions were...

  • Adding custom words to the dictionary (and re-evaluating the check)
  • Suggesting possible replacement words (possibly with some scaffolding, e.g. we could provide a calculateLevenshteinDistance function or something and just expect the trainees to use it)
  • Handling punctuation more interestingly (e.g. in-word punctuation, maybe handling hyphenated words as two independent words, passing "blue-green" because both "blue" and "green" are words)
  • Special-casing capitalised words assuming they're names ("I went to lunch with Ali" passes even though "ali" isn't in the dictionary)

They're all reasonably minor additions/tweaks, but maybe all of them together equal a reasonable individual project?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: 👀 In review
Development

Successfully merging this pull request may close these issues.

3 participants