/// <summary>
        /// Load one sentence from the xmltextreader.
        /// </summary>
        /// <param name="reader">XmlTextReader to read XML file.</param>
        /// <param name="contentController">Content controller.</param>
        public void Load(XmlTextReader reader, object contentController)
        {
            Debug.Assert(reader != null, "XmlTextReader is null");

            // Get sentence id, text
            this.Id = reader.GetAttribute("id");
            this.Text = reader.GetAttribute("txt");

            // get the phones
            if (!reader.IsEmptyElement)
            {
                while (reader.Read())
                {
                    if (reader.NodeType == XmlNodeType.Element && reader.Name == "phone")
                    {
                        UnitLatticePhone phone = new UnitLatticePhone();
                        phone.Load(reader, contentController);

                        this.Phones.Add(phone);
                    }
                    else if (reader.NodeType == XmlNodeType.EndElement && reader.Name == "sentence")
                    {
                        break;
                    }
                }
            }
        }
        /// <summary>
        /// Gets the number of same candidates between two phones.
        /// </summary>
        /// <param name="reference">A phone of reference build.</param>
        /// <param name="target">A phone of target build.</param>
        /// <returns>The number of same candidates.</returns>
        public static int GetSameCandidateCount(UnitLatticePhone reference, UnitLatticePhone target)
        {
            Debug.Assert(reference != null, "reference is null");
            Debug.Assert(target != null, "target is null");
            Debug.Assert(string.Equals(reference.Text, target.Text), "The phone text of tgtPhone and tgtPhone are not equal");

            int sameNum = 0;

            for (int i = 0; i < reference.Candidates.Count; i++)
            {
                for (int j = 0; j < target.Candidates.Count; j++)
                {
                    if (UnitLatticePhoneCandidate.Equals(reference.Candidates[i], target.Candidates[j]))
                    {
                        sameNum++;
                        break;
                    }
                }
            }

            return sameNum;
        }