Package org.dbpedia.spotlight.exceptions

Examples of org.dbpedia.spotlight.exceptions.InitializationException


        try {
            unigramClassifier.classify(unigramOccurrence);
            ngramClassifier.classify(ngramOccurrence);
        } catch (Exception e) {
            throw new InitializationException("An error occurred while classifying a test spot using the co-occurrence " +
                    "based spot selector. This is most probably caused by an outdated spot selector model. Please " +
                    "check the spot selector models defined 'org.dbpedia.spotlight.spot.cooccurrence.classifier.*'.", e);
        }
        LOG.info("Done.");

View Full Code Here


          spotterConfiguration.getCoOcSelectorDatabaseUser(),
          spotterConfiguration.getCoOcSelectorDatabasePassword()
      );

    } catch (SQLException e) {
      throw new InitializationException("SQL Exception: Maybe wrong filename, incorrect JDBC connector String?", e);
    } catch (ClassNotFoundException e) {
      throw new InitializationException("Did not find SQL driver class specified in configuration file, " +
          "is the driver in the classpath?", e);
    } catch (InstantiationException e) {
      throw new InitializationException("Could not instantiate SQL driver.", e);
    } catch (IllegalAccessException e) {
      throw new InitializationException("No access to SQL driver specified in configuration file.", e);
    }

  }
View Full Code Here

    if(dataSource.toLowerCase().equals(UKWAC)) {
      return new InstanceBuilderUnigramUKWAC(dataProvider);
    }else if(dataSource.toLowerCase().equals(GOOGLE_NGRAM)){
      return new InstanceBuilderUnigramGoogle(dataProvider);
    }else{
      throw new InitializationException("No known occurrence data source found. Please check " +
          "org.dbpedia.spotlight.spot.cooccurrence.datasource in the configuration file.");
     
    }
  }
View Full Code Here

    if(dataSource.toLowerCase().equals(UKWAC)) {
      return new InstanceBuilderNGramUKWAC(dataProvider);
    }else if(dataSource.toLowerCase().equals(GOOGLE_NGRAM)){
      return new InstanceBuilderNGramGoogle(dataProvider);
    }else{
      throw new InitializationException("No known occurrence data source found. Please check " +
          "org.dbpedia.spotlight.spot.cooccurrence.datasource in the configuration file.");

    }
 
  }
View Full Code Here

   * @throws InitializationException when something goes wrong on initialization
   */
  public SpotClassifier(String modelFile, OccurrenceDataProvider dataProvider, InstanceBuilder instanceBuilder)
      throws InitializationException {
    if (!new File(modelFile).exists()) //TODO Jo, please check during configuration if CoOccurrenceBasedSelector is in the config file, then check it at that point.
            throw new InitializationException("Error initiating SpotClassifier.",new ConfigurationException("Could not find file for org.dbpedia.spotlight.spot.classifier.unigram"));
    this.modelFile = modelFile;
    this.dataProvider = dataProvider;
    this.instanceBuilder = instanceBuilder;
    initialize();
  }
View Full Code Here

    Object o[];
    try {
      o = SerializationHelper.readAll(modelFile);
    } catch (Exception e) {
      throw new InitializationException("Could not deserialize classifier from file " + modelFile);
    }
    classifier = (Classifier) o[0];
    header = (Instances) o[1];
    header.setClassIndex(header.numAttributes() - 1);
    LOG.trace("Successfully deserialized Classifier " + classifier);
View Full Code Here

    private static void setSpotters(Map<SpotterPolicy,Spotter> s) throws InitializationException {
        if (spotters.size() == 0)
            spotters = s;
        else
            throw new InitializationException("Trying to overwrite singleton Server.spotters. Something fishy happened!");
    }
View Full Code Here

    private static void setDisambiguators(Map<SpotlightConfiguration.DisambiguationPolicy,ParagraphDisambiguatorJ> s) throws InitializationException {
        if (disambiguators.size() == 0)
            disambiguators = s;
        else
            throw new InitializationException("Trying to overwrite singleton Server.disambiguators. Something fishy happened!");
    }
View Full Code Here

          spotterConfiguration.getCoOcSelectorDatabaseUser(),
          spotterConfiguration.getCoOcSelectorDatabasePassword()
          );

    } catch(Exception e) {
      throw new InitializationException("Error in database initialization", e);
    }

  }
View Full Code Here

TOP

Related Classes of org.dbpedia.spotlight.exceptions.InitializationException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.