Need help converting 2 columns of output into a hashtable to measure character frequency count

I’ve got a file with sentences on each line. I read it in with

$dataset = get-content $filepath 

I want to create a character frequency count for each sentence. I’m trying to get a working example for just the first sentence. so far I have

$dataset[0].tocharArray() | group | sort -property Count -desc | select count, name 

How can I turn this into a hash table so that I can look for the total occurences of particular characters. For example, I want to know the total percentage of the screen that is , and ‘ characters.

I thought I could do something like $hashtable[“,”] + $hashtable[” ‘ “] = $total_count_of_special_cars

but I don’t know how to turn the output into a hash

Any help is appreciated

submitted by /u/thebigRword
[link] [comments]

Leave a Reply