private void checkDefaultProperties() { if (!Properties.containsProperty(VXLReaderPropertyKeys.CONTAINER_TYPE)) { Map<String, String> properties = new HashMap<String, String>(); // vxl reader properties.put( VXLReaderPropertyKeys.CONTAINER_TYPE, VXLReaderPropertyKeys.ContainerType.CLASS.toString()); properties.put(VXLReaderPropertyKeys.INCLUDE_CLASS, new Boolean(true).toString()); properties.put(VXLReaderPropertyKeys.INCLUDE_INTERFACE, new Boolean(true).toString()); properties.put(VXLReaderPropertyKeys.INCLUDE_SUPERCLASS, new Boolean(true).toString()); properties.put(VXLReaderPropertyKeys.INCLUDE_ENUM, new Boolean(true).toString()); properties.put(VXLReaderPropertyKeys.INCLUDE_ATTRIBUTE, new Boolean(true).toString()); properties.put(VXLReaderPropertyKeys.INCLUDE_METHOD, new Boolean(true).toString()); properties.put(VXLReaderPropertyKeys.INCLUDE_PARAMETER, new Boolean(true).toString()); properties.put(VXLReaderPropertyKeys.INCLUDE_LOCAL_VARIABLE, new Boolean(false).toString()); properties.put(VXLReaderPropertyKeys.INCLUDE_COMMENTS, new Boolean(true).toString()); properties.put(VXLReaderPropertyKeys.INCLUDE_JAVADOC, new Boolean(true).toString()); // identifier filter final String YES = "yes"; properties.put(FilterProperties.ENGLISH_LANGUAGE, YES); properties.put(FilterProperties.UNDERSCORE, YES); properties.put(FilterProperties.CAMEL_CASE, YES); properties.put(FilterProperties.STOPWORDS, YES); properties.put(FilterProperties.STEMMING, YES); properties.put(FilterProperties.CONVERT_TO_LOWER_CASE, YES); properties.put(FilterProperties.LIMIT_TERM_LENGTH, new Integer(3).toString()); properties.put(FilterProperties.STOPWORDS_FILE, Properties.STOPWORDS_FILE); // ir vector model properties.put( IRPropertyKeys.DISTANCE_FUNCTION, IRPropertyKeys.DistanceFunctionType.COSINE.toString()); Properties.setProperties(properties); } }
public JavaVocabularyExtractionController( File[] projects, boolean includeComment, boolean includeJavaDoc, boolean removeStopWords, boolean removeSmallWords, int minimalTermLength) { super(); checkDefaultProperties(); this.projects = projects; this.setNumStages(this.projects.length * 2); Map<String, String> properties = new HashMap<String, String>(); properties.put(VXLReaderPropertyKeys.INCLUDE_COMMENTS, String.valueOf(includeComment)); properties.put(VXLReaderPropertyKeys.INCLUDE_JAVADOC, String.valueOf(includeJavaDoc)); properties.put(FilterProperties.STOPWORDS, removeStopWords ? "yes" : "no"); properties.put( FilterProperties.LIMIT_TERM_LENGTH, removeSmallWords ? new Integer(minimalTermLength).toString() : new Integer(0).toString()); Properties.setProperties(properties); this.vocabularyResultFolder = Properties.getProperty(Properties.WORKSPACE) + File.separator + Properties.VOCABULARY_OUTPUT; this.termDocResultFolder = Properties.getProperty(Properties.WORKSPACE) + File.separator + Properties.TERM_DOC_MATRIX_OUTPUT; checkResultFolder(this.vocabularyResultFolder); checkResultFolder(this.termDocResultFolder); props = Properties.getProperties(); this.vxlReader = new VXLReader(props); this.identifierFilter = new IdentifierFilter(props); }