incubator-ctakes-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From build...@apache.org
Subject svn commit: r838598 - in /websites/staging/ctakes/trunk/content: ./ ctakes/2.6.0/ctakes-2.6-POS-Tagger.html
Date Fri, 16 Nov 2012 16:34:49 GMT
Author: buildbot
Date: Fri Nov 16 16:34:48 2012
New Revision: 838598

Log:
Staging update by buildbot for ctakes

Added:
    websites/staging/ctakes/trunk/content/ctakes/2.6.0/ctakes-2.6-POS-Tagger.html
Modified:
    websites/staging/ctakes/trunk/content/   (props changed)

Propchange: websites/staging/ctakes/trunk/content/
------------------------------------------------------------------------------
--- cms:source-revision (original)
+++ cms:source-revision Fri Nov 16 16:34:48 2012
@@ -1 +1 @@
-1410438
+1410441

Added: websites/staging/ctakes/trunk/content/ctakes/2.6.0/ctakes-2.6-POS-Tagger.html
==============================================================================
--- websites/staging/ctakes/trunk/content/ctakes/2.6.0/ctakes-2.6-POS-Tagger.html (added)
+++ websites/staging/ctakes/trunk/content/ctakes/2.6.0/ctakes-2.6-POS-Tagger.html Fri Nov
16 16:34:48 2012
@@ -0,0 +1,307 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
+<html>
+<head>
+<!--
+ 
+    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
+ 
+       http://www.apache.org/licenses/LICENSE- 2.0
+ 
+    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.
+-->
+
+<link href="/ctakes/css/ctakes.css" rel="stylesheet" type="text/css">
+
+<title>cTAKES 2.6 POS Tagger</title>
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+
+</head>
+ 
+<body>
+ <div class="banner">
+      <div id="bannerleft">
+		<a href="http://www.apache.org/"><img src="http://www.apache.org/images/asf_logo_wide.gif"
alt="The Apache Software Foundation" border="0"/></a>
+	<br/>
+			<img alt="cTAKES logo" src="/ctakes/images/ctakes_logo.jpg" border="0"/>
+      </div>  
+    <div id="bannerright">	
+	      <img id="asf-logo" alt="Apache Incubator" src="http://incubator.apache.org/images/egg-logo.png"
border="0"/></a>			
+	  </div>
+ </div>  
+  <div id="clear"></div>
+
+
+  <div id="sidenav">
+    <h1 id="general">General</h1>
+<ul>
+<li><a href="/ctakes/index.html">About</a></li>
+<li><a href="/ctakes/gettingstarted.html">Getting Started</a></li>
+<li><a href="/ctakes/downloads.html">Downloads</a></li>
+<li><a href="/ctakes/glossary.html">Glossary</a></li>
+</ul>
+<h1 id="community">Community</h1>
+<ul>
+<li><a href="/ctakes/get-involved.html">Get Involved</a></li>
+<li><a href="https://issues.apache.org/jira/browse/ctakes">Bug Tracker</a></li>
+<li><a href="/ctakes/mailing-lists.html">Mailing Lists</a></li>
+<li><a href="/ctakes/people.html">People</a></li>
+<li><a href="http://incubator.apache.org/projects/ctakes.html">Incubator page</a></li>
+<li><a href="/ctakes/license.html">License</a></li>
+<li><a href="/ctakes/history.html">History</a></li>
+<li><a href="/ctakes/community-faqs.html">Community FAQs</a></li>
+</ul>
+<h1 id="users">Users</h1>
+<ul>
+<li><a href="/ctakes/userguide.html">User Guide</a></li>
+<li><a href="/ctakes/user-faqs.html">User FAQs</a></li>
+</ul>
+<h1 id="developers">Developers</h1>
+<ul>
+<li><a href="/ctakes/developerguide.html">Developer Guide</a></li>
+<li><a href="/ctakes/developer-faqs.html">Developer FAQs</a></li>
+</ul>
+<h1 id="ppmc">PPMC</h1>
+<ul>
+<li><a href="/ctakes/ppmc-faqs.html">PPMC FAQs</a></li>
+<li><a href="/ctakes/ctakes-release-guide.html">Release Guide</a> <br
/>
+</li>
+</ul>
+<h1 id="asf">ASF</h1>
+<ul>
+<li><a href="http://www.apache.org">Apache Software Foundation</a></li>
+<li><a href="http://www.apache.org/foundation/thanks.html">Thanks</a></li>
+<li><a href="http://www.apache.org/foundation/sponsorship.html">Become a Sponsor</a></li>
+</ul>
+  </div>
+  <div id="contenta">
+    <h1 id="ctakes-26-pos-tagger">cTAKES 2.6 - POS Tagger</h1>
+<h2 id="overview-of-pos-tagger">Overview of POS Tagger</h2>
+<p>This project provides a UIMA wrapper around the popular OpenNLP part-of-speech
+tagger. The UIMA examples project provides a default wrapper from which we
+have borrowed liberally. We have created our own wrapper so that it will work
+better with our type system and to add features and supporting components.
+Additionally, both the OpenNLP package and the UIMA examples OpenNLP wrappers
+lack documentation for how to generate training data, build a part-of-speech
+tagging model, and build a tag dictionary. The latter in particular can be
+confusing if you are new to OpenNLP.</p>
+<p>A part-of-speech tagging model is included with this project.</p>
+<p><img alt="" src="/images/icons/emoticons/information.png" /></p>
+<p>The model derives from a combination of GENIA, Penn Treebank (Wall Street
+Journal) and anonymized clinical data per Safe Harbor HIPAA guidelines. Prior
+to model building, the clinical data was deidentified for patient names to
+preserve patient confidentiality. Any person name in the model will originate
+from non-patient data sources.</p>
+<h2 id="building-a-model">Building a model</h2>
+<h3 id="obtaining-training-data">Obtaining training data</h3>
+<p>There are a variety of sources of part-of-speech data that may be useful for
+training a part-of-speech tagger. We have used the following three sources for
+training a part-of-speech tagger for clinical data:</p>
+<h4 id="mayo-part-of-speech-corpus">Mayo part-of-speech corpus</h4>
+<p>This is a corpus owned and maintained by Mayo Clinic. Unfortunately, because
+of legal and privacy issues it is not currently available for distribution.
+However, a part-of-speech model based on this data is released.</p>
+<p><img alt="" src="/images/icons/emoticons/information.png" /></p>
+<p>If you'd like to use your own algorithms on the Mayo corpus, please contact
+<a href="mailto:clinicalnlp@mayo.edu">clinicalnlp@mayo.edu</a> for its availability.</p>
+<h4 id="genia">GENIA</h4>
+<p><a href="http://www-tsujii.is.s.u-tokyo.ac.jp/GENIA/home/wiki.cgi">GENIA</a>
is a
+literature mining project in molecular biology from University of Tokyo. Its
+corpus, a collection of biomedical literature, has been annotated with POS
+tags. You can download a copy of its POS corpus version 3.02p that we used to
+build our model from <a href="http://www-
+tsujii.is.s.u-tokyo.ac.jp/%7Egenia/topics/Corpus/pos3.02p.html">Topics</a>.</p>
+<h4 id="penn-treebank">Penn Treebank</h4>
+<p>The <a href="http://www.cis.upenn.edu/%7Etreebank/">Penn Treebank</a>
project annotates
+naturally-occurring text for linguistic structure. Penn Treebank also
+annotates text with part-of-speech tags. To obtain a copy of Release 2 from
+which we built our model, refer to <a href="http://www.ldc.upenn.edu/Catalog/CatalogEntry.jsp?catalogId=LDC95T7">Release
+2</a>.</p>
+<h3 id="formatting-training-data">Formatting training data</h3>
+<p>The format of a training data file expected by OpenNLP tools should have one
+sentence per line, with each "word" immediately followed by "_" and the word's
+part-of-speech tag, which is then followed by a space. An example snippet from
+one line of training data is shown in <a href="http://ohnlp.sourceforge.net/cTAKES/#pos_training_data_eg">Example
4.2, "POS tagger training data"
+in the cTAKES documentation on
+SourceForge</a>,
+repeated here.</p>
+<p><strong>Example 4.2. POS tagger training data</strong></p>
+<p>the_DT stories_NNS about_IN well-heeled_JJ communities_NNS and_CC</p>
+<p>We have provided a script to convert GENIA data to OpenNLP part-of-speech
+data. To create a training data file from the GENIA corpus:</p>
+<ul>
+<li>Remove the following lines from GENIAcorpus3.02.pos.xml:</li>
+</ul>
+<p>line 2: &lt;?xml-stylesheet type="text/css" href="gpml.css" ?&gt;</p>
+<p>line 3: &lt;!DOCTYPE set SYSTEM "gpml.merged.dtd"&gt;</p>
+<p>line 5: &lt;import resource="GENIAontology.daml" prefix="G"&gt;&lt;/import&gt;</p>
+<p><strong>java -cp</strong> <strong><em>&lt;classpath&gt;</em></strong>
<strong>data.pos.training.GeniaPosTrainingDataExtractor GENIAcorpus3.02.pos.xml</strong>
<strong><em>&lt;genia-pos-training-data&gt;</em></strong></p>
+<p>Where</p>
+<p><strong><em>&lt;genia-pos-training-data&gt;</em></strong>
is a file that the converted training data will be written into. For the few cases in Genia
where tokens contain white space, these are simply ignored and not added to the training data
file.</p>
+<ul>
+<li>We do not have scripts that we can share for converting Penn Treebank version 2
into OpenNLP-formatted training data. However, there are many libraries that are available
that can be used to parse the Penn Treebank. Two suggestions are: <ul>
+<li>opennlp.tools.parser.ParserEventStream <a href="http://opennlp.sourceforge.net/api/opennlp/tools/parser/chunking/ParserEventStream.html">API</a>
from OpenNLP library</li>
+</ul>
+</li>
+<li><a href="http://nlp.stanford.edu/software/lex-parser.shtml">Stanford parser</a></li>
+</ul>
+<p>Another strategy is to take the output of the chunker training data as
+detailed in the section called <a href="http://ohnlp.sourceforge.net/cTAKES/#ftn.id506867">Prepare
Penn Treebank training data in the
+cTAKES documentation on
+SourceForge</a> and convert it
+to the correct format.</p>
+<p><img alt="" src="/images/icons/emoticons/information.png" /></p>
+<p><strong>What if my text contains underscores?</strong><br />
+</p>
+<p>No problem. OpenNLP splits the word from the tag using the last underscore.
+However, there will be difficulties if your data uses an underscore as a part-
+of-speech tag.</p>
+<p><img alt="" src="/images/icons/emoticons/information.png" /></p>
+<p><strong>What if I have a "token" that contains a space?</strong><br
/>
+</p>
+<p>This is a problem. OpenNLP will not be able to handle a token that contains a
+space in it. GENIA, for example, contains 108 occurrences of spaces inside
+tokens. The white space must be removed from these tokens or ignored (see
+above).</p>
+<h3 id="creating-a-model">Creating a model</h3>
+<p><strong>java -cp</strong> <strong><em>&lt;classpath&gt;</em></strong>
<strong>opennlp.tools.postag.POSTaggerME</strong> <strong><em>&lt;training-data&gt;</em></strong>
<strong><em>&lt;model-name&gt;</em></strong> <strong><em>iterations</em></strong>
<strong><em>cutoff</em></strong><br />
+Where</p>
+<ul>
+<li><em>&lt;training-data&gt;</em>* is an OpenNLP training data
file.</li>
+<li><em>&lt;model-name&gt;</em>* is the file name of the resulting
model. The name should end with either .txt (for a plain text model) or .bin.gz (for a compressed
binary model).</li>
+<li><em>&lt;iterations&gt;</em>* determines how many training iterations
will be performed. The default is 100.</li>
+<li><em>&lt;cutoff&gt;</em>* determines the minimum number of times
a feature has to be seen to be considered for inclusion in the model. The default cutoff is
5</li>
+</ul>
+<p>The iterations and cutoff arguments are, taken together, optional, that is,
+you should provide both or provide neither.</p>
+<h3 id="building-a-tag-dictionary">Building a tag dictionary</h3>
+<p>One thing that can be confusing about the OpenNLP part-of-speech tagger is
+that there are two data structures with similar sounding names, Dictionary and
+TagDictionary. In short, the Dictionary construct is one that can and should
+be ignored while the TagDictionary is one that needs a bit of attention.</p>
+<p>A tag dictionary is used when tagging text, not during the training of a POS
+model.</p>
+<p>We have provided a mechanism for creating a tag dictionary. It can be run with
+the following command:</p>
+<p><strong>java -cp</strong> <strong><em>&lt;classpath&gt;</em></strong>
<strong>edu.mayo.bmi.uima.pos_tagger.TagDictionaryCreator</strong> <strong><em>&lt;training-data&gt;</em></strong>
<strong><em>&lt;tag-dictionary&gt;</em></strong> <strong><em>case-sensitive</em></strong><br
/>
+Where</p>
+<ul>
+<li><em>&lt;training-data&gt;</em>* is a file containing pos-of-speech
tagged training data</li>
+<li><em>&lt;tag-dictionary&gt;</em>* the file name of the resulting
tag dictionary</li>
+<li><em>&lt;case-sensitive&gt;</em>* is either 'true' or 'false'
depending on whether the tag dictionary should be case sensitive or not.</li>
+</ul>
+<p>For relevant material about the difference between Dictionary and
+TagDictionary refer to the following forum threads:</p>
+<ul>
+<li><a href="https://sourceforge.net/forum/forum.php?thread_id=1720863&amp;forum_id=9943">https://sourceforge.net/forum/forum.php?thread_id=1720863&amp;forum_id=9943</a></li>
+<li><a href="https://sourceforge.net/forum/forum.php?thread_id=1894043&amp;forum_id=9943">https://sourceforge.net/forum/forum.php?thread_id=1894043&amp;forum_id=9943</a></li>
+<li>DefaultPOSContextGenerator.getContext(int, Object[], String[])] API</li>
+</ul>
+<p>OpenNLP provides a default tag dictionary for the English part-of-speech model
+called tag.bin.gz which can be downloaded from <a href="http://opennlp.sourceforg
+e.net/models/english/parser/tagdict">{+}</a><a href="http://opennlp.sourceforge.net/models/english/parser/tag
+dict+">http://opennlp.sourceforge.net/models/eng
+lish/parser/tagdict+</a>. You should use this tag dictionary only if you are using
the model
+from <a href="http://opennlp.sourceforge.net/models/english/parser/tag.bin.gz">{+}</a><a
href="http://opennlp
+.sourceforge.net/models/english/parser/tag.bin.gz+">ht
+tp://opennlp.sourceforge.net/models/english/parser/tag.bin.gz+</a>.</p>
+<p>TIP If you want to use the tag dictionary in a case insensitive way, then
+entries in the tag dictionary which are not all lowercased will be ignored
+because the tag dictionary fails to lowercase entries read in from the file.
+It only lowercases the words that are compared against the dictionary when
+"CaseSensitive" is set to false. Therefore, if you want the tag dictionary to
+be used in a case insensitive way, be sure to build the tag dictionary using
+'false' as the third argument.</p>
+<h2 id="analysis-engines-annotators">Analysis engines (annotators)</h2>
+<h3 id="postaggerxml">POSTagger.xml</h3>
+<p>The file desc/POSTagger.xml provides a descriptor for the POSTagger analysis
+engine which is the UIMA component we have written that wraps the OpenNLP
+part-of-speech tagger. It calls "edu.mayo.bmi.uima.pos_tagger.POSTagger",
+whose Javadoc API provides further information on the parameters of this
+descriptor.</p>
+<p><strong>Parameters</strong></p>
+<p>PosModelFile</p>
+<p>the file that contains the part-of-speech tagging model</p>
+<p>TagDictionary</p>
+<p>the file that contains the tag dictionary (if available)</p>
+<p>CaseSensitive</p>
+<p>determines whether to use the TagDictionary in a case sensitive way or not.</p>
+<h3 id="postaggeraggregatexml">POSTaggerAggregate.xml</h3>
+<p>The descriptor desc/POSTaggerAggregate.xml defines a pipeline for part-of-
+speech tagging that creates all the necessary inputs (e.g. token and sentence
+annotations). It needs the same three parameters as
+<a href="http://ohnlp.sourceforge.net/cTAKES/#postagger_xml">POSTagger.xml</a>
does.</p>
+<h3 id="postaggercpexml">POSTaggerCPE.xml</h3>
+<p>The file desc/POSTaggerCPE.xml provides an XML-specification of a collection
+processing engine (CPE).</p>
+<p>Start UIMA CPE GUI.</p>
+<p><strong>java -cp</strong> <strong><em>&lt;classpath&gt;</em></strong>
<strong>org.apache.uima.tools.cpm.CpmFrame</strong></p>
+<ul>
+<li>Open this file.</li>
+<li>Set the parameters for the collection reader to point to a local collection of
files that you want part-of-speech tagged.</li>
+<li>Set the parameters for the POSTagger as appropriate for your environment.</li>
+<li>Set the output directory of the XCAS Writer CAS Consumer.</li>
+</ul>
+<p>The results of running the pipeline are written to the output directory as
+XCAS files. These files can be viewed in the CAS Visual Debugger.</p>
+<h2 id="evaluating-a-pos-tagger">Evaluating a POS tagger</h2>
+<p>There are two ways a POS tagger should be evaluated:</p>
+<p>(1) Use gold standard tokens. Run the POS tagger using gold standard tokens
+and calculate the percentage of part-of-speech labels that have been correctly
+assigned. An example is given in Example 4.3 in the cTAKES documention on
+SourceForge, repeated here.</p>
+<p>(2) Use generated tokens.</p>
+<h3 id="evaluate-a-pos-tagger-using-gold-standard-tokens">Evaluate a POS tagger using
gold standard tokens</h3>
+<p>If this is gold standard sentence:</p>
+<p>The_DT major_JJ inducible_JJ protein_NN complex_NN that_WDT binds_VBZ ._.</p>
+<p>And if this is the output for that sentence:</p>
+<p>The_DT major_JJ inducible_NN protein_NN complex_NN that_WDT binds_VBD ._.</p>
+<p>By the second method, the accuracy should be 6/8 = 75%.</p>
+<ul>
+<li>Use tokenizer generated tokens</li>
+<li>Run the tokenizer and use this as input to the POS tagger.</li>
+<li>In this scenario, we calculate F-measure in the following way:</li>
+</ul>
+<p>true positive (TP)</p>
+<p>a token that has the correct boundary and part-of-speech label</p>
+<p>false positive (FP)</p>
+<p>a tagged token that does not have the correct boundary and/or part-of-speech
+label</p>
+<ul>
+<li>false negative (FN)<br />
+a token in the gold standard data that was not correctly generated by the
+tokenizer/POS tagger</li>
+</ul>
+<p>An example is given in Example 4.4 in the cTAKES documentation on SourceForge,
+<a href="http://ohnlp.sourceforge.net/cTAKES/#eval_pos_tag_gs">Evaluate a POS tagger
using generated
+tokens</a>, repeated here.</p>
+<h3 id="evaluate-a-pos-tagger-using-generated-tokens">Evaluate a POS tagger using generated
tokens</h3>
+<p>If this is gold standard sentence:</p>
+<p>This_DT complex_NN is_VBZ not_RB cyclosporin_JJ -sensitive_JJ ._.</p>
+<p>And if this is the output for that sentence:</p>
+<p>This_DT complex_JJ is_VBZ not_RB cyclosporin-sensitive_JJ ._.</p>
+<p>TP = 4, FP = 2, and FN = 3</p>
+<p>F-measure = (2 * recall * precision) / (precision + recall) = (2 * TP) / (2<em>TP
++ FP + FN) = (2 * 4) / (2</em>4 + 2 + 3) = 8 / 13 = .615</p>
+<p>In fact, if you do the evaluation this way for the "gold standard tokens"
+evaluation, then you will get the same answer as the accuracy calculation
+given above.</p>
+  </div>
+ 
+ <div id="footera">
+    <div id="copyrighta">
+      <p>Copyright &#169; 2011 The Apache Software Foundation, Licensed under the
<a href="http://www.apache.org/licenses/LICENSE-2.0">Apache License, Version 2.0</a>.<br/>Apache
and the Apache feather logo are trademarks of The Apache Software Foundation.</p>
+    </div>
+ </div>
+ 
+</body>
+</html>
+



Mime
View raw message