Using Stanford OpenIE with Ubuntu on VirtualBox

Use Vagrant and VirtualBox to set up a local Ubuntu installation. Run the VirtualBox, steps here.

In the command line, cd into /vagrant_data:

cd /vagrant_data

Install Java 8:

sudo apt-get update
sudo apt-get install openjdk-8-jdk

Download Stanford CoreNLP here and extract it.

cd into the stanford-corenlp directory and run the following:

java -mx1g -cp "*" edu.stanford.nlp.naturalli.OpenIE

cd back into cd /vagrant_data

Install minconda. Then install and run Jupyter notebook, steps here.

Install the following dependencies:

conda create -n entitylinks python=3.6
conda activate entitylinks
jupyter
pip install stanford-openie
pip install pycorenlp
conda install -c conda-forge pandas=1.0.3
conda install -c conda-forge numpy==1.18.2
conda install -c conda-forge matplotlib=3.2.1
conda install -c conda-forge tensorflow==1.8.0
conda install -c conda-forge tensorflow-hub==0.3.0
conda install -c conda-forge keras=2.1.6
conda install -c conda-forge nltk==3.4.5

Run the following in Jupyter Notebook (each sentence of string str1 will be split into triples):

from openie import StanfordOpenIE
from pycorenlp import StanfordCoreNLP

triples=[]

with StanfordOpenIE() as client:
    text = str1
    #print('Text: %s.' % text)
    for triple in client.annotate(text):
        urls.append(triple)

triples

Leave a Reply

Your email address will not be published. Required fields are marked *