예제 #1
0
            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());
            }
예제 #2
0
            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));
            }
예제 #3
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);
            }
예제 #4
0
 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);
 }
예제 #8
0
 public AcronymExpanderTests()
 {
     this.matrix   = new SparseCoOccurrenceMatrix();
     this.expander = new AcronymExpander(matrix);
 }
예제 #9
0
 public TagCloudBuilder(IWordCoOccurrenceMatrix matrix, String[] rootWords = null)
 {
     this.matrix    = matrix;
     this.rootWords = rootWords;
 }
예제 #10
0
 public BigMatrixTest()
 {
     this.matrix = new SparseCoOccurrenceMatrix();
 }
예제 #11
0
 public TagCloudBuilder(IWordCoOccurrenceMatrix matrix, String[] rootWords = null)
 {
     this.matrix = matrix;
     this.rootWords = rootWords;
 }
예제 #12
0
 public InFileCoOccurrenceMatrixTests()
 {
     this.matrix = new SparseCoOccurrenceMatrix();
 }
예제 #13
0
 public AcronymExpanderTests()
 {
     this.matrix = new SparseMatrixForWordPairs();
     this.expander = new AcronymExpander(matrix);
 }
 public InFileCoOccurrenceMatrixTests()
 {
     this.matrix = new SparseMatrixForWordPairs();
 }
예제 #15
0
 public IReformedQuery ToReformedQuery(IWordCoOccurrenceMatrix matrix)
 {
     return(new ExpandedQuery(this.Words, ComputeCoOccurrenceCount(matrix)));
 }
예제 #16
0
 public AcronymExpander(IWordCoOccurrenceMatrix localCoOccurMatrix)
 {
     this.localCoOccurMatrix = localCoOccurMatrix;
 }