Skip to content
Snippets Groups Projects
Commit f0a691f9 authored by Eike Cochu's avatar Eike Cochu
Browse files

updated dynnmf filebase

updated dynnmf filebase, added missing lines
changed default enums to functions
parent 1ee8470b
No related branches found
No related tags found
No related merge requests found
......@@ -10,6 +10,7 @@ import java.util.List;
import java.util.Map;
import de.vipra.cmd.ex.FilebaseException;
import de.vipra.util.CalendarUtils;
import de.vipra.util.Constants.WindowResolution;
import de.vipra.util.FileUtils;
import de.vipra.util.model.ArticleFull;
......@@ -43,9 +44,11 @@ public class DynNMFFilebase extends Filebase {
c.setTime(date);
String dirName = "" + c.get(Calendar.YEAR);
switch (windowResolution) {
case MONTHLY:
break;
case QUARTERLY:
dirName += "-" + CalendarUtils.getQuarter(c);
break;
case MONTHLY:
dirName += "-" + c.get(Calendar.MONTH);
break;
case YEARLY:
default:
......
......@@ -2,5 +2,5 @@ db.host=localhost
db.port=27017
db.name=test
tm.processor=corenlp
tm.analyzer=jgibb
tm.analyzer=dynnmf
tm.saveallwords=false
\ No newline at end of file
package de.vipra.util;
import java.util.Calendar;
public class CalendarUtils {
public static final int getQuarter(Calendar c) {
return (int) Math.ceil(c.get(Calendar.MONTH) / 3.0);
}
}
......@@ -40,13 +40,13 @@ public class Config {
public String databaseName = Constants.DB_NAME;
@ConfigKey("tm.processor")
public Processor processor = Constants.Processor.DEFAULT;
public Processor processor = Constants.Processor.DEFAULT();
@ConfigKey("tm.analyzer")
public Analyzer analyzer = Constants.Analyzer.DEFAULT;
public Analyzer analyzer = Constants.Analyzer.DEFAULT();
@ConfigKey("tm.windowresolution")
public WindowResolution windowResolution = Constants.WindowResolution.DEFAULT;
public WindowResolution windowResolution = Constants.WindowResolution.DEFAULT();
@ConfigKey("tm.saveallwords")
public boolean saveAllWords = Constants.SAVE_ALL_WORDS;
......
......@@ -205,8 +205,7 @@ public class Constants {
* The text processors available, including the default text processor
*/
public static enum Processor {
CORENLP("corenlp"),
DEFAULT(CORENLP);
CORENLP("corenlp");
public final String name;
......@@ -218,6 +217,10 @@ public class Constants {
this.name = def.name;
}
public static Processor DEFAULT() {
return CORENLP;
}
public static Processor fromString(String text) {
if (text != null) {
for (Processor b : Processor.values()) {
......@@ -226,7 +229,7 @@ public class Constants {
}
}
}
return DEFAULT;
return DEFAULT();
}
}
......@@ -235,8 +238,7 @@ public class Constants {
*/
public static enum Analyzer {
JGIBB("jgibb"),
DYNNMF("dynnmf"),
DEFAULT(JGIBB);
DYNNMF("dynnmf");
public final String name;
......@@ -248,6 +250,10 @@ public class Constants {
this.name = def.name;
}
public static Analyzer DEFAULT() {
return JGIBB;
}
public static Analyzer fromString(String text) {
if (text != null) {
for (Analyzer b : Analyzer.values()) {
......@@ -256,7 +262,7 @@ public class Constants {
}
}
}
return DEFAULT;
return DEFAULT();
}
}
......@@ -266,8 +272,7 @@ public class Constants {
public static enum WindowResolution {
MONTHLY("monthly"),
QUARTERLY("quarterly"),
YEARLY("yearly"),
DEFAULT(MONTHLY);
YEARLY("yearly");
public final String name;
......@@ -279,6 +284,10 @@ public class Constants {
this.name = def.name;
}
public static WindowResolution DEFAULT() {
return YEARLY;
}
public static WindowResolution fromString(String text) {
if (text != null) {
for (WindowResolution b : WindowResolution.values()) {
......@@ -287,7 +296,7 @@ public class Constants {
}
}
}
return DEFAULT;
return DEFAULT();
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment