Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mavenize project for easier project setup. #14

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 12 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#<a id="top"></a>Anonymouth

![](src/edu/drexel/psal/resources/graphics/readme_Logo.png)
![](src/main/resources/graphics/readme_Logo.png)

Document Anonymization Tool, Version 0.5<br>

Expand Down Expand Up @@ -38,17 +38,19 @@ Though Anonymouth and it's team works hard to provide you with tools to help rem

###<a id="dependencies"></a>Dependencies

Java 7 is required to run Anonymouth. If you don't yet have it, get it at <a href="http://java.com/en/download/index.jsp">Oracle's website here</a> and follow the installation instructions provided there.
Java 7 (or higher) and Maven are required to run Anonymouth. If you don't yet have it, get it at <a href="http://java.com/en/download/index.jsp">Oracle's website here</a> and [Maven Download](https://maven.apache.org/download.cgi). Follow the installation instructions provided there.

If you are unsure whether or not you have it installed, follow these steps to see:
* OS X:
1. Open up Terminal (Applications/Utilities)
2. Type "java -version" without the quotes
3. If you see something like `java version "1.7.x_xx"` then you're ready to go! If not, then that means you most likely don't have Java 7 installed, in which case you should go to the download link above
* Windows:
1. Follow the instructions here: http://www.java.com/en/download/help/version_manual.xml. if you have version "1.7.x_xx", then you're good to go! If not, then that means you most likely don't have Java 7 installed, in which case you should go to the download link above

If you are using Eclipse, also make sure that Java 7 is your selected compiler by checking `Preferences/Java/Compiler` and is an included Library in your java Build Path (Not sure how to do this? Google is your friend).
1. Open up a terminal
Linux: Bash/ZSH/...
OS X: Applications/Utilities
Windows: Press Windows key + R and execute cmd
2. Type `java -version`
3. If you don't see something like `java version "1.7.x_xx" or "1.8.x_xx"` then please install the required Java version
4. Check if Maven installed by running `mvn`. Note that Maven sometimes comes bundled within your favorite IDE.
If not please install it using [this](https://maven.apache.org/install.html)

Please make sure that you import the project as Maven project in your favorite IDE.

Anonymouth requires the included `jsan_resources` directory in it's running directory (The main Anonymouth directory containing lib, src, etc.). It should be in the correct directy by default.

Expand Down
Binary file removed lib/Jama-1.0.3.jar
Binary file not shown.
Binary file removed lib/fasttag_v2.jar
Binary file not shown.
Binary file removed lib/jaws-bin.jar
Binary file not shown.
Binary file removed lib/jcommon-1.0.17.jar
Binary file not shown.
Binary file removed lib/jfreechart-1.0.14.jar
Binary file not shown.
Binary file not shown.
Binary file removed lib/miglayout-4.0-swing.jar
Binary file not shown.
Binary file removed lib/org.annolab.tt4j-1.0.15.jar
Binary file not shown.
Binary file removed lib/stanford-postagger-2012-01-06.jar
Binary file not shown.
Binary file removed lib/weka_3_7_9.jar
Binary file not shown.
123 changes: 123 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>

<groupId>edu.drexel.psal</groupId>
<artifactId>anonymouth</artifactId>
<packaging>jar</packaging>

<version>1.0-SNAPSHOT</version>
<name>anonymouth</name>
<url>https://psal.cs.drexel.edu/index.php/JStylo-Anonymouth</url>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.6.1</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>3.0.2</version>
<configuration>
<archive>
<manifest>
<mainClass>edu.drexel.psal.anonymouth.gooie.ThePresident</mainClass>
</manifest>
</archive>
</configuration>
</plugin>
</plugins>
</build>

<repositories>
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
</repositories>

<dependencies>
<dependency>
<groupId>com.github.mark-watson</groupId>
<artifactId>fasttag_v2</artifactId>
<version>e769975e70</version>
</dependency>

<dependency>
<groupId>com.github.jaytaylor</groupId>
<artifactId>jaws</artifactId>
<version>1.3.1</version>
</dependency>

<dependency>
<groupId>com.memetix</groupId>
<artifactId>microsoft-translator-java-api</artifactId>
<version>0.6.1</version>
</dependency>

<dependency>
<groupId>nz.ac.waikato.cms.weka</groupId>
<artifactId>weka-stable</artifactId>
<version>3.8.1</version>
</dependency>

<dependency>
<groupId>net.sf.jcommon</groupId>
<artifactId>jcommon</artifactId>
<version>1.0.0</version>
</dependency>
<dependency>
<groupId>jfreechart</groupId>
<artifactId>jfreechart</artifactId>
<version>1.0.0</version>
</dependency>
<dependency>
<groupId>com.miglayout</groupId>
<artifactId>miglayout-swing</artifactId>
<version>4.1</version>
</dependency>

<dependency>
<groupId>org.annolab.tt4j</groupId>
<artifactId>org.annolab.tt4j</artifactId>
<version>1.0.15</version>
</dependency>

<dependency>
<groupId>gov.nist.math</groupId>
<artifactId>jama</artifactId>
<version>1.0.3</version>
</dependency>

<!-- System libraries -->
<dependency>
<groupId>jgaap-5.2.0-lite</groupId>
<artifactId>jgaap-5.2.0-lite</artifactId>
<scope>system</scope>
<version>5.2.0</version>
<systemPath>${basedir}/lib/jgaap-5.2.0-lite.jar</systemPath>
</dependency>

<dependency>
<groupId>ui</groupId>
<artifactId>ui</artifactId>
<scope>system</scope>
<version>1.0-SNAPSHOT</version>
<systemPath>${basedir}/lib/ui.jar</systemPath>
</dependency>

<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<scope>test</scope>
</dependency>
</dependencies>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,7 @@ public class ANONConstants {
//DO NOT DELETE, for use when bundling Anonymouth in an OS X app.
//public static final String LOG_DIR = System.getProperty("user.home")+"/Desktop/anonymouth_log";
public static final String LOG_DIR = WORKING_DIR + "anonymouth_log";
public static final String RESOURCE_PACKAGE = "/edu/drexel/psal/resources/";
public static final String GRAPHICS_PREFIX = RESOURCE_PACKAGE+"graphics/";
public static final String GRAPHICS_PREFIX = "graphics/";
public static final String EXTERNAL_RESOURCE_PACKAGE = ANONConstants.WORKING_DIR + "jsan_resources/";
public static final String CORPORA_PREFIX = EXTERNAL_RESOURCE_PACKAGE+"corpora/";
public static final String PROBLEMSETS_PREFIX = EXTERNAL_RESOURCE_PACKAGE+"problem_sets/";
Expand All @@ -31,7 +30,7 @@ public class ANONConstants {
public static final String DOC_MAGICIAN_WRITE_DIR = WORKING_DIR + ".edited_documents/";
public static final String KOPPEL_FUNCTION_WORDS = EXTERNAL_RESOURCE_PACKAGE+"koppel_function_words.txt";
public static final String SER_DIR = WORKING_DIR + ".serialized_objects/";
public static final String GRAPHICS = "/edu/drexel/psal/resources/graphics/";
public static final String GRAPHICS = "/graphics/";
public static final String PATH_TO_CLASSIFIER = SER_DIR+"saved_classifier.model";
public static final String ABBREVIATIONS_FILE = EXTERNAL_RESOURCE_PACKAGE+"abbreviations.txt";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import java.awt.event.WindowEvent;
import java.awt.event.WindowListener;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

import javax.swing.SwingUtilities;
Expand Down Expand Up @@ -523,10 +524,13 @@ protected void updateClassifierTab() {
Logger.logln(NAME+"Successfully loaded classifier: "+className);
//Add an -M option for SMO classifier
if (className.toLowerCase().contains("smo")) {
String options = advancedWindow.getOptionsStr(((OptionHandler)tmpClassifier).getOptions()) + " -M";
String[] optionsArray = ((OptionHandler) tmpClassifier).getOptions();
optionsArray = Arrays.copyOf(optionsArray, optionsArray.length + 1);
optionsArray[optionsArray.length - 1] = "-M";
try {
((OptionHandler)tmpClassifier).setOptions(options.split(" "));
((OptionHandler)tmpClassifier).setOptions(optionsArray);
} catch (Exception e) {
e.printStackTrace();
Logger.logln(NAME+"Problem occured while tried to add -M flag to SMO classifier", LogOut.STDERR);
}
}
Expand All @@ -544,4 +548,4 @@ protected void updateClassifierTab() {

SwingUtilities.invokeLater(new ScrollToTop(new Point(0, 0), advancedWindow.classDescScrollPane));
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -635,4 +635,4 @@ public void actionPerformed(ActionEvent e) {
};
continueButton.addActionListener(continueListener);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import edu.drexel.psal.jstylo.generics.Logger;
import edu.drexel.psal.jstylo.generics.Logger.LogOut;
import edu.stanford.nlp.ling.*;
import edu.stanford.nlp.tagger.maxent.MaxentTagger;
import edu.stanford.nlp.tagger.maxent.MaxentTagger;

import java.io.*;
import java.util.*;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ public Evaluation getTrainTestEval(List<Document> testDocs){ //TODO overhaul thi
allInstances.setClassIndex(allInstances.numAttributes()-1);
goodInstances = new Instances(allInstances,0,extractedAuthors.size());
smo.buildClassifier(goodInstances);
smo.setBuildLogisticModels(true);
smo.setBuildCalibrationModels(true);
eval = new Evaluation(allInstances);
} catch (Exception e){
e.printStackTrace();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,7 @@ public NormBaselineEnum getNormBaseline() {
* The normalization factor.
*/
public Double getNormFactor() {
return norm.getSecond() == null ? 1 : norm.getSecond();
return norm.getSecond() == null ? 1D : norm.getSecond();
}

/**
Expand Down