-
Notifications
You must be signed in to change notification settings - Fork 42
Implement merge-concrete-entities function and add some tests #153
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
Conversation
This comment was marked as outdated.
This comment was marked as outdated.
gvanrossum
left a comment
There was a problem hiding this 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.
This comment was marked as duplicate.
This comment was marked as duplicate.
There was a problem hiding this 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
NotImplementedErrorstub 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 |
|
@copilot Please review this function carefully. It should be equivalent in semantics to the TypeScript function mergeConcreteEntities defined here: |
|
@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. |
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)
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
|
@gvanrossum added your review and should be ready now |
…identity + testcases better handling in if
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.