InterlingualIndexConverter { public void convert(){ createSynsetMappings(wordNetLexicon); SynsetGenerator synsetGenerator = gnConverter.getSynsetGenerator(); synsetGenerator.initialize(); List<IliRecord> iliRecords = gnet.getIliRecords(); int synsetAlignmentCounter = 0; int senseAlignmentCounter = 0; for(IliRecord iliRecord : iliRecords){ EwnRel relation = iliRecord.getEwnRelation(); if(relation.toString().equals("synonym")){ String pwn30Id = iliRecord.getPwn30Id(); String offsetString = pwn30Id.replaceAll("ENG30-", ""); String[] temp = offsetString.split("-"); offsetString = temp[0]; EPartOfSpeech pos = getUbyPosFromKey(temp[1]); if(offsetString.contains("null")) { logger.warn("offsetString contains null-string for " + iliRecord); continue; } long offset = Long.parseLong(offsetString); LexUnit lexUnit = gnet.getLexUnitByID(iliRecord.getLexUnitId()); Synset gnUBYSynset = synsetGenerator.getLMFSynset(lexUnit); Synset wnUBYSynset = synsetMappings.get(pos).get(offset); if(wnUBYSynset == null){ logger.warn("Synset for the given WordNet word could not be found. SenseAxis will not be generated." + iliRecord); continue; } else{ SenseAxis senseAxisSynset = new SenseAxis(); senseAxisSynset.setSynsetOne(gnUBYSynset); senseAxisSynset.setSynsetTwo(wnUBYSynset); senseAxisSynset.setSenseAxisType(ESenseAxisType.crosslingualSenseAlignment); senseAxisSynset.setId("GN_WN_Synset_Alignment_Interlingual_Index_"+synsetAlignmentCounter++); senseAxisSynset.setLexiconOne(gnConverter.getLexicalResource().getLexicons().get(0)); senseAxisSynset.setLexiconTwo(wordNetLexicon); senseAxisSynset.setMetaData(metaData); senseAxes.add(senseAxisSynset); } String pwnWord = iliRecord.getPwnWord(); Sense gnUBYSense = gnConverter.getSynsetGenerator().getSense(lexUnit); Sense wnUBYSense = getSense(wnUBYSynset, pwnWord); if(wnUBYSense == null){ logger.warn("Sense for the given WordNet word ##" +pwnWord +"## could not be found. SenseAxis will not be generated." + iliRecord); continue; } else{ SenseAxis senseAxisSense = new SenseAxis(); senseAxisSense.setSenseOne(gnUBYSense); senseAxisSense.setSenseTwo(wnUBYSense); senseAxisSense.setSenseAxisType(ESenseAxisType.crosslingualSenseAlignment); senseAxisSense.setId("GN_WN_Sense_Alignment_Interlingual_Index_"+senseAlignmentCounter++); senseAxisSense.setLexiconOne(gnConverter.getLexicalResource().getLexicons().get(0)); senseAxisSense.setLexiconTwo(wordNetLexicon); senseAxisSense.setMetaData(metaData); senseAxes.add(senseAxisSense); } } } } InterlingualIndexConverter(GNConverter gnConverter, GermaNet gnet, Lexicon wordNetLexicon, MetaData alignmentMetaData); void convert(); List<SenseAxis> getSenseAxes(); static MetaData getDefaultMetaData();  }
@Test public final void testConvert() throws IllegalArgumentException, IllegalAccessException { iliConverter.convert(); @SuppressWarnings("unchecked") Map<EPartOfSpeech, Map<Long, Synset>> synsetMappings = (Map<EPartOfSpeech, Map<Long, Synset>>) fieldSynsetMappings.get(iliConverter); assertFalse(synsetMappings.isEmpty()); List<EPartOfSpeech> poses = Arrays.asList(EPartOfSpeech.noun, EPartOfSpeech.verb, EPartOfSpeech.adjective, EPartOfSpeech.adverb); assertTrue(synsetMappings.keySet().containsAll(poses)); List<Synset> synsets = wordNetLexicon.getSynsets(); int numSynsets = 0; for(EPartOfSpeech pos : poses){ Collection<Synset> temp = synsetMappings.get(pos).values(); assertTrue(synsets.containsAll(temp)); numSynsets += temp.size(); } assertEquals(synsets.size(), numSynsets); List<SenseAxis> senseAxes = iliConverter.getSenseAxes(); for(SenseAxis senseAxis : senseAxes){ testNodesPresent(senseAxis); } }