Beispiel #1
0
    # for createdLine in testList:
    for windx in range(len(testList)):
        createdLine = formatPosTestInputNew(windx,testList)
        preds = pc.classify(classes,wts,voco,createdLine)
        predict.append(preds)
    
    return predict

def writeOutput(prList,inLine):
    inList = inLine.split()
    
    # if len(inList) != len(prList):
    #     print("GOGOGOGOGO")

    printLine = ""
    for idx in range(len(inList)):
        wwrd = str(inList[idx]) + "/" + str(prList[idx])+" "
        printLine += wwrd
    sys.stdout.flush()
    print(printLine)


if __name__ == '__main__':

    posModelFile = sys.argv[1]
    classes,wts,voco = pc.readModel(posModelFile)

    for line in sys.stdin:
        predList = posClassify(classes,wts,voco,line)
        writeOutput(predList,line)
Beispiel #2
0
        predict.append(preds)
        
    return predict

def writeOutput(prList,inLine):
    inList = inLine.split()
    # if len(inList) != len(prList):
    #     print("GOGOGOGOGO")

    printLine = ""
    for idx in range(len(inList)):
        wwrd = str(inList[idx]) + "/" + str(prList[idx])+" "
        printLine += wwrd
    sys.stdout.flush()
    print(printLine)


if __name__ == '__main__':
    sys.path.insert(1,os.path.join(sys.path[0],'..'))

    nerModelFile = sys.argv[1]
    classes,wts,voco = pc.readModel(nerModelFile)

    inputStream = io.TextIOWrapper(sys.stdin.buffer, encoding='ISO-8859-1')

    for line in inputStream:
        predList = nerClassify(classes,wts,voco,line)
        writeOutput(predList,line)