private void Add(Document document)
 {
     var words = _tokenizer.Tokenize(document.Text).ToArray();
     for (int i = 0; i < words.Length; i++)
     {
         Add(new Tuple<string, int>(words[i], i), document);
     }
 }
        private void Add(Tuple<string, int> termWithPosition, Document document)
        {
            var term = termWithPosition.Item1;
            if (!_dictionary.ContainsKey(term))
            {
                _dictionary[term] = new Dictionary<Document, HashSet<int>>();
            }

            if (!_dictionary[term].ContainsKey(document))
            {
                _dictionary[term][document] = new HashSet<int>();
            }
            _dictionary[term][document].Add(termWithPosition.Item2);
        }
 public int TrackDocumentId(Document document)
 {
     File.AppendAllLines(_documentIdFile, new[] {$"{document.FilePath}{SplitSymbol}{_index}"});
     return _index++;
 }