Skip to content

Instantly share code, notes, and snippets.

@PrateekKumarSingh
Last active December 6, 2016 19:28
Show Gist options
  • Select an option

  • Save PrateekKumarSingh/a37fe3799abc1137d47e844640bc8c8a to your computer and use it in GitHub Desktop.

Select an option

Save PrateekKumarSingh/a37fe3799abc1137d47e844640bc8c8a to your computer and use it in GitHub Desktop.
#Get important words that where length is greater than 3 to avoid - in, on, of, to, by etc
$FrequencyDistribution = $Content.split(" ") |?{-not [String]::IsNullOrEmpty($_)} |`
%{[Regex]::Replace($_,'[^a-zA-Z0-9]','')} |group |sort count -Descending
$ImportantWords = $FrequencyDistribution |?{$_.name.length -gt 3} |`
select @{n='ImportanceWeight';e={$_.Count * 0.01}}, @{n='ImportantWord';e={$_.Name}} -First 10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment