Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Table of Contents

Grobid Quantities with Tika

Grobid Quantities is a Java library used to recognize module of Grobid that specialised in the recognition of any expressions of measurements (e.g. pressure, temperature, etc.) in textual documents , parse, normalize and finally convert the measurements into SI units. It can be used on technical and scientific articles (text, XML and PDF input) and patents (text and XML input). such as PDF publications.
Measurements are parsed normalised and converted into SI units. 
To use its capabilities with Tika, one must install the server endpoint created for Grobid Quantities to extract measurement units from text passed to it.

Installation

Steps to install: Install Grobid Quantities by following the steps from github and make sure the quantity model is trained as per the instructions provided

After installing and training the model, start the REST server using the following command

Start Grobid Quantities Server

...


Installing Grobid-quantities

The best approach is to run Grobid-quantities via docker.

TLDR: The following command will start the grobid-quantities image on port 8060 (the default port for grobid-quantities):

docker run -t --rm --init -p 8060:8060 lfoppiano/grobid-quantities:${latest_grobid_quantities_version}

...

The server starts by default on port number 8080 8060 and the server can be seen running on http://127.0.0.1:80808060.

Preparing resources for Grobid

...

-quantities in Tika-App

...

The resources to be created are 2 files: tika-config.xml and GrobidServer.properties to be supplied later.

A predefined set of configuration files are available here:

Code Block
git clone https://github.com/lfoppiano/grobid-quantities-tika-parser-resources.git grobidquantities-parser-resources

Alternatively is possible to create the files automatically, as described below.

Manual configuration

Create Tika-config.xml

In order to use any of the NamedEntityParser implementations in Tika, the parser responsible for handling the name recognition task needs to be enabled.
This can be done

...

by creating the tika-config.xml file, as follows:

No Format
 <?xml version="1.0" encoding="UTF-8"?>
 <properties>
     <parsers>
         <parser class="org.apache.tika.parser.ner.NamedEntityParser">
             <mime>text/plain</mime>
             <mime>text/html</mime>
             <mime>application/xhtml+xml</mime>
         </parser>
     </parsers>
 </properties>
 

...

Create GrobidServer.properties

...

It is imperative that Tika should know on what host you are running the grobid-quantities-server. By default, Tika will assume your server runs on port

...

8060.
In order to specify any other port, you must supply a GrobidServer.properties  file.

...

No Format
grobid.server.url=http://localhost:

...

8060
grobid.endpoint.text=/processQuantityText

...


...

 

...

Running Grobid Quantities with Tika


No Format

export TIKA_APP={your/path/to/tika-app}/target/tika-app-1.13-SNAPSHOT.jar

#set the system property to use GrobidNERecogniser class
cd grobidquantities-parser-resources

java -Dner.impl.class=org.apache.tika.parser.ner.grobid.GrobidNERecogniser -classpath $GROBID_QUANTITIES_RES:$TIKA_APP.:tika-app-2.8.0.jar:tika-parser-nlp-package-2.8.0.jar org.apache.tika.cli.TikaCLI --config=$GROBID_QUANTITIES_RES/tika-config.xml -m  https://en.wikipedia.org/wiki/Time

...