Beispiel #1
0
        static public List <BeamSearchStatus> GetTopNBSS(List <BeamSearchStatus> bssList, int topN)
        {
            FixedSizePriorityQueue <ComparableItem <BeamSearchStatus> > q = new FixedSizePriorityQueue <ComparableItem <BeamSearchStatus> >(topN, new ComparableItemComparer <BeamSearchStatus>(false));

            for (int i = 0; i < bssList.Count; i++)
            {
                q.Enqueue(new ComparableItem <BeamSearchStatus>(bssList[i].Score, bssList[i]));
            }

            return(q.Select(x => x.Value).ToList());
        }
Beispiel #2
0
        public static List <BeamSearchStatus> GetTopNBSS(List <BeamSearchStatus> bssList, int topN)
        {
            var q = new FixedSizePriorityQueue <ComparableItem <BeamSearchStatus> >(topN, new ComparableItemComparer <BeamSearchStatus>(false));

            foreach (var status in bssList)
            {
                q.Enqueue(new ComparableItem <BeamSearchStatus>(status.Score, status));
            }

            return(q.Select(x => x.Value).ToList());
        }
Beispiel #3
0
        public List <int> GetTopNMaxWeightIdx(int topN)
        {
            float[] weights = ToWeightArray();
            FixedSizePriorityQueue <ComparableItem <int> > q = new FixedSizePriorityQueue <ComparableItem <int> >(topN, new ComparableItemComparer <int>(true));

            for (int i = 0; i < weights.Length; i++)
            {
                q.Enqueue(new ComparableItem <int>(weights[i], i));
            }

            return(q.Select(x => x.Value).ToList());
        }