(sf, of, vocab)
| 77 | print >>fout, '</s>' |
| 78 | |
| 79 | def process_test(sf, of, vocab): |
| 80 | with open(of, 'w') as fout: |
| 81 | with open(sf) as sin: |
| 82 | for sline in sin: |
| 83 | print >>fout, '<s>', |
| 84 | for token in sline.split(): |
| 85 | if token in vocab: |
| 86 | print >>fout, token, |
| 87 | else: |
| 88 | print >>fout, '<unk>', |
| 89 | print >>fout, '</s>' |
| 90 | |
| 91 | ofname = sys.argv[3] + "." + sys.argv[1] + "-" + sys.argv[2] + ".capped" # '/home/vhoang2/tools/nmt/nmt/scripts/iwslt15/train.en-vi.vcb.capped' |
| 92 |