Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

classic dictionary / hash table issue

 
f. nikita thomas
Ranch Hand
Posts: 87
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hey,
i have been staring at this for the last (2) hours and can't see where i'm going wrong. for the input (C) and C++ the file check comes back misspelled and i know "c"<yes "" because it's a String> is in the table. works fine other than that with the file he gave us. here is the code:




and ...




i know that a lot of the methods are superfluous, just experimenting with different io schemes. any help will be greatly appreciated. thanks.

nikita
[ April 17, 2008: Message edited by: f. nikita thomas ]
 
Campbell Ritchie
Sheriff
Posts: 48652
56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So what is it supposed to do, what is supposed to be in the file you are reading?
 
f. nikita thomas
Ranch Hand
Posts: 87
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
125000+ word dictionary which is then used to spell check another file. he had us hard code alot of stuff that i would have passed on the commandline but then he already makin' real bacon, so we dance to his tune ... if anyone wants the files, email me.
 
fred rosenberger
lowercase baba
Bartender
Pie
Posts: 12097
30
Chrome Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That's a lot of code for someone to wade through... especially when you admit "i know that a lot of the methods are superfluous". Can you whittle it down to the bare minimum needed to show the problem?

and i'm not even sure i understand the problem... you are spell checking a file, and the input has "(C)" in it. your checker say this is invalid, even though your dictionary has "c" in it. is that it?

can you change your input file to JUST have "(C)" in it and debug it with a lot of println() calls? does case matter? do the parens and ++ matter (in other words, pass in "c", "C", "(c" and "(C" and see how those work... maybe the characters after the word aren't being stripped.
[ April 17, 2008: Message edited by: Fred Rosenberger ]
 
f. nikita thomas
Ranch Hand
Posts: 87
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
give me a minute to "whittle" it down. yes fred, it is an infix issue.
 
f. nikita thomas
Ranch Hand
Posts: 87
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
here is the code. i cut it down as much as i could ...



 
f. nikita thomas
Ranch Hand
Posts: 87
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
modified the file, "C" and "c" got caught, "(C" and "(c" passed as expected. in all cases the punctuation was stripped. curious ...
 
Nicholas Jordan
Ranch Hand
Posts: 1282
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So what is "in the file he gave us" and is the data file multibyte?

Sounds to me like this is intermediate, not beginner. There are some subtle issues that can be of consequence in the search for this. Is the parser you are writing all in Java or is there a cross-platform linkage that can be looked at for ideas? I slapped together the following, it may or may not be correct. My first thought was to check for hash collisions. I ran this and found nothing so my next short list issue to look at is what platform the testing and development is being done on along with what the data file looks like.


[ April 17, 2008: Message edited by: Nicholas Jordan ]
 
f. nikita thomas
Ranch Hand
Posts: 87
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I rarely use capital letters for a good reason. I feel that they convey a different meaning when used. That being said, I apologize for posting this topic since I didn't check my data file; if I had I would have found that the reason I got the output I received is due in part that the dictionary file didn't have single letters. Live and learn. Take care.

nikita
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic