Skip to content

resolves #2 incorporate top k - #3

Merged
angelphanth merged 2 commits into
mainfrom
2-incorporate-top_k
Apr 6, 2026
Merged

angelphanth merged 2 commits into
mainfrom
2-incorporate-top_k

Conversation

@angelphanth

Copy link
Copy Markdown
Owner

This pull request updates the NodeMapper tutorial, core implementation, and tests to improve usability and flexibility when finding similar text nodes. The main changes include enhancing the get_similar method to support returning the top-k matches, updating tutorial data and outputs for clarity, switching from print to logging for model loading, and improving test coverage for the new features.

Enhancements to NodeMapper functionality:

  • Added a top_k parameter to the get_similar method in hugger/mapper.py, allowing users to specify the number of top similar items to return. This includes input validation and updated docstrings/examples. [1] [2] [3] [4] [5]
  • Changed the default similarity threshold for get_similar and get_match to 0, making it easier to retrieve results without filtering by a minimum score. [1] [2] [3]

Usability and output improvements:

  • Replaced print statements with logging for model and tokenizer loading in hugger/mapper.py for better integration in various environments. [1] [2]

Tutorial and example updates:

  • Expanded the example dataset in both nodemapper-tutorial.ipynb and nodemapper-tutorial.py to use longer, more realistic sentences and additional entries, improving the clarity and usefulness of the tutorial. [1] [2]
  • Updated tutorial outputs and example queries to reflect the new dataset, demonstrate the new top_k parameter, and use more descriptive queries and thresholds. [1] [2] [3] [4]

Testing improvements:

  • Refactored and expanded tests in tests/test_mapper.py to cover the new top_k functionality, renamed test functions for clarity, and adjusted assertions to match the updated logic and data. [1] [2]

Miscellaneous:

  • Updated notebook metadata, kernel name, and Python version in the tutorial notebook for reproducibility and environment clarity. [1] [2]

These changes collectively make the NodeMapper more flexible and user-friendly, with improved documentation, examples, and test coverage.

@angelphanth angelphanth linked an issue Apr 6, 2026 that may be closed by this pull request
@angelphanth
angelphanth merged commit 414674a into main Apr 6, 2026
7 of 8 checks passed
@angelphanth
angelphanth deleted the 2-incorporate-top_k branch April 6, 2026 20:36
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.

Incorporate top_k

1 participant