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 2017/08/09 03:14:46 UTC
svn commit: r1804483 - in /ctakes/trunk:
ctakes-core-res/src/main/resources/org/apache/ctakes/core/list/
ctakes-core/src/main/java/org/apache/ctakes/core/pipeline/
ctakes-core/src/main/java/org/apache/ctakes/core/resource/
ctakes-dictionary-lookup-fast...
Author: seanfinan
Date: Wed Aug 9 03:14:45 2017
New Revision: 1804483
URL: http://svn.apache.org/viewvc?rev=1804483&view=rev
Log:
PiperFileReader add current piper directory even if specification is relative
FileLocator add getFileQuiet( String )
DefaultListRegex slight modifications to regex spacing
DictionaryDescriptorParser trim provided class names
ExampleDict stupid commit "reformat" rearranges xml
Modified:
ctakes/trunk/ctakes-core-res/src/main/resources/org/apache/ctakes/core/list/DefaultListRegex.bsv
ctakes/trunk/ctakes-core/src/main/java/org/apache/ctakes/core/pipeline/PiperFileReader.java
ctakes/trunk/ctakes-core/src/main/java/org/apache/ctakes/core/resource/FileLocator.java
ctakes/trunk/ctakes-dictionary-lookup-fast/src/main/java/org/apache/ctakes/dictionary/lookup2/dictionary/DictionaryDescriptorParser.java
ctakes/trunk/ctakes-examples-res/src/main/resources/org/apache/ctakes/examples/dictionary/lookup/fast/ExampleDict.xml
Modified: ctakes/trunk/ctakes-core-res/src/main/resources/org/apache/ctakes/core/list/DefaultListRegex.bsv
URL: http://svn.apache.org/viewvc/ctakes/trunk/ctakes-core-res/src/main/resources/org/apache/ctakes/core/list/DefaultListRegex.bsv?rev=1804483&r1=1804482&r2=1804483&view=diff
==============================================================================
--- ctakes/trunk/ctakes-core-res/src/main/resources/org/apache/ctakes/core/list/DefaultListRegex.bsv (original)
+++ ctakes/trunk/ctakes-core-res/src/main/resources/org/apache/ctakes/core/list/DefaultListRegex.bsv Wed Aug 9 03:14:45 2017
@@ -2,9 +2,9 @@ Numbered||(?:^[\t ]*[\d]{1,2}(?::|\.)[\t
Alpha Sentence||(?:^[\t ]*[A-Z](?::|\.)+\)?[\t ]+(?:[^\t\n\.]+(?:\.|\n))+\r?\n){2,}||^[\t ]*[A-Z](?::|\.)+\)?[\t ]+(?:[^\t\n\.]+(?:\.|\n))+\r?\n
// Name Value||(?:^[^\t\r\n]{2,50}:[\t ]+(?:[^\t\r\n:]+\r?\n)+){3,}||^[^\t\r\n]{2,50}:[\t ]+(?:[^\t\r\n:]+\r?\n)+
Name Value||(?:^[^\r\n:]{2,}:[\s]+[^\r\n]+\r?\n){2,}||^[^\r\n:]{2,80}:[\s]+[^\r\n]+\r?\n
-Multi Column||(?:^(?:[^\t\r\n :]+(?: [^\t\r\n :]+)*(?:\t+| {3,}))+(?:[^\t\r\n ]+(?: [^\t\r\n ]+)*)[\t ]*\r?\n){3,}||\r?\n
-// Mixed Column||(?:^(?:[^\t\r\n :]+(?: [^\t\r\n :]+)*(?:\t+| {3,}))+(?:[^\t\r\n ]+(?: [^\t\r\n ]+)*)[\t ]*\r?\n[\t ]*(?:[^\t\r\n ]+(?: [^\t\r\n ]+)*)[\t ]*\r?\n){3,}||[\r\n][\t ]*(?:[^\t\r\n ]+(?: [^\t\r\n ]+)*)[\t ]*\r?\n
+Multi Column||(?:^(?:[^\s:]+(?: [^\s:]+)*(?:\t+| {3,}))+(?:[^\s]+(?: [^\s]+)*)[\t ]*\r?\n){3,}||\r?\n
+// Mixed Column||(?:^(?:[^\s:]+(?: [^\s:]+)*(?:\t+| {3,}))+(?:[^\s]+(?: [^\s]+)*)[\t ]*\r?\n[\t ]*(?:[^\s]+(?: [^\s]+)*)[\t ]*\r?\n){3,}||[\r\n][\t ]*(?:[^\s]+(?: [^\s]+)*)[\t ]*\r?\n
// Header||(?:^[^\t\r\n\.]+\.{3,}[^\t\r\n\.]+\r?\n){3,}||\r?\n
Dash||(?:^[\t ]*-{1,3}[\t ]+(?:(?:[^\t\r\n-]+-?)+\r?\n){1,3}){2,}||^[\t ]*-{1,3}[\t ]+(?:(?:[^\t\r\n-]+-?)+\r?\n)+
Document Header||(?:^[^\t\r\n\.]+\.{3,}[^\t\r\n\.]+\r?\n){3,}||\r?\n
-Checkbox||(?:^(?:[^\r\n:]{2,80}:\r?\n)?(?:[\t ]*\[[X _]*\][^\r\n]+\r?\n)+)+||^(?:[^\r\n:]{2,80}:\r?\n)?(?:[\t ]*\[[X _]*\][^\r\n]+\r?\n)+
+Checkbox||(?:^(?:[^\r\n:]{2,80}:\r?\n)?(?:[\t ]*\[[XYN _]*\][^\r\n]+\r?\n)+)+||^(?:[^\r\n:]{2,80}:\r?\n)?(?:[\t ]*\[[XYN _]*\][^\r\n]+\r?\n)+
Modified: ctakes/trunk/ctakes-core/src/main/java/org/apache/ctakes/core/pipeline/PiperFileReader.java
URL: http://svn.apache.org/viewvc/ctakes/trunk/ctakes-core/src/main/java/org/apache/ctakes/core/pipeline/PiperFileReader.java?rev=1804483&r1=1804482&r2=1804483&view=diff
==============================================================================
--- ctakes/trunk/ctakes-core/src/main/java/org/apache/ctakes/core/pipeline/PiperFileReader.java (original)
+++ ctakes/trunk/ctakes-core/src/main/java/org/apache/ctakes/core/pipeline/PiperFileReader.java Wed Aug 9 03:14:45 2017
@@ -382,12 +382,20 @@ final public class PiperFileReader {
*/
public InputStream getPiperStream( final String filePath ) {
final File piperFile = new File( filePath );
+ String parentPath = null;
if ( piperFile.isAbsolute() ) {
- final String parentPath = piperFile.getParent();
- if ( parentPath != null && !parentPath.isEmpty() && !_userPackages.contains( parentPath ) ) {
- _userPackages.add( parentPath );
+ parentPath = piperFile.getParent();
+ } else {
+ try {
+ final File located = FileLocator.getFile( filePath );
+ parentPath = located.getParent();
+ } catch ( FileNotFoundException fnfE ) {
+ // do nothing
}
}
+ if ( parentPath != null && !parentPath.isEmpty() && !_userPackages.contains( parentPath ) ) {
+ _userPackages.add( parentPath );
+ }
InputStream stream = FileLocator.getStreamQuiet( filePath );
if ( stream != null ) {
return stream;
Modified: ctakes/trunk/ctakes-core/src/main/java/org/apache/ctakes/core/resource/FileLocator.java
URL: http://svn.apache.org/viewvc/ctakes/trunk/ctakes-core/src/main/java/org/apache/ctakes/core/resource/FileLocator.java?rev=1804483&r1=1804482&r2=1804483&view=diff
==============================================================================
--- ctakes/trunk/ctakes-core/src/main/java/org/apache/ctakes/core/resource/FileLocator.java (original)
+++ ctakes/trunk/ctakes-core/src/main/java/org/apache/ctakes/core/resource/FileLocator.java Wed Aug 9 03:14:45 2017
@@ -394,6 +394,21 @@ final public class FileLocator {
* 3. By resource stream in classpath
* If a stream is found then it is copied to a temporary file and that file is returned.
*
+ * @param location some string representing the full or partial location of a resource
+ * @return an file for the resource or null if none is found
+ */
+ static public File getFileQuiet( final String location ) {
+ return getFileQuiet( FileLocator.class, location );
+ }
+
+ /**
+ * Fetches file without throwing exceptions.
+ * Search order is by:
+ * 1. By file on filesystem
+ * 2. By resource url in classpath
+ * 3. By resource stream in classpath
+ * If a stream is found then it is copied to a temporary file and that file is returned.
+ *
* @param clazz some class whose classloader should be used
* @param location some string representing the full or partial location of a resource
* @return an file for the resource or null if none is found
Modified: ctakes/trunk/ctakes-dictionary-lookup-fast/src/main/java/org/apache/ctakes/dictionary/lookup2/dictionary/DictionaryDescriptorParser.java
URL: http://svn.apache.org/viewvc/ctakes/trunk/ctakes-dictionary-lookup-fast/src/main/java/org/apache/ctakes/dictionary/lookup2/dictionary/DictionaryDescriptorParser.java?rev=1804483&r1=1804482&r2=1804483&view=diff
==============================================================================
--- ctakes/trunk/ctakes-dictionary-lookup-fast/src/main/java/org/apache/ctakes/dictionary/lookup2/dictionary/DictionaryDescriptorParser.java (original)
+++ ctakes/trunk/ctakes-dictionary-lookup-fast/src/main/java/org/apache/ctakes/dictionary/lookup2/dictionary/DictionaryDescriptorParser.java Wed Aug 9 03:14:45 2017
@@ -30,7 +30,6 @@ import org.jdom.Element;
import org.jdom.JDOMException;
import org.jdom.input.SAXBuilder;
-import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.lang.reflect.Constructor;
@@ -176,7 +175,7 @@ final public class DictionaryDescriptorP
final Class[] constructionArgs = { String.class, UimaContext.class, Properties.class };
final String name = getName( "Dictionary Name", dictionaryElement );
- final String className = dictionaryElement.getChildText( IMPLEMENTATION_KEY );
+ final String className = dictionaryElement.getChildText( IMPLEMENTATION_KEY ).trim();
final Element propertiesElement = dictionaryElement.getChild( PROPERTIES_KEY );
final Properties properties = parsePropertiesXml( propertiesElement );
Class dictionaryClass;
@@ -241,7 +240,7 @@ final public class DictionaryDescriptorP
throws AnnotatorContextException {
final Class[] constructionArgs = { String.class, UimaContext.class, Properties.class };
final String name = getName( "Concept Factory Name", conceptFactoryElement );
- final String className = conceptFactoryElement.getChildText( IMPLEMENTATION_KEY );
+ final String className = conceptFactoryElement.getChildText( IMPLEMENTATION_KEY ).trim();
final Element propertiesElement = conceptFactoryElement.getChild( PROPERTIES_KEY );
final Properties properties = parsePropertiesXml( propertiesElement );
Class conceptFactoryClass;
@@ -310,7 +309,7 @@ final public class DictionaryDescriptorP
Class[] constrArgsConsum = { UimaContext.class, Properties.class, int.class };//ohnlp-Bugs-3296301
Class[] constrArgsConsumB = { UimaContext.class, Properties.class };
- String consumerClassName = lookupConsumerElement.getChildText( IMPLEMENTATION_KEY );
+ String consumerClassName = lookupConsumerElement.getChildText( IMPLEMENTATION_KEY ).trim();
Element consumerPropertiesElement = lookupConsumerElement.getChild( PROPERTIES_KEY );
Properties consumerProperties = parsePropertiesXml( consumerPropertiesElement );
Class consumerClass;
Modified: ctakes/trunk/ctakes-examples-res/src/main/resources/org/apache/ctakes/examples/dictionary/lookup/fast/ExampleDict.xml
URL: http://svn.apache.org/viewvc/ctakes/trunk/ctakes-examples-res/src/main/resources/org/apache/ctakes/examples/dictionary/lookup/fast/ExampleDict.xml?rev=1804483&r1=1804482&r2=1804483&view=diff
==============================================================================
--- ctakes/trunk/ctakes-examples-res/src/main/resources/org/apache/ctakes/examples/dictionary/lookup/fast/ExampleDict.xml (original)
+++ ctakes/trunk/ctakes-examples-res/src/main/resources/org/apache/ctakes/examples/dictionary/lookup/fast/ExampleDict.xml Wed Aug 9 03:14:45 2017
@@ -24,8 +24,7 @@
<dictionaries>
<dictionary>
<name>ExampleDict</name>
- <implementationName>org.apache.ctakes.dictionary.lookup2.dictionary.BsvRareWordDictionary
- </implementationName>
+ <implementationName>org.apache.ctakes.dictionary.lookup2.dictionary.BsvRareWordDictionary</implementationName>
<properties>
<property key="bsvPath" value="org/apache/ctakes/examples/dictionary/lookup/fast/ExampleDict.bsv"/>
</properties>