26 lines
763 B
Python
26 lines
763 B
Python
|
#!/usr/bin/python3
|
||
|
# -*- coding: utf-8 -*-
|
||
|
|
||
|
import sys
|
||
|
|
||
|
|
||
|
with open(sys.argv[1]) as falign_result, open(sys.argv[2]) as src_clean_lem:
|
||
|
for line in src_clean_lem:
|
||
|
src_line_lem = line.strip()
|
||
|
falign_alignment_pairs = falign_result.readline().rstrip().split()
|
||
|
falign_map = {}
|
||
|
for pair in falign_alignment_pairs:
|
||
|
numbers = pair.split('-')
|
||
|
s = int(numbers[0])
|
||
|
t = int(numbers[1])
|
||
|
if not s in falign_map:
|
||
|
falign_map[s] = []
|
||
|
falign_map[s].append(t)
|
||
|
res = []
|
||
|
for i in range(len(src_line_lem.split())):
|
||
|
if i in falign_map:
|
||
|
res.append(falign_map[i])
|
||
|
else:
|
||
|
res.append([])
|
||
|
print(res)
|