Code Monkey home page Code Monkey logo

Comments (3)

eric-yates avatar eric-yates commented on June 19, 2024

I figured out a way to only check for coreference in a sentence, although it seems a bit hacky. For example in:

[Carol: [Carol, she]]

I first calculated the begin index and the end index of the sentence in question. Then, I checked to see if the index of the first mention (Carol) was in between the begin index and end index.

If it was, then it was a valid coreference within a sentence. If it was not, then it was a coreference from another sentence.

Is there a better approach than this?

from neuralcoref.

thomwolf avatar thomwolf commented on June 19, 2024

Well the behavior in your first comment is intended:

  • if you ask for the coreference of a Doc, you get all the coreferences.
  • if you ask for the coreference of a Span you only get coreferences that matches exactly the Span.
    This is required to navigate easily within the chains. I understand it may be a bit surprising, I will try to clarify it a bit in the readme.

Regarding your second comment, another way to limit coreference to single sentences only would be to split your string in sentences (like string.split('.')) and feed a list of strings instead of a single string to the nlp object.

from neuralcoref.

eric-yates avatar eric-yates commented on June 19, 2024

Ah I see, thank you for the clarification. We're relying on user input that may put in decimal numbers, abbreviations, etc. that would mess up the split string method. I tried first passing the whole paragraph through nlp and then passing each sentence in doc.sents through nlp, although I found that performance was too slow for our requirements

A coreference option within a sentence could be a useful feature for the future. Until then, the workaround I made above works (if a bit hacky) for anyone looking to do this

from neuralcoref.

Related Issues (20)

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.