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.

186 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
2
votes
2answers
89 views

2019 PSET4 SPELLER, I have no clue why it isn't working, I'm sure size and unload function is right, but unsure about load and check

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

Why do cs50/2018/x/speller, cs50/2018/x/mashup show looks good but give 4 / 5 for style?

I have run update50 and I'm still not seeing any style errors but I'm still getting 95% and 4/5 for style?
1
vote
0answers
43 views

Speller doesn't answer correctly

my code is // Implements a dictionary's functionality #include <stdbool.h> #include <stdio.h> #include <string.h> #include <stdlib.h> #include <strings.h> #include "...
1
vote
1answer
76 views

Speller (PSET5) has output that is exactly the same as the staff's solution, but check50 returns many errors. What's happening?

My speller program (part of pset5) works well and the output exactly matches that of the staff's solution. However, when I run my program through check50, I still get several errors per their script: ...
1
vote
1answer
45 views

Pset5 Speller — Conditional jump or move depends on uninitialised value(s); Uninitialised value was created by a stack allocation;

My code is able to pass all the tests in check50 except the valgrind one. Here is the error when I run the valgrind. Could someone help me, please? // Implements a dictionary's functionality #...
1
vote
1answer
238 views

My check function in speller isn't working

I have implemented everything else but this check function when I try to test it it seems like the the check function isn't working, because the no. of misspelled words is the same as the no. in text.....
1
vote
0answers
31 views

dictionary hints?

I just submitted my dictionary code to the Big Board. My results weren't horrific (well, I did use more memory than anyone else, lol); but I'm a little disheartened when comparing to the best results. ...
1
vote
1answer
191 views

pset5 cs50 does not handle basic words properly

Can you please help with the following issue with speller from pset5 in cs50: When I run the cs50 check, I get that it does not handle basic words properly, I am guessing, my check function is not ...
1
vote
1answer
527 views

Pset5 Speller load() function completely stuck (trie)

I am completely stuck on pset5 load() function, have no idea where to go. Can someone please guide me in the right direction? Here is my code: bool load(const char* dictionary) { // TODO FILE* file = ...
1
vote
0answers
115 views

Check50 seg. faulting on speller, locally works fine

I've been trying to fix this for days, sadly, it's almost impossible for me to try and figure out what's going on when my speller works perfectly fine locally. I tested running my program on every ...
1
vote
1answer
165 views

PSET5 Spell Check: strncmp strcmp problems

1) The rules state I can't change speller.c 2) Speller.c sends each word to the check function in dictionary.c 3) I am creating a copy of that word in my function and making it all lower-case 4) ...
0
votes
1answer
22 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
0answers
14 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
0answers
14 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
33 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
0answers
16 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
29 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
1answer
26 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 ...
0
votes
1answer
29 views

cs50 speller code complies and run also successfully. but it not qualifying for big board

:) dictionary.c and dictionary.h exist :) speller compiles :( qualifies for Big Board expected exit code 0, not 139 :| passes benchmarking can't check until a frown turns upside down how to fix this *...
0
votes
0answers
39 views

CS50 pset5 Speller - Code Does Not Compile Due to Issue with Hash Table/Load Function

I've been working on Speller for a little while now, but I've run into a roadblock. I finished my first draft of speller and have been clearing up errors until this point. Here's my dictionary.c so ...
0
votes
0answers
26 views

code can't handle substring property

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

CS50 Pset5 Speller

I am having problems with Pset 5 Speller. I believe, I'm nearly there, I can get all functions to run and compile successfully, however my outputs are not quite right. I have attached comments to make ...
0
votes
2answers
51 views

CS50 Speller returns all word as mispelled and I can't find any mistake in my code

I need help, I can't get around this problem set. I have searched everywhere and I think the code is equal to most of the other students... The problem is that the check function is returning true ...
0
votes
1answer
26 views

pset5 speller “Could not load dictionaries/large” error

#include <ctype.h> #include <stdbool.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <strings.h> #include "dictionary.h" #define ...
0
votes
0answers
33 views

CS50 Speller valgrind issues and

I'm new to CS and could really use some help on the speller pset. I've got a basic outline that doesn't seem to seg fault, but I'm still having issues. It fails check50 in that: it doesn't handle ...
0
votes
1answer
17 views

Struggling to understand file I/O

everyone. I'm just starting my journey in learning to code, starting with C. And for the past few months, I've been struggling to understand file I/O. More often than not, I don't get the output I'm ...
0
votes
0answers
27 views

pset5 - Conditional jump or move depends on uninitialised value(s)

Here is my code: // Implements a dictionary's functionality #include <stdbool.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <strings.h> #include ...
0
votes
1answer
50 views

Speller pset 5: Valgrind gives me error

I am doing pset 5 speller and It seems to be okey less valgrind check. Valgrind HELP50 gives me these errors ==22585== Use of uninitialised value of size 8 ==22585== at 0x40110B: hash (dictionary.c:...
0
votes
0answers
48 views

Almost Done… But substrings

// Returns true if word is in dictionary else false bool check(const char *word) { //Variables bool looping = true; int hashWord = hash(word); //Create a new pointers node *head = table[hashWord]; ...
0
votes
2answers
47 views

Pset 5 Help understanding Valgrind output

I was wondering if anyone could help me with interpreting the Valgrind error to trouble shoot. There are no memory leaks, but I am getting this error "Conditional jump or move depends on ...
0
votes
1answer
25 views

pset 5: Repeat Until?

Trying to read strings from file in the [load] function of speller. When using fscanf(), how do I start a while loop until it returns "EOF"? I think there's got to be an easy way to do this, ...
0
votes
1answer
58 views

CS50 pset5 segmentation fault

I've spent a whole day trying to solve pset5. When i try to run the code it kept showing "Segmentation fault". Here's what i get from Valgrind ==21210== HEAP SUMMARY: ==21210== in use at ...
0
votes
0answers
66 views

PSET 5 SPELLER - HELP!

i'm not sure why this happens when I execute the code. The program seems to never end as if it's running an infinite loop. When I run valgrind on it misspelled words keep spewing out and it gives me a ...
0
votes
1answer
24 views

PSET 5 SPELLER - segmentation fault

I keep getting a segmentation fault on my load function when using the debugger. Specifically, the line with "if(table[num]->next != NULL)" is what is causing it. I need some help, please....
0
votes
1answer
53 views

pset5 valgrind tests failed

I'm very close to completing pset5; all smiley faces except the Valgrind memory leak. I'm hoping someone can help find the problem. I am only leaking 112 bytes and have tried to fix the issue by ...
0
votes
1answer
42 views

PSET 5 My hash table doesn't seem to be storing correctly

When I load the dictionary, I add the words to the hash table, by calling the hash function to calculate the bucket ID, then add hash function to actually insert it into the list. Inside the addhash ...
0
votes
1answer
106 views

PSET 5 Speller Failing free memory of errors final check

So i am so close to finally completing this present and i still have some final errors to go through. Valgrind is saying that it is still leaking memory for some reason and i cant find the reason why. ...
0
votes
0answers
17 views

One block still reachable plus other advice

I am trying to do pset5 speller and am running into a lot of problems Can't figure out what the problem is here. https://pastebin.com/fBkFeDA9 Also saw that the hash function is giving out negative ...
0
votes
0answers
32 views

all my speller words are misseplled

// Implements a dictionary's functionality #include <stdbool.h> #include "dictionary.h" #include <stdio.h> #include <stdlib.h> #include <string.h> #include <...
0
votes
2answers
39 views

strcpy not working with struct items

bool load(const char *dictionary) { char splitStrings[9999][45]; FILE* dict = fopen(dictionary, "r"); node* item = table[0]; int i = 0; for (i = 0; fscanf(dict, "%...
0
votes
0answers
21 views

Help me with Pset5 filter

// Implements a dictionary's functionality include include "dictionary.h" include include include include define HASHTABLE_SIZE 1000 // Represents a node in a hash table typedef struct ...
0
votes
0answers
33 views

Help me with Pset 5 Speller

Help me Guys Where did i go wrong in my code // Implements a dictionary's functionality include include "dictionary.h" include include include include define HASHTABLE_SIZE 1000 // ...
0
votes
0answers
44 views

check50 keeps printing “Could not load basic/dict.” what might be the problem in the code?

// Implements a dictionary's functionality include include include include "dictionary.h" include include include // Number of buckets in hash table define N 120000 //maximum length of ...
0
votes
2answers
52 views

Valgrind errors: “invalid read of size 8” and “…uninitialised value” (pset5, speller)

I have basically finished the code, no memory leaking and tests work out fine. However, Valgrind is not happy: Conditional jump or move depends on uninitialised value(s): line 141 This is one of the ...
0
votes
1answer
208 views

Need help: pset5 “Speller”

I am having a strange issue with the pset5. When I debug the file, it works fine, but when I check it through Check50, it throws several frowns at me. Need suggestions. Here is my code: #include <...
0
votes
1answer
44 views

PSET5 Speller using trie memory leak

Could somebody help me identify the cause of the memory leak shown by Valgrind? Check50 says that there are no leaks, for some reason. Here is my code for dictionary.c // Implements a dictionary's ...
0
votes
1answer
28 views

pset 5 Seg Fault

I just wrote this code and in terms of ideas(of data structures), I really think it makes sense but it gets Segmentation fault. I am not sure about the unload function. Can you search for seg fault ...
0
votes
0answers
75 views

Shows double free or corruption (fasttop)

// Implements a dictionary's functionality #include <stdbool.h> #include <stdio.h> #include <string.h> #include <stdlib.h> #include "dictionary.h" // Represents a node in a ...
0
votes
1answer
76 views

Valgrind uninitialized values pset5

This is my solution for pset5's speller problem, which uploads a dictionary with a hash table and checks an inputed text to find misspelled words. My code works fine when I run, but valgrind says "...
0
votes
0answers
22 views

what can be rong with my check function? it returning handles substrings properly after checking

bool check(const char *word) { // TODO int exist = 0; int index = hash(word); for(node *temp = table[index]; temp != NULL; temp = temp->next) { if((strcasecmp(temp->word, word) == ...