<commit_before>﻿open System
open System.IO
open System.Linq
open System.Text.RegularExpressions

#time

let ``stop words`` = __SOURCE_DIRECTORY__ + "../stop_words.txt"
let ``p&p`` = __SOURCE_DIRECTORY__ + "../pride-and-prejudice.txt"
let test = __SOURCE_DIRECTORY__ + "../test.txt"

let stops = (File.ReadAllText ``stop words``).Split(',') |> Set.ofArray
let words = Regex.Matches((File.ReadAllText ``p&p``).ToLower(), "[a-z]{2,}") |> Seq.cast<Match> |> Seq.map (fun m -> m.Value)
let counts = words.Where(stops.Contains >> not).GroupBy(fun x -> x).Select(fun gr -> gr.Key, gr |> Seq.length)
counts |> Seq.sortByDescending snd |> Seq.take 25 |> Seq.iter (fun (w, n) -> printfn "%s - %d" w n)<commit_msg>- condensed style 6 even further<commit_after>﻿open System.IO
open System.Linq
open System.Text.RegularExpressions

#time

let stops = (File.ReadAllText <| __SOURCE_DIRECTORY__ + "../stop_words.txt").Split(',') |> Set.ofArray
let words = Regex.Matches((File.ReadAllText <| __SOURCE_DIRECTORY__ + "../pride-and-prejudice.txt").ToLower(), "[a-z]{2,}") 
            |> Seq.cast<Match> |> Seq.map (fun m -> m.Value)
let counts = words.Where(stops.Contains >> not).GroupBy(fun x -> x).Select(fun gr -> gr.Key, gr |> Seq.length)
counts |> Seq.sortByDescending snd |> Seq.take 25 |> Seq.iter (fun (w, n) -> printfn "%s - %d" w n)
{'fraction_non_alphanumeric': 0.19547169811320755, 'fraction_numerical': 0.005283018867924529, 'mean_word_length': 4.2, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 31, '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': '5007685', 'n_tokens_mistral': 505, 'n_tokens_neox': 494, 'n_words': 114}