divvun / libdivvun

lib for running gramcheck and other pipelines + cli; modules for CG→spelling, CG→feedback, tagging blanks
https://giellalt.github.io/proof/gramcheck/GrammarCheckerDocumentation.html
GNU General Public License v3.0
9 stars 1 forks source link

withCasing uses getCasing(cohort wf), should use getCasing(whole_underlined_wf) #34

Closed unhammer closed 5 years ago

unhammer commented 5 years ago

If the suggestion/underline covers more than one cohort, we need to use the casing from that whole string, not just the cohort of the reading with the error tag.

If input is

"<A.>"
    "A" N Sg <NoSpaceAfterPunctMark> &no-space-after-punct-mark ID:1 R:RIGHT:2
    "A" N Sg <NoSpaceAfterPunctMark> "<A. Eira>" &no-space-after-punct-mark &SUGGESTWF ID:1 R:RIGHT:2
"<Eira>"
    "Eira" N Prop &LINK &no-space-after-punct-mark ID:2

we want &SUGGESTWF to produce A. Eira (as if it had the <fixedcase> tag).

But

    if(r.suggestwf) {
        r.sforms.emplace_back(withCasing(r.fixedcase, inputCasing, r.wf));
    }

gets called with inputCasing that's set by inputCasing = getCasing("A.") which is considered uppercase, should be called with getCasing("A.Eira") which is mIxed (and leads to no case change).