instance.setOutcomes(getOutcomes(aJCas, aTarget)); instance.setJcasId(jcasId); instance.setSequenceId(aSequenceId);
instance.setOutcomes(getOutcomes(jcas, aTarget)); instance.setJcasId(jcasId); instance.setSequenceId(sequenceId);
instance.setOutcomes(getOutcomes(aJCas, aTarget)); instance.setWeight(getWeight(aJCas, aTarget)); instance.setJcasId(jcasId);
instance.setOutcomes(getOutcomes(aJCas, aTarget)); instance.setWeight(getWeight(aJCas, aTarget)); instance.setJcasId(jcasId);
instance.setOutcomes(getOutcomes(aJCas, aTarget)); instance.setWeight(getWeight(aJCas, aTarget)); instance.setJcasId(jcasId);
instance.setOutcomes(getOutcomes(aJCas, aTarget)); instance.setWeight(getWeight(aJCas, aTarget)); instance.setJcasId(jcasId);
private Instance getSingleInstanceUnit(Instance anInstance, JCas aJCas, boolean supportsSparseFeature) throws Exception { int jcasId = JCasUtil.selectSingle(aJCas, JCasId.class).getId(); TextClassificationTarget unit = JCasUtil.selectSingle(aJCas, TextClassificationTarget.class); if (addInstanceId) { anInstance.addFeature(InstanceIdFeature.retrieve(aJCas, unit)); } for (FeatureExtractorResource_ImplBase featExt : featureExtractors) { if (supportsSparseFeature) { anInstance.addFeatures(getSparse(aJCas, unit, featExt)); } else { anInstance.addFeatures(getDense(aJCas, unit, featExt)); } anInstance.setOutcomes(getOutcomes(aJCas, unit)); anInstance.setWeight(getWeight(aJCas, unit)); anInstance.setJcasId(jcasId); } return anInstance; }
private Instance getSingleInstanceUnit(Instance anInstance, JCas aJCas, boolean supportsSparseFeature) throws Exception { int jcasId = JCasUtil.selectSingle(aJCas, JCasId.class).getId(); TextClassificationTarget unit = JCasUtil.selectSingle(aJCas, TextClassificationTarget.class); if (addInstanceId) { anInstance.addFeature(InstanceIdFeature.retrieve(aJCas, unit)); } for (FeatureExtractorResource_ImplBase featExt : featureExtractors) { if (supportsSparseFeature) { anInstance.addFeatures(getSparse(aJCas, unit, featExt)); } else { anInstance.addFeatures(getDense(aJCas, unit, featExt)); } anInstance.setOutcomes(getOutcomes(aJCas, unit)); anInstance.setWeight(getWeight(aJCas, unit)); anInstance.setJcasId(jcasId); } return anInstance; }
private Instance getSingleInstancePair(Instance anInstance, JCas aJCas) throws TextClassificationException { try { int jcasId = JCasUtil.selectSingle(aJCas, JCasId.class).getId(); if (addInstanceId) { anInstance.addFeature(InstanceIdFeature.retrieve(aJCas)); } for (FeatureExtractorResource_ImplBase featExt : featureExtractors) { if (!(featExt instanceof PairFeatureExtractor)) { throw new TextClassificationException( "Using non-pair FE in pair mode: " + featExt.getResourceName()); } JCas view1 = aJCas.getView(Constants.PART_ONE); JCas view2 = aJCas.getView(Constants.PART_TWO); anInstance.setOutcomes(getOutcomes(aJCas, null)); anInstance.setWeight(getWeight(aJCas, null)); anInstance.setJcasId(jcasId); anInstance.addFeatures(((PairFeatureExtractor) featExt).extract(view1, view2)); } } catch (CASException e) { throw new TextClassificationException(e); } return anInstance; }
private Instance getSingleInstancePair(Instance anInstance, JCas aJCas) throws TextClassificationException { try { int jcasId = JCasUtil.selectSingle(aJCas, JCasId.class).getId(); if (addInstanceId) { anInstance.addFeature(InstanceIdFeature.retrieve(aJCas)); } for (FeatureExtractorResource_ImplBase featExt : featureExtractors) { if (!(featExt instanceof PairFeatureExtractor)) { throw new TextClassificationException( "Using non-pair FE in pair mode: " + featExt.getResourceName()); } JCas view1 = aJCas.getView(Constants.PART_ONE); JCas view2 = aJCas.getView(Constants.PART_TWO); anInstance.setOutcomes(getOutcomes(aJCas, null)); anInstance.setWeight(getWeight(aJCas, null)); anInstance.setJcasId(jcasId); anInstance.addFeatures(((PairFeatureExtractor) featExt).extract(view1, view2)); } } catch (CASException e) { throw new TextClassificationException(e); } return anInstance; }
private Instance getSingleInstanceDocument(Instance anInstance, JCas aJCas, boolean supportSparseFeatures) throws TextClassificationException { int jcasId = JCasUtil.selectSingle(aJCas, JCasId.class).getId(); TextClassificationTarget documentTcu = JCasUtil.selectSingle(aJCas, TextClassificationTarget.class); if (addInstanceId) { anInstance.addFeature(InstanceIdFeature.retrieve(aJCas)); } for (FeatureExtractorResource_ImplBase featExt : featureExtractors) { if (!(featExt instanceof FeatureExtractor)) { throw new TextClassificationException( "Using incompatible feature in document mode: " + featExt.getResourceName()); } if (supportSparseFeatures) { anInstance.addFeatures(getSparse(aJCas, documentTcu, featExt)); } else { anInstance.addFeatures(getDense(aJCas, documentTcu, featExt)); } anInstance.setOutcomes(getOutcomes(aJCas, null)); anInstance.setWeight(getWeight(aJCas, null)); anInstance.setJcasId(jcasId); } return anInstance; }
private Instance getSingleInstanceDocument(Instance anInstance, JCas aJCas, boolean supportSparseFeatures) throws TextClassificationException { int jcasId = JCasUtil.selectSingle(aJCas, JCasId.class).getId(); TextClassificationTarget documentTcu = JCasUtil.selectSingle(aJCas, TextClassificationTarget.class); if (addInstanceId) { anInstance.addFeature(InstanceIdFeature.retrieve(aJCas)); } for (FeatureExtractorResource_ImplBase featExt : featureExtractors) { if (!(featExt instanceof FeatureExtractor)) { throw new TextClassificationException( "Using incompatible feature in document mode: " + featExt.getResourceName()); } if (supportSparseFeatures) { anInstance.addFeatures(getSparse(aJCas, documentTcu, featExt)); } else { anInstance.addFeatures(getDense(aJCas, documentTcu, featExt)); } anInstance.setOutcomes(getOutcomes(aJCas, null)); anInstance.setWeight(getWeight(aJCas, null)); anInstance.setJcasId(jcasId); } return anInstance; }