Dear Group,

I have a list of tuples, as follows,

list1=[u"('koteeswaram/BHPERSN engaged/NA himself/NA in/NA various/NA 
philanthropic/NA activities/NA  ','class1')", u"('koteeswaram/BHPERSN is/NA 
a/NA very/NA nice/NA person/NA  ','class1')", u"('koteeswaram/BHPERSN came/NA 
to/NA mumbai/LOC but/NA could/NA not/NA attend/NA the/ARTDEF board/NA 
meeting/NA  ','class1')", u"('the/ARTDEF people/NA of/NA the/ARTDEF company 
ABCOMP did/NA not/NA vote/NA for/NA koteeswaram/LOC  ','class2')", 
u"('the/ARTDEF director AHT of/NA the/ARTDEF company,/NA koteeswaram/BHPERSN 
had/NA been/NA advised/NA to/NA take/NA rest/NA for/NA a/NA while/NA  
','class2')", u"('animesh/BHPERSN chauhan/BHPERSN arrived/NA by/NA his/PRNM3PAS 
private/NA aircraft/NA in/NA mumbai/LOC  ','class2')", u"('animesh/BHPERSN 
chauhan/BHPERSN met/NA the/ARTDEF prime/HPLPERST minister/AHT of/NA india/LOCC 
over/NA some/NA issues/NA  ','class2')", u"('animesh/BHPERSN chauhan/BHPERSN 
is/NA trying/NA to/NA set/NA up/NA a/NA plant/NA in/NA uk/LOCC  ','class3')", 
u"('animesh/BHPERSN chauh
 an/BHPERSN is/NA trying/NA to/NA launch/NA a/NA new/ABCOMP office/AHT in/NA 
burdwan/LOC  ','class3')", u"('animesh/BHPERSN chauhan/BHPERSN is/NA trying/NA 
to/NA work/NA out/NA the/ARTDEF launch/NA of/NA a/NA new/ABCOMP product/NA 
in/NA india/LOCC  ','class3')"]

I want to make it like,

[('koteeswaram/BHPERSN engaged/NA himself/NA in/NA various/NA philanthropic/NA 
activities/NA','class1'),
 ('koteeswaram/BHPERSN is/NA a/NA very/NA nice/NA person/NA  ','class1'), 
('koteeswaram/BHPERSN came/NA to/NA mumbai/LOC but/NA could/NA not/NA attend/NA 
the/ARTDEF board/NA meeting/NA','class1'), ('the/ARTDEF people/NA of/NA 
the/ARTDEF company ABCOMP did/NA not/NA vote/NA for/NA koteeswaram/LOC  
','class2'),           ('the/ARTDEF director AHT of/NA the/ARTDEF company,/NA 
koteeswaram/BHPERSN had/NA been/NA advised/NA to/NA take/NA rest/NA for/NA a/NA 
while/NA  ','class2'), ('animesh/BHPERSN chauhan/BHPERSN arrived/NA by/NA 
his/PRNM3PAS private/NA aircraft/NA in/NA mumbai/LOC','class2'), 
('animesh/BHPERSN chauhan/BHPERSN met/NA the/ARTDEF prime/HPLPERST minister/AHT 
of/NA india/LOCC over/NA some/NA issues/NA','class2'), ('animesh/BHPERSN 
chauhan/BHPERSN is/NA trying/NA to/NA set/NA up/NA a/NA plant/NA in/NA 
uk/LOCC','class3'), ('animesh/BHPERSN chauhan/BHPERSN is/NA trying/NA to/NA 
launch/NA a/NA new/ABCOMP office/AHT in/NA burdwan/LOC','class3'),
('animesh/BHPERSN chauhan/BHPERSN is/NA trying/NA to/NA work/NA out/NA 
the/ARTDEF launch/NA of/NA a/NA new/ABCOMP product/NA in/NA 
india/LOCC','class3')]

I tried to make it as follows,
list2=[]
for i in train_sents:
        a1=unicodedata.normalize('NFKD', i).encode('ascii','ignore')
        a2=a1.replace('"',"")
        list2.append(a2)

and,

for i in list1:
        a3=i[1:-1]
        list2.append(a3)


but not helping.
If any one may kindly suggest how may I approach it?

Thanks in Advance,
Regards,
Subhabrata Banerjee. 



-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to