Filter API for Python#
- class eot.wowool.native.core.filter.Filter#
A Filter object can be used to filter your results.
- Param
filter: is a collection or a comma delimited string of the annotation you want to filter..
- Type
filter Union[list, set, str]
For example:
from eot.wowool.native.core import Language, Compiler, Domain, Filter from eot.wowool.annotation import Concept from eot.wowool.document import Document Compiler.compile( output_file="profile.dom", source=r""" rule:{ Person .. 'werken' .. Company }= PersonWorkCompany;""", ) analyzer = Language("dutch") domains = [] for dn in ["dutch-entity.dom", "profile.dom"]: domains.append(Domain(dn)) filter = Filter(["PersonWorkCompany", "Sentence", "Person", "Company"]) document = analyzer(Document("Mark Van Den Berg werkte als hoofdarts by Omega Pharma.")) for domain in domains: document = domain(document) document = filter(document) for concept in Concept.iter(document): print(concept)
- __init__(filter: Union[list, set, str])#