Package org.apache.stanbol.entityhub.indexing.core.normaliser

Examples of org.apache.stanbol.entityhub.indexing.core.normaliser.ScoreNormaliser


        assertTrue(config.getDistributionFolder().isDirectory());
        //test the name
        assertEquals(config.getName(),"simple");
        assertEquals(config.getDescription(), "Simple Configuration");
        //test if the normaliser configuration was parsed correctly!
        final ScoreNormaliser normaliser = config.getNormaliser();
        //test if the config files where copied form the classpath to the
        //config directory.
        assertTrue("Config File for the RangeNormaliser not copied",
            new File(config.getConfigFolder(),"range.properties").isFile());
        assertTrue("Config File for the MinScoreNormalizer not copied",
            new File(config.getConfigFolder(),"minscore.properties").isFile());
        //now test if the configuration was parsed correctly
        ScoreNormaliser testNormaliser = normaliser;
        assertNotNull(testNormaliser);
        assertEquals(testNormaliser.getClass(), RangeNormaliser.class);
        testNormaliser = testNormaliser.getChained();
        assertNotNull(testNormaliser);
        assertEquals(testNormaliser.getClass(), NaturalLogNormaliser.class);
        testNormaliser = testNormaliser.getChained();
        assertNotNull(testNormaliser);
        assertEquals(testNormaliser.getClass(), MinScoreNormalizer.class);
        EntityIterator entityIterator = config.getEntityIdIterator();
        assertNotNull(entityIterator);
        assertEquals(entityIterator.getClass(), LineBasedEntityIterator.class);
        if(entityIterator.needsInitialisation()){
            entityIterator.initialise();
View Full Code Here


    private void initNormaliser() {
        Object value = configuration.get(IndexingConstants.KEY_SCORE_NORMALIZER);
        if(value == null){
            this.scoreNormaliser = new  DefaultNormaliser();
        } else {
            ScoreNormaliser normaliser = null;
            ScoreNormaliser last = null;
            List<ConfigEntry> configs = parseConfigEntries(value.toString());
            for(int i=configs.size()-1;i>=0;i--){
                last = normaliser;
                normaliser = null;
                ConfigEntry config = configs.get(i);
View Full Code Here

    private void initNormaliser() {
        Object value = configuration.get(IndexingConstants.KEY_SCORE_NORMALIZER);
        if(value == null){
            this.scoreNormaliser = new  DefaultNormaliser();
        } else {
            ScoreNormaliser normaliser = null;
            ScoreNormaliser last = null;
            List<ConfigEntry> configs = parseConfigEntries(value.toString());
            for(int i=configs.size()-1;i>=0;i--){
                last = normaliser;
                normaliser = null;
                ConfigEntry config = configs.get(i);
View Full Code Here

    private void initNormaliser() {
        Object value = configuration.get(IndexingConstants.KEY_SCORE_NORMALIZER);
        if(value == null){
            this.scoreNormaliser = new  DefaultNormaliser();
        } else {
            ScoreNormaliser normaliser = null;
            ScoreNormaliser last = null;
            List<ConfigEntry> configs = parseConfigEntries(value.toString());
            for(int i=configs.size()-1;i>=0;i--){
                last = normaliser;
                normaliser = null;
                ConfigEntry config = configs.get(i);
View Full Code Here

    }
    @Test
    public void testEntityIdIteratorConfig(){
        IndexingConfig config = new IndexingConfig();
        EntityIterator iterator = config.getEntityIdIterator();
        ScoreNormaliser normaliser = config.getNormaliser();
        if(iterator.needsInitialisation()){
            iterator.initialise();
        }
        float lastScore = Float.MAX_VALUE;
        float lastNormalisedScore = 1f;
        while(iterator.hasNext()){
            EntityScore entity = iterator.next();
            assertNotNull(entity);
            assertNotNull(entity.id);
            assertNotNull(entity.score);
            //log.info("Entity: {}",entity);
            assertTrue(entity.id.startsWith("http://dbpedia.org/resource/"));
            float score = entity.score.floatValue();
            assertTrue(score > 0);
            assertTrue(score <=lastScore);
            lastScore = score;
            Float normalisedScore = normaliser.normalise(entity.score);
            assertNotNull(normalisedScore);
            float nScore = normalisedScore.floatValue();
            assertTrue(nScore <= lastNormalisedScore);
            if(score < 2){ //the value of "min-score" in minincoming
                log.info("score="+score+" nScore="+nScore);
View Full Code Here

        assertTrue(config.getDistributionFolder().isDirectory());
        //test the name
        assertEquals(config.getName(),"simple");
        assertEquals(config.getDescription(), "Simple Configuration");
        //test if the normaliser configuration was parsed correctly!
        final ScoreNormaliser normaliser = config.getNormaliser();
        //test if the config files where copied form the classpath to the
        //config directory.
        assertTrue("Config File for the RangeNormaliser not copied",
            new File(config.getConfigFolder(),"range.properties").isFile());
        assertTrue("Config File for the MinScoreNormalizer not copied",
            new File(config.getConfigFolder(),"minscore.properties").isFile());
        //now test if the configuration was parsed correctly
        ScoreNormaliser testNormaliser = normaliser;
        assertNotNull(testNormaliser);
        assertEquals(testNormaliser.getClass(), RangeNormaliser.class);
        testNormaliser = testNormaliser.getChained();
        assertNotNull(testNormaliser);
        assertEquals(testNormaliser.getClass(), NaturalLogNormaliser.class);
        testNormaliser = testNormaliser.getChained();
        assertNotNull(testNormaliser);
        assertEquals(testNormaliser.getClass(), MinScoreNormalizer.class);
        EntityIterator entityIterator = config.getEntityIdIterator();
        assertNotNull(entityIterator);
        assertEquals(entityIterator.getClass(), LineBasedEntityIterator.class);
        if(entityIterator.needsInitialisation()){
            entityIterator.initialise();
View Full Code Here

        assertTrue(config.getDistributionFolder().isDirectory());
        //test the name
        assertEquals(config.getName(),"simple");
        assertEquals(config.getDescription(), "Simple Configuration");
        //test if the normaliser configuration was parsed correctly!
        final ScoreNormaliser normaliser = config.getNormaliser();
        //test if the config files where copied form the classpath to the
        //config directory.
        assertTrue("Config File for the RangeNormaliser not copied",
            new File(config.getConfigFolder(),"range.properties").isFile());
        assertTrue("Config File for the MinScoreNormalizer not copied",
            new File(config.getConfigFolder(),"minscore.properties").isFile());
        //now test if the configuration was parsed correctly
        ScoreNormaliser testNormaliser = normaliser;
        assertNotNull(testNormaliser);
        assertEquals(testNormaliser.getClass(), RangeNormaliser.class);
        testNormaliser = testNormaliser.getChained();
        assertNotNull(testNormaliser);
        assertEquals(testNormaliser.getClass(), NaturalLogNormaliser.class);
        testNormaliser = testNormaliser.getChained();
        assertNotNull(testNormaliser);
        assertEquals(testNormaliser.getClass(), MinScoreNormalizer.class);
        EntityIterator entityIterator = config.getEntityIdIterator();
        assertNotNull(entityIterator);
        assertEquals(entityIterator.getClass(), LineBasedEntityIterator.class);
        if(entityIterator.needsInitialisation()){
            entityIterator.initialise();
View Full Code Here

    private void initNormaliser() {
        Object value = configuration.get(IndexingConstants.KEY_SCORE_NORMALIZER);
        if(value == null){
            this.scoreNormaliser = new  DefaultNormaliser();
        } else {
            ScoreNormaliser normaliser = null;
            ScoreNormaliser last = null;
            List<ConfigEntry> configs = parseConfigEntries(value.toString());
            for(int i=configs.size()-1;i>=0;i--){
                last = normaliser;
                normaliser = null;
                ConfigEntry config = configs.get(i);
View Full Code Here

TOP

Related Classes of org.apache.stanbol.entityhub.indexing.core.normaliser.ScoreNormaliser

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.