AD2000X commited on
Commit
5b8b134
·
verified ·
1 Parent(s): a4a05ae

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -6
app.py CHANGED
@@ -579,10 +579,10 @@ def run_detailed_comparison():
579
 
580
  # Direct Relevance - Based on Keywords
581
  if any(kw in content.lower() for kw in query.lower().split()):
582
- metrics["Direct Relevance"] += 1 # Fixed key name
583
 
584
  # Semantic richness - based on text length
585
- metrics["Semantic Richness"] += min(1, len(content.split()) / 50) # Fixed key name
586
 
587
  # Structural information - from ontology
588
  if hasattr(doc, "metadata") and doc.metadata.get("source") in ["ontology", "ontology_context"]:
@@ -590,7 +590,7 @@ def run_detailed_comparison():
590
 
591
  # Relationship information - from path
592
  if hasattr(doc, "metadata") and doc.metadata.get("source") == "semantic_path":
593
- metrics["Relationship Information"] += 1 # Fixed key name
594
 
595
  # Standardization
596
  for key in metrics:
@@ -613,7 +613,7 @@ def run_detailed_comparison():
613
  fig = px.line_polar(
614
  metrics_df,
615
  r=["Traditional RAG", "Ontology-Enhanced RAG"],
616
- theta="metrics", # Fixed column name
617
  line_close=True,
618
  range_r=[0, 10],
619
  title="Context Quality Comparison"
@@ -706,5 +706,4 @@ def run_detailed_comparison():
706
  """)
707
 
708
  if __name__ == "__main__":
709
- main()
710
-
 
579
 
580
  # Direct Relevance - Based on Keywords
581
  if any(kw in content.lower() for kw in query.lower().split()):
582
+ metrics["Direct Relevance"] += 1
583
 
584
  # Semantic richness - based on text length
585
+ metrics["Semantic Richness"] += min(1, len(content.split()) / 50)
586
 
587
  # Structural information - from ontology
588
  if hasattr(doc, "metadata") and doc.metadata.get("source") in ["ontology", "ontology_context"]:
 
590
 
591
  # Relationship information - from path
592
  if hasattr(doc, "metadata") and doc.metadata.get("source") == "semantic_path":
593
+ metrics["Relationship Information"] += 1
594
 
595
  # Standardization
596
  for key in metrics:
 
613
  fig = px.line_polar(
614
  metrics_df,
615
  r=["Traditional RAG", "Ontology-Enhanced RAG"],
616
+ theta="metrics",
617
  line_close=True,
618
  range_r=[0, 10],
619
  title="Context Quality Comparison"
 
706
  """)
707
 
708
  if __name__ == "__main__":
709
+ main()