private void makeTagMaps() { Set<String> tags = classifier.labels(); String backgroundSymbol = classifier.backgroundSymbol(); tagToColorMap = makeTagToColorMap(tags, backgroundSymbol); }
private void makeTagMaps() { Set<String> tags = classifier.labels(); String backgroundSymbol = classifier.backgroundSymbol(); tagToColorMap = makeTagToColorMap(tags, backgroundSymbol); }
private void buildTagPanel() { if (tagPanel == null) { tagPanel = new JToolBar(SwingConstants.VERTICAL); tagPanel.setFloatable(false); frame.getContentPane().add(tagPanel, BorderLayout.EAST); } else { tagPanel.removeAll(); } if (classifier != null) { makeTagMaps(); Set<String> tags = classifier.labels(); String backgroundSymbol = classifier.backgroundSymbol(); for (String tag : tags) { if (backgroundSymbol.equals(tag)) { continue; } Color color = tagToColorMap.get(tag); JButton b = new JButton(tag, new ColorIcon(color)); tagPanel.add(b); } } tagPanel.revalidate(); tagPanel.repaint(); }
private void buildTagPanel() { if (tagPanel == null) { tagPanel = new JToolBar(SwingConstants.VERTICAL); tagPanel.setFloatable(false); frame.getContentPane().add(tagPanel, BorderLayout.EAST); } else { tagPanel.removeAll(); } if (classifier != null) { makeTagMaps(); Set<String> tags = classifier.labels(); String backgroundSymbol = classifier.backgroundSymbol(); for (String tag : tags) { if (backgroundSymbol.equals(tag)) { continue; } Color color = tagToColorMap.get(tag); JButton b = new JButton(tag, new ColorIcon(color)); tagPanel.add(b); } } tagPanel.revalidate(); tagPanel.repaint(); }
String background = classifier.backgroundSymbol(); String tagPattern = ""; for (String tag : tags) { String background = classifier.backgroundSymbol(); String tagPattern = ""; for (String tag : tags) {
String background = classifier.backgroundSymbol(); StringBuilder tagPattern = new StringBuilder(); for (String tag : tags) { String background = classifier.backgroundSymbol(); StringBuilder tagPattern = new StringBuilder(); for (String tag : tags) {
private List<IN> preprocessTokens(List<? extends HasWord> tokenSequence) { // log.info("knownLCWords.size is " + knownLCWords.size() + "; knownLCWords.maxSize is " + knownLCWords.getMaxSize() + // ", prior to NER for " + getClass().toString()); List<IN> document = new ArrayList<>(); int i = 0; for (HasWord word : tokenSequence) { IN wi; // initialized below if (word instanceof CoreMap) { // copy all annotations! some are required later in // AbstractSequenceClassifier.classifyWithInlineXML // wi = (IN) new ArrayCoreMap((ArrayCoreMap) word); wi = tokenFactory.makeToken((IN) word); } else { wi = tokenFactory.makeToken(); wi.set(CoreAnnotations.TextAnnotation.class, word.word()); // wi.setWord(word.word()); } wi.set(CoreAnnotations.PositionAnnotation.class, Integer.toString(i)); wi.set(CoreAnnotations.AnswerAnnotation.class, backgroundSymbol()); document.add(wi); i++; } // TODO get rid of ObjectBankWrapper ObjectBankWrapper<IN> wrapper = new ObjectBankWrapper<>(flags, null, knownLCWords); wrapper.processDocument(document); // log.info("Size of knownLCWords is " + knownLCWords.size() + ", after NER for " + getClass().toString()); return document; }
private List<IN> preprocessTokens(List<? extends HasWord> tokenSequence) { // log.info("knownLCWords.size is " + knownLCWords.size() + "; knownLCWords.maxSize is " + knownLCWords.getMaxSize() + // ", prior to NER for " + getClass().toString()); List<IN> document = new ArrayList<>(); int i = 0; for (HasWord word : tokenSequence) { IN wi; // initialized below if (word instanceof CoreMap) { // copy all annotations! some are required later in // AbstractSequenceClassifier.classifyWithInlineXML // wi = (IN) new ArrayCoreMap((ArrayCoreMap) word); wi = tokenFactory.makeToken((IN) word); } else { wi = tokenFactory.makeToken(); wi.set(CoreAnnotations.TextAnnotation.class, word.word()); // wi.setWord(word.word()); } wi.set(CoreAnnotations.PositionAnnotation.class, Integer.toString(i)); wi.set(CoreAnnotations.AnswerAnnotation.class, backgroundSymbol()); document.add(wi); i++; } // TODO get rid of ObjectBankWrapper ObjectBankWrapper<IN> wrapper = new ObjectBankWrapper<>(flags, null, knownLCWords); wrapper.processDocument(document); // log.info("Size of knownLCWords is " + knownLCWords.size() + ", after NER for " + getClass().toString()); return document; }
wi.set(AnswerAnnotation.class, backgroundSymbol()); document.add(wi); i++;
wi.set(AnswerAnnotation.class, backgroundSymbol()); document.add(wi); i++;
wi.set(CoreAnnotations.AnswerAnnotation.class, backgroundSymbol()); document.add(wi); i++;
wi.set(CoreAnnotations.AnswerAnnotation.class, backgroundSymbol()); document.add(wi); i++;