using System;
using System.Collections.Generic;
using System.Linq;

namespace OCR
{
    public class Word : ICloneable
    {
        public int TextBoxId;
        public int WordInBoxId;
        public List<PossibleWord> PossibleWords;
        public Position Position;

        public PossibleWord GetBestWord()
        {
            return PossibleWords.OrderByDescending(x => x.Probability).First();
        }

        public object Clone()
        {
            return new Word {
                TextBoxId = TextBoxId,
                WordInBoxId = WordInBoxId,
                PossibleWords = PossibleWords.Select(x => (PossibleWord) x.Clone()).ToList(),
                Position = (Position) Position.Clone()
            };
        }
    }
}
