public void AddDocument(uint documentID, IDictionary<string, uint> termTFs)
{
if (termTFs == null) throw new ArgumentNullException(nameof(termTFs));
if (ContainsDocument(documentID))
{
throw new ArgumentException("A document with this ID already exists.", nameof(documentID));
}
minipulatedSinceLastRecalc = true;
foreach (var term in termTFs.Keys)
{
if (Terms.ContainsKey(term))
{
Terms[term].DocumentIDsByTFs[documentID] = termTFs[term];
}
else
{
Terms[term] = new Term
{
DocumentIDsByTFs = new Dictionary<uint, uint>
{
[documentID] = termTFs[term]
},
Value = term
};
}
}
}