Package org.dbpedia.spotlight.spot

Examples of org.dbpedia.spotlight.spot.Spotter


                && text.length() > 1200) {
            disambiguatorName = SpotlightConfiguration.DisambiguationPolicy.Document.name();
            LOG.info(String.format("Text length: %d. Using %s to disambiguate.",text.length(),disambiguatorName));
        }

        Spotter spotter = Server.getSpotter(spotterName);
        ParagraphDisambiguatorJ disambiguator = Server.getDisambiguator(disambiguatorName);

        /* Running Annotation */

        Annotation annotation = process(text, confidence, support, ontologyTypesString, sparqlQuery, blacklist, coreferenceResolution, spotter, disambiguator);
View Full Code Here


    public static void main(String[] args) throws IOException, JSONException, ConfigurationException, InitializationException, org.json.JSONException, SpottingException {

        File dictionary = new File("/Users/jodaiber/Desktop/lrec_2012_spotting/surface_forms-Wikipedia-TitRedDis.thresh3.spotterDictionary");

        Spotter spotter = null;

        //
        if (args.length==0)
        {
            LOG.error("server.properties is requested to continue...");
           return;
        }

        SpotlightConfiguration configuration = new SpotlightConfiguration(args[0]);


        int spotterNr = 0;

        switch(spotterNr) {
            case 0: {
                String openNLPDir = "/Users/jodaiber/Desktop/DBpedia/";
                SurfaceFormDictionary sfDictProbThresh3 = ExactSurfaceFormDictionary.fromLingPipeDictionary(dictionary, false);
                System.out.println("Dictionary size: " + sfDictProbThresh3.size());
                File stopwordsFile = new File(openNLPDir+"stopwords.txt");
                spotter = OpenNLPChunkerSpotter.fromDir(openNLPDir,configuration.getI18nLanguageCode(),sfDictProbThresh3,stopwordsFile);
                break;
            }
            case 1: {
                spotter = new LingPipeSpotter(dictionary, configuration.getAnalyzer());
                break;
            }
        }


        System.out.println("Using Spotter " + spotter.getName());

        System.out.println("Running GC.");
        System.gc(); System.gc(); System.gc(); System.gc();

        int i = 0;

        LinkedList<Long> consumption = new LinkedList<Long>();

        for (File textFile : new File("/data/spotlight/csaw/original/crawledDocs").listFiles()) {

            if (!textFile.getName().endsWith(".txt"))
                continue;

            i++;
            if (i == 100)
                break;

            spotter.extract(
                    new Text(
                            new Scanner(textFile).useDelimiter("\\A").next()
                    )
            );
View Full Code Here


    ///**
    // * No selection:
    // */
    Spotter spotter = new LingPipeSpotter(new File(configuration.getSpotterConfiguration().getSpotterFile()), configuration.getAnalyzer());
    //
    //extract(jsonObject, spotter);


    /**
     * Advanced Spotter:
     */
    Spotter spotterWithSelector = SpotterWithSelector.getInstance(
        spotter,
        new CoOccurrenceBasedSelector(configuration.getSpotterConfiguration()),
        spotlightFactory.taggedTokenProvider()
    );

View Full Code Here

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

    }

    public List<SurfaceFormOccurrence> spot(String spotterName, Text context) throws InputException, SpottingException {
        Spotter spotter = Server.getSpotter(spotterName);

        if(Server.getTokenizer() != null)
            Server.getTokenizer().tokenizeMaybe(context);

        List<SurfaceFormOccurrence> spots = spotter.extract(context);
        return spots;
    }
View Full Code Here

        }

        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

TOP

Related Classes of org.dbpedia.spotlight.spot.Spotter

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.