Ontology Based
OntologyBasedFilter
Source code in engines/contentFilterEngine/other_approaches/ontology_based.py
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 |
|
__init__(ontology_path)
Initializes the OntologyBasedFilter with a specific ontology.
Parameters: - ontology_path (str): The file path to the ontology (.owl) file.
Source code in engines/contentFilterEngine/other_approaches/ontology_based.py
4 5 6 7 8 9 10 11 12 13 14 |
|
filter_content(content)
Filters the content based on ontology-defined relationships.
Parameters: - content (str): The content to be filtered.
Returns: - dict: A dictionary with 'status' and 'related_concepts'.
Source code in engines/contentFilterEngine/other_approaches/ontology_based.py
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
|
find_related_concepts(concepts)
Finds related concepts within the ontology.
Parameters: - concepts (set): A set of concepts to find relationships for.
Returns: - dict: A dictionary mapping each concept to its related concepts.
Source code in engines/contentFilterEngine/other_approaches/ontology_based.py
53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 |
|
get_concepts(content)
Extracts concepts from the content based on the ontology.
Parameters: - content (str): The content to extract concepts from.
Returns: - set: A set of concepts identified in the content.
Source code in engines/contentFilterEngine/other_approaches/ontology_based.py
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
|