Skip to content

Conversation

@bmerkle
Copy link
Contributor

@bmerkle bmerkle commented Jan 5, 2026

first implementation of missing merge-concrete-entities function
please have a look if the semantic and implementation is ok.
if yes, we could also add some further test cases.

@gvanrossum

This comment was marked as outdated.

Copy link
Collaborator

@gvanrossum gvanrossum left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This ought to be consistent with the TS version at
https://github.com/microsoft/TypeAgent/blob/120e280c7b2acfeb499b5bbc5d78cea23f75b531/ts/packages/knowPro/src/knowledgeMerge.ts#L144C8-L144C38

I'm experimenting with copilot review -- hopefully it can do the check for us.

@gvanrossum gvanrossum marked this pull request as draft January 6, 2026 22:13
@gvanrossum

This comment was marked as duplicate.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR implements the previously unimplemented merge_concrete_entities function, which merges a list of concrete entities by name, combining their types and facets. The implementation includes comprehensive test coverage with 9 test cases covering various merging scenarios.

  • Replaces NotImplementedError stub with working implementation using a dictionary-based merging strategy
  • Adds helper classes and functions (_MergedEntity, _facets_to_merged, _merged_to_facets) to support the merging logic
  • Implements comprehensive test suite covering edge cases including empty lists, single entities, distinct entities, case sensitivity, type deduplication, and facet merging

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 5 comments.

File Description
src/typeagent/knowpro/knowledge.py Implements merge_concrete_entities function with helper classes and functions for merging entities by name, combining types (sorted and deduplicated) and facets (concatenated with "; " separator)
tests/test_knowledge.py Adds 9 comprehensive test cases covering various merge scenarios including empty inputs, single entities, distinct entities, case sensitivity, type/facet merging, and deduplication

@gvanrossum
Copy link
Collaborator

gvanrossum commented Jan 6, 2026

@copilot Please review this function carefully. It should be equivalent in semantics to the TypeScript function mergeConcreteEntities defined here:
https://github.com/microsoft/TypeAgent/blob/120e280c7b2acfeb499b5bbc5d78cea23f75b531/ts/packages/knowPro/src/knowledgeMerge.ts#L144C8-L144C38

@gvanrossum
Copy link
Collaborator

@bmerkle Feel free to ignore or implement Copilot's suggestions (or let it implement some itself). I am still waiting for it to compare the Python version to the TypeScript version.

bmerkle and others added 2 commits January 7, 2026 00:58
refactored based on @copilot suggestion

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
- adopted implementation and tests to be caseinsensitive (as in the TS reference app)
bmerkle and others added 9 commits January 13, 2026 15:03
Co-authored-by: Guido van Rossum <gvanrossum@gmail.com>
Co-authored-by: Guido van Rossum <gvanrossum@gmail.com>
Co-authored-by: Guido van Rossum <gvanrossum@gmail.com>
…n optional argument.

The argument is Callable[[str], str] with default of str.lower

added corresponding testcases
@bmerkle
Copy link
Contributor Author

bmerkle commented Jan 13, 2026

@gvanrossum added your review and should be ready now

@gvanrossum gvanrossum marked this pull request as ready for review January 13, 2026 20:40
@gvanrossum gvanrossum merged commit c6692d7 into microsoft:main Jan 13, 2026
28 of 29 checks passed
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