/** * This method enriches the CompositionalStructureElement{s} with the pointwise product of the * vectors of head and modifiers. * * @param repr the representation to be enriched */ private void enrichTreeWithCompositionalProduct(TreeRepresentation repr) { for (TreeNode node : repr.getAllNodes()) { if (node.getContent() instanceof CompositionalStructureElement) { CompositionalStructureElement el = (CompositionalStructureElement) node.getContent(); Vector compositionalInfo = getCompositionalInformationFor(el.getHead(), el.getModifier()); el.addAdditionalInformation(enrichmentName, compositionalInfo); } } }
protected float getScore(CompositionalStructureElement csx, CompositionalStructureElement csz) { Vector storedSx = (Vector) csx.getAdditionalInformation(enrichmentName); if (storedSx == null && csx.containsAdditionalInfo(enrichmentName)) return 0.0f; Vector storedSz = (Vector) csz.getAdditionalInformation(enrichmentName); if (storedSz == null && csz.containsAdditionalInfo(enrichmentName)) return 0.0f; if (storedSx == null) { storedSx = getCompositionalInformationFor(csx.getHead(), csx.getModifier()); if (storedSx == null) { return 0.0f; } } if (storedSz == null) { storedSz = getCompositionalInformationFor(csz.getHead(), csz.getModifier()); if (storedSz == null) { return 0.0f; } } return getSimilarity(storedSx, storedSz); }