You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ctakes.apache.org by se...@apache.org on 2014/02/25 21:54:26 UTC
svn commit: r1571820 [1/4] - in /ctakes/sandbox/ctakes-dictionary-lookup2:
./ desc/ desc/analysis_engine/ doc/ example/ example/desc/
example/desc/analysis_engine/
example/desc/analysis_engine/ctakes-dictionary-lookup2/ src/ src/main/
src/main/java/ sr...
Author: seanfinan
Date: Tue Feb 25 20:54:25 2014
New Revision: 1571820
URL: http://svn.apache.org/r1571820
Log:
First commit of new dictionary lookup module. No jira
Added:
ctakes/sandbox/ctakes-dictionary-lookup2/
ctakes/sandbox/ctakes-dictionary-lookup2/LICENSE (with props)
ctakes/sandbox/ctakes-dictionary-lookup2/desc/
ctakes/sandbox/ctakes-dictionary-lookup2/desc/analysis_engine/
ctakes/sandbox/ctakes-dictionary-lookup2/desc/analysis_engine/SnomedLookupAnnotator.xml (with props)
ctakes/sandbox/ctakes-dictionary-lookup2/desc/analysis_engine/SnomedOvLookupAnnotator.xml (with props)
ctakes/sandbox/ctakes-dictionary-lookup2/doc/
ctakes/sandbox/ctakes-dictionary-lookup2/example/
ctakes/sandbox/ctakes-dictionary-lookup2/example/desc/
ctakes/sandbox/ctakes-dictionary-lookup2/example/desc/analysis_engine/
ctakes/sandbox/ctakes-dictionary-lookup2/example/desc/analysis_engine/ctakes-dictionary-lookup2/
ctakes/sandbox/ctakes-dictionary-lookup2/example/desc/analysis_engine/ctakes-dictionary-lookup2/CustomLookupAnnotatorBSV.xml (with props)
ctakes/sandbox/ctakes-dictionary-lookup2/example/desc/analysis_engine/ctakes-dictionary-lookup2/CustomLookupAnnotatorJDBC.xml (with props)
ctakes/sandbox/ctakes-dictionary-lookup2/pom.xml (with props)
ctakes/sandbox/ctakes-dictionary-lookup2/src/
ctakes/sandbox/ctakes-dictionary-lookup2/src/main/
ctakes/sandbox/ctakes-dictionary-lookup2/src/main/java/
ctakes/sandbox/ctakes-dictionary-lookup2/src/main/java/org/
ctakes/sandbox/ctakes-dictionary-lookup2/src/main/java/org/apache/
ctakes/sandbox/ctakes-dictionary-lookup2/src/main/java/org/apache/ctakes/
ctakes/sandbox/ctakes-dictionary-lookup2/src/main/java/org/apache/ctakes/dictionary/
ctakes/sandbox/ctakes-dictionary-lookup2/src/main/java/org/apache/ctakes/dictionary/lookup2/
ctakes/sandbox/ctakes-dictionary-lookup2/src/main/java/org/apache/ctakes/dictionary/lookup2/ae/
ctakes/sandbox/ctakes-dictionary-lookup2/src/main/java/org/apache/ctakes/dictionary/lookup2/ae/AbstractJCasTermAnnotator.java (with props)
ctakes/sandbox/ctakes-dictionary-lookup2/src/main/java/org/apache/ctakes/dictionary/lookup2/ae/DefaultJCasTermAnnotator.java (with props)
ctakes/sandbox/ctakes-dictionary-lookup2/src/main/java/org/apache/ctakes/dictionary/lookup2/ae/JCasTermAnnotator.java (with props)
ctakes/sandbox/ctakes-dictionary-lookup2/src/main/java/org/apache/ctakes/dictionary/lookup2/ae/OverlapJCasTermAnnotator.java (with props)
ctakes/sandbox/ctakes-dictionary-lookup2/src/main/java/org/apache/ctakes/dictionary/lookup2/ae/WindowProcessor.java (with props)
ctakes/sandbox/ctakes-dictionary-lookup2/src/main/java/org/apache/ctakes/dictionary/lookup2/consumer/
ctakes/sandbox/ctakes-dictionary-lookup2/src/main/java/org/apache/ctakes/dictionary/lookup2/consumer/AbstractTermConsumer.java (with props)
ctakes/sandbox/ctakes-dictionary-lookup2/src/main/java/org/apache/ctakes/dictionary/lookup2/consumer/DefaultTermConsumer.java (with props)
ctakes/sandbox/ctakes-dictionary-lookup2/src/main/java/org/apache/ctakes/dictionary/lookup2/consumer/PrecisionTermConsumer.java (with props)
ctakes/sandbox/ctakes-dictionary-lookup2/src/main/java/org/apache/ctakes/dictionary/lookup2/consumer/TermConsumer.java (with props)
ctakes/sandbox/ctakes-dictionary-lookup2/src/main/java/org/apache/ctakes/dictionary/lookup2/consumer/WsdTermConsumer.java (with props)
ctakes/sandbox/ctakes-dictionary-lookup2/src/main/java/org/apache/ctakes/dictionary/lookup2/dictionary/
ctakes/sandbox/ctakes-dictionary-lookup2/src/main/java/org/apache/ctakes/dictionary/lookup2/dictionary/AbstractRareWordDictionary.java (with props)
ctakes/sandbox/ctakes-dictionary-lookup2/src/main/java/org/apache/ctakes/dictionary/lookup2/dictionary/BsvRareWordDictionary.java (with props)
ctakes/sandbox/ctakes-dictionary-lookup2/src/main/java/org/apache/ctakes/dictionary/lookup2/dictionary/DictionaryDescriptorParser.java (with props)
ctakes/sandbox/ctakes-dictionary-lookup2/src/main/java/org/apache/ctakes/dictionary/lookup2/dictionary/DictionaryFactory.java (with props)
ctakes/sandbox/ctakes-dictionary-lookup2/src/main/java/org/apache/ctakes/dictionary/lookup2/dictionary/JdbcRareWordDictionary.java (with props)
ctakes/sandbox/ctakes-dictionary-lookup2/src/main/java/org/apache/ctakes/dictionary/lookup2/dictionary/MemRareWordDictionary.java (with props)
ctakes/sandbox/ctakes-dictionary-lookup2/src/main/java/org/apache/ctakes/dictionary/lookup2/dictionary/RareWordDictionary.java (with props)
ctakes/sandbox/ctakes-dictionary-lookup2/src/main/java/org/apache/ctakes/dictionary/lookup2/dictionary/RareWordDictionaryWrapper.java (with props)
ctakes/sandbox/ctakes-dictionary-lookup2/src/main/java/org/apache/ctakes/dictionary/lookup2/dictionary/RareWordTermMapCreator.java (with props)
ctakes/sandbox/ctakes-dictionary-lookup2/src/main/java/org/apache/ctakes/dictionary/lookup2/relation/
ctakes/sandbox/ctakes-dictionary-lookup2/src/main/java/org/apache/ctakes/dictionary/lookup2/relation/CuiRelationsJdbc.java (with props)
ctakes/sandbox/ctakes-dictionary-lookup2/src/main/java/org/apache/ctakes/dictionary/lookup2/term/
ctakes/sandbox/ctakes-dictionary-lookup2/src/main/java/org/apache/ctakes/dictionary/lookup2/term/RareWordTerm.java (with props)
ctakes/sandbox/ctakes-dictionary-lookup2/src/main/java/org/apache/ctakes/dictionary/lookup2/term/SpannedRareWordTerm.java (with props)
ctakes/sandbox/ctakes-dictionary-lookup2/src/main/java/org/apache/ctakes/dictionary/lookup2/textspan/
ctakes/sandbox/ctakes-dictionary-lookup2/src/main/java/org/apache/ctakes/dictionary/lookup2/textspan/DefaultTextSpan.java (with props)
ctakes/sandbox/ctakes-dictionary-lookup2/src/main/java/org/apache/ctakes/dictionary/lookup2/textspan/MultiTextSpan.java (with props)
ctakes/sandbox/ctakes-dictionary-lookup2/src/main/java/org/apache/ctakes/dictionary/lookup2/textspan/TextSpan.java (with props)
ctakes/sandbox/ctakes-dictionary-lookup2/src/main/java/org/apache/ctakes/dictionary/lookup2/util/
ctakes/sandbox/ctakes-dictionary-lookup2/src/main/java/org/apache/ctakes/dictionary/lookup2/util/DictionarySpec.java (with props)
ctakes/sandbox/ctakes-dictionary-lookup2/src/main/java/org/apache/ctakes/dictionary/lookup2/util/FastLookupToken.java (with props)
ctakes/sandbox/ctakes-dictionary-lookup2/src/main/java/org/apache/ctakes/dictionary/lookup2/util/LookupUtil.java (with props)
ctakes/sandbox/ctakes-dictionary-lookup2/src/main/java/org/apache/ctakes/dictionary/lookup2/util/SemanticUtil.java (with props)
ctakes/sandbox/ctakes-dictionary-lookup2/src/main/java/org/apache/ctakes/dictionary/lookup2/util/TokenMatchUtil.java (with props)
ctakes/sandbox/ctakes-dictionary-lookup2/src/main/java/org/apache/ctakes/dictionary/lookup2/util/UmlsUserApprover.java (with props)
Added: ctakes/sandbox/ctakes-dictionary-lookup2/LICENSE
URL: http://svn.apache.org/viewvc/ctakes/sandbox/ctakes-dictionary-lookup2/LICENSE?rev=1571820&view=auto
==============================================================================
--- ctakes/sandbox/ctakes-dictionary-lookup2/LICENSE (added)
+++ ctakes/sandbox/ctakes-dictionary-lookup2/LICENSE Tue Feb 25 20:54:25 2014
@@ -0,0 +1,202 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed 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.
Propchange: ctakes/sandbox/ctakes-dictionary-lookup2/LICENSE
------------------------------------------------------------------------------
svn:eol-style = native
Added: ctakes/sandbox/ctakes-dictionary-lookup2/desc/analysis_engine/SnomedLookupAnnotator.xml
URL: http://svn.apache.org/viewvc/ctakes/sandbox/ctakes-dictionary-lookup2/desc/analysis_engine/SnomedLookupAnnotator.xml?rev=1571820&view=auto
==============================================================================
--- ctakes/sandbox/ctakes-dictionary-lookup2/desc/analysis_engine/SnomedLookupAnnotator.xml (added)
+++ ctakes/sandbox/ctakes-dictionary-lookup2/desc/analysis_engine/SnomedLookupAnnotator.xml Tue Feb 25 20:54:25 2014
@@ -0,0 +1,271 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ 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.
+
+-->
+<taeDescription xmlns="http://uima.apache.org/resourceSpecifier">
+ <frameworkImplementation>org.apache.uima.java</frameworkImplementation>
+ <primitive>true</primitive>
+ <annotatorImplementationName>org.apache.ctakes.dictionary.lookup2.ae.DefaultJCasTermAnnotator</annotatorImplementationName>
+ <analysisEngineMetaData>
+ <name>SnomedOvLookupAnnotator</name>
+ <description>Lookup Annotator descriptor for Snomed Terms which are in a Rare Word -format Database, Ctakes</description>
+ <version/>
+ <vendor/>
+
+ <configurationParameters>
+ <!-- windowAnnotations and exclusionTags were originally for the LookupConsumer, but now apply to the annotator -->
+ <configurationParameter>
+ <name>windowAnnotations</name>
+ <description>Type of window to use for lookup</description>
+ <type>String</type>
+ <multiValued>false</multiValued>
+ <mandatory>true</mandatory>
+ </configurationParameter>
+ <configurationParameter>
+ <name>exclusionTags</name>
+ <description>Parts of speech to ignore when considering lookup tokens</description>
+ <type>String</type>
+ <multiValued>false</multiValued>
+ <mandatory>false</mandatory>
+ </configurationParameter>
+ <configurationParameter>
+ <name>minimumSpan</name>
+ <description>Minimum required span length of tokens to use for lookup. Default is 3</description>
+ <type>String</type>
+ <multiValued>false</multiValued>
+ <mandatory>false</mandatory>
+ </configurationParameter>
+ <!-- UMLS User Verification -->
+ <configurationParameter>
+ <name>ctakes.umlsaddr</name>
+ <description>
+ A UMLS is required to use the UMLS Dictionary.
+ Address to verify UMLS License. If you do not have one,
+ Please request one at: https://uts.nlm.nih.gov/license.html
+ </description>
+ <type>String</type>
+ <multiValued>false</multiValued>
+ <mandatory>true</mandatory>
+ </configurationParameter>
+ <configurationParameter>
+ <name>ctakes.umlsvendor</name>
+ <description>UMLS Vendor ID</description>
+ <type>String</type>
+ <multiValued>false</multiValued>
+ <mandatory>true</mandatory>
+ </configurationParameter>
+ <configurationParameter>
+ <name>ctakes.umlsuser</name>
+ <description>UMLS User Name</description>
+ <type>String</type>
+ <multiValued>false</multiValued>
+ <mandatory>true</mandatory>
+ </configurationParameter>
+ <configurationParameter>
+ <name>ctakes.umlspw</name>
+ <description>UMLS Password</description>
+ <type>String</type>
+ <multiValued>false</multiValued>
+ <mandatory>true</mandatory>
+ </configurationParameter>
+ </configurationParameters>
+
+ <configurationParameterSettings>
+ <nameValuePair>
+ <name>windowAnnotations</name>
+ <value>
+ <!-- LookupWindowAnnotation is supposed to be a refined Noun Phrase -->
+ <string>org.apache.ctakes.typesystem.type.textspan.LookupWindowAnnotation</string>
+ <!-- In some instances LookupWindowAnnotation is missing tokens and Sentence can be used -->
+ <!-- <string>org.apache.ctakes.typesystem.type.textspan.Sentence</string> -->
+ </value>
+ </nameValuePair>
+ <nameValuePair>
+ <name>exclusionTags</name>
+ <value>
+ <string>VB,VBD,VBG,VBN,VBP,VBZ,CC,CD,DT,EX,IN,LS,MD,PDT,POS,PP,PP$,PRP,PRP$,RP,TO,WDT,WP,WPS,WRB</string>
+ </value>
+ </nameValuePair>
+ <nameValuePair>
+ <name>minimumSpan</name>
+ <value>
+ <string>3</string>
+ </value>
+ </nameValuePair>
+ <!-- UMLS User Verification -->
+ <nameValuePair>
+ <name>ctakes.umlsaddr</name>
+ <value>
+ <string>https://uts-ws.nlm.nih.gov/restful/isValidctakes.umlsuser</string>
+ </value>
+ </nameValuePair>
+ <nameValuePair>
+ <name>ctakes.umlsvendor</name>
+ <value>
+ <string>NLM-6515182895</string>
+ </value>
+ </nameValuePair>
+ <nameValuePair>
+ <name>ctakes.umlsuser</name>
+ <value>
+ <string>YOUR_UMLS_USERNAME_HERE</string>
+ </value>
+ </nameValuePair>
+ <nameValuePair>
+ <name>ctakes.umlspw</name>
+ <value>
+ <string>YOUR_UMLS_PASSWORD_HERE</string>
+ </value>
+ </nameValuePair>
+ </configurationParameterSettings>
+
+ <typeSystemDescription>
+ <imports>
+ </imports>
+ </typeSystemDescription>
+ <typePriorities/>
+ <fsIndexCollection/>
+ <capabilities>
+ <capability>
+ <inputs>
+ <type allAnnotatorFeatures="true">org.apache.ctakes.typesystem.type.syntax.BaseToken</type>
+ <type allAnnotatorFeatures="true">org.apache.ctakes.typesystem.type.textspan.LookupWindowAnnotation</type>
+ </inputs>
+ <outputs>
+ <type allAnnotatorFeatures="true">org.apache.ctakes.typesystem.type.textsem.IdentifiedAnnotation</type>
+ </outputs>
+ <languagesSupported/>
+ </capability>
+ </capabilities>
+ <operationalProperties>
+ <modifiesCas>true</modifiesCas>
+ <multipleDeploymentAllowed>true</multipleDeploymentAllowed>
+ <outputsNewCASes>false</outputsNewCASes>
+ </operationalProperties>
+ </analysisEngineMetaData>
+
+ <externalResourceDependencies>
+ <!-- RareWordTermsDescriptor is a relatively poorly-named xml that contains parms for dictionary files, dbs, etc. -->
+ <!-- why aren't such things just defined here? The obvious answer is -->
+ <externalResourceDependency>
+ <key>RareWordTermsDescriptor</key>
+ <description/>
+ <interfaceName>org.apache.ctakes.core.resource.FileResource</interfaceName>
+ <optional>false</optional>
+ </externalResourceDependency>
+
+ <externalResourceDependency>
+ <key>cTakesSnomed</key>
+ <description/>
+ <interfaceName>org.apache.ctakes.core.resource.JdbcConnectionResource</interfaceName>
+ <optional>false</optional>
+ </externalResourceDependency>
+ </externalResourceDependencies>
+
+ <resourceManagerConfiguration>
+ <externalResources>
+ <externalResource>
+ <!-- Kind of backwards. The Binding is below, for RareWordTermsDescriptor = RareWordTermsDescriptorFile -->
+ <name>RareWordTermsDescriptorFile</name>
+ <description/>
+ <fileResourceSpecifier>
+ <fileUrl>file:org/apache/ctakes/dictionary/lookup2/Snomed2011ab_ctakesTui/ctakesSnomed.xml</fileUrl>
+ </fileResourceSpecifier>
+ <implementationName>org.apache.ctakes.core.resource.FileResourceImpl</implementationName>
+ </externalResource>
+
+ <externalResource>
+ <name>cTakesSnomedResource</name>
+ <description/>
+ <configurableDataResourceSpecifier>
+ <url/>
+ <resourceMetaData>
+ <name/>
+ <configurationParameters>
+ <configurationParameter>
+ <name>DriverClassName</name>
+ <type>String</type>
+ <multiValued>false</multiValued>
+ <mandatory>true</mandatory>
+ </configurationParameter>
+ <configurationParameter>
+ <name>URL</name>
+ <type>String</type>
+ <multiValued>false</multiValued>
+ <mandatory>true</mandatory>
+ </configurationParameter>
+ <configurationParameter>
+ <name>Username</name>
+ <type>String</type>
+ <multiValued>false</multiValued>
+ <mandatory>true</mandatory>
+ </configurationParameter>
+ <configurationParameter>
+ <name>Password</name>
+ <type>String</type>
+ <multiValued>false</multiValued>
+ <mandatory>true</mandatory>
+ </configurationParameter>
+ </configurationParameters>
+ <configurationParameterSettings>
+ <nameValuePair>
+ <name>DriverClassName</name>
+ <value>
+ <string>org.hsqldb.jdbcDriver</string>
+ </value>
+ </nameValuePair>
+ <nameValuePair>
+ <name>URL</name>
+ <value>
+ <string>jdbc:hsqldb:res:org/apache/ctakes/dictionary/lookup2/Snomed2011ab_ctakesTui/cTakesUmls</string>
+ </value>
+ </nameValuePair>
+ <nameValuePair>
+ <name>Username</name>
+ <value>
+ <string>SA</string>
+ </value>
+ </nameValuePair>
+ <nameValuePair>
+ <name>Password</name>
+ <value>
+ <string/>
+ </value>
+ </nameValuePair>
+ </configurationParameterSettings>
+ </resourceMetaData>
+ </configurableDataResourceSpecifier>
+ <implementationName>org.apache.ctakes.core.resource.JdbcConnectionResourceImpl</implementationName>
+ </externalResource>
+
+ </externalResources>
+ <externalResourceBindings>
+ <externalResourceBinding>
+ <key>RareWordTermsDescriptor</key>
+ <resourceName>RareWordTermsDescriptorFile</resourceName>
+ </externalResourceBinding>
+
+ <externalResourceBinding>
+ <key>cTakesSnomed</key>
+ <resourceName>cTakesSnomedResource</resourceName>
+ </externalResourceBinding>
+ </externalResourceBindings>
+ </resourceManagerConfiguration>
+</taeDescription>
Propchange: ctakes/sandbox/ctakes-dictionary-lookup2/desc/analysis_engine/SnomedLookupAnnotator.xml
------------------------------------------------------------------------------
svn:eol-style = native
Added: ctakes/sandbox/ctakes-dictionary-lookup2/desc/analysis_engine/SnomedOvLookupAnnotator.xml
URL: http://svn.apache.org/viewvc/ctakes/sandbox/ctakes-dictionary-lookup2/desc/analysis_engine/SnomedOvLookupAnnotator.xml?rev=1571820&view=auto
==============================================================================
--- ctakes/sandbox/ctakes-dictionary-lookup2/desc/analysis_engine/SnomedOvLookupAnnotator.xml (added)
+++ ctakes/sandbox/ctakes-dictionary-lookup2/desc/analysis_engine/SnomedOvLookupAnnotator.xml Tue Feb 25 20:54:25 2014
@@ -0,0 +1,297 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ 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.
+
+-->
+<taeDescription xmlns="http://uima.apache.org/resourceSpecifier">
+ <frameworkImplementation>org.apache.uima.java</frameworkImplementation>
+ <primitive>true</primitive>
+ <annotatorImplementationName>org.apache.ctakes.dictionary.lookup2.ae.OverlapJCasTermAnnotator</annotatorImplementationName>
+ <analysisEngineMetaData>
+ <name>SnomedOvLookupAnnotator</name>
+ <description>Lookup Annotator descriptor for Snomed Terms which are in a Rare Word -format Database, Ctakes</description>
+ <version/>
+ <vendor/>
+
+ <configurationParameters>
+ <!-- windowAnnotations and exclusionTags were originally for the LookupConsumer, but now apply to the annotator -->
+ <configurationParameter>
+ <name>windowAnnotations</name>
+ <description>Type of window to use for lookup</description>
+ <type>String</type>
+ <multiValued>false</multiValued>
+ <mandatory>true</mandatory>
+ </configurationParameter>
+ <configurationParameter>
+ <name>exclusionTags</name>
+ <description>Parts of speech to ignore when considering lookup tokens</description>
+ <type>String</type>
+ <multiValued>false</multiValued>
+ <mandatory>false</mandatory>
+ </configurationParameter>
+ <configurationParameter>
+ <name>minimumSpan</name>
+ <description>Minimum required span length of tokens to use for lookup. Default is 3</description>
+ <type>String</type>
+ <multiValued>false</multiValued>
+ <mandatory>false</mandatory>
+ </configurationParameter>
+ <configurationParameter>
+ <name>consecutiveSkips</name>
+ <description>Number of consecutive tokens that can be skipped when matching terms. Default is 2</description>
+ <type>String</type>
+ <multiValued>false</multiValued>
+ <mandatory>false</mandatory>
+ </configurationParameter>
+ <configurationParameter>
+ <name>totalTokenSkips</name>
+ <description>Total number of tokens that can be skipped when matching terms. Default is 4</description>
+ <type>String</type>
+ <multiValued>false</multiValued>
+ <mandatory>false</mandatory>
+ </configurationParameter>
+ <!-- UMLS User Verification -->
+ <configurationParameter>
+ <name>ctakes.umlsaddr</name>
+ <description>
+ A UMLS is required to use the UMLS Dictionary.
+ Address to verify UMLS License. If you do not have one,
+ Please request one at: https://uts.nlm.nih.gov/license.html
+ </description>
+ <type>String</type>
+ <multiValued>false</multiValued>
+ <mandatory>true</mandatory>
+ </configurationParameter>
+ <configurationParameter>
+ <name>ctakes.umlsvendor</name>
+ <description>UMLS Vendor ID</description>
+ <type>String</type>
+ <multiValued>false</multiValued>
+ <mandatory>true</mandatory>
+ </configurationParameter>
+ <configurationParameter>
+ <name>ctakes.umlsuser</name>
+ <description>UMLS User Name</description>
+ <type>String</type>
+ <multiValued>false</multiValued>
+ <mandatory>true</mandatory>
+ </configurationParameter>
+ <configurationParameter>
+ <name>ctakes.umlspw</name>
+ <description>UMLS Password</description>
+ <type>String</type>
+ <multiValued>false</multiValued>
+ <mandatory>true</mandatory>
+ </configurationParameter>
+ </configurationParameters>
+
+ <configurationParameterSettings>
+ <nameValuePair>
+ <name>windowAnnotations</name>
+ <value>
+ <!-- LookupWindowAnnotation is supposed to be a refined Noun Phrase -->
+ <string>org.apache.ctakes.typesystem.type.textspan.LookupWindowAnnotation</string>
+ <!-- In some instances LookupWindowAnnotation is missing tokens and Sentence can be used -->
+ <!-- <string>org.apache.ctakes.typesystem.type.textspan.Sentence</string> -->
+ </value>
+ </nameValuePair>
+ <nameValuePair>
+ <name>exclusionTags</name>
+ <value>
+ <string>VB,VBD,VBG,VBN,VBP,VBZ,CC,CD,DT,EX,IN,LS,MD,PDT,POS,PP,PP$,PRP,PRP$,RP,TO,WDT,WP,WPS,WRB</string>
+ </value>
+ </nameValuePair>
+ <nameValuePair>
+ <name>minimumSpan</name>
+ <value>
+ <string>3</string>
+ </value>
+ </nameValuePair>
+ <nameValuePair>
+ <name>consecutiveSkips</name>
+ <value>
+ <string>2</string>
+ </value>
+ </nameValuePair>
+ <nameValuePair>
+ <name>totalTokenSkips</name>
+ <value>
+ <string>4</string>
+ </value>
+ </nameValuePair>
+ <!-- UMLS User Verification -->
+ <nameValuePair>
+ <name>ctakes.umlsaddr</name>
+ <value>
+ <string>https://uts-ws.nlm.nih.gov/restful/isValidctakes.umlsuser</string>
+ </value>
+ </nameValuePair>
+ <nameValuePair>
+ <name>ctakes.umlsvendor</name>
+ <value>
+ <string>NLM-6515182895</string>
+ </value>
+ </nameValuePair>
+ <nameValuePair>
+ <name>ctakes.umlsuser</name>
+ <value>
+ <string>YOUR_UMLS_USERNAME_HERE</string>
+ </value>
+ </nameValuePair>
+ <nameValuePair>
+ <name>ctakes.umlspw</name>
+ <value>
+ <string>YOUR_UMLS_PASSWORD_HERE</string>
+ </value>
+ </nameValuePair>
+ </configurationParameterSettings>
+
+ <typeSystemDescription>
+ <imports>
+ </imports>
+ </typeSystemDescription>
+ <typePriorities/>
+ <fsIndexCollection/>
+ <capabilities>
+ <capability>
+ <inputs>
+ <type allAnnotatorFeatures="true">org.apache.ctakes.typesystem.type.syntax.BaseToken</type>
+ <type allAnnotatorFeatures="true">org.apache.ctakes.typesystem.type.textspan.LookupWindowAnnotation</type>
+ </inputs>
+ <outputs>
+ <type allAnnotatorFeatures="true">org.apache.ctakes.typesystem.type.textsem.IdentifiedAnnotation</type>
+ </outputs>
+ <languagesSupported/>
+ </capability>
+ </capabilities>
+ <operationalProperties>
+ <modifiesCas>true</modifiesCas>
+ <multipleDeploymentAllowed>true</multipleDeploymentAllowed>
+ <outputsNewCASes>false</outputsNewCASes>
+ </operationalProperties>
+ </analysisEngineMetaData>
+
+ <externalResourceDependencies>
+ <!-- RareWordTermsDescriptor is a relatively poorly-named xml that contains parms for dictionary files, dbs, etc. -->
+ <!-- why aren't such things just defined here? The obvious answer is -->
+ <externalResourceDependency>
+ <key>RareWordTermsDescriptor</key>
+ <description/>
+ <interfaceName>org.apache.ctakes.core.resource.FileResource</interfaceName>
+ <optional>false</optional>
+ </externalResourceDependency>
+
+ <externalResourceDependency>
+ <key>cTakesSnomed</key>
+ <description/>
+ <interfaceName>org.apache.ctakes.core.resource.JdbcConnectionResource</interfaceName>
+ <optional>false</optional>
+ </externalResourceDependency>
+ </externalResourceDependencies>
+
+ <resourceManagerConfiguration>
+ <externalResources>
+ <externalResource>
+ <!-- Kind of backwards. The Binding is below, for RareWordTermsDescriptor = RareWordTermsDescriptorFile -->
+ <name>RareWordTermsDescriptorFile</name>
+ <description/>
+ <fileResourceSpecifier>
+ <fileUrl>file:org/apache/ctakes/dictionary/lookup2/Snomed2011ab_ctakesTui/ctakesSnomed.xml</fileUrl>
+ </fileResourceSpecifier>
+ <implementationName>org.apache.ctakes.core.resource.FileResourceImpl</implementationName>
+ </externalResource>
+
+ <externalResource>
+ <name>cTakesSnomedResource</name>
+ <description/>
+ <configurableDataResourceSpecifier>
+ <url/>
+ <resourceMetaData>
+ <name/>
+ <configurationParameters>
+ <configurationParameter>
+ <name>DriverClassName</name>
+ <type>String</type>
+ <multiValued>false</multiValued>
+ <mandatory>true</mandatory>
+ </configurationParameter>
+ <configurationParameter>
+ <name>URL</name>
+ <type>String</type>
+ <multiValued>false</multiValued>
+ <mandatory>true</mandatory>
+ </configurationParameter>
+ <configurationParameter>
+ <name>Username</name>
+ <type>String</type>
+ <multiValued>false</multiValued>
+ <mandatory>true</mandatory>
+ </configurationParameter>
+ <configurationParameter>
+ <name>Password</name>
+ <type>String</type>
+ <multiValued>false</multiValued>
+ <mandatory>true</mandatory>
+ </configurationParameter>
+ </configurationParameters>
+ <configurationParameterSettings>
+ <nameValuePair>
+ <name>DriverClassName</name>
+ <value>
+ <string>org.hsqldb.jdbcDriver</string>
+ </value>
+ </nameValuePair>
+ <nameValuePair>
+ <name>URL</name>
+ <value>
+ <string>jdbc:hsqldb:res:org/apache/ctakes/dictionary/lookup2/Snomed2011ab_ctakesTui/cTakesUmls</string>
+ </value>
+ </nameValuePair>
+ <nameValuePair>
+ <name>Username</name>
+ <value>
+ <string>SA</string>
+ </value>
+ </nameValuePair>
+ <nameValuePair>
+ <name>Password</name>
+ <value>
+ <string/>
+ </value>
+ </nameValuePair>
+ </configurationParameterSettings>
+ </resourceMetaData>
+ </configurableDataResourceSpecifier>
+ <implementationName>org.apache.ctakes.core.resource.JdbcConnectionResourceImpl</implementationName>
+ </externalResource>
+
+ </externalResources>
+ <externalResourceBindings>
+ <externalResourceBinding>
+ <key>RareWordTermsDescriptor</key>
+ <resourceName>RareWordTermsDescriptorFile</resourceName>
+ </externalResourceBinding>
+
+ <externalResourceBinding>
+ <key>cTakesSnomed</key>
+ <resourceName>cTakesSnomedResource</resourceName>
+ </externalResourceBinding>
+ </externalResourceBindings>
+ </resourceManagerConfiguration>
+</taeDescription>
Propchange: ctakes/sandbox/ctakes-dictionary-lookup2/desc/analysis_engine/SnomedOvLookupAnnotator.xml
------------------------------------------------------------------------------
svn:eol-style = native
Added: ctakes/sandbox/ctakes-dictionary-lookup2/example/desc/analysis_engine/ctakes-dictionary-lookup2/CustomLookupAnnotatorBSV.xml
URL: http://svn.apache.org/viewvc/ctakes/sandbox/ctakes-dictionary-lookup2/example/desc/analysis_engine/ctakes-dictionary-lookup2/CustomLookupAnnotatorBSV.xml?rev=1571820&view=auto
==============================================================================
--- ctakes/sandbox/ctakes-dictionary-lookup2/example/desc/analysis_engine/ctakes-dictionary-lookup2/CustomLookupAnnotatorBSV.xml (added)
+++ ctakes/sandbox/ctakes-dictionary-lookup2/example/desc/analysis_engine/ctakes-dictionary-lookup2/CustomLookupAnnotatorBSV.xml Tue Feb 25 20:54:25 2014
@@ -0,0 +1,148 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ 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.
+
+-->
+<taeDescription xmlns="http://uima.apache.org/resourceSpecifier">
+ <frameworkImplementation>org.apache.uima.java</frameworkImplementation>
+ <primitive>true</primitive>
+ <annotatorImplementationName>org.apache.ctakes.dictionary.lookup2.ae.DefaultJCasTermAnnotator</annotatorImplementationName>
+ <analysisEngineMetaData>
+ <!-- Simple descriptor that uses DefaultJCasTermAnnotator and Bsv Dictionary File -->
+ <name>CustomLookupAnnotatorBSV</name>
+ <description>Dictionary Lookup Annotator descriptor for dictionaries which actually lie in a BSV file</description>
+ <version/>
+ <vendor/>
+
+ <configurationParameters>
+ <!-- windowAnnotations and exclusionTags were originally for the LookupConsumer, but now apply to the annotator -->
+ <configurationParameter>
+ <name>windowAnnotations</name>
+ <description>Type of window to use for lookup</description>
+ <type>String</type>
+ <multiValued>false</multiValued>
+ <mandatory>true</mandatory>
+ </configurationParameter>
+ <configurationParameter>
+ <name>exclusionTags</name>
+ <description>Parts of speech to ignore when considering lookup tokens</description>
+ <type>String</type>
+ <multiValued>false</multiValued>
+ <mandatory>false</mandatory>
+ </configurationParameter>
+ </configurationParameters>
+
+ <configurationParameterSettings>
+ <nameValuePair>
+ <name>windowAnnotations</name>
+ <value>
+ <!-- LookupWindowAnnotation is supposed to be a refined Noun Phrase -->
+ <string>org.apache.ctakes.typesystem.type.textspan.LookupWindowAnnotation</string>
+ <!-- In some instances LookupWindowAnnotation is missing tokens and Sentence can be used -->
+ <!-- <string>org.apache.ctakes.typesystem.type.textspan.Sentence</string> -->
+ </value>
+ </nameValuePair>
+ <nameValuePair>
+ <name>exclusionTags</name>
+ <value>
+ <string>VB,VBD,VBG,VBN,VBP,VBZ,CC,CD,DT,EX,IN,LS,MD,PDT,POS,PP,PP$,PRP,PRP$,RP,TO,WDT,WP,WPS,WRB</string>
+ </value>
+ </nameValuePair>
+ </configurationParameterSettings>
+
+ <typeSystemDescription>
+ <imports>
+ </imports>
+ </typeSystemDescription>
+ <typePriorities/>
+ <fsIndexCollection/>
+ <capabilities>
+ <capability>
+ <inputs>
+ <type allAnnotatorFeatures="true">org.apache.ctakes.typesystem.type.syntax.BaseToken</type>
+ <type allAnnotatorFeatures="true">org.apache.ctakes.typesystem.type.textspan.LookupWindowAnnotation</type>
+ </inputs>
+ <outputs>
+ <type allAnnotatorFeatures="true">org.apache.ctakes.typesystem.type.textsem.IdentifiedAnnotation</type>
+ </outputs>
+ <languagesSupported/>
+ </capability>
+ </capabilities>
+ <operationalProperties>
+ <modifiesCas>true</modifiesCas>
+ <multipleDeploymentAllowed>true</multipleDeploymentAllowed>
+ <outputsNewCASes>false</outputsNewCASes>
+ </operationalProperties>
+ </analysisEngineMetaData>
+
+ <externalResourceDependencies>
+ <!-- LookupDescriptor is a relatively poorly-named xml that contains parms for dictionary files, dbs, etc. -->
+ <!-- why aren't such things just defined here? The obvious answer is -->
+ <externalResourceDependency>
+ <key>RareWordTermsDescriptor</key>
+ <description/>
+ <interfaceName>org.apache.ctakes.core.resource.FileResource</interfaceName>
+ <optional>false</optional>
+ </externalResourceDependency>
+ <!-- BsvDictionaryFile is the key that we are giving the actual bsv file that contains the dictionary -->
+ <!-- This is not a filename, just a key to connect what is here with what is in the lookupDescriptor -->
+ <externalResourceDependency>
+ <key>BsvDictionaryFile</key>
+ <description/>
+ <interfaceName>org.apache.ctakes.core.resource.FileResource</interfaceName>
+ <optional>false</optional>
+ </externalResourceDependency>
+ </externalResourceDependencies>
+
+ <resourceManagerConfiguration>
+ <externalResources>
+ <externalResource>
+ <!-- Kind of backwards. The Binding is below, for LookupDescriptor = LookupDescriptorFile -->
+ <name>RareWordTermsDescriptorFile</name>
+ <description/>
+ <fileResourceSpecifier>
+ <fileUrl>file:org/apache/ctakes/dictionary/lookup2/example/bsv/RareWord_BSV.xml</fileUrl>
+ </fileResourceSpecifier>
+ <implementationName>org.apache.ctakes.core.resource.FileResourceImpl</implementationName>
+ </externalResource>
+ <externalResource>
+ <!-- Kind of backwards. The Binding is below, for BsvDictionaryFile = BsvDictionaryFileResource -->
+ <!-- The binding key DictionaryFile will be used in the LookupDescriptor to point back to this
+ BsvDictionaryFileResource. Dead or Alive anyone? (80's)-->
+ <name>BsvDictionaryFileResource</name>
+ <description/>
+ <fileResourceSpecifier>
+ <fileUrl>file:org/apache/ctakes/dictionary/lookup2/example/bsv/CustomBsvDictionary.bsv</fileUrl>
+ </fileResourceSpecifier>
+ <implementationName>org.apache.ctakes.core.resource.FileResourceImpl</implementationName>
+ </externalResource>
+ </externalResources>
+ <externalResourceBindings>
+ <externalResourceBinding>
+ <key>LookupDescriptor</key>
+ <resourceName>LookupDescriptorFile</resourceName>
+ </externalResourceBinding>
+ <externalResourceBinding>
+ <!-- binding key BsvDictionaryFile points up to the externalResource named BsvDictionaryFileResource -->
+ <key>BsvDictionaryFile</key>
+ <resourceName>BsvDictionaryFileResource</resourceName>
+ </externalResourceBinding>
+ </externalResourceBindings>
+ </resourceManagerConfiguration>
+</taeDescription>
Propchange: ctakes/sandbox/ctakes-dictionary-lookup2/example/desc/analysis_engine/ctakes-dictionary-lookup2/CustomLookupAnnotatorBSV.xml
------------------------------------------------------------------------------
svn:eol-style = native
Added: ctakes/sandbox/ctakes-dictionary-lookup2/example/desc/analysis_engine/ctakes-dictionary-lookup2/CustomLookupAnnotatorJDBC.xml
URL: http://svn.apache.org/viewvc/ctakes/sandbox/ctakes-dictionary-lookup2/example/desc/analysis_engine/ctakes-dictionary-lookup2/CustomLookupAnnotatorJDBC.xml?rev=1571820&view=auto
==============================================================================
--- ctakes/sandbox/ctakes-dictionary-lookup2/example/desc/analysis_engine/ctakes-dictionary-lookup2/CustomLookupAnnotatorJDBC.xml (added)
+++ ctakes/sandbox/ctakes-dictionary-lookup2/example/desc/analysis_engine/ctakes-dictionary-lookup2/CustomLookupAnnotatorJDBC.xml Tue Feb 25 20:54:25 2014
@@ -0,0 +1,199 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ 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.
+
+-->
+<taeDescription xmlns="http://uima.apache.org/resourceSpecifier">
+ <frameworkImplementation>org.apache.uima.java</frameworkImplementation>
+ <primitive>true</primitive>
+ <annotatorImplementationName>org.apache.ctakes.dictionary.lookup2.ae.DefaultJCasTermAnnotator</annotatorImplementationName>
+ <analysisEngineMetaData>
+ <name>CustomLookupAnnotatorJDBC</name>
+ <description>Term Lookup Annotator descriptor for Terms which are in a Rare Word -format Database</description>
+ <version/>
+ <vendor/>
+
+ <configurationParameters>
+ <!-- windowAnnotations and exclusionTags were originally for the LookupConsumer, but now apply to the annotator -->
+ <configurationParameter>
+ <name>windowAnnotations</name>
+ <description>Type of window to use for lookup</description>
+ <type>String</type>
+ <multiValued>false</multiValued>
+ <mandatory>true</mandatory>
+ </configurationParameter>
+ <configurationParameter>
+ <name>exclusionTags</name>
+ <description>Parts of speech to ignore when considering lookup tokens</description>
+ <type>String</type>
+ <multiValued>false</multiValued>
+ <mandatory>false</mandatory>
+ </configurationParameter>
+ </configurationParameters>
+
+ <configurationParameterSettings>
+ <nameValuePair>
+ <name>windowAnnotations</name>
+ <value>
+ <!-- LookupWindowAnnotation is supposed to be a refined Noun Phrase -->
+ <string>org.apache.ctakes.typesystem.type.textspan.LookupWindowAnnotation</string>
+ <!-- In some instances LookupWindowAnnotation is missing tokens and Sentence can be used -->
+ <!-- <string>org.apache.ctakes.typesystem.type.textspan.Sentence</string> -->
+ </value>
+ </nameValuePair>
+ <nameValuePair>
+ <name>exclusionTags</name>
+ <value>
+ <string>VB,VBD,VBG,VBN,VBP,VBZ,CC,CD,DT,EX,IN,LS,MD,PDT,POS,PP,PP$,PRP,PRP$,RP,TO,WDT,WP,WPS,WRB</string>
+ </value>
+ </nameValuePair>
+ </configurationParameterSettings>
+
+ <typeSystemDescription>
+ <imports>
+ </imports>
+ </typeSystemDescription>
+ <typePriorities/>
+ <fsIndexCollection/>
+ <capabilities>
+ <capability>
+ <inputs>
+ <type allAnnotatorFeatures="true">org.apache.ctakes.typesystem.type.syntax.BaseToken</type>
+ <type allAnnotatorFeatures="true">org.apache.ctakes.typesystem.type.textspan.LookupWindowAnnotation</type>
+ </inputs>
+ <outputs>
+ <type allAnnotatorFeatures="true">org.apache.ctakes.typesystem.type.textsem.IdentifiedAnnotation</type>
+ </outputs>
+ <languagesSupported/>
+ </capability>
+ </capabilities>
+ <operationalProperties>
+ <modifiesCas>true</modifiesCas>
+ <multipleDeploymentAllowed>true</multipleDeploymentAllowed>
+ <outputsNewCASes>false</outputsNewCASes>
+ </operationalProperties>
+ </analysisEngineMetaData>
+
+ <externalResourceDependencies>
+ <!-- RareWordTermsDescriptor is a relatively poorly-named xml that contains parms for dictionary files, dbs, etc. -->
+ <!-- why aren't such things just defined here? The obvious answer is -->
+ <externalResourceDependency>
+ <key>RareWordTermsDescriptor</key>
+ <description/>
+ <interfaceName>org.apache.ctakes.core.resource.FileResource</interfaceName>
+ <optional>false</optional>
+ </externalResourceDependency>
+ <externalResourceDependency>
+ <key>JdbcDictionaryDB</key>
+ <description/>
+ <interfaceName>org.apache.ctakes.core.resource.JdbcConnectionResource</interfaceName>
+ <optional>false</optional>
+ </externalResourceDependency>
+ </externalResourceDependencies>
+
+ <resourceManagerConfiguration>
+ <externalResources>
+ <externalResource>
+ <!-- Kind of backwards. The Binding is below, for RareWordTermsDescriptor = RareWordTermsDescriptorFile -->
+ <name>RareWordTermsDescriptorFile</name>
+ <description/>
+ <fileResourceSpecifier>
+ <fileUrl>file:org/apache/ctakes/dictionary/lookup2/example/hsql/RareWord_JDBC.xml</fileUrl>
+ </fileResourceSpecifier>
+ <implementationName>org.apache.ctakes.core.resource.FileResourceImpl</implementationName>
+ </externalResource>
+
+ <externalResource>
+ <name>JdbcDictionaryDbResource</name>
+ <description/>
+ <configurableDataResourceSpecifier>
+ <url/>
+ <resourceMetaData>
+ <name/>
+ <configurationParameters>
+ <configurationParameter>
+ <name>DriverClassName</name>
+ <type>String</type>
+ <multiValued>false</multiValued>
+ <mandatory>true</mandatory>
+ </configurationParameter>
+ <configurationParameter>
+ <name>URL</name>
+ <type>String</type>
+ <multiValued>false</multiValued>
+ <mandatory>true</mandatory>
+ </configurationParameter>
+ <configurationParameter>
+ <name>Username</name>
+ <type>String</type>
+ <multiValued>false</multiValued>
+ <mandatory>true</mandatory>
+ </configurationParameter>
+ <configurationParameter>
+ <name>Password</name>
+ <type>String</type>
+ <multiValued>false</multiValued>
+ <mandatory>true</mandatory>
+ </configurationParameter>
+ </configurationParameters>
+ <configurationParameterSettings>
+ <nameValuePair>
+ <name>DriverClassName</name>
+ <value>
+ <string>org.hsqldb.jdbcDriver</string>
+ </value>
+ </nameValuePair>
+ <nameValuePair>
+ <name>URL</name>
+ <value>
+ <string>jdbc:hsqldb:res:org/apache/ctakes/dictionary/lookup2/example/hsql/customHsql</string>
+ </value>
+ </nameValuePair>
+ <nameValuePair>
+ <name>Username</name>
+ <value>
+ <string>SA</string>
+ </value>
+ </nameValuePair>
+ <nameValuePair>
+ <name>Password</name>
+ <value>
+ <string/>
+ </value>
+ </nameValuePair>
+ </configurationParameterSettings>
+ </resourceMetaData>
+ </configurableDataResourceSpecifier>
+ <implementationName>org.apache.ctakes.core.resource.JdbcConnectionResourceImpl</implementationName>
+ </externalResource>
+
+ </externalResources>
+ <externalResourceBindings>
+ <externalResourceBinding>
+ <key>RareWordTermsDescriptor</key>
+ <resourceName>RareWordTermsDescriptorFile</resourceName>
+ </externalResourceBinding>
+
+ <externalResourceBinding>
+ <key>JdbcDictionaryDB</key>
+ <resourceName>JdbcDictionaryDbResource</resourceName>
+ </externalResourceBinding>
+ </externalResourceBindings>
+ </resourceManagerConfiguration>
+</taeDescription>
Propchange: ctakes/sandbox/ctakes-dictionary-lookup2/example/desc/analysis_engine/ctakes-dictionary-lookup2/CustomLookupAnnotatorJDBC.xml
------------------------------------------------------------------------------
svn:eol-style = native
Added: ctakes/sandbox/ctakes-dictionary-lookup2/pom.xml
URL: http://svn.apache.org/viewvc/ctakes/sandbox/ctakes-dictionary-lookup2/pom.xml?rev=1571820&view=auto
==============================================================================
--- ctakes/sandbox/ctakes-dictionary-lookup2/pom.xml (added)
+++ ctakes/sandbox/ctakes-dictionary-lookup2/pom.xml Tue Feb 25 20:54:25 2014
@@ -0,0 +1,114 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ 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.
+
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>ctakes-dictionary-lookup2</artifactId>
+ <name>Apache cTAKES dictionary lookup 2</name>
+ <parent>
+ <groupId>org.apache.ctakes</groupId>
+ <artifactId>ctakes</artifactId>
+ <version>3.1.2-SNAPSHOT</version>
+ </parent>
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.ctakes</groupId>
+ <artifactId>ctakes-dictionary-lookup2-res</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>hsqldb</groupId>
+ <artifactId>hsqldb</artifactId>
+ <version>1.8.0.10</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.ctakes</groupId>
+ <artifactId>ctakes-type-system</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.ctakes</groupId>
+ <artifactId>ctakes-core</artifactId>
+ </dependency>
+<!-- if there is a need to use RareWordDictionaryWrapper then the old ctakes-dictionary-lookup is a dependency
+ <dependency>
+ <groupId>org.apache.ctakes</groupId>
+ <artifactId>ctakes-dictionary-lookup</artifactId>
+ </dependency>
+-->
+ <dependency>
+ <groupId>log4j</groupId>
+ <artifactId>log4j</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.lucene</groupId>
+ <artifactId>lucene-core</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.lucene</groupId>
+ <artifactId>lucene-queries</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.lucene</groupId>
+ <artifactId>lucene-queryparser</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.lucene</groupId>
+ <artifactId>lucene-analyzers-common</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>jdom</groupId>
+ <artifactId>jdom</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ </dependency>
+
+ <!-- cTAKES Resources -->
+<!-- <dependency>
+ <groupId>net.sourceforge.ctakesresources</groupId>
+ <artifactId>ctakes-resources-umls2011ab</artifactId>
+ <version>3.1.0</version>
+ </dependency>
+-->
+ </dependencies>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-dependency-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>unpack-dependencies</id>
+ <phase>process-resources</phase>
+ <goals>
+ <goal>unpack-dependencies</goal>
+ </goals>
+ <configuration>
+ <includeArtifactIds>ctakes-resources-umls2011ab</includeArtifactIds>
+ <!-- <includes>**/*</includes> -->
+ <outputDirectory>${project.build.directory}/classes</outputDirectory>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+</project>
Propchange: ctakes/sandbox/ctakes-dictionary-lookup2/pom.xml
------------------------------------------------------------------------------
svn:eol-style = native
Added: ctakes/sandbox/ctakes-dictionary-lookup2/src/main/java/org/apache/ctakes/dictionary/lookup2/ae/AbstractJCasTermAnnotator.java
URL: http://svn.apache.org/viewvc/ctakes/sandbox/ctakes-dictionary-lookup2/src/main/java/org/apache/ctakes/dictionary/lookup2/ae/AbstractJCasTermAnnotator.java?rev=1571820&view=auto
==============================================================================
--- ctakes/sandbox/ctakes-dictionary-lookup2/src/main/java/org/apache/ctakes/dictionary/lookup2/ae/AbstractJCasTermAnnotator.java (added)
+++ ctakes/sandbox/ctakes-dictionary-lookup2/src/main/java/org/apache/ctakes/dictionary/lookup2/ae/AbstractJCasTermAnnotator.java Tue Feb 25 20:54:25 2014
@@ -0,0 +1,276 @@
+/**
+ * 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.
+ */
+package org.apache.ctakes.dictionary.lookup2.ae;
+
+import org.apache.ctakes.core.fsm.token.NumberToken;
+import org.apache.ctakes.core.resource.FileResource;
+import org.apache.ctakes.core.util.JCasUtil;
+import org.apache.ctakes.dictionary.lookup2.dictionary.RareWordDictionary;
+import org.apache.ctakes.dictionary.lookup2.dictionary.DictionaryDescriptorParser;
+import org.apache.ctakes.dictionary.lookup2.term.SpannedRareWordTerm;
+import org.apache.ctakes.dictionary.lookup2.util.DictionarySpec;
+import org.apache.ctakes.dictionary.lookup2.util.FastLookupToken;
+import org.apache.ctakes.typesystem.type.syntax.BaseToken;
+import org.apache.ctakes.typesystem.type.syntax.ContractionToken;
+import org.apache.ctakes.typesystem.type.syntax.NewlineToken;
+import org.apache.ctakes.typesystem.type.syntax.PunctuationToken;
+import org.apache.ctakes.typesystem.type.syntax.SymbolToken;
+import org.apache.log4j.Logger;
+import org.apache.uima.UimaContext;
+import org.apache.uima.analysis_component.JCasAnnotator_ImplBase;
+import org.apache.uima.analysis_engine.AnalysisEngineProcessException;
+import org.apache.uima.analysis_engine.annotator.AnnotatorContextException;
+import org.apache.uima.cas.text.AnnotationIndex;
+import org.apache.uima.jcas.JCas;
+import org.apache.uima.jcas.JFSIndexRepository;
+import org.apache.uima.jcas.tcas.Annotation;
+import org.apache.uima.resource.ResourceAccessException;
+import org.apache.uima.resource.ResourceInitializationException;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+/**
+ * Performs the basic initialization with uima context, including the parse of the dictionary specifications file.
+ * Has a
+ *
+ * Author: SPF
+ * Affiliation: CHIP-NLP
+ * Date: 12/6/13
+ */
+abstract public class AbstractJCasTermAnnotator extends JCasAnnotator_ImplBase
+ implements JCasTermAnnotator, WindowProcessor {
+
+ // LOG4J logger based on interface name
+ final private Logger _logger = Logger.getLogger( "AbstractJCasTermAnnotator" );
+
+ /** specifies the type of window to use for lookup */
+ static private final String WINDOW_ANNOT_PRP_KEY = "windowAnnotations";
+ /** optional part of speech tags for tokens that should not be used for lookup */
+ static private final String EXC_TAGS_PRP_KEY = "exclusionTags";
+ /** optional minimum span for tokens that should not be used for lookup */
+ static private final String MIN_SPAN_PRP_KEY = "minimumSpan";
+
+ private DictionarySpec _dictionarySpec;
+
+ // type of lookup window to use, typically "LookupWindowAnnotation" or "Sentence"
+ private int _lookupWindowType;
+ // set of exclusion POS tags (lower cased), may be null
+ private final Set<String> _exclusionPartsOfSpeech = new HashSet<String>();
+ // minimum span required to use token for lookup
+ private int _minimumLookupSpan = 3;
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void initialize( final UimaContext uimaContext ) throws ResourceInitializationException {
+ super.initialize( uimaContext );
+ try {
+ final String windowClassName = (String)uimaContext.getConfigParameterValue( WINDOW_ANNOT_PRP_KEY );
+ _logger.info( "Using dictionary lookup window type: " + windowClassName );
+ _lookupWindowType = JCasUtil.getType( windowClassName );
+
+ // optional exclusion POS tags
+ final String exclusionTags = (String)uimaContext.getConfigParameterValue( EXC_TAGS_PRP_KEY );
+ if ( exclusionTags != null ) {
+ final String[] tagArr = exclusionTags.split( "," );
+ for ( String tag : tagArr ) {
+ _exclusionPartsOfSpeech.add( tag.toUpperCase() );
+ }
+ final List<String> posList = new ArrayList<String>( _exclusionPartsOfSpeech );
+ Collections.sort( posList );
+ final StringBuilder sb = new StringBuilder();
+ for ( String pos : posList ) {
+ sb.append( pos ).append( " " );
+ }
+ _logger.info( "Exclusion tagset loaded: " + sb.toString() );
+ }
+
+ // optional minimum span, default is 3
+ final String minimumSpan = (String)uimaContext.getConfigParameterValue( MIN_SPAN_PRP_KEY );
+ if ( minimumSpan != null ) {
+ _minimumLookupSpan = parseInt( minimumSpan, MIN_SPAN_PRP_KEY, _minimumLookupSpan );
+ }
+ _logger.info( "Using minimum lookup token span: " + _minimumLookupSpan );
+ final FileResource fileResource = (FileResource) uimaContext.getResourceObject( LOOKUP_DESCRIPTOR_KEY );
+ final File descriptorFile = fileResource.getFile();
+ _dictionarySpec = DictionaryDescriptorParser.parseDescriptor( descriptorFile, uimaContext );
+ } catch ( ResourceAccessException raE ) {
+ throw new ResourceInitializationException( raE );
+ } catch ( AnnotatorContextException acE ) {
+ throw new ResourceInitializationException( acE );
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void process( final JCas jcas ) throws AnalysisEngineProcessException {
+ _logger.info( "Starting processing" );
+ final JFSIndexRepository indexes = jcas.getJFSIndexRepository();
+ final AnnotationIndex annotationIndex = indexes.getAnnotationIndex( _lookupWindowType );
+ if ( annotationIndex == null ) { // I don't trust AnnotationIndex.size(), so don't check
+ return;
+ }
+ final Map<RareWordDictionary,Collection<SpannedRareWordTerm>> dictionaryTermsMap
+ = new HashMap<RareWordDictionary, Collection<SpannedRareWordTerm>>();
+ final Iterator windowIterator = annotationIndex.iterator();
+ try {
+ while ( windowIterator.hasNext() ) {
+ final Annotation window = (Annotation) windowIterator.next();
+ if ( isWindowOk( window ) ) {
+ processWindow( jcas, window, dictionaryTermsMap );
+ }
+ }
+ } catch ( ArrayIndexOutOfBoundsException iobE ) {
+ // JCasHashMap will throw this every once in a while. Assume the windows are done and move on
+ _logger.warn( iobE.getMessage() );
+ }
+ // Let the consumer handle uniqueness and ordering - some may not care
+ for ( Map.Entry<RareWordDictionary, Collection<SpannedRareWordTerm>> entry : dictionaryTermsMap.entrySet() ) {
+ _dictionarySpec.getConsumer().consumeHits( jcas, entry.getKey(), entry.getValue() );
+ }
+ _logger.info( "Finished processing" );
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Collection<RareWordDictionary> getDictionaries() {
+ return _dictionarySpec.getDictionaries();
+ }
+
+ /**
+ * Skip windows that are section headers/footers. Kludge, but worth doing
+ * {@inheritDoc}
+ */
+ @Override
+ public boolean isWindowOk( final Annotation window ) {
+ final String coveredText = window.getCoveredText();
+ return !coveredText.equals( "section id" )
+ && !coveredText.startsWith( "[start section id" )
+ && !coveredText.startsWith( "[end section id" );
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void processWindow( final JCas jcas, final Annotation window,
+ final Map<RareWordDictionary, Collection<SpannedRareWordTerm>> dictionaryTermsMap ) {
+ final List<FastLookupToken> allTokens = new ArrayList<FastLookupToken>();
+ final List<Integer> lookupTokenIndices = new ArrayList<Integer>();
+ getAnnotationsInWindow( jcas, window, allTokens, lookupTokenIndices );
+ findTerms( getDictionaries(), allTokens, lookupTokenIndices, dictionaryTermsMap );
+ }
+
+ /**
+ * Given a set of dictionaries, tokens, and lookup token indices, populate a terms map with discovered terms
+ * @param dictionaries -
+ * @param allTokens -
+ * @param lookupTokenIndices -
+ * @param dictionaryTermsMap -
+ */
+ private void findTerms( final Collection<RareWordDictionary> dictionaries,
+ final List<FastLookupToken> allTokens, final List<Integer> lookupTokenIndices,
+ final Map<RareWordDictionary, Collection<SpannedRareWordTerm>> dictionaryTermsMap ) {
+ Collection<SpannedRareWordTerm> termsFromDictionary;
+ for ( RareWordDictionary dictionary : dictionaries ) {
+ termsFromDictionary = dictionaryTermsMap.get( dictionary );
+ if ( termsFromDictionary == null ) {
+ termsFromDictionary = new ArrayList<SpannedRareWordTerm>();
+ dictionaryTermsMap.put( dictionary, termsFromDictionary );
+ }
+ findTerms( dictionary, allTokens, lookupTokenIndices, termsFromDictionary );
+ }
+ }
+
+ /**
+ * Given a dictionary, tokens, and lookup token indices, populate a terms collection with discovered terms
+ * @param dictionary -
+ * @param allTokens -
+ * @param lookupTokenIndices -
+ * @param termsFromDictionary -
+ */
+ abstract void findTerms( RareWordDictionary dictionary,
+ List<FastLookupToken> allTokens, List<Integer> lookupTokenIndices,
+ Collection<SpannedRareWordTerm> termsFromDictionary );
+
+
+ /**
+ * For the given lookup window fills two collections with 1) All tokens in the window,
+ * and 2) indexes of tokens in the window to be used for lookup
+ * @param jcas -
+ * @param window annotation lookup window
+ * @param allTokens filled with all tokens, including punctuation, etc.
+ * @param lookupTokenIndices filled with indices of tokens to use for lookup
+ */
+ protected void getAnnotationsInWindow( final JCas jcas, final Annotation window,
+ final List<FastLookupToken> allTokens,
+ final List<Integer> lookupTokenIndices ) {
+ final List<BaseToken> allBaseTokens = org.uimafit.util.JCasUtil.selectCovered( jcas, BaseToken.class, window );
+ for ( BaseToken baseToken : allBaseTokens ) {
+ if ( baseToken instanceof NewlineToken ) {
+ continue;
+ }
+ final boolean isNonLookup = baseToken instanceof PunctuationToken
+ || baseToken instanceof NumberToken
+ || baseToken instanceof ContractionToken
+ || baseToken instanceof SymbolToken;
+ // We are only interested in tokens that are -words-
+ // getEnd() and getBegin() are both inclusive, so end - begin is actually text.length()-1
+ if ( !isNonLookup && baseToken.getEnd() - baseToken.getBegin() + 1 >= _minimumLookupSpan ) {
+ // POS exclusion logic for first word lookup
+ final String partOfSpeech = baseToken.getPartOfSpeech();
+ if ( partOfSpeech == null || !_exclusionPartsOfSpeech.contains( partOfSpeech ) ) {
+ lookupTokenIndices.add( allTokens.size() );
+ }
+ }
+ final FastLookupToken lookupToken = new FastLookupToken( baseToken );
+ allTokens.add( lookupToken );
+ }
+ }
+
+
+
+
+
+
+ protected int parseInt( final String text, final String name, final int defaultValue ) {
+ try {
+ return Integer.parseInt( text );
+ } catch ( NumberFormatException nfE ) {
+ _logger.warn( "Could not parse " + name + " " + text + " as an integer" );
+ }
+ return defaultValue;
+ }
+
+
+}
Propchange: ctakes/sandbox/ctakes-dictionary-lookup2/src/main/java/org/apache/ctakes/dictionary/lookup2/ae/AbstractJCasTermAnnotator.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: ctakes/sandbox/ctakes-dictionary-lookup2/src/main/java/org/apache/ctakes/dictionary/lookup2/ae/DefaultJCasTermAnnotator.java
URL: http://svn.apache.org/viewvc/ctakes/sandbox/ctakes-dictionary-lookup2/src/main/java/org/apache/ctakes/dictionary/lookup2/ae/DefaultJCasTermAnnotator.java?rev=1571820&view=auto
==============================================================================
--- ctakes/sandbox/ctakes-dictionary-lookup2/src/main/java/org/apache/ctakes/dictionary/lookup2/ae/DefaultJCasTermAnnotator.java (added)
+++ ctakes/sandbox/ctakes-dictionary-lookup2/src/main/java/org/apache/ctakes/dictionary/lookup2/ae/DefaultJCasTermAnnotator.java Tue Feb 25 20:54:25 2014
@@ -0,0 +1,73 @@
+/**
+ * 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.
+ */
+package org.apache.ctakes.dictionary.lookup2.ae;
+
+import org.apache.ctakes.dictionary.lookup2.dictionary.RareWordDictionary;
+import org.apache.ctakes.dictionary.lookup2.term.RareWordTerm;
+import org.apache.ctakes.dictionary.lookup2.term.SpannedRareWordTerm;
+import org.apache.ctakes.dictionary.lookup2.util.FastLookupToken;
+import org.apache.ctakes.dictionary.lookup2.util.TokenMatchUtil;
+
+import java.util.Collection;
+import java.util.List;
+
+/**
+ * A direct string match using phrase permutations
+ * Author: SPF
+ * Affiliation: CHIP-NLP
+ * Date: 11/19/13
+ */
+final public class DefaultJCasTermAnnotator extends AbstractJCasTermAnnotator {
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void findTerms( final RareWordDictionary dictionary,
+ final List<FastLookupToken> allTokens, final List<Integer> lookupTokenIndices,
+ final Collection<SpannedRareWordTerm> termsFromDictionary ) {
+ Collection<RareWordTerm> rareWordHits;
+ for ( Integer lookupTokenIndex : lookupTokenIndices ) {
+ final FastLookupToken lookupToken = allTokens.get( lookupTokenIndex );
+ rareWordHits = dictionary.getRareWordHits( lookupToken );
+ if ( rareWordHits == null || rareWordHits.isEmpty() ) {
+ continue;
+ }
+ for ( RareWordTerm rareWordHit : rareWordHits ) {
+ if ( rareWordHit.getTokenCount() == 1 ) {
+ // Single word term, add and move on
+ termsFromDictionary.add( new SpannedRareWordTerm( rareWordHit, lookupToken.getTextSpan() ) );
+ continue;
+ }
+ final int termStartIndex = lookupTokenIndex - rareWordHit.getRareWordIndex();
+ if ( termStartIndex < 0 || termStartIndex + rareWordHit.getTokenCount() > allTokens.size() ) {
+ // term will extend beyond window
+ continue;
+ }
+ final int termEndIndex = termStartIndex + rareWordHit.getTokenCount() - 1;
+ if ( TokenMatchUtil.isTermMatch( rareWordHit, allTokens, termStartIndex, termEndIndex ) ) {
+ final int spanStart = allTokens.get( termStartIndex ).getStart();
+ final int spanEnd = allTokens.get( termEndIndex ).getEnd();
+ termsFromDictionary.add( new SpannedRareWordTerm( rareWordHit, spanStart, spanEnd ) );
+ }
+ }
+ }
+ }
+
+}
Propchange: ctakes/sandbox/ctakes-dictionary-lookup2/src/main/java/org/apache/ctakes/dictionary/lookup2/ae/DefaultJCasTermAnnotator.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: ctakes/sandbox/ctakes-dictionary-lookup2/src/main/java/org/apache/ctakes/dictionary/lookup2/ae/JCasTermAnnotator.java
URL: http://svn.apache.org/viewvc/ctakes/sandbox/ctakes-dictionary-lookup2/src/main/java/org/apache/ctakes/dictionary/lookup2/ae/JCasTermAnnotator.java?rev=1571820&view=auto
==============================================================================
--- ctakes/sandbox/ctakes-dictionary-lookup2/src/main/java/org/apache/ctakes/dictionary/lookup2/ae/JCasTermAnnotator.java (added)
+++ ctakes/sandbox/ctakes-dictionary-lookup2/src/main/java/org/apache/ctakes/dictionary/lookup2/ae/JCasTermAnnotator.java Tue Feb 25 20:54:25 2014
@@ -0,0 +1,43 @@
+/**
+ * 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.
+ */
+package org.apache.ctakes.dictionary.lookup2.ae;
+
+import org.apache.ctakes.dictionary.lookup2.dictionary.RareWordDictionary;
+import org.apache.uima.analysis_component.AnalysisComponent;
+
+import java.util.Collection;
+
+/**
+ * An annotator that looks up dictionary terms in text using
+ * {@link org.apache.ctakes.dictionary.lookup2.dictionary.RareWordDictionary} s
+ * and adds them as entities to the Cas using a {@link org.apache.ctakes.dictionary.lookup2.consumer.TermConsumer}
+ * Author: SPF
+ * Affiliation: CHIP-NLP
+ * Date: 2/24/14
+ */
+public interface JCasTermAnnotator extends AnalysisComponent {
+
+ static public final String LOOKUP_DESCRIPTOR_KEY = "RareWordTermsDescriptor";
+
+ /**
+ * @return Dictionaries that are used by this WindowProcessor
+ */
+ public Collection<RareWordDictionary> getDictionaries();
+
+}
Propchange: ctakes/sandbox/ctakes-dictionary-lookup2/src/main/java/org/apache/ctakes/dictionary/lookup2/ae/JCasTermAnnotator.java
------------------------------------------------------------------------------
svn:eol-style = native