.. _py_eot_wowool_tool_entity_mapper: EntityMapper API for Python *************************** .. autoclass:: eot.wowool.entity_mapper.EntityMapper :noindex: :members: :inherited-members: TO BE DONE: THE FOLLOWING IS NOT CORRECT, IT ASSUMES THE SDK BUT IS PLACED IN COMMON Driver (CLI) ============ The entity mapper comes with a CLI that can be used to generate a csv file with the given mappings. In this example we map the name of the person with either a Company or City using the english-entity domain. .. code-block:: console entity_mapper -p english,entity -i "John Dow works for EyeOnText in Antwerp." \ --lhs "Person" --rhs "Company,City" -o test.csv --attributes gender .. code-block:: json [ {"id": "stream_id_2199722368313370556", "Person": "John Dow", "Company": "EyeOnText", "gender": "male"}, {"id": "stream_id_2199722368313370556", "Person": "John Dow", "City": "Antwerp", "gender": "male"} ] .. code-block:: text id,Person,Company,gender stream_id_2199722368313370556,John Dow,EyeOnText,male stream_id_2199722368313370556,John Dow,,male Reformating the fields ~~~~~~~~~~~~~~~~~~~~~~ You can reformat the fields that will appear in the csv using the '--fields' attribute. Every field is comma separates, ex : "id,Person,Company,gender" But every field can be formatted using the f-string format, and you have access to the requested concepts as the complete row (dict). The format is. field_name={f-string},... .. code-block:: console entity_mapper.sdk -p english,entity -i "John Dow works for EyeOnText in Antwerp." \ --lhs "Person" --rhs "Company,City" -o test.csv --attributes gender \ --fields "id=document.id,Person,gender=Person.gender.upper" \ -o out.csv .. code-block:: text id,Person,gender STREAM_ID_4768304866666727575,John Dow,MALE STREAM_ID_4768304866666727575,John Dow,MALE If the ``id`` is a filename you can even use ``Path`` to format the id. In this example we only want the filename without extension. .. code-block:: console --fields "id=document.id,Person,gender=Person.gender.upper"