You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mahout.apache.org by td...@apache.org on 2010/07/24 05:59:09 UTC
svn commit: r978789 - in /mahout/trunk: conf/driver.classes.props
conf/prepare20newsgroups.props
examples/src/main/java/org/apache/mahout/classifier/bayes/PrepareTwentyNewsgroups.java
Author: tdunning
Date: Sat Jul 24 03:59:08 2010
New Revision: 978789
URL: http://svn.apache.org/viewvc?rev=978789&view=rev
Log:
MAHOUT-448 - make lift a little easier for example users
Added:
mahout/trunk/conf/prepare20newsgroups.props
Modified:
mahout/trunk/conf/driver.classes.props
mahout/trunk/examples/src/main/java/org/apache/mahout/classifier/bayes/PrepareTwentyNewsgroups.java
Modified: mahout/trunk/conf/driver.classes.props
URL: http://svn.apache.org/viewvc/mahout/trunk/conf/driver.classes.props?rev=978789&r1=978788&r2=978789&view=diff
==============================================================================
--- mahout/trunk/conf/driver.classes.props (original)
+++ mahout/trunk/conf/driver.classes.props Sat Jul 24 03:59:08 2010
@@ -18,6 +18,7 @@ org.apache.mahout.utils.vectors.RowIdJob
org.apache.mahout.text.WikipediaToSequenceFile = seqwiki : Wikipedia xml dump to sequence file
org.apache.mahout.classifier.bayes.TestClassifier = testclassifier : Test Bayes Classifier
org.apache.mahout.classifier.bayes.TrainClassifier = trainclassifier : Train Bayes Classifier
+org.apache.mahout.classifier.bayes.PrepareTwentyNewsgroups = prepare20newsgroups : Reformat 20 newsgroups data
org.apache.mahout.math.hadoop.decomposer.DistributedLanczosSolver = svd : Lanczos Singular Value Decomposition
org.apache.mahout.math.hadoop.decomposer.EigenVerificationJob = cleansvd : Cleanup and verification of SVD output
org.apache.mahout.math.hadoop.similarity.RowSimilarityJob = rowsimilarity : Compute the pairwise similarities of the rows of a matrix
Added: mahout/trunk/conf/prepare20newsgroups.props
URL: http://svn.apache.org/viewvc/mahout/trunk/conf/prepare20newsgroups.props?rev=978789&view=auto
==============================================================================
(empty)
Modified: mahout/trunk/examples/src/main/java/org/apache/mahout/classifier/bayes/PrepareTwentyNewsgroups.java
URL: http://svn.apache.org/viewvc/mahout/trunk/examples/src/main/java/org/apache/mahout/classifier/bayes/PrepareTwentyNewsgroups.java?rev=978789&r1=978788&r2=978789&view=diff
==============================================================================
--- mahout/trunk/examples/src/main/java/org/apache/mahout/classifier/bayes/PrepareTwentyNewsgroups.java (original)
+++ mahout/trunk/examples/src/main/java/org/apache/mahout/classifier/bayes/PrepareTwentyNewsgroups.java Sat Jul 24 03:59:08 2010
@@ -18,6 +18,7 @@
package org.apache.mahout.classifier.bayes;
import java.io.File;
+import java.io.FileNotFoundException;
import java.nio.charset.Charset;
import org.apache.commons.cli2.CommandLine;
@@ -92,9 +93,16 @@ public final class PrepareTwentyNewsgrou
analyzer = (Analyzer) Class.forName(analyzerName).getConstructor(Version.class).newInstance(Version.LUCENE_30);
}
// parent dir contains dir by category
+ if (!parentDir.exists()) {
+ throw new FileNotFoundException("Can't find input directory " + parentDir);
+ }
File[] categoryDirs = parentDir.listFiles();
for (File dir : categoryDirs) {
if (dir.isDirectory()) {
+ if (!outputDir.exists() && !outputDir.mkdirs()) {
+ throw new IllegalArgumentException("Can't create output directory");
+ }
+
File outputFile = new File(outputDir, dir.getName() + ".txt");
BayesFileFormatter.collapse(dir.getName(), analyzer, dir, charset, outputFile);
}
@@ -103,4 +111,4 @@ public final class PrepareTwentyNewsgrou
CommandLineUtil.printHelp(group);
}
}
-}
\ No newline at end of file
+}