Questions tagged [dictionary]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0
votes
1answer
109 views

Problem in unload

I am having problem in my unload. While running valgrind it shows no leaks, but the program wont acquiesce check50. Here is the unload function: //free the memory bool freenode(node *first) { //...
0
votes
2answers
185 views

Pset5 - Valgrind causes 9544106 errors, Uninitialised value was created by a heap allocation

Im unsure if there is any error in my recursion in unloading/unload to free all memory. (But i doubt so because help50 tells me all my memory were freed- 367,084 allocs, 367,084 frees) I checked ...
0
votes
1answer
101 views

pset5 speller dictionary errors

Can someone give me feedback on my code please? I can't compile this, and it says too many errors. A lot of the errors don't seem to make sense. For example, it says "error: use of undeclared ...
0
votes
2answers
869 views

(pset5) valgrind - 1 block not freed

I've grinding away at this one problem for a couple of days now, and can't quite work out what's going wrong. My code passes check50. The output is fine. I'm relatively happy with how quickly it runs. ...
0
votes
1answer
641 views

Need help with check in speller (trie)

Stuck on speller, especially check, but load has some problems too. I am using a trie, but I kind of regret choosing it, because it has been very tough. I believe my problem is with the use of *next ...
0
votes
1answer
987 views

pset5 speller Invalid write of size 1

my implementation of dictionary.c passes all checks using check50 except memory leaks. I'm using valgrind and most of my leaks seem to be happening in my check function: // Returns true if word is ...
0
votes
1answer
290 views

Segmentation Fault on Hashtable

PLease Someone help me I was trying to implement a hash table that stores the word of English language for pset 5. So to be in brief, I used an array of linked list ( Chaining ) , I haven't made the ...
0
votes
1answer
81 views

PSET5: load fails with large dictionary, but works with small dictionary - trie

I'm trying to use a trie structure to implement the load function in speller. I get a segmentation fault with the large dictionary, but not the small one. Text file size does not seem to matter, (I ...
0
votes
2answers
1k views

PSET5 Dictionary - error : Could not open texts files

I have a problem to open texts files related to pset5. I think that is nothing to do with my code. It's probably the way I ask in the command window or maybe my current directory. Is it the good way ...
0
votes
1answer
47 views

PSET5 speller: all words listed as mispelled and check50 gives substrings a sad face

I made my dictionary.c for my speller program, however... it lists the whole text as mispelled check50 gives a sad face for substrings, showing that in its testing, "cat" is listed as mispelled, ...
0
votes
1answer
80 views

too many misspelled words

I'm working on my spell checker, and everything seems to be compiling. However, when I run the spell checker, the number of words that it finds that are misspelled is way high. I'm not exactly sure ...
0
votes
1answer
99 views

Pset5 Speller Tries Valgring memory leak; don't undertand how unload works

The code works and I compared it with the staff's code it cought all the errors but it leaks memory. I don't know why isn't it freeing new_node. I also managed to make unload() work but I don't fully ...
0
votes
1answer
105 views

Stuck on the unload() function. Possibly wrong logic used on load() and check() using tries

I am using tries to complete the spellcheck but I just can't keep up with the logic. I've implemented load() and check() as much as I could but I'm sure it has some logic flaw. The unload() function ...
0
votes
1answer
25 views

dictionary - need some hints to target details why it doesn't work - please

So my code does compiles but it does print all the words as mispelled plus now i have a segmentation fault. Please i need so hints. here my codes : https://pastebin.com/4axfif3g
0
votes
1answer
87 views

Pset5 Dictionary C Struct Array Call In Load Function Issue

I've defined the struct as following: // Node struct typedef struct node { // Node value char word[LENGTH + 1]; // Node Pointer to next value/node struct node* ...
0
votes
1answer
126 views

PSET5 - Loads 0 words into dictionary

my code compiles and runs, but loads 0 words into the dictionary. Can you spot what's wrong with it? (As a sample, I tried using the smaller dictionary with a random text file. example syntax: "./...
1
vote
1answer
122 views

Memory leakage PSET 5

I've successfully implemented the dictionary and it fully works. When I run valgrind I get 2 nodes (224 bytes each) that are leaking. I really don't know how to fix this. Can someone help? ==1316== ...
0
votes
1answer
75 views

PSET 5: I've made a mistake somewhere in the load() function but can't pinpoint the problem

So currently I'm working on speller and I suspect that there's a mistake(s) in load(). When I run my code it does load without an error message and correctly checks some words successfully and fails ...
0
votes
1answer
380 views

Pset5 dictionary.c load and check: returning all words as misspelled?

Hi guys i've been spending hours on pset5 and for some reason it's showing all words as misspelled, i've checked ppl asking similar question but still couldn't get an answer, any suggestions would be ...
0
votes
1answer
169 views

Pset5 - thousands of errors using valgrind. Help?

I've successfully implemented the dictionary and it fully works (already submitted and got 100/100). But when I run valgrind I get9911215 errors from 6 contexts. I really don't know what that means or ...
0
votes
1answer
315 views

Speller(hashtable) flagging all words as misspelled

I've exhausted all my options which is why I'm making this post. When I simply run the program it prints every word as misspelled. The problem itself probably lies in load or check. Running the ...
0
votes
1answer
89 views

Pset5 load function doesn't load any words

Still getting segmentation fault and have updated code several times. Here is my most recent iteration and have also attached copy of valgrind report. /** * Loads dictionary into memory. Returns ...
0
votes
2answers
78 views

segfault in speller.c

Why do I get a segmentationfault when I run speller.c. I changed nothing in speller. so the mistake has to be in the dictionary.c file. Thanks for helping me in advance! /** * Implements a ...
0
votes
1answer
65 views

Pset5 Unload Giving Double Free or Corruption error

My title pretty much explains the problem. I can tell that the problem probably exists where I called free (marked in my code). Here's the code below: bool unload(void) { node* trav = head; ...
1
vote
1answer
66 views

Speller.c finds some words, but says that correct words are mispelled PSET 5 - Speller

After finishing writing my functions in dictionary.c, I have tried testing it out using austinpowers.txt, but the output is blatantly incorrect. (As seen in pastebin, 6259 words are incorrect.) Some ...
0
votes
1answer
320 views

PSET5: speller - Program terminated with signal SIGKILL, Killed. The program no longer exists

[Update] Hi, I get Killed when I run speller with the large dictionary. Upon trying to debug, I get the following when I run gdb. Program terminated with signal SIGKILL, Killed. The program no ...
0
votes
1answer
39 views

Speller, works for given dictionaries but not the ones used in check50: segmentation fault

my program works fine for the provided texts but fails check50 at handling the most basic words and every following check with the error: ... but received the following on standard error instead — /...
0
votes
1answer
121 views

handles possessives properly and substrings properly fail- pset5(trie)

bool check(const char *word) { int i; node *loader = root; for(int c = 0; word[c] != '\0'; c++) { if(isalpha(word[c])) { i = (tolower(word[c]) % 'a'); } if (word[c] ==...
0
votes
1answer
99 views

Pset 5 speller trie check function - check50 handles everything but possessives and substrings

this part seemed pretty straight forward. Am I missing something in my syntax or is it something more complicated in my check function that I'm missing? Cheers! :( handles possessives ...
0
votes
1answer
542 views

Why does this hash function fail?

unsigned int hash(const char *str) { unsigned int hash = 5381; int c; int i; size_t k= strlen(str)*1; char *str2=malloc(k+1); strcpy(str2,str); for(i=0;i<strlen(str);i++...
0
votes
1answer
1k views

pset5: dictionary not loading correctly

I took a bit of a break from cs50 and having come back to it I realised that there is a problem with my load function in pset5. Although the program tells me correctly which words are misspelled, the ...
0
votes
1answer
417 views

PSET5 Speller problem with apostrophes

I haven't been able to figure out why my code recognizes every word with apostrophes as a misspelled word. I was hoping someone can help me spot any problems with my code. Trying not to break the ...
0
votes
1answer
247 views

Pset5 - Could not open dictionary

My command line syntax is "./speller dictionaries/small.txt test" If I could PM someone my full code, I'd really appreciate it. I'm getting the error "Could not open dictionary." First lines of my ...
0
votes
1answer
55 views

PSET 5 Words not loading in memory

I think there might be something wrong with the fscanf use because when using gbd temp's value never changes, it stays as NULL. Also, word's value stays as 0 throughout the entire program and every ...
0
votes
1answer
18 views

PLEASE HELP How to contemplate the last line in dictionary (the empty one)

In both the small and large dictionaries the last line is empty which was causing my program to read an extra word. To prevent this I added an extra condition but it is now causing valgrind to have ...
0
votes
1answer
710 views

PSET 5: Dictionary.c, Trie structure, Check/Load, All words misspelled

I know there are some similar questions, but I can't figure this out. I have checked my check program by running printf functions through it, and it does iterate through all the letters properly (for ...
0
votes
1answer
84 views

Cannot load dictionary

Not sure what's wrong, I've been staring at this for days. It will not load any dictionary. bool load(const char *dictionary) { FILE *f = fopen(dictionary, "r"); if (f == NULL); { return ...
0
votes
1answer
535 views

Can I test implementation of load function in pset5 prior to completing check, size and unload

I have finished coding the load function for pset5 dictionary.c and want to see if it works (and confirm I am on the right track) before I go onto the other functions. I tried to execute speller.c but ...
1
vote
2answers
3k views

Try to use trie in pset5

I know if I want to use trie in pset5 to load the dictionary, there should be a struct containing an array of pointers for the alphabets or the apostrophe and a variable of bool. The question is, ...
1
vote
1answer
99 views

PSET5 Question about pointers

I had a question for dictionary.c. First, I'm still confused at why load and check imput is const char*. I understand that const char* means that the value that char* points to will never change and ...
1
vote
1answer
51 views

pset5 trie: What is the boolean-data value in the root node if the dictionary has one-letter words?

I think I understand how the children-nodes of a trie are supposed to work. But if the dictionary contains one-letter words like "a" and "I", what should the boolean-data value of the root node be? If ...
0
votes
2answers
299 views

Pset5, load skips first letters and the last word; Dictionary isn't loaded

I've used a dictionary I created and it's got 8 words. However, speller doesn't recognize the last one (it counts 7), but also it returns two words misspelled, even though all of them begin with ...
0
votes
1answer
196 views

2014 pset5: Double free in load

I can't seem to figure out how to allocate and free memory correctly when I'm using a linked list node (a pointer inside a struct). When I can get my code to run without error I am getting major ...
0
votes
0answers
159 views

pset5 load/check: seem to be inadvertently freeing my hashtable

I think I've implemented load in a (mostly) correct way. For the most part it seems to be sorting and loading into the hashtable correctly but I'm not sure. The problem I'm running into is that I ...
0
votes
0answers
104 views

a simple linked-list try

First of all, i need to say that i am just trying to check my code working or not. For the following code, i used a so-called small dictionary which only includes the words "caterpillar" and "cat". ...
0
votes
1answer
157 views

Kinda confused with what needs memory allocated in pset5

I wanted to give hashtables a go with pset5. I've set the struct up as: typedef struct node { char *data; struct node *next; } node; Every time I link a new node all of the node->data ...
0
votes
1answer
156 views

load check & unload

I've been trying to implement load using trie but I have been told that I have something wrong with the place of my declaration of root and with the way I'm handling EOF. I'm trying to fix it but I ...
2
votes
1answer
119 views

Unknown problem with dictionary.c Help!

dictionary.c doesn't compile, but i am not getting the usual error when I try to compile it. Instead I get something I haven't seen before and I have no clue what it is trying to tell me. Does anyone ...
0
votes
1answer
610 views

how do I malloc nodes for use in a trie data structure

How do I use malloc to allocate memory for use in a trie data structure given: typedef struct node { bool in_word; struct node* children[27]; } LETTERNODE; What is the syntax for malloc in ...
0
votes
1answer
940 views

Problems with hash function in pset5

I'm using a hash function I found online that's meant to be quick but it's throwing an error that I don't understand (and as I've cut and paste it, I don't get what the issue can be?). Everything else ...