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

Discrepancy between count and returned entities #21

Closed
Ahmedjjj opened this issue Apr 5, 2022 · 1 comment
Closed

Discrepancy between count and returned entities #21

Ahmedjjj opened this issue Apr 5, 2022 · 1 comment

Comments

@Ahmedjjj
Copy link

Ahmedjjj commented Apr 5, 2022

Hello,

Thank you for your work on the library !

I think there might be an issue either from the parlement api or from the library. Basically the returned count is different from the number of entities. Here are the steps to reproduce:

import swissparlpy as spp
person = spp.get_data("Person")
print(person.count)
print(len(person.entities))

Result:

18170
1000

Any Idea why this is the case?

Thanks!

@metaodi
Copy link
Owner

metaodi commented Jun 21, 2022

Yes this is by design: the data is lazy loaded when it's requested, so at first not all 18170 entries in your example are loaded.

If you use len(person) the correct number should be returned. As soon as an element is used for the first time the actual data is loaded.

@metaodi metaodi closed this as completed Jun 21, 2022
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