Giter VIP home page Giter VIP logo

hobbs's Introduction

hobbs.py


Enter python hobbs.py demo to see a demo.

Otherwise, enter a file containing parsed sentences to search, with one sentence per line, and then enter the pronoun you'd like to resolve, e.g.,

python hobbs.py demosents.txt "He"
python hobbs.py demosents.txt "it"
python hobbs.py demorefl.txt "herself"

The sentences must use Treebank tags and be parsed such that they can be converted into NLTK Trees. The pronoun must be in the last sentence of the file.

This program uses Hobbs’ algorithm to find the antecedent of a pronoun. It has also been expanded to handle reflexive pronouns. The algorithm is given below:

  1. Begin at the NP node immediately dominating the pronoun
  2. Go up the tree to the first NP or S node encountered. Call this node X and the path used to reach it p.
  3. Traverse all branches below node X to the left of path p in a left-to-right, breadth-first fashion. Propose as an antecedent any NP node that is encountered which has an NP or S node between it and X.
  4. If node X is the highest S node in the sentence, traverse the surface parse trees of previous sentences in the text in order of recency, the most recent first; each tree is traversed in a left-to-right, breadth-first manner, and when an NP node is encountered, it is proposed as an antecedent. If X is not the highest S node in the sentence, continue to step 5.
  5. From node X, go up the tree to the first NP or S node encountered. Call this new node X, and call the path traversed to reach it p.
  6. If X is an NP node and if the path p to X did not pass through the Nominal node that X immediately dominates, propose X as the antecedent.
  7. Traverse all branches below node X to the left of path p in a left-to-right, breadth-first manner. Propose any NP node encountered as the antecedent.
  8. If X is an S node, traverse all the branches of node X to the right of path p in a left-to-right, breadth-first manner, but do not go below any NP or S node encountered. Propose any NP node encountered as the antecedent.
  9. Go to step 4.

hobbs's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

hobbs's Issues

TypeError: cannot unpack non-iterable NoneType object

(S (NP (DT the) (N castle) (PP in (NP (N camelot)))) (VP remained (NP (DT the) (N residence (PP of (NP (DT the) (N king))))) (PP until (NP (CD 536) (WRB when (SBAR (S (NP he) (VP moved (NP it) (PP to (NP (N london)))))))))))

@cmward @enfageorge @notapro @jburb @sarmilaupadhyaya hey people, hope you're doing just fine! Above is the tree I used to solve co-reference, but I got the error I mentioned in the title of this issue TypeError: cannot unpack non-iterable NoneType object and the pos of the pronoun is (1, 2, 1, 1, 1, 0, 0, 0). Please help me out people and thanks in advance.

Custom training data for hobbs

Hi all,
I was wondering if it is possible to use custom data that one can prepare themselves for training this model. If so, how does one do this with hobbs? Will it convert a txt file to the right format or does one have to convert it to a ConLL file first? Can it be ConLL-U? Thank you very much.

Inputting our own sentence

Hey,
How can we input our own sentence as I tried inserting my own sentence but it gives an error of Grammar does not support some input words?

How to get a pattern for any sentence by programatically ?

for two inputs

  1. demorefl.txt
    contents :
    (S (NP (NNP John) ) (VP (VBD said) (SBAR (-NONE- 0)(S (NP (NNP Mary) ) (VP (VBD likes) (NP (PRP herself) ) ) ) ) ) )

  2. demosents.txt
    contents :
    (S (NP (NNP John)) (VP (VBD saw) (NP (DT a)(JJ flashy) (NN hat)) (PP (IN at) (NP (DT the) (NN store)))))
    (S (NP (PRP He)) (VP (VBD showed) (NP (PRP it))(PP (IN to) (NP (NNP Terrence)))))

How to get these patterns for any sentence given programatically?

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.