@Test public void convertToCitation() { MatchableEntity citationEntity = MatchableEntity.fromParameters("cit_someId1_4", "John Doe", null, "Some Title", null, null, null); IdWithSimilarity docIdWithSimilarity = new IdWithSimilarity("doc_someId2", 0.786); Citation actualCitation = converter.convertToCitation(citationEntity, docIdWithSimilarity); Citation expectedCitation = Citation.newBuilder() .setSourceDocumentId("someId1") .setDestinationDocumentId("someId2") .setPosition(4) .setConfidenceLevel(0.786F) .build(); assertEquals(expectedCitation, actualCitation); }
public Citation convertToCitation(MatchableEntity citationEntity, IdWithSimilarity docIdWithSimilarity) { CitEntityId citEntityId = CitEntityId.parseFrom(citationEntity.id()); DocEntityId docEntityId = DocEntityId.parseFrom(docIdWithSimilarity.getId()); Citation cit = new Citation(); cit.setSourceDocumentId(citEntityId.getSourceDocumentId()); cit.setPosition(citEntityId.getPosition()); cit.setDestinationDocumentId(docEntityId.getDocumentId()); cit.setConfidenceLevel((float)docIdWithSimilarity.getSimilarity()); return cit; }
MatchedCitationToCitationConverter implements Serializable { public Citation convertToCitation(MatchableEntity citationEntity, IdWithSimilarity docIdWithSimilarity) { CitEntityId citEntityId = CitEntityId.parseFrom(citationEntity.id()); DocEntityId docEntityId = DocEntityId.parseFrom(docIdWithSimilarity.getId()); Citation cit = new Citation(); cit.setSourceDocumentId(citEntityId.getSourceDocumentId()); cit.setPosition(citEntityId.getPosition()); cit.setDestinationDocumentId(docEntityId.getDocumentId()); cit.setConfidenceLevel((float)docIdWithSimilarity.getSimilarity()); return cit; } }
MatchedCitationToCitationConverter implements Serializable { public Citation convertToCitation(MatchableEntity citationEntity, IdWithSimilarity docIdWithSimilarity) { CitEntityId citEntityId = CitEntityId.parseFrom(citationEntity.id()); DocEntityId docEntityId = DocEntityId.parseFrom(docIdWithSimilarity.getId()); Citation cit = new Citation(); cit.setSourceDocumentId(citEntityId.getSourceDocumentId()); cit.setPosition(citEntityId.getPosition()); cit.setDestinationDocumentId(docEntityId.getDocumentId()); cit.setConfidenceLevel((float)docIdWithSimilarity.getSimilarity()); return cit; }  }
MatchedCitationToCitationConverter implements Serializable { public Citation convertToCitation(MatchableEntity citationEntity, IdWithSimilarity docIdWithSimilarity) { CitEntityId citEntityId = CitEntityId.parseFrom(citationEntity.id()); DocEntityId docEntityId = DocEntityId.parseFrom(docIdWithSimilarity.getId()); Citation cit = new Citation(); cit.setSourceDocumentId(citEntityId.getSourceDocumentId()); cit.setPosition(citEntityId.getPosition()); cit.setDestinationDocumentId(docEntityId.getDocumentId()); cit.setConfidenceLevel((float)docIdWithSimilarity.getSimilarity()); return cit; }  Citation convertToCitation(MatchableEntity citationEntity, IdWithSimilarity docIdWithSimilarity); }
MatchedCitationToCitationConverter implements Serializable { public Citation convertToCitation(MatchableEntity citationEntity, IdWithSimilarity docIdWithSimilarity) { CitEntityId citEntityId = CitEntityId.parseFrom(citationEntity.id()); DocEntityId docEntityId = DocEntityId.parseFrom(docIdWithSimilarity.getId()); Citation cit = new Citation(); cit.setSourceDocumentId(citEntityId.getSourceDocumentId()); cit.setPosition(citEntityId.getPosition()); cit.setDestinationDocumentId(docEntityId.getDocumentId()); cit.setConfidenceLevel((float)docIdWithSimilarity.getSimilarity()); return cit; }  Citation convertToCitation(MatchableEntity citationEntity, IdWithSimilarity docIdWithSimilarity);  }