Entity Mapper Application#
Application ID
eot_entity_mapper
Application Aliases
entity-mapper.app mapper.app eot/mapper.app eot/entity-mapper.app
Description#
The Entity Mapper application, like its name very much suggests, produces a mapping of entities found in the document.
Configuration#
The configuration is an object defined as (bold = required, italic = optional):
lhs (
string
) – The left hand side URI of the mapping, e.g."Person"
, which means results should center aroundPerson
conceptsrhs (
array[string]
) – The right hand side is a list of URIs that have a relation with the lhsfield (
array[string]
) – A list of fields that should be present in the results, e.g.["Person", "Company"]
. See fields for more advanced usagescopes (
array[string|int]
) – A list of concepts that overlap the lhs and rhs concepts, e.g.["PersonPosition"]
. This is used to restrict/expand the mappings. If the values are int then they are relative sentence indexes.slots (
array[string]
) – A list of concepts that stay alive during the mapping, e.g.["Date", "UserName"]
Fields#
Fields represent the selected data in your results. Usually this corresponds to the concept names, but you can specify the data of a field by assigning it. For example, gender=Person.gender
, where gender
is the name of your field and Person.gender
is the data. The following can be used to format fields:
Variables: There is also a predefined variable for the document id, accessible via
document.id
Functions:
upper
,lower
,title
,stem
,canonical
Example:
--fields "id=document.id.stem.upper,gender=Person.gender.upper"
Scopes#
The scopes are used to restrict or expand the mappings. You can create a concept that overlap Person and Position when they are related.
// John Dow is the CEO of EyeOnText.
rule: { Person 'be' Position } = PersonPosition;
Example:
--scope "PersonPosition"
You can have different types of scopes. Either the value is a str like the example above or if you pass a digit it will be interpreted as a relative sentence index.
As the Position is in the next sentence you can set the scope to on.
John Dow. Is the CEO of EyeOnText.
Example:
--scope 1
Slots#
Slots are like mementos: things you have seen and want to remember at a later stage. It is used as a means to link to items that have previously been encountered in the document, but are not present in the sentence that is currently being processed. Put differently: it’s a list of items - slots - where each slot corresponds to a concept URI and contains the last thing you have seen of that type. For instance, in job postings, you might want to remember the position and then add the hard and soft skills required for that position.
Example#
Mapping the name of a Person
to a Company
:
wow -p 'english,entity,mapper(lhs="Person", rhs=["Company"]).app' \
-i "John Smith works for EyeOnText."
which yields:
[
{
"Person": "John Smith",
"Company": "EyeOnText"
}
]
For an interpretation of the JSON data, refer to the application’s JSON schema.