graphai.core.text.graph module
- class graphai.core.text.graph.ConceptsGraph
Bases:
object
- load_from_db()
- get_ontology_concepts()
- add_graph_score(results, smoothing=True)
Computes graph_score for the provided DataFrame containing concepts.
- Parameters:
results (pd.DataFrame) – A pandas DataFrame including the column [‘concept_id’].
smoothing (bool) – Whether to apply a transformation to the graph_score that bumps scores to avoid
Default (a negative exponential shape.) – True.
- Returns:
A pandas DataFrame with the original columns plus [‘graph_score’].
- Return type:
pd.DataFrame
- add_ontology_scores(results, smoothing=True)
Computes ontology_local_score and ontology_global_score for the provided DataFrame containing keywords and concepts.
- Parameters:
results (pd.DataFrame) – A pandas DataFrame including the columns [‘keywords’, ‘concept_id’].
smoothing (bool) – Whether to apply a transformation to the ontology scores that pushes scores away from 0.5. Default: True.
- Returns:
A pandas DataFrame with the original columns plus [‘ontology_local_score’, ‘ontology_global_score’].
- Return type:
pd.DataFrame