RE: BagOfCuisGenerator.java, same idea for getConceptText()

2015-02-17 Thread Finan, Sean
Hi Maite,

I just checked the log and it looks like you'll need to use a copy of cTakes 
built after 12/08/2014 to get Snomed codes.

Sean

-Original Message-
From: Maite Meseure Hugues [mailto:meseure.ma...@gmail.com] 
Sent: Monday, February 16, 2015 12:19 PM
To: dev@ctakes.apache.org
Subject: Re: BagOfCuisGenerator.java, same idea for getConceptText()

Sean, I have a question, is it because I am using fast dictionary I don't get 
snomed-oid or snomed-code? Instead, it's  snomed_oid: null#CTAKES.
Thank you.

Maite

On Fri, Feb 13, 2015 at 1:32 PM, Maite Meseure Hugues  
meseure.ma...@gmail.com wrote:

 Thank you for your replies, It's helpful. I was working on 3.2.0 
 version, so it looks like 3.2.1 allows to get the UMLS preferred text.

 Maite

 On Thu, Feb 12, 2015 at 2:25 PM, Finan, Sean  
 sean.fi...@childrens.harvard.edu wrote:

 Oh yeah - use the -fast dictionary to get preferred text.  The 
 fastest way to get cuis only is with CuisOnlyPlaintextUMLSProcessor.  
 If you want polarity make sure you uncomment the section with 
 PolarityCleartkAnalysisEngine.

 Sean

 -Original Message-
 From: Maite Meseure Hugues [mailto:meseure.ma...@gmail.com]
 Sent: Thursday, February 12, 2015 2:46 PM
 To: dev@ctakes.apache.org
 Subject: BagOfCuisGenerator.java, same idea for getConceptText()

 Hi everyone,

 I am currently working on BagOfCuisGenerator, and I would like to add 
 the concept text to the output.
 I 've seen some discussions about getting the original text and UMLS 
 preferred text in addition to the cui. Can someone give me pointers 
 to do that?
 Thanks in advance for your time.

 Maite

 --
 --
  Maïté Meseure Hugues




 --
 --
  Maïté Meseure Hugues




--
--
 Maïté Meseure Hugues


Re: BagOfCuisGenerator.java, same idea for getConceptText()

2015-02-16 Thread Maite Meseure Hugues
Sean, I have a question, is it because I am using fast dictionary I don't
get snomed-oid or snomed-code? Instead, it's  snomed_oid: null#CTAKES.
Thank you.

Maite

On Fri, Feb 13, 2015 at 1:32 PM, Maite Meseure Hugues 
meseure.ma...@gmail.com wrote:

 Thank you for your replies, It's helpful. I was working on 3.2.0 version,
 so it looks like 3.2.1 allows to get the UMLS preferred text.

 Maite

 On Thu, Feb 12, 2015 at 2:25 PM, Finan, Sean 
 sean.fi...@childrens.harvard.edu wrote:

 Oh yeah - use the -fast dictionary to get preferred text.  The fastest
 way to get cuis only is with CuisOnlyPlaintextUMLSProcessor.  If you want
 polarity make sure you uncomment the section with
 PolarityCleartkAnalysisEngine.

 Sean

 -Original Message-
 From: Maite Meseure Hugues [mailto:meseure.ma...@gmail.com]
 Sent: Thursday, February 12, 2015 2:46 PM
 To: dev@ctakes.apache.org
 Subject: BagOfCuisGenerator.java, same idea for getConceptText()

 Hi everyone,

 I am currently working on BagOfCuisGenerator, and I would like to add the
 concept text to the output.
 I 've seen some discussions about getting the original text and UMLS
 preferred text in addition to the cui. Can someone give me pointers to do
 that?
 Thanks in advance for your time.

 Maite

 --
 --
  Maïté Meseure Hugues




 --
 --
  Maïté Meseure Hugues




-- 
--
 Maïté Meseure Hugues


Re: BagOfCuisGenerator.java, same idea for getConceptText()

2015-02-13 Thread Maite Meseure Hugues
Thank you for your replies, It's helpful. I was working on 3.2.0 version,
so it looks like 3.2.1 allows to get the UMLS preferred text.

Maite

On Thu, Feb 12, 2015 at 2:25 PM, Finan, Sean 
sean.fi...@childrens.harvard.edu wrote:

 Oh yeah - use the -fast dictionary to get preferred text.  The fastest way
 to get cuis only is with CuisOnlyPlaintextUMLSProcessor.  If you want
 polarity make sure you uncomment the section with
 PolarityCleartkAnalysisEngine.

 Sean

 -Original Message-
 From: Maite Meseure Hugues [mailto:meseure.ma...@gmail.com]
 Sent: Thursday, February 12, 2015 2:46 PM
 To: dev@ctakes.apache.org
 Subject: BagOfCuisGenerator.java, same idea for getConceptText()

 Hi everyone,

 I am currently working on BagOfCuisGenerator, and I would like to add the
 concept text to the output.
 I 've seen some discussions about getting the original text and UMLS
 preferred text in addition to the cui. Can someone give me pointers to do
 that?
 Thanks in advance for your time.

 Maite

 --
 --
  Maïté Meseure Hugues




-- 
--
 Maïté Meseure Hugues


RE: BagOfCuisGenerator.java, same idea for getConceptText()

2015-02-12 Thread Finan, Sean
Try something like the following for output:

   private int extractFeatures( final IdentifiedAnnotation annotation )  {
  // Extract the IdentifiedAnnotation itself
  final CollectionString umlsInfos = getUmlsInfos( annotation, 
_printSnomed );
  if ( umlsInfos  == null ) {
 return 0;
  }
  final int begin = annotation.getBegin();
  final int end = annotation.getEnd();
  final String annotationText = annotation.getCoveredText();
  final int polarity = annotation.getPolarity();
  int count = 0;
  for ( String umlsInfo : umlsInfos ) {
 saveAnnotation( annotationText, umlsInfo, polarity, begin, end );
 count++;
  }
  return count;
   }

   static private CollectionString getUmlsInfos( final IdentifiedAnnotation 
identifiedAnnotation ) {
  final FSArray fsArray = identifiedAnnotation.getOntologyConceptArr();
  if ( fsArray == null ) {
 return Collections.emptySet();
  }
  final FeatureStructure[] featureStructures = fsArray.toArray();
  final SetString umlsInfos = new HashSetString( 
featureStructures.length );
  for ( FeatureStructure featureStructure : featureStructures ) {
 final OntologyConcept ontologyConcept = (OntologyConcept) 
featureStructure;
 String info = null;
 if ( ontologyConcept instanceof UmlsConcept ) {
final UmlsConcept umlsConcept = (UmlsConcept) ontologyConcept;
info = umlsConcept.getCui();
final String tui = umlsConcept.getTui();
if ( tui != null  !tui.isEmpty() ) {
   info += _ + tui;
}
final String preferredText = umlsConcept.getPreferredText();
if ( preferredText != null  !preferredText.isEmpty() ) {
   info +=  = \ + preferredText + \;
}
umlsInfos.add( info );
 }
  }
  return umlsInfos;
   }

   public void saveAnnotation( final String spannedText, final String umlsInfo, 
final int polarity,
   final int begin, final int end  )  {
  final String text = begin + , + end +   + (polarity  0 ? - :  ) 
+ umlsInfo +   + spannedText;
  if ( _writer == null ) {
 System.out.println( text );
 return;
  }
  try {
 _writer.write( text );
 _writer.newLine();
  } catch ( IOException ioE ) {
 logger.error( ioE.getMessage() );
  }
   }
-Original Message-
From: Maite Meseure Hugues [mailto:meseure.ma...@gmail.com] 
Sent: Thursday, February 12, 2015 2:46 PM
To: dev@ctakes.apache.org
Subject: BagOfCuisGenerator.java, same idea for getConceptText()

Hi everyone,

I am currently working on BagOfCuisGenerator, and I would like to add the 
concept text to the output.
I 've seen some discussions about getting the original text and UMLS preferred 
text in addition to the cui. Can someone give me pointers to do that?
Thanks in advance for your time.

Maite

--
--
 Maïté Meseure Hugues


RE: BagOfCuisGenerator.java, same idea for getConceptText()

2015-02-12 Thread Finan, Sean
Oh yeah - use the -fast dictionary to get preferred text.  The fastest way to 
get cuis only is with CuisOnlyPlaintextUMLSProcessor.  If you want polarity 
make sure you uncomment the section with PolarityCleartkAnalysisEngine.

Sean

-Original Message-
From: Maite Meseure Hugues [mailto:meseure.ma...@gmail.com] 
Sent: Thursday, February 12, 2015 2:46 PM
To: dev@ctakes.apache.org
Subject: BagOfCuisGenerator.java, same idea for getConceptText()

Hi everyone,

I am currently working on BagOfCuisGenerator, and I would like to add the 
concept text to the output.
I 've seen some discussions about getting the original text and UMLS preferred 
text in addition to the cui. Can someone give me pointers to do that?
Thanks in advance for your time.

Maite

--
--
 Maïté Meseure Hugues