public void add(long originalStart, long originalEnd, long tempStart, long tempEnd) { NodePosition mapping = new NodePosition(originalStart, originalEnd, tempStart, tempEnd); add(mapping); }
/** * Adds a string item to the model and associates it with a Lookup * @param singleItem the string item to be added * @param lookup the lookup to be associated with the string item * @return true if the item has been added, otherwise - false. */ @Override public boolean add(String singleItem, Lookup lookup) { return gaz.add(singleItem,lookup); }
/** * Loads a gazetteer list * * @throws ResourceInstantiationException when the resource cannot be * created */ public void load() throws ResourceInstantiationException { load(false); }
LinearDefinition ld = gazetter.getLinearDefinition(); //add .lst record LinearNode ln = new LinearNode("glossary.lst", "minor", "major", "en", "AnnotType"); ld.add(ln); //add Lookup record Map<String, Object> features = new HashMap<>(); features.put("someFeatureName", "some value"); GazetteerNode gn = new GazetteerNode("string to be found", features); gn.setSeparator("@"); GazetteerList theList = ld.getListsByNode().get(ln); theList.add(gn); //save updated files theList.store(); ld.store(); //optionally re-init the gazetteer to make changes to work gazetter.reInit();
public void dump() { update(); for (int i = 0 ; i < size ; i++) { long start = tempStartOffsets[i]; long end = tempEndOffsets[i]; NodePosition m = startMap.get(start); System.out.format("FGMT: %d, %d : o(%d, %d) t(%d, %d)%n", start, end, m.getOriginalStartOffset(), m.getOriginalEndOffset(), m.getTempStartOffset(), m.getTempEndOffset() ); } }
@Override public Set<Lookup> lookup(String singleItem) { return gaz.lookup(singleItem); }
@Override public void reInit() throws ResourceInstantiationException { super.reInit(); fireGazetteerEvent(new GazetteerEvent(this,GazetteerEvent.REINIT)); }//reInit()
/** * Loads the gazetteer lists and maps them to the nodes * * @return a map of nodes vs GazetteerLists * @throws ResourceInstantiationException when the resource cannot be * created */ public Map<LinearNode, GazetteerList> loadLists() throws ResourceInstantiationException { return loadLists(false); }
/** * Removes a single string item from the gazetteer model * @param singleItem removes a string item from the gazetteer model * @return true if the string is removed from the model, otherwise - false */ @Override public boolean remove(String singleItem) { return gaz.remove(singleItem); }
/** Adds a new value to the transition function */ // >>> DAM: was - to use CharMap /* void put(Character chr, FSMState state) { transitionFunction.put(chr,state); } */ // >>> DAM: TransArray optimization public void put(char chr, FSMState state) { transitionFunction.put(chr,state); } // >>> DAM: end
@Override public boolean add(String singleItem, Lookup lookup) { addLookup(singleItem,lookup); return true; }
/** * Loads a single gazetteer list given a name * * @param listName the name of the list to be loaded * @return the loaded gazetteer list * @throws ResourceInstantiationException */ public GazetteerList loadSingleList(String listName) throws ResourceInstantiationException { return loadSingleList(listName, false); }
@Override public void remove() { if(!removeCalled && null != last) { LinearDefinition.this.remove(last); }// if possible remove removeCalled = true; } // remove
/** * Gets the string representation of this node * * @return the string representation of this node */ @Override public String toString() { if(featureMap == null || separator == null) return entry; else return entry + featureMapToString(featureMap); }
/** This method is used to access the transition function of this state. */ // >>> DAM: was /* FSMState next(Character chr) {//UnicodeType type){ return (FSMState)transitionFunction.get(chr); } */ // >>> DAM: TransArray optimization public FSMState next(char chr) {//UnicodeType type){ return (FSMState)transitionFunction.get(chr); } // >>> DAM: end
@Override public int getRowCount() { return gazetteerListFiltered.size(); }
@Override public Iterator<MappingNode> iterator() { return new SafeIterator(); }
@Override public Iterator<LinearNode> iterator() { return new SafeIterator(); }
public ListTableModel() { gazetteerListFiltered = new GazetteerList(); }