with open(args.output, "w") as outfile:
for (words, tags) in sentences:
for i, (w, t) in enumerate(zip(words, tags)):
print("{}\t{}\t{}\tner={}".format(i+1, w, "\t".join([filler]*7), t), file=outfile)
print("", file=outfile)
print("Generated conllu file {}.".format(args.output))
def load_conll03(filename, skip_doc_start=True):
After Change
sentences = load_conll03(args.input)
print("{} examples loaded from {}".format(len(sentences), args.input))
document = []
for (words, tags) in sentences:
sent = []
for w, t in zip(words, tags):
sent += [{"text": w, "ner": t}]
document += [sent]
with open(args.output, "w") as outfile:
json.dump(document, outfile)
print("Generated json file {}.".format(args.output))
def load_conll03(filename, skip_doc_start=True):
cached_lines = []