Adding Pauper in the stop-words list

All supported format names in stopwords have been grouped into a constant for easy update and re-use.
This commit is contained in:
Valerio Maggio
2023-05-20 13:58:38 +01:00
parent 5ceb541180
commit f03a8049cd

View File

@@ -38,6 +38,7 @@ import static forge.lda.lda.inference.InferenceMethod.CGS;
*/
public final class LDAModelGenetrator {
public static final String SUPPORTED_LDA_FORMATS = "Historic|Modern|Pioneer|Standard|Legacy|Vintage|Pauper";
public static Map<String, Map<String,List<List<Pair<String, Double>>>>> ldaPools = new HashMap<>();
public static Map<String, List<Archetype>> ldaArchetypes = new HashMap<>();
@@ -167,7 +168,6 @@ public final class LDAModelGenetrator {
public static List<Archetype> initializeFormat(GameFormat format) throws Exception{
Dataset dataset = new Dataset(format);
//estimate number of topics to attempt to find using power law
final int numTopics = Float.valueOf(347f*dataset.getNumDocs()/(2892f + dataset.getNumDocs())).intValue();
System.out.println("Num Topics = " + numTopics);
@@ -223,8 +223,8 @@ public final class LDAModelGenetrator {
}
LinkedHashMap<String, Integer> wordCounts = new LinkedHashMap<>();
for( Deck deck: decks){
String name = deck.getName().replaceAll(".* Version - ","").replaceAll(" \\((Historic|Modern|Pioneer|Standard|Legacy|Vintage), #[0-9]+\\)","");
name = name.replaceAll("\\(Historic|Modern|Pioneer|Standard|Legacy|Vintage|Fuck|Shit|Cunt\\)","");
String name = deck.getName().replaceAll(".* Version - ","").replaceAll(" \\((" + SUPPORTED_LDA_FORMATS + "), #[0-9]+\\)","");
name = name.replaceAll("\\(" + SUPPORTED_LDA_FORMATS + "|Fuck|Shit|Cunt|Ass|Arse|Dick|Pussy\\)","");
String[] tokens = name.split(" ");
for(String rawtoken: tokens){
String token = rawtoken.toLowerCase();
@@ -256,7 +256,7 @@ public final class LDAModelGenetrator {
System.out.println("============ " + deckName);
System.out.println(decks.toString());
unfilteredTopics.add(new Archetype(topRankVocabs,deckName,decks.size()));
unfilteredTopics.add(new Archetype(topRankVocabs, deckName, decks.size()));
}
Comparator<Archetype> archetypeComparator = new Comparator<Archetype>() {
@Override
@@ -376,7 +376,7 @@ public final class LDAModelGenetrator {
int old = matrix[legendIntegerMap.get(legend.getName())][cardIntegerMap.get(pairCard.getName())];
matrix[legendIntegerMap.get(legend.getName())][cardIntegerMap.get(pairCard.getName())] = old + 1;
}catch (NullPointerException ne){
//Todo: Not sure what was failing here
//TODO: Not sure what was failing here
ne.printStackTrace();
}
}