public static Sentence parse(final String text,final ConversationContext ctx){
  String txt;
  if (text == null) {
    txt="";
  }
 else {
    if ((ctx != null) && ctx.isForMatching()) {
      final ExpressionMatcher matcher=new ExpressionMatcher();
      txt=matcher.readMatchingFlags(text);
      if (matcher.isAnyFlagSet()) {
        return matcher.parseSentence(txt,ctx);
      }
    }
 else {
      txt=text;
    }
  }
  txt=txt.trim();
  final SentenceImplementation sentence=new SentenceImplementation(ctx,txt);
  try {
    final ConversationParser parser=new ConversationParser(sentence);
    sentence.parse(parser);
    sentence.classifyWords(parser);
    if ((ctx != null) && ctx.getMergeExpressions()) {
      sentence.evaluateSentenceType();
      sentence.mergeWords();
      if (!ctx.isForMatching()) {
        sentence.standardizeSentenceType();
        sentence.performaAliasing();
      }
    }
    sentence.setError(parser.getErrorString());
  }
 catch (  final Exception e) {
    LOGGER.error("ConversationParser.parse(): caught Exception while parsing '" + text + '\'');
    sentence.setError(e.getMessage());
    e.printStackTrace();
  }
  return sentence;
}

public static Sentence parse ( final String text , final ConversationContext ctx ) { String txt ; if ( text == null ) { txt = "" ; } else { if ( ( ctx != null ) && ctx . isForMatching ( ) ) { final ExpressionMatcher matcher = new ExpressionMatcher ( ) ; txt = matcher . readMatchingFlags ( text ) ; if ( matcher . isAnyFlagSet ( ) ) { return matcher . parseSentence ( txt , ctx ) ; } } else { txt = text ; } } txt = txt . trim ( ) ; final SentenceImplementation sentence = new SentenceImplementation ( ctx , txt ) ; try { final ConversationParser parser = new ConversationParser ( sentence ) ; sentence . parse ( parser ) ; sentence . classifyWords ( parser ) ; if ( ( ctx != null ) && ctx . getMergeExpressions ( ) ) { sentence . evaluateSentenceType ( ) ; sentence . mergeWords ( ) ; if ( ! ctx . isForMatching ( ) ) { sentence . standardizeSentenceType ( ) ; sentence . performaAliasing ( ) ; } } sentence . setError ( parser . getErrorString ( ) ) ; } catch ( final Exception e ) { LOGGER . error ( "ConversationParser.parse(): caught Exception while parsing '" + text + '\'' ) ; sentence . setError ( e . getMessage ( ) ) ; e . printStackTrace ( ) ; } return sentence ; }
parse the given text sentence .
