package com.grayben.riskExtractor.htmlScorer.partScorers.tagScorers;

import org.jsoup.parser.Tag;

import java.util.HashMap;
import java.util.Map;

/**
 * Created by beng on 22/12/2015.
 */
public class TagSegmentationScorer
extends MapScorer<Tag> {
    public static final String SCORE_LABEL = "tag-emphasis";

    public TagSegmentationScorer(Map<Tag, Integer> tagScores) {
        super(SCORE_LABEL, tagScores);
    }

    public static final Map<Tag, Integer> defaultMap() {

        Map<Tag, Integer> tagScoreMap = new HashMap<>();
        tagScoreMap.put(Tag.valueOf("br"), 1);
        tagScoreMap.put(Tag.valueOf("dd"), 1);
        tagScoreMap.put(Tag.valueOf("dl"), 1);
        tagScoreMap.put(Tag.valueOf("dt"), 1);
        tagScoreMap.put(Tag.valueOf("form"), 1);
        tagScoreMap.put(Tag.valueOf("hr"), 1);
        tagScoreMap.put(Tag.valueOf("li"), 1);
        tagScoreMap.put(Tag.valueOf("p"), 1);
        tagScoreMap.put(Tag.valueOf("pre"), 1);
        tagScoreMap.put(Tag.valueOf("table"), 1);
        tagScoreMap.put(Tag.valueOf("tbody"), 1);
        tagScoreMap.put(Tag.valueOf("td"), 1);
        tagScoreMap.put(Tag.valueOf("th"), 1);
        tagScoreMap.put(Tag.valueOf("title"), 1);
        tagScoreMap.put(Tag.valueOf("tr"), 1);
        tagScoreMap.put(Tag.valueOf("ul"), 1);
        tagScoreMap.put(Tag.valueOf("div"), 1);

        return tagScoreMap;

    }

    @Override
    public int score(Tag input) {
        validateTagInput(input);
        return super.score(input);
    }

    public static void validateTagInput(Tag input){
        if(input.getName().isEmpty()){
            throw new IllegalArgumentException(
                    "Input Tag must have a non-empty name"
            );
        }
    }
}

@@ -63,16 +63,80 @@
 orers;%0A%0A
+import com.grayben.riskExtractor.htmlScorer.partScorers.Scorer;%0A
 import o
@@ -210,16 +210,100 @@
 p;%0A%0A/**%0A
+ * Scores the segmentation of %7B@link Tag%7Ds passed in to %7B@link #score(Tag)%7D.%0A * %3Cp%3E%0A
  * Creat
@@ -312,22 +312,18 @@
  by 
-beng on 22/12/
+Ben Gray, 
 2015
@@ -392,69 +392,347 @@
 %3E %7B%0A
-    public static final String SCORE_LABEL = %22tag-emphasis%22;%0A
+%0A    /**%0A     * The string (uniquely) labelling this class.%0A     * %3Cp%3E%0A     * Used to identify this class in a collection of %7B@link Scorer%7Ds.%0A     */%0A    public static final String SCORE_LABEL = %22tag-emphasis%22;%0A%0A    /**%0A     * Construct with the specified map.%0A     * @param tagScores the map with which to construct this instance.%0A     */
 %0A   
@@ -830,32 +830,100 @@
 Scores);%0A    %7D%0A%0A
+    /**%0A     * @return the default score map for this class%0A     */%0A
     public stati
@@ -1865,24 +1865,178 @@
 ap;%0A%0A    %7D%0A%0A
+    /**%0A     * Use the underlying %7B@link MapScorer%7D to score the specified input.%0A     * @param input the input to score%0A     * @return the score%0A     */%0A
     @Overrid
@@ -2142,24 +2142,82 @@
 ut);%0A    %7D%0A%0A
+    /**%0A     * @param input the input to validate%0A     */%0A
     public s

Document TagSegmentationSCorer