moduleNLP.GizaPlusPlus.ParsecwhereimportText.ParserCombinators.ParsecimportText.ParserCombinators.Parsec.LanguagetypeOneToManyPair=(String,[Integer])alignFile::CharParser()[([String],[OneToManyPair])]alignFile=manyTillalignSentencePaireofalignSentencePair::CharParser()([String],[OneToManyPair])alignSentencePair=dochar'#';manyTill(noneOf"\n")(char'\n')target<-sepEndByalignWordjustSpacechar'\n'alignment<-sepEndByalignWordPairjustSpacechar'\n'return(target,alignment)alignWordPair::CharParser()OneToManyPairalignWordPair=dowordFrom<-alignWordjustSpaceindicesTo<-betweenlbrackrbrack$dojustSpaceoption[]$sepEndBy1naturaljustSpacereturn(wordFrom,indicesTo)wherelbrack=string"({"rbrack=string"})"alignWord::CharParser()StringalignWord=many1(noneOf" \n\t")justSpace::CharParser()CharjustSpace=char' 'natural::CharParser()Integernatural=manydigit>>=readM-- suggested by John Meacham on the haskell libraries listreadM::(Monadm,Reada)=>String->mareadMs=casereadssof[(x,"")]->returnx_->fail"readM: no parse"