public void processSpace(Properties properties) {
try {
// first ensure that we are no longer writing to the matrix
termDocumentMatrixBuilder.finish();
Transform transform = new LogEntropyTransform();
String transformClass =
properties.getProperty(MATRIX_TRANSFORM_PROPERTY);
if (transformClass != null) {
try {
Class clazz = Class.forName(transformClass);
transform = (Transform)(clazz.newInstance());
}
// perform a general catch here due to the number of possible
// things that could go wrong. Rethrow all exceptions as an
// error.
catch (Exception e) {
throw new Error(e);
}
}
LSA_LOGGER.info("performing " + transform + " transform");
// Get the finished matrix file from the builder
File termDocumentMatrix = termDocumentMatrixBuilder.getFile();
if (LSA_LOGGER.isLoggable(Level.FINE)) {
LSA_LOGGER.fine("stored term-document matrix in format " +
termDocumentMatrixBuilder.getMatrixFormat()
+ " at " + termDocumentMatrix.getAbsolutePath());
}
// Convert the raw term counts using the specified transform
File transformedMatrix = transform.transform(termDocumentMatrix,
termDocumentMatrixBuilder.getMatrixFormat());
if (LSA_LOGGER.isLoggable(Level.FINE)) {
LSA_LOGGER.fine("transformed matrix to " +
transformedMatrix.getAbsolutePath());