code: private void setSentenceSpan(JSONObject cNode, JSONObject parent) {
      try {
        JSONObject data = cNode.getJSONObject("data");
  
        int leftPosC = data.getInt(SENTENCE_LEFT);
        int rightPosC = data.getInt(SENTENCE_RIGHT);
  
        data = parent.getJSONObject("data");
  
        if (data.has(SENTENCE_LEFT)) {
          data.put(SENTENCE_LEFT, Math.min(leftPosC, data.getInt(SENTENCE_LEFT)));
        } else {
          data.put(SENTENCE_LEFT, leftPosC);
        }
  
        if (data.has(SENTENCE_RIGHT)) {
          data.put(SENTENCE_RIGHT,
                  Math.max(rightPosC, data.getInt(SENTENCE_RIGHT)));
        } else {
          data.put(SENTENCE_RIGHT, rightPosC);
        }
      } catch (JSONException ex) {
        log.debug("error while setting left and right position for sentences", ex);
      }
    }
docs: Sets the sentence_left and sentence_right properties of the data object of
  parent to the min/max of the currNode.