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
0answers
3 views

Speller segmentation fault

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

Speller: Load function only reads 9 words to memory

I finished coding all functions for the pset5. However, all my tests result in the same output: Words in Dictionary: 9 It does not matter which texts I am running. But, I cannot find my fault in the ...
0
votes
0answers
55 views

Why it shows "free(): double free detected in tcache 2" in speller?

I am working on pset5 and speller assignment. Here is my code: // Implements a dictionary's functionality #include <stdbool.h> #include <string.h> #include <strings.h> #include &...
0
votes
1answer
11 views

Clang error when compiling (Pset 5)

I tried googling this but I couldn't find (or understand) much. I'm receiving the following error when I go to make dictionary: Here is my code for the load portion:
0
votes
1answer
25 views

Pset 5 speller: segmentation fault for large dictionary

I can't figure out what I am doing wrong, have gone through many questions and walkthroughs of this problem and it still looks like it should be correct. It obviously is not! With a small and medium ...
0
votes
1answer
25 views

I just can't figure out how to put the word into lowercase for the hash function to provide the same index

bool check(const char *word) { char mot2[46]; for (int o = 0, h = strlen(word); o < h + 1; o++) { mot2[o] = tolower(word[o]); } int y = hash(word); node *cursor = table[y]; while (cursor != ...
0
votes
1answer
25 views

I have no idea why my speller in pset5 is giving the wrong amount of misspelled words

I am not sure where my mistake is, I keep getting too many misspelled words. This is the link to check 50 I run on the code: https://submit.cs50.io/check50/ce552ed87b7d99ac966d9ba7a897bda34bf0a794 // ...
0
votes
1answer
25 views

Program is free of memory errors, valgrind tests failed - pset5 speller

I'm am getting this error - program is free of memory errors, valgrind tests failed; see log for more information. I have tried so many things but I keep getting more errors. Here is my code: // ...
0
votes
1answer
48 views

Pset5 speller load

I am having an issue with my load function in pset5 speller, I really can't tell what's going on. I've gone back and rewatched the lectures and have redone my code a few times but just can't figure it ...
0
votes
1answer
18 views

pset5 speller Hash table not appearing in the debug50 stack/heap

This question is related with this other question of mine, in which I am trying to complete pset5: speller. I took Cliff's advice, and additionally executed the debug50 on my code. Since the original ...
0
votes
1answer
31 views

pset5 speller memory errors with valgrind

i've been working in pset5 and cannot make it work. I've read some similar questions and made some improvements to my code, but still can't figure what is wrong. Any tips are welcomed! Here is my code:...
0
votes
1answer
417 views

PSET5 compiles but gives: "free(): double free detected in tcache 2" error on testing

Been scratching my head at this for a while now. I use FREE() only once in the program, and don't know why I get this error. Any help is appreciated :-) // Implements a dictionary's functionality #...
0
votes
1answer
30 views

PSET5 Why Speller can't load dictionary? (included HASH function in case it's relevant)

// Load function bool load(const char *dictionary) { char word[LENGTH + 1]; FILE *file = fopen("dictionary", "r"); if (file == NULL) { printf(&...
0
votes
1answer
24 views

Speller not handling substrings properly

All tests seem to pass okay apart from the substrings test.The results of this test are : :( handles substrings properly expected "MISSPELLED WOR...", not "MISSPELLED WOR..." Log ...
0
votes
1answer
38 views

Help with check function (PSET5)

My check function is counting the right amount of words in dictionary and text, but it outputs words that are not misspelled. Here are all the functions of the problem, the arrays are used to locate ...
0
votes
1answer
25 views

Speller code doesn't handle apostrophes and substrings properly

this is my code: https://pastebin.com/hJfQH6Vb Any help is appreciated.
1
vote
1answer
46 views

Pset 5, Speller, What are the issues in my code(Check or load issues?)?

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

The load function in speller is returning a seg fault

I've run the debugger on my faulty program and reached the conclusion that the main that's causing the problem is among the following: while(fscanf(f, "%s", term) != EOF) { ...
0
votes
1answer
36 views

Speller still isn't running correctly

I rectified the earlier error in my code (putting dictionary within inverted commas). I also corrected my error in unload where the function would always return false instead of true. However, I ...
0
votes
1answer
33 views

pset5 - speller "double free detected" when I run check 50 but program does nothing during self tests

I am currently doing Speller. I have written all the functions and the program compiles but during self testing it is printing "misspelled words" and stays stuck at a blinking cursor. It ...
0
votes
1answer
26 views

Getting a segmentation fault on cs50's speller (pset5)

I would love a bit of help on cs50's pset5 speller. The program does compile. However, when I run valgrind ./speller texts/cat.txt I get a segmentation fault . I think I am overlooking something but I ...
0
votes
1answer
29 views

problems in unload function-pset5

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

dictionary.c - pset5 segmentation fault

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

CS50 PSET 5 SPELLER - Valgrind issues

I have been trying to figure out what is wrong with my code for a while, running through valgrind and the like. Sorry for the large wall of text, but if you could help me figure out just what one of ...
0
votes
1answer
47 views

Problem Set 5 - Segmentation Fault

I am trying to overcome the segmentation fault on the following code, and I couldn't manage to solve the error. Segmentation fault occurs in the load() function, and after hours of debugging, I couldn'...
0
votes
0answers
21 views

CS50 Speller: valgrind test says that bytes are still reachable in 3 blocks

I'm currently at the CS50's pset5, and am working on the "Speller" problem. I managed to do all functions and don't have any compile or runtime errors. When using check50, though, I receive ...
0
votes
0answers
25 views

My program is showing Segmentation Fault

I am working on pset5 speller. When I am running my program it is showing segmentation fault. And I am not quite sure why. Please look into it. here is my code: // Implements a dictionary's ...
0
votes
1answer
57 views

Where am I making a mistake?

I am solving problem set5, speller. My program is compiling correctly, but I am not sure exactly what the output is supposed to be. My program is not even getting approved from the check50. Here is ...
0
votes
1answer
30 views

Speller skips first word in dictionary

After chasing down and eliminating memory leaks, I think I am getting close to finishing speller. So far, valgrind says no memory leaks, and the output is formatted correctly. However, when running my ...
0
votes
1answer
27 views

pset5 speller all words are spelled wrong

new error: most words are seen as spelling error Here's my full code: (UPDATED) // Implements a dictionary's functionality #include <stdbool.h> #include <string.h> #include <stdio.h>...
0
votes
1answer
34 views

70-90 Extra Misspellings - Any ideas?

I did ask this on Ed Forums so my apologies if you're sick of seeing it - but I'm still so stuck!!! I get almost the right number of misspelled words on whatever text I use but it's off by the first ...
1
vote
2answers
57 views

PSET 5 SPELLER - Passing Valgrind but not Check50

I am very close to solving this, my code is returning 0 errors from Valgrind when I run that on its own, but its not passing the memory errors parameter in check50, so I'm very confused. Any help ...
1
vote
1answer
51 views

PSET 5 Load and Hash seg fault

I've update the code somewhat. Mostly fixing my hash function so it will run properly with non alphabetical words. Three hours into this though and I still can't seem to figure it out. I know now it ...
1
vote
1answer
49 views

PSET 5 Load Function woes

Back with more questions about my code. 1) fscanf: When using fscanf do we need to iterate through what it is writing to the buffer to check for the null signifier so we can jump in and strcpy that ...
0
votes
1answer
30 views

Why won't my Speller correctly identify misspelled words?

See the code below. I initially had some segmentation fault issues, but now everything compiles OK and valgrind indicates no issues. However, running check50, the output indicates that my program isn'...
0
votes
2answers
42 views

pset5 speller passess all checks except valgrind. no memory leaks but errors raised. confused

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

speller identifies most words as mispelled

Despite memory problems to be fixed, my code compiles fine and runs but returns almost every word that it checks as mispelled. I have spent so long looking at all this now that I am worried it just ...
0
votes
1answer
68 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
36 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
31 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
127 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
43 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
62 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
46 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
52 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
54 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
60 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
37 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
51 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
94 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? ...

1
2 3 4 5
17