ASPL Programming ver 1.00
© 2024 Bassem W. Jamaleddine
13. 19similarity calculates the similarities of one or more set variables
similarity a1 [a2 .. aN] where a1 [a2 .. aN] are set variables
similarity`fflc a1 [a2 .. aN]
similarity
When specified by itself then gets the similarity between the two objects on top of the answer stack
similarity cosStruc 1* ins:H_H_H ret:cosStruc
Use the similarity operator to compare one or many set variables. This operator is setadic (it comes first on the line) then it is followed by one or more set variables. However it can be preceded by a left variable and the equal sign, in which case the similarity result is assigned to the left variable and the result in saved in ASPL COS symbol table.
similarity EXAMPLE1In the sample workspace RANDONEBITMIX we created random groups, subgroups, and elements, then saved their results to set variables. In this example we will start ASPL by loading RANDONEBITMIX workspace and show some useful tips on how to interrogate the similarity of a set variable.
similarity OPERATION1# aspl RANDONEBITMIX
① aspl> v
② aspl> sim mg123
(show the similarity of the set variable mg123)
③ aspl> sim mg123 g1
(show the similarity of the set variables mg123 and g1)
④ aspl> sim a1 a2 a3
(show the similarity between a1, a2, and a3)
⑤ aspl> ? mg123
(interrogate mg123)
⑥ aspl> v sorted
(sort and view the symbol table )
⑦ aspl> @sim mg123
(show the similarity or archived set variable mg123)
Figure FFFF shows the operations performed in this first example.
Figure eg-op-similarity-1.png
The interrogation of set variable mg123 and its historical similarity is shown in figure FFFF.
Figure eg-op-similarity-2.png
similarity EXAMPLE2Having defined the set variables a1, a2, and a3, you want to show the similarity between these three variables. This example starts ASPL by loading the WS1 workspace then the similarity operator is used to compare the set variables a1, a2, and a3.
Use the tick operator to get the similarity according to a predicate (shown in the table below). For example, You want to show the similarity between variables a1, a2, and a3 taking into consideration the checksum attribute of their elements.
You can also save the similarity results into COS variables. ASPL has a COS symbol table where COS variables are saved. You can display the content of the COS symbol table with the COS command, and you can even interrogate a COS variable by preceding it with the COS interrogation operator ?c. The following operations summarize the usage of the similarity operator and the ?c operator.
similarity OPERATION2① aspl> sim a1 a2 a3
(show the similarity between a1, a2, and a3)
② aspl> sim`c a1 a2 a3
(show the similarity between a1, a2, and a3 considering the checksum attribute)
③ aspl> sima123 = sim a1 a2 a3
(assign to the COS variable sima123 the similarity result)
④ aspl> cos
(view the COS symbol table)
⑤ aspl> c d sima123
(print the internals of the COS variable sima123)
⑥ aspl> ?c sima123
(interrogating the COS variable sima123)
⑦ aspl> cos sorted
(show the sorted COS symbol table, likely no change)
Figure FFFF shows the operations performed in this second example.
Figure eg-op-similarity-3.png
The interrogation of COS variable sima123 and its historical similarity is shown in figure FFFF. Since no change in the variables then the similarities remained the same and the COS variable remained the same without any historical.
Figure eg-op-similarity-4.png
● Tickable Predicates for similarity
This c*& is tickable with predicates that are shown in the following table:
a yellow note
similarity`_ similarity on the aggregated element containment names similarity`ffl similarity on the aggregated element containment names similarity`f similarity on the aggregated element names similarity`c similarity on the aggregated checksums of the named elements similarity`z similarity on the aggregated zsums of the named elements similarity`fflz similarity on the aggregated element containment names AND their zsums similarity`dosi similarity on the aggregated document similarities of the named elements similarity`h similarity on the aggregated entropies of the named elements similarity`c similarity on the aggregated checksums of the named elements similarity`fc similarity on the aggregated named elements AND their checksums similarity`fflc similarity on the aggregated element containment names AND their checksums similarity`fflmtm similarity on the aggregated element containment names AND their make time similarity`mtm similarity on the aggregated make times of the named elements similarity`fmtm similarity on the aggregated named elements AND their make times similarity`d similarity on the aggregated containment subgroups similarity`dmtm similarity on the aggregated containment subgroups AND the make times of the subgroups