public IEnumerable <ExtendedAcronym> GetCommonCoOccurWords(IWordCoOccurrenceMatrix matrix, char letter) { var entries = matrix.GetEntries(entry => IsEntryCorrect(matrix, entry, letter, Words.ToArray())).ToArray(); var newWords = entries.Select(e => Words.Contains(e.Column) ? e.Row : e.Column).Distinct(); return(newWords.Select(k => new ExtendedAcronym(Words.AddImmutably(k))).ToArray()); }
private bool IsEntryCorrect(IWordCoOccurrenceMatrix matrix, IMatrixEntry entry, char start, string[] words) { var otherWord = words.Contains(entry.Column) ? entry.Row : entry.Column; if (words.Contains(otherWord) || !otherWord.StartsWith(start.ToString())) { return(false); } return(words.All(w => matrix.GetCoOccurrenceCount(w, otherWord) > 0)); }
public int ComputeCoOccurrenceCount(IWordCoOccurrenceMatrix matrix) { int sum = 0; for (int i = Words.Count - 1; i > 0; i--) { var current = Words.ElementAt(i); var restList = Words.GetRange(0, i); sum += restList.Sum(rest => matrix.GetCoOccurrenceCount(rest, current)); } return(sum); }
public BigMatrixTest() { this.matrix = new SparseMatrixForWordPairs(); }
private InternalReformedQuery(IEnumerable <ReformedWord> allTerms, IWordCoOccurrenceMatrix matrix) { this.allTerms = allTerms.ToList(); this.matrix = matrix; }
public InternalReformedQuery(IWordCoOccurrenceMatrix matrix) { this.allTerms = new List <ReformedWord>(); this.matrix = matrix; }
public ReformedQueryBuilder(IWordCoOccurrenceMatrix coOccurrenceMatrix) { this.coOccurrenceMatrix = coOccurrenceMatrix; QueryFilters.Add(IsEveryWordPairExisting); }
public AcronymExpanderTests() { this.matrix = new SparseCoOccurrenceMatrix(); this.expander = new AcronymExpander(matrix); }
public TagCloudBuilder(IWordCoOccurrenceMatrix matrix, String[] rootWords = null) { this.matrix = matrix; this.rootWords = rootWords; }
public BigMatrixTest() { this.matrix = new SparseCoOccurrenceMatrix(); }
public InFileCoOccurrenceMatrixTests() { this.matrix = new SparseCoOccurrenceMatrix(); }
public AcronymExpanderTests() { this.matrix = new SparseMatrixForWordPairs(); this.expander = new AcronymExpander(matrix); }
public InFileCoOccurrenceMatrixTests() { this.matrix = new SparseMatrixForWordPairs(); }
public IReformedQuery ToReformedQuery(IWordCoOccurrenceMatrix matrix) { return(new ExpandedQuery(this.Words, ComputeCoOccurrenceCount(matrix))); }
public AcronymExpander(IWordCoOccurrenceMatrix localCoOccurMatrix) { this.localCoOccurMatrix = localCoOccurMatrix; }