Giter VIP home page Giter VIP logo

bert-coref-resolver's Introduction

SpanBERT Coref Resolver

This repository is just a wrapper on top of coref and with the help of this notebook. The additional work is the replacement of the mentions.

How to use

Installation
git clone --recurse-submodules https://github.com/sayef/bert-coref-resolver.git
cd bert-coref-resolver/coref
pip install -r requirements.txt
./setup_all.sh
./download_pretrained.sh spanbert_base models
Usage
  1. Python demo file:
import os
import nltk
nltk.download('punkt')

from resolver import Resolver
    

genre = "nw" # Other options: https://natural-language-understanding.fandom.com/wiki/OntoNotes
model_name = "spanbert_base" # The fine-tuned model to use. Options are: bert_base, spanbert_base, bert_large, spanbert_large
model_dir = "./coref/models" # where you have extracted pretrained model, from outside this module use absolute path

# coref resolver that loads model
coref_resolver = Resolver(genre, model_dir, model_name)
    
# text fot coref resolution
text = "Deepika has a dog. She loves him. The movie star has always been fond of animals."

# call resolve method as many without loading model again


resolved = coref_resolver.resolve(text)

print(resolved)

Output: Deepika has a dog. Deepika loves a dog. Deepika has always been fond of animals.

bert-coref-resolver's People

Contributors

sayef avatar

Watchers

 avatar  avatar

Forkers

dnanad

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.