code: public static boolean isEndOfChunk(String prevTag, String prevType, String curTag, String curType)
    {
      boolean chunkEnd = false;
  
      if ( "B".equals(prevTag) && "B".equals(curTag) ) { chunkEnd = true; }
      if ( "B".equals(prevTag) && "O".equals(curTag) ) { chunkEnd = true; }
      if ( "I".equals(prevTag) && "B".equals(curTag) ) { chunkEnd = true; }
      if ( "I".equals(prevTag) && "O".equals(curTag) ) { chunkEnd = true; }
  
      if ( "E".equals(prevTag) || "L".equals(prevTag)
            || "S".equals(prevTag) || "U".equals(prevTag)
            || "[".equals(prevTag) || "]".equals(prevTag)) { chunkEnd = true; }
  
      if (!"O".equals(prevTag) && !".".equals(prevTag) && !prevType.equals(curType)) {
        chunkEnd = true;
      }
  
      return chunkEnd;
    }
docs: Returns whether a chunk ended between the previous and current token
  @param prevTag - the tag of the previous token
  @param prevType - the type of the previous token
  @param curTag - the tag of the current token
  @param curType - the type of the current token
  @return true if the previous token was the last token of a chunk