Package org.mediameter.cliff.people

Examples of org.mediameter.cliff.people.ResolvedPerson


    @Override
    public List<ResolvedPerson> select(List<PersonOccurrence> allPossibilities) {
        ArrayList<ResolvedPerson> bestCandidates = new ArrayList<ResolvedPerson>();
        for(PersonOccurrence occurrence: allPossibilities){
          if (bestCandidates.size() == 0){
            bestCandidates.add(new ResolvedPerson(occurrence));
            continue;
          }
          boolean added = false;
         
          for(ResolvedPerson alreadyAdded: bestCandidates){
            String newDude= occurrence.text.toLowerCase(Locale.US);
            String oldDude = alreadyAdded.getName().toLowerCase(Locale.US);
            if (oldDude.indexOf( newDude ) >=0 || newDude.indexOf(oldDude) >= 0){
              logger.debug(alreadyAdded.getName() + " is a version of " + occurrence.text);
              alreadyAdded.addOccurrence(occurrence);
              added = true;
              break;
            }
          }
          if (!added){
            bestCandidates.add(new ResolvedPerson(occurrence));
          }
         
        }
        return bestCandidates;
    }
View Full Code Here


        List<PersonOccurrence> occurrences = new ArrayList<PersonOccurrence>();
        occurrences.add( new PersonOccurrence("Obama", 0));
        occurrences.add( new PersonOccurrence("Barack Obama", 100));
        KindaDumbDisambiguationStrategy strategy = new KindaDumbDisambiguationStrategy();
        List<ResolvedPerson> resolvedPeople = strategy.select(occurrences);
        ResolvedPerson person = resolvedPeople.get(0);
        assertEquals("Resolved person not choosing longest name", "Barack Obama", person.getName());
    }
View Full Code Here

TOP

Related Classes of org.mediameter.cliff.people.ResolvedPerson

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.