Examples of DummyRecommendationResult


Examples of recommender.impl.test.util.DummyRecommendationResult

    @Override
    public void run() {
      final SortedSet<DummyRecommendationResult> result = new TreeSet<DummyRecommendationResult>(new RecommendationResultComparator<DummyRecommendationResult>());
      for( int i = 0; i < this.nrOfTags; i++ ) {
        result.add(new DummyRecommendationResult("Result_" + i, (1.0 * i) / (this.nrOfTags + 1), 0.5));
      }
      try {
        Thread.sleep(this.timeout);
      } catch (final InterruptedException ex) {
        // ingonre
View Full Code Here

Examples of recommender.impl.test.util.DummyRecommendationResult

  @Test
  public void testMapBackedSetWithRecommendedTags() {
    final Set<DummyRecommendationResult> tempSet = new TreeSet<DummyRecommendationResult>(new RecommendationResultComparator<DummyRecommendationResult>()); // all tags
    final Set<DummyRecommendationResult> topSet = new TreeSet<DummyRecommendationResult>(new RecommendationResultComparator<DummyRecommendationResult>())// top tags

    tempSet.add(new DummyRecommendationResult("a", 0.1, 0.5));
    tempSet.add(new DummyRecommendationResult("b", 0.2, 0.5));
    tempSet.add(new DummyRecommendationResult("c", 0.3, 0.5));

    topSet.add(new DummyRecommendationResult("d", 0.4, 0.5));
    topSet.add(new DummyRecommendationResult("e", 0.5, 0.5));
    topSet.add(new DummyRecommendationResult("f", 0.6, 0.5));
    topSet.add(new DummyRecommendationResult("g", 0.7, 0.5));
    topSet.add(new DummyRecommendationResult("h", 0.8, 0.5));


    tempSet.addAll(topSet);

    final TopResultsMapBackedSet<DummyRecommendationResult> set = new TopResultsMapBackedSet<DummyRecommendationResult>(5);
View Full Code Here

Examples of recommender.impl.test.util.DummyRecommendationResult

    /*
     *  check containment and order of top tags
     */
    final Iterator<DummyRecommendationResult> iterator = recommendedTags.iterator();
    final DummyRecommendationResult tag1 = iterator.next();
    final double score = tag1.getScore();
    /*
     * score should be smaller than 1
     */
    assertTrue(score < 1.0);
    assertEquals("eins", tag1.getTitle());
    assertEquals("zwei", iterator.next().getTitle());
    assertEquals("drei", iterator.next().getTitle());
    assertEquals("vier", iterator.next().getTitle());
    assertEquals("fünf", iterator.next().getTitle());
    assertFalse(iterator.hasNext());
View Full Code Here

Examples of recommender.impl.test.util.DummyRecommendationResult

  /**
   * Tests each possible invalid value and it's substitution.
   */
  @Test
  public void testInvalidScoringFilter() {
    final DummyRecommendationResult tag = new DummyRecommendationResult("foo", Double.POSITIVE_INFINITY, Double.POSITIVE_INFINITY);
    final InvalidScoringFilter<DummyRecommendationResult> filter = new InvalidScoringFilter<DummyRecommendationResult>();
   
    final SortedSet<DummyRecommendationResult> tags = new TreeSet<DummyRecommendationResult>(new RecommendationResultComparator<DummyRecommendationResult>());
    tags.add(tag);
   
    filter.alterResult(tags);
   
    assertEquals(Integer.MAX_VALUE, tags.first().getScore(), DELTA);
    assertEquals(Integer.MAX_VALUE, tags.first().getConfidence(), DELTA);
   
    tag.setScore(Double.NEGATIVE_INFINITY);
    tag.setConfidence(Double.NEGATIVE_INFINITY);
   
    filter.alterResult(tags);
   
    assertEquals(Integer.MIN_VALUE, tags.first().getScore(), DELTA);
    assertEquals(Integer.MIN_VALUE, tags.first().getConfidence(), DELTA);
   
    tag.setScore(Double.NaN);
    tag.setConfidence(Double.NaN);
   
    filter.alterResult(tags);
   
    assertEquals(Integer.MIN_VALUE, tags.first().getScore(), DELTA);
    assertEquals(Integer.MIN_VALUE, tags.first().getConfidence(), DELTA);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.