private void parseWordBoundaries(String text, boolean gold) {
		List<String> unitList = new LinkedList<String>();
		List<Boolean> stressList = new LinkedList<Boolean>();
		List<Boolean> boundaryList = new LinkedList<Boolean>();

		// Find each unit/boundary.
		int idx = 0; // Define outside so it carries over
		int unitStart = -1; // -1 marks an invalid start
		for (; idx < text.length(); idx++) {
			char c = text.charAt(idx);
			// If it's a boundary, finish off the unit
			if (c == WORD_BOUNDARY || c == SYLL_BOUNDARY) {
				// Do nothing if we didn't already have a unit built
				if (unitStart == -1) {
					continue;
				}

				// Add the new unit
				String unit = text.substring(unitStart, idx);
				unitList.add(anyStressPattern.matcher(unit).replaceAll(""));
				stressList.add(primaryStressPattern.matcher(unit).matches());

				// Place a boundary if we're gold and this was a word boundary
				boundaryList.add(gold && c == WORD_BOUNDARY);

				// Reset unit start
				unitStart = -1;
			}
			else {
				// Note the start if this is the beginning of a new unit
				if (unitStart == -1) {
					unitStart = idx;
				}
			}

		}

		// Put in whatever's left. This code is repeated from above; for optimization
		// these were not refactored out
		String unit = text.substring(unitStart, idx);
		unitList.add(anyStressPattern.matcher(unit).replaceAll(""));
		stressList.add(primaryStressPattern.matcher(unit).matches());

		// Convert into arrays for fast access later.
		boundaries = boundaryList.toArray(new Boolean[boundaryList.size()]);
		units = unitList.toArray(new String[unitList.size()]);
		stresses = stressList.toArray(new Boolean[stressList.size()]);
	}