// Path: edits-core/src/main/java/org/edits/engines/EvaluationResult.java
// @Data
// @XmlRootElement(name = "result")
// @XmlAccessorType(XmlAccessType.FIELD)
// public class EvaluationResult implements Comparator<EvaluationResult>, Serializable {
// 
// 	private static final long serialVersionUID = 1L;
// 	@XmlElement
// 	private String assigned;
// 	@XmlElement
// 	private String benchmark;
// 	@XmlElement
// 	private double confidence;
// 	@XmlElement
// 	private String id;
// 	@XmlElement
// 	private double score;
// 
// 	public EvaluationResult() {
// 
// 	}
// 
// 	public EvaluationResult(String id, String assigned, String benchmark, double score, double confidence) {
// 
// 		this.id = id;
// 		this.assigned = assigned;
// 		this.benchmark = benchmark;
// 		this.score = score;
// 		this.confidence = confidence;
// 	}
// 
// 	@Override
// 	public int compare(EvaluationResult o1, EvaluationResult o2) {
// 		return o1.getId().compareTo(o2.getId());
// 	}
// }
// 
// Path: edits-core/src/main/java/org/edits/etaf/AnnotatedEntailmentPair.java
// @Data
// @XmlAccessorType(XmlAccessType.FIELD)
// @XmlType(name = "AnnotatedEntailmentPair", propOrder = { "t", "h" })
// public class AnnotatedEntailmentPair {
// 
// 	public static AnnotatedEntailmentPair create(String t2, String h2, EditsTextAnnotator annotator) throws Exception {
// 		AnnotatedEntailmentPair px = new AnnotatedEntailmentPair();
// 		AnnotatedText at = new AnnotatedText();
// 		at.getAnnotation().addAll(annotator.annotate(t2));
// 		px.getT().add(at);
// 		at = new AnnotatedText();
// 		at.getAnnotation().addAll(annotator.annotate(h2));
// 		px.getH().add(at);
// 		return px;
// 	}
// 
// 	@XmlTransient
// 	private Map<String, String> attributes;
// 	@XmlAttribute
// 	protected String entailment;
// 	@XmlElement
// 	protected List<AnnotatedText> h;
// 	@XmlAttribute
// 	protected String id;
// 
// 	@XmlTransient
// 	private int order;
// 
// 	@XmlElement
// 	protected List<AnnotatedText> t;
// 
// 	@XmlAttribute
// 	protected String task;
// 
// 	public AnnotatedEntailmentPair() {
// 		t = Lists.newArrayList();
// 		h = Lists.newArrayList();
// 		attributes = Maps.newHashMap();
// 	}
// 
// }


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.ws.rs.DefaultValue;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.QueryParam;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import lombok.Getter;
import org.apache.http.HttpResponse;
import org.apache.http.client.ClientProtocolException;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.impl.client.HttpClients;
import org.apache.log4j.LogManager;
import org.edits.engines.EvaluationResult;
import org.edits.etaf.AnnotatedEntailmentPair;
import com.sun.jersey.api.container.httpserver.HttpServerFactory;
import com.sun.jersey.api.core.DefaultResourceConfig;
		HttpClient client = HttpClients.createDefault();
		HttpGet request = new HttpGet("http://localhost:8095/system/evaluate?engine=rte7&t=b&h=b");
		HttpResponse response = client.execute(request);
		BufferedReader rd = new BufferedReader(new InputStreamReader(response.getEntity().getContent()));
		String line = "";
		while ((line = rd.readLine()) != null) {
			System.out.println(line);
		}
		rd.close();
		request = new HttpGet("http://localhost:8095/system/evaluate?engine=rte7&t=a&h=b");
		response = client.execute(request);
		rd = new BufferedReader(new InputStreamReader(response.getEntity().getContent()));
		line = "";
		while ((line = rd.readLine()) != null) {
			System.out.println(line);
		}
		rd.close();
		System.exit(0);
	}

	@Path("evaluate")
	@Produces(MediaType.APPLICATION_JSON)
	@GET
	public Response evaluate(@DefaultValue(EngineManager.DEFAULT_ENTAILMENT_ENGINE) @QueryParam("engine") String id,
			@QueryParam("t") String t, @QueryParam("h") String h) {
		try {
			init();
			EngineInstance e = manager.get(id);
			AnnotatedEntailmentPair p = AnnotatedEntailmentPair.create(t, h, e.annotator());
			System.out.println(p);
// Path: edits-core/src/main/java/org/edits/engines/EvaluationResult.java
// @Data
// @XmlRootElement(name = "result")
// @XmlAccessorType(XmlAccessType.FIELD)
// public class EvaluationResult implements Comparator<EvaluationResult>, Serializable {
// 
// 	private static final long serialVersionUID = 1L;
// 	@XmlElement
// 	private String assigned;
// 	@XmlElement
// 	private String benchmark;
// 	@XmlElement
// 	private double confidence;
// 	@XmlElement
// 	private String id;
// 	@XmlElement
// 	private double score;
// 
// 	public EvaluationResult() {
// 
// 	}
// 
// 	public EvaluationResult(String id, String assigned, String benchmark, double score, double confidence) {
// 
// 		this.id = id;
// 		this.assigned = assigned;
// 		this.benchmark = benchmark;
// 		this.score = score;
// 		this.confidence = confidence;
// 	}
// 
// 	@Override
// 	public int compare(EvaluationResult o1, EvaluationResult o2) {
// 		return o1.getId().compareTo(o2.getId());
// 	}
// }
// 
// Path: edits-core/src/main/java/org/edits/etaf/AnnotatedEntailmentPair.java
// @Data
// @XmlAccessorType(XmlAccessType.FIELD)
// @XmlType(name = "AnnotatedEntailmentPair", propOrder = { "t", "h" })
// public class AnnotatedEntailmentPair {
// 
// 	public static AnnotatedEntailmentPair create(String t2, String h2, EditsTextAnnotator annotator) throws Exception {
// 		AnnotatedEntailmentPair px = new AnnotatedEntailmentPair();
// 		AnnotatedText at = new AnnotatedText();
// 		at.getAnnotation().addAll(annotator.annotate(t2));
// 		px.getT().add(at);
// 		at = new AnnotatedText();
// 		at.getAnnotation().addAll(annotator.annotate(h2));
// 		px.getH().add(at);
// 		return px;
// 	}
// 
// 	@XmlTransient
// 	private Map<String, String> attributes;
// 	@XmlAttribute
// 	protected String entailment;
// 	@XmlElement
// 	protected List<AnnotatedText> h;
// 	@XmlAttribute
// 	protected String id;
// 
// 	@XmlTransient
// 	private int order;
// 
// 	@XmlElement
// 	protected List<AnnotatedText> t;
// 
// 	@XmlAttribute
// 	protected String task;
// 
// 	public AnnotatedEntailmentPair() {
// 		t = Lists.newArrayList();
// 		h = Lists.newArrayList();
// 		attributes = Maps.newHashMap();
// 	}
// 
// }


// Path: edits-server/src/main/java/org/edits/rest/RestService.java
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.ws.rs.DefaultValue;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.QueryParam;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import lombok.Getter;
import org.apache.http.HttpResponse;
import org.apache.http.client.ClientProtocolException;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.impl.client.HttpClients;
import org.apache.log4j.LogManager;
import org.edits.engines.EvaluationResult;
import org.edits.etaf.AnnotatedEntailmentPair;
import com.sun.jersey.api.container.httpserver.HttpServerFactory;
import com.sun.jersey.api.core.DefaultResourceConfig;

		HttpClient client = HttpClients.createDefault();
		HttpGet request = new HttpGet("http://localhost:8095/system/evaluate?engine=rte7&t=b&h=b");
		HttpResponse response = client.execute(request);
		BufferedReader rd = new BufferedReader(new InputStreamReader(response.getEntity().getContent()));
		String line = "";
		while ((line = rd.readLine()) != null) {
			System.out.println(line);
		}
		rd.close();
		request = new HttpGet("http://localhost:8095/system/evaluate?engine=rte7&t=a&h=b");
		response = client.execute(request);
		rd = new BufferedReader(new InputStreamReader(response.getEntity().getContent()));
		line = "";
		while ((line = rd.readLine()) != null) {
			System.out.println(line);
		}
		rd.close();
		System.exit(0);
	}

	@Path("evaluate")
	@Produces(MediaType.APPLICATION_JSON)
	@GET
	public Response evaluate(@DefaultValue(EngineManager.DEFAULT_ENTAILMENT_ENGINE) @QueryParam("engine") String id,
			@QueryParam("t") String t, @QueryParam("h") String h) {
		try {
			init();
			EngineInstance e = manager.get(id);
			AnnotatedEntailmentPair p = AnnotatedEntailmentPair.create(t, h, e.annotator());
			System.out.println(p);
			EvaluationResult r = e.getModel().getEngine().evaluate(p);