/** * Sets the stopwords algorithms. * * @param value the algorithms */ public void setStopwords(StopwordsHandler[] value) { m_Stopwords = value; reset(); }
/** * Used to create an instance of a specific stopwords scheme. * * @return a suitably configured <code>StopwordsHandler</code> value */ @Override public StopwordsHandler getStopwords() { MultiStopwords result; StopwordsHandler[] handlers; result = new MultiStopwords(); handlers = new StopwordsHandler[3]; handlers[0] = new Rainbow(); handlers[1] = new WordsFromFile(); ((WordsFromFile) handlers[1]).setStopwords(new File(getTmpDirectory() + File.separator + "WordsFromFile.txt")); handlers[2] = new RegExpFromFile(); ((RegExpFromFile) handlers[2]).setStopwords(new File(getTmpDirectory() + File.separator + "RegExpFromFile.txt")); result.setStopwords(handlers); return result; }
/** * 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; String[] tmpOptions; List<StopwordsHandler> handlers; handlers = new ArrayList<StopwordsHandler>(); do { tmpStr = Utils.getOption("stopwords", options); if (!tmpStr.isEmpty()) { tmpOptions = Utils.splitOptions(tmpStr); tmpStr = tmpOptions[0]; tmpOptions[0] = ""; handlers.add((StopwordsHandler) Utils.forName(StopwordsHandler.class, tmpStr, tmpOptions)); } } while (!tmpStr.isEmpty()); setStopwords(handlers.toArray(new StopwordsHandler[handlers.size()])); 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: none)", "stopwords", 1, "-stopwords <classname + options>")); return result.elements(); }
/** * Used to create an instance of a specific stopwords scheme. * * @return a suitably configured <code>StopwordsHandler</code> value */ @Override public StopwordsHandler getStopwords() { MultiStopwords result; StopwordsHandler[] handlers; result = new MultiStopwords(); handlers = new StopwordsHandler[3]; handlers[0] = new Rainbow(); handlers[1] = new WordsFromFile(); ((WordsFromFile) handlers[1]).setStopwords(new File(getTmpDirectory() + File.separator + "WordsFromFile.txt")); handlers[2] = new RegExpFromFile(); ((RegExpFromFile) handlers[2]).setStopwords(new File(getTmpDirectory() + File.separator + "RegExpFromFile.txt")); result.setStopwords(handlers); return result; }
/** * 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; String[] tmpOptions; List<StopwordsHandler> handlers; handlers = new ArrayList<StopwordsHandler>(); do { tmpStr = Utils.getOption("stopwords", options); if (!tmpStr.isEmpty()) { tmpOptions = Utils.splitOptions(tmpStr); tmpStr = tmpOptions[0]; tmpOptions[0] = ""; handlers.add((StopwordsHandler) Utils.forName(StopwordsHandler.class, tmpStr, tmpOptions)); } } while (!tmpStr.isEmpty()); setStopwords(handlers.toArray(new StopwordsHandler[handlers.size()])); 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: none)", "stopwords", 1, "-stopwords <classname + options>")); return result.elements(); }
/** * Sets the stopwords algorithms. * * @param value the algorithms */ public void setStopwords(StopwordsHandler[] value) { m_Stopwords = value; reset(); }