/** * Sets the feature null. * * @param feature the new feature null */ public void setFeatureNull(Feature feature) { mFeatureStructre.setFeatureValue(feature, null); }
/** * Set the first link of a chain in the chain head feature structure. */ private void setFirstLink(FeatureStructure aChain, AnnotationFS aLink) { aChain.setFeatureValue(aChain.getType().getFeatureByBaseName(chainFirstFeatureName), aLink); }
private void assignAnnotationByTypeInWindow(FeatureStructure annotation, Feature feature, MatchContext context, Type type) { List<AnnotationFS> inWindow = this.getAnnotationsInWindow(context.getAnnotation(), type); if (feature.getRange().isArray()) { annotation.setFeatureValue(feature, UIMAUtils.toFSArray(this.getJCas(), inWindow)); } else { if (inWindow != null && !inWindow.isEmpty()) { AnnotationFS a = inWindow.get(0); annotation.setFeatureValue(feature, a); } else { annotation.setFeatureValue(feature, null); } } }
public static void setLinkFeatureValue(FeatureStructure aFS, Feature aFeature, List<FeatureStructure> linkFSes) { // Create a new array if size differs otherwise re-use existing one ArrayFS array = (ArrayFS) WebAnnoCasUtil.getFeatureFS(aFS, aFeature.getShortName()); if (array == null || (array.size() != linkFSes.size())) { array = aFS.getCAS().createArrayFS(linkFSes.size()); } // Fill in links array.copyFromArray(linkFSes.toArray(new FeatureStructure[linkFSes.size()]), 0, 0, linkFSes.size()); aFS.setFeatureValue(aFeature, array); }
public static void setLinkFeatureValue(FeatureStructure aFS, Feature aFeature, List<FeatureStructure> linkFSes) { // Create a new array if size differs otherwise re-use existing one ArrayFS array = (ArrayFS) WebAnnoCasUtil.getFeatureFS(aFS, aFeature.getShortName()); if (array == null || (array.size() != linkFSes.size())) { array = aFS.getCAS().createArrayFS(linkFSes.size()); } // Fill in links array.copyFromArray(linkFSes.toArray(new FeatureStructure[linkFSes.size()]), 0, 0, linkFSes.size()); aFS.setFeatureValue(aFeature, array); }
/** * Set the first link of a chain in the chain head feature structure. */ private void setFirstLink(FeatureStructure aChain, AnnotationFS aLink) { aChain.setFeatureValue(aChain.getType().getFeatureByBaseName(getChainFirstFeatureName()), aLink); }
/** * Set the first link of a chain in the chain head feature structure. */ private void setFirstLink(FeatureStructure aChain, AnnotationFS aLink) { aChain.setFeatureValue(aChain.getType().getFeatureByBaseName(getChainFirstFeatureName()), aLink); }
public static void setFeature(FeatureStructure aFS, String aFeature, byte... aValue) { Feature feat = getMandatoryFeature(aFS, aFeature); if (feat.getRange().isPrimitive()) { requireSingleValue(feat, aValue); aFS.setByteValue(feat, aValue[0]); } else if (aValue == null) { aFS.setFeatureValue(feat, null); } else { aFS.setFeatureValue(feat, createByteArray(aFS.getCAS(), aValue)); } }
public static void setFeature(FeatureStructure aFS, String aFeature, boolean... aValue) { Feature feat = getMandatoryFeature(aFS, aFeature); if (feat.getRange().isPrimitive()) { requireSingleValue(feat, aValue); aFS.setBooleanValue(feat, aValue[0]); } else if (aValue == null) { aFS.setFeatureValue(feat, null); } else { aFS.setFeatureValue(feat, createBooleanArray(aFS.getCAS(), aValue)); } }
public static void setFeature(FeatureStructure aFS, String aFeature, long... aValue) { Feature feat = getMandatoryFeature(aFS, aFeature); if (feat.getRange().isPrimitive()) { requireSingleValue(feat, aValue); aFS.setLongValue(feat, aValue[0]); } else if (aValue == null) { aFS.setFeatureValue(feat, null); } else { aFS.setFeatureValue(feat, createLongArray(aFS.getCAS(), aValue)); } }
public static void setFeature(FeatureStructure aFS, String aFeature, short... aValue) { Feature feat = getMandatoryFeature(aFS, aFeature); if (feat.getRange().isPrimitive()) { requireSingleValue(feat, aValue); aFS.setShortValue(feat, aValue[0]); } else if (aValue == null) { aFS.setFeatureValue(feat, null); } else { aFS.setFeatureValue(feat, createShortArray(aFS.getCAS(), aValue)); } }
public static void setFeature(FeatureStructure aFS, String aFeature, double... aValue) { Feature feat = getMandatoryFeature(aFS, aFeature); if (feat.getRange().isPrimitive()) { requireSingleValue(feat, aValue); aFS.setDoubleValue(feat, aValue[0]); } else if (aValue == null) { aFS.setFeatureValue(feat, null); } else { aFS.setFeatureValue(feat, createDoubleArray(aFS.getCAS(), aValue)); } }
public static void setFeature(FeatureStructure aFS, String aFeature, float... aValue) { Feature feat = getMandatoryFeature(aFS, aFeature); if (feat.getRange().isPrimitive()) { requireSingleValue(feat, aValue); aFS.setFloatValue(feat, aValue[0]); } else if (aValue == null) { aFS.setFeatureValue(feat, null); } else if (feat.getRange().isArray()) { aFS.setFeatureValue(feat, createFloatArray(aFS.getCAS(), aValue)); } else { aFS.setFeatureValue(feat, createFloatList(aFS.getCAS(), aValue)); } }
public static void setFeature(FeatureStructure aFS, String aFeature, int... aValue) { Feature feat = getMandatoryFeature(aFS, aFeature); if (feat.getRange().isPrimitive()) { requireSingleValue(feat, aValue); aFS.setIntValue(feat, aValue[0]); } else if (aValue == null) { aFS.setFeatureValue(feat, null); } else if (feat.getRange().isArray()) { aFS.setFeatureValue(feat, createIntArray(aFS.getCAS(), aValue)); } else { aFS.setFeatureValue(feat, createIntegerList(aFS.getCAS(), aValue)); } }
/** * Create a new chain head feature structure. Already adds the chain to the CAS. */ private FeatureStructure newChain(JCas aJCas, AnnotationFS aFirstLink) { Type chainType = getAnnotationType(aJCas.getCas()); FeatureStructure newChain = aJCas.getCas().createFS(chainType); newChain.setFeatureValue(chainType.getFeatureByBaseName(chainFirstFeatureName), aFirstLink); aJCas.addFsToIndexes(newChain); return newChain; }
/** * Create a new chain head feature structure. Already adds the chain to the CAS. */ private FeatureStructure newChain(JCas aJCas, AnnotationFS aFirstLink) { Type chainType = CasUtil.getType(aJCas.getCas(), getChainTypeName()); FeatureStructure newChain = aJCas.getCas().createFS(chainType); newChain.setFeatureValue(chainType.getFeatureByBaseName(getChainFirstFeatureName()), aFirstLink); aJCas.addFsToIndexes(newChain); return newChain; }
/** * Create a new chain head feature structure. Already adds the chain to the CAS. */ private FeatureStructure newChain(JCas aJCas, AnnotationFS aFirstLink) { Type chainType = CasUtil.getType(aJCas.getCas(), getChainTypeName()); FeatureStructure newChain = aJCas.getCas().createFS(chainType); newChain.setFeatureValue(chainType.getFeatureByBaseName(getChainFirstFeatureName()), aFirstLink); aJCas.addFsToIndexes(newChain); return newChain; }
private static FeatureStructure makeLinkFS(JCas aJCas, String aType, String aSlotLabel, AnnotationFS aTarget) { Type linkType = aJCas.getTypeSystem().getType(aType); FeatureStructure linkA1 = aJCas.getCas().createFS(linkType); linkA1.setStringValue(linkType.getFeatureByBaseName("role"), aSlotLabel); linkA1.setFeatureValue(linkType.getFeatureByBaseName("target"), aTarget); aJCas.getCas().addFsToIndexes(linkA1); return linkA1; }
public static FeatureStructure makeLinkFS(JCas aJCas, String aSlotLabel, int aTargetBegin, int aTargetEnd) { Token token1 = new Token(aJCas, aTargetBegin, aTargetEnd); token1.addToIndexes(); Type linkType = aJCas.getTypeSystem().getType(LINK_TYPE); FeatureStructure linkA1 = aJCas.getCas().createFS(linkType); linkA1.setStringValue(linkType.getFeatureByBaseName("role"), aSlotLabel); linkA1.setFeatureValue(linkType.getFeatureByBaseName("target"), token1); aJCas.getCas().addFsToIndexes(linkA1); return linkA1; } }
public static FeatureStructure makeLinkFS(JCas aJCas, String aSlotLabel, int aTargetBegin, int aTargetEnd) { Token token1 = new Token(aJCas, aTargetBegin, aTargetEnd); token1.addToIndexes(); Type linkType = aJCas.getTypeSystem().getType(LINK_TYPE); FeatureStructure linkA1 = aJCas.getCas().createFS(linkType); linkA1.setStringValue(linkType.getFeatureByBaseName("role"), aSlotLabel); linkA1.setFeatureValue(linkType.getFeatureByBaseName("target"), token1); aJCas.getCas().addFsToIndexes(linkA1); return linkA1; } }