Discussion:
Q3 words in dictionary
(too old to reply)
tt
2011-06-15 13:05:00 UTC
Permalink
Is that possible the word 'a' is in the dictionary? If it is, what is
the number of apostrophes. The given executable returns 1, but should
it be 2?
Ian Toffelmire
2011-06-15 14:46:48 UTC
Permalink
Post by tt
Is that possible the word 'a' is in the dictionary? If it is, what is
the number of apostrophes. The given executable returns 1, but should
it be 2?
Considering the question states that you're supposed to take quotation
marks off that surround a word, I would expect the answer is "No, that
is not a possible word".
cs246
2011-06-15 16:49:50 UTC
Permalink
Post by Ian Toffelmire
Post by tt
Is that possible the word 'a' is in the dictionary? If it is, what is
the number of apostrophes. The given executable returns 1, but should
it be 2?
Considering the question states that you're supposed to take quotation
marks off that surround a word, I would expect the answer is "No, that
is not a possible word".
Actually inside your dictionary that is a valid word that could be
there, but you're right in that you would never actually match that word
from the input file because the apostrophes would be removed.

And to answer the original question, you are asked to find the number of
words with apostrophes inside them, so multiple apostrophes in 1 word is
still just one word.
--
-------------------------------------------------
John Munnings
CS 246 Tutor
School of Computer Science, UW
Office: DC3128
-------------------------------------------------
Jeremy Roman
2011-06-15 18:19:13 UTC
Permalink
Post by cs246
Post by Ian Toffelmire
Post by tt
Is that possible the word 'a' is in the dictionary? If it is, what is
the number of apostrophes. The given executable returns 1, but should
it be 2?
Considering the question states that you're supposed to take quotation
marks off that surround a word, I would expect the answer is "No, that
is not a possible word".
Actually inside your dictionary that is a valid word that could be
there, but you're right in that you would never actually match that word
from the input file because the apostrophes would be removed.
And to answer the original question, you are asked to find the number of
words with apostrophes inside them, so multiple apostrophes in 1 word is
still just one word.
For clarification, is it acceptable to consider words in the dictionary
which end in apostrophes to cause undefined behaviour?

For instance, the reference implementation does not count the word '''''
as a word containing an apostrophe (I presume because it is stripping
these when reading the dictionary). The assignment specification,
however, only specifies that punctuation should be stripped when reading
the input file (*not* the dictionary).

If this is undefined behaviour, I assume that it will not be tested. If
we are expected to match the behaviour of the reference implementation
in this regard, would it be possible to get clarification about when
punctuation should and should not be considered?
--
Jeremy Roman
Student, Computer Science
University of Waterloo
cs246
2011-06-15 18:57:38 UTC
Permalink
Post by Jeremy Roman
Post by cs246
Post by Ian Toffelmire
Post by tt
Is that possible the word 'a' is in the dictionary? If it is, what is
the number of apostrophes. The given executable returns 1, but should
it be 2?
Considering the question states that you're supposed to take quotation
marks off that surround a word, I would expect the answer is "No, that
is not a possible word".
Actually inside your dictionary that is a valid word that could be
there, but you're right in that you would never actually match that word
from the input file because the apostrophes would be removed.
And to answer the original question, you are asked to find the number of
words with apostrophes inside them, so multiple apostrophes in 1 word is
still just one word.
For clarification, is it acceptable to consider words in the dictionary
which end in apostrophes to cause undefined behaviour?
For instance, the reference implementation does not count the word '''''
as a word containing an apostrophe (I presume because it is stripping
these when reading the dictionary). The assignment specification,
however, only specifies that punctuation should be stripped when reading
the input file (*not* the dictionary).
If this is undefined behaviour, I assume that it will not be tested. If
we are expected to match the behaviour of the reference implementation
in this regard, would it be possible to get clarification about when
punctuation should and should not be considered?
Can you give me a case where it doesn't count ''''' as a word with an
apostrophe?

***@mef-linux018:~/A3$ cat dict
'''''
***@mef-linux018:~/A3$ ./spellcheck_64 dict input
Words not found in dictionary:

Dictionary statistics:
Dictionary size: 1
Usage factor: 0.031
Words with apostrophe: 1
***@mef-linux018:~/A3$
--
-------------------------------------------------
John Munnings
CS 246 Tutor
School of Computer Science, UW
Office: DC3128
-------------------------------------------------
Jeremy Roman
2011-06-15 19:30:50 UTC
Permalink
Post by cs246
Can you give me a case where it doesn't count ''''' as a word with an
apostrophe?
'''''
Dictionary size: 1
Usage factor: 0.031
Words with apostrophe: 1
I'd thought that it was because of that word, but it seems not.

It turns out that it was another of the words I was using that was
causing the issue. I apologize for the inconvenience.
(If you care, my dictionary contained some words with uppercase letters,
which caused the reference implementation to behave oddly; this is
undefined behaviour according to the spec, so it's fine.)

Thanks,
--
Jeremy Roman
Student, Computer Science
University of Waterloo
Loading...