Hello,

I wrote a module to use the Part of Speech Tagger Hunpos in web2py.

The module takes a text file tokenized as one token (word) per line as 
input and perfectly creates and writes into another text file with one 
token and its POS (Part of Speech) Tag separated with a tab character in 
one line.

Here is a part of my output file to give an idea how it looks:

Literature NN 
gives VBZ 
a DT 
form NN 
to TO 
life NN 
, , 
helps VBZ 
us PRP 
to TO 
know VB 
who WP 
we PRP 
are VBP 
, , 
how WRB 
we PRP 
feel VBP 
and CC 
what WP 
is VBZ 
the DT 
point NN 
of IN 
the DT 
whole JJ 
unutterably JJ 
rummy NN 
business NN 
. . 
 

When I try to open and read from the output file and write the items inside 
into the mysql database it simply does not insert the items.
Here is the part of my code that I used for database insertion:

...

            # Write to database

            with io.open(outfile, 'r') as ffile:
                id_list = []
                for line in ffile:
                    if not line.isspace():
                        pt = line.split('\t')
                        _id = 
db.en_pos_analysis.insert(token=pt[0],postag=pt[1])
                        id_list.append(_id)

    print 'POS Tagging completed'

    return

I used the same syntax in other modules of the program before and there was 
no problem inserting in the database.

Thanks in advance.

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to