// Path: src/main/java/de/tudarmstadt/ukp/dkpro/argumentation/crossdomainclaims/features/syntactic/utils/DependencyTriplesMC.java
// public class DependencyTriplesMC extends FreqDistBasedMetaCollector {
// 
// //	public static final String DEPENDENCIES_FD_KEY = "depTripleFdFile.ser";
// //    @ConfigurationParameter(name = DependencyTriples.PARAM_DEPENDENCY_TRIPLE_FD_FILE, mandatory = true)
// //    private File depTripleFdFile;
//     
//     
//     public static final String PARAM_DEPENDENCY_TRIPLE_FD_FILE = "depTripleFdFile";
//     @ConfigurationParameter(name = PARAM_DEPENDENCY_TRIPLE_FD_FILE, mandatory = true)
//     private File depTripleFdFile;
//     
//     @Override
//     public void initialize(UimaContext context) throws ResourceInitializationException {
//         super.initialize(context);
// 
//     }
//     
//     
//     @Override
//     public void process(JCas jcas) throws AnalysisEngineProcessException {
//         FrequencyDistribution<String> foundDependencies = new FrequencyDistribution<String>();
//         	
//     	Collection<Dependency> dependencies = JCasUtil.select(jcas, Dependency.class);  
//     	
//     	for (Dependency dep : dependencies) {
// 			
//     		// lemma with type
// 			String dependency = dep.getDependencyType()+ ":" + dep.getGovernor().getLemma().getValue()+"_"+dep.getDependent().getLemma().getValue();
//     		
// 			foundDependencies.addSample(dependency, foundDependencies.getCount(dependency)+1);
// 		}
// 
//         for (String ngram : foundDependencies.getKeys()) {
//             fd.addSample(ngram, foundDependencies.getCount(ngram));
//         }
//     }
// 
//     @Override
//     public Map<String, String> getParameterKeyPairs() {
//         Map<String, String> mapping = new HashMap<String, String>();
//         mapping.put(DependencyTriples.PARAM_DEPENDENCY_TRIPLE_FD_FILE, PARAM_DEPENDENCY_TRIPLE_FD_FILE);
//         return mapping;
//     }
// 
//     @Override
//     protected File getFreqDistFile() {
//         return depTripleFdFile;
//     }
// }


import org.apache.uima.jcas.JCas;
import org.apache.uima.resource.ResourceInitializationException;
import org.apache.uima.resource.ResourceSpecifier;
import java.io.File;
import java.util.*;
import de.tudarmstadt.ukp.dkpro.argumentation.crossdomainclaims.features.syntactic.utils.DependencyTriplesMC;
import de.tudarmstadt.ukp.dkpro.core.api.frequency.util.FrequencyDistribution;
import de.tudarmstadt.ukp.dkpro.core.api.syntax.type.dependency.Dependency;
import de.tudarmstadt.ukp.dkpro.tc.api.exception.TextClassificationException;
import de.tudarmstadt.ukp.dkpro.tc.api.features.ClassificationUnitFeatureExtractor;
import de.tudarmstadt.ukp.dkpro.tc.api.features.Feature;
import de.tudarmstadt.ukp.dkpro.tc.api.features.FeatureExtractorResource_ImplBase;
import de.tudarmstadt.ukp.dkpro.tc.api.features.meta.MetaCollector;
import de.tudarmstadt.ukp.dkpro.tc.api.features.meta.MetaDependent;
import de.tudarmstadt.ukp.dkpro.tc.api.type.TextClassificationUnit;
import org.apache.uima.fit.descriptor.ConfigurationParameter;
import org.apache.uima.fit.util.JCasUtil;
            trainingFD = new FrequencyDistribution<String>();
            trainingFD.load(new File(depTripleFdFile));
        } catch (Exception e) {
            throw new ResourceInitializationException(e);
        }
        
    	topKDeps = new FrequencyDistribution<String>();
    	
    	if (numberOfDependencyTriples==-1) {
    		// consider all samples
    		for (String sample : trainingFD.getKeys()) {
    			topKDeps.addSample(sample, trainingFD.getCount(sample));
    		}
    	}
    	else {
    		// consider a given number of samples
	    	List<String> topK = trainingFD.getMostFrequentSamples(numberOfDependencyTriples);
	    	for (String sample : topK) {
	    		topKDeps.addSample(sample, trainingFD.getCount(sample));
	    	}
    	} 	
    	
    	getLogger().info("Loaded " + topKDeps.getKeys().size() + " dependencies for feature extraction");
    	
    	return true;
    }
    
	
    public List<Class<? extends MetaCollector>> getMetaCollectorClasses() {
        List<Class<? extends MetaCollector>> metaCollectorClasses = new ArrayList<Class<? extends MetaCollector>>();
// Path: src/main/java/de/tudarmstadt/ukp/dkpro/argumentation/crossdomainclaims/features/syntactic/utils/DependencyTriplesMC.java
// public class DependencyTriplesMC extends FreqDistBasedMetaCollector {
// 
// //	public static final String DEPENDENCIES_FD_KEY = "depTripleFdFile.ser";
// //    @ConfigurationParameter(name = DependencyTriples.PARAM_DEPENDENCY_TRIPLE_FD_FILE, mandatory = true)
// //    private File depTripleFdFile;
//     
//     
//     public static final String PARAM_DEPENDENCY_TRIPLE_FD_FILE = "depTripleFdFile";
//     @ConfigurationParameter(name = PARAM_DEPENDENCY_TRIPLE_FD_FILE, mandatory = true)
//     private File depTripleFdFile;
//     
//     @Override
//     public void initialize(UimaContext context) throws ResourceInitializationException {
//         super.initialize(context);
// 
//     }
//     
//     
//     @Override
//     public void process(JCas jcas) throws AnalysisEngineProcessException {
//         FrequencyDistribution<String> foundDependencies = new FrequencyDistribution<String>();
//         	
//     	Collection<Dependency> dependencies = JCasUtil.select(jcas, Dependency.class);  
//     	
//     	for (Dependency dep : dependencies) {
// 			
//     		// lemma with type
// 			String dependency = dep.getDependencyType()+ ":" + dep.getGovernor().getLemma().getValue()+"_"+dep.getDependent().getLemma().getValue();
//     		
// 			foundDependencies.addSample(dependency, foundDependencies.getCount(dependency)+1);
// 		}
// 
//         for (String ngram : foundDependencies.getKeys()) {
//             fd.addSample(ngram, foundDependencies.getCount(ngram));
//         }
//     }
// 
//     @Override
//     public Map<String, String> getParameterKeyPairs() {
//         Map<String, String> mapping = new HashMap<String, String>();
//         mapping.put(DependencyTriples.PARAM_DEPENDENCY_TRIPLE_FD_FILE, PARAM_DEPENDENCY_TRIPLE_FD_FILE);
//         return mapping;
//     }
// 
//     @Override
//     protected File getFreqDistFile() {
//         return depTripleFdFile;
//     }
// }


// Path: src/main/java/de/tudarmstadt/ukp/dkpro/argumentation/crossdomainclaims/features/syntactic/DependencyTriples.java
import org.apache.uima.jcas.JCas;
import org.apache.uima.resource.ResourceInitializationException;
import org.apache.uima.resource.ResourceSpecifier;
import java.io.File;
import java.util.*;
import de.tudarmstadt.ukp.dkpro.argumentation.crossdomainclaims.features.syntactic.utils.DependencyTriplesMC;
import de.tudarmstadt.ukp.dkpro.core.api.frequency.util.FrequencyDistribution;
import de.tudarmstadt.ukp.dkpro.core.api.syntax.type.dependency.Dependency;
import de.tudarmstadt.ukp.dkpro.tc.api.exception.TextClassificationException;
import de.tudarmstadt.ukp.dkpro.tc.api.features.ClassificationUnitFeatureExtractor;
import de.tudarmstadt.ukp.dkpro.tc.api.features.Feature;
import de.tudarmstadt.ukp.dkpro.tc.api.features.FeatureExtractorResource_ImplBase;
import de.tudarmstadt.ukp.dkpro.tc.api.features.meta.MetaCollector;
import de.tudarmstadt.ukp.dkpro.tc.api.features.meta.MetaDependent;
import de.tudarmstadt.ukp.dkpro.tc.api.type.TextClassificationUnit;
import org.apache.uima.fit.descriptor.ConfigurationParameter;
import org.apache.uima.fit.util.JCasUtil;

            trainingFD = new FrequencyDistribution<String>();
            trainingFD.load(new File(depTripleFdFile));
        } catch (Exception e) {
            throw new ResourceInitializationException(e);
        }
        
    	topKDeps = new FrequencyDistribution<String>();
    	
    	if (numberOfDependencyTriples==-1) {
    		// consider all samples
    		for (String sample : trainingFD.getKeys()) {
    			topKDeps.addSample(sample, trainingFD.getCount(sample));
    		}
    	}
    	else {
    		// consider a given number of samples
	    	List<String> topK = trainingFD.getMostFrequentSamples(numberOfDependencyTriples);
	    	for (String sample : topK) {
	    		topKDeps.addSample(sample, trainingFD.getCount(sample));
	    	}
    	} 	
    	
    	getLogger().info("Loaded " + topKDeps.getKeys().size() + " dependencies for feature extraction");
    	
    	return true;
    }
    
	
    public List<Class<? extends MetaCollector>> getMetaCollectorClasses() {
        List<Class<? extends MetaCollector>> metaCollectorClasses = new ArrayList<Class<? extends MetaCollector>>();
        metaCollectorClasses.add(DependencyTriplesMC.class);