Menu

#294 hfst-reweight multiplication is not applied

future
closed
None
1
2015-04-24
2015-04-14
sjurum
No

To reproduce:

$ hfst-lookup -q generator-fstspeller-gt-norm-weighted.hfst 
ja+CC
ja+CC   ja  99999,000000

> ^C
$ hfst-reweight --verbose -b "10.0" -i generator-fstspeller-gt-norm-weighted.hfst > test.hfst
Reading from generator-fstspeller-gt-norm-weighted.hfst, writing to <stdout>
Modifying weights 0.000000 < w < 340282346638528859811704183484516925440.000000 as 10.000000 * id(w) + 0.000000
Reweighting minimize(determinize(push-weights-f(remove-epsilons(reweight(?stdin?)))))...
$ hfst-lookup -q test.hfst 
ja+CC
ja+CC   ja  99999,000000

^C
$ hfst-reweight --verbose -a "10.0" -i generator-fstspeller-gt-norm-weighted.hfst > test.hfst
Reading from generator-fstspeller-gt-norm-weighted.hfst, writing to <stdout>
Modifying weights 0.000000 < w < 340282346638528859811704183484516925440.000000 as 1.000000 * id(w) + 10.000000
Reweighting minimize(determinize(push-weights-f(remove-epsilons(reweight(?stdin?)))))...
$ hfst-lookup -q test.hfst 
ja+CC
ja+CC   ja  100049,000000

That is, multiplication is not functional (although it looks like), addition is.

Discussion

  • sjurum

    sjurum - 2015-04-14

    Here is what seems to happen: in our build system, one weight is added only to the end state. This weight (unit weight) is NOT changed, because end states are excluded from reweighting, cf reweight() in hfst-reweight.cc. And this was exactly the weight I tested for in the original report.

    I had expected general multiply and addition operations to apply to the whole net and to all states including end and begin states. I don't know whether this is against any theory or established practice, but to me it seems counter intuitive.

    That is, this may be considered a bug or a feature:) - but at least it should be documented. I would argue that it is a bug - when using the -a, -b or -F options the assumption would be that they apply to all states and all weights, except when restricted explicitly with the -l and -u bound options.

     
    • sjurum

      sjurum - 2015-04-14

      After further testing, I am able to change the weights of the end states using the -e option. I am thus able to work around what initially looked like a bug to me.

      What the bug report boils down to then is whether it is the code or the documentation that is wrong or lacking:-)

       
  • Erik Axelson

    Erik Axelson - 2015-04-14
    • status: open --> accepted
     
  • Erik Axelson

    Erik Axelson - 2015-04-15

    Fixed in svn revision 4313. Now weights of all arcs and end states are modified unless --arcs-only or --end-states-only is used.

     
    • sjurum

      sjurum - 2015-04-22

      Seems to work fine, the bug can be closed IMHO.

       
  • Erik Axelson

    Erik Axelson - 2015-04-24
    • status: accepted --> closed