コード例 #1
0
        /// <summary>
        /// Converts the given Roman numeral string into (word) Items in the WordRelation.
        /// </summary>
        /// <param name="romanString">The roman numeral string.</param>
        private void RomanToWords(string romanString)
        {
            string punctuation = (string)_tokenItem.FindFeature("p.punc");

            if (punctuation.Equals(""))
            {
                /* no preceeding punctuation */
                //string n = String.valueOf(NumberExpander.expandRoman(romanString));
                var n = NumberExpander.ExpandRoman(romanString).ToString(CultureInfo.InvariantCulture);

                if (KingLike(_tokenItem))
                {
                    _wordRelation.AddWord("the");
                    NumberExpander.ExpandOrdinal(n, _wordRelation);
                }
                else if (SectionLike(_tokenItem))
                {
                    NumberExpander.ExpandNumber(n, _wordRelation);
                }
                else
                {
                    NumberExpander.ExpandLetters(romanString, _wordRelation);
                }
            }
            else
            {
                NumberExpander.ExpandLetters(romanString, _wordRelation);
            }
        }