Exemplo n.º 1
0
#! /usr/bin/env python

import NER
import sys
import os

if __name__=="__main__":
    fin = os.path.abspath(sys.argv[1])
    fout = os.path.abspath(sys.argv[2])
    NER.utf8tobw(fin,fout)
Exemplo n.º 2
0
    try:
        json.dump(struct, fh,indent=0)
        fh.close()
        shutil.copy(tmpFile.name, fName)
    except:
        print >> sys.stderr, "Failed to write the structure in", fName
        print_exception()
    tmpFile.close()

def loadJson(fName):
    try:
        fh = open(fName,'rb')
        result = json.load(fh)
        fh.close()
        return result
    except:
        print >> sys.stderr, fName, "Failed to be interpreted as a Json file because of"
        print_exception()
        fh.close()
        return -1


if __name__== "__main__":
    fName = os.path.abspath(sys.argv[1])
    b2utf8(fName, fName+".utf8")
    NER.utf8tobw(fName+".utf8", fName+".BW")
    b2utf8(fName+".BW", fName+".BW.utf8")
    fixCols(fName+".BW.utf8")