In this example, we use the Ontology Matcher to create an annotation,
with value
my.annotation
for a document when there is a reference
to the brand
Coca-Cola
.
<Ontology xmlns="exa:com.exalead.mot.components.ontology">
<Pkg path="my.annotation">
<Entry display="Coca-Cola">
<Form level="exact" />
</Entry>
<Pkg path="subannotation">
<Entry display="Albert Einstein" lang="en">
<Form value="Albert E." level="normalized" />
</Entry>
</Pkg>
</Pkg>
<Pkg path="my.second.annotation">
<Entry display="Recherche et Développement" lang="fr">
<Form level="exact" distance="0" />
<Form level="lowercase" distance="1" />
<Form level="normalized" distance="2" />
<Form value="R&D" level="normalized" distance="3" />
<Form value="R & D" level="exact" distance="4" />
</Entry>
</Pkg>
</Ontology>
These Ontology rules would create the following annotations:
Input:
"Always Coca-Cola..."
Result: The annotation created is
displayForm=
"Coca-Cola"
tag=
"my.annotation" level=
"exact"
distance=
"0"
Input:
"always coca-cola..."
Result: No annotation is created since the match level is
set to
exact and
"Coca-Cola" != "coca-cola"
Input:
"the famous albert e." (lang=en)
Result: The annotation created is
displayForm="Albert Einstein"
tag=
"my.annotation.subannotation"
level=
"normalized"
distance=
"0"
Input:
"le célèbre albert e." (lang=fr)
Result: No annotation is created since the token is tagged
as French.
Input:
"recherche et développement"
Result: The annotation created is
displayForm=
"Recherche et Développement"
tag=
"my.second.annotation"
level=
"lowercase" distance=
"1"
Input:
"R&D" Result: The annotation created is
displayForm=
"Recherche et Développement"
tag=
"my.second.annotation"
level=
"normalized" distance=
"3"