Code Monkey home page Code Monkey logo

pyclausie's Introduction

pyclausie

Python wrapper around ClausIE. This will take a list of sentences and return a list of triples.

How to Install

>>> python setup.py install

Example Usage

To start you must create a ClausIE instance from the pyclausie package.

>>> from pyclausie import ClausIE
>>> cl = ClausIE.get_instance()

get_instance() will automatically download the clausie jar file. If you have an existing clausie jar file you can specifiy the file using the jar_filename parameter.

To extract triples from a sentence use the extract_triples() method. This method takes a list of sentences as input and will return a list of Triple objects.

>>> sents = ['I learned that the 2012 Sasquatch music festival is '
...          'scheduled for May 25th until May 28.']
>>> triples = cl.extract_triples(sents)
>>> for triple in triples:
...     print triple
Triple(index='1', subject='I', predicate='learned', object='that the 2012 Sasquatch music festival is scheduled for May 25th until May 28')
Triple(index='1', subject='the 2012 Sasquatch music festival', predicate='is scheduled', object='for May 25th until May 28')
Triple(index='1', subject='the 2012 Sasquatch music festival', predicate='is scheduled', object='for May 25th')

This shows three triples returned by clausie for the given sentence. If you wish to get the confidence score you should pass the parameter print_sent_confidence=True to the extract_triples() method.

More Information

Licensed under Apache 2.0.

Written by Anthony Rios

pyclausie's People

Contributors

anthonymrios avatar lighteternal avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.