DomainResolver { public String getDomain(Synset syn) { String off=Long.toString(syn.getOffset()); while(off.length()<8) { off="0"+off; } if(syn.getPOS().equals(POS.NOUN)) { off="1"+off; } if(syn.getPOS().equals(POS.VERB)) { off="2"+off; } if(syn.getPOS().equals(POS.ADJECTIVE)) { off="3"+off; } if(syn.getPOS().equals(POS.ADVERB)) { off="4"+off; } return map.get(off); } DomainResolver(); String getDomain(Synset syn);  }
@Test public void testGetDomain() throws FileNotFoundException, JWNLException { Dictionary dict = Dictionary.getInstance(new FileInputStream(new File( "src/main/resources/resource/WordNet_3/wordnet_properties.xml") )); assertTrue(2737 >= test(dict,dr,POS.NOUN)); assertTrue(971 >= test(dict,dr,POS.ADJECTIVE)); assertTrue(72 >= test(dict,dr,POS.ADVERB)); assertTrue(361 >= test(dict,dr,POS.VERB)); }