Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use Python list?

Tags:

python

list

I have python list like below.

lst = ['paragraph 1','paragraph 2','paragraph 3']

I'm trying to make corpus of them with Pattern library - http://www.clips.ua.ac.be/pages/pattern-vector

As their example it should be like this ..

d1 = Document('paragraph 1')
d2 = Document('paragraph 2')
d3 = Document('paragraph 3')

corpus = Corpus(documents=[d1,d2,d3])

How can i make corpus liks this with my python list ?

like image 852
ChamingaD Avatar asked Dec 13 '22 03:12

ChamingaD


1 Answers

lst = ['paragraph 1','paragraph 2','paragraph 3']
corpus = Corpus(documents=[Document(x) for x in lst])
like image 92
San4ez Avatar answered Dec 26 '22 22:12

San4ez