private void PersistTuples(Tweeter tweeter, int maxTupleLength = 1) { var allWords = tweeter.WordSet.Distinct(); // make sure we arent trying to make combinations longer than the original maxTupleLength = maxTupleLength > allWords.Count() ? allWords.Count() : maxTupleLength; IEnumerable <IOrderedEnumerable <string> > nWordSets = allWords.Combinations(1).Select(set => set.OrderBy(s => s)); for (int i = 2; i <= maxTupleLength; i++) { var combos = allWords.Combinations(i).Select(set => set.OrderBy(s => s)); nWordSets = nWordSets.Union(combos); } foreach (var set in nWordSets) { _repo.InsertNTuple(set.ToArray()); WordSetsStored[set.Count()]++; } }
public void InsertNTuple(string[] tupleOfWords) { _pipelineRepo.InsertNTuple(tupleOfWords); _postgreRepo.InsertNTuple(tupleOfWords); }