The top level README file has a short C++ example of using the library. It contains three bugs: * Must use "f->" instead of "f." everywhere * f->setInputAlphabet() wants ConstAlphabetRef instead of (StaticAlphabet*) * It seems that setId() must be called for each state manually. Here is the correct (hopefully) version of the code: using namespace Fsa; StaticAutomaton *f = new StaticAutomaton; f->setType(TypeAcceptor); f->setSemiring(TropicalSemiring); StaticAlphabet *a = new StaticAlphabet(); f->setInputAlphabet(ConstAlphabetRef(a)); State *sp1 = new State(), *sp2 = new State(StateTagFinal); sp1->setId(0); sp2->setId(1); sp1->newArc(sp2->id(), f->semiring()->one(), a->addSymbol("a")); sp2->newArc(sp2->id(), f->semiring()->one(), a->addSymbol("a")); f->setState(sp1); f->setState(sp2); f->setInitialStateId(sp1->id()); ConstAutomatonRef fr = ConstAutomatonRef(f); -- Teemu Hirsimäki
teemu.hirsimaki@hut.fi (Teemu Hirsimäki) writes:
State *sp1 = new State(), *sp2 = new State(StateTagFinal); sp1->setId(0); sp2->setId(1);
The above is still wrong. It does not set the state tag correctly. It should be either State *sp1 = new State(), *sp2 = new State(); sp1->setId(0); sp2->setId(1); sp2->setTags(StateTagFinal); or State *sp1 = new State(0), *sp2 = new State(1, StateTagFinal); -- Teemu Hirsimäki
Hi! On Wednesday 16 February 2005 12:15, Teemu Hirsimäki wrote:
The top level README file has a short C++ example of using the library. It contains three bugs:
* Must use "f->" instead of "f." everywhere * f->setInputAlphabet() wants ConstAlphabetRef instead of (StaticAlphabet*) * It seems that setId() must be called for each state manually.
Here is the correct (hopefully) version of the code:
using namespace Fsa; StaticAutomaton *f = new StaticAutomaton; f->setType(TypeAcceptor); f->setSemiring(TropicalSemiring); StaticAlphabet *a = new StaticAlphabet(); f->setInputAlphabet(ConstAlphabetRef(a)); State *sp1 = new State(), *sp2 = new State(StateTagFinal); sp1->setId(0); sp2->setId(1); sp1->newArc(sp2->id(), f->semiring()->one(), a->addSymbol("a")); sp2->newArc(sp2->id(), f->semiring()->one(), a->addSymbol("a")); f->setState(sp1); f->setState(sp2); f->setInitialStateId(sp1->id()); ConstAutomatonRef fr = ConstAutomatonRef(f);
Ok, thank you. I will correct that in the README. Due to some stress prior to the release in December I didn't compile the example from the README. Stephan
participants (2)
-
Stephan Kanthak
-
Teemu Hirsimäki