[GitHub] any23 pull request #34: ANY23-304 Add extractor for OpenIE

2017-08-23 Thread asfgit
Github user asfgit closed the pull request at:

https://github.com/apache/any23/pull/34


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] any23 pull request #34: ANY23-304 Add extractor for OpenIE

2017-03-01 Thread lewismc
Github user lewismc commented on a diff in the pull request:

https://github.com/apache/any23/pull/34#discussion_r103832543
  
--- Diff: 
openie/src/test/java/org/apache/any23/openie/OpenIEExtractorTest.java ---
@@ -0,0 +1,88 @@
+/*
+ * 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.any23.openie;
+
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+
+import org.apache.any23.extractor.ExtractionContext;
+import org.apache.any23.extractor.ExtractionException;
+import org.apache.any23.extractor.ExtractionParameters;
+import org.apache.any23.extractor.ExtractionResult;
+import org.apache.any23.extractor.ExtractionResultImpl;
+import org.apache.any23.extractor.openie.OpenIEExtractor;
+import org.apache.any23.rdf.RDFUtils;
+import org.apache.any23.util.StreamUtils;
+import org.apache.any23.writer.RDFXMLWriter;
+import org.apache.any23.writer.TripleHandler;
+import org.apache.any23.writer.TripleHandlerException;
+import org.eclipse.rdf4j.model.IRI;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * @author lewismc
+ *
+ */
+public class OpenIEExtractorTest {
+
+private static final Logger logger = 
LoggerFactory.getLogger(OpenIEExtractorTest.class);
+
+private OpenIEExtractor extractor;
+
+@Before
+public void setUp() throws Exception {
+extractor = new OpenIEExtractor();
+}
+
+@After
+public void tearDown() throws Exception {
+extractor = null;
+}
+
+//@Ignore("This typically results in a JVM crash... disabled for the 
time being.")
+@Test
+public void testExtractFromHTMLDocument() 
+  throws IOException, ExtractionException, TripleHandlerException {
+final IRI uri = 
RDFUtils.iri("http://podaac.jpl.nasa.gov/aquarius;);
+extract(uri, 
"/org/apache/any23/extractor/openie/example-openie.html");
+}
+
+public void extract(IRI uri, String filePath) 
+  throws IOException, ExtractionException, TripleHandlerException {
+  ByteArrayOutputStream baos = new ByteArrayOutputStream();
--- End diff --

OK I get you and yes this makes pefect sense.

> Does the model load on every call to the CLI?

... yes... which I realize is far from ideal. The issue with this as well 
is that it will load on every document AFAIK so this is a major limitation of 
the approach as it currently sits.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] any23 pull request #34: ANY23-304 Add extractor for OpenIE

2017-03-01 Thread ansell
Github user ansell commented on a diff in the pull request:

https://github.com/apache/any23/pull/34#discussion_r103832125
  
--- Diff: 
openie/src/test/java/org/apache/any23/openie/OpenIEExtractorTest.java ---
@@ -0,0 +1,88 @@
+/*
+ * 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.any23.openie;
+
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+
+import org.apache.any23.extractor.ExtractionContext;
+import org.apache.any23.extractor.ExtractionException;
+import org.apache.any23.extractor.ExtractionParameters;
+import org.apache.any23.extractor.ExtractionResult;
+import org.apache.any23.extractor.ExtractionResultImpl;
+import org.apache.any23.extractor.openie.OpenIEExtractor;
+import org.apache.any23.rdf.RDFUtils;
+import org.apache.any23.util.StreamUtils;
+import org.apache.any23.writer.RDFXMLWriter;
+import org.apache.any23.writer.TripleHandler;
+import org.apache.any23.writer.TripleHandlerException;
+import org.eclipse.rdf4j.model.IRI;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * @author lewismc
+ *
+ */
+public class OpenIEExtractorTest {
+
+private static final Logger logger = 
LoggerFactory.getLogger(OpenIEExtractorTest.class);
+
+private OpenIEExtractor extractor;
+
+@Before
+public void setUp() throws Exception {
+extractor = new OpenIEExtractor();
+}
+
+@After
+public void tearDown() throws Exception {
+extractor = null;
+}
+
+//@Ignore("This typically results in a JVM crash... disabled for the 
time being.")
+@Test
+public void testExtractFromHTMLDocument() 
+  throws IOException, ExtractionException, TripleHandlerException {
+final IRI uri = 
RDFUtils.iri("http://podaac.jpl.nasa.gov/aquarius;);
+extract(uri, 
"/org/apache/any23/extractor/openie/example-openie.html");
+}
+
+public void extract(IRI uri, String filePath) 
+  throws IOException, ExtractionException, TripleHandlerException {
+  ByteArrayOutputStream baos = new ByteArrayOutputStream();
--- End diff --

ByteArrayOutputStream will hold all of the results in memory. It may be 
useful to create a temporary file and reference it as a FileOutputStream, which 
will have a fixed memory buffer before writing to disk. Just trying to work 
through the possible avenues where memory requirements can be managed. It may 
be useful to work through in a debugger to identity the large memory 
requirement and where that can be lowered, as hopefully the CLI can still be 
used on small machines after this pull request. Does the model load on every 
call to the CLI?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] any23 pull request #34: ANY23-304 Add extractor for OpenIE

2017-03-01 Thread lewismc
Github user lewismc commented on a diff in the pull request:

https://github.com/apache/any23/pull/34#discussion_r103829816
  
--- Diff: 
openie/src/main/java/org/apache/any23/extractor/openie/OpenIEExtractor.java ---
@@ -0,0 +1,129 @@
+/*
+ * 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.any23.extractor.openie;
+
+import java.io.IOException;
+import java.util.List;
+
+import javax.xml.transform.TransformerConfigurationException;
+import javax.xml.transform.TransformerFactoryConfigurationError;
+
+import org.apache.any23.extractor.Extractor;
+import org.apache.any23.configuration.Configuration;
+import org.apache.any23.configuration.DefaultConfiguration;
+import org.apache.any23.extractor.ExtractionContext;
+import org.apache.any23.extractor.ExtractorDescription;
+import org.apache.any23.rdf.RDFUtils;
+import org.apache.any23.util.StreamUtils;
+import org.apache.tika.Tika;
+import org.apache.tika.exception.TikaException;
+import org.eclipse.rdf4j.model.IRI;
+import org.eclipse.rdf4j.model.Resource;
+import org.eclipse.rdf4j.model.Value;
+import org.eclipse.rdf4j.model.vocabulary.RDF;
+import org.eclipse.rdf4j.model.vocabulary.RDFS;
+import org.apache.any23.extractor.ExtractionException;
+import org.apache.any23.extractor.ExtractionParameters;
+import org.apache.any23.extractor.ExtractionResult;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.w3c.dom.Document;
+
+import edu.knowitall.openie.Argument;
+import edu.knowitall.openie.Instance;
+import edu.knowitall.openie.OpenIE;
+import edu.knowitall.tool.parse.ClearParser;
+import edu.knowitall.tool.postag.ClearPostagger;
+import edu.knowitall.tool.srl.ClearSrl;
+import edu.knowitall.tool.tokenize.ClearTokenizer;
+import scala.collection.JavaConversions;
+import scala.collection.Seq;
+
+/**
+ * An https://github.com/allenai/openie-standalone;>OpenIE 
+ * extractor able to generate RDF statements from 
+ * sentences representing relations in the text.
+ */
+public class OpenIEExtractor implements Extractor.TagSoupDOMExtractor {
+
+private static final Logger LOG = 
LoggerFactory.getLogger(OpenIEExtractor.class);
+
+private IRI documentRoot;
+
+/**
+ * default constructor
+ */
+public OpenIEExtractor() {
+// default constructor
+}
+
+/**
+ * @see org.apache.any23.extractor.Extractor#getDescription()
+ */
+@Override
+public ExtractorDescription getDescription() {
+return OpenIEExtractorFactory.getDescriptionInstance();
+}
+
+@Override
+public void run(ExtractionParameters extractionParameters,
+ExtractionContext context, Document in, ExtractionResult out)
+throws IOException, ExtractionException {
+
+IRI documentIRI = context.getDocumentIRI();
+documentRoot = RDFUtils.iri(documentIRI.toString() + "root");
+out.writeNamespace(RDF.PREFIX, RDF.NAMESPACE);
+out.writeNamespace(RDFS.PREFIX, RDFS.NAMESPACE);
+LOG.debug("Processing: {}", documentIRI.toString());
+
+OpenIE openIE = new OpenIE(
+new ClearParser(
+new ClearPostagger(
+new ClearTokenizer())), new ClearSrl(), 
false, false);
+
+Seq extractions = null;
+Tika tika = new Tika();
+try {
+extractions = 
openIE.extract(tika.parseToString(StreamUtils.documentToInputStream(in)));
+} catch (TransformerConfigurationException | 
TransformerFactoryConfigurationError e) {
+LOG.error("Encountered error during OpenIE extraction.", e);
+} catch (TikaException e) {
+LOG.error("Encountered error whilst parsing InputStream with 
Tika.", e);
+}
+
+List listExtractions = 

[GitHub] any23 pull request #34: ANY23-304 Add extractor for OpenIE

2017-03-01 Thread ansell
Github user ansell commented on a diff in the pull request:

https://github.com/apache/any23/pull/34#discussion_r103806632
  
--- Diff: 
openie/src/test/java/org/apache/any23/openie/OpenIEExtractorTest.java ---
@@ -0,0 +1,88 @@
+/*
+ * 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.any23.openie;
+
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+
+import org.apache.any23.extractor.ExtractionContext;
+import org.apache.any23.extractor.ExtractionException;
+import org.apache.any23.extractor.ExtractionParameters;
+import org.apache.any23.extractor.ExtractionResult;
+import org.apache.any23.extractor.ExtractionResultImpl;
+import org.apache.any23.extractor.openie.OpenIEExtractor;
+import org.apache.any23.rdf.RDFUtils;
+import org.apache.any23.util.StreamUtils;
+import org.apache.any23.writer.RDFXMLWriter;
+import org.apache.any23.writer.TripleHandler;
+import org.apache.any23.writer.TripleHandlerException;
+import org.eclipse.rdf4j.model.IRI;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * @author lewismc
+ *
+ */
+public class OpenIEExtractorTest {
+
+private static final Logger logger = 
LoggerFactory.getLogger(OpenIEExtractorTest.class);
+
+private OpenIEExtractor extractor;
+
+@Before
+public void setUp() throws Exception {
+extractor = new OpenIEExtractor();
+}
+
+@After
+public void tearDown() throws Exception {
+extractor = null;
+}
+
+//@Ignore("This typically results in a JVM crash... disabled for the 
time being.")
+@Test
+public void testExtractFromHTMLDocument() 
+  throws IOException, ExtractionException, TripleHandlerException {
+final IRI uri = 
RDFUtils.iri("http://podaac.jpl.nasa.gov/aquarius;);
+extract(uri, 
"/org/apache/any23/extractor/openie/example-openie.html");
+}
+
+public void extract(IRI uri, String filePath) 
+  throws IOException, ExtractionException, TripleHandlerException {
+  ByteArrayOutputStream baos = new ByteArrayOutputStream();
--- End diff --

Writing to a file instead of ByteArrayOutputStream may alleviate some of 
the memory pressures.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] any23 pull request #34: ANY23-304 Add extractor for OpenIE

2017-03-01 Thread ansell
Github user ansell commented on a diff in the pull request:

https://github.com/apache/any23/pull/34#discussion_r103806389
  
--- Diff: 
openie/src/main/java/org/apache/any23/extractor/openie/OpenIEExtractor.java ---
@@ -0,0 +1,129 @@
+/*
+ * 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.any23.extractor.openie;
+
+import java.io.IOException;
+import java.util.List;
+
+import javax.xml.transform.TransformerConfigurationException;
+import javax.xml.transform.TransformerFactoryConfigurationError;
+
+import org.apache.any23.extractor.Extractor;
+import org.apache.any23.configuration.Configuration;
+import org.apache.any23.configuration.DefaultConfiguration;
+import org.apache.any23.extractor.ExtractionContext;
+import org.apache.any23.extractor.ExtractorDescription;
+import org.apache.any23.rdf.RDFUtils;
+import org.apache.any23.util.StreamUtils;
+import org.apache.tika.Tika;
+import org.apache.tika.exception.TikaException;
+import org.eclipse.rdf4j.model.IRI;
+import org.eclipse.rdf4j.model.Resource;
+import org.eclipse.rdf4j.model.Value;
+import org.eclipse.rdf4j.model.vocabulary.RDF;
+import org.eclipse.rdf4j.model.vocabulary.RDFS;
+import org.apache.any23.extractor.ExtractionException;
+import org.apache.any23.extractor.ExtractionParameters;
+import org.apache.any23.extractor.ExtractionResult;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.w3c.dom.Document;
+
+import edu.knowitall.openie.Argument;
+import edu.knowitall.openie.Instance;
+import edu.knowitall.openie.OpenIE;
+import edu.knowitall.tool.parse.ClearParser;
+import edu.knowitall.tool.postag.ClearPostagger;
+import edu.knowitall.tool.srl.ClearSrl;
+import edu.knowitall.tool.tokenize.ClearTokenizer;
+import scala.collection.JavaConversions;
+import scala.collection.Seq;
+
+/**
+ * An https://github.com/allenai/openie-standalone;>OpenIE 
+ * extractor able to generate RDF statements from 
+ * sentences representing relations in the text.
+ */
+public class OpenIEExtractor implements Extractor.TagSoupDOMExtractor {
+
+private static final Logger LOG = 
LoggerFactory.getLogger(OpenIEExtractor.class);
+
+private IRI documentRoot;
+
+/**
+ * default constructor
+ */
+public OpenIEExtractor() {
+// default constructor
+}
+
+/**
+ * @see org.apache.any23.extractor.Extractor#getDescription()
+ */
+@Override
+public ExtractorDescription getDescription() {
+return OpenIEExtractorFactory.getDescriptionInstance();
+}
+
+@Override
+public void run(ExtractionParameters extractionParameters,
+ExtractionContext context, Document in, ExtractionResult out)
+throws IOException, ExtractionException {
+
+IRI documentIRI = context.getDocumentIRI();
+documentRoot = RDFUtils.iri(documentIRI.toString() + "root");
+out.writeNamespace(RDF.PREFIX, RDF.NAMESPACE);
+out.writeNamespace(RDFS.PREFIX, RDFS.NAMESPACE);
+LOG.debug("Processing: {}", documentIRI.toString());
+
+OpenIE openIE = new OpenIE(
+new ClearParser(
+new ClearPostagger(
+new ClearTokenizer())), new ClearSrl(), 
false, false);
+
+Seq extractions = null;
+Tika tika = new Tika();
+try {
+extractions = 
openIE.extract(tika.parseToString(StreamUtils.documentToInputStream(in)));
+} catch (TransformerConfigurationException | 
TransformerFactoryConfigurationError e) {
+LOG.error("Encountered error during OpenIE extraction.", e);
+} catch (TikaException e) {
+LOG.error("Encountered error whilst parsing InputStream with 
Tika.", e);
+}
+
+List listExtractions = 

[GitHub] any23 pull request #34: ANY23-304 Add extractor for OpenIE

2017-03-01 Thread ansell
Github user ansell commented on a diff in the pull request:

https://github.com/apache/any23/pull/34#discussion_r103806159
  
--- Diff: 
openie/src/main/java/org/apache/any23/extractor/openie/OpenIEExtractor.java ---
@@ -0,0 +1,129 @@
+/*
+ * 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.any23.extractor.openie;
+
+import java.io.IOException;
+import java.util.List;
+
+import javax.xml.transform.TransformerConfigurationException;
+import javax.xml.transform.TransformerFactoryConfigurationError;
+
+import org.apache.any23.extractor.Extractor;
+import org.apache.any23.configuration.Configuration;
+import org.apache.any23.configuration.DefaultConfiguration;
+import org.apache.any23.extractor.ExtractionContext;
+import org.apache.any23.extractor.ExtractorDescription;
+import org.apache.any23.rdf.RDFUtils;
+import org.apache.any23.util.StreamUtils;
+import org.apache.tika.Tika;
+import org.apache.tika.exception.TikaException;
+import org.eclipse.rdf4j.model.IRI;
+import org.eclipse.rdf4j.model.Resource;
+import org.eclipse.rdf4j.model.Value;
+import org.eclipse.rdf4j.model.vocabulary.RDF;
+import org.eclipse.rdf4j.model.vocabulary.RDFS;
+import org.apache.any23.extractor.ExtractionException;
+import org.apache.any23.extractor.ExtractionParameters;
+import org.apache.any23.extractor.ExtractionResult;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.w3c.dom.Document;
+
+import edu.knowitall.openie.Argument;
+import edu.knowitall.openie.Instance;
+import edu.knowitall.openie.OpenIE;
+import edu.knowitall.tool.parse.ClearParser;
+import edu.knowitall.tool.postag.ClearPostagger;
+import edu.knowitall.tool.srl.ClearSrl;
+import edu.knowitall.tool.tokenize.ClearTokenizer;
+import scala.collection.JavaConversions;
+import scala.collection.Seq;
+
+/**
+ * An https://github.com/allenai/openie-standalone;>OpenIE 
+ * extractor able to generate RDF statements from 
+ * sentences representing relations in the text.
+ */
+public class OpenIEExtractor implements Extractor.TagSoupDOMExtractor {
+
+private static final Logger LOG = 
LoggerFactory.getLogger(OpenIEExtractor.class);
+
+private IRI documentRoot;
+
+/**
+ * default constructor
+ */
+public OpenIEExtractor() {
+// default constructor
+}
+
+/**
+ * @see org.apache.any23.extractor.Extractor#getDescription()
+ */
+@Override
+public ExtractorDescription getDescription() {
+return OpenIEExtractorFactory.getDescriptionInstance();
+}
+
+@Override
+public void run(ExtractionParameters extractionParameters,
+ExtractionContext context, Document in, ExtractionResult out)
+throws IOException, ExtractionException {
+
+IRI documentIRI = context.getDocumentIRI();
+documentRoot = RDFUtils.iri(documentIRI.toString() + "root");
+out.writeNamespace(RDF.PREFIX, RDF.NAMESPACE);
+out.writeNamespace(RDFS.PREFIX, RDFS.NAMESPACE);
+LOG.debug("Processing: {}", documentIRI.toString());
+
+OpenIE openIE = new OpenIE(
+new ClearParser(
+new ClearPostagger(
+new ClearTokenizer())), new ClearSrl(), 
false, false);
+
+Seq extractions = null;
+Tika tika = new Tika();
+try {
+extractions = 
openIE.extract(tika.parseToString(StreamUtils.documentToInputStream(in)));
+} catch (TransformerConfigurationException | 
TransformerFactoryConfigurationError e) {
+LOG.error("Encountered error during OpenIE extraction.", e);
+} catch (TikaException e) {
+LOG.error("Encountered error whilst parsing InputStream with 
Tika.", e);
+}
+
+List listExtractions = 

[GitHub] any23 pull request #34: ANY23-304 Add extractor for OpenIE

2017-02-23 Thread lewismc
GitHub user lewismc opened a pull request:

https://github.com/apache/any23/pull/34

ANY23-304 Add extractor for OpenIE

Hi Folks,
This issue is a rework of #33 which takes on board @ansell 's comments to 
add the new extractor as a separate module as oppose to inside of core. 
There are a number of classes which are cleaned up for JDK1.8 compliance.
In addition, this new functionality augments the default configuration by 
introducing a threshold for OpenIE extractions of 0.5. Anything below this 
value is not converted into triples.
I run a test extraction on a reasonably testing Webpage from the 
[PO.DAAC](http://podaac.jpl.nasa.gov/aquarius) but right now i am not asserting 
anything.
As far as I can see this is working pretty well but some community review 
would go a long way.

You can merge this pull request into a Git repository by running:

$ git pull https://github.com/lewismc/any23 ANY23-304

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/any23/pull/34.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

This closes #34


commit 2ecfbff1dddaf57689b725feddba47c7921f726d
Author: Lewis John McGibbney 
Date:   2017-02-24T01:26:03Z

ANY23-304 Add extractor for OpenIE




---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---