Hi Abilash,
If you use the DefaultFastPipeline.piper then the ClearNLP Dependency Parser
and Semantic Role labeler are already present. Adding them again will cause
duplicate data both from those modules and others down the road. There is a
diagram of the default pipeline here
https://cwiki.apache.org/confluence/display/CTAKES/Piper+Files
The following code should give you what you want:
final Map<Sentence,Collection<Predicate>> sentences =
JCasUtil.indexCovered( jCas, Sentence.class, Predicate.class );
for ( Map.Entry<Sentence,Collection<Predicate>> entry :
sentences.entrySet() ) {
System.out.println( entry.getKey().getCoveredText() );
for ( Predicate predicate : entry.getValue() ) {
System.out.print( " " + predicate.getFrameSet() + " (" );
for ( SemanticRoleRelation semRel : new
ListIterable<SemanticRoleRelation>( predicate.getRelations() ) ) {
System.out.print( " " + semRel.getCategory() + "." +
semRel.getArgument().getCoveredText() );
}
System.out.println( " )" );
}
}
Output:
The patient underwent a CT scan in April which did not reveal lesions in his
liver.
undergo.01 ( A1.patient A2.scan AM-TMP.in )
do.01 ( )
reveal.01 ( A0.scan R-A0.which AM-NEG.not A1.lesions AM-LOC.in )
Sean
-----Original Message-----
From: [email protected] [mailto:[email protected]]
Sent: Monday, September 18, 2017 1:14 AM
To: [email protected]
Subject: RE: semantic Role mapping [EXTERNAL] [SUSPICIOUS]
Tim & Sean,
I used DefaultFastPipeline.piper to run CTakes 4.0 code and got the semantic
groups tagged(after lookup with Dictionary) at the output (like
Anatomy,Disorder,Drug,etc).
Now I am trying to find the relation between the tagged words.
>From the link
>https://urldefense.proofpoint.com/v2/url?u=https-3A__cwiki.apache.org_confluence_display_CTAKES_cTAKES-2B4.0-2B-2D-2BDependency-2BParser-2Band-2BSemantic-2BRole-2BLabeler-23cTAKES4.0-2DDependencyParserandSemanticRoleLabeler-2DOverviewofSemanticRoleLabeler&d=DwIFAg&c=qS4goWBT7poplM69zy_3xhKwEW14JZMSdioCoppxeFU&r=fs67GvlGZstTpyIisCYNYmQCP6r0bcpKGd4f7d4gTao&m=SsmC-k9x4WYnOIfZPSG51PIvzx_GWbUwcBW4Ah7Tgdw&s=NEwNUx11cAMekR2LNiy7Nb-82dLhDjGlpZY_l1lhujA&e=
> ,
I found that "The semantic role labeler assigns the predicate-argument
structure of the sentence. (Who did what to whom when and where)"
For example, For the below sentence,
The patient underwent a CT scan
in April
DT NN VBD DT NN NN
IN NNP
I want the relation between words - "undergo.01(A1.patient A2.scan AM-TMP.in)"
In order to achieve this relation, I added the below pipebits to the piper file
* add org.apache.ctakes.dependency.parser.ae.ClearNLPDependencyParserAE
* add org.apache.ctakes.dependency.parser.ae.ClearNLPSemanticRoleLabelerAE
Now I want the relation to be printed in the output file (using
PrettyTextWriter)
I found a method dumpSRLOutput() present in SRLUtility.java as part of
ctakes-dependency-parser to print the semantic role label to the output file.
Please let me know if this method is appropriate or there is any other method
available in Ctakes 4 to achieve the same.
Thanks,
Abilash Mathew
-----Original Message-----
From: Finan, Sean [mailto:[email protected]]
Sent: Friday, September 15, 2017 6:12 PM
To: [email protected]
Subject: RE: semantic Role mapping [EXTERNAL] [SUSPICIOUS]
Hi Tim, Abilesh,
>From the sentence I am guessing that the image comes from the ctakes overview
>video
>https://urldefense.proofpoint.com/v2/url?u=https-3A__youtu.be_TpGZIKEDYMw&d=DwIFAg&c=qS4goWBT7poplM69zy_3xhKwEW14JZMSdioCoppxeFU&r=fs67GvlGZstTpyIisCYNYmQCP6r0bcpKGd4f7d4gTao&m=SsmC-k9x4WYnOIfZPSG51PIvzx_GWbUwcBW4Ah7Tgdw&s=N3Q5aLkUDVZaXkYN_UiIqGkwHIwRlHkvNrxA1vqrkXw&e=
>
I will try to reply with something semi-substantial in a bit.
Sean
-----Original Message-----
From: Miller, Timothy [mailto:[email protected]]
Sent: Friday, September 15, 2017 7:38 AM
To: [email protected]
Subject: Re: semantic Role mapping [EXTERNAL] [SUSPICIOUS]
?The image isn't rendering for me -- can you upload to imgur and post a link
maybe?
Tim
________________________________
From: [email protected] <[email protected]>
Sent: Friday, September 15, 2017 12:42 AM
To: [email protected]
Subject: RE: semantic Role mapping [EXTERNAL]
Hi Sean,
I am looking for the relation between the semantic groups to get printed in the
output text file.
For example in the sentence, "The patient underwent a CT scan in April which
did not reveal lesions in his liver"
I want the "Semantic Role Labeling"( as in the below image) - relation between
semantic groups identified to get printed in the output text file.
[cid:[email protected]]
Thanks,
Abilash Mathew
-----Original Message-----
From: Finan, Sean [mailto:[email protected]]
Sent: Thursday, September 14, 2017 6:48 PM
To: [email protected]
Subject: RE: semantic Role mapping [EXTERNAL]
Hi Abilash,
What exactly are you looking for?
Sean
-----Original Message-----
From: [email protected]<mailto:[email protected]>
[mailto:[email protected]]
Sent: Thursday, September 14, 2017 3:13 AM
To: [email protected]<mailto:[email protected]>
Subject: semantic Role mapping [EXTERNAL]
Hi,
Please let me know if there is a method in CTAKES other than
dumpSRLOutput(Annotation annotation to get the semantic Role mapping of input
sentences.
Does DependencyNodeWriter.java has any role in this?
Thanks,
Abilash Mathew
This e-mail and any files transmitted with it are for the sole use of the
intended recipient(s) and may contain confidential and privileged information.
If you are not the intended recipient(s), please reply to the sender and
destroy all copies of the original message. Any unauthorized review, use,
disclosure, dissemination, forwarding, printing or copying of this email,
and/or any action taken in reliance on the contents of this e-mail is strictly
prohibited and may be unlawful. Where permitted by applicable law, this e-mail
and other e-mail communications sent to and from Cognizant e-mail addresses may
be monitored.
This e-mail and any files transmitted with it are for the sole use of the
intended recipient(s) and may contain confidential and privileged information.
If you are not the intended recipient(s), please reply to the sender and
destroy all copies of the original message. Any unauthorized review, use,
disclosure, dissemination, forwarding, printing or copying of this email,
and/or any action taken in reliance on the contents of this e-mail is strictly
prohibited and may be unlawful. Where permitted by applicable law, this e-mail
and other e-mail communications sent to and from Cognizant e-mail addresses may
be monitored.
This e-mail and any files transmitted with it are for the sole use of the
intended recipient(s) and may contain confidential and privileged information.
If you are not the intended recipient(s), please reply to the sender and
destroy all copies of the original message. Any unauthorized review, use,
disclosure, dissemination, forwarding, printing or copying of this email,
and/or any action taken in reliance on the contents of this e-mail is strictly
prohibited and may be unlawful. Where permitted by applicable law, this e-mail
and other e-mail communications sent to and from Cognizant e-mail addresses may
be monitored.