Skip to content

Commit

Permalink
Adding Pauper in the stop-words list
Browse files Browse the repository at this point in the history
All supported format names in stopwords have been grouped into a constant for easy update and re-use.
  • Loading branch information
leriomaggio committed May 20, 2023
1 parent 5ceb541 commit f03a804
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions forge-lda/src/main/java/forge/lda/LDAModelGenetrator.java
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
*/
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<>();

Expand Down Expand Up @@ -167,7 +168,6 @@ public static Map<String,List<List<Pair<String, Double>>>> loadFormat(GameFormat

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);
Expand Down Expand Up @@ -223,8 +223,8 @@ public static List<Archetype> initializeFormat(GameFormat format) throws Excepti
}
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();
Expand Down Expand Up @@ -256,7 +256,7 @@ public static List<Archetype> initializeFormat(GameFormat format) throws Excepti
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
Expand Down Expand Up @@ -376,7 +376,7 @@ public static void updateLegendMatrix(Deck deck, PaperCard legend, Map<String, I
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();
}
}
Expand Down

0 comments on commit f03a804

Please sign in to comment.