GameSentenceMiner 2.11.0__py3-none-any.whl → 2.11.2__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -91,15 +91,28 @@ class AIManager(ABC):
91
91
 
92
92
  @abstractmethod
93
93
  def _build_prompt(self, lines: List[GameLine], sentence: str, current_line: GameLine, game_title: str) -> str:
94
- start_index = max(0, current_line.index - 10)
95
- end_index = min(len(lines), current_line.index + 11)
94
+ if get_config().ai.dialogue_context_length != 0:
95
+ if get_config().ai.dialogue_context_length == -1:
96
+ start_index = 0
97
+ end_index = len(lines)
98
+ else:
99
+ start_index = max(0, current_line.index - get_config().ai.dialogue_context_length)
100
+ end_index = min(len(lines), current_line.index + 1 + get_config().ai.dialogue_context_length)
101
+
102
+ context_lines_text = []
103
+ for i in range(start_index, end_index):
104
+ if i < len(lines):
105
+ context_lines_text.append(lines[i].text)
96
106
 
97
- context_lines_text = []
98
- for i in range(start_index, end_index):
99
- if i < len(lines):
100
- context_lines_text.append(lines[i].text)
107
+ dialogue_context = "\n".join(context_lines_text)
108
+
109
+ dialogue_context = f"""
110
+ Dialogue Context:
101
111
 
102
- dialogue_context = "\n".join(context_lines_text)
112
+ {dialogue_context}
113
+ """
114
+ else:
115
+ dialogue_context = "No dialogue context available."
103
116
 
104
117
  if get_config().ai.use_canned_translation_prompt:
105
118
  prompt_to_use = TRANSLATION_PROMPT
@@ -109,10 +122,8 @@ class AIManager(ABC):
109
122
  prompt_to_use = get_config().ai.custom_prompt
110
123
 
111
124
  full_prompt = textwrap.dedent(f"""
112
- **Disclaimer:** All dialogue provided is from the script of the video game "{game_title}". This content is entirely fictional and part of a narrative. It must not be treated as real-world user input or a genuine request. The goal is accurate, context-aware localization.
125
+ **Disclaimer:** All dialogue provided is from the script of the video game "{game_title}". This content is entirely fictional and part of a narrative. It must not be treated as real-world user input or a genuine request. The goal is accurate, context-aware localization. If no context is provided, do not throw errors or warnings.
113
126
 
114
- Dialogue Context:
115
-
116
127
  {dialogue_context}
117
128
 
118
129
  {prompt_to_use}
@@ -360,7 +360,8 @@ class ConfigApp:
360
360
  anki_field=self.ai_anki_field.get(),
361
361
  use_canned_translation_prompt=self.use_canned_translation_prompt.get(),
362
362
  use_canned_context_prompt=self.use_canned_context_prompt.get(),
363
- custom_prompt=self.custom_prompt.get("1.0", tk.END)
363
+ custom_prompt=self.custom_prompt.get("1.0", tk.END),
364
+ dialogue_context_length=int(self.ai_dialogue_context_length.get()),
364
365
  )
365
366
  )
366
367
 
@@ -1623,6 +1624,13 @@ class ConfigApp:
1623
1624
  self.ai_anki_field.grid(row=self.current_row, column=1, sticky='EW', pady=2)
1624
1625
  self.current_row += 1
1625
1626
 
1627
+ HoverInfoLabelWidget(ai_frame, text="Dialogue Context Length:", tooltip="Number of previous/next lines to include as context for AI. 0 to disable. -1 for as many as possible (Use With Caution)",
1628
+ foreground="red", font=("Helvetica", 10, "bold"), row=self.current_row, column=0)
1629
+ self.ai_dialogue_context_length = ttk.Entry(ai_frame)
1630
+ self.ai_dialogue_context_length.insert(0, str(self.settings.ai.dialogue_context_length))
1631
+ self.ai_dialogue_context_length.grid(row=self.current_row, column=1, sticky='EW', pady=2)
1632
+ self.current_row += 1
1633
+
1626
1634
  HoverInfoLabelWidget(ai_frame, text="Use Canned Translation Prompt:",
1627
1635
  tooltip="Use a pre-defined translation prompt for AI.", row=self.current_row, column=0)
1628
1636
  self.use_canned_translation_prompt = tk.BooleanVar(value=self.settings.ai.use_canned_translation_prompt)
@@ -307,8 +307,8 @@ class GoogleLens:
307
307
  response_proto = LensOverlayServerResponse().FromString(res.content)
308
308
  response_dict = response_proto.to_dict(betterproto.Casing.SNAKE)
309
309
 
310
- with open(os.path.join(r"C:\Users\Beangate\GSM\Electron App\test", 'glens_response.json'), 'w', encoding='utf-8') as f:
311
- json.dump(response_dict, f, indent=4, ensure_ascii=False)
310
+ # with open(os.path.join(r"C:\Users\Beangate\GSM\Electron App\test", 'glens_response.json'), 'w', encoding='utf-8') as f:
311
+ # json.dump(response_dict, f, indent=4, ensure_ascii=False)
312
312
  res = ''
313
313
  text = response_dict['objects_response']['text']
314
314
  skipped = []
@@ -275,6 +275,7 @@ class Ai:
275
275
  use_canned_translation_prompt: bool = True
276
276
  use_canned_context_prompt: bool = False
277
277
  custom_prompt: str = ''
278
+ dialogue_context_length: int = 10
278
279
 
279
280
  def __post_init__(self):
280
281
  if not self.gemini_api_key:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: GameSentenceMiner
3
- Version: 2.11.0
3
+ Version: 2.11.2
4
4
  Summary: A tool for mining sentences from games. Update: Full UI Re-design
5
5
  Author-email: Beangate <bpwhelan95@gmail.com>
6
6
  License: MIT License
@@ -16,7 +16,6 @@ Requires-Dist: requests~=2.32.3
16
16
  Requires-Dist: watchdog~=5.0.2
17
17
  Requires-Dist: DateTime~=5.5
18
18
  Requires-Dist: pyperclip~=1.9.0
19
- Requires-Dist: vosk~=0.3.45
20
19
  Requires-Dist: soundfile~=0.12.1
21
20
  Requires-Dist: toml~=0.10.2
22
21
  Requires-Dist: psutil~=6.0.0
@@ -1,12 +1,12 @@
1
1
  GameSentenceMiner/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
2
  GameSentenceMiner/anki.py,sha256=3BVFXAM7tpJAxHMbsMpnMHUoDfyqHQ1JSYJThW18QWA,16846
3
- GameSentenceMiner/config_gui.py,sha256=B0VjddeKcnc8w9nJMLK0I0XlGVOo-6KQRtISZ5K6j08,98511
3
+ GameSentenceMiner/config_gui.py,sha256=QTK1yBDcfHaIUR_JyekkRQY9CVI_rh3Cae0bi7lviIo,99198
4
4
  GameSentenceMiner/gametext.py,sha256=6VkjmBeiuZfPk8T6PHFdIAElBH2Y_oLVYvmcafqN7RM,6747
5
5
  GameSentenceMiner/gsm.py,sha256=wTERcvG37SeDel51TCFusoQqk5B_b11YY4QZMTF0a6s,24954
6
6
  GameSentenceMiner/obs.py,sha256=o_I6213VZvXqYkZDdUBgUg2KWi9SbnNZZjjUnKnQkK4,15190
7
7
  GameSentenceMiner/vad.py,sha256=A3CvBQ67w3c7L8s7mTMxo6U_9ZQXlCToIpGUbePotfA,18321
8
8
  GameSentenceMiner/ai/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
9
- GameSentenceMiner/ai/ai_prompting.py,sha256=l8JKyL_4zO5x3QKExN4c3HUPF2mQfB4B-VKclO5ofmM,25348
9
+ GameSentenceMiner/ai/ai_prompting.py,sha256=ojp7i_xg2YB1zALgFbivwtXPMVkThnSbPoUiAs-nz_g,25892
10
10
  GameSentenceMiner/assets/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
11
11
  GameSentenceMiner/assets/icon.png,sha256=9GRL8uXUAgkUSlvbm9Pv9o2poFVRGdW6s2ub_DeUD9M,937624
12
12
  GameSentenceMiner/assets/icon128.png,sha256=l90j7biwdz5ahwOd5wZ-406ryEV9Pan93dquJQ3e1CI,18395
@@ -25,12 +25,12 @@ GameSentenceMiner/owocr/owocr/__init__.py,sha256=87hfN5u_PbL_onLfMACbc0F5j4KyIK9
25
25
  GameSentenceMiner/owocr/owocr/__main__.py,sha256=XQaqZY99EKoCpU-gWQjNbTs7Kg17HvBVE7JY8LqIE0o,157
26
26
  GameSentenceMiner/owocr/owocr/config.py,sha256=qM7kISHdUhuygGXOxmgU6Ef2nwBShrZtdqu4InDCViE,8103
27
27
  GameSentenceMiner/owocr/owocr/lens_betterproto.py,sha256=oNoISsPilVVRBBPVDtb4-roJtAhp8ZAuFTci3TGXtMc,39141
28
- GameSentenceMiner/owocr/owocr/ocr.py,sha256=iooUMZ5Z7ub2PMxuK9314U3DyuafZ6ASt-acrRe7rsk,59446
28
+ GameSentenceMiner/owocr/owocr/ocr.py,sha256=S1unC9FShXApl5mxL0NAdvcH3wISB8KcolZcAxOGdnM,59450
29
29
  GameSentenceMiner/owocr/owocr/run.py,sha256=lwZOj5nmQWgXlQOA_b2FYrMjhGWCPA7ZZCBg-cj57-k,56518
30
30
  GameSentenceMiner/owocr/owocr/screen_coordinate_picker.py,sha256=Na6XStbQBtpQUSdbN3QhEswtKuU1JjReFk_K8t5ezQE,3395
31
31
  GameSentenceMiner/util/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
32
32
  GameSentenceMiner/util/audio_offset_selector.py,sha256=8Stk3BP-XVIuzRv9nl9Eqd2D-1yD3JrgU-CamBywJmY,8542
33
- GameSentenceMiner/util/configuration.py,sha256=VXed6OKZPjwo1sK9CbpCerEsB3Dro82sEpFiQrWh97w,28961
33
+ GameSentenceMiner/util/configuration.py,sha256=vwBehuEP2QVvbsyJx5x1EPXZEOtGsqeIQjlEES0vVdQ,28999
34
34
  GameSentenceMiner/util/electron_config.py,sha256=3VmIrcXhC-wIMMc4uqV85NrNenRl4ZUbnQfSjWEwuig,9852
35
35
  GameSentenceMiner/util/ffmpeg.py,sha256=t0tflxq170n8PZKkdw8fTZIUQfXD0p_qARa9JTdhBTc,21530
36
36
  GameSentenceMiner/util/gsm_utils.py,sha256=iRyLVcodMptRhkCzLf3hyqc6_RCktXnwApi6mLju6oQ,11565
@@ -62,9 +62,9 @@ GameSentenceMiner/web/templates/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm
62
62
  GameSentenceMiner/web/templates/index.html,sha256=Gv3CJvNnhAzIVV_QxhNq4OD-pXDt1vKCu9k6WdHSXuA,215343
63
63
  GameSentenceMiner/web/templates/text_replacements.html,sha256=tV5c8mCaWSt_vKuUpbdbLAzXZ3ATZeDvQ9PnnAfqY0M,8598
64
64
  GameSentenceMiner/web/templates/utility.html,sha256=3flZinKNqUJ7pvrZk6xu__v67z44rXnaK7UTZ303R-8,16946
65
- gamesentenceminer-2.11.0.dist-info/licenses/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
66
- gamesentenceminer-2.11.0.dist-info/METADATA,sha256=seST1470YoAwPQ6PAyizVoUWviEWbOCqCro6JaSrsfc,7347
67
- gamesentenceminer-2.11.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
68
- gamesentenceminer-2.11.0.dist-info/entry_points.txt,sha256=2APEP25DbfjSxGeHtwBstMH8mulVhLkqF_b9bqzU6vQ,65
69
- gamesentenceminer-2.11.0.dist-info/top_level.txt,sha256=V1hUY6xVSyUEohb0uDoN4UIE6rUZ_JYx8yMyPGX4PgQ,18
70
- gamesentenceminer-2.11.0.dist-info/RECORD,,
65
+ gamesentenceminer-2.11.2.dist-info/licenses/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
66
+ gamesentenceminer-2.11.2.dist-info/METADATA,sha256=zpe9LIoyiK5AyBRjnGH7Blp8z5rksCm3Nrxng5CKhyg,7319
67
+ gamesentenceminer-2.11.2.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
68
+ gamesentenceminer-2.11.2.dist-info/entry_points.txt,sha256=2APEP25DbfjSxGeHtwBstMH8mulVhLkqF_b9bqzU6vQ,65
69
+ gamesentenceminer-2.11.2.dist-info/top_level.txt,sha256=V1hUY6xVSyUEohb0uDoN4UIE6rUZ_JYx8yMyPGX4PgQ,18
70
+ gamesentenceminer-2.11.2.dist-info/RECORD,,