summaryrefslogtreecommitdiff
path: root/chain/src/item
diff options
context:
space:
mode:
authorJSDurand <mmemmew@gmail.com>2023-08-09 11:42:03 +0800
committerJSDurand <mmemmew@gmail.com>2023-08-09 11:42:03 +0800
commitf14c8a2aeab18a9bfa380df28f94736580e08f48 (patch)
tree352cdff6872c9c48575c7dfcfd02a5924a8d2ad9 /chain/src/item
parentf4f8b84a3a95bea42c118d14697076c2de52c8bb (diff)
Fix a bug of using incorrect forest nodes to plant.
Previously some incorrect forest nodes will be used for planting new nodes. I cannot fix the root cause of their presence in the chain-rule machine. But I can ignore them when they are encountered. Of course I would like to really prevent them from existing, but still cannot figure out how.
Diffstat (limited to 'chain/src/item')
-rw-r--r--chain/src/item/genins.rs11
1 files changed, 7 insertions, 4 deletions
diff --git a/chain/src/item/genins.rs b/chain/src/item/genins.rs
index 262728f..e3e79b6 100644
--- a/chain/src/item/genins.rs
+++ b/chain/src/item/genins.rs
@@ -212,7 +212,7 @@ impl DefaultForest<ForestLabel<GrammarLabel>> {
// Whether or not to print detailed graphs of each step of
// operation for debugging purposes.
let mut to_print = false;
- // let mut to_print = (8..=10).contains(&pos);
+ // let mut to_print = (11..=12).contains(&pos);
if std::fs::metadata("output/").is_err() {
to_print = false;
@@ -419,8 +419,8 @@ impl DefaultForest<ForestLabel<GrammarLabel>> {
.collect();
}
- // if pos == 9 {
- // dbg!(&parents);
+ // if pos == 12 {
+ // dbg!(num, &parents, pavi, label);
// }
let mut non_empty = false;
@@ -535,7 +535,6 @@ impl DefaultForest<ForestLabel<GrammarLabel>> {
parents,
reduction_info,
atom.query_reduction(label.label(), atom_child).unwrap(),
- is_empty_segment,
atom.trace(0, 3, atom_child)
.into_iter()
.flatten()
@@ -616,6 +615,10 @@ impl DefaultForest<ForestLabel<GrammarLabel>> {
unreachable!("the forest is wrongly planted");
}
+ // if pos == 11 {
+ // dbg!(root_label, node, edge, child);
+ // }
+
// dbg!(node, edge, root_label, leaf_label);
PaVi::Parent(node, edge, child)
} else {