Questions tagged [speller]

speller.c is one of the files that make up Problem Set 5, but it is already written by CS50 Staff and you may not alter it! Instead, you must implement your solution by altering three other component files: dictionary.c, dictionary.h, and Makefile.

Filter by
Sorted by
Tagged with
0
votes
2answers
15 views

PSET5 speller segmentation fault

Can anyone help with segmentation fault. I have tried running debug50 and aparently the fault hits at line "if (head -> next != NULL)" in the load function. Aparently "table" is ...
2
votes
1answer
24 views

What is the usage of creating DICTIONARY_H in pset5?

I cann't understand when to use the preprocessor directives as (ifndef, define ,etc.)? In dictionary.h, what is the importance of writing those statements? and regarding the reason that was mentioned ...
0
votes
1answer
15 views

Why are check50 and valgrind telling different things?

When I run help50 valgrind ./speller texts/lalaland/txt it returns ==1123== ==1123== HEAP SUMMARY: ==1123== in use at exit: 472 bytes in 1 blocks ==1123== total heap usage: 143,096 allocs, 143,...
0
votes
1answer
62 views

Speller not working! What's going on?

My function returns this: WORDS MISSPELLED: 375902 WORDS IN DICTIONARY: 143091 WORDS IN TEXT: 376904 TIME IN load: 0.02 TIME IN check: 1.20 TIME IN size: 0.00 TIME ...
0
votes
1answer
18 views

Check function pset5 speller

I've been stuck on this for hours, please help. bool check(const char *word) { char check_buffer[LENGTH + 1]; for(int i = 0; i < strlen(word); i++) { check_buffer[i] = word[i]; ...
0
votes
2answers
32 views

PSET5 Speller Load function skips the words from the dictionary

Struggling with the load function in speller for second week now. What I found using debug50 and placing "printf" between different lines of code is that the fscanf reads every second word ...
0
votes
2answers
41 views

Help In Solving Memory Leak For PSET5

I need to fix the memory leak error for me to complete pset5. When running my code, I get: :) dictionary.c exists :) speller compiles :) handles most basic words properly :) handles min length (1-char)...
0
votes
1answer
29 views

PSET 5: valgrind: memory marked as 'still reachable'

fortunately I finally made it through speller. The only thing remaining is a valgrind error: ==2226== HEAP SUMMARY: ==2226== in use at exit: 8,013,096 bytes in 143,091 blocks ==2226== total heap ...
0
votes
1answer
33 views

pset 5 - speller: Hash function gets stuck with strlen() and I don't know why. Furthermore I'm lacking memory

I have several problems with my speller code and debug50 wont help me. I sat in front of it for hours now. Just want to know, where to start. Have no clue. At first Debug50 gets stuck at strlen() in ...
0
votes
3answers
50 views

PSet 5 Speller: How can the program tell if the dictionary has been successfully freed?

I'm pretty sure I'm just being dumb, but I've been wracking my brain and I'm drawing a blank. I've completed 5/6 of the functions in Speller, but the unload function has me stumped- the description ...
0
votes
1answer
27 views

Problem set 5 - is this the correct way of inserting into a hash table?

So far I've been unable to get the dictionary to load properly in the speller problem set. The goal is to insert every word from the dictionary into a hash table. Is what I'm doing in the the line ...
0
votes
2answers
48 views

Speller.c, get correct result on my machine, wrong on check50

Good day, I am struggling with speller.c. When I run the program on my machine I get the correct result compared to the keys but then when I use check50 to check I get all wrong. I have narrowed the ...
0
votes
1answer
75 views

Output in Speller.c seems to match the staff solutions, but cannot seem to pass check50

This is what I happen to get when I run check50, which is weird, because when I do manual tests, I seem to match the keys. Other posts make me think this might be an issue of using the incorrect slug? ...
0
votes
1answer
31 views

pset5 - speller - recursion

// Implements a dictionary's functionality #include <stdio.h> #include <stdbool.h> #include <stdlib.h> #include <string.h> #include <strings.h> #include "dictionary....
0
votes
1answer
35 views

Pset 5 speller load function and word

I'm working on my load function to obtain the "word" from dictionary and I obtain one of the next message dictionary.c:59:28: error: use of undeclared identifier 'word'; did you mean 'load'? ...
0
votes
0answers
24 views

CS50 Speller (trie) - getting issues with apostrophes and substrings

searching for help with the task pset4/speller (using trie) :( handles words with apostrophes properly expected "MISSPELLED WORD...", not "MISSPELLED WORD..." :( handles ...
0
votes
2answers
46 views

Pset5 Speller,Check function isn't working as expected, strcasecmp always returns false

The problem is the word is found in loaded dictionary it's found but check function still returns false i've been like 7 days in this problem someone helps please, ((I'm Trying to test code ./speller ...
0
votes
1answer
19 views

Somehow I don't have any output when I run check50 on speller

After running check50, I got these results. https://submit.cs50.io/check50/0298620e7f016e3485ce95bb4bebaac5f12abbfd I'm not sure how come there are no outputs at all according to the link above. Here'...
0
votes
1answer
29 views

speller is case sensitive

I tried to convert each word to lower before hashing in check, but it seems like it didnt do anything :( however, in the output the misspelled word is now lower // Implements a dictionary's ...
0
votes
1answer
46 views

PSET5/Speller - Valgrind error: conditional jump, relates to table[i] array, but I've already initialized that (or have I?)?

I posted something similar a couple of days ago but have made progress since then. Specifically I found a couple of posts answered by Cliff B indicating the problem users had was that they hadn't ...
0
votes
1answer
17 views

speller getting different hashes in check and load

using some printf statements to debug it seems that when I hash a word in my load function I get a different value then when I hash it in my check function, even when the words are the same case. I'm ...
0
votes
1answer
25 views

speller returning a segmentation fault, unclear why

this is my dictionary.c implementation. I think the problem is speller since I've been printing my hash values from hash. I also have not yet implemented unload since I think I'm having some ...
0
votes
1answer
20 views

My program tells me there are no words misspelled when I use the large dictionary, although the small dictionary with cat.txt seems to work fine

My code passes all the check50 checks, apart from a small amount of memory leak (I think I'm unnecessarily allocating memory to my temporary nodes). When I run the small dictionary with cat.txt, it ...
0
votes
2answers
34 views

In PSET5/ Speller - Unload Valgrind says Conditional jump or move depends on uninitialised value(s)

So my code passes all the Check50 tests apart from the memory one. I have been playing around with this for ages, but don't understand what the problem is. Here's what valgrind says. And here's the ...
0
votes
1answer
32 views

My Code compiles but I am getting a leak “8,013,096 bytes in 143,091 blocks are still reachable in loss record 1 of 1”

I see that valgrind is saying that the leak is happening at malloc but I am not sure how to free it seeing where it is allocated (within loop). Please help. ''' // Implements a dictionary's ...
0
votes
1answer
27 views

speller: Testing myself works but check50 says it's producing no output

I have tried testing my code normally with the provided dictionaries and texts, and it seems to work, producing the expected results in a reasonable amount of time. However, when I use check50, it ...
0
votes
1answer
22 views

Pset 5- Output is correct but still cant pass check50

I am currently working on Pset5, Speller. My output seems to be identical with cs50's solution (mine is simply way slower), but I still can't pass check50, it simply shows a blank window for my output....
0
votes
2answers
53 views

Segmentation Fault on Speller's Load function

bool load(const char *dictionary) { FILE *dict = fopen(dictionary, "r"); if (dict == NULL) { return false; } char word[LENGTH + 1]; while (fscanf(dict, "%s&...
0
votes
2answers
36 views

Problem freeing memory in Speller hash function

I have a problem to free the memory for the variable lowercaseword, I try to do it above the return statement with free(lowercaseword), but then the program stops working and I get errors on check50. ...
0
votes
1answer
36 views

(Speller) Search Function returns each word given as false, And when i run Small Dictionary gives me Segmentation Fault

// Implements a dictionary's functionality #include <stdio.h> #include <stdbool.h> #include <stdlib.h> #include <string.h> #include <strings.h> #include <ctype.h> #...
0
votes
1answer
35 views

“Could not unload” error in pset4 speller

I am solving speller pset5. In check50 my code is wrong. Don't know why. dictionary.c:// Implements a dictionary's functionality #include <stdbool.h> #include <strings.h> #include <...
0
votes
0answers
15 views

PSet 5 Speller - Valgrind Segmentation Fault

I keep getting a hit on valgrind. It says to check line 99 but I know I free(cursor) before the end of the block :-( my entire code
0
votes
1answer
47 views

Word array sometimes filled with weird values - Speller

My code looks like this: (ignore the comments; they're old) // Implements a dictionary's functionality #include <stdbool.h> #include <string.h> #include "dictionary.h" #include &...
0
votes
1answer
14 views

Memory Leak Even Though Memory Freed - Speller

The error specifically refers to line 36, which is when memory is allocated to the node pointer "temporary" in the check function. At the end of the function, I am still freeing the code, ...
0
votes
1answer
14 views

PSet 5 Speller - Expected Identifier

Been stuck on Speller for 2 days and could really please use some help. My initial idea is just to create an array of linked lists with 26 buckets (N = 26) and very simply hash the words by only the ...
0
votes
1answer
21 views

The strcsecmp() function is not working as expected

I am currently trying to solve pset5, speller. I managed to write every funtion correctly except of the check() function. This is the check() function I wrote so far: // Returns true if word is in ...
0
votes
0answers
16 views

Speller - Compiles but Doesn't Hit Criteria for Completion

I've been having a lot of trouble with Speller. This compiles but almost all the criteria are red, for example it doesn't basic words properly, doesn't handle 1 char words or long words, etc. I'm not ...
0
votes
1answer
39 views

Hash Function in Speller - Use of Undeclared Identifier Error

I'm stuck on the speller assignment but it feels like the smallest thing to be stuck on....in my hash function I keep getting "use of undeclared identifier" for n and i. Usually if this ...
0
votes
1answer
29 views

Pset5: check returns hashtable pointers as NULL despite hashtable values printed correctly in load

My check function returns all hashtable indexes as NULL (I printed a known index of 124 and still returns NULL), despite all indexes printed correctly in load. I am not sure where exactly the problem ...
0
votes
1answer
28 views

Errors with Valgrind on Speller (Still Reachable) - PSET5

I am almost done with speller but when I pass it through valgrind, it says there are some mistakes. More specifically, it says a bunch of bytes are still reachable. I don't know whether my problem is ...
0
votes
1answer
46 views

When declaring an array of pointers that will be a hash table, do you have to set all the elements of the array to NULL?

In the distribution code for Speller in pset5, they include this line in dictionary.c // Hash table node *table[N]; Should I set every element in the array to NULL, because they are pointers? (the ...
0
votes
1answer
39 views

Struggling with PSET5 Speller valgrind problems (& possibly more)

I've been working on PSET5 for weeks now on & off and I'm becoming really frustrated. I think I'm lacking some understanding of the malloc/free relationship, I'm not sure. Here's all of my code. ...
0
votes
1answer
57 views

pset5 speller check function: cursor pointer keeps being NULL

I finished writing the code and tried to run the program, but it returned all words as misspelled. When I ran debug50 on the check function, it shows that the cursor pointer does not take the value of ...
0
votes
1answer
25 views

Trying to fix a segfault in unload , pset5, speller

So when I originally wrote my code for the dictionary.c, I forgot to create the header nodes for each 'bucket' in the hash table. It ran well when every first node of each linked list had a letter, ...
0
votes
0answers
19 views

trouble loading dictionary

my load function seems to only load two words and all words are coming back misspelled. I don't know if the problem is with my load function or the hash function. I've gone over the load function ...
0
votes
1answer
27 views

Speller skips last word in testfile I use

The title speaks for itself, but here is a bit more in-depth explanation. While my check() function runs, it always skips the last word in whatever file it is checking out. The source code for my ...
0
votes
1answer
57 views

CS50 Speller Not Free of Memory Errors

When I run check50 on my code, valgrind says: Conditional jump or move depends on uninitialised value(s): (file: dictionary.c, line: 34) 112 bytes in 2 blocks are still reachable in loss record 1 of 1:...
0
votes
2answers
44 views

Segmentation fault error in pset5

I did the speller and had some errors that I solved, but now I'm stuck and need help. I debug the load and hash (I know it's not ideal, but it works:)) Now I'm receiving the Segmentation fault error ...
0
votes
1answer
47 views

pset5 speller check50 error - code doens`t handle max length (45char)

i get this error from check50 and i can t figure out why...: :( handles max length (45-char) words expected "MISSPELLED WOR...", not "MISSPELLED WOR..." everything else is green (...
1
vote
1answer
37 views

speller - unload returns false …?

unload returns false and i am not sure why.... when i run Valgrind i get this: HEAP SUMMARY: ==7885== in use at exit: 608 bytes in 2 blocks ==7885== total heap usage: 143,096 allocs, 143,094 ...

1
2 3 4 5
17