2013/10/1 cerr <ron.egg...@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

Reply via email to