Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #55160 > unrolled thread

extraction tool using CRF++

Started bycerr <ron.eggler@gmail.com>
First post2013-09-30 21:14 -0700
Last post2013-10-01 08:36 -0700
Articles 4 — 3 participants

Back to article view | Back to comp.lang.python


Contents

  extraction tool using CRF++ cerr <ron.eggler@gmail.com> - 2013-09-30 21:14 -0700
    Re: extraction tool using CRF++ Vlastimil Brom <vlastimil.brom@gmail.com> - 2013-10-01 16:24 +0200
    Re: extraction tool using CRF++ Joost Molenaar <j.j.molenaar@gmail.com> - 2013-10-01 17:04 +0200
      Re: extraction tool using CRF++ cerr <ron.eggler@gmail.com> - 2013-10-01 08:36 -0700

#55160 — extraction tool using CRF++

Fromcerr <ron.eggler@gmail.com>
Date2013-09-30 21:14 -0700
Subjectextraction tool using CRF++
Message-ID<90b8ca83-fb81-40d6-a864-f1c0e07bca76@googlegroups.com>
Hi,

I want to write an extraction tool using CRF++ (http://crfpp.googlecode.com/svn/trunk/doc/index.html).
I have written a trainings file and a template:
training:
banana  FOOD    B-NP
bread   FOOD    I-NP
template:
U01:%x[0,1]
U02:%x[1,1]

and now I want to go ahead and extract the foods from a sentence like "how do I make a banana bread". Also, I'm unsure how I interface to crf++ with python, I compiled and installed it from source as described on the above website but I don't have a crf module available in python...

[toc] | [next] | [standalone]


#55215

FromVlastimil Brom <vlastimil.brom@gmail.com>
Date2013-10-01 16:24 +0200
Message-ID<mailman.560.1380637486.18130.python-list@python.org>
In reply to#55160
2013/10/1 cerr <ron.eggler@gmail.com>:
> Hi,
>
> I want to write an extraction tool using CRF++ (http://crfpp.googlecode.com/svn/trunk/doc/index.html).
> I have written a trainings file and a template:
> training:
> banana  FOOD    B-NP
> bread   FOOD    I-NP
> template:
> U01:%x[0,1]
> U02:%x[1,1]
>
> and now I want to go ahead and extract the foods from a sentence like "how do I make a banana bread". Also, I'm unsure how I interface to crf++ with python, I compiled and installed it from source as described on the above website but I don't have a crf module available in python...
> --
> https://mail.python.org/mailman/listinfo/python-list


Hi,
I have unfortunately no experience with CRF++; if there is no python
wrapper for it available, the usage might not be (easily) possible -
depending on the character of this library, you may try accessing it
e.g. via ctypes.

Alternatively, you may try another packages already available, e.g.
NLTK:  http://nltk.org/

>>> import nltk
>>> any(synset.lexname == "noun.food" for synset in nltk.corpus.wordnet.synsets("apple"))
True
>>> any(synset.lexname == "noun.food" for synset in nltk.corpus.wordnet.synsets("bread"))
True
>>> any(synset.lexname == "noun.food" for synset in nltk.corpus.wordnet.synsets("wine"))
True
>>> any(synset.lexname == "noun.food" for synset in nltk.corpus.wordnet.synsets("book"))
False
>>> any(synset.lexname == "noun.food" for synset in nltk.corpus.wordnet.synsets("pencil"))
False

# of course there might be some surprise, probably due to polysemy ore
some specifics of the semantic description...

>>> any(synset.lexname == "noun.food" for synset in nltk.corpus.wordnet.synsets("dog"))
True
>>> any(synset.lexname == "noun.food" for synset in nltk.corpus.wordnet.synsets("white"))
True
>>>

cf.
http://nltk.org/
http://nltk.googlecode.com/svn/trunk/doc/howto/wordnet.html
http://www.velvetcache.org/2010/03/01/looking-up-words-in-a-dictionary-using-python
http://wordnet.princeton.edu/man/lexnames.5WN.html

hth,
   vbr

[toc] | [prev] | [next] | [standalone]


#55219

FromJoost Molenaar <j.j.molenaar@gmail.com>
Date2013-10-01 17:04 +0200
Message-ID<mailman.562.1380639848.18130.python-list@python.org>
In reply to#55160
Hi Ron,
In the python/ subdirectory of the CRF++ source package there's a
README with instructions on how to use the CRFPP python module.

HTH,

Joost

On Tue, Oct 1, 2013 at 4:24 PM, Vlastimil Brom <vlastimil.brom@gmail.com> wrote:
> 2013/10/1 cerr <ron.eggler@gmail.com>:
>> Hi,
>>
>> I want to write an extraction tool using CRF++ (http://crfpp.googlecode.com/svn/trunk/doc/index.html).
>> I have written a trainings file and a template:
>> training:
>> banana  FOOD    B-NP
>> bread   FOOD    I-NP
>> template:
>> U01:%x[0,1]
>> U02:%x[1,1]
>>
>> and now I want to go ahead and extract the foods from a sentence like "how do I make a banana bread". Also, I'm unsure how I interface to crf++ with python, I compiled and installed it from source as described on the above website but I don't have a crf module available in python...
>> --
>> https://mail.python.org/mailman/listinfo/python-list
>
>
> Hi,
> I have unfortunately no experience with CRF++; if there is no python
> wrapper for it available, the usage might not be (easily) possible -
> depending on the character of this library, you may try accessing it
> e.g. via ctypes.
>
> Alternatively, you may try another packages already available, e.g.
> NLTK:  http://nltk.org/
>
>>>> import nltk
>>>> any(synset.lexname == "noun.food" for synset in nltk.corpus.wordnet.synsets("apple"))
> True
>>>> any(synset.lexname == "noun.food" for synset in nltk.corpus.wordnet.synsets("bread"))
> True
>>>> any(synset.lexname == "noun.food" for synset in nltk.corpus.wordnet.synsets("wine"))
> True
>>>> any(synset.lexname == "noun.food" for synset in nltk.corpus.wordnet.synsets("book"))
> False
>>>> any(synset.lexname == "noun.food" for synset in nltk.corpus.wordnet.synsets("pencil"))
> False
>
> # of course there might be some surprise, probably due to polysemy ore
> some specifics of the semantic description...
>
>>>> any(synset.lexname == "noun.food" for synset in nltk.corpus.wordnet.synsets("dog"))
> True
>>>> any(synset.lexname == "noun.food" for synset in nltk.corpus.wordnet.synsets("white"))
> True
>>>>
>
> cf.
> http://nltk.org/
> http://nltk.googlecode.com/svn/trunk/doc/howto/wordnet.html
> http://www.velvetcache.org/2010/03/01/looking-up-words-in-a-dictionary-using-python
> http://wordnet.princeton.edu/man/lexnames.5WN.html
>
> hth,
>    vbr
> --
> https://mail.python.org/mailman/listinfo/python-list

[toc] | [prev] | [next] | [standalone]


#55222

Fromcerr <ron.eggler@gmail.com>
Date2013-10-01 08:36 -0700
Message-ID<6267fcd8-69ea-4968-975c-e45d1779c880@googlegroups.com>
In reply to#55219
On Tuesday, October 1, 2013 3:04:00 PM UTC, Joost Molenaar wrote:
> Hi Ron,
> 
> In the python/ subdirectory of the CRF++ source package there's a
> 
> README with instructions on how to use the CRFPP python module.
> 
Joost,

Hoops, didn't see that! Yes, Thanks! :)

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web