#!/usr/bin/python
import sys
import os
import psycopg2
import re
import NER
import subprocess
import psycopg2
import re
import subprocess
import nltk
from nltk.stem.wordnet import WordNetLemmatizer
from nltk.stem import PorterStemmer

file = open('fromDbn','r')
list = []
while True: 
  line = file.readline()
  if line == '':
    file.close()
    break
  line = line.split('\n')
  split = line[0].split('\t')
  list.append([split[0],split[1],split[2],split[3]])
#print len(list)
file = open('baseline','r')
text = file.read()
o= NER.find(text,'en')
for loc in o.keys():
      for k in o[loc]:
        print k[4]
        pom = list[int(k[4])]
        print 'exact:',pom[0],'begin:',k[0],'lenght:',k[1]

