private int maxWord(String text, boolean hasSuffix, String prvText) throws MorphException {
    
    int maxlen = 0;
    boolean existPrv = false;
    
    // if previous text exist in the dictionary.
    if(prvText.length()>=2) 
      existPrv = (DictionaryUtil.getNoun(prvText.substring(prvText.length()-2))!=null);
    if(!existPrv&&prvText.length()>=3)
      existPrv = (DictionaryUtil.getNoun(prvText.substring(prvText.length()-3))!=null);
    
    for(int i=text.length();i>1;i--) {
      
      String seg = text.substring(0,i);
      WordEntry entry = DictionaryUtil.getAllNoun(seg);
      if(entry==null) continue;
      
      int len = 0;
      if(i==text.length()-1 && hasSuffix && !existPrv)
        len = i+1;
      else
        len = i;
      
      if(len>maxlen) maxlen = len;
    }   
    
    return maxlen;
  }