package com.grayben.riskExtractor.helpers;

import com.grayben.riskExtractor.htmlScorer.ScoredText;
import com.grayben.riskExtractor.htmlScorer.partScorers.Scorer;
import org.apache.commons.io.IOUtils;
import org.jsoup.nodes.Element;
import org.jsoup.nodes.Node;

import java.io.InputStream;
import java.util.Set;

/**
 * Created by beng on 20/04/2016.
 */
public final class ScoredTextReverseEngineerer {

    public static Node treeFrom(ScoredText scoredText, Set<Scorer<Element>> elementScorers){
        throw new UnsupportedOperationException("Not implemented");
    }

    public static String htmlFrom(Node tree){
        StringBuilder sb = new StringBuilder();
        tree.html(sb);
        return sb.toString();
    }

    public static String htmlFrom(ScoredText scoredText, Set<Scorer<Element>> elementScorers){
        Node tree = treeFrom(scoredText, elementScorers);
        return htmlFrom(tree);
    }

    public static InputStream inputStreamFrom(String html){
        return IOUtils.toInputStream(html);
    }

    public static InputStream inputStreamFrom(Node tree){
        String html = htmlFrom(tree);
        return inputStreamFrom(html);
    }

    public static InputStream inputSteamFrom(ScoredText scoredText, Set<Scorer<Element>> elementScorers){
        String html = htmlFrom(scoredText, elementScorers);
        return inputStreamFrom(html);
    }

}

@@ -285,16 +285,39 @@
 Stream;%0A
+import java.util.List;%0A
 import j
@@ -330,16 +330,16 @@
 il.Set;%0A
-
 %0A/**%0A * 
@@ -427,176 +427,8 @@
  %7B%0A%0A
-    public static Node treeFrom(ScoredText scoredText, Set%3CScorer%3CElement%3E%3E elementScorers)%7B%0A        throw new UnsupportedOperationException(%22Not implemented%22);%0A    %7D%0A%0A
     
@@ -684,87 +684,162 @@
     
-Node tree = treeFrom(scoredText, elementScorers);%0A        return htmlFrom(tree)
+List%3CString%3E textElementsSurroundedByAppropriateTags = null;%0A        String taggedTextSurroundedByFrame = null;%0A        return taggedTextSurroundedByFrame
 ;%0A  

Remove a step in reversal; can go ScoredText -> html directly