Skip to content

LazyLattice and LazyConcept #22

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

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

mikulatomas
Copy link
Contributor

Hi :)

I am currently testing WIP demo implementation of something i call LazyLattice (and LazyConcept).

Typical application is when you wanna construct Lattice with one concept and find its upper and lower neighbours (and nothing more).

Biggest priority was to keep the API as close as possible, because users could want to use Concept and LazyConcept as interchangeable arguments to other functions.

The whole magic is here and here.

Are you interested in this feature in the main branch? It is still work in progress (no docstring, API not complete etc.). This feature is necessary for my research so I will implement i anyway (in fcapsy package, which should still keep compatibility).

Ideas are welcomed :) (btw I feel that this feature is more important than #15)

Small demo:

from concepts import Context

c = Context.fromstring('''
           |human|knight|king |mysterious|
King Arthur|  X  |  X   |  X  |          |
Sir Robin  |  X  |  X   |     |          |
holy grail |     |      |     |     X    |
''')

lazy_concept = c.lazy_lattice[["King Arthur"]]
# <LazyConcept {King Arthur} <-> [human knight king]>

len(c.lazy_lattice)
# 1

lazy_concept.upper_neighbors
# (<LazyConcept {King Arthur, Sir Robin} <-> [human knight]>,)

len(c.lazy_lattice)
# 2

lazy_concept.lower_neighbors
# (<LazyConcept {} <-> [human knight king mysterious]>,)

len(c.lazy_lattice)
# 3

lazy_concept.upper_neighbors
# (<LazyConcept {King Arthur, Sir Robin} <-> [human knight]>,)

len(c.lazy_lattice)
# 3 - nothing was added

@codecov-commenter
Copy link

codecov-commenter commented Feb 5, 2022

Codecov Report

Merging #22 (89137f7) into master (e1d73a8) will decrease coverage by 3.76%.
The diff coverage is 43.80%.

Impacted file tree graph

@@             Coverage Diff             @@
##            master      #22      +/-   ##
===========================================
- Coverage   100.00%   96.23%   -3.77%     
===========================================
  Files           23       25       +2     
  Lines         1462     1567     +105     
===========================================
+ Hits          1462     1508      +46     
- Misses           0       59      +59     
Impacted Files Coverage Δ
concepts/lazy_lattice_members.py 41.53% <41.53%> (ø)
concepts/lazy_lattices.py 44.44% <44.44%> (ø)
concepts/contexts.py 99.50% <75.00%> (-0.50%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update e1d73a8...89137f7. Read the comment docs.

@mikulatomas
Copy link
Contributor Author

just rebased to current master, no changes :)

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

Successfully merging this pull request may close these issues.

2 participants