designing tag grouping for the whitelist part 1 (blame trimead)

pull/1/head
alexb 5 years ago
parent 94e0d4aa58
commit 91b9d3c22c
  1. 2
      Tagger/.project
  2. 5
      Tagger/src/Tagger.java
  3. 29
      Tagger/src/imageTag.java

@ -16,7 +16,7 @@
<arguments>
<dictionary>
<key>LaunchConfigHandle</key>
<value>&lt;project&gt;/.externalToolBuilders/New_Builder.launch</value>
<value>&lt;project&gt;/.externalToolBuilders/New_Builder (1).launch</value>
</dictionary>
</arguments>
</buildCommand>

@ -26,6 +26,11 @@ public class Tagger {
StringBuilder sb = new StringBuilder();
if (tags!=null) {
for (String tag : tags) {
if (imageTag.subtaglist.containsKey(tag)) {
List<String> subtag = imageTag.subtaglist.get(tag);
/* info needed- subtags and
* action- look up the value for the subtag */
}
if (sb.length()!=0) {
sb.append("; ");
}

@ -29,6 +29,7 @@ public class imageTag {
public static List<File> pixiv_rawimage_list = new ArrayList<File>();
public static HashMap<String,List<String>> taglist = new HashMap<String,List<String>>();
public static Map<String,Integer> tagCounter = new TreeMap<String,Integer>();
public static HashMap<String,List<String>> subtaglist = new HashMap<String,List<String>>();
public static void main(String[] args) {
@ -61,10 +62,32 @@ public class imageTag {
s = br.readLine();
while (s!=null) {
String newtag = s.trim().toLowerCase();
tag_whitelist.put(newtag,true);
System.out.println("Read in whitelisted tag: "+newtag);
String[] combtag;
List<String> listofsubs = new ArrayList<String>();
if (s.contains(": ")); {
combtag = s.split(": ");
for (int i=1;i<combtag.length; i++) {
tag_whitelist.put(combtag[i].trim().toLowerCase(),true);
System.out.println("Read in whitelisted tag: "+combtag[i]);
subtaglist.put(combtag[i],listofsubs);
}
tag_whitelist.put(combtag[0].trim().toLowerCase(),true);
System.out.println("Read in whitelisted tag: "+combtag[0]);
listofsubs.add(combtag[0]);
}
/* the first word is read and will commit to the change while other
* tags in colons will be read but default to the first for committing */
s=br.readLine();
}
}
System.out.println("SUBTAG LIST:");
for (String ss : subtaglist.keySet()) {
List<String> subtags = subtaglist.get(ss);
System.out.println(" "+ss+": ");
for (String sss : subtags) {
System.out.println(" -"+sss);
}
}
System.out.println("============");
} catch (IOException e) {
e.printStackTrace();
}

Loading…
Cancel
Save