Codota Logo
GazetteerNode
Code IndexAdd Codota to your IDE (free)

How to use
GazetteerNode
in
gate.creole.gazetteer

Best Java code snippets using gate.creole.gazetteer.GazetteerNode (Showing top 19 results out of 315)

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
Point p =
  • Codota Iconnew Point(x, y)
  • Codota Iconnew Point()
  • Codota IconMouseEvent e;e.getPoint()
  • Smart code suggestions by Codota
}
origin: uk.ac.gate.plugins/annie

for(int i = 0; i < entries.size(); i++) {
 GazetteerNode node = entries.get(i);
 entry = node.getEntry().trim();
 if(entry.length() > 0) {
  result.append(entry);
  Map<String,Object> featureMap = node.getFeatureMap();
  if(featureMap != null && (featureMap.size() > 0)) {
   result.append(node.featureMapToString(featureMap));
origin: uk.ac.gate.plugins/annie

/**
 * Parses and create a gazetteer node from a string
 *
 * @param node the gazetteer node to be parsed
 * @param separator the separator used in the gazetteer node string to delimit
 * each name-value pair of features. If the separator is null, then the whole
 * node will be used as the gazetteer entry
 * @param isOrdered true if the feature maps used should be ordered
 */
public GazetteerNode(String node, String separator, boolean isOrdered) {
 this.separator = (separator != null && separator.length() == 0)? null : separator;
 int index_sep;
 if(this.separator == null || (index_sep = node.indexOf(this.separator)) == -1 ) {
  entry = node;
  // leave featureMap null
 } else {
  entry = node.substring(0, index_sep);
  String features = node.substring(index_sep + 1);
  featureMap = getFeatures(features, isOrdered);
 }
}
origin: uk.ac.gate.plugins/annie

@Override
public int hashCode() {
 return toString().hashCode();
}
origin: uk.ac.gate.plugins/annie

@Override
public Object getValueAt(int row, int column) {
 GazetteerNode node = gazetteerListFiltered.get(row);
 if (column == 0) {
  return node.getEntry();
 } else {
  Map<String,Object> featureMap = node.getFeatureMap();
  if (featureMap == null
   || featureMap.size()*2 < column) {
   return "";
  }
  List<String> features = new ArrayList<String>(featureMap.keySet());
  int featureCount = (column + (column % 2)) / 2;
  if (column % 2 == 1) {
   return features.get(featureCount-1);
  } else {
   return featureMap.get(features.get(featureCount-1));
  }
 }
}
origin: stackoverflow.com

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();
origin: uk.ac.gate.plugins/annie

try {
 while(null != (line = listReader.readLine())) {
  tempEntries.add(new GazetteerNode(line, separator));
origin: uk.ac.gate.plugins/annie

public void addEmptyFeatureColumns() {
 // find the first row fully filled with value
 if (getColumnCount() == 1) {
  GazetteerNode node = gazetteerListFiltered.get(0);
  Map<String, Object> map = new HashMap<String, Object>();
  // add a couple of rows
  map.put("", "");
  node.setFeatureMap(map);
 } else {
  for (Object object : gazetteerListFiltered) {
   GazetteerNode node = (GazetteerNode) object;
   Map<String,Object> map = node.getFeatureMap();
   if (map != null
   && (2*map.size()+1) == getColumnCount()) {
    map.put("", "");
    break;
   }
  }
 }
 for (Object object : gazetteerList) {
  GazetteerNode node = (GazetteerNode) object;
  node.setSeparator(linearDefinition.getSeparator());
 }
}
origin: uk.ac.gate.plugins/annie

if (column == 0) {
 gazetteerNode.setEntry((String) value);
} else {
  newFeatureMap.put(feature, val);
 gazetteerNode.setFeatureMap(newFeatureMap);
 fireTableRowsUpdated(row, row);
origin: uk.ac.gate.plugins/annie

/**
 * 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);
}
origin: uk.ac.gate.plugins/annie

@Override
public int getColumnCount() {
 if (columnCount > -1) { return columnCount; }
 if (gazetteerListFiltered == null) { return 0; }
 columnCount = 1;
 // read all the features maps to find the biggest one
 for (Object object : gazetteerListFiltered) {
  GazetteerNode node = (GazetteerNode) object;
  Map<String,Object> map = node.getFeatureMap();
  if (map != null && columnCount < 2*map.size()+1) {
   columnCount = 2*map.size() + 1;
  }
 }
 return columnCount;
}
origin: uk.ac.gate.plugins/annie

for (Object object : gazetteerList) {
 GazetteerNode node = (GazetteerNode) object;
 if (node.getEntry().equals(value)) {
  found = true;
  break;
origin: uk.ac.gate.plugins/annie

@Override
public void actionPerformed(ActionEvent e) {
 GazetteerNode newGazetteerNode = new GazetteerNode(listEntryTextField.getText());
 newGazetteerNode.setSeparator(listTableModel.gazetteerList
     .getSeparator());
origin: uk.ac.gate.plugins/annie

 node = new GazetteerNode(line, separator, isOrdered);
} catch(Exception ex) {
 throw new GateRuntimeException("Could not read gazetteer entry "
origin: uk.ac.gate.plugins/annie

GazetteerNode node = (GazetteerNode) object;
boolean match = false;
Map<String,Object> map = node.getFeatureMap();
if (map != null && !onlyValueCheckBox.isSelected()) {
 for (String key : map.keySet()) {
if (match || pattern.matcher(node.getEntry()).find()) {
origin: uk.ac.gate.plugins/tools

    theLanguage));
theList.add(new GazetteerNode(text));
  gazetteer.add(theString, new Lookup(listName, annotType, "inferred",
      theLanguage));
  theList.add(new GazetteerNode(theString));
origin: uk.ac.gate.plugins/annie

entry = gazNode.getEntry();
Map<String,Object> features = gazNode.getFeatureMap();
if (features == null) {
 lookup = defaultLookup;
origin: uk.ac.gate.plugins/annie

/**
 * Checks this node vs another one for equality.
 * 
 * @param o another node
 * @return true if the string representation of the entry and weighting match.
 */
@Override
public boolean equals(Object o) {
 boolean result = false;
 if(o instanceof GazetteerNode) {
  result = this.toString().equals(o.toString());
 }
 return result;
}

origin: uk.ac.gate.plugins/annie

/**
 * Stores the list to the specified url
 * 
 * @throws ResourceInstantiationException
 */
public void store() throws ResourceInstantiationException {
 try {
  if(null == url) {
   throw new ResourceInstantiationException("URL not specified (null)");
  }
  File fileo = Files.fileFromURL(url);
  fileo.delete();
  OutputStreamWriter listWriter =
      new OutputStreamWriter(new FileOutputStream(fileo), encoding);
  // BufferedWriter listWriter = new BufferedWriter(new
  // FileWriter(fileo));
  Iterator<GazetteerNode> iter = entries.iterator();
  while(iter.hasNext()) {
   listWriter.write(iter.next().toString());
   listWriter.write(13);
   listWriter.write(10);
  }
  listWriter.close();
 } catch(Exception x) {
  throw new ResourceInstantiationException(x.getClass() + ":"
      + x.getMessage());
 }
 isModified = false;
} // store()
origin: uk.ac.gate.plugins/annie

String normalisedWord = null;
for(; iterator.hasNext(); add(normalisedWord, lookup1)) {
 String word = iterator.next().toString();
 int wordLength = word.length();
 for(int j = 0; j < wordLength; j++) {
gate.creole.gazetteerGazetteerNode

Javadoc

A node in a gazetteer list allowing an arbitary amount of features to be added as metadata to an entry, e.g.:

With the separator set to '\t', if a gazetteer entry looked like this:

Vodaphone type=mobile phone company

Then the GazetteerNode would consist of an entry "Vodaphone", with a featureMap containing the key "type", mapped to "mobile phone company".

Most used methods

  • <init>
    Constructor. Uses the default separator.
  • setSeparator
  • featureMapToString
    Converts a featureMap to separated name value pairs. Note: the string will begin with the separator
  • getEntry
  • getFeatureMap
  • getFeatures
    Given a string of name-value pairs in the format "name=value", separated by whatever this GazetteerN
  • setEntry
  • setFeatureMap
  • toString
    Gets the string representation of this node

Popular in Java

  • Reading from database using SQL prepared statement
  • scheduleAtFixedRate (Timer)
  • getOriginalFilename (MultipartFile)
    Return the original filename in the client's filesystem.This may contain path information depending
  • putExtra (Intent)
  • HttpServer (com.sun.net.httpserver)
    This class implements a simple HTTP server. A HttpServer is bound to an IP address and port number a
  • ByteBuffer (java.nio)
    A buffer for bytes. A byte buffer can be created in either one of the following ways: * #allocate(i
  • Permission (java.security)
    Abstract class for representing access to a system resource. All permissions have a name (whose inte
  • Dictionary (java.util)
    The Dictionary class is the abstract parent of any class, such as Hashtable, which maps keys to valu
  • ThreadPoolExecutor (java.util.concurrent)
    An ExecutorService that executes each submitted task using one of possibly several pooled threads, n
  • JTable (javax.swing)
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now