Class StopwordFilterTool

java.lang.Object
opennlp.tools.cmdline.CmdLineTool
opennlp.tools.cmdline.BasicCmdLineTool
opennlp.tools.cmdline.stopword.StopwordFilterTool

public final class StopwordFilterTool extends opennlp.tools.cmdline.BasicCmdLineTool
A command line tool that filters stop words from whitespace-separated tokens read on standard input and prints the kept tokens to standard output, one input line per output line.

Usage: opennlp StopwordFilter <lang|file>. The single argument is either an ISO 639 language code matching one of the bundled lists, or a path to a custom stopword list file (one entry per line, # comments and blank lines ignored, loaded case-insensitively). The tokens to filter are always read from standard input. A bundled language code takes precedence; to force loading a file whose name happens to be a language code, qualify it with a path (e.g. ./en).

  • Constructor Details

    • StopwordFilterTool

      public StopwordFilterTool()
  • Method Details

    • getShortDescription

      public String getShortDescription()
      Overrides:
      getShortDescription in class opennlp.tools.cmdline.CmdLineTool
      Returns:
      Retrieves a short description of what the tool does
    • getHelp

      public String getHelp()
      Specified by:
      getHelp in class opennlp.tools.cmdline.CmdLineTool
      Returns:
      Retrieves a description on how to use the tool
    • hasParams

      public boolean hasParams()
      Overrides:
      hasParams in class opennlp.tools.cmdline.CmdLineTool
      Returns:
      Retrieves whether the tool has any command line params
    • run

      public void run(String[] args)
      Description copied from class: opennlp.tools.cmdline.BasicCmdLineTool
      Executes the tool with the given parameters.
      Specified by:
      run in class opennlp.tools.cmdline.BasicCmdLineTool
      Parameters:
      args - arguments