e2e-dutch

Code for e2e coref model in Dutch

https://github.com/filter-bubble/e2e-dutch

Science Score: 67.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
    Found CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
    Found 2 DOI reference(s) in README
  • Academic publication links
    Links to: arxiv.org, zenodo.org
  • Committers with academic emails
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (14.4%) to scientific vocabulary
Last synced: 6 months ago · JSON representation ·

Repository

Code for e2e coref model in Dutch

Basic Info
  • Host: GitHub
  • Owner: Filter-Bubble
  • License: apache-2.0
  • Language: Python
  • Default Branch: master
  • Size: 245 KB
Statistics
  • Stars: 10
  • Watchers: 3
  • Forks: 3
  • Open Issues: 11
  • Releases: 6
Created over 5 years ago · Last pushed about 4 years ago
Metadata Files
Readme License Citation Zenodo

README.md

Python package codecov DOI

e2e-Dutch

Code for e2e coref model in Dutch. The code is based on the original e2e model for English, and modified to work for Dutch. If you make use of this code, please cite it and also cite the original e2e paper.

This code can be used with a pre-trained model for Dutch, trained on the SoNaR-1 dataset. The model file and documentation can be found at 10.5281/zenodo.5153574

Installation

Requirements: - Python 3.6 or 3.7 - pip - tensorflow v2.0.0 or higher

In this repository, run: pip install -r requirements.txt python setup.py install

Alternatively, you can install directly from Pypi (this might not work for all operating systems): pip install tensorflow pip install e2e-Dutch

For developers

If you plan to make changes to the code, or train your own model, make sure to install e2e-Dutch in developers mode: pip install -r requirements.txt python setup.py install pip install pytest pytest-cov

And then run the tests to see whether installation has run correctly: python -c 'import stanza; stanza.download("nl")' python -m e2edutch.download -v python setup.py test

Quick start - Stanza

e2edutch can be used as part of a Stanza pipeline.

Coreferences are added similarly to Stanza's entities: * a Document has an attribute clusters that is a List of coreference clusters; * a coreference cluster is a List of Stanza Spans.

``` import stanza import e2edutch.stanza

stanza.download('nl') # This downloads the stanza models if not yet available

nlp = stanza.Pipeline(lang='nl', processors='tokenize,coref')

doc = nlp('Jan liep met Fido over straat. Hij wilde oversteken maar de hond wilde niet.') print ([[span.text for span in cluster] for cluster in doc.clusters])

Output: doc = nlp('Jan liep met Fido over straat. Hij wilde oversteken maar de hond wilde niet.')

```

The e2e-Dutch model files are automatically downloaded to the stanza resources directory when loading the pipeline.

Quick start

A pretrained model is available to download: python -m e2edutch.download [-d DATAPATH] This downloads the model files, the default location is the data directory inside the python package location. It can also be set manually with the DATAPATH argument, or by specifying the enviornment vairable E2E_HOME.

The pretrained model can be used to predict coreferences on a conll 2012 files, jsonlines files, NAF files or plain text files (in the latter case, the stanza package will be used for tokenization). ``` python -m e2edutch.predict [-h] [-o OUTPUTFILE] [-f {conll,jsonlines,naf}] [-m MODEL] [-c WORD_COL] [--cfgfile CFGFILE] [--modelcfgfile MODELCFGFILE] [-v] inputfilename

positional arguments: input_filename

optional arguments: -h, --help show this help message and exit -o OUTPUTFILE, --outputfile OUTPUTFILE -f {conll,jsonlines,naf}, --formatout {conll,jsonlines,naf} -m MODEL, --model MODEL model name -c WORDCOL, --wordcol WORDCOL --cfgfile CFGFILE config file --modelcfgfile MODELCFGFILE model config file -v, --verbose `` The user-specific configurations (such as data directory, data files, etc) can be provided in a separate config file, the defaults are specified incfg/defaults.conf. The options modelcfg_fileandmodel` are relevant when you want to use a user-specified model instead of the pretrained model to predict (see the section below on how to train a model).

Example

An example of using the predict script: bash echo "Jan liep met Fido over straat. Hij wilde oversteken maar de hond wilde niet." > example.txt python -m e2edutch.predict example.txt Gives output: ```

begin document (example);

example 0 Jan (0) example 1 liep - example 2 met - example 3 Fido (1) example 4 over - example 5 straat (2) example 6 . -

example 0 Hij (0) example 1 wilde - example 2 oversteken - example 3 maar - example 4 de (3 example 5 hond 3) example 6 wilde - example 7 niet - example 8 . -

end document

```

Train your own model

To train a new model: - Make sure the model config file (default: e2edutch/cfg/models.conf) describes the model you wish to train - Make sure your config file (default: e2edutch/cfg/defaults.conf) includes the data files you want to use for training - Run scripts/setup_train.sh e2edutch/cfg/defaults.conf. This script converts the conll2012 data to jsonlines files, and caches the word and contextualized embeddings. - If you want to enable the use of a GPU, set the environment variable: bash export GPU=0 - Run the training script: bash python -m e2edutch.train <model-name>

Citing this code

If you use this code in your research, please cite it as follows: @misc{YourReferenceHere, author = { Dafne van Kuppevelt and Jisk Attema }, title = {e2e-Dutch}, doi = {10.5281/zenodo.4146960}, url = {https://github.com/Filter-Bubble/e2e-Dutch} } As the code is largely based on original e2e model for English, please make sure to also cite the original e2e paper.

Owner

  • Name: Inside the filter bubble
  • Login: Filter-Bubble
  • Kind: organization
  • Email: jedsfilterbubble@gmail.com
  • Location: Amsterdam

We develop a framework for deep semantic analysis of mobile news consumption traces.

Citation (CITATION.cff)

# YAML 1.2
---
abstract: "Code for e2e coref model in Dutch. The code is based on the original e2e model for English (https://github.com/kentonl/e2e-coref), and modified to work for Dutch."
authors: 
  -
    family-names: "van Kuppevelt"
    given-names: Dafne
    orcid: "https://orcid.org/0000-0002-2662-1994"
  -
    family-names: Attema
    given-names: Jisk
    orcid: "https://orcid.org/0000-0002-0948-1176"
cff-version: "1.1.0"
doi: "10.5281/zenodo.4146960"
license: "Apache-2.0"
message: "If you use this software, please cite it using these metadata."
repository-code: "https://github.com/Filter-Bubble/e2e-Dutch"
title: "e2e-Dutch"
...

GitHub Events

Total
Last Year

Committers

Last synced: almost 3 years ago

All Time
  • Total Commits: 134
  • Total Committers: 2
  • Avg Commits per committer: 67.0
  • Development Distribution Score (DDS): 0.097
Top Committers
Name Email Commits
Dafne van Kuppevelt d****t@e****l 121
Jisk Attema j****a@e****l 13
Committer Domains (Top 20 + Academic)

Issues and Pull Requests

Last synced: 7 months ago

All Time
  • Total issues: 26
  • Total pull requests: 6
  • Average time to close issues: 3 months
  • Average time to close pull requests: about 1 month
  • Total issue authors: 3
  • Total pull request authors: 2
  • Average comments per issue: 0.5
  • Average comments per pull request: 0.5
  • Merged pull requests: 4
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 0
  • Pull requests: 0
  • Average time to close issues: N/A
  • Average time to close pull requests: N/A
  • Issue authors: 0
  • Pull request authors: 0
  • Average comments per issue: 0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • dafnevk (24)
  • CorbenPoot (1)
  • MaudGoddefroy (1)
Pull Request Authors
  • dafnevk (5)
  • abelsiqueira (1)
Top Labels
Issue Labels
bug (1)
Pull Request Labels

Packages

  • Total packages: 1
  • Total downloads:
    • pypi 84 last-month
  • Total dependent packages: 0
  • Total dependent repositories: 1
  • Total versions: 5
  • Total maintainers: 2
pypi.org: e2e-dutch

Coreference resolution with e2e for Dutch

  • Versions: 5
  • Dependent Packages: 0
  • Dependent Repositories: 1
  • Downloads: 84 Last month
Rankings
Dependent packages count: 9.7%
Forks count: 16.9%
Stargazers count: 17.7%
Average: 19.2%
Dependent repos count: 21.9%
Downloads: 29.9%
Maintainers (2)
Last synced: 7 months ago

Dependencies

requirements.txt pypi
  • tensorflow >=2.0.0
setup.py pypi
  • KafNafParserPy *
  • h5py *
  • pyhocon *
  • scikit-learn *
  • scipy *
  • stanza *
  • tensorflow >=2.0.0
  • torch <=1.7.1
  • transformers <=3.5.1