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