Analyzing with TreeBuilderProcess: Can't instantiate abstract class TreeBuilderProcess with abstract method run
See original GitHub issueDescription Attempting to analyze a CLTK sentence using cltk.dependency.processes.TreeBuilderProcess added to variable pipeline of class NLP, in order produce a dependency graph, produces an error output that states that the abstract class TreeBuilderProcess cannot be instantiated with the abstract method “run”.
To Reproduce
- Install Python version 3.10.4
- Install CLTK version 1.1.5 with dependencies using pip in virtualenv
- In a REPL, run the following code:
from cltk import NLP
from cltk.dependency.processes import TreeBuilderProcess
nlp = NLP(language="lat", suppress_banner=True)
nlp.pipeline.add_process(TreeBuilderProcess)
from cltk.languages.example_texts import get_example_text
doc = nlp.analyze(text=get_example_text("lat"))
- See error
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/user/.virtualenvs/textproc/lib/python3.10/site-packages/cltk/nlp.py", line 140, in analyze
a_process = self._get_process_object(process)
File "/home/user/.virtualenvs/textproc/lib/python3.10/site-packages/cltk/nlp.py", line 116, in _get_process_object
a_process = process_object(self.language.iso_639_3_code)
TypeError: Can't instantiate abstract class TreeBuilderProcess with abstract method run
Expected behavior This follows the example commands as listed on the following URL: https://docs.cltk.org/en/latest/cltk.dependency.html
According to the documentation, cltk.dependency.processes.TreeBuilderProcess is a “Process that takes a doc containing sentences of CLTK words and returns a dependency tree for each sentence.”
Expected behavior is no error output, with the ability to use the “doc” object as a reference for dependency graphs (trees) of the example text in question.
Example language “got” leads to the same output.
Desktop (please complete the following information):
Pop!_OS 22.04 LTS jammy (ID_LIKE ubuntu debian)
Issue Analytics
- State:
- Created a year ago
- Reactions:2
- Comments:6 (4 by maintainers)
Top GitHub Comments
Hello Gideon,
I think it would be easier to discuss about it on or Discord server: https://discord.gg/ATUDJQX7cg and I’ll see how to help you more precisely and see how to implement the
TreeBuilderProcess
class.Thanks, Clément.
I wrote this a few years ago, but it looks like I never finished it.
TreeBuilderProcess
is not referenced anywhere else in the docs. If I recall correctly, my intention was that this would be a generic form of what we do with (StanzaProcess), but only for dependency information. For therun()
method that @clemsciences references, you can see one here: https://github.com/cltk/cltk/blob/cd25f24d5795ae8d169f2dce778d6b1175d97633/src/cltk/dependency/processes.py#L45@GideonK if you would explain what your goal is, we will help you as best we can.