示例#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
        public IReformedQuery[] GetExpandedQueries(string target)
        {
            if (!IsPreconditionMet(target))
            {
                return new IReformedQuery[] {}
            }
            ;
            var entries = localCoOccurMatrix.GetEntries(en => IsEntryStartWith(en, target[0], target[1]) &&
                                                        !en.Column.Equals(en.Row)).ToList();
            var acronyms = CreateInitialAcronym(entries, target[0], target[1]).OrderByDescending(a => a.
                                                                                                 ComputeCoOccurrenceCount(localCoOccurMatrix)).TrimIfOverlyLong(3).ToArray();

            for (int i = 2; i < target.Count(); i++)
            {
                acronyms = acronyms.SelectMany(a => a.GetCommonCoOccurWords(localCoOccurMatrix,
                                                                            target.ElementAt(i))).OrderByDescending(a => a.ComputeCoOccurrenceCount
                                                                                                                        (localCoOccurMatrix)).TrimIfOverlyLong(3).ToArray();
            }
            return(acronyms.Select(a => a.ToReformedQuery(localCoOccurMatrix)).
                   OrderByDescending(query => query.CoOccurrenceCount).
                   TrimIfOverlyLong(GetMaximumCount()).ToArray());
        }