Ejemplo n.º 1
0
  public void oncreate() {

    if (Gate.getPluginsHome() != null) {
      System.out.println(Gate.getPluginsHome());
    } else {
      Gate.setPluginsHome(new File("C:/Program Files/GATE_Developer_8.0/plugins"));
    }
  }
  /**
   * Initialise the ANNIE system. This creates a "corpus pipeline" application that can be used to
   * run sets of documents through the extraction system.
   */
  public void initAnnie() throws GateException, IOException {
    Out.prln("Initialising ANNIE...");

    // load the ANNIE application from the saved state in plugins/ANNIE
    File pluginsHome = Gate.getPluginsHome();
    File anniePlugin = new File(pluginsHome, "ANNIE");
    File annieGapp = new File(anniePlugin, "ANNIE_with_defaults.gapp");
    annieController = (CorpusController) PersistenceManager.loadObjectFromFile(annieGapp);

    Out.prln("...ANNIE loaded");
  } // initAnnie()
Ejemplo n.º 3
0
  @Override
  public void setUp() throws MalformedURLException, IOException, GateException {
    if (!Gate.isInitialised()) {
      Gate.init();
    }

    File baseDir = new File(Gate.getPluginsHome(), "Tagger_Measurements");

    parser =
        new MeasurementsParser(
            (new File(baseDir, "resources/units.dat")).toURI().toURL(),
            new File(baseDir, "resources/common_words.txt").toURI().toURL());
  }
Ejemplo n.º 4
0
  public static void main(String[] args) throws Exception {

    /*Set to your Gate installation home*/
    XMLConfiguration config = new XMLConfiguration("config/madaap.xml");
    Gate.setGateHome(new File(config.getString("gate.home")));

    Gate.init();

    Gate.getCreoleRegister()
        .registerDirectories(
            new File(Gate.getPluginsHome(), ANNIEConstants.PLUGIN_DIR).toURI().toURL());

    /*Set the path to \Plugins\Tools directory*/
    Gate.getCreoleRegister()
        .registerDirectories(
            new File(config.getString("gate.home") + "\\plugins\\Tools").toURI().toURL());

    /*Declare queue to receive URL from various collectors*/
    BlockingQueue<URL> queue = new LinkedBlockingQueue<URL>();

    /*Start extractor, initialization will run the thread*/
    Extractor e = new Extractor(queue);

    /*Timer to schedule collector tasks at regular intervals*/
    Timer timer = new Timer();

    /*Collect URL from /input/url.txt*/
    TimerTask manualFeederTask = new ManualFeeder(queue);
    long manualFeederTime =
        Long.parseLong(config.getString("timer.ManualFeederInterval"))
            * ONE_HOUR; // Unit of ManualFeederTime: hour
    timer.scheduleAtFixedRate(manualFeederTask, 0, manualFeederTime);

    /*Collect URL from twitter feed*/

    TimerTask twitterTask = new Twitter(queue);
    long twitterTime =
        Long.parseLong(config.getString("timer.TwitterInterval"))
            * ONE_MIN; // Unit of twitterTime: minutes
    timer.scheduleAtFixedRate(twitterTask, 0, twitterTime);

    /*Check all URL if they are active or not*/
    TimerTask checkerTask = new Checker();
    long checkerTime =
        Long.parseLong(config.getString("timer.CheckerInterval"))
            * ONE_HOUR; // Unit of CheckerTime: hour
    timer.scheduleAtFixedRate(checkerTask, 0, checkerTime);
  }