Package org.apache.uima.analysis_engine

Examples of org.apache.uima.analysis_engine.TypeOrFeature


  /**
   * @see org.apache.uima.analysis_engine.metadata.Capability#addOutputFeature(java.lang.String)
   */
  public void addOutputFeature(String aFeatureName) {
    TypeOrFeature feat = UIMAFramework.getResourceSpecifierFactory().createTypeOrFeature();
    feat.setType(false);
    feat.setName(aFeatureName);

    TypeOrFeature[] oldArr = getOutputs();
    TypeOrFeature[] newArr = new TypeOrFeature[oldArr.length + 1];
    System.arraycopy(oldArr, 0, newArr, 0, oldArr.length);
    newArr[newArr.length - 1] = feat;
View Full Code Here


        typeName = aFullFeatureName.substring(0, typeSeparatorIndex);
      }

      Iterator it = mTypesAndFeatures.keySet().iterator();
      while (it.hasNext()) {
        TypeOrFeature elem = (TypeOrFeature) it.next();
        if ((!elem.isType() && aFullFeatureName.equals(elem.getName()))
                || (elem.isType() && elem.isAllAnnotatorFeatures() && typeName.equals(elem
                        .getName()))) {
          return true;
        }
      }
View Full Code Here

        typeName = aFullFeatureName.substring(0, typeSeparatorIndex);
      }

      Iterator it = mTypesAndFeatures.keySet().iterator();
      while (it.hasNext()) {
        TypeOrFeature elem = (TypeOrFeature) it.next();
        if ((!elem.isType() && aFullFeatureName.equals(elem.getName()))
                || (elem.isType() && elem.isAllAnnotatorFeatures() && typeName.equals(elem
                        .getName()))) {
          HashSet languages = (HashSet) mTypesAndFeatures.get(elem);
          if (languages != null) {
            // check if tof is supported for the current language
            if (UNSPECIFIED_LANGUAGE.equals(language) || languages.contains(language)
View Full Code Here

    Vector vec = new Vector();

    Iterator it = mTypesAndFeatures.keySet().iterator();
    while (it.hasNext()) {
      // get current key
      TypeOrFeature tof = (TypeOrFeature) it.next();
      // get value for the current key
      Set values = (HashSet) mTypesAndFeatures.get(tof);
      if (values.contains(language) || values.contains(UNSPECIFIED_LANGUAGE)
              || values.contains(baseLanguage)) {
        // add tof to the TypeOfFeature array
View Full Code Here

  /**
   * @see org.apache.uima.analysis_engine.ResultSpecification#addResultType(java.lang.String,
   *      boolean)
   */
  public void addResultType(String aTypeName, boolean aAllAnnotatorFeatures) {
    TypeOrFeature t = new TypeOrFeature_impl();
    t.setType(true);
    t.setName(aTypeName);
    t.setAllAnnotatorFeatures(aAllAnnotatorFeatures);
    mTypesAndFeatures.put(t, mDefaultLanguage);
    // revert to uncompiled state
    mCompiledNameToLanguageMap.clear();
  }
View Full Code Here

      for (int x = 0; x < aLanguageIDs.length; x++) {
        // add current language to the HashSet
        languagesSupported.add(aLanguageIDs[x]);
      }

      TypeOrFeature t = new TypeOrFeature_impl();
      t.setType(true);
      t.setName(aTypeName);
      t.setAllAnnotatorFeatures(aAllAnnotatorFeatures);
      HashSet existingLanguages = (HashSet) mTypesAndFeatures.get(t);
      if (existingLanguages != null) {
        existingLanguages.addAll(languagesSupported);
      } else {
        mTypesAndFeatures.put(t, languagesSupported);
View Full Code Here

  /**
   * @see org.apache.uima.analysis_engine.ResultSpecification#addResultFeature(java.lang.String)
   */
  public void addResultFeature(String aFullFeatureName) {
    TypeOrFeature f = new TypeOrFeature_impl();
    f.setType(false);
    f.setName(aFullFeatureName);
    mTypesAndFeatures.put(f, mDefaultLanguage);
    // revert to uncompiled state
    mCompiledNameToLanguageMap.clear();
  }
View Full Code Here

      for (int x = 0; x < aLanguageIDs.length; x++) {
        // add current language to the HashSet
        languagesSupported.add(aLanguageIDs[x]);
      }

      TypeOrFeature f = new TypeOrFeature_impl();
      f.setType(false);
      f.setName(aFullFeatureName);
      HashSet existingLanguages = (HashSet) mTypesAndFeatures.get(f);
      if (existingLanguages != null) {
        existingLanguages.addAll(languagesSupported);
      } else {
        mTypesAndFeatures.put(f, languagesSupported);
View Full Code Here

  public void compile(TypeSystem aTypeSystem) {
    mCompiledNameToLanguageMap.clear();
    Iterator it = mTypesAndFeatures.entrySet().iterator();
    while (it.hasNext()) {
      Map.Entry elem = (Map.Entry) it.next();
      TypeOrFeature tof = (TypeOrFeature) elem.getKey();
      if (tof.isType()) {
        Type t = aTypeSystem.getType(tof.getName());
        if (t != null) {
          addTypeRecursive(t, aTypeSystem, (HashSet) elem.getValue(), tof.isAllAnnotatorFeatures());
        }
      } else // feature
      {
        mCompiledNameToLanguageMap.put(tof.getName(), elem.getValue());
      }
    }
    // TODO: process the set of intersections
  }
View Full Code Here

      return mCompiledNameToLanguageMap.containsKey(aTypeName);
    } else {
      // brute force search
      Iterator it = mTypesAndFeatures.keySet().iterator();
      while (it.hasNext()) {
        TypeOrFeature elem = (TypeOrFeature) it.next();
        if (elem.isType() && aTypeName.equals(elem.getName())) {
          return true;
        }
      }
      return false;
    }
View Full Code Here

TOP

Related Classes of org.apache.uima.analysis_engine.TypeOrFeature

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.