Giter Club home page Giter Club logo

spell-checker-data-structures-using-c's Introduction

Spell Checker: Data Structures using C

๐ŸŽ“ Problem Set 4

  • Speller: Program that spell-checks a file after loading a dictionary of words from disk into memory. Includes run-time data output.
  • I wrote the following functions in dictionary.c: load, hash, size, check, and unload. The other code and files were provided by the instructor.

Speller Program Demo

๐Ÿ’กLessons Learned

  • Hash table and linked list data strutures
  • Implementing knowledge of pointers *n and next n -> next
  • Hashing words from a txt file into a hash table
  • Reading into and subsequently unloading dictionary from memory
  • Using malloc and command-line argument $ valgrind to prevent leaking memory and segmentation faults
  • Run time optimization and Big O analysis

๐Ÿš€ Getting Started

To run this project locally:

  • In your terminal, navigate to the filter directory and run the following commands
$	clang -ggdb3 -O0 -Qunused-arguments -std=c11 -Wall -Werror -Wextra  -Wno-sign-compare -Wno-unused-parameter -Wno-unused-variable -Wshadow -c -o speller.o speller.c
clang -ggdb3 -O0 -Qunused-arguments -std=c11 -Wall -Werror -Wextra -Wno-sign-compare -Wno-unused-parameter -Wno-unused-variable -Wshadow -c -o dictionary.o dictionary.c
clang -ggdb3 -O0 -Qunused-arguments -std=c11 -Wall -Werror -Wextra -Wno-sign-compare -Wno-unused-parameter -Wno-unused-variable -Wshadow -o speller speller.o dictionary.o -lm

๐Ÿ•น How to Use

  • In your terminal, navigate to this folder's root directory and run the following command
$ ./speller texts/foo.txt

Where foo is the name of a body of text found in the texts directory. There are 30 different texts to choose from. The output of the spell check program can be compared to the corresponding file in the keys directory for accuracy by running:

./speller texts/tolstoy.txt > bar.txt
$ diff -y bar.txt keys/baz.txt

Where bar is the name of the program's output file and baz is the name of the text analyzed

Analysis of results:

  • TIME IN load represents the number of seconds that speller spends executing the implementation of load.
  • TIME IN check represents the number of seconds that speller spends, in total, executing the implementation of check.
  • TIME IN size represents the number of seconds that speller spends executing the implementation of size.
  • TIME IN unload represents the number of seconds that speller spends executing the implementation of unload.
  • TIME IN TOTAL is the sum of those four measurements.

Quick use examples

./speller texts/tolstoy.txt
./speller texts/tolstoy.txt > your.txt
diff -y your.txt keys/tolstoy.txt

spell-checker-data-structures-using-c's People

Contributors

jacobgrisham avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.