Haskell-Data-Analysis-Cookbook/Ch03/README.md
2014-06-12 22:19:26 -04:00

1.6 KiB
Raw Permalink Blame History

Chapter 3

Chapter 3, The Science of Words, introduces common string manipulation algorithms including base conversions, substring matching, and computing the edit distance.

This is the accompanying source code for Haskell Data Analysis Cookbook. Refer to the book for step-by-step explanations.

Recipes

  • Code01: Displaying a number in another base
  • Code02: Reading a number from another base
  • Code03: Searching for a substring using Data.ByteString
  • Code04: Searching a string using the BoyerMooreHorspool algorithm
  • Code05: Searching a string using the Rabin-Karp algorithm
  • Code06: Splitting a string on lines, words, or arbitrary tokens
  • Code07: Finding the longest common subsequence
  • Code08: Computing a phonetic code
  • Code09: Calculating the edit distance between two strings
  • Code10: Computing the JaroWinkler distance between two strings
  • Code11: Finding strings within one-edit distance
  • Code12: Fixing spelling mistakes using edit distance

How to use

Setting up the environment

Install the Haskell Platform.

$ sudo apt-get install haskell-platform

Alternatively, install GHC 7.6 (or above) and Cabal.

$ sudo apt-get install ghc cabal-install

Running the code

A Makefile is provided in each recipe. Compile the corresponding executable by running make.

$ make

Run the resulting code. For example,

$ ./Code01

To clean up the directory:

$ make clean