module NGramCrackers.NGramCrackers (
  getNGramsFromString
, getNGramsFromList
, getAlphasOnlyToString
, getAlphasOnlyToList
) where

import Data.Char (isAlpha)
import ListManipulation

getNGramsFromString :: Int -> [Char] -> [String]
getNGramsFromString n wordString = (map unwords . getNGramsFromList n . words) $ getAlphasOnly wordString

getNGramsFromList :: Int -> [String] -> [[String]]
getNGramsFromList n wordList = getNSeqFromList n wordList 

{-| Return only alphabetic characters from a string and return the
    result as a string. Output of this function may need processing
    into a list, tuple, etc. -}
getAlphasOnlyToString :: [Char] -> [Char]
getAlphasOnlyToString = (unwords . map (filter (isAlpha)) . words)

getAlphasOnlyToList :: [Char] -> [String]
getAlphasOnlyToList = (map (filter (isAlpha)) . words)


module NGramCrackers.NGramCrackers (
  getNGramsFromString
, getNGramsFromList
, getAlphasOnlyToString
, getAlphasOnlyToList
) where

import Data.Char (isAlpha, toLower)
import ListManipulation

bigrams :: [Char] -> [String]
bigrams wordString = getNGramsFromString 2 wordString

getNGramsFromString :: Int -> [Char] -> [String]
getNGramsFromString n wordString = map unwords $ getNGramsFromList n wordList
    where wordList = getAlphasOnlyToList wordString

getNGramsFromList :: Int -> [String] -> [[String]]
getNGramsFromList n wordList = getNSeqFromList n wordList 

{-| Return only alphabetic characters from a string and return the
    result as a string. Output of this function may need processing
    into a list, tuple, etc. -}
getAlphasOnlyToString :: [Char] -> [Char]
getAlphasOnlyToString = (unwords . map (filter (isAlpha)) . words)

getAlphasOnlyToList :: [Char] -> [String]
getAlphasOnlyToList = (map (map toLower) . map (filter (isAlpha)) . words)


Add bigrams function and update cleaning function
Add bigrams function and update cleaning function

 -- Construct bigram wrapper around getNGramsFromString
 -- Updated getAlphasOnlyToString string to make things all
    lowercase. This gets confuzzling on sentence boundaries.
    May need do sentence parsing of some sort.
