예제 #1
0
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()
예제 #2
0
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()
예제 #3
0
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)
예제 #4
0
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)
예제 #5
0
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