I have Following data in txt file. need to load this data in Python list.
[('Get RC for Apple for SmallCA for CAR?', {'entities': [ (11, 16, 'ORG'),(4, 6, 'Revenue'),(21, 28, 'Product'),(33, 36, 'Region')]}),('Get REVCCR for Apple for SmallCA for CAR?', {'entities': [ (15, 20, 'ORG'),(4, 10, 'REV'),(25, 32, 'Product'),(37, 40, 'CAA')]})]
1) I have open this file and read all the data, but its loaded as string.
2) Try to load using numpy
but its not getting loaded as expected
data = set(w.rstrip() for w in open('../File/DataList.txt'))
print(data )
Should load data as below
data = [('Get RC for Apple for SmallCA for CAR?', {'entities': [ (11, 16, 'ORG'),(4, 6, 'Revenue'),(21, 28, 'Product'),(33, 36, 'Region')]}),('Get REVCCR for Apple for SmallCA for CAR?', {'entities': [ (15, 20, 'ORG'),(4, 10, 'REV'),(25, 32, 'Product'),(37, 40, 'CAA')]})]
print(data)