Spaces:
Running
Running
Bohaska
commited on
Commit
·
aab4729
1
Parent(s):
973d0ad
Fix wording of issue search webpage
Browse files
app.py
CHANGED
|
@@ -262,7 +262,7 @@ def search_issues(query: str, search_type: str = 'semantic', scope: str = 'both'
|
|
| 262 |
indexed = list(enumerate(scores))
|
| 263 |
indexed.sort(key=lambda x: x[1], reverse=True)
|
| 264 |
|
| 265 |
-
out = [f"# Top 20 Issue Results (Loose
|
| 266 |
if not indexed:
|
| 267 |
out.append("No matches found.")
|
| 268 |
return "\n".join(out)
|
|
@@ -283,7 +283,7 @@ def search_issues(query: str, search_type: str = 'semantic', scope: str = 'both'
|
|
| 283 |
if ql in issue_text.lower():
|
| 284 |
strict_matches.append(i)
|
| 285 |
|
| 286 |
-
out = [f"# Top 20 Issue Search Results (Strict
|
| 287 |
if not strict_matches:
|
| 288 |
out.append("No exact matches found.")
|
| 289 |
return "\n".join(out)
|
|
@@ -423,7 +423,9 @@ def search_ga_resolutions(search_term: str, hide_repealed: bool, hide_repeal_cat
|
|
| 423 |
with gr.Blocks() as demo:
|
| 424 |
gr.Markdown("""
|
| 425 |
# NationStates Semantic Search
|
| 426 |
-
Search NationStates issues and GA resolutions. Choose semantic for conceptual similarity, loose for keyword matching, and strict for exact substring queries.
|
|
|
|
|
|
|
| 427 |
""")
|
| 428 |
|
| 429 |
with gr.Tabs() as tabs:
|
|
@@ -431,16 +433,13 @@ with gr.Blocks() as demo:
|
|
| 431 |
with gr.TabItem("Issue Search"):
|
| 432 |
gr.Markdown("""
|
| 433 |
### Search NationStates Issues
|
| 434 |
-
- Semantic: component-level (descriptions and/or options), honors Scope.
|
| 435 |
-
- Loose: issue-level keywords (Scope is ignored).
|
| 436 |
-
- Strict: issue-level exact/substring (Scope is ignored).
|
| 437 |
""")
|
| 438 |
issue_search_interface = gr.Interface(
|
| 439 |
fn=search_issues,
|
| 440 |
inputs=[
|
| 441 |
gr.Textbox(label="Search term", placeholder="What issue or option are you looking for?"),
|
| 442 |
gr.Radio(["semantic", "loose", "strict"], label="Search Type", value="semantic",
|
| 443 |
-
info="semantic:
|
| 444 |
gr.Radio(["both", "descriptions", "options"], label="Scope (semantic only)", value="both",
|
| 445 |
info="Only applies to semantic search; ignored for loose and strict.")
|
| 446 |
],
|
|
@@ -455,7 +454,7 @@ with gr.Blocks() as demo:
|
|
| 455 |
title=None,
|
| 456 |
description=None,
|
| 457 |
submit_btn="Search Issues",
|
| 458 |
-
article="Made by [Jiangbei](www.nationstates.net/nation=jiangbei).
|
| 459 |
)
|
| 460 |
|
| 461 |
# GA Resolution Search Tab
|
|
|
|
| 262 |
indexed = list(enumerate(scores))
|
| 263 |
indexed.sort(key=lambda x: x[1], reverse=True)
|
| 264 |
|
| 265 |
+
out = [f"# Top 20 Issue Results (Loose)"]
|
| 266 |
if not indexed:
|
| 267 |
out.append("No matches found.")
|
| 268 |
return "\n".join(out)
|
|
|
|
| 283 |
if ql in issue_text.lower():
|
| 284 |
strict_matches.append(i)
|
| 285 |
|
| 286 |
+
out = [f"# Top 20 Issue Search Results (Strict)"]
|
| 287 |
if not strict_matches:
|
| 288 |
out.append("No exact matches found.")
|
| 289 |
return "\n".join(out)
|
|
|
|
| 423 |
with gr.Blocks() as demo:
|
| 424 |
gr.Markdown("""
|
| 425 |
# NationStates Semantic Search
|
| 426 |
+
Search NationStates issues and GA resolutions. Choose semantic for conceptual similarity, loose for keyword matching, and strict for exact substring queries.
|
| 427 |
+
For semantic search, you can decide whether to search for only descriptions, only options, or both. For finding duplicate topics, I recommend using description-only.
|
| 428 |
+
Please check the text of issue search results when determining whether your idea is a duplicate or not.
|
| 429 |
""")
|
| 430 |
|
| 431 |
with gr.Tabs() as tabs:
|
|
|
|
| 433 |
with gr.TabItem("Issue Search"):
|
| 434 |
gr.Markdown("""
|
| 435 |
### Search NationStates Issues
|
|
|
|
|
|
|
|
|
|
| 436 |
""")
|
| 437 |
issue_search_interface = gr.Interface(
|
| 438 |
fn=search_issues,
|
| 439 |
inputs=[
|
| 440 |
gr.Textbox(label="Search term", placeholder="What issue or option are you looking for?"),
|
| 441 |
gr.Radio(["semantic", "loose", "strict"], label="Search Type", value="semantic",
|
| 442 |
+
info="semantic: meaning-based; loose: keyword; strict: exact substring"),
|
| 443 |
gr.Radio(["both", "descriptions", "options"], label="Scope (semantic only)", value="both",
|
| 444 |
info="Only applies to semantic search; ignored for loose and strict.")
|
| 445 |
],
|
|
|
|
| 454 |
title=None,
|
| 455 |
description=None,
|
| 456 |
submit_btn="Search Issues",
|
| 457 |
+
article="Made by [Jiangbei](www.nationstates.net/nation=jiangbei). Issue data from Valentine Z. Powered by BAAI/bge-m3."
|
| 458 |
)
|
| 459 |
|
| 460 |
# GA Resolution Search Tab
|