Skip to main content

Bindings to Chu-Liu-Edmonds algorithm from TurboParser

Project description

Chu-Liu-Edmonds Algorithm from TurpoParser.

This package wraps the Chu-Liu-Edmonds maximum spanning algorithm from TurboParser for use within Python.

The original package was made by https://github.com/andersjo/dependency_decoding .

Documentation

The package provides a function chu_liu_edmonds which accepts a N×N score matrix as argument, where N is the sentence length, including the artificial root node. The (i,j)-th cell is the score for the edge j→i. In other words, a row gives the scores for the different heads of a dependent.

A np.nan cell value informs the algorithm to skip the edge.

Example usage:

import numpy as np
from ufal.chu_liu_edmonds import chu_liu_edmonds

np.random.seed(42)
score_matrix = np.random.rand(3, 4)
heads, tree_score = chu_liu_edmonds(score_matrix)
print(heads, tree_score)

Install

Binary wheels of the package are provided, just run

pip install ufal.chu_liu_edmonds

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ufal.chu_liu_edmonds-1.0.1.tar.gz (118.9 kB view hashes)

Uploaded Source

Built Distributions

ufal.chu_liu_edmonds-1.0.1-cp38-cp38-win_amd64.whl (287.3 kB view hashes)

Uploaded CPython 3.8 Windows x86-64

ufal.chu_liu_edmonds-1.0.1-cp38-cp38-win32.whl (227.0 kB view hashes)

Uploaded CPython 3.8 Windows x86

ufal.chu_liu_edmonds-1.0.1-cp38-cp38-manylinux2010_x86_64.whl (100.4 kB view hashes)

Uploaded CPython 3.8 manylinux: glibc 2.12+ x86-64

ufal.chu_liu_edmonds-1.0.1-cp38-cp38-manylinux2010_i686.whl (100.1 kB view hashes)

Uploaded CPython 3.8 manylinux: glibc 2.12+ i686

ufal.chu_liu_edmonds-1.0.1-cp38-cp38-manylinux1_i686.whl (100.1 kB view hashes)

Uploaded CPython 3.8

ufal.chu_liu_edmonds-1.0.1-cp38-cp38-macosx_10_9_x86_64.whl (83.8 kB view hashes)

Uploaded CPython 3.8 macOS 10.9+ x86-64

ufal.chu_liu_edmonds-1.0.1-cp37-cp37m-win_amd64.whl (285.9 kB view hashes)

Uploaded CPython 3.7m Windows x86-64

ufal.chu_liu_edmonds-1.0.1-cp37-cp37m-win32.whl (225.7 kB view hashes)

Uploaded CPython 3.7m Windows x86

ufal.chu_liu_edmonds-1.0.1-cp37-cp37m-manylinux2010_x86_64.whl (99.2 kB view hashes)

Uploaded CPython 3.7m manylinux: glibc 2.12+ x86-64

ufal.chu_liu_edmonds-1.0.1-cp37-cp37m-manylinux2010_i686.whl (99.6 kB view hashes)

Uploaded CPython 3.7m manylinux: glibc 2.12+ i686

ufal.chu_liu_edmonds-1.0.1-cp37-cp37m-macosx_10_9_x86_64.whl (83.7 kB view hashes)

Uploaded CPython 3.7m macOS 10.9+ x86-64

ufal.chu_liu_edmonds-1.0.1-cp36-cp36m-win_amd64.whl (285.8 kB view hashes)

Uploaded CPython 3.6m Windows x86-64

ufal.chu_liu_edmonds-1.0.1-cp36-cp36m-win32.whl (225.7 kB view hashes)

Uploaded CPython 3.6m Windows x86

ufal.chu_liu_edmonds-1.0.1-cp36-cp36m-manylinux2010_x86_64.whl (99.4 kB view hashes)

Uploaded CPython 3.6m manylinux: glibc 2.12+ x86-64

ufal.chu_liu_edmonds-1.0.1-cp36-cp36m-manylinux2010_i686.whl (99.8 kB view hashes)

Uploaded CPython 3.6m manylinux: glibc 2.12+ i686

ufal.chu_liu_edmonds-1.0.1-cp36-cp36m-macosx_10_9_x86_64.whl (83.4 kB view hashes)

Uploaded CPython 3.6m macOS 10.9+ x86-64

ufal.chu_liu_edmonds-1.0.1-cp35-cp35m-win_amd64.whl (285.2 kB view hashes)

Uploaded CPython 3.5m Windows x86-64

ufal.chu_liu_edmonds-1.0.1-cp35-cp35m-win32.whl (225.3 kB view hashes)

Uploaded CPython 3.5m Windows x86

ufal.chu_liu_edmonds-1.0.1-cp35-cp35m-manylinux2010_x86_64.whl (98.9 kB view hashes)

Uploaded CPython 3.5m manylinux: glibc 2.12+ x86-64

ufal.chu_liu_edmonds-1.0.1-cp35-cp35m-manylinux2010_i686.whl (99.2 kB view hashes)

Uploaded CPython 3.5m manylinux: glibc 2.12+ i686

ufal.chu_liu_edmonds-1.0.1-cp35-cp35m-macosx_10_9_x86_64.whl (82.4 kB view hashes)

Uploaded CPython 3.5m macOS 10.9+ x86-64

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page