Package gate

Examples of gate.FeatureMap


      return;
    }
   
    while(lookupIter.hasNext()) {
      Lookup currentLookup = lookupIter.next();
      FeatureMap fm = Factory.newFeatureMap();
      gazStore.addLookupListFeatures(fm, currentLookup);
      fm.put("_listnr",gazStore.getListInfoIndex(currentLookup));
      gazStore.addLookupEntryFeatures(fm, currentLookup);
      // added features for ExtendedGazetteer
      fm.put("_firstcharCategory", Character.getType(chunk.getCharAt(matchedRegionStart)));
      if (Character.isUpperCase(chunk.getCharAt(matchedRegionStart))) {
        fm.put("_firstcharUpper", true);
      } else {
        fm.put("_firstcharUpper", false);
      }
      fm.put("_string", chunk.getTextString(matchedRegionStart, matchedRegionEnd));

      // addEntryFeatures(fm,currentLookup.entryFeatures);
      Integer lookupid =       
        addAnAnnotation(
            chunk.getStartOffset(matchedRegionStart),
View Full Code Here


    //System.out.println("Trying to add annotation from "+from+" to "+to+" lookups="+lookups+"Annotation is "+ann);
    while(lookups.hasNext()) {
      Lookup lookup = lookups.next();
      String type = gazStore.getLookupType(lookup);
      type = getAnnotationTypeName(type);
      FeatureMap fm = Factory.newFeatureMap();
      gazStore.addLookupListFeatures(fm, lookup);
      gazStore.addLookupEntryFeatures(fm, lookup);
      try {
        outputAS.add(new Long(from), new Long(to), type, fm);
      } catch (InvalidOffsetException ex) {
View Full Code Here

      return value.toString();
    }
  }

  protected void addLookupsToAnn(Annotation ann, Iterator<Lookup> lookups, boolean overwrite) {
    FeatureMap fm = ann.getFeatures();
    while(lookups.hasNext()) {
      Lookup lookup = lookups.next();
      FeatureMap newFm = Factory.newFeatureMap();
      gazStore.addLookupListFeatures(newFm, lookup);
      gazStore.addLookupEntryFeatures(newFm, lookup);
      if(getOutputFeaturePrefix() != null && !getOutputFeaturePrefix().isEmpty()) {
        FeatureMap newFm2 = Factory.newFeatureMap();
        for(Object key : newFm.keySet()) {
          newFm2.put(getOutputFeaturePrefix()+key.toString(), newFm.get(key));
        }
        newFm = newFm2;
      }
      if(overwrite) {       
        fm.putAll(newFm);
View Full Code Here

 
  @Test
  public void testPersistenceBig1()
      throws ResourceInstantiationException, ExecutionException, IOException {
    System.out.println("Running gazetteer persistence test");
    FeatureMap parms = Factory.newFeatureMap();
    File defFile = new File(testingDir,"pref_en_500K.def");
    URL gazURL = defFile.toURI().toURL();
    parms.put("configFileURL", gazURL);
    parms.put("backendNr",3);
    System.gc();
    long before = ManagementFactory.getMemoryMXBean().getHeapMemoryUsage().getUsed();
    System.out.println("Memory used before loading gazetteer: "+before);
    long startTime = System.currentTimeMillis();
    ExtendedGazetteer2 eg = (ExtendedGazetteer2)Factory.createResource(
View Full Code Here

 
  @Test
  public void testGazetteerApplicationBig_BE1()
      throws MalformedURLException, ResourceInstantiationException, ExecutionException {
    System.out.println("Running big gazetteer application test, backend 1");
    FeatureMap parms = Factory.newFeatureMap();
    File defFile = new File(testingDir,"pref_en_500K.def");   
    URL gazURL = defFile.toURI().toURL();
    parms.put("configFileURL", gazURL);
    parms.put("backendNr",1);
    System.gc();
    long before = ManagementFactory.getMemoryMXBean().getHeapMemoryUsage().getUsed();
    System.out.println("Memory used before loading gazetteer: "+before);
    long startTime = System.currentTimeMillis();
    ExtendedGazetteer2 eg = (ExtendedGazetteer2)Factory.createResource(
View Full Code Here

  @Test
  public void testGazetteerApplicationBig_BE2()
      throws MalformedURLException, ResourceInstantiationException, ExecutionException {
    System.out.println("Running big gazetteer application test, backend 2");
    FeatureMap parms = Factory.newFeatureMap();
    File defFile = new File(testingDir,"pref_en_500K.def");
    URL gazURL = defFile.toURI().toURL();
    parms.put("configFileURL", gazURL);
    parms.put("backendNr",2);
    System.gc();
    long before = ManagementFactory.getMemoryMXBean().getHeapMemoryUsage().getUsed();
    System.out.println("Memory used before loading gazetteer: "+before);
    long startTime = System.currentTimeMillis();
    ExtendedGazetteer2 eg = (ExtendedGazetteer2)Factory.createResource(
View Full Code Here

  }
  @Test
  public void testGazetteerApplicationBig_BE3()
      throws ResourceInstantiationException, ExecutionException, IOException {
    System.out.println("Running big gazetteer application test, backend 3");
    FeatureMap parms = Factory.newFeatureMap();
    File defFile = new File(testingDir,"pref_en_500K.def");
    URL gazURL = defFile.toURI().toURL();
    parms.put("configFileURL", gazURL);
    parms.put("backendNr",3);
    System.gc();
    long before = ManagementFactory.getMemoryMXBean().getHeapMemoryUsage().getUsed();
    System.out.println("Memory used before loading gazetteer: "+before);
    long startTime = System.currentTimeMillis();
    ExtendedGazetteer2 eg = (ExtendedGazetteer2)Factory.createResource(
View Full Code Here

      unescapedSeparator = Strings.unescape(gazetteerFeatureSeparator);
    }
   
    //logger.info("Loading list file "+listFileName);
    URL lurl = new URL(configFileURL,listFileName);
    FeatureMap listFeatures = Factory.newFeatureMap();
    listFeatures.put(LOOKUP_MAJOR_TYPE_FEATURE_NAME, majorType);
    listFeatures.put(LOOKUP_MINOR_TYPE_FEATURE_NAME, minorType);
    if(languages != null) {
      listFeatures.put(LOOKUP_LANGUAGE_FEATURE_NAME, languages);
    }
    gazStore.addListInfo(annotationType,lurl.toString(),listFeatures);
    int infoIndex = gazStore.getListInfos().size() - 1;
    //Lookup defaultLookup = new Lookup(listFileName, majorType, minorType,
    //        languages, annotationType);
View Full Code Here

  }
 
  @Test
  public void testTrie2() {
    GazStore gs = new GazStoreTrie2();
    FeatureMap fm = Factory.newFeatureMap();
    fm.put("listFeature1","value1");
    fm.put("listFeature2","value2");
    int info1 = gs.addListInfo("Type1", "URL1", fm);
    String[] keyvals1 = new String[]{"key1","val1","key2","","k3","valuenumberthree"};
    /*
    State st1 = gs.addLookupOld("asdf", info1, keyvals1);
    Iterator<Lookup> it1 = gs.getLookups(st1);
View Full Code Here

    List<FeatureMap> fms = new ArrayList<FeatureMap>();
    if(lookups == null) {
      return fms;
    }
    while(lookups.hasNext()) {
      FeatureMap fm = Factory.newFeatureMap();
      Lookup currentLookup = lookups.next();
      gazStore.addLookupListFeatures(fm, currentLookup);
      fm.put("_listnr",gazStore.getListInfoIndex(currentLookup));
      gazStore.addLookupEntryFeatures(fm, currentLookup);
      fms.add(fm);
    }
    return fms;
  }
View Full Code Here

TOP

Related Classes of gate.FeatureMap

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.