entity-mapper – Entity Mapper#

Description#

Entity Mapper or entity-mapper is the command line utility provided by the eot-wowool-sdk Python package allowing you to easily use the functionality of the Entity Mapper application.

The Entity Mapper application, like its name very much suggests, produces a mapping of entities found in the document.

Example#

Mapping world regions to facilities can be done using:

entity_mapper -p 'english,entity' \
              -i "John Smith works for EyeOnText. He works also for IBM." \
              --lhs Person \
              --rhs Company

yielding:

[
    {"Person": "John Smith", "Company": "EyeOnText"},
    {"Person": "John Smith", "Company": "IBM"}
]

You can use the field parameter to assign you own fields, like the document id or the gender of the person.

entity_mapper -p 'english,entity' \
              -i "John Smith works for EyeOnText. He works also for IBM." \
              --lhs Person \
              --rhs Company \
              --fields "id=document.id,Person,gender=Person.gender,Company"
[
    {"id": "stream_id_613420399071901962", "Person": "John Smith", "gender": "male", "Company": "EyeOnText"},
    {"id": "stream_id_613420399071901962", "Person": "John Smith", "gender": "male", "Company": "IBM"}
]

For more information, refer to the JSON schema.

Usage#

usage: entity-mapper [-h] [-f FILE] [-i TEXT] -p PIPELINE [--lhs LHS]
                     [--rhs RHS] [--fields FIELDS] [--scopes SCOPES]
                     [--slots SLOTS] [-o OUTPUT] [-s]

Named Arguments#

-f, --file

folder or file

-i, --text

The input text to process

-p, --pipeline

pipeline description

--lhs

Left hand side

--rhs

Right hand side

--fields

A Comma delimited list of fields you want to have in your results. Format:field1,field2,field3 to use f-string: field1={row[‘field_name’]},field2,field3

--scopes

The list of sentence indices relative to the lhs concept you want to find the rhs concepts

--slots

The list of concept that stay alive during the mapping ex: [‘Date’, ‘UserName’]

-o, --output

The output file to save your results (.csv, .json )

-s, --silent

Do not print individual data sets

Default: False