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