Path: csiph.com!usenet.pasdenom.info!news.etla.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed2.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.032 X-Spam-Evidence: '*H*': 0.94; '*S*': 0.00; 'python,': 0.02; 'semantic': 0.09; 'sentence': 0.09; 'subject:using': 0.09; 'url:googlecode': 0.09; 'wrapper': 0.09; 'python': 0.11; 'ctypes.': 0.16; 'url:html)': 0.16; 'url:svn': 0.16; 'module': 0.19; 'written': 0.21; '>>>': 0.22; 'import': 0.22; 'library,': 0.24; 'source': 0.25; 'compiled': 0.26; 'url:edu': 0.26; 'header :In-Reply-To:1': 0.27; 'installed': 0.27; 'character': 0.29; 'message-id:@mail.gmail.com': 0.30; "i'm": 0.30; 'url:mailman': 0.30; 'extract': 0.31; 'file': 0.32; 'probably': 0.32; 'interface': 0.32; 'another': 0.32; 'url:python': 0.33; 'tool': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'there': 0.35; 'accessing': 0.36; 'described': 0.36; 'false': 0.36; 'url:listinfo': 0.36; 'possible': 0.36; 'hi,': 0.36; 'url:org': 0.36; 'ahead': 0.38; 'e.g.': 0.38; 'to:addr:python-list': 0.38; 'url:01': 0.39; 'to:addr:python.org': 0.39; 'url:mail': 0.40; 'how': 0.40; 'skip:u 10': 0.60; 'skip:n 30': 0.60; 'course': 0.61; 'url:index': 0.63; 'due': 0.66; 'food': 0.72; 'bread': 0.84; 'subject:tool': 0.84; 'url:03': 0.84; '"how': 0.91; 'ore': 0.91 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type:content-transfer-encoding; bh=0NGdBibVPbkSJWkUWBGPCoD4pLkjMgcA46r3v4BHQ20=; b=CVvIWq6PIuM95RcD7RfnoRSLNE0BA1nW/7FK+ewOh8oXA6CDvHB1UoOuK+xfrt+OBN 7poYyRnh/2kLwXKjitUVj3FiOZ03ZN+LZiCwg1BACnNGLXfM7PrUZSdq5/S4cgONxLV2 I/wNRAUBn4zENeEyLMyNX6Qy0FeDcc9T0eRCaai7zSsVpueEvfBWxnyTRnmVDQLHr5E+ ieWHSNJ/aj45NR4s08b50giFLPMQR6/QQo8Gp0/q+2hMR2k1opphhOZJ81WyOzCSvCuA /Xmo5Xf5CfUU+sfYWsHYnAaDiUZ/BqNNK1qmA27cj4k/3BXdIefyNuUsvFDBJE6NRnro B3uA== MIME-Version: 1.0 X-Received: by 10.49.105.230 with SMTP id gp6mr35139901qeb.71.1380637477968; Tue, 01 Oct 2013 07:24:37 -0700 (PDT) In-Reply-To: <90b8ca83-fb81-40d6-a864-f1c0e07bca76@googlegroups.com> References: <90b8ca83-fb81-40d6-a864-f1c0e07bca76@googlegroups.com> Date: Tue, 1 Oct 2013 16:24:37 +0200 Subject: Re: extraction tool using CRF++ From: Vlastimil Brom To: python Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 67 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1380637486 news.xs4all.nl 15987 [2001:888:2000:d::a6]:60707 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:55215 2013/10/1 cerr : > Hi, > > I want to write an extraction tool using CRF++ (http://crfpp.googlecode.c= om/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 "ho= w 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 =3D=3D "noun.food" for synset in nltk.corpus.wordnet= .synsets("apple")) True >>> any(synset.lexname =3D=3D "noun.food" for synset in nltk.corpus.wordnet= .synsets("bread")) True >>> any(synset.lexname =3D=3D "noun.food" for synset in nltk.corpus.wordnet= .synsets("wine")) True >>> any(synset.lexname =3D=3D "noun.food" for synset in nltk.corpus.wordnet= .synsets("book")) False >>> any(synset.lexname =3D=3D "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 =3D=3D "noun.food" for synset in nltk.corpus.wordnet= .synsets("dog")) True >>> any(synset.lexname =3D=3D "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-usin= g-python http://wordnet.princeton.edu/man/lexnames.5WN.html hth, vbr