#  Copyright (c) 2020 EyeOnText, All Rights Reserved.
#  NOTICE:  All information contained herein is, and remains the property of EyeOnText.
# !!! make sure you build the helloworld.dom
# from the domains folder pywoc -t -l en -o helloworld.dom helloworld.wow --verbose debug
# or using scons
# scons .

from eot.wowool.native import Analyzer, Domain
from eot.wowool.annotation import Concept
from eot.wowool.error import Error
from pathlib import Path

this_folder  = Path(__file__).parent

try:
    dutch = Analyzer(language="dutch")
    helloworld = Domain( Path( this_folder, '..', '..', '..', 'domains' , 'helloworld.dom' ) )

    doc = dutch("greetings world.")
    doc = helloworld(doc)
    print( doc )
except Error as ex:
    print("Exception:",ex)
Exemple #2
0
#  Copyright (c) 2020 EyeOnText, All Rights Reserved.
#  NOTICE:  All information contained herein is, and remains the property of EyeOnText.

from eot.wowool.native import Analyzer, Domain
from eot.wowool.error import Error

try:
    english = Analyzer(language="dutch")
    entities = Domain("dutch-entity")

    # scope is the range of sentence, in this case 3 before until the current sentence.
    # concept id the type of annotation we are looking for.
    # required means that we must have that attribute. in this case 'hij' must be male.
    # you can also add relevancy if you have seen a attribute, ex: relevancy="_ana:referent:6.1"
    #   this means that if we have a candidate with a attribute _ana="referent" we add more relevancy.
    anaphora = Domain(source="""
    namespace entity {
         rule:{ Person } = Person;
    }

    namespace anaphora {
        rule: { <'hij'>} =
            wow::anaphora@( concept="Person" , scope="-3:0" , inherit="true", required="gender:male" );
    }

""")

    doc = english(
        "Jan Van Den Berg werkte als hoofdarts samen met Pol Jannsens bij Omega Pharma. Hij is ook de CEO."
    )
    doc = entities(doc)
Exemple #3
0
#  Copyright (c) 2020 EyeOnText, All Rights Reserved.
#  NOTICE:  All information contained herein is, and remains the property of EyeOnText.

from eot.wowool.native import Analyzer
from eot.wowool.native import Domain
from eot.wowool.annotation import Concept

a = Analyzer(language="english")
dc = Domain("english-company")
doc = dc(a("this is a EyeOnText."))

call_plugin = Domain(source="""
rule:{ Company }= ::python::myplugin::call_this;
rule:{ Company }= Other@(name=f"{rule.literal()}" );

""")

doc = call_plugin(doc)
concepts = [c for c in Concept.iter(doc)]
uris = [c.uri for c in concepts]
print(doc)

assert "PLUGIN_COMPANY" in uris, "Missing some plugin annotation"
assert "Company" in uris, "Missing some plugin annotation"
assert concepts[1].attributes["name"][0] == "EyeOnText", "Missing attributes."