MostFrequentSenseBaseline extends AbstractWSDAlgorithm implements WSDAlgorithmIndividualBasic, WSDAlgorithmIndividualPOS { @Override public Map<String, Double> getDisambiguation(String sod, POS pos) throws SenseInventoryException { List<String> senses = inventory.getSenses(sod, pos); if (!senses.isEmpty()) { return getDisambiguationMap( new String[] { inventory.getMostFrequentSense(sod, pos) }, new double[] { 1.0 }); } else { logger.debug("Could not disambiguate " + sod); } return null; } MostFrequentSenseBaseline(SenseInventory inventory); @Override Map<String, Double> getDisambiguation(String sod, POS pos); @Override Map<String, Double> getDisambiguation(String sod);  }
@Test public void mfsBaselineTest() throws SenseInventoryException { SenseInventory inventory = new TestSenseInventory(); WSDAlgorithmIndividualBasic wsdAlgo = new MostFrequentSenseBaseline(inventory); assertEquals(1, wsdAlgo.getDisambiguation("bank").size()); assertEquals(1, wsdAlgo.getDisambiguation("bat").size()); assertEquals(1, wsdAlgo.getDisambiguation("test").size()); assertEquals(null, wsdAlgo.getDisambiguation("humpelgrpf")); assertEquals(1.0, wsdAlgo.getDisambiguation("bank").get("bank1"), 0.000001); assertEquals(1.0, wsdAlgo.getDisambiguation("bat").get("bat1"), 0.000001); assertEquals(1.0, wsdAlgo.getDisambiguation("test").get("test1"), 0.000001); }