abdiharyadi commited on
Commit
17757ae
·
1 Parent(s): d4efbb2

fix: use separate methods for triplets and style words to resolve style detector issue

Browse files
Files changed (1) hide show
  1. app.py +6 -10
app.py CHANGED
@@ -40,20 +40,16 @@ def run(text, source_style):
40
  source_amr_display = "(z0 / halo)"
41
  yield source_amr_display, "...", "...", "...", "..."
42
 
43
- triplet_display_dict = {"data": "..."}
44
- def triplets_callback(triplets: list):
45
- triplet_display_dict["data"] = "\n".join(f"({x[0]}, {x[1]}, {x[2]})" for x in triplets)
46
- triplets_display = triplet_display_dict["data"]
47
- yield source_amr_display, triplets_display, "...", "...", "..."
48
-
49
- style_words = sd(text, triplets_callback=triplets_callback)
50
- # style_words = ["bagus", "bersih"]
51
  # triplets = [
52
  # ("kamar", "sangat bagus", "positif"),
53
  # ("kamar", "bersih", "positif")
54
  # ]
55
- # triplets_display = "\n".join(f"({x[0]}, {x[1]}, {x[2]})" for x in triplets)
56
- triplets_display = triplet_display_dict["data"]
 
 
 
57
  style_words_display = ", ".join(style_words)
58
  yield source_amr_display, triplets_display, style_words_display, "...", "..."
59
 
 
40
  source_amr_display = "(z0 / halo)"
41
  yield source_amr_display, "...", "...", "...", "..."
42
 
43
+ triplets = sd.get_triplets(text)
 
 
 
 
 
 
 
44
  # triplets = [
45
  # ("kamar", "sangat bagus", "positif"),
46
  # ("kamar", "bersih", "positif")
47
  # ]
48
+ triplets_display = "\n".join(f"({x[0]}, {x[1]}, {x[2]})" for x in triplets)
49
+ yield source_amr_display, triplets_display, "...", "...", "..."
50
+
51
+ style_words = sd.get_style_words_from_triplets(triplets)
52
+ # style_words = ["bagus", "bersih"]
53
  style_words_display = ", ".join(style_words)
54
  yield source_amr_display, triplets_display, style_words_display, "...", "..."
55