OrganizationSectionHasher implements Serializable { public String hash(OrganizationSection section) { if (section.getTypeSignificantWordPos() == -1) { return hashUsingFirstWords(section); } return hashUsingAdjacentWords(section); }  String hash(OrganizationSection section); void setNumberOfLettersPerWord(int numberOfLettersPerWord);  }
@Test public void hash_university_section() { OrganizationSection section = new OrganizationSection(OrgSectionType.UNIVERSITY, new String[] {"medical", "university", "toronto"}, 1); assertEquals("UNImedtor", orgSectionHasher.hash(section)); }
@Test public void hash_university_short_section() { OrganizationSection section = new OrganizationSection(OrgSectionType.UNIVERSITY, new String[] {"md", "university", "in"}, 1); assertEquals("UNIin_md_", orgSectionHasher.hash(section)); }
@Test public void hash_university_section_univ_on_first_position() { OrganizationSection section = new OrganizationSection(OrgSectionType.UNIVERSITY, new String[] {"university", "barcelona"}, 0); assertEquals("UNI___bar", orgSectionHasher.hash(section)); }
@Test public void hash_university_section_univ_on_last_position() { OrganizationSection section = new OrganizationSection(OrgSectionType.UNIVERSITY, new String[] {"washington", "university"}, 1); assertEquals("UNI___was", orgSectionHasher.hash(section)); }
@Test public void hash_unknown_section() { OrganizationSection section = new OrganizationSection(OrgSectionType.UNKNOWN, new String[] {"medical", "college", "school"}, -1); assertEquals("UNKcolmed", orgSectionHasher.hash(section)); }
@Test public void hash_unknown_section_short_words() { OrganizationSection section = new OrganizationSection(OrgSectionType.UNKNOWN, new String[] {"a", "bb"}, -1); assertEquals("UNKa__bb_", orgSectionHasher.hash(section)); }
@Test public void hash_unknown_section_one_word() { OrganizationSection section = new OrganizationSection(OrgSectionType.UNKNOWN, new String[] {"institution"}, -1); assertEquals("UNK___ins", orgSectionHasher.hash(section)); }