junaidiiith / Apertium_Code

0 stars 0 forks source link

pretransfer treats all blanks as inline #6

Closed unhammer closed 8 years ago

unhammer commented 8 years ago

plain []-blanks shouldn't be copied, only inline [{}]-blanks. A simple test set:


class BasicPretransferTest(PretransferTest):
    inputs =          ["^a<n>$", "^a<n>+c<po>$",   "^a<vblex><pres># b$", "[<div>]^a<n>$", "[<div>]^a<vblex><pres># b$"]
    expectedOutputs = ["^a<n>$", "^a<n>$ ^c<po>$", "^a# b<vblex><pres>$", "[<div>]^a<n>$", "[<div>]^a# b<vblex><pres>$"]

class JoinGroupPretransferTest(PretransferTest):
    inputs =          ["[<div>]^a<vblex><pres>+c<po># b$",   "[<div>]^a<vblex><pres>+c<po>+d<po># b$"]
    expectedOutputs = ["[<div>]^a# b<vblex><pres>$ ^c<po>$", "[<div>]^a# b<vblex><pres>$ ^c<po>$ ^d<po>$"]

class InlineBlankPretransferTest(PretransferTest):
    inputs =          ["[{<i>}]^a<vblex><pres>+c<po># b$",          "[{<i>}]^a<vblex><pres>+c<po>+d<po># b$"]
    expectedOutputs = ["[{<i>}]^a# b<vblex><pres>$ [{<i>}]^c<po>$", "[{<i>}]^a# b<vblex><pres>$ [{<i>}]^c<po>$ [{<i>}]^d<po>$"]
unhammer commented 8 years ago

I put those tests in trunk/apertium, so if you svn up there, and try make test with your version of pretransfer.cc you'll see what's failing and not (the inline blank tests is marked "expected failure", but should pass when your pretransfer code is all done)

junaidiiith commented 8 years ago

Yeah I figured that. I misinterpreted it. I'll just fix it once the deformatter merging of tags is done.

junaidiiith commented 8 years ago

Fixed it. Please check

unhammer commented 8 years ago

tests pass :)