namespace Preprocessing
module Normalization =
open System.Text.RegularExpressions
// Detect sentence boundaries
let splitParagraph (paragraph: string) =
paragraph.Replace(".", "XXXX")
.Replace("?", "XXXX")
.Replace("!", "XXXX")
.Split("XXXX")
|> Array.map (fun xs -> xs.Replace("XXXX", "").Trim())
|> Array.filter (fun xs -> xs.Length <> 0)
/// Check for *only* words (Regex)
let getOnlyWords (text: string): string=
let onlyWords = Regex(@"(?<!\S)[a-zA-Z]\S*[a-zA-Z](?!\S)")
text.Replace(",", "")
.Replace(";", "")
.Replace(":", "")
.Trim()
.ToLowerInvariant()
|> onlyWords.Matches
|> Seq.cast<Match>
|> Seq.map (fun m -> m.Value)
|> String.concat(" ")
/// Non-exhaustive map of english contractions
let englishContractions: Map<string, string>=
[
("aren't", "are not")
("can't", "cannot")
("could've", "could have")
("couldn't", "could not")
("dammit", "damn it")
("didn't", "did not")
("doesn't", "does not")
("don't", "do not")
("dunno", "do not know")
("everybody's", "everybody is")
("everyone's", "everyone is")
("gimme", "give me")
("gonna", "going to")
("gotta", "got to")
("hadn't", "had not")
("had've", "had have")
("hasn't", "has not")
("haven't", "have not")
("here's", "here is")
("how'll", "how will")
("how're", "how are")
("i'll", "I will")
("i'm", "I am")
("imma", "I am about to")
("innit", "is it not")
("i've", "I have")
("isn't", "is not")
("it'd", "it would")
("kinda", "kind of")
("let's", "let us")
("ma'am", "madam")
("mayn't", "may not")
("may've", "may have")
("methinks", "I think")
("mightn't", "might not")
("might've", "might have")
("mustn't", "must not")
("mustn't've", "must not have")
("must've", "must have")
("needn't", "need not")
("shan't", "shall not")
("should've", "should have")
("shouldn't", "should not")
("shouldn't've", "should not have")
("that're", "that are")
("there're", "there are")
("these're", "these are")
("these've", "these have")
("they'll", "they will")
("they've", "they have")
("they're", "they are")
("those're", "those are")
("those've", "those have")
("wanna", "want to")
("wasn't", "was not")
("we'd've", "we would have")
("we'll", "we will")
("we're", "we are")
("we've", "we have")
("weren't", "were not")
("what'd", "what did")
("what've", "what have")
("where'd", "where did")
("where're", "where are")
("where've", "where have")
("which're", "which are")
("which've", "which have")
("who'd've", "who would have")
("who're", "who are")
("who's", "who has")
("who've", "who have")
("why'd", "why did")
("why're", "why are")
("won't", "will not")
("would've", "would have")
("wouldn't", "would not")
("wouldn't've", "would not have")
("you'll", "you will")
("you're", "you are")
("you've", "you have")
] |> Map
/// Tryfind contraction and expand
let expand (word: string): option<string>=
if word.Contains("'") then
match englishContractions.TryFind word with
| Some expandedWord -> Some expandedWord
| None -> None
else Some word
let expandContractions (textItem: string) =
textItem.Split(" ")
|> Array.choose expand
|> String.concat(" ")
module Tokenization =
/// NGrams Tokenizer
let nGrams (n: int) (text: string) =
text.Split(" ")
|> Array.windowed n
|> Array.map (String.concat(" "))
module NltkData =
let stopWords =
Set [
"i"
"me"
"my"
"myself"
"we"
"our"
"ours"
"ourselves"
"you"
"you're"
"you've"
"you'll"
"you'd"
"your"
"yours"
"yourself"
"yourselves"
"he"
"him"
"his"
"himself"
"she"
"she's"
"her"
"hers"
"herself"
"it"
"it's"
"its"
"itself"
"they"
"them"
"their"
"theirs"
"themselves"
"what"
"which"
"who"
"whom"
"this"
"that"
"that'll"
"these"
"those"
"am"
"is"
"are"
"was"
"were"
"be"
"been"
"being"
"have"
"has"
"had"
"having"
"do"
"does"
"did"
"doing"
"a"
"an"
"the"
"and"
"but"
"if"
"or"
"because"
"as"
"until"
"while"
"of"
"at"
"by"
"for"
"with"
"about"
"against"
"between"
"into"
"through"
"during"
"before"
"after"
"above"
"below"
"to"
"from"
"up"
"down"
"in"
"out"
"on"
"off"
"over"
"under"
"again"
"further"
"then"
"once"
"here"
"there"
"when"
"where"
"why"
"how"
"all"
"any"
"both"
"each"
"few"
"more"
"most"
"other"
"some"
"such"
"no"
"nor"
"not"
"only"
"own"
"same"
"so"
"than"
"too"
"very"
"can"
"will"
"just"
"don"
"don't"
"should"
"should've"
"now"
"ain"
"aren"
"aren't"
"couldn"
"couldn't"
"didn"
"didn't"
"doesn"
"doesn't"
"hadn"
"hadn't"
"hasn"
"hasn't"
"haven"
"haven't"
"isn"
"isn't"
"ma"
"mightn"
"mightn't"
"mustn"
"mustn't"
"needn"
"needn't"
"shan"
"shan't"
"shouldn"
"shouldn't"
"wasn"
"wasn't"
"weren"
"weren't"
"won"
"won't"
"wouldn"
"wouldn't"
]
let removeStopWords (textItem: string) =
let remaining =
textItem.Split(" ")
|> Array.filter (fun word -> not (stopWords.Contains word))
if Array.isEmpty remaining then None else Some (remaining |> String.concat(" "))
module TermFrequencies =
let tf bow =
let docTokenCounts =
Seq.sumBy snd bow
bow
|> Array.map (fun (token, count) ->
let tf = (float count)/(float docTokenCounts)
token, tf)
|> Array.sortByDescending snd
let idf bows=
let numDocs = Seq.length bows
bows
|> Seq.collect (Seq.map fst)
|> Seq.countBy id
|> Seq.map (fun (token, numDocsWithToken) ->
let idf = (float numDocs) / (float numDocsWithToken)
token, log idf)
|> Seq.sortByDescending snd
|> Seq.toArray
let tfIdf (idf : Map<'Token, float>)
bow =
let idfPrior =
idf
|> Map.toArray
|> Array.averageBy snd
tf bow
|> Array.choose (fun (token, tf) ->
match idf.TryFind token with
// Word appeared in train
| Some idf ->
let tfIdf = tf * idf
Some (token, tfIdf)
// Word did not appear in train
| None ->
let tfIdf = tf * idfPrior
Some ("UNK", tfIdf))
namespace Preprocessing
namespace System
namespace System.Text
namespace System.Text.RegularExpressions
val splitParagraph : paragraph:string -> string []
val paragraph : string
Multiple items
val string : value:'T -> string
<summary>Converts the argument to a string using <c>ToString</c>.</summary>
<remarks>For standard integer and floating point values the and any type that implements <c>IFormattable</c><c>ToString</c> conversion uses <c>CultureInfo.InvariantCulture</c>. </remarks>
<param name="value">The input value.</param>
<returns>The converted string.</returns>
--------------------
type string = System.String
<summary>An abbreviation for the CLI type <see cref="T:System.String" />.</summary>
<category>Basic Types</category>
System.String.Replace(oldValue: string, newValue: string) : string
System.String.Replace(oldChar: char, newChar: char) : string
System.String.Replace(oldValue: string, newValue: string, comparisonType: System.StringComparison) : string
System.String.Replace(oldValue: string, newValue: string, ignoreCase: bool, culture: System.Globalization.CultureInfo) : string
module Array
from Microsoft.FSharp.Collections
<summary>Contains operations for working with arrays.</summary>
<remarks>
See also <a href="https://docs.microsoft.com/dotnet/fsharp/language-reference/arrays">F# Language Guide - Arrays</a>.
</remarks>
val map : mapping:('T -> 'U) -> array:'T [] -> 'U []
<summary>Builds a new array whose elements are the results of applying the given function
to each of the elements of the array.</summary>
<param name="mapping">The function to transform elements of the array.</param>
<param name="array">The input array.</param>
<returns>The array of transformed elements.</returns>
<exception cref="T:System.ArgumentNullException">Thrown when the input array is null.</exception>
val xs : string
val filter : predicate:('T -> bool) -> array:'T [] -> 'T []
<summary>Returns a new collection containing only the elements of the collection
for which the given predicate returns "true".</summary>
<param name="predicate">The function to test the input elements.</param>
<param name="array">The input array.</param>
<returns>An array containing the elements for which the given predicate returns true.</returns>
<exception cref="T:System.ArgumentNullException">Thrown when the input array is null.</exception>
property System.String.Length: int with get
val getOnlyWords : text:string -> string
Check for *only* words (Regex)
val text : string
val onlyWords : Regex
Multiple items
type Regex =
interface ISerializable
new : unit -> unit + 4 overloads
member GetGroupNames : unit -> string []
member GetGroupNumbers : unit -> int []
member GroupNameFromNumber : i: int -> string
member GroupNumberFromName : name: string -> int
member InitializeReferences : unit -> unit
member IsMatch : input: string -> bool + 4 overloads
member Match : input: string -> Match + 5 overloads
member Matches : input: string -> MatchCollection + 4 overloads
...
<summary>Represents an immutable regular expression.</summary>
--------------------
Regex(pattern: string) : Regex
Regex(pattern: string, options: RegexOptions) : Regex
Regex(pattern: string, options: RegexOptions, matchTimeout: System.TimeSpan) : Regex
Regex.Matches(input: string) : MatchCollection
Regex.Matches(input: string, startat: int) : MatchCollection
module Seq
from Microsoft.FSharp.Collections
<summary>Contains operations for working with values of type <see cref="T:Microsoft.FSharp.Collections.seq`1" />.</summary>
val cast : source:System.Collections.IEnumerable -> seq<'T>
<summary>Wraps a loosely-typed System.Collections sequence as a typed sequence.</summary>
<remarks>The use of this function usually requires a type annotation.
An incorrect type annotation may result in runtime type
errors.
Individual IEnumerator values generated from the returned sequence should not be accessed concurrently.</remarks>
<param name="source">The input sequence.</param>
<returns>The result sequence.</returns>
<exception cref="T:System.ArgumentNullException">Thrown when the input sequence is null.</exception>
type Match =
inherit Group
new : unit -> unit
member NextMatch : unit -> Match
member Result : replacement: string -> string
static member Synchronized : inner: Match -> Match
member Groups : GroupCollection
static member Empty : Match
<summary>Represents the results from a single regular expression match.</summary>
val map : mapping:('T -> 'U) -> source:seq<'T> -> seq<'U>
<summary>Builds a new collection whose elements are the results of applying the given function
to each of the elements of the collection. The given function will be applied
as elements are demanded using the <c>MoveNext</c> method on enumerators retrieved from the
object.</summary>
<remarks>The returned sequence may be passed between threads safely. However,
individual IEnumerator values generated from the returned sequence should not be accessed concurrently.</remarks>
<param name="mapping">A function to transform items from the input sequence.</param>
<param name="source">The input sequence.</param>
<returns>The result sequence.</returns>
<exception cref="T:System.ArgumentNullException">Thrown when the input sequence is null.</exception>
val m : Match
property Capture.Value: string with get
<summary>Gets the captured substring from the input string.</summary>
<returns>The substring that is captured by the match.</returns>
module String
from Microsoft.FSharp.Core
<summary>Functional programming operators for string processing. Further string operations
are available via the member functions on strings and other functionality in
<a href="http://msdn2.microsoft.com/en-us/library/system.string.aspx">System.String</a>
and <a href="http://msdn2.microsoft.com/library/system.text.regularexpressions.aspx">System.Text.RegularExpressions</a> types.
</summary>
<category>Strings and Text</category>
val concat : sep:string -> strings:seq<string> -> string
<summary>Returns a new string made by concatenating the given strings
with separator <c>sep</c>, that is <c>a1 + sep + ... + sep + aN</c>.</summary>
<param name="sep">The separator string to be inserted between the strings
of the input sequence.</param>
<param name="strings">The sequence of strings to be concatenated.</param>
<returns>A new string consisting of the concatenated strings separated by
the separation string.</returns>
<exception cref="T:System.ArgumentNullException">Thrown when <c>strings</c> is null.</exception>
val englishContractions : Map<string,string>
Non-exhaustive map of english contractions
Multiple items
module Map
from Microsoft.FSharp.Collections
<summary>Contains operations for working with values of type <see cref="T:Microsoft.FSharp.Collections.Map`2" />.</summary>
--------------------
type Map<'Key,'Value (requires comparison)> =
interface IReadOnlyDictionary<'Key,'Value>
interface IReadOnlyCollection<KeyValuePair<'Key,'Value>>
interface IEnumerable
interface IComparable
interface IEnumerable<KeyValuePair<'Key,'Value>>
interface ICollection<KeyValuePair<'Key,'Value>>
interface IDictionary<'Key,'Value>
new : elements:seq<'Key * 'Value> -> Map<'Key,'Value>
member Add : key:'Key * value:'Value -> Map<'Key,'Value>
member Change : key:'Key * f:('Value option -> 'Value option) -> Map<'Key,'Value>
...
<summary>Immutable maps based on binary trees, where keys are ordered by F# generic comparison. By default
comparison is the F# structural comparison function or uses implementations of the IComparable interface on key values.</summary>
<remarks>See the <see cref="T:Microsoft.FSharp.Collections.MapModule" /> module for further operations on maps.
All members of this class are thread-safe and may be used concurrently from multiple threads.</remarks>
--------------------
new : elements:seq<'Key * 'Value> -> Map<'Key,'Value>
val expand : word:string -> string option
Tryfind contraction and expand
val word : string
type 'T option = Option<'T>
<summary>The type of optional values. When used from other CLI languages the
empty option is the <c>null</c> value. </summary>
<remarks>Use the constructors <c>Some</c> and <c>None</c> to create values of this type.
Use the values in the <c>Option</c> module to manipulate values of this type,
or pattern match against the values directly.
'None' values will appear as the value <c>null</c> to other CLI languages.
Instance methods on this type will appear as static methods to other CLI languages
due to the use of <c>null</c> as a value representation.</remarks>
<category index="3">Options</category>
System.String.Contains(value: string) : bool
System.String.Contains(value: char) : bool
System.String.Contains(value: string, comparisonType: System.StringComparison) : bool
System.String.Contains(value: char, comparisonType: System.StringComparison) : bool
member Map.TryFind : key:'Key -> 'Value option
union case Option.Some: Value: 'T -> Option<'T>
<summary>The representation of "Value of type 'T"</summary>
<param name="Value">The input value.</param>
<returns>An option representing the value.</returns>
val expandedWord : string
union case Option.None: Option<'T>
<summary>The representation of "No value"</summary>
val expandContractions : textItem:string -> string
val textItem : string
System.String.Split([<System.ParamArray>] separator: char []) : string []
System.String.Split(separator: string [], options: System.StringSplitOptions) : string []
System.String.Split(separator: string,?options: System.StringSplitOptions) : string []
System.String.Split(separator: char [], options: System.StringSplitOptions) : string []
System.String.Split(separator: char [], count: int) : string []
System.String.Split(separator: char,?options: System.StringSplitOptions) : string []
System.String.Split(separator: string [], count: int, options: System.StringSplitOptions) : string []
System.String.Split(separator: string, count: int,?options: System.StringSplitOptions) : string []
System.String.Split(separator: char [], count: int, options: System.StringSplitOptions) : string []
System.String.Split(separator: char, count: int,?options: System.StringSplitOptions) : string []
val choose : chooser:('T -> 'U option) -> array:'T [] -> 'U []
<summary>Applies the given function to each element of the array. Returns
the array comprised of the results "x" for each element where
the function returns Some(x)</summary>
<param name="chooser">The function to generate options from the elements.</param>
<param name="array">The input array.</param>
<returns>The array of results.</returns>
<exception cref="T:System.ArgumentNullException">Thrown when the input array is null.</exception>
val nGrams : n:int -> text:string -> string []
NGrams Tokenizer
val n : int
Multiple items
val int : value:'T -> int (requires member op_Explicit)
<summary>Converts the argument to signed 32-bit integer. This is a direct conversion for all
primitive numeric types. For strings, the input is converted using <c>Int32.Parse()</c>
with InvariantCulture settings. Otherwise the operation requires an appropriate
static conversion method on the input type.</summary>
<param name="value">The input value.</param>
<returns>The converted int</returns>
--------------------
[<Struct>]
type int = int32
<summary>An abbreviation for the CLI type <see cref="T:System.Int32" />.</summary>
<category>Basic Types</category>
--------------------
type int<'Measure> =
int
<summary>The type of 32-bit signed integer numbers, annotated with a unit of measure. The unit
of measure is erased in compiled code and when values of this type
are analyzed using reflection. The type is representationally equivalent to
<see cref="T:System.Int32" />.</summary>
<category>Basic Types with Units of Measure</category>
val windowed : windowSize:int -> array:'T [] -> 'T [] []
<summary>Returns an array of sliding windows containing elements drawn from the input
array. Each window is returned as a fresh array.</summary>
<param name="windowSize">The number of elements in each window.</param>
<param name="array">The input array.</param>
<returns>The result array.</returns>
<exception cref="T:System.ArgumentNullException">Thrown when the input array is null.</exception>
<exception cref="T:System.ArgumentException">Thrown when windowSize is not positive.</exception>
val stopWords : Set<string>
Multiple items
module Set
from Microsoft.FSharp.Collections
<summary>Contains operations for working with values of type <see cref="T:Microsoft.FSharp.Collections.Set`1" />.</summary>
--------------------
type Set<'T (requires comparison)> =
interface IReadOnlyCollection<'T>
interface IComparable
interface IEnumerable
interface IEnumerable<'T>
interface ICollection<'T>
new : elements:seq<'T> -> Set<'T>
member Add : value:'T -> Set<'T>
member Contains : value:'T -> bool
override Equals : obj -> bool
member IsProperSubsetOf : otherSet:Set<'T> -> bool
...
<summary>Immutable sets based on binary trees, where elements are ordered by F# generic comparison. By default
comparison is the F# structural comparison function or uses implementations of the IComparable interface on element values.</summary>
<remarks>See the <see cref="T:Microsoft.FSharp.Collections.SetModule" /> module for further operations on sets.
All members of this class are thread-safe and may be used concurrently from multiple threads.</remarks>
--------------------
new : elements:seq<'T> -> Set<'T>
val removeStopWords : textItem:string -> string option
val remaining : string []
val not : value:bool -> bool
<summary>Negate a logical value. Not True equals False and not False equals True</summary>
<param name="value">The value to negate.</param>
<returns>The result of the negation.</returns>
member Set.Contains : value:'T -> bool
val isEmpty : array:'T [] -> bool
<summary>Returns true if the given array is empty, otherwise false.</summary>
<param name="array">The input array.</param>
<returns>True if the array is empty.</returns>
<exception cref="T:System.ArgumentNullException">Thrown when the input array is null.</exception>
module TermFrequencies
from Preprocessing
val tf : bow:('a * int) [] -> ('a * float) []
val bow : ('a * int) []
val docTokenCounts : int
val sumBy : projection:('T -> 'U) -> source:seq<'T> -> 'U (requires member ( + ) and member get_Zero)
<summary>Returns the sum of the results generated by applying the function to each element of the sequence.</summary>
<remarks>The generated elements are summed using the <c>+</c> operator and <c>Zero</c> property associated with the generated type.</remarks>
<param name="projection">A function to transform items from the input sequence into the type that will be summed.</param>
<param name="source">The input sequence.</param>
<returns>The computed sum.</returns>
val snd : tuple:('T1 * 'T2) -> 'T2
<summary>Return the second element of a tuple, <c>snd (a,b) = b</c>.</summary>
<param name="tuple">The input tuple.</param>
<returns>The second value.</returns>
val token : 'a
val count : int
val tf : float
Multiple items
val float : value:'T -> float (requires member op_Explicit)
<summary>Converts the argument to 64-bit float. This is a direct conversion for all
primitive numeric types. For strings, the input is converted using <c>Double.Parse()</c>
with InvariantCulture settings. Otherwise the operation requires an appropriate
static conversion method on the input type.</summary>
<param name="value">The input value.</param>
<returns>The converted float</returns>
--------------------
[<Struct>]
type float = System.Double
<summary>An abbreviation for the CLI type <see cref="T:System.Double" />.</summary>
<category>Basic Types</category>
--------------------
type float<'Measure> =
float
<summary>The type of double-precision floating point numbers, annotated with a unit of measure.
The unit of measure is erased in compiled code and when values of this type
are analyzed using reflection. The type is representationally equivalent to
<see cref="T:System.Double" />.</summary>
<category index="6">Basic Types with Units of Measure</category>
val sortByDescending : projection:('T -> 'Key) -> array:'T [] -> 'T [] (requires comparison)
<summary>Sorts the elements of an array, in descending order, using the given projection for the keys and returning a new array.
Elements are compared using <see cref="M:Microsoft.FSharp.Core.Operators.compare" />.</summary>
<remarks>This is not a stable sort, i.e. the original order of equal elements is not necessarily preserved.
For a stable sort, consider using <see cref="M:Microsoft.FSharp.Collections.SeqModule.Sort" />.</remarks>
<param name="projection">The function to transform array elements into the type that is compared.</param>
<param name="array">The input array.</param>
<returns>The sorted array.</returns>
val idf : bows:seq<#seq<'b * 'c>> -> ('b * float) [] (requires equality)
val bows : seq<#seq<'b * 'c>> (requires equality)
val numDocs : int
val length : source:seq<'T> -> int
<summary>Returns the length of the sequence</summary>
<param name="source">The input sequence.</param>
<returns>The length of the sequence.</returns>
<exception cref="T:System.ArgumentNullException">Thrown when the input sequence is null.</exception>
val collect : mapping:('T -> #seq<'U>) -> source:seq<'T> -> seq<'U>
<summary>Applies the given function to each element of the sequence and concatenates all the
results.</summary>
<remarks>Remember sequence is lazy, effects are delayed until it is enumerated.</remarks>
<param name="mapping">A function to transform elements of the input sequence into the sequences
that will then be concatenated.</param>
<param name="source">The input sequence.</param>
<returns>The result sequence.</returns>
<exception cref="T:System.ArgumentNullException">Thrown when the input sequence is null.</exception>
val fst : tuple:('T1 * 'T2) -> 'T1
<summary>Return the first element of a tuple, <c>fst (a,b) = a</c>.</summary>
<param name="tuple">The input tuple.</param>
<returns>The first value.</returns>
val countBy : projection:('T -> 'Key) -> source:seq<'T> -> seq<'Key * int> (requires equality)
<summary>Applies a key-generating function to each element of a sequence and returns a sequence yielding unique
keys and their number of occurrences in the original sequence.</summary>
<remarks>Note that this function returns a sequence that digests the whole initial sequence as soon as
that sequence is iterated. As a result this function should not be used with
large or infinite sequences. The function makes no assumption on the ordering of the original
sequence.</remarks>
<param name="projection">A function transforming each item of the input sequence into a key to be
compared against the others.</param>
<param name="source">The input sequence.</param>
<returns>The result sequence.</returns>
<exception cref="T:System.ArgumentNullException">Thrown when the input sequence is null.</exception>
val id : x:'T -> 'T
<summary>The identity function</summary>
<param name="x">The input value.</param>
<returns>The same value.</returns>
val token : 'b (requires equality)
val numDocsWithToken : int
val idf : float
val log : value:'T -> 'T (requires member Log)
<summary>Natural logarithm of the given number</summary>
<param name="value">The input value.</param>
<returns>The natural logarithm of the input.</returns>
val sortByDescending : projection:('T -> 'Key) -> source:seq<'T> -> seq<'T> (requires comparison)
<summary>Applies a key-generating function to each element of a sequence and yield a sequence ordered
descending by keys. The keys are compared using generic comparison as implemented by <see cref="M:Microsoft.FSharp.Core.Operators.compare" />.</summary>
<remarks>This function returns a sequence that digests the whole initial sequence as soon as
that sequence is iterated. As a result this function should not be used with
large or infinite sequences. The function makes no assumption on the ordering of the original
sequence.
This is a stable sort, that is the original order of equal elements is preserved.</remarks>
<param name="projection">A function to transform items of the input sequence into comparable keys.</param>
<param name="source">The input sequence.</param>
<returns>The result sequence.</returns>
<exception cref="T:System.ArgumentNullException">Thrown when the input sequence is null.</exception>
val toArray : source:seq<'T> -> 'T []
<summary>Builds an array from the given collection.</summary>
<param name="source">The input sequence.</param>
<returns>The result array.</returns>
<exception cref="T:System.ArgumentNullException">Thrown when the input sequence is null.</exception>
val tfIdf : idf:Map<string,float> -> bow:(string * int) [] -> (string * float) []
val idf : Map<string,float>
val bow : (string * int) []
val idfPrior : float
val toArray : table:Map<'Key,'T> -> ('Key * 'T) [] (requires comparison)
<summary>Returns an array of all key-value pairs in the mapping.
The array will be ordered by the keys of the map.</summary>
<param name="table">The input map.</param>
<returns>The array of key/value pairs.</returns>
val averageBy : projection:('T -> 'U) -> array:'T [] -> 'U (requires member ( + ) and member DivideByInt and member get_Zero)
<summary>Returns the average of the elements generated by applying the function to each element of the array.</summary>
<param name="projection">The function to transform the array elements before averaging.</param>
<param name="array">The input array.</param>
<exception cref="T:System.ArgumentException">Thrown when <c>array</c> is empty.</exception>
<returns>The computed average.</returns>
<exception cref="T:System.ArgumentNullException">Thrown when the input array is null.</exception>
val token : string
val tfIdf : float