Examples of FeatureMap


Examples of gate.FeatureMap

  private void addConcept(Concept concept, Long sentenceStartPos) {
    Long conceptSPos = (long) concept.getOffset();
    Long sPos = sentenceStartPos + conceptSPos;
    Long ePos = sPos + (long) concept.getText().length();
    try {
      FeatureMap features = Factory.newFeatureMap();
      features.put("cn", concept.getName());
      features.put("cui", concept.getCode());
      features.put("definition", concept.getDefinition());
      features.put("preferredTerm", concept.getPreferredTerm().getText());
      features.put("synonyms", StringUtils.join(concept.getSynonyms(), ";"));
      features.put("tuis", joinTuis(concept.getSemanticTypes()));
      features.put("stys", joinStys(concept.getSemanticTypes()));
      AnnotationSet nobleCoderSet = getDocument().getAnnotations(
          getOutputAS());
      nobleCoderSet.add(sPos, ePos, getOutputAnnotationType(), features);
    } catch (Exception x) {
      if (debugging) {
View Full Code Here

Examples of gate.FeatureMap

          " which is non empty, number of documents contained: "+
          corpus.size());
      }
      // since this is a valid corpus, we adopt it by returning new
      // DocumentSubsetCorpus which has the original corpus as a parent
      FeatureMap parms = Factory.newFeatureMap();
      parms.put("jdbcCorpus", ourCorpus);
      try {
        Resource newCorpus = Factory.createResource(
          "at.ofai.gate.virtualcorpus.JDBCSubsetCorpus", parms,
          corpus.getFeatures(), corpus.getName());
        lr = (LanguageResource)newCorpus;
View Full Code Here

Examples of gate.FeatureMap

          " which is non empty, number of documents contained: "+
          corpus.size());
      }
      // since this is a valid corpus, we adopt it by returning new
      // DocumentSubsetCorpus which has the original corpus as a parent
      FeatureMap parms = Factory.newFeatureMap();
      parms.put("directoryCorpus", ourCorpus);
      try {
        Resource newCorpus = Factory.createResource("at.ofai.gate.virtualcorpus.DirectorySubsetCorpus", parms, corpus.getFeatures(), corpus.getName());
        lr = (LanguageResource)newCorpus;
      } catch (ResourceInstantiationException ex) {
        throw new PersistenceException("Could not adopt corpus "+corpus.getName(),ex);
View Full Code Here

Examples of gate.FeatureMap

        }

        Long sPos = offset;
        Long ePos = offset + line.length();
        if (line.length() > 0 && line.trim().length() > 0) {
          FeatureMap features = Factory.newFeatureMap();
           document.getAnnotations(getInputAS()).add(sPos, ePos, getInputAnnotationType(), features);
          if (debugging) {
            System.out.println("Adding sentence:\n\t at (" + sPos
                + ", " + ePos + ")");
          }
View Full Code Here

Examples of gate.FeatureMap

  private void addConcept(Concept concept, Long sentenceStartPos) {
    Long conceptSPos = (long) concept.getOffset();
    Long sPos = sentenceStartPos + conceptSPos;
    Long ePos = sPos + (long) concept.getText().length();
    try {
      FeatureMap features = Factory.newFeatureMap();
      features.put("cn", concept.getName());
      features.put("cui", concept.getCode());
      features.put("definition", concept.getDefinition());
      features.put("preferredTerm", concept.getPreferredTerm().getText());
      features.put("synonyms", StringUtils.join(concept.getSynonyms(),";"));
      features.put("tuis", joinTuis(concept.getSemanticTypes()));
      features.put("stys", joinStys(concept.getSemanticTypes()));
      AnnotationSet nobleCoderSet = getDocument().getAnnotations(
          getOutputAS());
      nobleCoderSet.add(sPos, ePos, getOutputAnnotationType(), features);
    } catch (Exception x) {
      if (debugging) {
View Full Code Here

Examples of opennlp.ccg.perceptron.FeatureMap

  protected void addFeatures(Sign sign, boolean complete) {
    // check for existing map, otherwise make one
    if (getFeatureMap(sign) != null) return;
    // lex case
    if (sign.isLexical()) {
      currentMap = new FeatureMap(0);
    }
    // non-terminal
    else {
      Sign[] inputs = sign.getDerivationHistory().getInputs();
      // first recurse
      for (Sign child : inputs) addFeatures(child, false);
      // use input maps in making current map
      if (inputs.length == 1) {
        currentMap = new FeatureMap(getFeatureMap(inputs[0]));
      }
      else if (inputs.length == 2) {
        currentMap = new FeatureMap(getFeatureMap(inputs[0]), getFeatureMap(inputs[1]));
      }

      String subjArg=null;
     
      //do each newly filled dep
View Full Code Here

Examples of org.eclipse.emf.ecore.util.FeatureMap

    {
      documentRoot = (EObject)resource.getContents().get(0);
      EClass documentRootClass = documentRoot.eClass();
      if ("".equals(extendedMetaData.getName(documentRootClass))) //TODO efficient way to check this? Maybe DataObject.getContainer should also check this?
      {
        FeatureMap featureMap = (FeatureMap)documentRoot.eGet(documentRootClass.getEStructuralFeature(0)); // get mixed feature
        int size = featureMap.size();
        for (int index = 0; index < size; index++)
        {
          EStructuralFeature feature = featureMap.getEStructuralFeature(index);
          boolean isText =
            feature == XMLTypePackage.Literals.XML_TYPE_DOCUMENT_ROOT__TEXT ||
            feature == XMLTypePackage.Literals.XML_TYPE_DOCUMENT_ROOT__CDATA ||   
            feature == XMLTypePackage.Literals.XML_TYPE_DOCUMENT_ROOT__COMMENT;
          if (!isText)
          {
            if (feature instanceof EReference)
            {
              rootObject = (EObject)featureMap.getValue(index);
              documentRoot.eUnset(feature);
            }
            else //EAttribute
            {
              rootObject = (EObject)SDOUtil.createDataTypeWrapper((Type)feature.getEType(), featureMap.getValue(index));
            }
            rootElement = feature;
            break;
          }
        } //for
View Full Code Here

Examples of org.eclipse.emf.ecore.util.FeatureMap

    private Scenario getDefaultScenario(Definitions def) {
      if(def.getRelationships() != null && def.getRelationships().size() > 0) {
          // current support for single relationship
          Relationship relationship = def.getRelationships().get(0);
          for(ExtensionAttributeValue extattrval : relationship.getExtensionValues()) {
                FeatureMap extensionElements = extattrval.getValue();
                @SuppressWarnings("unchecked")
                List<BPSimDataType> bpsimExtension = (List<BPSimDataType>) extensionElements.get(BpsimPackage.Literals.DOCUMENT_ROOT__BP_SIM_DATA, true);
                if(bpsimExtension != null && bpsimExtension.size() > 0) {
                    BPSimDataType bpmsim = bpsimExtension.get(0);
                  if(bpmsim.getScenario() != null && bpmsim.getScenario().size() > 0) {
                    return bpmsim.getScenario().get(0);
                  }
View Full Code Here

Examples of org.eclipse.emf.ecore.util.FeatureMap

    {
      documentRoot = (EObject)resource.getContents().get(0);
      EClass documentRootClass = documentRoot.eClass();
      if ("".equals(extendedMetaData.getName(documentRootClass))) //TODO efficient way to check this? Maybe DataObject.getContainer should also check this?
      {
        FeatureMap featureMap = (FeatureMap)documentRoot.eGet(documentRootClass.getEStructuralFeature(0)); // get mixed feature
        int size = featureMap.size();
        for (int index = 0; index < size; index++)
        {
          EStructuralFeature feature = featureMap.getEStructuralFeature(index);
          boolean isText =
            feature == XMLTypePackage.Literals.XML_TYPE_DOCUMENT_ROOT__TEXT ||
            feature == XMLTypePackage.Literals.XML_TYPE_DOCUMENT_ROOT__CDATA ||   
            feature == XMLTypePackage.Literals.XML_TYPE_DOCUMENT_ROOT__COMMENT;
          if (!isText)
          {
            if (feature instanceof EReference)
            {
              rootObject = (EObject)featureMap.getValue(index);
              documentRoot.eUnset(feature);
            }
            else //EAttribute
            {
              rootObject = (EObject)SDOUtil.createDataTypeWrapper((Type)feature.getEType(), featureMap.getValue(index));
            }
            rootElement = feature;
            break;
          }
        } //for
View Full Code Here

Examples of org.eclipse.emf.ecore.util.FeatureMap

    private Scenario getDefaultScenario(Definitions def) {
      if(def.getRelationships() != null && def.getRelationships().size() > 0) {
          // current support for single relationship
          Relationship relationship = def.getRelationships().get(0);
          for(ExtensionAttributeValue extattrval : relationship.getExtensionValues()) {
                FeatureMap extensionElements = extattrval.getValue();
                @SuppressWarnings("unchecked")
                List<BPSimDataType> bpsimExtensions = (List<BPSimDataType>) extensionElements.get(BpsimPackage.Literals.DOCUMENT_ROOT__BP_SIM_DATA, true);
                if(bpsimExtensions != null && bpsimExtensions.size() > 0) {
                    BPSimDataType processAnalysis = bpsimExtensions.get(0);
                  if(processAnalysis.getScenario() != null && processAnalysis.getScenario().size() > 0) {
                    return processAnalysis.getScenario().get(0);
                  }
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.