2
votes
Accepted
I don't get these errors
I'll pick one.
// Adds word to list
void append(const char *word, node *list)
What is this meant to do? I guess you pass a word and the pointer to the list head, and expect a new node to be added to ...
1
vote
Accepted
dictionary is allways null
this is problematic
fread(dict, 1, 999999, fopen(dictionary, "r"));
you can read one word at a time with fscanf, keep reading it in a loop until fscanf returns EOF.
1
vote
Accepted
trie speller check() function no mispellings
Your code is returning true if the first few characters form a valid word, ignoring the rest.
The code
if (current->is_word == true)
{
return true;
}
should be after the loop,...
1
vote
Accepted
PSET 4 - Speller Load Function giving SEG Fault at strcpy("cursor->word", word);
Remove the quotation marks around cursor->word. "cursor->word" is a pointer to some read-only location where exactly those characters ({'c', 'u', 'r', ...}), together with a null terminator, are ...
1
vote
Accepted
trie speller works on custom dict but misses mispellings on large dictionary
if (i == l - 1)
{
cursor->is_word = true;
}
would have to go behind
cursor = cursor->children[n];
because otherwise you ...
1
vote
Accepted
pset4 speller (hash) - check50 showing "handles substrings properly"
You have a "small" problem in check function, you actually go through the entire hash table without finding any match. What happens if strcasecmp () is zero? Why do you keep moving forward in the hash ...
1
vote
Accepted
Speller (hashtable) check-function marks everything as correct
I took a very quick glance at it and see this:
if (strcmp(word, wordcheck->word))
{
return true;
}
This tells me that you've assumed that strcmp returns true/...
1
vote
When I run valgrind, why do I see more allocs than the number of times I've malloc'ed memory?
Your size function shouldn't call the load function.
1
vote
Accepted
do not understand why check function checks new word against dictionary
No, not at all. You're conflating two different var names to be the same variable. Let's look at the code:
// Returns true if word is in dictionary else false
bool check(const char *word)
{
...
if ...
1
vote
Accepted
pset4 speller unload trie leaking memory
What's n meant to represent? Your recursive function is looping from 0 to n to unload the children, but n isn't the number of children, N is.
1
vote
Accepted
Pset4 speller segmentation fault in check functions when using larger files like holmes.txt
You're on the right track. The problem is definitely within the hash function.
I added a printf statement to print every word being checked to find out which word was triggering the seg fault. The ...
1
vote
Accepted
I keep getting the message that 'non-ASCII characters are not allowed outside of literals and identifiers.'
This has to be one of the most unique syntax errors I've seen in a while! You get today's award for something almost never seen! ;-)
Let's look at one of the lines that are causing the problem:
...
1
vote
Accepted
Speller is returning all the words as misspelled while using a hashtable?
Here's the main issue that's blocking your progress:
if (ptr -> word == wordt)
Your goal is obviously to see if the words are the same. Unfortunately, this will compare addresses in memory, ...
1
vote
Accepted
valgrind() causing IDE to shut down
The result of the comment discussion as an answer.
I still have no idea why the IDE would time out, I am guessing valgrind had a hell of a job counting all the occasions where you read from ...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
pset4-speller × 19speller × 8
pset4 × 5
trie × 5
pset5 × 3
speller-check × 3
c × 2
load × 2
hash-table × 2
pset4-speller-hashtable × 2
speller-hashtable × 2
cs50x × 1
error × 1
valgrind × 1
check × 1
dictionary × 1
make × 1
debugger × 1