Exemplo n.º 1
0
        public Item addContentItem(double valueStart, double valueEnd, string content)
        {
            List <Item> items      = transcribed.results.items;
            Item        itemSelect = items.Find(x => (x.start_time == valueStart) && (x.end_time == valueEnd));

            if (!itemSelect.Equals(null))
            {
                Alternatives checkAlternative = itemSelect.alternatives.Find(x => x.changed.Equals(true));
                if (checkAlternative == null)
                {
                    Alternatives alternative = new Alternatives
                    {
                        confidence = 1,
                        content    = content,
                        changed    = true
                    };
                    itemSelect.alternatives.Insert(0, alternative);
                }
                else
                {
                    checkAlternative.content = content;
                }
            }

            return(itemSelect);
        }
Exemplo n.º 2
0
        public Alternatives searchMaxConfidence(Item item)
        {
            float confidences = 0;
            //int index = -1;
            Alternatives alternative = null;

            for (int a = 0; a < item.alternatives.Count; a++)
            {
                if (item.alternatives.ElementAt(a).confidence > confidences)
                {
                    alternative = item.alternatives.ElementAt(a);
                    confidences = alternative.confidence;
                }
            }
            if (alternative == null)
            {
                alternative = item.alternatives.ElementAt(0);
            }
            return(alternative);
        }