Factor out a common method of building TreeBinarizer