Beispiel #1
0
        /// <summary>
        /// Moves a MRG file enumerator to the next valid MRG file based on the training section restriction (if any)
        /// </summary>
        /// <returns>True if valid MRG file was found, false otherwise</returns>
        protected bool MoveToNextValidMrgFile()
        {
            // try moving to next file
            if (!_fileEnum.MoveNext())
            {
                return(false);
            }

            // impose section restriction if there is one
            if (_sections != null)
            {
                while (!_sections.Contains(TreeBankEngine.GetSectionNumber(_fileEnum.Current)))
                {
                    if (!_fileEnum.MoveNext())
                    {
                        return(false);
                    }
                }
            }

            return(true);
        }
        /// <summary>
        /// Moves a NounInfo enumerator to the next valid entry
        /// </summary>
        /// <param name="nounInfoEnum">NounInfo enumerator to move</param>
        /// <returns>True if valid NounInfo was found, false otherwise</returns>
        private bool MoveToNextValidNounInfo(ref List <NounInfo> .Enumerator nounInfoEnum)
        {
            // move to next NounInfo for the current noun...if we're out, quit looking
            if (!nounInfoEnum.MoveNext())
            {
                return(false);
            }

            // move to the next NounInfo that satisfies the TreeBank section constraint
            if (Sections != null)
            {
                while (!Sections.Contains(TreeBankEngine.GetSectionNumber(nounInfoEnum.Current.File)))
                {
                    // if we're out of NounInfo, return
                    if (!nounInfoEnum.MoveNext())
                    {
                        return(false);
                    }
                }
            }

            return(true);
        }