Beispiel #1
0
        private static void expandLargeNumber(string text, string word, int num, WordRelation wordRelation)
        {
            int    num2         = String.instancehelper_length(text);
            int    num3         = num2 - num;
            string numberString = String.instancehelper_substring(text, 0, num3);
            Item   tail         = wordRelation.getTail();

            NumberExpander.expandNumber(numberString, wordRelation);
            if (wordRelation.getTail() != tail)
            {
                wordRelation.addWord(word);
            }
            NumberExpander.expandNumberAt(text, num3, wordRelation);
        }
Beispiel #2
0
        public static void expandOrdinal(string rawNumberString, WordRelation wordRelation)
        {
            object       obj           = ",";
            object       obj2          = "";
            object       _ref          = obj;
            CharSequence charSequence  = CharSequence.Cast(_ref);
            CharSequence charSequence2 = charSequence;

            _ref         = obj2;
            charSequence = CharSequence.Cast(_ref);
            NumberExpander.expandNumber(String.instancehelper_replace(rawNumberString, charSequence2, charSequence), wordRelation);
            Item tail = wordRelation.getTail();

            if (tail != null)
            {
                FeatureSet features = tail.getFeatures();
                string     @string  = features.getString("name");
                string     text     = NumberExpander.findMatchInArray(@string, NumberExpander.digit2num, NumberExpander.ord2num);
                if (text == null)
                {
                    text = NumberExpander.findMatchInArray(@string, NumberExpander.digit2teen, NumberExpander.ord2teen);
                }
                if (text == null)
                {
                    text = NumberExpander.findMatchInArray(@string, NumberExpander.digit2enty, NumberExpander.ord2enty);
                }
                if (String.instancehelper_equals(@string, "hundred"))
                {
                    text = "hundredth";
                }
                else if (String.instancehelper_equals(@string, "thousand"))
                {
                    text = "thousandth";
                }
                else if (String.instancehelper_equals(@string, "billion"))
                {
                    text = "billionth";
                }
                if (text != null)
                {
                    wordRelation.setLastWord(text);
                }
            }
        }