• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

Creating a spell checker - guidance/ideas?

 
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I need to create a spell checker with hashing. So far I pretty much made a hash table with linked lists but don't really know how to 'Mod' strings.
The code below is my Dictionary class which takes in a .txt file that is a word bank. with single alphabet letters before the start of the words with that letter.

ex.
a
airplain
apple
astronaut
b
ball
big
bunny
c
cat
cow
etc.....








Then i have a scan class in which i attempt to go through the linked lists and try to identify the strings. I don't even know :P




How would i check words for misspellings and compare them to the dictionary then provide options for the user to change the words?

Any help is very appreciative

also i forgot to include the OpenFile method which opens a short .txt doc that is misspelled.



 
lowercase baba
Posts: 13091
67
Chrome Java Linux
  • Likes 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ok...here is my advice:

Stop.

Throw this away. Do not keep working on this.

Why? I didn't have to get past your subject. Please read StopCoding. Then read its sister page at WhatNotHow.

Only after you follow all the instructions there should you consider writing a line of code.
 
Matt Wilde
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Point taken. Starting over. Thanks for the heads up





Are these even some plausible ideas? is there another way anyone suggests i should go about this?
 
Ranch Hand
Posts: 808
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Matt Wilde wrote:Are these even some plausible ideas? is there another way anyone suggests i should go about this?


This is nice, but it is still all written in terms of Java. We often want to start in with Java right away, because writing code is fun. Forget about Java. Forget about the computer. How would you, without the aid of a couputer, check the spelling in an excerpt of text? That's where you should start.
 
Matt Wilde
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Well, I would first start reading something. Then if i saw a word that did not look correct or i couldn't pronounce correctly, i would think back to all my years of vocabulary lessons in grade school and books i have read over the years and perhaps look in the dictionary for words that looked similar to that word. words that had the same general prefix or beginning?
 
Bartender
Posts: 3323
86
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This is good but it is a high level description of how you check the spelling of some text. For instance when you say:

"I would first start reading something" you really should say "for each word in the text" or "I look at the text and break it into individual words"

"Then if i saw a word that did not look correct ..." how do know you it doesn't look correct, as you say it is because you are referring to the words you have learned over time ie your internal dictionary. So maybe this should be "check every word against the dictionary to see if it is a known word".

Finding the correct spelling of an unknown word can be quite tricky to describe and even harder to compute. When you do come to code it I believe you can use the Damerau-Levenshtein distance to help find words that might be the correct ones, although there may also be other (possibly better) strategies. Google may help you here.
 
Bartender
Posts: 10780
71
Hibernate Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Matt Wilde wrote:The code below is my Dictionary class...


Matt,

Please DontWriteLongLines (←click).

I've broken yours (line 24) up this time, but I suggest you also re-read the UseCodeTags page again thoroughly.

Thanks.

Winston
 
I didn't like the taste of tongue and it didn't like the taste of me. I will now try this tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic