public static String cleanNonTerminal(String nt){
  if (isNonterminal(nt)) {
    if (isIndexedNonTerminal(nt)) {
      return nt.substring(1,nt.indexOf(INDEX_SEPARATOR));
    }
    return nt.substring(1,nt.length() - 1);
  }
  return nt;
}

public static String cleanNonTerminal ( String nt ) { if ( isNonterminal ( nt ) ) { if ( isIndexedNonTerminal ( nt ) ) { return nt . substring ( 1 , nt . indexOf ( INDEX_SEPARATOR ) ) ; } return nt . substring ( 1 , nt . length ( ) - 1 ) ; } return nt ; }
nonterminals are stored in the vocabulary in square brackets . this removes them when you just want the raw nonterminal word . supports indexed and non - indexed nonterminals : [ goal ] - & gt ; goal [ x , 1 ] - & gt ; [ x ]
