<commit_before>import System.Environment
import Data.GraphViz.Types.Graph
import Data.GraphViz.Commands.IO
import YakGraph

iograph :: String -> IO (DotGraph String)
iograph  = readDotFile

main = do
    [repoGit,pathToFile] <- getArgs 
    g <- iograph pathToFile
    putStrLn $ show.listOfClusterNames $ g
    putStrLn $ show.listOfNodesPerCluster $ g
    putStrLn $ show.countOfNodesPerCluster $ g<commit_msg>output list of graph's clusters count from a file's commit<commit_after>import System.Environment
import Data.GraphViz.Types.Graph
import Data.GraphViz.Commands.IO
import Data.GraphViz.Parsing
import Data.Text.Lazy(pack)
import Data.Maybe(fromJust)

import YakGraph
import YakGit

iograph :: String -> DotGraph String
iograph  = parseIt'.pack

-- |Output cfddata for a given file in a given repo
--
-- >>> outputCfdData "test-repo" "planning.dot" >>= return . head
-- "foo"
outputCfdData :: FilePath        -- ^Path to git repo
                 -> FilePath     -- ^File (expect graphviz format) to extract data from
                 -> IO [String]  -- ^CFD Data extracted from graph file's content
outputCfdData gitrepo filename = do
  commits <- gitCommitsForFile gitrepo filename
  contents <- mapM (gitContentOfFileAtCommit gitrepo filename . gitHash) commits 
  return $ map (show . countOfNodesPerCluster . iograph . fromJust) contents

  
main = do
    [repoGit,pathToFile] <- getArgs
    cfdData <- outputCfdData repoGit pathToFile
    mapM_ putStrLn cfdData
{'fraction_non_alphanumeric': 0.08666215301286391, 'fraction_numerical': 0.0, 'mean_word_length': 3.5617283950617282, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 12, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '837958', 'n_tokens_mistral': 469, 'n_tokens_neox': 453, 'n_words': 134}