// Path: src/main/java/de/tudarmstadt/ukp/dkpro/argumentation/crossdomainclaims/utils/ArgUtils.java
// public class ArgUtils {
// 
// 	
// 	public static String getID(String s) {
// 		String[] tmp = s.split("/");
// 		return tmp[tmp.length-1].replace(".xmi","").replace(".bin", "");
// 	}
// 	
// 	
// 	public static String getID(File f) {
// 		return getID(f.getName());
// 	}
// 	
// 	
// 	public static boolean isClaim(Sentence s, JCas cas) {
// 		return selectOverlapping(Claim.class, s, cas).size()>0 || selectOverlapping(MajorClaim.class, s, cas).size()>0;
// 	}
// 	
// 	
// 	public static boolean isPremise(Sentence s, JCas cas) {
// 		return selectOverlapping(Premise.class, s, cas).size()>0;
// 	}
// 	
// 	
// 	public static <T extends TOP> List<T> selectOverlapping(Class<T> type,Annotation annotation, JCas jCas) {
//         Collection<T> allAnnotations = JCasUtil.select(jCas, type);
// 
//         List<T> result = new ArrayList<T>();
// 
//         for (T a : allAnnotations) {
//             if ((a instanceof Annotation) && (doOverlap(annotation, (Annotation) a))) {
//                 result.add(a);
//             }
//         }
// 
//         return result;
//     }
// 	
// 	 
// 	public static <T extends Annotation> boolean doOverlap(final T anno1, final T anno2) {
// 		return anno1.getEnd() > anno2.getBegin() && anno1.getBegin() < anno2.getEnd();
// 	}
// 	
// 	
// 	public static JCas readCas(File f) throws ResourceInitializationException, SAXException, IOException, CASException {
// 		CAS loadedCas = CasCreationUtils.createCas(TypeSystemDescriptionFactory.createTypeSystemDescription(), null, null); 
// 		FileInputStream in = new FileInputStream(f); 
// 		XmiCasDeserializer.deserialize(in, loadedCas);
// 		IOUtils.closeQuietly(in);
// 		return loadedCas.getJCas();
// 	}
// 	
// 	public static void writeFile(String fileName, String content) throws Exception {
// 		BufferedWriter br = new BufferedWriter(new FileWriter(new File(fileName)));
// 		br.write(content);
// 		br.close();
// 	}
// 	
// 	
// }


import de.tudarmstadt.ukp.dkpro.argumentation.crossdomainclaims.utils.ArgUtils;
import de.tudarmstadt.ukp.dkpro.core.api.metadata.type.DocumentMetaData;
import de.tudarmstadt.ukp.dkpro.core.api.segmentation.type.Sentence;
import de.tudarmstadt.ukp.dkpro.core.io.xmi.XmiReader;
import de.tudarmstadt.ukp.dkpro.core.io.xmi.XmiWriter;
import de.tudarmstadt.ukp.dkpro.tc.api.type.TextClassificationOutcome;
import de.tudarmstadt.ukp.dkpro.tc.api.type.TextClassificationUnit;
import org.apache.uima.analysis_engine.AnalysisEngineProcessException;
import org.apache.uima.cas.AbstractCas;
import org.apache.uima.cas.CAS;
import org.apache.uima.cas.CASException;
import org.apache.uima.cas.text.AnnotationFS;
import org.apache.uima.fit.component.JCasMultiplier_ImplBase;
import org.apache.uima.fit.factory.AnalysisEngineFactory;
import org.apache.uima.fit.factory.CollectionReaderFactory;
import org.apache.uima.fit.pipeline.SimplePipeline;
import org.apache.uima.fit.util.JCasUtil;
import org.apache.uima.jcas.JCas;
import org.apache.uima.util.CasCopier;
import java.io.File;
import java.util.Collection;
import java.util.Iterator;
        catch (CASException e) {
            throw new AnalysisEngineProcessException("Exception while creating JCas", null, e);
        }

        // Set new ids and URIs for copied cases.
        // The counting variable keeps track of how many new CAS objects are created from the
        // original CAS, a CAS relative counter.
        // NOTE: As it may cause confusion: If in sequence classification several or all CAS
        // contains only a single sequence this counter would be zero in all cases - this is not a
        // bug, but a cosmetic flaw
        DocumentMetaData.get(copyJCas).setDocumentId(
                DocumentMetaData.get(jCas).getDocumentId() + "_" + subCASCounter);
        DocumentMetaData.get(copyJCas).setDocumentUri(
                DocumentMetaData.get(jCas).getDocumentUri() + "_" + subCASCounter);

        // focus annotation
        AnnotationFS focusUnit = this.iterator.next();
        Sentence s = (Sentence) focusUnit;

        // set unit
        TextClassificationUnit unit = new TextClassificationUnit(copyJCas, s.getBegin(),
                s.getEnd());
        unit.setId(unitCounter);
        unitCounter++;
        subCASCounter++;

        // and outcome
        TextClassificationOutcome outcome = new TextClassificationOutcome(copyJCas, s.getBegin(),
                s.getEnd());

// Path: src/main/java/de/tudarmstadt/ukp/dkpro/argumentation/crossdomainclaims/utils/ArgUtils.java
// public class ArgUtils {
// 
// 	
// 	public static String getID(String s) {
// 		String[] tmp = s.split("/");
// 		return tmp[tmp.length-1].replace(".xmi","").replace(".bin", "");
// 	}
// 	
// 	
// 	public static String getID(File f) {
// 		return getID(f.getName());
// 	}
// 	
// 	
// 	public static boolean isClaim(Sentence s, JCas cas) {
// 		return selectOverlapping(Claim.class, s, cas).size()>0 || selectOverlapping(MajorClaim.class, s, cas).size()>0;
// 	}
// 	
// 	
// 	public static boolean isPremise(Sentence s, JCas cas) {
// 		return selectOverlapping(Premise.class, s, cas).size()>0;
// 	}
// 	
// 	
// 	public static <T extends TOP> List<T> selectOverlapping(Class<T> type,Annotation annotation, JCas jCas) {
//         Collection<T> allAnnotations = JCasUtil.select(jCas, type);
// 
//         List<T> result = new ArrayList<T>();
// 
//         for (T a : allAnnotations) {
//             if ((a instanceof Annotation) && (doOverlap(annotation, (Annotation) a))) {
//                 result.add(a);
//             }
//         }
// 
//         return result;
//     }
// 	
// 	 
// 	public static <T extends Annotation> boolean doOverlap(final T anno1, final T anno2) {
// 		return anno1.getEnd() > anno2.getBegin() && anno1.getBegin() < anno2.getEnd();
// 	}
// 	
// 	
// 	public static JCas readCas(File f) throws ResourceInitializationException, SAXException, IOException, CASException {
// 		CAS loadedCas = CasCreationUtils.createCas(TypeSystemDescriptionFactory.createTypeSystemDescription(), null, null); 
// 		FileInputStream in = new FileInputStream(f); 
// 		XmiCasDeserializer.deserialize(in, loadedCas);
// 		IOUtils.closeQuietly(in);
// 		return loadedCas.getJCas();
// 	}
// 	
// 	public static void writeFile(String fileName, String content) throws Exception {
// 		BufferedWriter br = new BufferedWriter(new FileWriter(new File(fileName)));
// 		br.write(content);
// 		br.close();
// 	}
// 	
// 	
// }


// Path: src/main/java/de/tudarmstadt/ukp/dkpro/argumentation/crossdomainclaims/reader/SentenceClaimOutcomeMultiplier.java
import de.tudarmstadt.ukp.dkpro.argumentation.crossdomainclaims.utils.ArgUtils;
import de.tudarmstadt.ukp.dkpro.core.api.metadata.type.DocumentMetaData;
import de.tudarmstadt.ukp.dkpro.core.api.segmentation.type.Sentence;
import de.tudarmstadt.ukp.dkpro.core.io.xmi.XmiReader;
import de.tudarmstadt.ukp.dkpro.core.io.xmi.XmiWriter;
import de.tudarmstadt.ukp.dkpro.tc.api.type.TextClassificationOutcome;
import de.tudarmstadt.ukp.dkpro.tc.api.type.TextClassificationUnit;
import org.apache.uima.analysis_engine.AnalysisEngineProcessException;
import org.apache.uima.cas.AbstractCas;
import org.apache.uima.cas.CAS;
import org.apache.uima.cas.CASException;
import org.apache.uima.cas.text.AnnotationFS;
import org.apache.uima.fit.component.JCasMultiplier_ImplBase;
import org.apache.uima.fit.factory.AnalysisEngineFactory;
import org.apache.uima.fit.factory.CollectionReaderFactory;
import org.apache.uima.fit.pipeline.SimplePipeline;
import org.apache.uima.fit.util.JCasUtil;
import org.apache.uima.jcas.JCas;
import org.apache.uima.util.CasCopier;
import java.io.File;
import java.util.Collection;
import java.util.Iterator;

        catch (CASException e) {
            throw new AnalysisEngineProcessException("Exception while creating JCas", null, e);
        }

        // Set new ids and URIs for copied cases.
        // The counting variable keeps track of how many new CAS objects are created from the
        // original CAS, a CAS relative counter.
        // NOTE: As it may cause confusion: If in sequence classification several or all CAS
        // contains only a single sequence this counter would be zero in all cases - this is not a
        // bug, but a cosmetic flaw
        DocumentMetaData.get(copyJCas).setDocumentId(
                DocumentMetaData.get(jCas).getDocumentId() + "_" + subCASCounter);
        DocumentMetaData.get(copyJCas).setDocumentUri(
                DocumentMetaData.get(jCas).getDocumentUri() + "_" + subCASCounter);

        // focus annotation
        AnnotationFS focusUnit = this.iterator.next();
        Sentence s = (Sentence) focusUnit;

        // set unit
        TextClassificationUnit unit = new TextClassificationUnit(copyJCas, s.getBegin(),
                s.getEnd());
        unit.setId(unitCounter);
        unitCounter++;
        subCASCounter++;

        // and outcome
        TextClassificationOutcome outcome = new TextClassificationOutcome(copyJCas, s.getBegin(),
                s.getEnd());

        if (ArgUtils.isClaim(s, copyJCas)) {