本文整理汇总了Java中gate.creole.SerialAnalyserController类的典型用法代码示例。如果您正苦于以下问题:Java SerialAnalyserController类的具体用法?Java SerialAnalyserController怎么用?Java SerialAnalyserController使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SerialAnalyserController类属于gate.creole包,在下文中一共展示了SerialAnalyserController类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: extractDataFromSource
import gate.creole.SerialAnalyserController; //导入依赖的package包/类
/**
* Populates this Persistence with the data that needs to be stored from the
* original source object.
*/
@Override
public void extractDataFromSource(Object source)throws PersistenceException{
if(! (source instanceof SerialAnalyserController)){
throw new UnsupportedOperationException(
getClass().getName() + " can only be used for " +
SerialAnalyserController.class.getName() +
" objects!\n" + source.getClass().getName() +
" is not a " + SerialAnalyserController.class.getName());
}
super.extractDataFromSource(source);
SerialAnalyserController sac = (SerialAnalyserController)source;
corpus = PersistenceManager.getPersistentRepresentation(sac.getCorpus());
}
示例2: actionPerformed
import gate.creole.SerialAnalyserController; //导入依赖的package包/类
@Override
public void actionPerformed(ActionEvent e) {
SerialAnalyserController existingController =
(SerialAnalyserController)target;
try {
ConditionalSerialAnalyserController newController =
(ConditionalSerialAnalyserController)Factory
.createResource("gate.creole.ConditionalSerialAnalyserController");
newController.getFeatures().putAll(existingController.getFeatures());
newController.setName(existingController.getName());
Iterator<?> it = existingController.getPRs().iterator();
while(it.hasNext()) {
newController.add((ProcessingResource)it.next());
}
List<ProcessingResource> empty = Collections.emptyList();
existingController.setPRs(empty);
Factory.deleteResource(existingController);
} catch(Exception ex) {
JOptionPane.showMessageDialog(getLargeView(),
"Error!\n" + ex.toString(), "GATE", JOptionPane.ERROR_MESSAGE);
ex.printStackTrace(Err.getPrintWriter());
}
}
示例3: setTarget
import gate.creole.SerialAnalyserController; //导入依赖的package包/类
@Override
public void setTarget(Object target){
if(!(target instanceof SerialController))
throw new IllegalArgumentException(
"gate.gui.ApplicationViewer can only be used for serial controllers\n" +
target.getClass().toString() +
" is not a gate.creole.SerialController!");
if(controller != null) controller.removeControllerListener(this);
this.controller = (SerialController)target;
controller.addControllerListener(this);
corpusControllerMode = controller instanceof CorpusController;
analyserMode = controller instanceof SerialAnalyserController ||
controller instanceof ConditionalSerialAnalyserController;
conditionalMode = controller instanceof ConditionalController;
initLocalData();
initGuiComponents();
initListeners();
loadedPRsTableModel.fireTableDataChanged();
memberPRsTableModel.fireTableDataChanged();
}
示例4: controllerExecutionFinished
import gate.creole.SerialAnalyserController; //导入依赖的package包/类
@Override
public void controllerExecutionFinished(Controller c)
throws ExecutionException {
if(controller instanceof ControllerAwarePR) {
if(controller instanceof ConditionalSerialAnalyserController) {
((ConditionalSerialAnalyserController)controller).setCorpus(corpus);
} else if(controller instanceof SerialAnalyserController) {
((SerialAnalyserController)controller).setCorpus(corpus);
}
((ControllerAwarePR)controller).controllerExecutionFinished(c);
if(controller instanceof ConditionalSerialAnalyserController) {
((ConditionalSerialAnalyserController)controller).setCorpus(null);
} else if(controller instanceof SerialAnalyserController) {
((SerialAnalyserController)controller).setCorpus(null);
}
}
}
示例5: controllerExecutionAborted
import gate.creole.SerialAnalyserController; //导入依赖的package包/类
@Override
public void controllerExecutionAborted(Controller c, Throwable t)
throws ExecutionException {
if(controller instanceof ControllerAwarePR) {
if(controller instanceof ConditionalSerialAnalyserController) {
((ConditionalSerialAnalyserController)controller).setCorpus(corpus);
} else if(controller instanceof SerialAnalyserController) {
((SerialAnalyserController)controller).setCorpus(corpus);
}
((ControllerAwarePR)controller).controllerExecutionAborted(c, t);
if(controller instanceof ConditionalSerialAnalyserController) {
((ConditionalSerialAnalyserController)controller).setCorpus(null);
} else if(controller instanceof SerialAnalyserController) {
((SerialAnalyserController)controller).setCorpus(null);
}
}
}
示例6: init
import gate.creole.SerialAnalyserController; //导入依赖的package包/类
/** Initialise this resource, and return it. */
public Resource init() throws ResourceInstantiationException {
f.setMaximumFractionDigits(2); // format used for all decimal values
f.setMinimumFractionDigits(2);
// using QualityAssurancePR internally to calculate QA stats
// but hiding this PR just in case
FeatureMap hideParams = Factory.newFeatureMap();
Gate.setHiddenAttribute(hideParams, true);
assurancePR = (QualityAssurancePR)Factory.createResource(
"gate.qa.QualityAssurancePR", Factory.newFeatureMap(), hideParams);
// we use controller to execute assurance PR
controller = (SerialAnalyserController)Factory.createResource(
SerialAnalyserController.class.getName(), Factory.newFeatureMap(),
hideParams);
controller.add(assurancePR);
return this;
}
示例7: createObject
import gate.creole.SerialAnalyserController; //导入依赖的package包/类
/**
* Creates a new object from the data contained. This new object is supposed
* to be a copy for the original object used as source for data extraction.
*/
@Override
public Object createObject()throws PersistenceException,
ResourceInstantiationException{
SerialAnalyserController sac = (SerialAnalyserController)
super.createObject();
sac.setCorpus((Corpus)PersistenceManager.getTransientRepresentation(
corpus,resourceName,initParamOverrides));
return sac;
}
示例8: assambleEntityExtractionPipelineEN
import gate.creole.SerialAnalyserController; //导入依赖的package包/类
private void assambleEntityExtractionPipelineEN() {
try {
URL url = THDController.getInstance().getClass().getResource(Settings.EN_ENTITY_EXTRACTION_GRAMMAR);
File japeOrigFile = new File(url.getFile());
java.net.URI japeURI = japeOrigFile.toURI();
FeatureMap transducerFeatureMap = Factory.newFeatureMap();
try {
transducerFeatureMap.put("grammarURL", japeURI.toURL());
transducerFeatureMap.put("encoding", "UTF-8");
} catch (MalformedURLException e) {
}
FeatureMap tokenizerFeatureMap = Factory.newFeatureMap();
ProcessingResource tokenizerPR = (ProcessingResource) Factory.createResource("gate.creole.tokeniser.DefaultTokeniser", tokenizerFeatureMap);
FeatureMap sentenceSplitterFeatureMap = Factory.newFeatureMap();
ProcessingResource sentenceSplitterPR = (ProcessingResource) Factory.createResource("gate.creole.splitter.SentenceSplitter", sentenceSplitterFeatureMap);
FeatureMap posTaggerFeatureMap = Factory.newFeatureMap();
ProcessingResource posTaggerPR = (ProcessingResource) Factory.createResource("gate.creole.POSTagger", posTaggerFeatureMap);
ProcessingResource japeCandidatesPR = (ProcessingResource) Factory.createResource("gate.creole.Transducer", transducerFeatureMap);
enEntityExtractionPipeline = (SerialAnalyserController) Factory.createResource("gate.creole.SerialAnalyserController");
enEntityExtractionPipeline.add(tokenizerPR);
enEntityExtractionPipeline.add(sentenceSplitterPR);
enEntityExtractionPipeline.add(posTaggerPR);
enEntityExtractionPipeline.add(japeCandidatesPR);
} catch (ResourceInstantiationException ex) {;
Logger.getLogger(THDInstance.class.getName()).log(Level.SEVERE, null, ex);
}
}
示例9: assambleEntityExtractionPipelineEN
import gate.creole.SerialAnalyserController; //导入依赖的package包/类
private static void assambleEntityExtractionPipelineEN(){
try {
URL url = thdInstance.getClass().getResource(enEntityExtractionGrammar);
File japeOrigFile = new File(url.getFile());
java.net.URI japeURI = japeOrigFile.toURI();
FeatureMap transducerFeatureMap = Factory.newFeatureMap();
try {
transducerFeatureMap.put("grammarURL", japeURI.toURL());
transducerFeatureMap.put("encoding", "UTF-8");
} catch (MalformedURLException e) {
}
FeatureMap tokenizerFeatureMap = Factory.newFeatureMap();
ProcessingResource tokenizerPR = (ProcessingResource) Factory.createResource("gate.creole.tokeniser.DefaultTokeniser", tokenizerFeatureMap);
FeatureMap sentenceSplitterFeatureMap = Factory.newFeatureMap();
ProcessingResource sentenceSplitterPR = (ProcessingResource) Factory.createResource("gate.creole.splitter.SentenceSplitter", sentenceSplitterFeatureMap);
FeatureMap posTaggerFeatureMap = Factory.newFeatureMap();
ProcessingResource posTaggerPR = (ProcessingResource) Factory.createResource("gate.creole.POSTagger", posTaggerFeatureMap);
ProcessingResource japeCandidatesPR = (ProcessingResource) Factory.createResource("gate.creole.Transducer", transducerFeatureMap);
enEntityExtractionPipeline = (SerialAnalyserController) Factory.createResource("gate.creole.SerialAnalyserController");
enEntityExtractionPipeline.add(tokenizerPR);
enEntityExtractionPipeline.add(sentenceSplitterPR);
enEntityExtractionPipeline.add(posTaggerPR);
enEntityExtractionPipeline.add(japeCandidatesPR);
} catch (ResourceInstantiationException ex) {;
Logger.getLogger(THDInstance.class.getName()).log(Level.SEVERE, null, ex);
}
}
示例10: controllerExecutionStarted
import gate.creole.SerialAnalyserController; //导入依赖的package包/类
@Override
public void controllerExecutionStarted(Controller c)
throws ExecutionException {
if(controller instanceof ControllerAwarePR) {
if(controller instanceof ConditionalSerialAnalyserController) {
((ConditionalSerialAnalyserController)controller).setCorpus(corpus);
} else if(controller instanceof SerialAnalyserController) {
((SerialAnalyserController)controller).setCorpus(corpus);
}
((ControllerAwarePR)controller).controllerExecutionStarted(c);
}
}
示例11: buildStaticPopupItems
import gate.creole.SerialAnalyserController; //导入依赖的package包/类
protected void buildStaticPopupItems() {
// build the static part of the popup
staticPopupItems = new ArrayList<JComponent>();
if(target instanceof ProcessingResource && !(target instanceof Controller)) {
// actions for PRs (but not Controllers)
staticPopupItems.add(null);
staticPopupItems.add(new XJMenuItem(new ReloadAction(), sListenerProxy));
staticPopupItems.add(new XJMenuItem(new ApplicationWithPRAction(), sListenerProxy));
}
else if(target instanceof LanguageResource) {
// Language Resources
staticPopupItems.add(null);
if(target instanceof Document) {
staticPopupItems.add(new XJMenuItem(new CreateCorpusForDocAction(),
sListenerProxy));
}
if(target instanceof gate.TextualDocument) {
staticPopupItems.add(null);
staticPopupItems.add(new DocumentExportMenu(this));
}
else if(target instanceof Corpus) {
corpusFiller = new CorpusFillerComponent();
scfInputDialog = new SingleConcatenatedFileInputDialog();
staticPopupItems.add(new XJMenuItem(new PopulateCorpusAction(),
sListenerProxy));
staticPopupItems.add(new XJMenuItem(
new PopulateCorpusFromSingleConcatenatedFileAction(),
sListenerProxy));
staticPopupItems.add(null);
staticPopupItems.add(new DocumentExportMenu(this));
}
if(((LanguageResource)target).getDataStore() != null) {
// this item can be used only if the resource belongs to a
// datastore
staticPopupItems.add(new XJMenuItem(new SaveAction(), sListenerProxy));
}
if(!(target instanceof AnnotationSchema)) {
staticPopupItems
.add(new XJMenuItem(new SaveToAction(), sListenerProxy));
}
}
if(target instanceof Controller) {
// Applications
staticPopupItems.add(null);
if (target instanceof SerialAnalyserController) {
staticPopupItems.add(new XJMenuItem(new MakeConditionalAction(), sListenerProxy));
}
staticPopupItems.add(new XJMenuItem(new DumpToFileAction(),
sListenerProxy));
staticPopupItems.add(new XJMenuItem(new ExportApplicationAction(),
sListenerProxy));
}
}
示例12: getPipeline
import gate.creole.SerialAnalyserController; //导入依赖的package包/类
/**
* @return the pipeline
*/
public SerialAnalyserController getPipeline() {
return pipeline;
}
示例13: setPipeline
import gate.creole.SerialAnalyserController; //导入依赖的package包/类
/**
* @param pipeline the pipeline to set
*/
public void setPipeline(SerialAnalyserController pipeline) {
this.pipeline = pipeline;
}
示例14: assambleEntityExtractionPipelineDE
import gate.creole.SerialAnalyserController; //导入依赖的package包/类
private void assambleEntityExtractionPipelineDE(){
try {
FeatureMap resetFeatureMap = Factory.newFeatureMap();
ProcessingResource resetPR = (ProcessingResource) Factory.createResource("gate.creole.annotdelete.AnnotationDeletePR", resetFeatureMap);
FeatureMap tokenizerFeatureMap = Factory.newFeatureMap();
ProcessingResource tokenizerPR = (ProcessingResource) Factory.createResource("gate.creole.tokeniser.DefaultTokeniser", tokenizerFeatureMap);
FeatureMap taggerFeatureMap = Factory.newFeatureMap();
taggerFeatureMap.put("debug", "false");
taggerFeatureMap.put("encoding", "UTF-8");
taggerFeatureMap.put("failOnUnmappableCharacter", false);
taggerFeatureMap.put("featureMapping", "lemma=3;category=2;string=1");
taggerFeatureMap.put("inputAnnotationType", "Token");
taggerFeatureMap.put("inputTemplate", "${string}");
taggerFeatureMap.put("outputAnnotationType", "Token");
taggerFeatureMap.put("regex", "(.+) (.+) (.+)");
taggerFeatureMap.put("taggerBinary", Settings.DE_TAGGER_BINARY);
taggerFeatureMap.put("updateAnnotations", true);
ProcessingResource genTag = (ProcessingResource) Factory.createResource("gate.taggerframework.GenericTagger",taggerFeatureMap);
//JAPE Entity Extraction grammar
URL url = THDController.getInstance().getClass().getResource(Settings.DE_ENTITY_EXTRACTION_GRAMMAR);
File japeOrigFile = new File(url.getFile());
java.net.URI japeURI = japeOrigFile.toURI();
FeatureMap transducerFeatureMap = Factory.newFeatureMap();
try {
transducerFeatureMap.put("grammarURL", japeURI.toURL());
transducerFeatureMap.put("encoding", "UTF-8");
} catch (MalformedURLException e) {
}
ProcessingResource japeCandidatesPR = (ProcessingResource) Factory.createResource("gate.creole.Transducer", transducerFeatureMap);
deEntityExtractionPipeline = (SerialAnalyserController) Factory.createResource("gate.creole.RealtimeCorpusController");
deEntityExtractionPipeline.add(resetPR);
deEntityExtractionPipeline.add(tokenizerPR);
deEntityExtractionPipeline.add(genTag);
deEntityExtractionPipeline.add(japeCandidatesPR);
} catch (ResourceInstantiationException ex) {
Logger.getLogger(THDInstance.class.getName()).log(Level.SEVERE, null, ex);
}
}
示例15: assambleEntityExtractionPipelineNL
import gate.creole.SerialAnalyserController; //导入依赖的package包/类
private void assambleEntityExtractionPipelineNL(){
try {
FeatureMap resetFeatureMap = Factory.newFeatureMap();
ProcessingResource resetPR = (ProcessingResource) Factory.createResource("gate.creole.annotdelete.AnnotationDeletePR", resetFeatureMap);
FeatureMap tokenizerFeatureMap = Factory.newFeatureMap();
ProcessingResource tokenizerPR = (ProcessingResource) Factory.createResource("gate.creole.tokeniser.DefaultTokeniser", tokenizerFeatureMap);
FeatureMap taggerFeatureMap = Factory.newFeatureMap();
taggerFeatureMap.put("debug", "false");
taggerFeatureMap.put("encoding", "UTF-8");
taggerFeatureMap.put("failOnUnmappableCharacter", false);
// taggerFeatureMap.put("failOnMissingInputAnnotations", false);
taggerFeatureMap.put("featureMapping", "lemma=3;category=2;string=1");
taggerFeatureMap.put("inputAnnotationType", "Token");
taggerFeatureMap.put("inputTemplate", "${string}");
taggerFeatureMap.put("outputAnnotationType", "Token");
taggerFeatureMap.put("regex", "(.+) (.+) (.+)");
taggerFeatureMap.put("taggerBinary", Settings.NL_TAGGER_BINARY);
taggerFeatureMap.put("updateAnnotations", true);
ProcessingResource genTag = (ProcessingResource) Factory.createResource("gate.taggerframework.GenericTagger",taggerFeatureMap);
//JAPE Entity Extraction grammar
URL url = THDController.getInstance().getClass().getResource(Settings.NL_ENTITY_EXTRACTION_GRAMMAR);
File japeOrigFile = new File(url.getFile());
java.net.URI japeURI = japeOrigFile.toURI();
FeatureMap transducerFeatureMap = Factory.newFeatureMap();
try {
transducerFeatureMap.put("grammarURL", japeURI.toURL());
transducerFeatureMap.put("encoding", "UTF-8");
} catch (MalformedURLException e) {
}
ProcessingResource japeCandidatesPR = (ProcessingResource) Factory.createResource("gate.creole.Transducer", transducerFeatureMap);
nlEntityExtractionPipeline = (SerialAnalyserController) Factory.createResource("gate.creole.RealtimeCorpusController");
nlEntityExtractionPipeline.add(resetPR);
nlEntityExtractionPipeline.add(tokenizerPR);
nlEntityExtractionPipeline.add(genTag);
nlEntityExtractionPipeline.add(japeCandidatesPR);
} catch (ResourceInstantiationException ex) {
Logger.getLogger(THDInstance.class.getName()).log(Level.SEVERE, null, ex);
}
}