docstrings, changes to equivalence.ipynb
parent
fc600df5f1
commit
92ab1227ed
|
@ -2165,15 +2165,17 @@
|
|||
"The weights dictionary should contain both the weight and the comparison function for each property. You may use the default weights and functions, or provide your own.\n",
|
||||
"\n",
|
||||
"##### Existing comparison functions\n",
|
||||
"For reference, here is a list of the comparison functions already built in the codebase (found in [stix2/environment.py](../api/stix2.environment.rst#stix2.environment.Environment)):\n",
|
||||
"For reference, here is a list of the comparison functions already built in the codebase (found in [stix2/equivalence/object](../api/equivalence/stix2.equivalence.object.rst#module-stix2.equivalence.object)):\n",
|
||||
"\n",
|
||||
" - [custom_pattern_based](../api/stix2.environment.rst#stix2.environment.custom_pattern_based)\n",
|
||||
" - [exact_match](../api/stix2.environment.rst#stix2.environment.exact_match)\n",
|
||||
" - [partial_external_reference_based](../api/stix2.environment.rst#stix2.environment.partial_external_reference_based)\n",
|
||||
" - [partial_list_based](../api/stix2.environment.rst#stix2.environment.partial_list_based)\n",
|
||||
" - [partial_location_distance](../api/stix2.environment.rst#stix2.environment.partial_location_distance)\n",
|
||||
" - [partial_string_based](../api/stix2.environment.rst#stix2.environment.partial_string_based)\n",
|
||||
" - [partial_timestamp_based](../api/stix2.environment.rst#stix2.environment.partial_timestamp_based)\n",
|
||||
" - [custom_pattern_based](../api/equivalence/stix2.equivalence.object.rst#stix2.equivalence.object.custom_pattern_based)\n",
|
||||
" - [exact_match](../api/equivalence/stix2.equivalence.object.rst#stix2.equivalence.object.exact_match)\n",
|
||||
" - [list_reference_check](../api/equivalence/stix2.equivalence.object.rst#stix2.equivalence.object.list_reference_check)\n",
|
||||
" - [partial_external_reference_based](../api/equivalence/stix2.equivalence.object.rst#stix2.equivalence.object.partial_external_reference_based)\n",
|
||||
" - [partial_list_based](../api/equivalence/stix2.equivalence.object.rst#stix2.equivalence.object.partial_list_based)\n",
|
||||
" - [partial_location_distance](../api/equivalence/stix2.equivalence.object.rst#stix2.equivalence.object.partial_location_distance)\n",
|
||||
" - [partial_string_based](../api/equivalence/stix2.equivalence.object.rst#stix2.equivalence.object.partial_string_based)\n",
|
||||
" - [partial_timestamp_based](../api/equivalence/stix2.equivalence.object.rst#stix2.equivalence.object.partial_timestamp_based)\n",
|
||||
" - [reference_check](../api/equivalence/stix2.equivalence.object.rst#stix2.equivalence.object.reference_check)\n",
|
||||
"\n",
|
||||
"For instance, if we wanted to compare two of the `ThreatActor`s from before, but use our own weights, then we could do the following:"
|
||||
]
|
||||
|
|
|
@ -4,7 +4,7 @@ import copy
|
|||
from .datastore import CompositeDataSource, DataStoreMixin
|
||||
from .equivalence.graph import graphically_equivalent
|
||||
from .equivalence.object import ( # noqa: F401
|
||||
check_property_present, custom_pattern_based, exact_match,
|
||||
WEIGHTS, check_property_present, custom_pattern_based, exact_match,
|
||||
list_reference_check, partial_external_reference_based, partial_list_based,
|
||||
partial_location_distance, partial_string_based, partial_timestamp_based,
|
||||
reference_check, semantically_equivalent,
|
||||
|
@ -222,7 +222,7 @@ class Environment(DataStoreMixin):
|
|||
Note:
|
||||
Default weights_dict:
|
||||
|
||||
.. include:: ../default_sem_eq_weights.rst
|
||||
.. include:: ../object_default_sem_eq_weights.rst
|
||||
|
||||
Note:
|
||||
This implementation follows the Semantic Equivalence Committee Note.
|
||||
|
@ -260,7 +260,7 @@ class Environment(DataStoreMixin):
|
|||
Note:
|
||||
Default weights_dict:
|
||||
|
||||
.. include:: ../default_sem_eq_weights.rst
|
||||
.. include:: ../graph_default_sem_eq_weights.rst
|
||||
|
||||
Note:
|
||||
This implementation follows the Semantic Equivalence Committee Note.
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
"""Python APIs for STIX 2 Graph-based Semantic Equivalence."""
|
||||
import logging
|
||||
|
||||
from ..object import (
|
||||
|
@ -36,7 +37,7 @@ def graphically_equivalent(ds1, ds2, prop_scores={}, **weight_dict):
|
|||
Note:
|
||||
Default weights_dict:
|
||||
|
||||
.. include:: ../default_sem_eq_weights.rst
|
||||
.. include:: ../../graph_default_sem_eq_weights.rst
|
||||
|
||||
Note:
|
||||
This implementation follows the Semantic Equivalence Committee Note.
|
||||
|
@ -133,4 +134,4 @@ GRAPH_WEIGHTS.update({
|
|||
"ds2": None,
|
||||
"max_depth": 1,
|
||||
},
|
||||
}) #: :autodoc-skip:
|
||||
}) # :autodoc-skip:
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
"""Python APIs for STIX 2 Object-based Semantic Equivalence."""
|
||||
import logging
|
||||
import time
|
||||
|
||||
|
@ -32,7 +33,7 @@ def semantically_equivalent(obj1, obj2, prop_scores={}, **weight_dict):
|
|||
Note:
|
||||
Default weights_dict:
|
||||
|
||||
.. include:: ../default_sem_eq_weights.rst
|
||||
.. include:: ../../object_default_sem_eq_weights.rst
|
||||
|
||||
Note:
|
||||
This implementation follows the Semantic Equivalence Committee Note.
|
||||
|
@ -448,4 +449,4 @@ WEIGHTS = {
|
|||
"_internal": {
|
||||
"ignore_spec_version": False,
|
||||
},
|
||||
} #: :autodoc-skip:
|
||||
} # :autodoc-skip:
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
"""Python APIs for STIX 2 Pattern Semantic Equivalence.
|
||||
|
||||
.. autosummary::
|
||||
:toctree: patterns
|
||||
:toctree: pattern
|
||||
|
||||
compare
|
||||
transform
|
||||
|
|
Loading…
Reference in New Issue