private void installFeatures(int[] feature,WeightFactory wfactory,IDFLookup idflookup) {
		if (feature.length == 0) {
			return;// No features
		}
		int lasthash = feature[0];
		int idf;
		int count = 1;
		int sz = 1;
		for (int i = 0; i < feature.length; ++i) {
			if (feature[i] != lasthash) {
				lasthash = feature[i];
				sz += 1;
			}
		}
		hash = new HashEntry[sz];
		lasthash = feature[0];
		sz = 0;
		if (!idflookup.empty()) {
			idf = idflookup.getCount(lasthash);

			for (int i = 1; i < feature.length; ++i) {
				int featurei = feature[i];
				if (featurei != lasthash) {
					hash[sz] = new HashEntry(lasthash, count, idf, wfactory);
					sz += 1;
					lasthash = featurei;
					count = 1;
					idf = idflookup.getCount(lasthash);
				}
				else {
					count += 1;
				}
			}
		}
		else {
			idf = 0;
			for (int i = 1; i < feature.length; ++i) {
				int featurei = feature[i];
				if (featurei != lasthash) {
					hash[sz] = new HashEntry(lasthash, count, idf, wfactory);
					sz += 1;
					lasthash = featurei;
					count = 1;
				}
				else {
					count += 1;
				}
			}
		}
		hash[sz] = new HashEntry(lasthash, count, idf, wfactory);
	}
Assuming -feature- is sorted and -hash- is empty, count the features and populate -hash- and -tf-
For every unique feature, look up its idf via -idflookup-
@param feature is the list of sorted hash features
@param wfactory is the WeightFactory used to decide feature weights
@param idflookup is the IDFLookup used to decide relative frequency of individual features
Ghidra/Framework/Generic/src/main/java/generic/lsh/vector/LSHCosineVector.java