public static String applyPtbFormat(String image,String type){
  String result=null;
  if (type.equals(PunctDescription.OPEN_BRACKET)) {
    if (image.equals("(")) {
      result=LRB;
    }
 else     if (image.equals("[")) {
      result=LSB;
    }
 else     if (image.equals("{")) {
      result=LCB;
    }
  }
 else   if (type.equals(PunctDescription.CLOSE_BRACKET)) {
    if (image.equals(")")) {
      result=RRB;
    }
 else     if (image.equals("]")) {
      result=RSB;
    }
 else     if (image.equals("}")) {
      result=RCB;
    }
  }
 else   if (type.equals(PunctDescription.OPEN_PUNCT)) {
    result="``";
  }
 else   if (type.equals(PunctDescription.CLOSE_PUNCT)) {
    result="''";
  }
 else   if (image.contains("/")) {
    result=image.replace("/","\\/");
  }
 else   if (image.contains("*")) {
    result=image.replace("*","\\*");
  }
  return result;
}

public static String applyPtbFormat ( String image , String type ) { String result = null ; if ( type . equals ( PunctDescription . OPEN_BRACKET ) ) { if ( image . equals ( "(" ) ) { result = LRB ; } else if ( image . equals ( "[" ) ) { result = LSB ; } else if ( image . equals ( "{" ) ) { result = LCB ; } } else if ( type . equals ( PunctDescription . CLOSE_BRACKET ) ) { if ( image . equals ( ")" ) ) { result = RRB ; } else if ( image . equals ( "]" ) ) { result = RSB ; } else if ( image . equals ( "}" ) ) { result = RCB ; } } else if ( type . equals ( PunctDescription . OPEN_PUNCT ) ) { result = "``" ; } else if ( type . equals ( PunctDescription . CLOSE_PUNCT ) ) { result = "''" ; } else if ( image . contains ( "/" ) ) { result = image . replace ( "/" , "\\/" ) ; } else if ( image . contains ( "*" ) ) { result = image . replace ( "*" , "\\*" ) ; } return result ; }
this applies some replacements used in the penn treebank format to the given token image of the given type .
