Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HfstTransducer.n_best() documentation misleading #1

Open
maciejjan opened this issue Feb 12, 2019 · 0 comments
Open

HfstTransducer.n_best() documentation misleading #1

maciejjan opened this issue Feb 12, 2019 · 0 comments
Assignees

Comments

@maciejjan
Copy link

The documentation of HfstTransducer.n_best(), both in Python and in C++ API, says that the method "extracts paths" and "returns paths", which suggests a behaviour analogous to HfstTransducer.extract_paths(), HfstTransducer.extract_shortest_paths() etc., but returning the n best paths.

In reality, the method modifies the supplied transducer to contain only the n best paths. In the Python API, it does not return anything.

>>> a = hfst.fst(('foo', 3.0)) 
>>> a.disjunct(hfst.fst(('bar', 5.0))) 
>>> a.extract_paths() 
{'foo': [('foo', 3.0)], '@_EPSILON_SYMBOL_@bar': [('@_EPSILON_SYMBOL_@bar', 5.0)]} 
>>> b = a.n_best(1) 
>>> b 
>>> b is None 
True 
>>> a.extract_paths() 
{'foo': [('foo', 3.0)]} 

(version: 3.15.0 under Debian)

@eaxelson eaxelson self-assigned this Feb 15, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants