TextAnnotation annotate(String corpusId, String sentId, String[] tokens) throws AnnotatorException { // Ignore the root token List<String[]> words = Collections.singletonList(Arrays.copyOfRange(tokens, 1, tokens.length)); TextAnnotation ta = BasicTextAnnotationBuilder.createTextAnnotationFromTokens(corpusId, sentId, words); ta.addView(pos); ta.addView(lemma); ta.addView(chunk); return ta; }
@Override protected void addView(TextAnnotation textAnnotation) throws AnnotatorException { try { textAnnotation.addView(viewName, labeler.getPrediction(textAnnotation)); } catch (Exception e) { e.printStackTrace(); } } }
private void annotateTas(){ for (TextAnnotation ta : taList){ POSAnnotator posAnnotator = new POSAnnotator(); try { ta.addView(posAnnotator); } catch (Exception e){ e.printStackTrace(); } } }
@Override protected void addView(TextAnnotation textAnnotation) throws AnnotatorException { try { textAnnotation.addView(viewName, labeler.getPrediction(textAnnotation)); } catch (Exception e) { e.printStackTrace(); } } }
private void annotateTas(){ for (TextAnnotation ta : taList){ POSAnnotator posAnnotator = new POSAnnotator(); try { ta.addView(posAnnotator); } catch (Exception e){ e.printStackTrace(); } } }
private void addPOSView(List<String> pos, TextAnnotation ta) { // POS View TokenLabelView posView = new TokenLabelView(ViewNames.POS, "GoldStandard", ta, 1.0); for (int j = 0; j < pos.size(); j++) posView.addTokenLabel(j, pos.get(j), 1.0); ta.addView(ViewNames.POS, posView); }
private void populateTokenLabelView(TextAnnotation ta, List<String> tags, String viewName) { TokenLabelView v = new TokenLabelView(viewName, ta); for (int tkid = 0; tkid < tags.size(); tkid++) v.addTokenLabel(tkid, tags.get(tkid), 1.0D); ta.addView(viewName, v); }
private void addPOSView(List<String> pos, TextAnnotation ta) { // POS View TokenLabelView posView = new TokenLabelView(ViewNames.POS, "GoldStandard", ta, 1.0); for (int j = 0; j < pos.size(); j++) posView.addTokenLabel(j, pos.get(j), 1.0); ta.addView(ViewNames.POS, posView); }
@Override public void addView(TextAnnotation ta) throws AnnotatorException { try { ta.addView(viewName, curatorClient.getTextAnnotationView(ta, viewName)); } catch (TException | AnnotationFailedException | SocketException | ServiceUnavailableException e) { throw new AnnotatorException(e.getMessage()); } }
@Override public void addView(TextAnnotation ta) throws AnnotatorException { try { ta.addView(viewName, curatorClient.getTextAnnotationView(ta, viewName)); } catch (TException | AnnotationFailedException | SocketException | ServiceUnavailableException e) { throw new AnnotatorException(e.getMessage()); } }
@Override public void addView(TextAnnotation ta) throws AnnotatorException { // Check if all required views are present try { View srlView = getSRL(ta); ta.addView(getViewName(), srlView); } catch (Exception e) { e.printStackTrace(); throw new AnnotatorException(e.getMessage()); } } }
private void addView(TextAnnotation ta, List<String> labels) { TokenLabelView labelView = new TokenLabelView(viewName, ta); List constituents = ta.getView(ViewNames.TOKENS).getConstituents(); assert constituents.size() == labels.size(); for (int i = 0; i < constituents.size(); ++i) { Constituent constituent = (Constituent) constituents.get(i); labelView.addTokenLabel(constituent.getStartSpan(), labels.get(i), 1.0D); } ta.addView(viewName, labelView); }
protected void addGoldPOSView(TextAnnotation ta, List<String> sentencePOS) { TokenLabelView posView = new TokenLabelView(ViewNames.POS, ta); List constituents = ta.getView(ViewNames.TOKENS).getConstituents(); assert constituents.size() == sentencePOS.size(); for (int i = 0; i < constituents.size(); ++i) { Constituent constituent = (Constituent) constituents.get(i); posView.addTokenLabel(constituent.getStartSpan(), sentencePOS.get(i), 1.0D); } ta.addView(ViewNames.POS, posView); }
protected void addGoldPOSView(TextAnnotation ta, List<String> sentencePOS) { TokenLabelView posView = new TokenLabelView(ViewNames.POS, ta); List<Constituent> constituents = ta.getView(ViewNames.TOKENS).getConstituents(); assert constituents.size() == sentencePOS.size(); for (int i = 0; i < constituents.size(); ++i) { Constituent constituent = (Constituent) constituents.get(i); posView.addTokenLabel(constituent.getStartSpan(), sentencePOS.get(i), 1.0D); } ta.addView(ViewNames.POS, posView); }
public void addView(TextAnnotation ta, boolean overwrite) { TextAnnotation newTA = null; try { newTA = annotate(ta.getText(), overwrite); } catch (Exception e) { e.printStackTrace(); } for (String vu : viewsToAdd) { ta.addView(vu, newTA.getView(vu)); } }
public void addView(TextAnnotation ta, boolean overwrite) { TextAnnotation newTA = null; try { newTA = annotate(ta.getText(), overwrite); } catch (Exception e) { e.printStackTrace(); } for (String vu : viewsToAdd) { ta.addView(vu, newTA.getView(vu)); } }
private void addParseView(List<String> parses, TextAnnotation ta) { // PARSE View TreeView parseView = new TreeView(ViewNames.PARSE_CHARNIAK, "GoldStandard", ta, 1.0); for (int j = 0; j < parses.size(); j++) { Tree<String> parseTree = TreeParserFactory.getStringTreeParser().parse(parses.get(j)); parseView.setParseTree(j, parseTree); } ta.addView(ViewNames.PARSE_CHARNIAK, parseView); }
protected void addGoldView(TextAnnotation ta, List<String> labels) { TokenLabelView posView = new TokenLabelView(viewName, ta); List<Constituent> constituents = ta.getView(ViewNames.TOKENS).getConstituents(); for (int i = 0; i < constituents.size(); ++i) { Constituent constituent = (Constituent) constituents.get(i); posView.addTokenLabel(constituent.getStartSpan(), labels.get(i), 1.0D); } ta.addView(viewName, posView); } }
protected void addGoldView(TextAnnotation ta, List<String> labels) { TokenLabelView posView = new TokenLabelView(viewName, ta); List<Constituent> constituents = ta.getView(ViewNames.TOKENS).getConstituents(); for (int i = 0; i < constituents.size(); ++i) { Constituent constituent = (Constituent) constituents.get(i); posView.addTokenLabel(constituent.getStartSpan(), labels.get(i), 1.0D); } ta.addView(viewName, posView); } }
@Override public void addView(TextAnnotation input) { TokenLabelView view = new TokenLabelView(getViewName(), "PorterStemmer", input, 1.0); synchronized (instance) { for (int i = 0; i < input.size(); i++) { stemmer.setCurrent(input.getToken(i)); stemmer.stem(); view.addTokenLabel(i, stemmer.getCurrent(), 1.0); } } input.addView(getViewName(), view); }