Hi Ritwik,

I'm not able to find the link of Sean's response for this same question which 
we asked sometime back. So I'm attaching his response once again for you as 
follows:

> Iis there any doc or guide on how to start writing our own annotator?

There are two example annotators in the ctakes-examples project under the ae/ 
directory.  You can look at those, but I recommend that you look at some 
information on Uimafit, which can be used to create new annotators:
https://uima.apache.org/d/uimafit-2.1.0/tools.uimafit.book.pdf
An introduction to creating Analysis Engines (Annotators) is on page 5.

Coding style is individualistic, but below is a rubberstamp that I use to get 
started:

import org.apache.ctakes.core.pipeline.PipeBitInfo;
import org.apache.log4j.Logger;
import org.apache.uima.UimaContext;
import org.apache.uima.analysis_engine.AnalysisEngineProcessException;
import org.apache.uima.fit.component.JCasAnnotator_ImplBase;
import org.apache.uima.jcas.JCas;
import org.apache.uima.resource.ResourceInitializationException;

/**
 * @author SPF , chip-nlp
 * @version %I%
 * @since 9/22/2017
 */
@PipeBitInfo(
      name = "Template",
      description = "For Example.", role = PipeBitInfo.Role.ANNOTATOR
)
final public class Template extends JCasAnnotator_ImplBase {

   static private final Logger LOGGER = Logger.getLogger( "Template" );

   /**
    * {@inheritDoc}
    */
   @Override
   public void initialize( final UimaContext context ) throws 
ResourceInitializationException {
      // Always call the super first
      super.initialize( context );
      // place AE initialization code here
   }

   /**
    * {@inheritDoc}
    */
   @Override
   public void process( final JCas jCas ) throws AnalysisEngineProcessException 
{
      LOGGER.info( "Processing ..." );
      // Place AE processing code here
      LOGGER.info( "Finished." );
   }
}



If you use IntelliJ as your ide you can create a file template with these 
parameters:

#if (${PACKAGE_NAME} && ${PACKAGE_NAME} != "")package ${PACKAGE_NAME};#end

import org.apache.ctakes.core.pipeline.PipeBitInfo;
import org.apache.log4j.Logger;
import org.apache.uima.UimaContext;
import org.apache.uima.analysis_engine.AnalysisEngineProcessException;
import org.apache.uima.fit.component.JCasAnnotator_ImplBase;
import org.apache.uima.jcas.JCas;
import org.apache.uima.resource.ResourceInitializationException;

#parse("File Header.java")
@PipeBitInfo(
      name = "${NAME}",
      #if ( ${PROJECT_NAME} != "")description = "For ${PROJECT_NAME}.",#end
      role = PipeBitInfo.Role.ANNOTATOR
)
final public class ${NAME} extends JCasAnnotator_ImplBase {

   static private final Logger LOGGER = Logger.getLogger( "${NAME}" );

   /**
    * {@inheritDoc}
    */
   @Override
   public void initialize( final UimaContext context ) throws 
ResourceInitializationException {
      // Always call the super first
      super.initialize( context );
      // place AE initialization code here
   }

   /**
    * {@inheritDoc}
    */
   @Override
   public void process( final JCas jCas ) throws AnalysisEngineProcessException 
{
      LOGGER.info( "Processing ..." );
      // Place AE processing code here
      LOGGER.info( "Finished." );
   }
}

Thanks again Sean.

Regards,
Gandhi

-----Original Message-----
From: Ritwik Jain [mailto:[email protected]]
Sent: Monday, November 27, 2017 3:57 PM
To: [email protected]
Subject: Having trouble creating the first annotator.

HI,

I am new to C-takes development and i have taken the project in order to 
develop the first annotator using Ctakes. Can someone guide me by sharing the 
examples of the code for building the annotator.

Regards
Ritwik

--
Ritwik Jain
This email and any files transmitted with it are confidential and intended 
solely for the use of the individual or entity to whom they are addressed. If 
you are not the named addressee you should not disseminate, distribute or copy 
this e-mail. Please notify the sender or system manager by email immediately if 
you have received this e-mail by mistake and delete this e-mail from your 
system. If you are not the intended recipient you are notified that disclosing, 
copying, distributing or taking any action in reliance on the contents of this 
information is strictly prohibited and against the law.

Reply via email to