You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ctakes.apache.org by John Doe <lu...@gmail.com> on 2021/05/28 14:45:36 UTC

How to find IdentifiedAnnotationBuilder in build

Hello,

I'm just wondering where IdentifiedAnnotationBuilder is located in the
ctakes lib. I see it in the source code in ctakes-core but I can't find it
in any of the maven dependency packages. I also extracted the ctakes-core
jar in CTAKES_HOME/lib and still didn't find it. Is there a simple way to
use this builder? Ideally, I could just add a dependency to my pom and pull
it in but I can't seem to find any that have it. Why is it excluded from
ctakes-core?

Thanks.

Re: How to find IdentifiedAnnotationBuilder in build [EXTERNAL]

Posted by John Doe <lu...@gmail.com>.
Oh, awesome. Thanks. I didn't realize it was only in the snapshot version.

On Fri, May 28, 2021 at 12:40 PM Finan, Sean <
Sean.Finan@childrens.harvard.edu> wrote:

> Hi John,
>
> It shouldn't be excluded from ctakes-core, but if you are looking at the
> binary distributable or maven central artifact for ctakes 4.0.0.1 then it
> will definitely be absent as it didn't exist in that version.  It is only
> in the trunk version of ctakes currently under development.  You can use
> the trunk version in your maven project.
>
> In your pom:
> ...
>    <properties>
>       <ctakes.version>4.0.1-SNAPSHOT</ctakes.version>
> ...
>       <dependency>
>             <groupId>org.apache.ctakes</groupId>
>             <artifactId>ctakes-core</artifactId>
>             <version>${ctakes.version}</version>
> ...
>
> And you might need:
>    <repositories>
>       <repository>
>          <id>apache.snapshots</id>
>          <name>Apache Development Snapshot Repository</name>
>          <url>https://repository.apache.org/content/groups/snapshots/
> </url>
>          <releases>
>             <enabled>false</enabled>
>          </releases>
>          <snapshots>
>             <enabled>true</enabled>
>          </snapshots>
>       </repository>
>
>
>
>
> Use Example:
>
> /**
>  * Finds clinical procedures in text using regular expressions.
>  * Accepts parameters for the procedure's regular expression and the
> procedure's CUI.
>  */
> public class ApacheConDemoEngine extends JCasAnnotator_ImplBase {
>
>    @ConfigurationParameter(
>          name = "REGEX",
>          description = "Regular Rexpression to use for matching clinical
> procedures.",
>          defaultValue = "biopsy"
>    )
>    private String _regex;
>
>    @ConfigurationParameter(
>          name = "REGEX_CUI",
>          description = "CUI for matched clinical procedure expressions.",
>          defaultValue = "AC123"
>    )
>    private String _regexCui;
>
>    /**
>     * Finds Procedures using a regular expression and creates Identified
> Annotations.
>     */
>    @Override
>    public void process( JCas jCas ) throws AnalysisEngineProcessException {
>       IdentifiedAnnotationBuilder builder = new
> IdentifiedAnnotationBuilder()
>                .group( SemanticGroup.PROCEDURE )
>                .cui( _regexCui );
>       try ( RegexSpanFinder finder = new RegexSpanFinder( _regex ) ) {
>          finder.findSpans( jCas.getDocumentText() )
>                .forEach( span ->
>                      builder
>                            .span( span )
>                            .build( jCas ) );
>       } catch ( IllegalArgumentException iaE ) {
>          throw new AnalysisEngineProcessException( iaE );
>       }
>    }
>
> }
>
>
> Sean
>
>
> ________________________________________
> From: John Doe <lu...@gmail.com>
> Sent: Friday, May 28, 2021 10:45 AM
> To: dev@ctakes.apache.org
> Subject: How to find IdentifiedAnnotationBuilder in build [EXTERNAL]
>
> * External Email - Caution *
>
>
> Hello,
>
> I'm just wondering where IdentifiedAnnotationBuilder is located in the
> ctakes lib. I see it in the source code in ctakes-core but I can't find it
> in any of the maven dependency packages. I also extracted the ctakes-core
> jar in CTAKES_HOME/lib and still didn't find it. Is there a simple way to
> use this builder? Ideally, I could just add a dependency to my pom and pull
> it in but I can't seem to find any that have it. Why is it excluded from
> ctakes-core?
>
> Thanks.
>

Re: How to find IdentifiedAnnotationBuilder in build [EXTERNAL]

Posted by "Finan, Sean" <Se...@childrens.harvard.edu>.
Hi John,

It shouldn't be excluded from ctakes-core, but if you are looking at the binary distributable or maven central artifact for ctakes 4.0.0.1 then it will definitely be absent as it didn't exist in that version.  It is only in the trunk version of ctakes currently under development.  You can use the trunk version in your maven project.

In your pom:
...
   <properties>
      <ctakes.version>4.0.1-SNAPSHOT</ctakes.version>
...
      <dependency>
            <groupId>org.apache.ctakes</groupId>
            <artifactId>ctakes-core</artifactId>
            <version>${ctakes.version}</version>
...

And you might need:
   <repositories>
      <repository>
         <id>apache.snapshots</id>
         <name>Apache Development Snapshot Repository</name>
         <url>https://repository.apache.org/content/groups/snapshots/</url>
         <releases>
            <enabled>false</enabled>
         </releases>
         <snapshots>
            <enabled>true</enabled>
         </snapshots>
      </repository>




Use Example:

/**
 * Finds clinical procedures in text using regular expressions.
 * Accepts parameters for the procedure's regular expression and the procedure's CUI.
 */
public class ApacheConDemoEngine extends JCasAnnotator_ImplBase {

   @ConfigurationParameter(
         name = "REGEX",
         description = "Regular Rexpression to use for matching clinical procedures.",
         defaultValue = "biopsy"
   )
   private String _regex;

   @ConfigurationParameter(
         name = "REGEX_CUI",
         description = "CUI for matched clinical procedure expressions.",
         defaultValue = "AC123"
   )
   private String _regexCui;

   /**
    * Finds Procedures using a regular expression and creates Identified Annotations.
    */
   @Override
   public void process( JCas jCas ) throws AnalysisEngineProcessException {
      IdentifiedAnnotationBuilder builder = new IdentifiedAnnotationBuilder()
               .group( SemanticGroup.PROCEDURE )
               .cui( _regexCui );
      try ( RegexSpanFinder finder = new RegexSpanFinder( _regex ) ) {
         finder.findSpans( jCas.getDocumentText() )
               .forEach( span ->
                     builder
                           .span( span )
                           .build( jCas ) );
      } catch ( IllegalArgumentException iaE ) {
         throw new AnalysisEngineProcessException( iaE );
      }
   }

}


Sean

 
________________________________________
From: John Doe <lu...@gmail.com>
Sent: Friday, May 28, 2021 10:45 AM
To: dev@ctakes.apache.org
Subject: How to find IdentifiedAnnotationBuilder in build [EXTERNAL]

* External Email - Caution *


Hello,

I'm just wondering where IdentifiedAnnotationBuilder is located in the
ctakes lib. I see it in the source code in ctakes-core but I can't find it
in any of the maven dependency packages. I also extracted the ctakes-core
jar in CTAKES_HOME/lib and still didn't find it. Is there a simple way to
use this builder? Ideally, I could just add a dependency to my pom and pull
it in but I can't seem to find any that have it. Why is it excluded from
ctakes-core?

Thanks.