// Path: graphene-core/src/main/java/org/lambda3/graphene/core/discourse_simplification/model/DiscourseSimplificationContent.java
// public class DiscourseSimplificationContent extends SimplificationContent {
// 	private boolean coreferenced;
// 
// 	// for deserialization
// 	public DiscourseSimplificationContent() {
// 		super();
// 		this.coreferenced = false;
// 	}
// 
// 	public DiscourseSimplificationContent(SimplificationContent simplificationContent) {
// 		for (OutSentence outSentence : simplificationContent.getSentences()) {
// 			this.addSentence(outSentence);
// 		}
// 	}
// 
// 	public boolean isCoreferenced() {
// 		return coreferenced;
// 	}
// 
// 	public void setCoreferenced(boolean coreferenced) {
// 		this.coreferenced = coreferenced;
// 	}
// }
// 
// Path: graphene-core/src/main/java/org/lambda3/graphene/core/relation_extraction/model/LinkedContext.java
// public class LinkedContext {
// 	private String targetID;
// 	private Relation classification;
// 
// 	// for deserialization
// 	public LinkedContext() {
// 	}
// 
// 	public LinkedContext(String targetID, Relation classification) {
// 		this.targetID = targetID;
// 		this.classification = classification;
// 	}
// 
// 	public String getTargetID() {
// 		return targetID;
// 	}
// 
// 	public Extraction getTargetExtraction(RelationExtractionContent content) {
// 		return content.getExtraction(targetID);
// 	}
// 
// 	public Relation getClassification() {
// 		return classification;
// 	}
// 
// 	@Override
// 	public boolean equals(Object o) {
// 		return ((o instanceof LinkedContext)
// 			&& (((LinkedContext) o).targetID.equals(targetID))
// 			&& (((LinkedContext) o).classification.equals(classification)));
// 	}
// }
// 
// Path: graphene-core/src/main/java/org/lambda3/graphene/core/relation_extraction/model/SimpleContext.java
// public class SimpleContext {
//     private String text;
//     private Relation classification;
//     private TimeInformation timeInformation; // optional
// 
//     // for deserialization
//     public SimpleContext() {
//     }
// 
//     public SimpleContext(String text, Relation classification) {
//         this.text = text;
//         this.classification = classification;
//         this.timeInformation = null;
//     }
// 
//     public String getText() {
//         return text;
//     }
// 
//     public Relation getClassification() {
// 		return classification;
// 	}
// 
// 	public Optional<TimeInformation> getTimeInformation() {
// 		return Optional.ofNullable(timeInformation);
// 	}
// 
// 	public void setTimeInformation(TimeInformation timeInformation) {
// 		this.timeInformation = timeInformation;
// 	}
// }


import com.typesafe.config.Config;
import com.typesafe.config.ConfigException;
import edu.stanford.nlp.ling.Word;
import edu.stanford.nlp.trees.Tree;
import edu.stanford.nlp.trees.tregex.TregexMatcher;
import edu.stanford.nlp.trees.tregex.TregexPattern;
import org.lambda3.graphene.core.discourse_simplification.model.DiscourseSimplificationContent;
import org.lambda3.graphene.core.relation_extraction.model.*;
import org.lambda3.graphene.core.relation_extraction.model.LinkedContext;
import org.lambda3.graphene.core.relation_extraction.model.SimpleContext;
import org.lambda3.text.simplification.discourse.model.Element;
import org.lambda3.text.simplification.discourse.model.OutSentence;
import org.lambda3.text.simplification.discourse.runner.discourse_tree.Relation;
import org.lambda3.text.simplification.discourse.utils.parseTree.ParseTreeExtractionUtils;
import org.lambda3.text.simplification.discourse.utils.words.WordsUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.List;
				newExtractions.add(new NewExtraction(true, simpleContext.getRelation(), new Extraction(
					ExtractionType.VERB_BASED,
					null,
					element.getSentenceIdx(),
					element.getContextLayer() + 1,
					WordsUtils.wordsToString(relationWords),
					WordsUtils.wordsToString(arg1Words),
					element.getText()
				)));
			}
		} else {

			// add as simple context
			SimpleContext c = new SimpleContext(
				WordsUtils.wordsToString(ParseTreeExtractionUtils.getContainingWords(simpleContext.getPhrase())),
				simpleContext.getRelation()
			);
			simpleContext.getTimeInformation().ifPresent(t -> c.setTimeInformation(t));
			simpleContexts.add(c);
		}
	}

	private void processLinkedContext(Element element, org.lambda3.text.simplification.discourse.model.LinkedContext linkedContext, List<LinkedContext> linkedContexts, DiscourseSimplificationContent discourseSimplificationContent, RelationExtractionContent relationExtractionContent) {
		List<Extraction> targets = processElement(linkedContext.getTargetElement(discourseSimplificationContent), discourseSimplificationContent, relationExtractionContent);
		targets.forEach(t -> linkedContexts.add(new LinkedContext(
			t.getId(),
			linkedContext.getRelation()
		)));
	}

// Path: graphene-core/src/main/java/org/lambda3/graphene/core/discourse_simplification/model/DiscourseSimplificationContent.java
// public class DiscourseSimplificationContent extends SimplificationContent {
// 	private boolean coreferenced;
// 
// 	// for deserialization
// 	public DiscourseSimplificationContent() {
// 		super();
// 		this.coreferenced = false;
// 	}
// 
// 	public DiscourseSimplificationContent(SimplificationContent simplificationContent) {
// 		for (OutSentence outSentence : simplificationContent.getSentences()) {
// 			this.addSentence(outSentence);
// 		}
// 	}
// 
// 	public boolean isCoreferenced() {
// 		return coreferenced;
// 	}
// 
// 	public void setCoreferenced(boolean coreferenced) {
// 		this.coreferenced = coreferenced;
// 	}
// }
// 
// Path: graphene-core/src/main/java/org/lambda3/graphene/core/relation_extraction/model/LinkedContext.java
// public class LinkedContext {
// 	private String targetID;
// 	private Relation classification;
// 
// 	// for deserialization
// 	public LinkedContext() {
// 	}
// 
// 	public LinkedContext(String targetID, Relation classification) {
// 		this.targetID = targetID;
// 		this.classification = classification;
// 	}
// 
// 	public String getTargetID() {
// 		return targetID;
// 	}
// 
// 	public Extraction getTargetExtraction(RelationExtractionContent content) {
// 		return content.getExtraction(targetID);
// 	}
// 
// 	public Relation getClassification() {
// 		return classification;
// 	}
// 
// 	@Override
// 	public boolean equals(Object o) {
// 		return ((o instanceof LinkedContext)
// 			&& (((LinkedContext) o).targetID.equals(targetID))
// 			&& (((LinkedContext) o).classification.equals(classification)));
// 	}
// }
// 
// Path: graphene-core/src/main/java/org/lambda3/graphene/core/relation_extraction/model/SimpleContext.java
// public class SimpleContext {
//     private String text;
//     private Relation classification;
//     private TimeInformation timeInformation; // optional
// 
//     // for deserialization
//     public SimpleContext() {
//     }
// 
//     public SimpleContext(String text, Relation classification) {
//         this.text = text;
//         this.classification = classification;
//         this.timeInformation = null;
//     }
// 
//     public String getText() {
//         return text;
//     }
// 
//     public Relation getClassification() {
// 		return classification;
// 	}
// 
// 	public Optional<TimeInformation> getTimeInformation() {
// 		return Optional.ofNullable(timeInformation);
// 	}
// 
// 	public void setTimeInformation(TimeInformation timeInformation) {
// 		this.timeInformation = timeInformation;
// 	}
// }


// Path: graphene-core/src/main/java/org/lambda3/graphene/core/relation_extraction/RelationExtractionRunner.java
import com.typesafe.config.Config;
import com.typesafe.config.ConfigException;
import edu.stanford.nlp.ling.Word;
import edu.stanford.nlp.trees.Tree;
import edu.stanford.nlp.trees.tregex.TregexMatcher;
import edu.stanford.nlp.trees.tregex.TregexPattern;
import org.lambda3.graphene.core.discourse_simplification.model.DiscourseSimplificationContent;
import org.lambda3.graphene.core.relation_extraction.model.*;
import org.lambda3.graphene.core.relation_extraction.model.LinkedContext;
import org.lambda3.graphene.core.relation_extraction.model.SimpleContext;
import org.lambda3.text.simplification.discourse.model.Element;
import org.lambda3.text.simplification.discourse.model.OutSentence;
import org.lambda3.text.simplification.discourse.runner.discourse_tree.Relation;
import org.lambda3.text.simplification.discourse.utils.parseTree.ParseTreeExtractionUtils;
import org.lambda3.text.simplification.discourse.utils.words.WordsUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.List;

				newExtractions.add(new NewExtraction(true, simpleContext.getRelation(), new Extraction(
					ExtractionType.VERB_BASED,
					null,
					element.getSentenceIdx(),
					element.getContextLayer() + 1,
					WordsUtils.wordsToString(relationWords),
					WordsUtils.wordsToString(arg1Words),
					element.getText()
				)));
			}
		} else {

			// add as simple context
			SimpleContext c = new SimpleContext(
				WordsUtils.wordsToString(ParseTreeExtractionUtils.getContainingWords(simpleContext.getPhrase())),
				simpleContext.getRelation()
			);
			simpleContext.getTimeInformation().ifPresent(t -> c.setTimeInformation(t));
			simpleContexts.add(c);
		}
	}

	private void processLinkedContext(Element element, org.lambda3.text.simplification.discourse.model.LinkedContext linkedContext, List<LinkedContext> linkedContexts, DiscourseSimplificationContent discourseSimplificationContent, RelationExtractionContent relationExtractionContent) {
		List<Extraction> targets = processElement(linkedContext.getTargetElement(discourseSimplificationContent), discourseSimplificationContent, relationExtractionContent);
		targets.forEach(t -> linkedContexts.add(new LinkedContext(
			t.getId(),
			linkedContext.getRelation()
		)));
	}

	private List<Extraction> processElement(Element element, DiscourseSimplificationContent discourseSimplificationContent, RelationExtractionContent relationExtractionContent) {