I am working with Python "Pattern.en" package that gives me the subject, object and other details about a particular sentence.
But I want to store this output into another variable or a Dataframe for further processing which I am not able to do so.
Any inputs on this will be helpful.
Sample code is mentioned below for reference.
from pattern.en import parse
from pattern.en import pprint
import pandas as pd
input = parse('I want to go to the Restaurant as I am hungry very much')
print(input)
I/PRP/B-NP/O want/VBP/B-VP/O to/TO/I-VP/O go/VB/I-VP/O to/TO/O/O the/DT/B-NP/O Restaurant/NNP/I-NP/O as/IN/B-PP/B-PNP I/PRP/B-NP/I-PNP am/VBP/B-VP/O hungry/JJ/B-ADJP/O very/RB/I-ADJP/O much/JJ/I-ADJP/O
pprint(input)
WORD TAG CHUNK ROLE ID PNP LEMMA
I PRP NP - - - -
want VBP VP - - - -
to TO VP ^ - - - -
go VB VP ^ - - - -
to TO - - - - -
the DT NP - - - -
Restaurant NNP NP ^ - - - -
as IN PP - - PNP -
I PRP NP - - PNP -
am VBP VP - - - -
hungry JJ ADJP - - - -
very RB ADJP ^ - - - -
much JJ ADJP ^ - - - -
Please note the output of both print and pprint statements. I am trying to store either one of them into a variable. It would be better if I can store the output of pprint statement into a Dataframe as it is printing in tabular format.
But when I try to do so I encounter the error mentioned below
df = pd.DataFrame(input)
ValueError: DataFrame constructor not properly called!