Skip to content

Commit f73044a

Browse files
remove Node from python api (#119)
The Node is just a C++ implementation detail which does not need to be exposed to the python user (I think) overall trying to simplify and clean things up so that we can iterate more easily on the algorithm --------- Co-authored-by: Noureldin <[email protected]>
1 parent 4a868d0 commit f73044a

File tree

2 files changed

+2
-28
lines changed

2 files changed

+2
-28
lines changed

src/py/tesseract_test.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,7 @@
4242
)
4343

4444

45-
def test_create_node():
46-
node = tesseract_decoder.tesseract.Node(errors=[1, 0])
47-
assert node.errors == [1, 0]
45+
4846

4947

5048
def test_create_tesseract_config():

src/tesseract.pybind.h

Lines changed: 1 addition & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -199,31 +199,7 @@ void add_tesseract_module(py::module& root) {
199199
`TesseractConfig` object.
200200
)pbdoc");
201201

202-
py::class_<Node>(m, "Node", R"pbdoc(
203-
A class representing a node in the Tesseract search graph.
204-
205-
This is used internally by the decoder to track decoding progress.
206-
)pbdoc")
207-
.def(py::init<double, size_t, std::vector<size_t>>(), py::arg("cost") = 0.0,
208-
py::arg("num_dets") = 0, py::arg("errors") = std::vector<size_t>(), R"pbdoc(
209-
The constructor for the `Node` class.
210-
211-
Parameters
212-
----------
213-
cost : float, default=0.0
214-
The cost of the path to this node.
215-
num_dets : int, default=0
216-
The number of detectors this search node has.
217-
errors : list[int], default=empty
218-
The list of error indices this search node has.
219-
)pbdoc")
220-
.def_readwrite("cost", &Node::cost, "The cost of the node.")
221-
.def_readwrite("num_dets", &Node::num_dets, "The number of detectors this search node has.")
222-
.def_readwrite("errors", &Node::errors, "The list of error indices this search node has.")
223-
.def(py::self > py::self,
224-
"Comparison operator for nodes based on cost. This is necessary to prioritize "
225-
"lower-cost nodes during the search.")
226-
.def("__str__", &Node::str);
202+
227203

228204
py::class_<TesseractDecoder>(m, "TesseractDecoder", R"pbdoc(
229205
A class that implements the Tesseract decoding algorithm.

0 commit comments

Comments
 (0)