SOLR-2387: stabilize UIMA tests, so they use mock objects instead of remote calls

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1084045 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Robert Muir 2011-03-22 01:01:26 +00:00
parent 1c0ff82ac1
commit e96d323723
20 changed files with 596 additions and 462 deletions

View File

@ -18,3 +18,14 @@ AlchemyAPIAnnotator v2.3.1-SNAPSHOT rev. 1062868
WhitespaceTokenizer v2.3.1-SNAPSHOT rev. 1076132
$Id$
================== 3.2.0-dev ==================
Test Cases:
* SOLR-2387: add mock annotators for improved testing,
(Tommaso Teofili via rmuir)
================== 3.1.0-dev ==================
Initial Release

View File

@ -34,11 +34,11 @@ public class SolrUIMAConfiguration {
private String aePath;
private Map<String, String> runtimeParameters;
private Map<String, Object> runtimeParameters;
public SolrUIMAConfiguration(String aePath, String[] fieldsToAnalyze, boolean fieldsMerging,
Map<String, Map<String, String>> typesFeaturesFieldsMapping,
Map<String, String> runtimeParameters) {
Map<String, Object> runtimeParameters) {
this.aePath = aePath;
this.fieldsToAnalyze = fieldsToAnalyze;
this.fieldsMerging = fieldsMerging;
@ -62,7 +62,7 @@ public class SolrUIMAConfiguration {
return aePath;
}
public Map<String, String> getRuntimeParameters() {
public Map<String, Object> getRuntimeParameters() {
return runtimeParameters;
}

View File

@ -105,15 +105,15 @@ public class SolrUIMAConfigurationReader {
return map;
}
private Map<String, String> readAEOverridingParameters() {
Map<String, String> runtimeParameters = new HashMap<String, String>();
private Map<String, Object> readAEOverridingParameters() {
Map<String, Object> runtimeParameters = new HashMap<String, Object>();
Node uimaConfigNode = solrConfig.getNode(AE_RUNTIME_PARAMETERS_NODE_PATH, true);
if (uimaConfigNode.hasChildNodes()) {
NodeList overridingNodes = uimaConfigNode.getChildNodes();
for (int i = 0; i < overridingNodes.getLength(); i++) {
Node overridingNode = overridingNodes.item(i);
if (overridingNode.getNodeType() != Node.TEXT_NODE) {
if (overridingNode.getNodeType() != Node.TEXT_NODE && overridingNode.getNodeType() != Node.COMMENT_NODE) {
runtimeParameters.put(overridingNode.getNodeName(), overridingNode.getTextContent());
}
}

View File

@ -43,7 +43,7 @@ public class AEProviderFactory {
}
public synchronized AEProvider getAEProvider(String core, String aePath,
Map<String, String> runtimeParameters) {
Map<String, Object> runtimeParameters) {
String key = new StringBuilder(core).append(aePath).toString();
if (providerCache.get(key) == null) {
providerCache.put(key, new OverridingParamsAEProvider(aePath, runtimeParameters));

View File

@ -43,9 +43,9 @@ public class OverridingParamsAEProvider implements AEProvider {
private AnalysisEngine cachedAE;
private Map<String, String> runtimeParameters;
private Map<String, Object> runtimeParameters;
public OverridingParamsAEProvider(String aeFilePath, Map<String, String> runtimeParameters) {
public OverridingParamsAEProvider(String aeFilePath, Map<String, Object> runtimeParameters) {
this.aeFilePath = aeFilePath;
this.runtimeParameters = runtimeParameters;
}
@ -63,9 +63,11 @@ public class OverridingParamsAEProvider implements AEProvider {
/* iterate over each AE (to set runtime parameters) */
for (String attributeName : runtimeParameters.keySet()) {
Object val = getRuntimeValue(desc, attributeName);
desc.getAnalysisEngineMetaData().getConfigurationParameterSettings().setParameterValue(
attributeName, runtimeParameters.get(attributeName));
log.info(new StringBuilder("setting ").append(attributeName).append(" : ").append(
attributeName, val);
if (log.isDebugEnabled())
log.debug(new StringBuilder("setting ").append(attributeName).append(" : ").append(
runtimeParameters.get(attributeName)).toString());
}
// create AE here
@ -86,4 +88,30 @@ public class OverridingParamsAEProvider implements AEProvider {
return cachedAE;
}
/* create the value to inject in the runtime parameter depending on its declared type */
private Object getRuntimeValue(AnalysisEngineDescription desc, String attributeName)
throws ClassNotFoundException {
String type = desc.getAnalysisEngineMetaData().getConfigurationParameterDeclarations().
getConfigurationParameter(null, attributeName).getType();
// TODO : do it via reflection ? i.e. Class paramType = Class.forName(type)...
Object val = null;
Object runtimeValue = runtimeParameters.get(attributeName);
if (runtimeValue!=null) {
if ("String".equals(type)) {
val = String.valueOf(runtimeValue);
}
else if ("Integer".equals(type)) {
val = Integer.valueOf(runtimeValue.toString());
}
else if ("Boolean".equals(type)) {
val = Boolean.valueOf(runtimeValue.toString());
}
else if ("Float".equals(type)) {
val = Float.valueOf(runtimeValue.toString());
}
}
return val;
}
}

View File

@ -70,8 +70,6 @@ public class UIMAUpdateRequestProcessorTest extends SolrTestCaseJ4 {
@Test
public void testProcessing() throws Exception {
// this test requires an internet connection (e.g. opencalais api)
checkInternetConnection();
addDoc(adoc(
"id",
@ -83,26 +81,29 @@ public class UIMAUpdateRequestProcessorTest extends SolrTestCaseJ4 {
+ " attached if you need it, but it is also committed to trunk and 3_x branch."
+ " Last Lucene European Conference has been held in Prague."));
assertU(commit());
assertQ(req("suggested_category:*"), "//*[@numFound='1']");
assertQ(req("sentence:*"), "//*[@numFound='1']");
assertQ(req("sentiment:*"), "//*[@numFound='0']");
assertQ(req("entity:Prague"), "//*[@numFound='1']");
}
@Test
public void testTwoUpdates() throws Exception {
// this test requires an internet connection (e.g. opencalais api)
checkInternetConnection();
addDoc(adoc("id", "1", "text", "The Apache Software Foundation is happy to announce "
+ "BarCampApache Sydney, Australia, the first ASF-backed event in the Southern "
+ "Hemisphere!"));
assertU(commit());
assertQ(req("suggested_category:*"), "//*[@numFound='1']");
assertQ(req("sentence:*"), "//*[@numFound='1']");
addDoc(adoc("id", "2", "text", "Taking place 11th December 2010 at the University "
+ "of Sydney's Darlington Centre, the BarCampApache \"unconference\" will be"
+ " attendee-driven, facilitated by members of the Apache community and will "
+ "focus on the Apache..."));
assertU(commit());
assertQ(req("suggested_category:*"), "//*[@numFound='2']");
assertQ(req("sentence:*"), "//*[@numFound='2']");
assertQ(req("sentiment:positive"), "//*[@numFound='1']");
assertQ(req("entity:Apache"), "//*[@numFound='2']");
}
private void addDoc(String doc) throws Exception {
@ -120,14 +121,4 @@ public class UIMAUpdateRequestProcessorTest extends SolrTestCaseJ4 {
handler.handleRequestBody(req, new SolrQueryResponse());
}
private void checkInternetConnection() {
try {
URLConnection conn = new URL("http://www.apache.org/").openConnection();
conn.setConnectTimeout(5000);
conn.setReadTimeout(5000);
conn.connect();
} catch (Exception ex) {
assumeNoException("This test requires an internet connection", ex);
}
}
}

View File

@ -0,0 +1,42 @@
package org.apache.solr.uima.processor.an;
import org.apache.solr.uima.ts.EntityAnnotation;
import org.apache.uima.TokenAnnotation;
import org.apache.uima.analysis_component.JCasAnnotator_ImplBase;
import org.apache.uima.analysis_engine.AnalysisEngineProcessException;
import org.apache.uima.jcas.JCas;
import org.apache.uima.jcas.tcas.Annotation;
/**
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
public class DummyEntityAnnotator extends JCasAnnotator_ImplBase{
@Override
public void process(JCas jcas) throws AnalysisEngineProcessException {
for (Annotation annotation : jcas.getAnnotationIndex(TokenAnnotation.type)) {
String tokenPOS = ((TokenAnnotation) annotation).getPosTag();
if ("np".equals(tokenPOS) || "nps".equals(tokenPOS)) {
EntityAnnotation entityAnnotation = new EntityAnnotation(jcas);
entityAnnotation.setBegin(annotation.getBegin());
entityAnnotation.setEnd(annotation.getEnd());
entityAnnotation.addToIndexes();
}
}
}
}

View File

@ -0,0 +1,61 @@
package org.apache.solr.uima.processor.an;
import java.util.Arrays;
import org.apache.solr.uima.ts.SentimentAnnotation;
import org.apache.uima.TokenAnnotation;
import org.apache.uima.analysis_component.JCasAnnotator_ImplBase;
import org.apache.uima.analysis_engine.AnalysisEngineProcessException;
import org.apache.uima.jcas.JCas;
import org.apache.uima.jcas.tcas.Annotation;
/**
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
public class DummySentimentAnnotator extends JCasAnnotator_ImplBase{
private static final String[] positiveAdj = {"happy","cool","nice"};
private static final String[] negativeAdj = {"bad","sad","ugly"};
@Override
public void process(JCas jcas) throws AnalysisEngineProcessException {
for (Annotation annotation : jcas.getAnnotationIndex(TokenAnnotation.type)) {
String tokenPOS = ((TokenAnnotation) annotation).getPosTag();
if ("jj".equals(tokenPOS)) {
if (Arrays.asList(positiveAdj).contains(annotation.getCoveredText())) {
SentimentAnnotation sentimentAnnotation = createSentimentAnnotation(jcas, annotation);
sentimentAnnotation.setMood("positive");
sentimentAnnotation.addToIndexes();
}
else if (Arrays.asList(negativeAdj).contains(annotation.getCoveredText())) {
SentimentAnnotation sentimentAnnotation = createSentimentAnnotation(jcas, annotation);
sentimentAnnotation.setMood("negative");
sentimentAnnotation.addToIndexes();
}
}
}
}
private SentimentAnnotation createSentimentAnnotation(JCas jcas, Annotation annotation) {
SentimentAnnotation sentimentAnnotation = new SentimentAnnotation(jcas);
sentimentAnnotation.setBegin(annotation.getBegin());
sentimentAnnotation.setEnd(annotation.getEnd());
return sentimentAnnotation;
}
}

View File

@ -0,0 +1,62 @@
/* First created by JCasGen Fri Mar 04 12:48:08 CET 2011 */
package org.apache.solr.uima.ts;
import org.apache.uima.jcas.JCas;
import org.apache.uima.jcas.JCasRegistry;
import org.apache.uima.jcas.cas.TOP_Type;
import org.apache.uima.jcas.tcas.Annotation;
/**
* Updated by JCasGen Fri Mar 04 12:50:14 CET 2011
* XML source: /Users/tommasoteofili/Documents/workspaces/lucene_workspace/lucene_dev/solr/contrib/uima/src/test/resources/DummyEntityAEDescriptor.xml
* @generated */
public class EntityAnnotation extends Annotation {
/** @generated
* @ordered
*/
public final static int typeIndexID = JCasRegistry.register(EntityAnnotation.class);
/** @generated
* @ordered
*/
public final static int type = typeIndexID;
/** @generated */
public int getTypeIndexID() {return typeIndexID;}
/** Never called. Disable default constructor
* @generated */
protected EntityAnnotation() {}
/** Internal - constructor used by generator
* @generated */
public EntityAnnotation(int addr, TOP_Type type) {
super(addr, type);
readObject();
}
/** @generated */
public EntityAnnotation(JCas jcas) {
super(jcas);
readObject();
}
/** @generated */
public EntityAnnotation(JCas jcas, int begin, int end) {
super(jcas);
setBegin(begin);
setEnd(end);
readObject();
}
/** <!-- begin-user-doc -->
* Write your own initialization here
* <!-- end-user-doc -->
@generated modifiable */
private void readObject() {}
}

View File

@ -0,0 +1,55 @@
/* First created by JCasGen Fri Mar 04 12:48:08 CET 2011 */
package org.apache.solr.uima.ts;
import org.apache.uima.jcas.JCas;
import org.apache.uima.jcas.JCasRegistry;
import org.apache.uima.cas.impl.CASImpl;
import org.apache.uima.cas.impl.FSGenerator;
import org.apache.uima.cas.FeatureStructure;
import org.apache.uima.cas.impl.TypeImpl;
import org.apache.uima.cas.Type;
import org.apache.uima.jcas.tcas.Annotation_Type;
/**
* Updated by JCasGen Fri Mar 04 12:50:14 CET 2011
* @generated */
public class EntityAnnotation_Type extends Annotation_Type {
/** @generated */
protected FSGenerator getFSGenerator() {return fsGenerator;}
/** @generated */
private final FSGenerator fsGenerator =
new FSGenerator() {
public FeatureStructure createFS(int addr, CASImpl cas) {
if (EntityAnnotation_Type.this.useExistingInstance) {
// Return eq fs instance if already created
FeatureStructure fs = EntityAnnotation_Type.this.jcas.getJfsFromCaddr(addr);
if (null == fs) {
fs = new EntityAnnotation(addr, EntityAnnotation_Type.this);
EntityAnnotation_Type.this.jcas.putJfsFromCaddr(addr, fs);
return fs;
}
return fs;
} else return new EntityAnnotation(addr, EntityAnnotation_Type.this);
}
};
/** @generated */
public final static int typeIndexID = EntityAnnotation.typeIndexID;
/** @generated
@modifiable */
public final static boolean featOkTst = JCasRegistry.getFeatOkTst("org.apache.solr.uima.ts.EntityAnnotation");
/** initialize variables to correspond with Cas Type and Features
* @generated */
public EntityAnnotation_Type(JCas jcas, Type casType) {
super(jcas, casType);
casImpl.getFSClassRegistry().addGeneratorForType((TypeImpl)this.casType, getFSGenerator());
}
}

View File

@ -0,0 +1,80 @@
/* First created by JCasGen Fri Mar 04 13:08:40 CET 2011 */
package org.apache.solr.uima.ts;
import org.apache.uima.jcas.JCas;
import org.apache.uima.jcas.JCasRegistry;
import org.apache.uima.jcas.cas.TOP_Type;
import org.apache.uima.jcas.tcas.Annotation;
/**
* Updated by JCasGen Fri Mar 04 13:08:40 CET 2011
* XML source: /Users/tommasoteofili/Documents/workspaces/lucene_workspace/lucene_dev/solr/contrib/uima/src/test/resources/DummySentimentAnalysisAEDescriptor.xml
* @generated */
public class SentimentAnnotation extends Annotation {
/** @generated
* @ordered
*/
public final static int typeIndexID = JCasRegistry.register(SentimentAnnotation.class);
/** @generated
* @ordered
*/
public final static int type = typeIndexID;
/** @generated */
public int getTypeIndexID() {return typeIndexID;}
/** Never called. Disable default constructor
* @generated */
protected SentimentAnnotation() {}
/** Internal - constructor used by generator
* @generated */
public SentimentAnnotation(int addr, TOP_Type type) {
super(addr, type);
readObject();
}
/** @generated */
public SentimentAnnotation(JCas jcas) {
super(jcas);
readObject();
}
/** @generated */
public SentimentAnnotation(JCas jcas, int begin, int end) {
super(jcas);
setBegin(begin);
setEnd(end);
readObject();
}
/** <!-- begin-user-doc -->
* Write your own initialization here
* <!-- end-user-doc -->
@generated modifiable */
private void readObject() {}
//*--------------*
//* Feature: mood
/** getter for mood - gets
* @generated */
public String getMood() {
if (SentimentAnnotation_Type.featOkTst && ((SentimentAnnotation_Type)jcasType).casFeat_mood == null)
jcasType.jcas.throwFeatMissing("mood", "org.apache.solr.uima.ts.SentimentAnnotation");
return jcasType.ll_cas.ll_getStringValue(addr, ((SentimentAnnotation_Type)jcasType).casFeatCode_mood);}
/** setter for mood - sets
* @generated */
public void setMood(String v) {
if (SentimentAnnotation_Type.featOkTst && ((SentimentAnnotation_Type)jcasType).casFeat_mood == null)
jcasType.jcas.throwFeatMissing("mood", "org.apache.solr.uima.ts.SentimentAnnotation");
jcasType.ll_cas.ll_setStringValue(addr, ((SentimentAnnotation_Type)jcasType).casFeatCode_mood, v);}
}

View File

@ -0,0 +1,79 @@
/* First created by JCasGen Fri Mar 04 13:08:40 CET 2011 */
package org.apache.solr.uima.ts;
import org.apache.uima.jcas.JCas;
import org.apache.uima.jcas.JCasRegistry;
import org.apache.uima.cas.impl.CASImpl;
import org.apache.uima.cas.impl.FSGenerator;
import org.apache.uima.cas.FeatureStructure;
import org.apache.uima.cas.impl.TypeImpl;
import org.apache.uima.cas.Type;
import org.apache.uima.cas.impl.FeatureImpl;
import org.apache.uima.cas.Feature;
import org.apache.uima.jcas.tcas.Annotation_Type;
/**
* Updated by JCasGen Fri Mar 04 13:08:40 CET 2011
* @generated */
public class SentimentAnnotation_Type extends Annotation_Type {
/** @generated */
protected FSGenerator getFSGenerator() {return fsGenerator;}
/** @generated */
private final FSGenerator fsGenerator =
new FSGenerator() {
public FeatureStructure createFS(int addr, CASImpl cas) {
if (SentimentAnnotation_Type.this.useExistingInstance) {
// Return eq fs instance if already created
FeatureStructure fs = SentimentAnnotation_Type.this.jcas.getJfsFromCaddr(addr);
if (null == fs) {
fs = new SentimentAnnotation(addr, SentimentAnnotation_Type.this);
SentimentAnnotation_Type.this.jcas.putJfsFromCaddr(addr, fs);
return fs;
}
return fs;
} else return new SentimentAnnotation(addr, SentimentAnnotation_Type.this);
}
};
/** @generated */
public final static int typeIndexID = SentimentAnnotation.typeIndexID;
/** @generated
@modifiable */
public final static boolean featOkTst = JCasRegistry.getFeatOkTst("org.apache.solr.uima.ts.SentimentAnnotation");
/** @generated */
final Feature casFeat_mood;
/** @generated */
final int casFeatCode_mood;
/** @generated */
public String getMood(int addr) {
if (featOkTst && casFeat_mood == null)
jcas.throwFeatMissing("mood", "org.apache.solr.uima.ts.SentimentAnnotation");
return ll_cas.ll_getStringValue(addr, casFeatCode_mood);
}
/** @generated */
public void setMood(int addr, String v) {
if (featOkTst && casFeat_mood == null)
jcas.throwFeatMissing("mood", "org.apache.solr.uima.ts.SentimentAnnotation");
ll_cas.ll_setStringValue(addr, casFeatCode_mood, v);}
/** initialize variables to correspond with Cas Type and Features
* @generated */
public SentimentAnnotation_Type(JCas jcas, Type casType) {
super(jcas, casType);
casImpl.getFSClassRegistry().addGeneratorForType((TypeImpl)this.casType, getFSGenerator());
casFeat_mood = jcas.getRequiredFeatureDE(casType, "mood", "uima.cas.String", featOkTst);
casFeatCode_mood = (null == casFeat_mood) ? JCas.INVALID_FEATURE_CODE : ((FeatureImpl)casFeat_mood).getCode();
}
}

View File

@ -14,25 +14,34 @@
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
-->
<analysisEngineDescription xmlns="http://uima.apache.org/resourceSpecifier">
<frameworkImplementation>org.apache.uima.java</frameworkImplementation>
<primitive>false</primitive>
<delegateAnalysisEngineSpecifiers>
<delegateAnalysisEngine key="HmmTagger">
<import name="HmmTagger"/>
</delegateAnalysisEngine>
<delegateAnalysisEngine key="WhitespaceTokenizer">
<import name="WhitespaceTokenizer"/>
</delegateAnalysisEngine>
<delegateAnalysisEngine key="HmmTagger">
<import name="HmmTagger"/>
</delegateAnalysisEngine>
</delegateAnalysisEngineSpecifiers>
<analysisEngineMetaData>
<name>AggregateSentenceAE</name>
<description/>
<version>1.0</version>
<vendor/>
<configurationParameters/>
<configurationParameters>
<configurationParameter>
<name>ngramsize</name>
<type>Integer</type>
<multiValued>false</multiValued>
<mandatory>false</mandatory>
<overrides>
<parameter>HmmTagger/NGRAM_SIZE</parameter>
</overrides>
</configurationParameter>
</configurationParameters>
<configurationParameterSettings/>
<flowConstraints>
<fixedFlow>
@ -44,7 +53,10 @@
<capabilities>
<capability>
<inputs/>
<outputs/>
<outputs>
<type allAnnotatorFeatures="true">org.apache.uima.SentenceAnnotation</type>
<type allAnnotatorFeatures="true">org.apache.uima.TokenAnnotation</type>
</outputs>
<languagesSupported/>
</capability>
</capabilities>

View File

@ -0,0 +1,56 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<analysisEngineDescription xmlns="http://uima.apache.org/resourceSpecifier">
<frameworkImplementation>org.apache.uima.java</frameworkImplementation>
<primitive>true</primitive>
<annotatorImplementationName>org.apache.solr.uima.processor.an.DummyEntityAnnotator</annotatorImplementationName>
<analysisEngineMetaData>
<name>DummyEntityAEDescriptor</name>
<description/>
<version>1.0</version>
<vendor>ASF</vendor>
<configurationParameters/>
<configurationParameterSettings/>
<typeSystemDescription>
<types>
<typeDescription>
<name>org.apache.solr.uima.ts.EntityAnnotation</name>
<description/>
<supertypeName>uima.tcas.Annotation</supertypeName>
</typeDescription>
</types>
</typeSystemDescription>
<typePriorities/>
<fsIndexCollection/>
<capabilities>
<capability>
<inputs/>
<outputs>
<type allAnnotatorFeatures="true">org.apache.solr.uima.ts.EntityAnnotation</type>
</outputs>
<languagesSupported/>
</capability>
</capabilities>
<operationalProperties>
<modifiesCas>true</modifiesCas>
<multipleDeploymentAllowed>true</multipleDeploymentAllowed>
<outputsNewCASes>false</outputsNewCASes>
</operationalProperties>
</analysisEngineMetaData>
<resourceManagerConfiguration/>
</analysisEngineDescription>

View File

@ -0,0 +1,60 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<analysisEngineDescription xmlns="http://uima.apache.org/resourceSpecifier">
<frameworkImplementation>org.apache.uima.java</frameworkImplementation>
<primitive>true</primitive>
<annotatorImplementationName>org.apache.solr.uima.processor.an.DummySentimentAnnotator</annotatorImplementationName>
<analysisEngineMetaData>
<name>DummySentimentAnalysisAEDescriptor</name>
<description/>
<version>1.0</version>
<vendor>ASF</vendor>
<configurationParameters/>
<configurationParameterSettings/>
<typeSystemDescription>
<types>
<typeDescription>
<name>org.apache.solr.uima.ts.SentimentAnnotation</name>
<description/>
<supertypeName>uima.tcas.Annotation</supertypeName>
<features>
<featureDescription>
<name>mood</name>
<description/>
<rangeTypeName>uima.cas.String</rangeTypeName>
</featureDescription>
</features>
</typeDescription>
</types>
</typeSystemDescription>
<typePriorities/>
<fsIndexCollection/>
<capabilities>
<capability>
<inputs/>
<outputs/>
</capability>
</capabilities>
<operationalProperties>
<modifiesCas>true</modifiesCas>
<multipleDeploymentAllowed>true</multipleDeploymentAllowed>
<outputsNewCASes>false</outputsNewCASes>
</operationalProperties>
</analysisEngineMetaData>
<resourceManagerConfiguration/>
</analysisEngineDescription>

View File

@ -1,194 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<analysisEngineDescription xmlns="http://uima.apache.org/resourceSpecifier">
<frameworkImplementation>org.apache.uima.java</frameworkImplementation>
<primitive>true</primitive>
<annotatorImplementationName>org.apache.uima.annotator.calais.OpenCalaisAnnotator</annotatorImplementationName>
<analysisEngineMetaData>
<name>OpenCalaisAnnotator</name>
<description/>
<configurationParameters>
<configurationParameter>
<name>allowDistribution</name>
<description/>
<type>Boolean</type>
<multiValued>false</multiValued>
<mandatory>true</mandatory>
</configurationParameter>
<configurationParameter>
<name>allowSearch</name>
<description/>
<type>Boolean</type>
<multiValued>false</multiValued>
<mandatory>true</mandatory>
</configurationParameter>
<configurationParameter>
<name>submitter</name>
<description/>
<type>String</type>
<multiValued>false</multiValued>
<mandatory>true</mandatory>
</configurationParameter>
<configurationParameter>
<name>licenseID</name>
<description/>
<type>String</type>
<multiValued>false</multiValued>
<mandatory>true</mandatory>
</configurationParameter>
</configurationParameters>
<configurationParameterSettings>
<nameValuePair>
<name>allowDistribution</name>
<value>
<boolean>false</boolean>
</value>
</nameValuePair>
<nameValuePair>
<name>allowSearch</name>
<value>
<boolean>false</boolean>
</value>
</nameValuePair>
<nameValuePair>
<name>submitter</name>
<value>
<string/>
</value>
</nameValuePair>
<nameValuePair>
<name>licenseID</name>
<value>
<string>OC_LICENSE_ID</string>
</value>
</nameValuePair>
</configurationParameterSettings>
<typeSystemDescription>
<types>
<typeDescription>
<name>org.apache.uima.calais.Person</name>
<description/>
<supertypeName>org.apache.uima.calais.BaseType</supertypeName>
</typeDescription>
<typeDescription>
<name>org.apache.uima.calais.Anniversary</name>
<description/>
<supertypeName>org.apache.uima.calais.BaseType</supertypeName>
</typeDescription>
<typeDescription>
<name>org.apache.uima.calais.City</name>
<description/>
<supertypeName>org.apache.uima.calais.BaseType</supertypeName>
</typeDescription>
<typeDescription>
<name>org.apache.uima.calais.Company</name>
<description/>
<supertypeName>org.apache.uima.calais.BaseType</supertypeName>
</typeDescription>
<typeDescription>
<name>org.apache.uima.calais.Continent</name>
<description/>
<supertypeName>org.apache.uima.calais.BaseType</supertypeName>
</typeDescription>
<typeDescription>
<name>org.apache.uima.calais.Country</name>
<description/>
<supertypeName>org.apache.uima.calais.BaseType</supertypeName>
</typeDescription>
<typeDescription>
<name>org.apache.uima.calais.Currency</name>
<description/>
<supertypeName>org.apache.uima.calais.BaseType</supertypeName>
</typeDescription>
<typeDescription>
<name>org.apache.uima.calais.EmailAddress</name>
<description/>
<supertypeName>org.apache.uima.calais.BaseType</supertypeName>
</typeDescription>
<typeDescription>
<name>org.apache.uima.calais.Facility</name>
<description/>
<supertypeName>org.apache.uima.calais.BaseType</supertypeName>
</typeDescription>
<typeDescription>
<name>org.apache.uima.calais.FaxNumber</name>
<description/>
<supertypeName>org.apache.uima.calais.BaseType</supertypeName>
</typeDescription>
<typeDescription>
<name>org.apache.uima.calais.Holiday</name>
<description/>
<supertypeName>org.apache.uima.calais.BaseType</supertypeName>
</typeDescription>
<typeDescription>
<name>org.apache.uima.calais.IndustryTerm</name>
<description/>
<supertypeName>org.apache.uima.calais.BaseType</supertypeName>
</typeDescription>
<typeDescription>
<name>org.apache.uima.calais.NaturalDisaster</name>
<description/>
<supertypeName>org.apache.uima.calais.BaseType</supertypeName>
</typeDescription>
<typeDescription>
<name>org.apache.uima.calais.NaturalFeature</name>
<description/>
<supertypeName>org.apache.uima.calais.BaseType</supertypeName>
</typeDescription>
<typeDescription>
<name>org.apache.uima.calais.Organization</name>
<description/>
<supertypeName>org.apache.uima.calais.BaseType</supertypeName>
</typeDescription>
<typeDescription>
<name>org.apache.uima.calais.PhoneNumber</name>
<description/>
<supertypeName>org.apache.uima.calais.BaseType</supertypeName>
</typeDescription>
<typeDescription>
<name>org.apache.uima.calais.ProviceOrState</name>
<description/>
<supertypeName>org.apache.uima.calais.BaseType</supertypeName>
</typeDescription>
<typeDescription>
<name>org.apache.uima.calais.Region</name>
<description/>
<supertypeName>org.apache.uima.calais.BaseType</supertypeName>
</typeDescription>
<typeDescription>
<name>org.apache.uima.calais.Technology</name>
<description/>
<supertypeName>org.apache.uima.calais.BaseType</supertypeName>
</typeDescription>
<typeDescription>
<name>org.apache.uima.calais.URL</name>
<description/>
<supertypeName>org.apache.uima.calais.BaseType</supertypeName>
</typeDescription>
<typeDescription>
<name>org.apache.uima.calais.BaseType</name>
<description/>
<supertypeName>uima.tcas.Annotation</supertypeName>
<features>
<featureDescription>
<name>calaisType</name>
<description>OpenCalais type</description>
<rangeTypeName>uima.cas.String</rangeTypeName>
</featureDescription>
</features>
</typeDescription>
</types>
</typeSystemDescription>
<capabilities>
<capability>
<inputs/>
<outputs/>
<languagesSupported/>
</capability>
</capabilities>
<operationalProperties>
<modifiesCas>true</modifiesCas>
<multipleDeploymentAllowed>true</multipleDeploymentAllowed>
<outputsNewCASes>false</outputsNewCASes>
</operationalProperties>
</analysisEngineMetaData>
</analysisEngineDescription>

View File

@ -20,126 +20,38 @@
<frameworkImplementation>org.apache.uima.java</frameworkImplementation>
<primitive>false</primitive>
<delegateAnalysisEngineSpecifiers>
<delegateAnalysisEngine key="TextKeywordExtractionAEDescriptor">
<import name="TextKeywordExtractionAEDescriptor"/>
</delegateAnalysisEngine>
<delegateAnalysisEngine key="TextConceptTaggingAEDescriptor">
<import name="TextConceptTaggingAEDescriptor"/>
</delegateAnalysisEngine>
<delegateAnalysisEngine key="OpenCalaisAnnotator">
<import name="OpenCalaisAnnotator"/>
</delegateAnalysisEngine>
<delegateAnalysisEngine key="TextLanguageDetectionAEDescriptor">
<import name="TextLanguageDetectionAEDescriptor"/>
</delegateAnalysisEngine>
<delegateAnalysisEngine key="TextCategorizationAEDescriptor">
<import name="TextCategorizationAEDescriptor"/>
</delegateAnalysisEngine>
<delegateAnalysisEngine key="AggregateSentenceAE">
<import location="AggregateSentenceAE.xml"/>
</delegateAnalysisEngine>
<delegateAnalysisEngine key="TextRankedEntityExtractionAEDescriptor">
<import name="TextRankedEntityExtractionAEDescriptor"/>
<delegateAnalysisEngine key="DummyEntityAEDescriptor">
<import location="DummyEntityAEDescriptor.xml"/>
</delegateAnalysisEngine>
<delegateAnalysisEngine key="DummySentimentAnalysisAEDescriptor">
<import location="DummySentimentAnalysisAEDescriptor.xml"/>
</delegateAnalysisEngine>
</delegateAnalysisEngineSpecifiers>
<analysisEngineMetaData>
<name>ExtServicesAE</name>
<name>TestAE</name>
<description/>
<version>1.0</version>
<vendor/>
<configurationParameters searchStrategy="language_fallback">
<configurationParameters>
<configurationParameter>
<name>oc_licenseID</name>
<type>String</type>
<name>ngramsize</name>
<type>Integer</type>
<multiValued>false</multiValued>
<mandatory>true</mandatory>
<mandatory>false</mandatory>
<overrides>
<parameter>OpenCalaisAnnotator/licenseID</parameter>
</overrides>
</configurationParameter>
<configurationParameter>
<name>keyword_apikey</name>
<type>String</type>
<multiValued>false</multiValued>
<mandatory>true</mandatory>
<overrides>
<parameter>TextKeywordExtractionAEDescriptor/apikey</parameter>
</overrides>
</configurationParameter>
<configurationParameter>
<name>concept_apikey</name>
<type>String</type>
<multiValued>false</multiValued>
<mandatory>true</mandatory>
<overrides>
<parameter>TextConceptTaggingAEDescriptor/apikey</parameter>
</overrides>
</configurationParameter>
<configurationParameter>
<name>lang_apikey</name>
<type>String</type>
<multiValued>false</multiValued>
<mandatory>true</mandatory>
<overrides>
<parameter>TextLanguageDetectionAEDescriptor/apikey</parameter>
</overrides>
</configurationParameter>
<configurationParameter>
<name>cat_apikey</name>
<type>String</type>
<multiValued>false</multiValued>
<mandatory>true</mandatory>
<overrides>
<parameter>TextCategorizationAEDescriptor/apikey</parameter>
</overrides>
</configurationParameter>
<configurationParameter>
<name>entities_apikey</name>
<type>String</type>
<multiValued>false</multiValued>
<mandatory>true</mandatory>
<overrides>
<parameter>TextRankedEntityExtractionAEDescriptor/apikey</parameter>
<parameter>AggregateSentenceAE/ngramsize</parameter>
</overrides>
</configurationParameter>
</configurationParameters>
<configurationParameterSettings>
<nameValuePair>
<name>oc_licenseID</name>
<value>
<string>licenseid</string>
</value>
</nameValuePair>
<nameValuePair>
<name>keyword_apikey</name>
<value>
<string>apikey</string>
</value>
</nameValuePair>
<nameValuePair>
<name>concept_apikey</name>
<value>
<string>apikey</string>
</value>
</nameValuePair>
<nameValuePair>
<name>lang_apikey</name>
<value>
<string>apikey</string>
</value>
</nameValuePair>
<nameValuePair>
<name>cat_apikey</name>
<value>
<string>apikey</string>
</value>
</nameValuePair>
</configurationParameterSettings>
<configurationParameterSettings/>
<flowConstraints>
<fixedFlow>
<node>AggregateSentenceAE</node>
<node>OpenCalaisAnnotator</node>
<node>TextCategorizationAEDescriptor</node>
<node>DummyEntityAEDescriptor</node>
<node>DummySentimentAnalysisAEDescriptor</node>
</fixedFlow>
</flowConstraints>
<fsIndexCollection/>

View File

@ -1,102 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
<analysisEngineDescription xmlns="http://uima.apache.org/resourceSpecifier">
<frameworkImplementation>org.apache.uima.java</frameworkImplementation>
<primitive>true</primitive>
<annotatorImplementationName>org.apache.uima.alchemy.annotator.TextCategorizationAnnotator</annotatorImplementationName>
<analysisEngineMetaData>
<name>TextCategorizationAEDescriptor</name>
<description/>
<version>1.0</version>
<vendor/>
<configurationParameters>
<configurationParameter>
<name>apikey</name>
<type>String</type>
<multiValued>false</multiValued>
<mandatory>true</mandatory>
</configurationParameter>
<configurationParameter>
<name>outputMode</name>
<type>String</type>
<multiValued>false</multiValued>
<mandatory>true</mandatory>
</configurationParameter>
<configurationParameter>
<name>baseUrl</name>
<type>String</type>
<multiValued>false</multiValued>
<mandatory>false</mandatory>
</configurationParameter>
</configurationParameters>
<configurationParameterSettings>
<nameValuePair>
<name>outputMode</name>
<value>
<string>xml</string>
</value>
</nameValuePair>
<nameValuePair>
<name>apikey</name>
<value>
<string>AA_API_KEY</string>
</value>
</nameValuePair>
</configurationParameterSettings>
<typeSystemDescription>
<types>
<typeDescription>
<name>org.apache.uima.alchemy.ts.categorization.Category</name>
<description/>
<supertypeName>uima.cas.TOP</supertypeName>
<features>
<featureDescription>
<name>score</name>
<description/>
<rangeTypeName>uima.cas.String</rangeTypeName>
</featureDescription>
<featureDescription>
<name>text</name>
<description/>
<rangeTypeName>uima.cas.String</rangeTypeName>
</featureDescription>
</features>
</typeDescription>
</types>
</typeSystemDescription>
<typePriorities/>
<fsIndexCollection/>
<capabilities>
<capability>
<inputs/>
<outputs/>
<languagesSupported/>
</capability>
</capabilities>
<operationalProperties>
<modifiesCas>true</modifiesCas>
<multipleDeploymentAllowed>true</multipleDeploymentAllowed>
<outputsNewCASes>false</outputsNewCASes>
</operationalProperties>
</analysisEngineMetaData>
<resourceManagerConfiguration/>
</analysisEngineDescription>

View File

@ -562,11 +562,9 @@
-->
<field name="language" type="string" indexed="true" stored="true" required="false"/>
<field name="concept" type="string" indexed="true" stored="true" multiValued="true" required="false"/>
<field name="keyword" type="string" indexed="true" stored="true" multiValued="true" required="false"/>
<field name="suggested_category" type="string" indexed="true" stored="true" multiValued="false" required="false"/>
<field name="sentence" type="text" indexed="true" stored="true" multiValued="true" required="false" />
<dynamicField name="entity*" type="text" indexed="true" stored="true" multiValued="true"/>
<field name="sentiment" type="string" indexed="true" stored="true" multiValued="true"/>
<field name="entity" type="text" indexed="true" stored="true" multiValued="true"/>
<!--
Dynamic field definitions. If a field name is not found,

View File

@ -1064,38 +1064,21 @@
<uimaConfig>
<runtimeParameters>
<keyword_apikey>04490000a72fe7ec5cb3497f14e77f338c86f2fe</keyword_apikey>
<concept_apikey>04490000a72fe7ec5cb3497f14e77f338c86f2fe</concept_apikey>
<lang_apikey>04490000a72fe7ec5cb3497f14e77f338c86f2fe</lang_apikey>
<cat_apikey>04490000a72fe7ec5cb3497f14e77f338c86f2fe</cat_apikey>
<entities_apikey>04490000a72fe7ec5cb3497f14e77f338c86f2fe</entities_apikey>
<oc_licenseID>g6h9zamsdtwhb93nc247ecrs</oc_licenseID>
<ngramsize>3</ngramsize>
</runtimeParameters>
<analysisEngine>/TestAE.xml</analysisEngine>
<analyzeFields merge="false">text</analyzeFields>
<fieldMapping>
<type name="org.apache.uima.alchemy.ts.categorization.Category">
<map feature="text" field="suggested_category"/>
</type>
<type name="org.apache.uima.alchemy.ts.concept.ConceptFS">
<map feature="text" field="concept"/>
</type>
<type name="org.apache.uima.alchemy.ts.entity.BaseEntity">
<map feature="text" field="entity"/>
</type>
<type name="org.apache.uima.calais.BaseType">
<map feature="coveredText" field="entity"/>
</type>
<type name="org.apache.uima.alchemy.ts.keywords.KeywordFS">
<map feature="text" field="keyword"/>
</type>
<type name="org.apache.uima.alchemy.ts.language.LanguageFS">
<map feature="language" field="language"/>
</type>
<type name="org.apache.uima.SentenceAnnotation">
<map feature="coveredText" field="sentence"/>
</type>
<type name="org.apache.solr.uima.ts.SentimentAnnotation">
<map feature="mood" field="sentiment"/>
</type>
<type name="org.apache.solr.uima.ts.EntityAnnotation">
<map feature="coveredText" field="entity"/>
</type>
</fieldMapping>
</uimaConfig>
</config>