UnitOriginInfo unitOrigin = clunitDB.getUnitOriginInfo(unitEntry); if (unitOrigin != null) { unitFeatureSet.setString("origin", unitOrigin.originFile); unitFeatureSet.setFloat("origin_start", unitOrigin.originStart); unitFeatureSet.setFloat("origin_end", unitOrigin.originEnd); }
    public void processUtterance(Utterance utterance) throws ProcessException {	Viterbi vd;	Relation segs = utterance.getRelation(Relation.SEGMENT);	utterance.setObject(SampleInfo.UTT_NAME,		clunitDB.getSampleInfo());    	utterance.setObject("sts_list", clunitDB.getSts());	vd = new Viterbi(segs, clunitDB);	for (Item s = segs.getHead(); s != null; s = s.getNext()) {	    setUnitName(s);	}    // Carry out the CART lookup for the target costs, and the viterbi    // search for finding the best path (join costs) through the candidates.	vd.decode();    // Now associate the candidate units in the best path     // with the items in the segment relation.	if (!vd.result("selected_unit")) {	    utterance.getVoice().error("clunits: can't find path");	}    // If optimal coupling was used, the join points must now be copied    // from the path elements to the actual items in the segment relation.	vd.copyFeature("unit_prev_move");	vd.copyFeature("unit_this_move");    // Based on this data, create a Unit relation giving the details of the    // units to concatenate.	Relation unitRelation = utterance.createRelation(Relation.UNIT);	for (Item s = segs.getHead(); s != null; s = s.getNext()) {	    Item unit = unitRelation.appendItem();	    FeatureSet unitFeatureSet = unit.getFeatures();	    int unitEntry = s.getFeatures().getInt("selected_unit");        // The item name is the segment name	    unitFeatureSet.setString("name", s.getFeatures().getString("name"));	    int unitStart;	    int unitEnd;	    String clunitName = s.getFeatures().getString("clunit_name");	    if (s.getFeatures().isPresent("unit_this_move")) {		unitStart = s.getFeatures().getInt("unit_this_move");	    } else {		unitStart = clunitDB.getStart(unitEntry);	    }	    if (s.getNext() != null &&		    s.getNext().getFeatures().isPresent("unit_prev_move")) {		unitEnd = s.getNext().getFeatures().getInt("unit_prev_move");	    } else {		unitEnd = clunitDB.getEnd(unitEntry);	    }	    unitFeatureSet.setInt("unit_entry", unitEntry);	    ClusterUnit clunit = new ClusterUnit(clunitDB, 		    clunitName, unitStart, unitEnd);	    unitFeatureSet.setObject("unit", clunit);	    if (true) { 		unitFeatureSet.setInt("unit_start", clunit.getStart());		unitFeatureSet.setInt("unit_end", clunit.getEnd());        unitFeatureSet.setInt("instance", unitEntry - clunitDB.getUnitIndex(clunitName, 0));	    } // add the rest of these things for debugging.	    if (DEBUG) {		debug(" sr " + clunitDB.getSampleInfo().getSampleRate() + " " +		    s.getFeatures().getFloat("end") + " " +		    (int) (s.getFeatures().getFloat("end") * 			   clunitDB.getSampleInfo().getSampleRate()));	    }	    unitFeatureSet.setInt("target_end", 		(int) (s.getFeatures().getFloat("end") 		       * clunitDB.getSampleInfo().getSampleRate()));	}    }