mirror of
https://github.com/BinRoot/Haskell-Data-Analysis-Cookbook.git
synced 2024-09-11 06:15:31 +03:00
.. | ||
Code01_base1 | ||
Code02_base2 | ||
Code03_substring | ||
Code04_bm | ||
Code05_rk | ||
Code06_split | ||
Code07_lcs | ||
Code08_phon | ||
Code09_edit | ||
Code10_jw | ||
Code11_edit1 | ||
Code12_spell | ||
LICENSE | ||
README.md |
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 Boyer–Moore–Horspool 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 Jaro–Winkler 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