Skip to content

Commit 7b61d3d

Browse files
author
Lukas Molzberger
committed
fix
1 parent 1443ee0 commit 7b61d3d

File tree

2 files changed

+18
-13
lines changed

2 files changed

+18
-13
lines changed

src/main/java/org/aika/corpus/Document.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,12 +183,15 @@ public void propagate() {
183183
public void generateCandidates() {
184184
TreeSet<Candidate> tmp = new TreeSet<>();
185185
int i = 0;
186-
for (InterpretationNode cn : bottom.children) {
186+
187+
for(Activation act: addedActivations) {
188+
InterpretationNode cn = act.key.interpretation;
187189
if (cn.state == UNKNOWN && cn.activation.upperBound > 0.0) {
188190
tmp.add(new Candidate(cn, i++));
189191
}
190192
}
191193

194+
192195
long v = visitedCounter++;
193196
for(Activation act: inputNeuronActivations) {
194197
act.visited = v;

src/main/java/org/aika/neuron/INeuron.java

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -614,22 +614,24 @@ public void register(Activation act) {
614614

615615
Document doc = act.doc;
616616
INeuron.ThreadState th = ak.node.neuron.get().getThreadState(doc.threadId, true);
617-
if (th.activations.isEmpty()) {
618-
doc.activatedNeurons.add(ak.node.neuron.get());
619-
}
620-
th.activations.put(ak, act);
617+
if(!th.activations.containsKey(ak)) {
618+
if (th.activations.isEmpty()) {
619+
doc.activatedNeurons.add(ak.node.neuron.get());
620+
}
621+
th.activations.put(ak, act);
621622

622-
TreeMap<NodeActivation.Key, Activation> actEnd = th.activationsEnd;
623-
if (actEnd != null) actEnd.put(ak, act);
623+
TreeMap<NodeActivation.Key, Activation> actEnd = th.activationsEnd;
624+
if (actEnd != null) actEnd.put(ak, act);
624625

625-
TreeMap<NodeActivation.Key, Activation> actRid = th.activationsRid;
626-
if (actRid != null) actRid.put(ak, act);
626+
TreeMap<NodeActivation.Key, Activation> actRid = th.activationsRid;
627+
if (actRid != null) actRid.put(ak, act);
627628

628-
if (ak.rid != null) {
629-
doc.activationsByRid.put(ak, act);
630-
}
629+
if (ak.rid != null) {
630+
doc.activationsByRid.put(ak, act);
631+
}
631632

632-
doc.addedActivations.add(act);
633+
doc.addedActivations.add(act);
634+
}
633635

634636
linkActivation(act);
635637
}

0 commit comments

Comments
 (0)