/** * Gets the current settings of the Classifier. * * @return an array of strings suitable for passing to setOptions */ @Override public String[] getOptions() { List<String> options = new ArrayList<String>(Arrays.asList(super.getOptions())); options.add("-stopwords"); options.add(getStopwords().toString()); return options.toArray(new String[options.size()]); }
/** * Performs intialization of the scheme. */ @Override protected void initialize() { List<String> words; super.initialize(); m_Words = new HashSet<String>(); words = read(); for (String word: words) { // comment? if (!word.startsWith("#")) m_Words.add(word); } }
/** * Sets the file containing the stopwords, null or a directory unset the * stopwords. * * @param value the file containing the stopwords */ public void setStopwords(File value) { if (value == null) { value = new File(System.getProperty("user.dir")); } m_Stopwords = value; reset(); }
/** * Parses a given list of options. * * @param options the list of options as an array of strings * @throws Exception if an option is not supported */ @Override public void setOptions(String[] options) throws Exception { String tmpStr; tmpStr = Utils.getOption("stopwords", options); if (tmpStr.isEmpty()) setStopwords(new File(".")); else setStopwords(new File(tmpStr)); super.setOptions(options); }
/** * Returns an enumeration describing the available options. * * @return an enumeration of all the available options. */ @Override public Enumeration<Option> listOptions() { Vector<Option> result = new Vector<Option>(); Enumeration<Option> enm = super.listOptions(); while (enm.hasMoreElements()) result.add(enm.nextElement()); result.addElement(new Option( "\t" + stopwordsTipText() + "\n" + "\t(default: .)", "stopwords", 1, "-stopwords <file>")); return result.elements(); }
error("Failed to read stopwords file '" + m_Stopwords + "'!"); e.printStackTrace();
/** * Parses a given list of options. * * @param options the list of options as an array of strings * @throws Exception if an option is not supported */ @Override public void setOptions(String[] options) throws Exception { String tmpStr; tmpStr = Utils.getOption("stopwords", options); if (tmpStr.isEmpty()) setStopwords(new File(".")); else setStopwords(new File(tmpStr)); super.setOptions(options); }
/** * Returns an enumeration describing the available options. * * @return an enumeration of all the available options. */ @Override public Enumeration<Option> listOptions() { Vector<Option> result = new Vector<Option>(); Enumeration<Option> enm = super.listOptions(); while (enm.hasMoreElements()) result.add(enm.nextElement()); result.addElement(new Option( "\t" + stopwordsTipText() + "\n" + "\t(default: .)", "stopwords", 1, "-stopwords <file>")); return result.elements(); }
error("Failed to read stopwords file '" + m_Stopwords + "'!"); e.printStackTrace();
/** * Performs intialization of the scheme. */ @Override protected void initialize() { List<String> patterns; super.initialize(); m_Patterns = new ArrayList<Pattern>(); patterns = read(); for (String pattern: patterns) { m_Patterns.add(Pattern.compile(pattern)); } }
/** * Gets the current settings of the Classifier. * * @return an array of strings suitable for passing to setOptions */ @Override public String[] getOptions() { List<String> options = new ArrayList<String>(Arrays.asList(super.getOptions())); options.add("-stopwords"); options.add(getStopwords().toString()); return options.toArray(new String[options.size()]); }
/** * Sets the file containing the stopwords, null or a directory unset the * stopwords. * * @param value the file containing the stopwords */ public void setStopwords(File value) { if (value == null) { value = new File(System.getProperty("user.dir")); } m_Stopwords = value; reset(); }
/** * Performs intialization of the scheme. */ @Override protected void initialize() { List<String> patterns; super.initialize(); m_Patterns = new ArrayList<Pattern>(); patterns = read(); for (String pattern: patterns) { m_Patterns.add(Pattern.compile(pattern)); } }
/** * Performs intialization of the scheme. */ @Override protected void initialize() { List<String> words; super.initialize(); m_Words = new HashSet<String>(); words = read(); for (String word: words) { // comment? if (!word.startsWith("#")) m_Words.add(word); } }