ctakes-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From seanfi...@apache.org
Subject svn commit: r1877084 - in /ctakes/trunk/ctakes-core/src/main/java/org/apache/ctakes/core/util: DocumentIDAnnotationUtil.java DotLogger.java FinishedLogger.java OntologyConceptUtil.java SourceMetadataUtil.java WordTokenUtil.java
Date Mon, 27 Apr 2020 15:05:41 GMT
Author: seanfinan
Date: Mon Apr 27 15:05:41 2020
New Revision: 1877084

URL: http://svn.apache.org/viewvc?rev=1877084&view=rev
Log:
My IDE didn't add the deprecated copies of the classes that I moved Friday.  I didn't notice
that they weren't checked in.
Apologies if anybody with dependency got a broken build.  - though it should have made you
aware of the refactor!

Added:
    ctakes/trunk/ctakes-core/src/main/java/org/apache/ctakes/core/util/DocumentIDAnnotationUtil.java
    ctakes/trunk/ctakes-core/src/main/java/org/apache/ctakes/core/util/DotLogger.java
    ctakes/trunk/ctakes-core/src/main/java/org/apache/ctakes/core/util/FinishedLogger.java
    ctakes/trunk/ctakes-core/src/main/java/org/apache/ctakes/core/util/OntologyConceptUtil.java
    ctakes/trunk/ctakes-core/src/main/java/org/apache/ctakes/core/util/SourceMetadataUtil.java
    ctakes/trunk/ctakes-core/src/main/java/org/apache/ctakes/core/util/WordTokenUtil.java

Added: ctakes/trunk/ctakes-core/src/main/java/org/apache/ctakes/core/util/DocumentIDAnnotationUtil.java
URL: http://svn.apache.org/viewvc/ctakes/trunk/ctakes-core/src/main/java/org/apache/ctakes/core/util/DocumentIDAnnotationUtil.java?rev=1877084&view=auto
==============================================================================
--- ctakes/trunk/ctakes-core/src/main/java/org/apache/ctakes/core/util/DocumentIDAnnotationUtil.java
(added)
+++ ctakes/trunk/ctakes-core/src/main/java/org/apache/ctakes/core/util/DocumentIDAnnotationUtil.java
Mon Apr 27 15:05:41 2020
@@ -0,0 +1,89 @@
+/**
+ * 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
+ * <p>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p>
+ * 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.
+ */
+package org.apache.ctakes.core.util;
+
+import org.apache.ctakes.core.util.doc.DocIdUtil;
+import org.apache.uima.jcas.JCas;
+
+/**
+ * Utility class for fetching document id
+ * @deprecated use DocIdUtil in (sub) package doc
+ */
+@Deprecated
+final public class DocumentIDAnnotationUtil {
+
+   // Added for CTAKES-365
+   static public final String NO_DOCUMENT_ID = DocIdUtil.NO_DOCUMENT_ID;
+   static public final String NO_DOCUMENT_ID_PREFIX = DocIdUtil.NO_DOCUMENT_ID_PREFIX;
+
+   private DocumentIDAnnotationUtil() {
+   }
+
+   /**
+    * Check the jcas for a document id.  Unlike {@link #getDeepDocumentId(JCas)},
+    * this method does not progress into deeper jcas layers/views.
+    *
+    * @param jcas ye olde ...
+    * @return the document id contained in the type "DocumentID" or {@link #NO_DOCUMENT_ID}
+    */
+   @Deprecated
+   public static String getDocumentID( final JCas jcas ) {
+      return DocIdUtil.getDocumentID( jcas );
+   }
+
+
+   /**
+    * Gets the document Id by progressing through 3 layers until an Id is found: starting
JCas, Initial View, Plaintext View
+    *
+    * @param startingJcas initial JCas to start the checking
+    * @return Document Id from the starting JCas, the Initial View, the Plaintext View, or
{@link #NO_DOCUMENT_ID}
+    */
+   @Deprecated
+   static public String getDeepDocumentId( final JCas startingJcas ) {
+      return DocIdUtil.getDeepDocumentId( startingJcas );
+   }
+
+   /**
+    * Create a unique id for the document that can be used for an output filename or url.
+    * Will be the source document file name if possible,
+    * otherwise the first 10 characters of the text plus text hashcode,
+    * or "Unknown_" and the current millis if there is no text.
+    * Non-alphanumeric characters are replaced with '_'.
+    *
+    * @param jcas -
+    * @return an ok document id
+    */
+   @Deprecated
+   static public String getDocumentIdForFile( final JCas jcas ) {
+      return DocIdUtil.getDocumentIdForFile( jcas );
+   }
+
+   /**
+    * Check the jcas for a document id prefix.  Unlike {@link #getDeepDocumentId(JCas)},
+    * this method does not progress into deeper jcas layers/views.
+    *
+    * @param jcas ye olde ...
+    * @return the document id prefix contained in the type "DocumentIdPrefix" or {@link #NO_DOCUMENT_ID}
+    */
+   @Deprecated
+   public static String getDocumentIdPrefix( final JCas jcas ) {
+      return DocIdUtil.getDocumentIdPrefix( jcas );
+   }
+
+}

Added: ctakes/trunk/ctakes-core/src/main/java/org/apache/ctakes/core/util/DotLogger.java
URL: http://svn.apache.org/viewvc/ctakes/trunk/ctakes-core/src/main/java/org/apache/ctakes/core/util/DotLogger.java?rev=1877084&view=auto
==============================================================================
--- ctakes/trunk/ctakes-core/src/main/java/org/apache/ctakes/core/util/DotLogger.java (added)
+++ ctakes/trunk/ctakes-core/src/main/java/org/apache/ctakes/core/util/DotLogger.java Mon
Apr 27 15:05:41 2020
@@ -0,0 +1,36 @@
+package org.apache.ctakes.core.util;
+
+import java.io.Closeable;
+import java.io.IOException;
+
+/**
+ * Dot Logger Usable in try as resource blocks.  Logs a dot every 0.5 seconds until a process
completes.
+ *
+ * @author SPF , chip-nlp
+ * @version %I%
+ * @since 3/18/2016
+ * @deprecated use DotLogger in (sub) package log
+ */
+@Deprecated
+final public class DotLogger implements Closeable {
+
+   final private org.apache.ctakes.core.util.log.DotLogger _delegate;
+
+   /**
+    * Starts the Dot Logging
+    */
+   @Deprecated
+   public DotLogger() {
+      _delegate = new org.apache.ctakes.core.util.log.DotLogger();
+   }
+
+   /**
+    * {@inheritDoc}
+    */
+   @Override
+   @Deprecated
+   public void close() throws IOException {
+      _delegate.close();
+   }
+
+}

Added: ctakes/trunk/ctakes-core/src/main/java/org/apache/ctakes/core/util/FinishedLogger.java
URL: http://svn.apache.org/viewvc/ctakes/trunk/ctakes-core/src/main/java/org/apache/ctakes/core/util/FinishedLogger.java?rev=1877084&view=auto
==============================================================================
--- ctakes/trunk/ctakes-core/src/main/java/org/apache/ctakes/core/util/FinishedLogger.java
(added)
+++ ctakes/trunk/ctakes-core/src/main/java/org/apache/ctakes/core/util/FinishedLogger.java
Mon Apr 27 15:05:41 2020
@@ -0,0 +1,40 @@
+package org.apache.ctakes.core.util;
+
+import org.apache.ctakes.core.pipeline.PipeBitInfo;
+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 5/21/2018
+ * @deprecated use FinishedLogger in (sub) package log
+ */
+@PipeBitInfo(
+      name = "Deprecated Finished Logger",
+      description = "use FinishedLogger in (sub) package log.",
+      role = PipeBitInfo.Role.SPECIAL
+)
+final public class FinishedLogger extends JCasAnnotator_ImplBase {
+
+
+   /**
+    * {@inheritDoc}
+    */
+   @Override
+   public void initialize( final UimaContext context ) throws ResourceInitializationException
{
+      throw new ResourceInitializationException( new Exception( "Deprecated use FinishedLogger
in (sub) package log." ) );
+   }
+
+   /**
+    * {@inheritDoc}
+    */
+   @Override
+   public void process( final JCas jCas ) throws AnalysisEngineProcessException {
+      throw new AnalysisEngineProcessException( new Exception( "Deprecated use FinishedLogger
in (sub) package log." ) );
+   }
+
+}

Added: ctakes/trunk/ctakes-core/src/main/java/org/apache/ctakes/core/util/OntologyConceptUtil.java
URL: http://svn.apache.org/viewvc/ctakes/trunk/ctakes-core/src/main/java/org/apache/ctakes/core/util/OntologyConceptUtil.java?rev=1877084&view=auto
==============================================================================
--- ctakes/trunk/ctakes-core/src/main/java/org/apache/ctakes/core/util/OntologyConceptUtil.java
(added)
+++ ctakes/trunk/ctakes-core/src/main/java/org/apache/ctakes/core/util/OntologyConceptUtil.java
Mon Apr 27 15:05:41 2020
@@ -0,0 +1,431 @@
+package org.apache.ctakes.core.util;
+
+import org.apache.ctakes.typesystem.type.refsem.OntologyConcept;
+import org.apache.ctakes.typesystem.type.refsem.UmlsConcept;
+import org.apache.ctakes.typesystem.type.textsem.IdentifiedAnnotation;
+import org.apache.uima.cas.FeatureStructure;
+import org.apache.uima.fit.util.JCasUtil;
+import org.apache.uima.jcas.JCas;
+import org.apache.uima.jcas.tcas.Annotation;
+
+import java.util.Collection;
+import java.util.Map;
+import java.util.stream.Collectors;
+import java.util.stream.Stream;
+
+/**
+ * @author SPF , chip-nlp
+ * @version %I%
+ * @since 1/8/2015
+ * @deprecated use OntologyConceptUtil in (sub) package annotation
+ */
+@Deprecated
+final public class OntologyConceptUtil {
+
+   private OntologyConceptUtil() {
+   }
+
+   /**
+    * @param annotation -
+    * @return array of FeatureStructure castable to array of OntologyConcept
+    */
+   @Deprecated
+   static public FeatureStructure[] getConceptFeatureStructures( final IdentifiedAnnotation
annotation ) {
+      return org.apache.ctakes.core.util.annotation.OntologyConceptUtil.getConceptFeatureStructures(
annotation );
+   }
+
+   /**
+    * @param annotation -
+    * @return stream of OntologyConcept
+    */
+   @Deprecated
+   static public Stream<OntologyConcept> getOntologyConceptStream( final IdentifiedAnnotation
annotation ) {
+      return org.apache.ctakes.core.util.annotation.OntologyConceptUtil.getOntologyConceptStream(
annotation );
+   }
+
+   /**
+    * @param annotation -
+    * @return stream of OntologyConcept
+    */
+   @Deprecated
+   static public Collection<OntologyConcept> getOntologyConcepts( final IdentifiedAnnotation
annotation ) {
+      return getOntologyConceptStream( annotation ).collect( Collectors.toSet() );
+   }
+
+   /**
+    * @param annotation -
+    * @return stream of all Umls Concepts associated with the annotation
+    */
+   @Deprecated
+   static public Stream<UmlsConcept> getUmlsConceptStream( final IdentifiedAnnotation
annotation ) {
+      return org.apache.ctakes.core.util.annotation.OntologyConceptUtil.getUmlsConceptStream(
annotation );
+   }
+
+   /**
+    * @param annotation -
+    * @return set of all Umls Concepts associated with the annotation
+    */
+   @Deprecated
+   static public Collection<UmlsConcept> getUmlsConcepts( final IdentifiedAnnotation
annotation ) {
+      return getUmlsConceptStream( annotation ).collect( Collectors.toSet() );
+   }
+
+
+   //
+   //   Get cuis, tuis, or codes for a single IdentifiedAnnotation
+   //
+
+   /**
+    * @param annotation -
+    * @return set of all Umls cuis associated with the annotation
+    */
+   @Deprecated
+   static public Collection<String> getCuis( final IdentifiedAnnotation annotation
) {
+      return org.apache.ctakes.core.util.annotation.OntologyConceptUtil.getCuis( annotation
);
+   }
+
+   /**
+    * @param annotation -
+    * @return set of all Umls tuis associated with the annotation
+    */
+   @Deprecated
+   static public Collection<String> getTuis( final IdentifiedAnnotation annotation
) {
+      return org.apache.ctakes.core.util.annotation.OntologyConceptUtil.getTuis( annotation
);
+   }
+
+   /**
+    * @param annotation -
+    * @return map of ontology scheme names to a set of ontology codes associated each scheme
+    */
+   @Deprecated
+   static public Map<String, Collection<String>> getSchemeCodes( final IdentifiedAnnotation
annotation ) {
+      return org.apache.ctakes.core.util.annotation.OntologyConceptUtil.getSchemeCodes( annotation
);
+   }
+
+   /**
+    * @param annotation -
+    * @return set of ontology codes associated with all schemes
+    */
+   @Deprecated
+   static public Collection<String> getCodes( final IdentifiedAnnotation annotation
) {
+      return org.apache.ctakes.core.util.annotation.OntologyConceptUtil.getCodes( annotation
);
+   }
+
+   /**
+    * @param annotation -
+    * @param schemeName name of the scheme of interest
+    * @return set of ontology codes associated the named scheme
+    */
+   @Deprecated
+   static public Collection<String> getCodes( final IdentifiedAnnotation annotation,
+                                              final String schemeName ) {
+      return org.apache.ctakes.core.util.annotation.OntologyConceptUtil.getCodes( annotation,
schemeName );
+   }
+
+
+   //
+   //   Get cuis, tuis, or codes for all IdentifiedAnnotations in a jcas
+   //
+
+   /**
+    * @param jcas -
+    * @return set of all cuis in jcas
+    */
+   @Deprecated
+   static public Collection<String> getCuis( final JCas jcas ) {
+      return getCuis( JCasUtil.select( jcas, IdentifiedAnnotation.class ) );
+   }
+
+   /**
+    * @param jcas -
+    * @return map of all cuis in the jcas and their counts
+    */
+   @Deprecated
+   static public Map<String, Long> getCuiCounts( final JCas jcas ) {
+      return getCuiCounts( JCasUtil.select( jcas, IdentifiedAnnotation.class ) );
+   }
+
+   /**
+    * @param jcas -
+    * @return set of all tuis in jcas
+    */
+   @Deprecated
+   static public Collection<String> getTuis( final JCas jcas ) {
+      return getTuis( JCasUtil.select( jcas, IdentifiedAnnotation.class ) );
+   }
+
+   /**
+    * @param jcas -
+    * @return set of all ontology codes in jcas
+    */
+   @Deprecated
+   static public Map<String, Collection<String>> getSchemeCodes( final JCas jcas
) {
+      return getSchemeCodes( JCasUtil.select( jcas, IdentifiedAnnotation.class ) );
+   }
+
+   /**
+    * @param jcas -
+    * @return set of all ontology codes in jcas
+    */
+   @Deprecated
+   static public Collection<String> getCodes( final JCas jcas ) {
+      return getCodes( JCasUtil.select( jcas, IdentifiedAnnotation.class ) );
+   }
+
+   /**
+    * @param jcas       -
+    * @param schemeName name of the scheme of interest
+    * @return set of ontology codes associated the named scheme
+    */
+   @Deprecated
+   static public Collection<String> getCodes( final JCas jcas,
+                                              final String schemeName ) {
+      return getCodes( JCasUtil.select( jcas, IdentifiedAnnotation.class ), schemeName );
+   }
+
+
+   //
+   //   Get cuis, tuis, or codes for all IdentifiedAnnotations in a lookup window
+   //
+
+   /**
+    * @param jcas         -
+    * @param lookupWindow -
+    * @return set of all cuis in lookupWindow
+    */
+   @Deprecated
+   static public <T extends Annotation> Collection<String> getCuis( final JCas
jcas, final T lookupWindow ) {
+      return getCuis( JCasUtil.selectCovered( jcas, IdentifiedAnnotation.class, lookupWindow
) );
+   }
+
+   /**
+    * @param jcas         -
+    * @param lookupWindow -
+    * @return set of all tuis in lookupWindow
+    */
+   @Deprecated
+   static public <T extends Annotation> Collection<String> getTuis( final JCas
jcas, final T lookupWindow ) {
+      return getTuis( JCasUtil.selectCovered( jcas, IdentifiedAnnotation.class, lookupWindow
) );
+   }
+
+   /**
+    * @param jcas         -
+    * @param lookupWindow -
+    * @return map of all schemes and their codes in lookupWindow
+    */
+   @Deprecated
+   static public <T extends Annotation> Map<String, Collection<String>>
getSchemeCodes( final JCas jcas,
+                                                                                        final
T lookupWindow ) {
+      return getSchemeCodes( JCasUtil.selectCovered( jcas, IdentifiedAnnotation.class, lookupWindow
) );
+   }
+
+   /**
+    * @param jcas         -
+    * @param lookupWindow -
+    * @return set of all codes in lookupWindow
+    */
+   @Deprecated
+   static public <T extends Annotation> Collection<String> getCodes( final JCas
jcas, final T lookupWindow ) {
+      return getCodes( JCasUtil.selectCovered( jcas, IdentifiedAnnotation.class, lookupWindow
) );
+   }
+
+   /**
+    * @param jcas         -
+    * @param lookupWindow -
+    * @param schemeName   name of the scheme of interest
+    * @return set of ontology codes associated the named scheme
+    */
+   @Deprecated
+   static public <T extends Annotation> Collection<String> getCodes( final JCas
jcas, final T lookupWindow,
+                                                                     final String schemeName
) {
+      return getCodes( JCasUtil.selectCovered( jcas, IdentifiedAnnotation.class, lookupWindow
), schemeName );
+   }
+
+
+   //
+   //   Get cuis, tuis, or codes for a collections of IdentifiedAnnotations
+   //
+
+   /**
+    * @param annotations -
+    * @return set of all Umls cuis associated with the annotations
+    */
+   @Deprecated
+   static public Collection<String> getCuis( final Collection<IdentifiedAnnotation>
annotations ) {
+      return org.apache.ctakes.core.util.annotation.OntologyConceptUtil.getCuis( annotations
);
+   }
+
+   /**
+    * @param annotations -
+    * @return map of all Umls cuis associated with the annotations and the counts of those
cuis
+    */
+   @Deprecated
+   static public Map<String, Long> getCuiCounts( final Collection<IdentifiedAnnotation>
annotations ) {
+      return org.apache.ctakes.core.util.annotation.OntologyConceptUtil.getCuiCounts( annotations
);
+   }
+
+   /**
+    * @param annotations -
+    * @return set of all Umls tuis associated with the annotation
+    */
+   @Deprecated
+   static public Collection<String> getTuis( final Collection<IdentifiedAnnotation>
annotations ) {
+      return org.apache.ctakes.core.util.annotation.OntologyConceptUtil.getTuis( annotations
);
+
+   }
+
+   /**
+    * @param annotations -
+    * @return map of ontology scheme names to a set of ontology codes associated each scheme
+    */
+   @Deprecated
+   static public Map<String, Collection<String>> getSchemeCodes( final Collection<IdentifiedAnnotation>
annotations ) {
+      return org.apache.ctakes.core.util.annotation.OntologyConceptUtil.getSchemeCodes( annotations
);
+   }
+
+   /**
+    * @param annotations -
+    * @return set of ontology codes associated with all schemes
+    */
+   @Deprecated
+   static public Collection<String> getCodes( final Collection<IdentifiedAnnotation>
annotations ) {
+      return org.apache.ctakes.core.util.annotation.OntologyConceptUtil.getCodes( annotations
);
+   }
+
+   /**
+    * @param annotations -
+    * @param schemeName  name of the scheme of interest
+    * @return set of ontology codes associated the named scheme
+    */
+   @Deprecated
+   static public Collection<String> getCodes( final Collection<IdentifiedAnnotation>
annotations,
+                                              final String schemeName ) {
+      return org.apache.ctakes.core.util.annotation.OntologyConceptUtil.getCodes( annotations,
schemeName );
+   }
+
+
+   //
+   //   Get all IdentifiedAnnotations in jcas with given cui, tui, or code
+   //
+
+   /**
+    * @param jcas -
+    * @param cui  cui of interest
+    * @return all IdentifiedAnnotations that have the given cui
+    */
+   @Deprecated
+   static public Collection<IdentifiedAnnotation> getAnnotationsByCui( final JCas jcas,
+                                                                       final String cui )
{
+      return getAnnotationsByCui( JCasUtil.select( jcas, IdentifiedAnnotation.class ), cui
);
+   }
+
+   /**
+    * @param jcas -
+    * @param tui  tui of interest
+    * @return all IdentifiedAnnotations that have the given tui
+    */
+   @Deprecated
+   static public Collection<IdentifiedAnnotation> getAnnotationsByTui( final JCas jcas,
+                                                                       final String tui )
{
+      return getAnnotationsByTui( JCasUtil.select( jcas, IdentifiedAnnotation.class ), tui
);
+   }
+
+   /**
+    * @param jcas -
+    * @param code code of interest
+    * @return all IdentifiedAnnotations that have the given code
+    */
+   @Deprecated
+   static public Collection<IdentifiedAnnotation> getAnnotationsByCode( final JCas
jcas,
+                                                                        final String code
) {
+      return getAnnotationsByCode( JCasUtil.select( jcas, IdentifiedAnnotation.class ), code
);
+   }
+
+
+   //
+   //   Get all IdentifiedAnnotations in lookup window with given cui, tui, or code
+   //
+
+   /**
+    * @param jcas         -
+    * @param lookupWindow -
+    * @param cui          cui of interest
+    * @return all IdentifiedAnnotations that have the given cui
+    */
+   @Deprecated
+   static public <T extends Annotation> Collection<IdentifiedAnnotation> getAnnotationsByCui(
final JCas jcas,
+                                                                                        
     final T lookupWindow,
+                                                                                        
     final String cui ) {
+      return getAnnotationsByCui( JCasUtil.selectCovered( jcas, IdentifiedAnnotation.class,
lookupWindow ), cui );
+   }
+
+   /**
+    * @param jcas         -
+    * @param lookupWindow -
+    * @param tui          tui of interest
+    * @return all IdentifiedAnnotations that have the given tui
+    */
+   @Deprecated
+   static public <T extends Annotation> Collection<IdentifiedAnnotation> getAnnotationsByTui(
final JCas jcas,
+                                                                                        
     final T lookupWindow,
+                                                                                        
     final String tui ) {
+      return getAnnotationsByTui( JCasUtil.selectCovered( jcas, IdentifiedAnnotation.class,
lookupWindow ), tui );
+   }
+
+   /**
+    * @param jcas         -
+    * @param lookupWindow -
+    * @param code         code of interest
+    * @return all IdentifiedAnnotations that have the given code
+    */
+   @Deprecated
+   static public <T extends Annotation> Collection<IdentifiedAnnotation> getAnnotationsByCode(
final JCas jcas,
+                                                                                        
      final T lookupWindow,
+                                                                                        
      final String code ) {
+      return getAnnotationsByCode( JCasUtil.selectCovered( jcas, IdentifiedAnnotation.class,
lookupWindow ), code );
+   }
+
+
+   //
+   //   Get all IdentifiedAnnotations in a collection of annotations with given cui, tui,
or code
+   //
+
+   /**
+    * @param annotations annotations for which codes should be found
+    * @param cui         cui of interest
+    * @return all IdentifiedAnnotations that have the given cui
+    */
+   @Deprecated
+   static public Collection<IdentifiedAnnotation> getAnnotationsByCui(
+         final Collection<IdentifiedAnnotation> annotations,
+         final String cui ) {
+      return org.apache.ctakes.core.util.annotation.OntologyConceptUtil.getAnnotationsByCui(
annotations, cui );
+   }
+
+
+   /**
+    * @param annotations annotations for which codes should be found
+    * @param tui         tui of interest
+    * @return all IdentifiedAnnotations that have the given tui
+    */
+   @Deprecated
+   static public Collection<IdentifiedAnnotation> getAnnotationsByTui(
+         final Collection<IdentifiedAnnotation> annotations,
+         final String tui ) {
+      return org.apache.ctakes.core.util.annotation.OntologyConceptUtil.getAnnotationsByTui(
annotations, tui );
+   }
+
+
+   /**
+    * @param annotations annotations for which codes should be found
+    * @param code        code of interest
+    * @return all IdentifiedAnnotations that have the given code
+    */
+   @Deprecated
+   static public Collection<IdentifiedAnnotation> getAnnotationsByCode(
+         final Collection<IdentifiedAnnotation> annotations,
+         final String code ) {
+      return org.apache.ctakes.core.util.annotation.OntologyConceptUtil.getAnnotationsByCode(
annotations, code );
+   }
+
+}

Added: ctakes/trunk/ctakes-core/src/main/java/org/apache/ctakes/core/util/SourceMetadataUtil.java
URL: http://svn.apache.org/viewvc/ctakes/trunk/ctakes-core/src/main/java/org/apache/ctakes/core/util/SourceMetadataUtil.java?rev=1877084&view=auto
==============================================================================
--- ctakes/trunk/ctakes-core/src/main/java/org/apache/ctakes/core/util/SourceMetadataUtil.java
(added)
+++ ctakes/trunk/ctakes-core/src/main/java/org/apache/ctakes/core/util/SourceMetadataUtil.java
Mon Apr 27 15:05:41 2020
@@ -0,0 +1,133 @@
+package org.apache.ctakes.core.util;
+
+import org.apache.ctakes.typesystem.type.structured.Metadata;
+import org.apache.ctakes.typesystem.type.structured.SourceData;
+import org.apache.uima.jcas.JCas;
+import org.apache.uima.resource.ResourceProcessException;
+
+import java.sql.Timestamp;
+
+/**
+ * Utility class with convenience methods for a few commonly-used JCas Metadata types that
are begged of the source
+ *
+ * @author SPF , chip-nlp
+ * @version %I%
+ * @since 1/8/2015
+ * @deprecated use SourceMetadataUtil in (sub) package doc
+ */
+@Deprecated
+final public class SourceMetadataUtil {
+
+   @Deprecated
+   static public final String UNKNOWN_PATIENT = org.apache.ctakes.core.util.doc.SourceMetadataUtil.UNKNOWN_PATIENT;
+   @Deprecated
+   static public final long UNKNOWN_PATIENT_NUM
+         = org.apache.ctakes.core.util.doc.SourceMetadataUtil.UNKNOWN_PATIENT_NUM;
+
+   private SourceMetadataUtil() {
+   }
+
+   /**
+    * @param jcas ye olde jay-cas
+    * @return the patient identifier for the source or {@link #UNKNOWN_PATIENT}
+    */
+   @Deprecated
+   static public String getPatientIdentifier( final JCas jcas ) {
+      return org.apache.ctakes.core.util.doc.SourceMetadataUtil.getPatientIdentifier( jcas
);
+   }
+
+   /**
+    * @param jCas      ye olde
+    * @param patientId the patient identifier for the source
+    */
+   @Deprecated
+   static public void setPatientIdentifier( final JCas jCas, final String patientId ) {
+      org.apache.ctakes.core.util.doc.SourceMetadataUtil.setPatientIdentifier( jCas, patientId
);
+   }
+
+   /**
+    * @param jcas ye olde jay-cas
+    * @return the patient id for the source or {@link #UNKNOWN_PATIENT_NUM} if one is not
found
+    */
+   @Deprecated
+   static public long getPatientNum( final JCas jcas ) {
+      return org.apache.ctakes.core.util.doc.SourceMetadataUtil.getPatientNum( jcas );
+   }
+
+   /**
+    * @param jcas ye olde jay-cas
+    * @return the Metadata for the given jcas or null if one is not found
+    */
+   @Deprecated
+   static public Metadata getMetadata( final JCas jcas ) {
+      return org.apache.ctakes.core.util.doc.SourceMetadataUtil.getMetadata( jcas );
+   }
+
+   /**
+    * @param jCas ye olde jay-cas
+    * @return the Metadata for the given jcas
+    */
+   @Deprecated
+   static public Metadata getOrCreateMetadata( final JCas jCas ) {
+      return org.apache.ctakes.core.util.doc.SourceMetadataUtil.getOrCreateMetadata( jCas
);
+   }
+
+   /**
+    * The first step in utilizing SourceData is getting it!
+    *
+    * @param jcas ye olde jay-cas
+    * @return the metadata for the source associated with the jcas or null if one is not
found
+    */
+   @Deprecated
+   static public SourceData getSourceData( final JCas jcas ) {
+      return org.apache.ctakes.core.util.doc.SourceMetadataUtil.getSourceData( jcas );
+   }
+
+   /**
+    * @param jCas ye olde jay-cas
+    * @return the metadata for the source associated with the jcas
+    */
+   @Deprecated
+   static public SourceData getOrCreateSourceData( final JCas jCas ) {
+      return org.apache.ctakes.core.util.doc.SourceMetadataUtil.getOrCreateSourceData( jCas
);
+   }
+
+   /**
+    * @param sourcedata -
+    * @return the instance id or -1 if there isn't one
+    * @throws ResourceProcessException if the internal value is not parseable as long
+    */
+   @Deprecated
+   static public long getInstanceNum( final SourceData sourcedata ) throws ResourceProcessException
{
+      return org.apache.ctakes.core.util.doc.SourceMetadataUtil.getInstanceNum( sourcedata
);
+   }
+
+   /**
+    * @param sourcedata -
+    * @return the encounter id
+    * @throws ResourceProcessException if the encounter id does not exist or is not parseable
as an int
+    */
+   @Deprecated
+   static public int getEncounterNum( final SourceData sourcedata ) throws ResourceProcessException
{
+      return org.apache.ctakes.core.util.doc.SourceMetadataUtil.getEncounterNum( sourcedata
);
+   }
+
+   /**
+    * @param sourcedata -
+    * @return the author specialty
+    */
+   @Deprecated
+   static public String getProviderId( final SourceData sourcedata ) {
+      return org.apache.ctakes.core.util.doc.SourceMetadataUtil.getProviderId( sourcedata
);
+   }
+
+   /**
+    * @param sourcedata -
+    * @return the original date for the source
+    */
+   @Deprecated
+   static public Timestamp getStartDate( final SourceData sourcedata ) {
+      return org.apache.ctakes.core.util.doc.SourceMetadataUtil.getStartDate( sourcedata
);
+   }
+
+}

Added: ctakes/trunk/ctakes-core/src/main/java/org/apache/ctakes/core/util/WordTokenUtil.java
URL: http://svn.apache.org/viewvc/ctakes/trunk/ctakes-core/src/main/java/org/apache/ctakes/core/util/WordTokenUtil.java?rev=1877084&view=auto
==============================================================================
--- ctakes/trunk/ctakes-core/src/main/java/org/apache/ctakes/core/util/WordTokenUtil.java
(added)
+++ ctakes/trunk/ctakes-core/src/main/java/org/apache/ctakes/core/util/WordTokenUtil.java
Mon Apr 27 15:05:41 2020
@@ -0,0 +1,35 @@
+package org.apache.ctakes.core.util;
+
+
+import org.apache.ctakes.typesystem.type.syntax.WordToken;
+
+import javax.annotation.concurrent.Immutable;
+
+/**
+ * @author SPF , chip-nlp
+ * @version %I%
+ * @since 9/16/2015
+ * @deprecated use WordTokenUtil in (sub) package annotation.
+ */
+@Immutable
+@Deprecated
+final public class WordTokenUtil {
+
+   private WordTokenUtil() {
+   }
+
+
+   /**
+    * In some pipelines LVG is not run, hence a canonical form does not exist.
+    * In order to prevent NPEs, this method checks for null values of canonical form and
covered text
+    *
+    * @param wordToken of interest
+    * @return The first non-null of the word token's canonical form, covered text .
+    */
+   @Deprecated
+   static public String getCanonicalForm( final WordToken wordToken ) {
+      return org.apache.ctakes.core.util.annotation.WordTokenUtil.getCanonicalForm( wordToken
);
+   }
+
+
+}



Mime
View raw message