From 414de1bf94b9e48a6502060baec6d27b00cce885 Mon Sep 17 00:00:00 2001 From: Christoph Thiede Date: Thu, 20 Jun 2024 01:07:32 +0200 Subject: [PATCH] semantics: add missing dictionary method --- .../instance/talkSemanticWithValuesSorted..st | 12 ++++++++++++ .../Dictionary.extension/methodProperties.json | 5 +++++ .../Dictionary.extension/properties.json | 2 ++ .../instance/searchExact.semantic..st | 2 +- .../TalkSemanticAgent.class/methodProperties.json | 2 +- 5 files changed, 21 insertions(+), 2 deletions(-) create mode 100644 packages/SqueakInboxTalkExtras-Semantics.package/Dictionary.extension/instance/talkSemanticWithValuesSorted..st create mode 100644 packages/SqueakInboxTalkExtras-Semantics.package/Dictionary.extension/methodProperties.json create mode 100644 packages/SqueakInboxTalkExtras-Semantics.package/Dictionary.extension/properties.json diff --git a/packages/SqueakInboxTalkExtras-Semantics.package/Dictionary.extension/instance/talkSemanticWithValuesSorted..st b/packages/SqueakInboxTalkExtras-Semantics.package/Dictionary.extension/instance/talkSemanticWithValuesSorted..st new file mode 100644 index 00000000..1c89f7fa --- /dev/null +++ b/packages/SqueakInboxTalkExtras-Semantics.package/Dictionary.extension/instance/talkSemanticWithValuesSorted..st @@ -0,0 +1,12 @@ +*SqueakInboxTalkExtras-Semantics-Core-sorting +talkSemanticWithValuesSorted: aSortBlockOrNil + + | sorted | + sorted := OrderedDictionary new: self size. + (self associations sorted: + (aSortBlockOrNil + ifNil: [[:someAssoc :otherAssoc | someAssoc value <= otherAssoc value]] + ifNotNil: [[:someAssoc :otherAssoc | aSortBlockOrNil value: someAssoc value value: otherAssoc value]])) + do: [:assoc | + sorted add: assoc]. + ^ sorted \ No newline at end of file diff --git a/packages/SqueakInboxTalkExtras-Semantics.package/Dictionary.extension/methodProperties.json b/packages/SqueakInboxTalkExtras-Semantics.package/Dictionary.extension/methodProperties.json new file mode 100644 index 00000000..996cd90e --- /dev/null +++ b/packages/SqueakInboxTalkExtras-Semantics.package/Dictionary.extension/methodProperties.json @@ -0,0 +1,5 @@ +{ + "class" : { + }, + "instance" : { + "talkSemanticWithValuesSorted:" : "ct 6/20/2024 01:06" } } diff --git a/packages/SqueakInboxTalkExtras-Semantics.package/Dictionary.extension/properties.json b/packages/SqueakInboxTalkExtras-Semantics.package/Dictionary.extension/properties.json new file mode 100644 index 00000000..cb1bf501 --- /dev/null +++ b/packages/SqueakInboxTalkExtras-Semantics.package/Dictionary.extension/properties.json @@ -0,0 +1,2 @@ +{ + "name" : "Dictionary" } diff --git a/packages/SqueakInboxTalkExtras-Semantics.package/TalkSemanticAgent.class/instance/searchExact.semantic..st b/packages/SqueakInboxTalkExtras-Semantics.package/TalkSemanticAgent.class/instance/searchExact.semantic..st index 5d2e64c9..f3487dad 100644 --- a/packages/SqueakInboxTalkExtras-Semantics.package/TalkSemanticAgent.class/instance/searchExact.semantic..st +++ b/packages/SqueakInboxTalkExtras-Semantics.package/TalkSemanticAgent.class/instance/searchExact.semantic..st @@ -38,7 +38,7 @@ searchExact: exactTerms semantic: semanticTerms sum := Dictionary new. semanticResults do: [:ea | ea keysAndValuesDo: [:k :v | sum at: k put: (sum at: k ifAbsent: [0]) + v]]. - sum := (sum withValuesSorted: #yourself descending) keys. + sum := (sum talkSemanticWithValuesSorted: #yourself descending) keys. results := (searchers gather: [:searcher | searcher filter: sum]) withoutDuplicates. diff --git a/packages/SqueakInboxTalkExtras-Semantics.package/TalkSemanticAgent.class/methodProperties.json b/packages/SqueakInboxTalkExtras-Semantics.package/TalkSemanticAgent.class/methodProperties.json index 4482dd65..c5112bd7 100644 --- a/packages/SqueakInboxTalkExtras-Semantics.package/TalkSemanticAgent.class/methodProperties.json +++ b/packages/SqueakInboxTalkExtras-Semantics.package/TalkSemanticAgent.class/methodProperties.json @@ -10,4 +10,4 @@ "inbox:" : "ct 6/19/2024 17:10", "initializeConversation:" : "ct 6/8/2024 00:28", "openResults:" : "ct 6/7/2024 21:04", - "searchExact:semantic:" : "ct 6/19/2024 17:59" } } + "searchExact:semantic:" : "ct 6/20/2024 01:06" } }