Examples of FeatureMap


Examples of gate.FeatureMap

 
  @Override
  public void addLookupListFeatures(FeatureMap fm, Lookup lookup) {
    OurLookup l = (OurLookup)lookup;
    int lookupIndex = getListInfoFromChunk(l.chunk);
    FeatureMap lfm = listInfos.get(lookupIndex).getFeatures();
    fm.putAll(lfm);
  }
View Full Code Here

Examples of gate.FeatureMap

    System.out.println("key2 added, index is "+i2);
   
    String[] keyvals1 = new String[]{"k1","v1","k2", "value2", "keynumber3", "v3", "k4", ""};
    char[] chunk1 = lookup2chunk(0,keyvals1);
   
    FeatureMap fm = gate.Factory.newFeatureMap();
    addToFmFromChunk(fm,chunk1);
    System.out.println("FeatureMap is "+fm);
    assertEquals("v1",(String)fm.get("k1"));
    assertEquals("value2",(String)fm.get("k2"));
    assertEquals("",(String)fm.get("k4"));
   
    String[] keyvals2 = new String[]{"k1","nother","k2","asasassa","k3","xxxxx"};
    char[] chunk2 = lookup2chunk(0,keyvals2);
    FeatureMap fm2 = gate.Factory.newFeatureMap();
    addToFmFromChunk(fm2,chunk2);
    assertEquals("nother",(String)fm2.get("k1"));
    assertEquals("asasassa",(String)fm2.get("k2"));
    assertEquals(null,fm2.get("k4"));
    assertEquals("xxxxx",(String)fm2.get("k3"));
   
    int si1 = addLookupToStore(-1,12,keyvals1);
    int idx = addLookupToStore(si1,23,keyvals2);
    System.out.println("Index for keyvals2: "+idx);
    idx = addLookupToStore(si1,23,keyvals2);
View Full Code Here

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

Examples of gate.FeatureMap

    //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

Examples of gate.FeatureMap

      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

Examples of gate.FeatureMap

 
  @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

Examples of gate.FeatureMap

 
  @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

Examples of gate.FeatureMap

  @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

Examples of gate.FeatureMap

  }
  @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

Examples of gate.FeatureMap

      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
TOP
Copyright © 2018 www.massapi.com. 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.