machinalis / iepy

Information Extraction in Python
BSD 3-Clause "New" or "Revised" License
906 stars 186 forks source link

Do i need individual rules files for each relation? #117

Closed SindhuBairavi closed 7 years ago

SindhuBairavi commented 7 years ago

We need to specify the Relation in the rules.py, but it accepts only 1 relation at a time, so does that mean I need to create separate rules file for each relation? And if i run the rule_runner script, which relation would it pick up?

jmansilla commented 7 years ago

I'm afraid that there's no support for such a thing right now.

It shouldn't be hard to refactor the code for making this possible, so if you think you can do this contribution, let me know and I can guide you.

On the other hand, an ugly and not very elegant way of overcoming to this for you may be:

Later, when you want to work with relation A

On Thu, Dec 8, 2016 at 8:01 AM, Sindhu Bairavi notifications@github.com wrote:

We need to specify the Relation in the rules.py, but it accepts only 1 relation at a time, so does that mean I need to create separate rules file for each relation? And if i run the rule_runner script, which relation would it pick up?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/machinalis/iepy/issues/117, or mute the thread https://github.com/notifications/unsubscribe-auth/AAd04_Bom3ch_G2EyJWEHfHOsaDe_Wmvks5rF-OPgaJpZM4LHsV7 .

-- Javier Mansilla - Technical Leader www.machinalis.com

awolfmann commented 7 years ago

I handled this problem, adding an extra argument to the rule decorator called "relation_name", so each rule have a relation associated with (this was the most intuitive way to solve it for me). So that was the only change i did to the framework, the rest of the work was on my own instance, defining an attribute RELATIONS in the file rules.py as a list of relation names (instead of the RELATION attribute), and adapting the bin/iepy_rules_runner.py to handle a list of relations names. For example: Calling the RuleBasedCore inside of a loop iterating over the relations names, for each relation and its related rules.

I'm still working on my project but until now, seems to work fine.

jmansilla commented 7 years ago

Awesome Ariel

Do you think it's possible to make a pull request (against develop branch) with such changes?

Would consist on the changes you mentioned on the "framework" plus also the changes you did on iepy_rules_runner.py (the repo file for it is here https://github.com/machinalis/iepy/blob/develop/iepy/instantiation/iepy_rules_runner.py)