question: 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 ; }
target:  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]