private boolean isInsideTag (Label lbl) { String name = (String) lbl.getEntry (); return name.startsWith ("I-"); }
private boolean isBeginTag (Label lbl) { String name = (String) lbl.getEntry (); return name.startsWith ("B-"); }
private boolean isInsideTag (Label lbl) { String name = (String) lbl.getEntry (); return name.startsWith ("I-"); }
private boolean isInsideTag (Label lbl) { String name = (String) lbl.getEntry (); return name.startsWith ("I-"); }
private boolean isBeginTag (Label lbl) { String name = (String) lbl.getEntry (); return name.startsWith ("B-"); }
private boolean isBeginTag (Label lbl) { String name = (String) lbl.getEntry (); return name.startsWith ("B-"); }
public void addTargetLabel(Label label) { String labelEntry = (String) label.getEntry(); if(! this.labels.containsKey(labelEntry) ) { this.sortedLabelMap.put(labelEntry, new Integer(1)); this.labels.put(labelEntry, label); } else { Integer oldCount = this.sortedLabelMap.get(labelEntry); Integer newCount = oldCount + 1; this.sortedLabelMap.put(labelEntry, newCount); this.labels.put(labelEntry, label); } } }
public void addTargetLabel(Label label) { String labelEntry = (String) label.getEntry(); if(! this.labels.containsKey(labelEntry) ) { this.sortedLabelMap.put(labelEntry, new Integer(1)); this.labels.put(labelEntry, label); } else { Integer oldCount = this.sortedLabelMap.get(labelEntry); Integer newCount = oldCount + 1; this.sortedLabelMap.put(labelEntry, newCount); this.labels.put(labelEntry, label); } } }
public void addTargetLabel(Label label) { String labelEntry = (String) label.getEntry(); if(! this.labels.containsKey(labelEntry) ) { this.sortedLabelMap.put(labelEntry, new Integer(1)); this.labels.put(labelEntry, label); } else { Integer oldCount = this.sortedLabelMap.get(labelEntry); Integer newCount = oldCount + 1; this.sortedLabelMap.put(labelEntry, newCount); this.labels.put(labelEntry, label); } } }
private Label trimTag (LabelAlphabet dict, Label tag) { String name = (String) tag.getEntry (); return dict.lookupLabel (name.substring (2)); }
private Label trimTag (LabelAlphabet dict, Label tag) { String name = (String) tag.getEntry (); return dict.lookupLabel (name.substring (2)); }
private Label trimTag (LabelAlphabet dict, Label tag) { String name = (String) tag.getEntry (); return dict.lookupLabel (name.substring (2)); }
private boolean tagsMatch (Label tag1, Label tag2) { String name1 = (String) tag1.getEntry (); String name2 = (String) tag2.getEntry (); if (isBeginTag (tag1) || isInsideTag (tag1)) { name1 = name1.substring (2); } if (isInsideTag (tag2)) { name2 = name2.substring (2); } return name1.equals (name2); }
private boolean tagsMatch (Label tag1, Label tag2) { String name1 = (String) tag1.getEntry (); String name2 = (String) tag2.getEntry (); if (isBeginTag (tag1) || isInsideTag (tag1)) { name1 = name1.substring (2); } if (isInsideTag (tag2)) { name2 = name2.substring (2); } return name1.equals (name2); }
private boolean tagsMatch (Label tag1, Label tag2) { String name1 = (String) tag1.getEntry (); String name2 = (String) tag2.getEntry (); if (isBeginTag (tag1) || isInsideTag (tag1)) { name1 = name1.substring (2); } if (isInsideTag (tag2)) { name2 = name2.substring (2); } return name1.equals (name2); }
/** * * @param neighbors * @return An array containing a score for each of the elements of <code>neighbors</code>. */ public double[] evaluate (Neighbor[] neighbors) { double[] scores = new double[neighbors.length]; LabelVector ranks = classifier.classify(neighbors).getLabelVector(); for (int i = 0; i < ranks.numLocations(); i++) { int idx = ((Integer)ranks.getLabelAtRank(i).getEntry()).intValue(); scores[idx] = ranks.getValueAtRank(i); } return scores; }
/** * * @param neighbors * @return An array containing a score for each of the elements of <code>neighbors</code>. */ public double[] evaluate (Neighbor[] neighbors) { double[] scores = new double[neighbors.length]; LabelVector ranks = classifier.classify(neighbors).getLabelVector(); for (int i = 0; i < ranks.numLocations(); i++) { int idx = ((Integer)ranks.getLabelAtRank(i).getEntry()).intValue(); scores[idx] = ranks.getValueAtRank(i); } return scores; }
public static LabelSequence sliceLabelsSequence (LabelsSequence lbls, LabelAlphabet dict, int slice) { Label[] labels = new Label [lbls.size()]; for (int t = 0; t < lbls.size(); t++) { Label l = lbls.getLabels (t).get (slice); labels [t] = dict.lookupLabel (l.getEntry ()); } LabelSequence ls = new LabelSequence (labels); return ls; } } // SliceLabelsSequence
public static LabelSequence sliceLabelsSequence (LabelsSequence lbls, LabelAlphabet dict, int slice) { Label[] labels = new Label [lbls.size()]; for (int t = 0; t < lbls.size(); t++) { Label l = lbls.getLabels (t).get (slice); labels [t] = dict.lookupLabel (l.getEntry ()); } LabelSequence ls = new LabelSequence (labels); return ls; } } // SliceLabelsSequence
public static LabelSequence sliceLabelsSequence (LabelsSequence lbls, LabelAlphabet dict, int slice) { Label[] labels = new Label [lbls.size()]; for (int t = 0; t < lbls.size(); t++) { Label l = lbls.getLabels (t).get (slice); labels [t] = dict.lookupLabel (l.getEntry ()); } LabelSequence ls = new LabelSequence (labels); return ls; } } // SliceLabelsSequence