sorgerlab / indra

INDRA (Integrated Network and Dynamical Reasoning Assembler) is an automated model assembly system interfacing with NLP systems and databases to collect knowledge, and through a process of assembly, produce causal graphs and dynamical models.
http://indra.bio
BSD 2-Clause "Simplified" License
173 stars 65 forks source link

Add base assembler class #1372

Closed cthoyt closed 2 years ago

cthoyt commented 2 years ago

Adding a base assembler class allows for other assemblers to inherit some shared functionality (or at least unify the interface a bit).

For example, I find myself doing this quite a bit:

from indra.assemblers import SomethingAssembler

assembler = SomethingAssembler(stmts)
model = assembler.make_model()

And with the base class, it's possible to just do

from indra.assemblers import SomethingAssembler

model = SomethingAssembler.model_from_stmts(stmts)
bgyori commented 2 years ago

Not sure. The point is that the constructor and make_model can take different arguments and have different semantics. Sure, a shortcut can be useful in some cases but not critical.

cthoyt commented 2 years ago

Alright, I'll close this (it can also be accomplished with a helper function)