question: void classifyWords ( final ErrorDrain errors ) { final WordList wl = WordList . getInstance ( ) ; for ( final Expression w : expressions ) { final String original = w . getOriginal ( ) ; if ( context . isForMatching ( ) ) { if ( ExpressionType . isTypeString ( original ) ) { w . setType ( new ExpressionType ( original ) ) ; w . setNormalized ( Expression . JOKER ) ; } } boolean wordFound = w . getType ( ) != null ; boolean entryMissing = false ; if ( ! wordFound ) { WordEntry entry = wl . find ( original ) ; if ( entry == null ) { entryMissing = true ; } else if ( entry . getType ( ) != null ) { ExpressionType type = entry . getType ( ) ; w . setType ( type ) ; wordFound = true ; if ( type . isNumeral ( ) ) { w . setAmount ( entry . getValue ( ) ) ; w . setNormalized ( Integer . toString ( w . getAmount ( ) ) ) ; } else if ( type . isPlural ( ) ) { if ( entry . getPlurSing ( ) != null ) { w . setNormalized ( entry . getPlurSing ( ) ) ; } else { w . setNormalized ( original ) ; } } else { w . setNormalized ( entry . getNormalized ( ) ) ; } } } if ( ! wordFound ) { if ( original . matches ( "^[+-]?[0-9.,]+" ) ) { w . parseAmount ( original , errors ) ; final int amount = w . getAmount ( ) ; if ( amount < 0 ) { errors . setError ( "negative amount: " + amount ) ; } wordFound = w . getType ( ) != null ; } } if ( ! wordFound ) { final WordList . Verb verb = wl . normalizeVerb ( original ) ; if ( verb != null ) { if ( verb . isGerund ) { w . setType ( new ExpressionType ( verb . entry . getTypeString ( ) + ExpressionType . SUFFIX_GERUND ) ) ; wordFound = true ; } else if ( ( verb . entry . getType ( ) != null ) && verb . entry . getType ( ) . isVerb ( ) ) { w . setType ( verb . entry . getType ( ) ) ; wordFound = true ; } else if ( ! verb . isPast ) { w . setType ( new ExpressionType ( ExpressionType . VERB ) ) ; wordFound = true ; } if ( wordFound ) { w . setNormalized ( verb . entry . getNormalized ( ) ) ; } } } if ( ! wordFound ) { final WordEntry adjective = wl . normalizeAdjective ( original ) ; if ( adjective != null ) { w . setType ( new ExpressionType ( ExpressionType . ADJECTIVE ) ) ; w . setNormalized ( adjective . getNormalized ( ) ) ; wordFound = true ; } } if ( ! wordFound ) { w . setType ( new ExpressionType ( "" ) ) ; w . setNormalized ( original . toLowerCase ( ) ) ; if ( entryMissing ) { wl . addNewWord ( original ) ; } } assert w . getType ( ) != null ; } }
target:  Classify word types and normalize words.