Questions tagged [dictionary]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0
votes
1answer
85 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
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
309 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
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
63 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; ...
0
votes
1answer
86 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
1answer
153 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 ...
1
vote
1answer
60 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
352 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
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
284 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
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 ...
1
vote
1answer
121 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
461 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
396 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
112 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: "./...
0
votes
1answer
230 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
17 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
703 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
83 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
108 views

Pset 5 Dictionary TRIE Segfault

I know posting the while code is not cool, but I frankly can't figure out what is wrong anymore. I should have done this with something easier than trie-structure, but since it is close to done I'd ...
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
773 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
155 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
96 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 ...
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 ...
0
votes
1answer
888 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 ...
0
votes
1answer
135 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
207 views

Implementing a trie. Updated load function in dictionary.c causes more problems with valgrind

I've been trying to fix an error that valgrind indicated came from my load() function. So in the beginning I implemented load() like this: http://pastebin.com/57a2HPMg Doing so only produced 1 error ...
0
votes
1answer
1k views

Can't figure out memory leak pointed out by valgrind in dictionary.c

Having implemented the functions within dictionary.c, I tried running speller.c but was given the error double free or corruption (!prev). And so I ran speller.c through valgrind and got the message ...
0
votes
1answer
199 views

pset5 Misspellings - passes check50 - doesn't work with larger text file

I've been pulling my hair out over Misspellings and I've finally got it to the point where is passes check50. Though when I run the code with austinpowers.txt for example, it says I have 19188 ...
0
votes
1answer
91 views

Pset5 600 out 644 words misspelled. What am I missing?

I can't seem to figure out what I'm doing wrong here... It loads the correct amount of words and checks them but its missing some when it comes to finding the misspellings. Can anyone spot what I'm ...
0
votes
1answer
176 views

pset5 dictionary and valgrind

I am currently working on pset5 and having some issues with errors that were identified by valgrind. My dictionary program seems to run fine- it passes the check50 and it is almost as fast as the ...
0
votes
1answer
220 views

Speller is not giving expected out

I have been trying to implement and re-implement speller but so far, I haven't been so lucky. This is what I get for a custom smaller dictionary and a text file: MISSPELLED WORDS nice WORDS ...
0
votes
1answer
250 views

My program “works” just fine but it won't pass check50?

I'm having some issues debugging my program from Problem Set 5: Mispellings. Well after struggling a couple of hours, here's some background: 1. My check function seems to work just fine, as well as ...
0
votes
2answers
283 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
248 views

Speller - Tries - Check function does not work

I have implemented load successfully. When I run speller, words load until the end of file. However, my check function does not work and according to GDB, speller stops when appending chars to word, ...
1
vote
2answers
274 views

Problem in my unload function (double free or corruption)

so I have been straggling pset5 for some time and I end up getting double free or corruptionand don't now how to fix it. Here's my code : /* inside load() */ // some code if(head->children[b] == ...
0
votes
1answer
938 views

Valgrind still reachable memory

For my pset5 speller program valgrind is saying that i have still reachable memory. This is the output: HEAP SUMMARY: ==24516== in use at exit: 352 bytes in 1 blocks ==24516== total heap usage: ...
0
votes
1answer
117 views

pset5 invalid reads/writes

My speller programs compile and run with no issues however valgrind doesn't seem to think so. I initially used malloc and manually initialised each pointer to null and the boolean to false. I have ...
0
votes
1answer
93 views

Speller thoroughly modified yet still fails tests pset5

I have put many controls into the code, simplified the hash function, used gdb extensively, all which suggest the code works yet it still fails the tests, especially words like Still, Home, Video, ...
0
votes
1answer
85 views

pset5: I am leaking all of my memory. What am I missing?

This problem set is becoming my bane. I have spent hours on it and I am still getting the same issues with valgrind (definitely losing 7 million bytes). I think my issues lie with load and check and ...
0
votes
2answers
1k views

Pset5 Speller - segmentation fault is driving me crazy!

Hey guys! I have been working on pset5 for a while and I keep on obtaining a seg fault. I have alreay run valgrind but it gives me no error. I cannot really see where is the problem. Any help will be ...
0
votes
1answer
340 views

dictionary check50 returns \ expected output, not standard error of “/opt/sandbox50/bin/run.sh: line 31: 102…”

My dictionary implementation appears to work as my program's output matches the staff exactly. Check50 is giving me the error below for every check starting with handles most basic words \ ...
0
votes
1answer
601 views

pset 5 dictionary problems

I am having problems with pset 5. Honestly so far I have never had such a huge problems with a pset. I watched every video, read many questions and answers on stack exchange and wrote some code, which ...
0
votes
1answer
23 views

changes to code in appliance not being applied

I am working on pset5 dictionary.c, I had it working and now it is not. I have been tinkering with the code but every time I save dictionary.c and then execute make dictionary.c, the response is "...
0
votes
2answers
232 views

PSET5 - Help with Valgrind? error : “uninitialised value(s)”

I have ran speller in valgrind to see if there was memory leaks and its appears that all memory allocated have been freed. But, I get many errors of type : "Conditional jump or move depends on ...
0
votes
1answer
117 views

Why does this PSET 5 Load function segfault?

typedef struct node { char word[LENGTH+1]; struct node* next; }node; node *bucket[65530]={NULL}; unsigned int count=0; bool load(const char* dictionary) { FILE* inptr = fopen(dictionary, "r"...