@Test
  public void testTokenMapToSegments3() throws Exception {
    // [0=false, 1=false, 2=false, 3=true]
    // -> 4
    SortedMap<Integer, Boolean> map = new TreeMap<>();
    map.put(0, false);
    map.put(1, false);
    map.put(2, false);
    map.put(3, true);

    List<Integer> list = SegmentExtractor.tokenBoundaryMapToSegments(map);
    assertEquals(list, Collections.singletonList(4));
  }
  @Test
  public void testTokenMapToSegments() throws Exception {

    SortedMap<Integer, Boolean> map = new TreeMap<>();
    map.put(0, false);
    map.put(1, true);
    map.put(2, false);
    map.put(3, true);
    map.put(4, true);
    map.put(5, true);

    List<Integer> list = SegmentExtractor.tokenBoundaryMapToSegments(map);
    assertEquals(list, Arrays.asList(2, 2, 1, 1));
  }
  @Test
  public void testTokenMapToSegments2() throws Exception {
    // [0=false, 1=true, 2=false, 3=true, 4=false, 5=false]
    // -> 2, 2, 2
    SortedMap<Integer, Boolean> map = new TreeMap<>();
    map.put(0, false);
    map.put(1, true);
    map.put(2, false);
    map.put(3, true);
    map.put(4, false);
    map.put(5, false);

    List<Integer> list = SegmentExtractor.tokenBoundaryMapToSegments(map);
    assertEquals(list, Arrays.asList(2, 2, 2));
  }