public static CleartkExtractorException invalidTypePath(String path, Type type) { String key = KEY_PREFIX + "invalidTypePath"; return new CleartkExtractorException(DEFAULT_RESOURCE_BUNDLE, key, path, type); }
public static CleartkExtractorException moreThanOneName(String name1, String name2) { String key = KEY_PREFIX + "moreThanOneName"; return new CleartkExtractorException(DEFAULT_RESOURCE_BUNDLE, key, name1, name2); }
public static CleartkExtractorException wrongAnnotationType( Class<? extends Annotation> expectedType, Annotation actualAnnotation) { String key = KEY_PREFIX + "wrongAnnotationType"; return new CleartkExtractorException( DEFAULT_RESOURCE_BUNDLE, key, expectedType.getName(), actualAnnotation); }
public static CleartkExtractorException noAnnotationMatchingWindow( Class<? extends Annotation> expectedType, Annotation window) { String key = KEY_PREFIX + "noAnnotationMatchingWindow"; return new CleartkExtractorException( DEFAULT_RESOURCE_BUNDLE, key, expectedType.getName(), window); }
public static CleartkExtractorException noAnnotationInWindow( Class<? extends Annotation> expectedType, Annotation window) { String key = KEY_PREFIX + "noAnnotationInWindow"; return new CleartkExtractorException( DEFAULT_RESOURCE_BUNDLE, key, expectedType.getName(), window); }
public static CleartkExtractorException wrongNumberOfAnnotations( Class<? extends Annotation> expectedType, int expectedNumber, int actualNumber) { String key = KEY_PREFIX + "wrongNumberOfAnnotations"; return new CleartkExtractorException( DEFAULT_RESOURCE_BUNDLE, key, expectedType.getName(), expectedNumber, actualNumber); }
public ContinuousTextExtractor(String vecFile) throws CleartkExtractorException { super(); try { words = WordVectorReader.getEmbeddings(FileLocator.getAsStream(vecFile)); } catch (IOException e) { e.printStackTrace(); throw new CleartkExtractorException(e); } }
public ContinuousTextExtractor(String vecFile) throws CleartkExtractorException { super(); try { words = WordVectorReader.getEmbeddings(FileLocator.getAsStream(vecFile)); } catch (IOException e) { e.printStackTrace(); throw new CleartkExtractorException(e); } }
public ContinuousTextExtractor(String vecFile, OovStrategy oovStrategy) throws CleartkExtractorException { super(); try { words = WordVectorReader.getEmbeddings(FileLocator.getAsStream(vecFile)); } catch (IOException e) { e.printStackTrace(); throw new CleartkExtractorException(e); } this.oovStrategy = oovStrategy; } @Override
public ContinuousTextExtractor(String vecFile, OovStrategy oovStrategy) throws CleartkExtractorException { super(); try { words = WordVectorReader.getEmbeddings(FileLocator.getAsStream(vecFile)); } catch (IOException e) { e.printStackTrace(); throw new CleartkExtractorException(e); } this.oovStrategy = oovStrategy; } @Override
public static CleartkExtractorException notPrimitive(Feature feature) { String key = KEY_PREFIX + "notPrimitive"; return new CleartkExtractorException( DEFAULT_RESOURCE_BUNDLE, key, feature.getDomain(), feature.getRange()); }
public static CleartkExtractorException notPrimitiveArray(Feature feature) { String key = KEY_PREFIX + "notPrimitiveArray"; return new CleartkExtractorException( DEFAULT_RESOURCE_BUNDLE, key, feature.getDomain(), feature.getRange()); }
@Override public List<Feature> extract( JCas jcas, IdentifiedAnnotation focusAnnotation) throws CleartkExtractorException { List<Feature> feats = new ArrayList<>(); Sentence sent = _sentence; List<ConllDependencyNode> nodes = DependencyUtility.getDependencyNodes(jcas, sent); ConllDependencyNode headNode = DependencyUtility.getNominalHeadNode(jcas, focusAnnotation); try { boolean[] regexFeats = conAnal.findNegationContext(nodes, headNode); for(int j = 0; j < regexFeats.length; j++){ if(regexFeats[j]){ feats.add(new Feature("DepPath_" + conAnal.getRegexName(j))); //"NEG_DEP_REGEX_"+j)); } } } catch (Exception e) { e.printStackTrace(); throw new CleartkExtractorException(e); } return feats; }
@Override public List<Feature> extract(JCas jcas, IdentifiedAnnotation focusAnnotation) throws CleartkExtractorException { List<Feature> feats = new ArrayList<>(); Sentence sent = null; List<Sentence> sents = JCasUtil.selectCovering(jcas, Sentence.class, focusAnnotation.getBegin(), focusAnnotation.getEnd()); if(sents != null && sents.size() > 0){ sent = sents.get(0); }else{ return feats; } List<ConllDependencyNode> nodes = DependencyUtility.getDependencyNodes(jcas, sent); ConllDependencyNode headNode = DependencyUtility.getNominalHeadNode(jcas, focusAnnotation); try { boolean[] regexFeats = conAnal.findNegationContext(nodes, headNode); for(int j = 0; j < regexFeats.length; j++){ if(regexFeats[j]){ feats.add(new Feature("DepPath_" + conAnal.getRegexName(j))); //"NEG_DEP_REGEX_"+j)); } } } catch (Exception e) { e.printStackTrace(); throw new CleartkExtractorException(e); } return feats; }
@Override public List<Feature> extract(JCas jcas, IdentifiedAnnotation focusAnnotation) throws CleartkExtractorException { List<Feature> feats = new ArrayList<>(); Sentence sent = null; List<Sentence> sents = JCasUtil.selectCovering(jcas, Sentence.class, focusAnnotation.getBegin(), focusAnnotation.getEnd()); if(sents != null && sents.size() > 0){ sent = sents.get(0); }else{ return feats; } List<ConllDependencyNode> nodes = DependencyUtility.getDependencyNodes(jcas, sent); ConllDependencyNode headNode = DependencyUtility.getNominalHeadNode(jcas, focusAnnotation); try { boolean[] regexFeats = conAnal.findNegationContext(nodes, headNode); for(int j = 0; j < regexFeats.length; j++){ if(regexFeats[j]){ feats.add(new Feature("DepPath_" + conAnal.getRegexName(j))); //"NEG_DEP_REGEX_"+j)); } } } catch (Exception e) { e.printStackTrace(); throw new CleartkExtractorException(e); } return feats; }