def selfTest(): from lambekseq.lib.cindex import indexSeq con, *pres = 's', 's/(np\\s)', '(np\\s)/np', '(s/np)\\s' (con, *pres), _ = indexSeq(con, pres) lbk = LambekProof(con, pres) lbk.parse() lbk.buildTree() lbk.printTree()
def selfTest(): from lambekseq.lib.cindex import indexSeq con, *pres = 's', '(s^np)!s', '(np\\s)/np', '(s^np)!s' (con, *pres), _ = indexSeq(con, pres) dsp = DisplaceProof(con, pres) dsp.parse() dsp.buildTree() dsp.printTree()
def selfTest(): from lambekseq.lib.cindex import indexSeq con, *pres = 's', '(s^np)!s', '(np\\s)/np', '(s^np)!s', '(s\\s)/np', '(s^np)!s' (con, *pres), _ = indexSeq(con, pres) cntccg = Cntccg(con, pres, earlyCollapse=False) cntccg.parse() cntccg.buildTree() cntccg.printTree() print('Total:', cntccg.proofCount)
def selfTest(): import pprint as pp from lambekseq.lib.cindex import indexSeq con, *pres = 's', 's/(np\\s)', '(np\\s)/np', '(s/np)\\s' (con, *pres), _ = indexSeq(con, pres) pn = ProofNet.fromLambekSeq(con, pres) pn.parse() print(pp.pformat(pn.fm) + '\n') pn.printProofs() print('Total: %d\n' % pn.proofCount)
def searchLinks(cls, con, pres, **kwargs): '''Return the indexed `con`, `pres`, the run parser and the index dictionary `idxDic`. `idxDic.toToken` maps indices to token numbers. `idxDic.toDepth` maps indices to atom depths. ''' (con, *pres), idxDic = indexSeq(con, pres) if cls == ProofNet: parser = cls.fromLambekSeq(con, pres, **kwargs) else: parser = cls(con, pres, **kwargs) parser.parse() return con, pres, parser, idxDic