Package org.dbpedia.spotlight.exceptions

Examples of org.dbpedia.spotlight.exceptions.InputException


        LOG.info("disambiguator: " + disambiguatorName);

        /* Validating parameters */

        if (text.trim().equals("")) {
            throw new InputException("No text was specified in the &text parameter.");
        }

        /* Setting defaults */
        if (Server.getTokenizer() == null && disambiguatorName==SpotlightConfiguration.DisambiguationPolicy.Default.name()
                && text.length() > 1200) {
View Full Code Here


        announce(textString,confidence,support,ontologyTypesString,sparqlQuery,policy,coreferenceResolution,clientIp,spotterName,disambiguatorName);

        // Get input text
        if (textString.trim().equals("")) {
            throw new InputException("No text was specified in the &text parameter.");
        }
        Text context = new Text(textString);
        context.setFeature(new Score("confidence", confidence));

        // Find spots to annotate/disambiguate
View Full Code Here

        String clientIp = request.getRemoteAddr();

        try {
            if (docUrlString.equals("") && text.equals(""))
                throw new InputException("Either doc_url or text must be filled!");
            String response = "";
            String[] systems = systemIds.split(" ");
            URL docUrl = null;
            try {
                docUrl = new URL(docUrlString);
View Full Code Here

    public static Spotter getSpotter(String name) throws InputException {
        SpotterPolicy policy = SpotterPolicy.Default;
        try {
            policy = SpotterPolicy.valueOf(name);
        } catch (IllegalArgumentException e) {
            throw new InputException(String.format("Specified parameter spotter=%s is invalid. Use one of %s.",name,SpotterPolicy.values()));
        }

        if (spotters.size() == 0)
            throw new InputException(String.format("No spotters were loaded. Please add one of %s.",spotters.keySet()));

        Spotter spotter = spotters.get(policy);
        if (spotter==null) {
            throw new InputException(String.format("Specified spotter=%s has not been loaded. Use one of %s.",name,spotters.keySet()));
        }
        return spotter;
    }
View Full Code Here

    public static ParagraphDisambiguatorJ getDisambiguator(String name) throws InputException {
        DisambiguationPolicy policy = DisambiguationPolicy.Default;
        try {
            policy = DisambiguationPolicy.valueOf(name);
        } catch (IllegalArgumentException e) {
            throw new InputException(String.format("Specified parameter disambiguator=%s is invalid. Use one of %s.",name,DisambiguationPolicy.values()));
        }

        if (disambiguators.size() == 0)
            throw new InputException(String.format("No disambiguators were loaded. Please add one of %s.",disambiguators.keySet()));

        ParagraphDisambiguatorJ disambiguator = disambiguators.get(policy);
        if (disambiguator == null)
            throw new InputException(String.format("Specified disambiguator=%s has not been loaded. Use one of %s.",name,disambiguators.keySet()));
        return disambiguator;

    }
View Full Code Here

                LOG.error("Boilerpipe Cannot process the web page");
                textToProcess = "";
            }

        }else{
            throw new InputException("No input was specified in the &text nor the &url parameter.");
        }
        return textToProcess;
    }
View Full Code Here

            configFile = args[0]; //
            datasetLocation = args[1]; //"/home/pablo/eval/jo/jo.json"
            datasetType = Format.valueOf(args[2]);
        } catch (IndexOutOfBoundsException e) {
            System.err.println(usage);
            throw new InputException("Missing parameters in command line.",e);
        } catch (Exception e) {
            System.err.println(usage);
            throw new InputException("Error in parameters provided in command line.",e);
        }

        SpotlightConfiguration configuration = new SpotlightConfiguration(configFile);
        LingPipeFactory lingPipeFactory = new LingPipeFactory(new File(configuration.getTaggerFile()), new IndoEuropeanSentenceModel());
        LOG.info("Reading gold standard.");
View Full Code Here

TOP

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

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.