GameSentenceMiner 2.14.13__tar.gz → 2.14.15__tar.gz

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.
Files changed (84) hide show
  1. {gamesentenceminer-2.14.13 → gamesentenceminer-2.14.15}/GameSentenceMiner/ocr/owocr_helper.py +1 -1
  2. {gamesentenceminer-2.14.13 → gamesentenceminer-2.14.15}/GameSentenceMiner/owocr/owocr/ocr.py +24 -16
  3. {gamesentenceminer-2.14.13 → gamesentenceminer-2.14.15}/GameSentenceMiner/owocr/owocr/run.py +24 -11
  4. {gamesentenceminer-2.14.13 → gamesentenceminer-2.14.15}/GameSentenceMiner.egg-info/PKG-INFO +1 -1
  5. {gamesentenceminer-2.14.13 → gamesentenceminer-2.14.15}/PKG-INFO +1 -1
  6. {gamesentenceminer-2.14.13 → gamesentenceminer-2.14.15}/pyproject.toml +1 -1
  7. {gamesentenceminer-2.14.13 → gamesentenceminer-2.14.15}/GameSentenceMiner/__init__.py +0 -0
  8. {gamesentenceminer-2.14.13 → gamesentenceminer-2.14.15}/GameSentenceMiner/ai/__init__.py +0 -0
  9. {gamesentenceminer-2.14.13 → gamesentenceminer-2.14.15}/GameSentenceMiner/ai/ai_prompting.py +0 -0
  10. {gamesentenceminer-2.14.13 → gamesentenceminer-2.14.15}/GameSentenceMiner/anki.py +0 -0
  11. {gamesentenceminer-2.14.13 → gamesentenceminer-2.14.15}/GameSentenceMiner/assets/__init__.py +0 -0
  12. {gamesentenceminer-2.14.13 → gamesentenceminer-2.14.15}/GameSentenceMiner/assets/icon.png +0 -0
  13. {gamesentenceminer-2.14.13 → gamesentenceminer-2.14.15}/GameSentenceMiner/assets/icon128.png +0 -0
  14. {gamesentenceminer-2.14.13 → gamesentenceminer-2.14.15}/GameSentenceMiner/assets/icon256.png +0 -0
  15. {gamesentenceminer-2.14.13 → gamesentenceminer-2.14.15}/GameSentenceMiner/assets/icon32.png +0 -0
  16. {gamesentenceminer-2.14.13 → gamesentenceminer-2.14.15}/GameSentenceMiner/assets/icon512.png +0 -0
  17. {gamesentenceminer-2.14.13 → gamesentenceminer-2.14.15}/GameSentenceMiner/assets/icon64.png +0 -0
  18. {gamesentenceminer-2.14.13 → gamesentenceminer-2.14.15}/GameSentenceMiner/assets/pickaxe.png +0 -0
  19. {gamesentenceminer-2.14.13 → gamesentenceminer-2.14.15}/GameSentenceMiner/config_gui.py +0 -0
  20. {gamesentenceminer-2.14.13 → gamesentenceminer-2.14.15}/GameSentenceMiner/gametext.py +0 -0
  21. {gamesentenceminer-2.14.13 → gamesentenceminer-2.14.15}/GameSentenceMiner/gsm.py +0 -0
  22. {gamesentenceminer-2.14.13 → gamesentenceminer-2.14.15}/GameSentenceMiner/locales/en_us.json +0 -0
  23. {gamesentenceminer-2.14.13 → gamesentenceminer-2.14.15}/GameSentenceMiner/locales/ja_jp.json +0 -0
  24. {gamesentenceminer-2.14.13 → gamesentenceminer-2.14.15}/GameSentenceMiner/locales/zh_cn.json +0 -0
  25. {gamesentenceminer-2.14.13 → gamesentenceminer-2.14.15}/GameSentenceMiner/obs.py +0 -0
  26. {gamesentenceminer-2.14.13 → gamesentenceminer-2.14.15}/GameSentenceMiner/ocr/__init__.py +0 -0
  27. {gamesentenceminer-2.14.13 → gamesentenceminer-2.14.15}/GameSentenceMiner/ocr/gsm_ocr_config.py +0 -0
  28. {gamesentenceminer-2.14.13 → gamesentenceminer-2.14.15}/GameSentenceMiner/ocr/ocrconfig.py +0 -0
  29. {gamesentenceminer-2.14.13 → gamesentenceminer-2.14.15}/GameSentenceMiner/ocr/owocr_area_selector.py +0 -0
  30. {gamesentenceminer-2.14.13 → gamesentenceminer-2.14.15}/GameSentenceMiner/ocr/ss_picker.py +0 -0
  31. {gamesentenceminer-2.14.13 → gamesentenceminer-2.14.15}/GameSentenceMiner/owocr/owocr/__init__.py +0 -0
  32. {gamesentenceminer-2.14.13 → gamesentenceminer-2.14.15}/GameSentenceMiner/owocr/owocr/__main__.py +0 -0
  33. {gamesentenceminer-2.14.13 → gamesentenceminer-2.14.15}/GameSentenceMiner/owocr/owocr/config.py +0 -0
  34. {gamesentenceminer-2.14.13 → gamesentenceminer-2.14.15}/GameSentenceMiner/owocr/owocr/lens_betterproto.py +0 -0
  35. {gamesentenceminer-2.14.13 → gamesentenceminer-2.14.15}/GameSentenceMiner/owocr/owocr/screen_coordinate_picker.py +0 -0
  36. {gamesentenceminer-2.14.13 → gamesentenceminer-2.14.15}/GameSentenceMiner/tools/__init__.py +0 -0
  37. {gamesentenceminer-2.14.13 → gamesentenceminer-2.14.15}/GameSentenceMiner/tools/audio_offset_selector.py +0 -0
  38. {gamesentenceminer-2.14.13 → gamesentenceminer-2.14.15}/GameSentenceMiner/tools/ss_selector.py +0 -0
  39. {gamesentenceminer-2.14.13 → gamesentenceminer-2.14.15}/GameSentenceMiner/tools/window_transparency.py +0 -0
  40. {gamesentenceminer-2.14.13 → gamesentenceminer-2.14.15}/GameSentenceMiner/util/__init__.py +0 -0
  41. {gamesentenceminer-2.14.13 → gamesentenceminer-2.14.15}/GameSentenceMiner/util/communication/__init__.py +0 -0
  42. {gamesentenceminer-2.14.13 → gamesentenceminer-2.14.15}/GameSentenceMiner/util/communication/send.py +0 -0
  43. {gamesentenceminer-2.14.13 → gamesentenceminer-2.14.15}/GameSentenceMiner/util/communication/websocket.py +0 -0
  44. {gamesentenceminer-2.14.13 → gamesentenceminer-2.14.15}/GameSentenceMiner/util/configuration.py +0 -0
  45. {gamesentenceminer-2.14.13 → gamesentenceminer-2.14.15}/GameSentenceMiner/util/db.py +0 -0
  46. {gamesentenceminer-2.14.13 → gamesentenceminer-2.14.15}/GameSentenceMiner/util/downloader/Untitled_json.py +0 -0
  47. {gamesentenceminer-2.14.13 → gamesentenceminer-2.14.15}/GameSentenceMiner/util/downloader/__init__.py +0 -0
  48. {gamesentenceminer-2.14.13 → gamesentenceminer-2.14.15}/GameSentenceMiner/util/downloader/download_tools.py +0 -0
  49. {gamesentenceminer-2.14.13 → gamesentenceminer-2.14.15}/GameSentenceMiner/util/downloader/oneocr_dl.py +0 -0
  50. {gamesentenceminer-2.14.13 → gamesentenceminer-2.14.15}/GameSentenceMiner/util/electron_config.py +0 -0
  51. {gamesentenceminer-2.14.13 → gamesentenceminer-2.14.15}/GameSentenceMiner/util/ffmpeg.py +0 -0
  52. {gamesentenceminer-2.14.13 → gamesentenceminer-2.14.15}/GameSentenceMiner/util/get_overlay_coords.py +0 -0
  53. {gamesentenceminer-2.14.13 → gamesentenceminer-2.14.15}/GameSentenceMiner/util/gsm_utils.py +0 -0
  54. {gamesentenceminer-2.14.13 → gamesentenceminer-2.14.15}/GameSentenceMiner/util/model.py +0 -0
  55. {gamesentenceminer-2.14.13 → gamesentenceminer-2.14.15}/GameSentenceMiner/util/notification.py +0 -0
  56. {gamesentenceminer-2.14.13 → gamesentenceminer-2.14.15}/GameSentenceMiner/util/text_log.py +0 -0
  57. {gamesentenceminer-2.14.13 → gamesentenceminer-2.14.15}/GameSentenceMiner/util/win10toast/__init__.py +0 -0
  58. {gamesentenceminer-2.14.13 → gamesentenceminer-2.14.15}/GameSentenceMiner/util/win10toast/__main__.py +0 -0
  59. {gamesentenceminer-2.14.13 → gamesentenceminer-2.14.15}/GameSentenceMiner/vad.py +0 -0
  60. {gamesentenceminer-2.14.13 → gamesentenceminer-2.14.15}/GameSentenceMiner/web/__init__.py +0 -0
  61. {gamesentenceminer-2.14.13 → gamesentenceminer-2.14.15}/GameSentenceMiner/web/service.py +0 -0
  62. {gamesentenceminer-2.14.13 → gamesentenceminer-2.14.15}/GameSentenceMiner/web/static/__init__.py +0 -0
  63. {gamesentenceminer-2.14.13 → gamesentenceminer-2.14.15}/GameSentenceMiner/web/static/apple-touch-icon.png +0 -0
  64. {gamesentenceminer-2.14.13 → gamesentenceminer-2.14.15}/GameSentenceMiner/web/static/favicon-96x96.png +0 -0
  65. {gamesentenceminer-2.14.13 → gamesentenceminer-2.14.15}/GameSentenceMiner/web/static/favicon.ico +0 -0
  66. {gamesentenceminer-2.14.13 → gamesentenceminer-2.14.15}/GameSentenceMiner/web/static/favicon.svg +0 -0
  67. {gamesentenceminer-2.14.13 → gamesentenceminer-2.14.15}/GameSentenceMiner/web/static/site.webmanifest +0 -0
  68. {gamesentenceminer-2.14.13 → gamesentenceminer-2.14.15}/GameSentenceMiner/web/static/style.css +0 -0
  69. {gamesentenceminer-2.14.13 → gamesentenceminer-2.14.15}/GameSentenceMiner/web/static/web-app-manifest-192x192.png +0 -0
  70. {gamesentenceminer-2.14.13 → gamesentenceminer-2.14.15}/GameSentenceMiner/web/static/web-app-manifest-512x512.png +0 -0
  71. {gamesentenceminer-2.14.13 → gamesentenceminer-2.14.15}/GameSentenceMiner/web/templates/__init__.py +0 -0
  72. {gamesentenceminer-2.14.13 → gamesentenceminer-2.14.15}/GameSentenceMiner/web/templates/index.html +0 -0
  73. {gamesentenceminer-2.14.13 → gamesentenceminer-2.14.15}/GameSentenceMiner/web/templates/text_replacements.html +0 -0
  74. {gamesentenceminer-2.14.13 → gamesentenceminer-2.14.15}/GameSentenceMiner/web/templates/utility.html +0 -0
  75. {gamesentenceminer-2.14.13 → gamesentenceminer-2.14.15}/GameSentenceMiner/web/texthooking_page.py +0 -0
  76. {gamesentenceminer-2.14.13 → gamesentenceminer-2.14.15}/GameSentenceMiner/wip/__init___.py +0 -0
  77. {gamesentenceminer-2.14.13 → gamesentenceminer-2.14.15}/GameSentenceMiner.egg-info/SOURCES.txt +0 -0
  78. {gamesentenceminer-2.14.13 → gamesentenceminer-2.14.15}/GameSentenceMiner.egg-info/dependency_links.txt +0 -0
  79. {gamesentenceminer-2.14.13 → gamesentenceminer-2.14.15}/GameSentenceMiner.egg-info/entry_points.txt +0 -0
  80. {gamesentenceminer-2.14.13 → gamesentenceminer-2.14.15}/GameSentenceMiner.egg-info/requires.txt +0 -0
  81. {gamesentenceminer-2.14.13 → gamesentenceminer-2.14.15}/GameSentenceMiner.egg-info/top_level.txt +0 -0
  82. {gamesentenceminer-2.14.13 → gamesentenceminer-2.14.15}/LICENSE +0 -0
  83. {gamesentenceminer-2.14.13 → gamesentenceminer-2.14.15}/README.md +0 -0
  84. {gamesentenceminer-2.14.13 → gamesentenceminer-2.14.15}/setup.cfg +0 -0
@@ -504,7 +504,7 @@ def add_ss_hotkey(ss_hotkey="ctrl+shift+g"):
504
504
  logger.error(f"Error setting up screenshot hotkey with keyboard, Attempting Backup: {e}")
505
505
  logger.debug(e)
506
506
  pynput_hotkey = ss_hotkey.replace("ctrl", "<ctrl>").replace("shift", "<shift>").replace("alt", "<alt>")
507
- secondary_ss_hotkey = secondary_ss_hotkey.replace("ctrl", "<ctrl>").replace("shift", "<shift>").replace("alt", "<alt>")
507
+ secondary_ss_hotkey = get_ocr_manual_ocr_hotkey().lower().replace("ctrl", "<ctrl>").replace("shift", "<shift>").replace("alt", "<alt>")
508
508
  try:
509
509
  from pynput import keyboard as pynput_keyboard
510
510
  listener = pynput_keyboard.GlobalHotKeys({
@@ -15,6 +15,7 @@ import numpy as np
15
15
  import rapidfuzz.fuzz
16
16
  from PIL import Image
17
17
  from loguru import logger
18
+ import regex
18
19
  import requests
19
20
 
20
21
 
@@ -377,7 +378,8 @@ class GoogleLens:
377
378
  for line in paragraph['lines']:
378
379
  if furigana_filter_sensitivity:
379
380
  for word in line['words']:
380
- if not self.punctuation_regex.findall(word):
381
+ if self.punctuation_regex.findall(word['plain_text']):
382
+ res += word['plain_text'] + word['text_separator']
381
383
  continue
382
384
  if 'geometry' not in word:
383
385
  res += word['plain_text'] + word['text_separator']
@@ -869,8 +871,10 @@ class OneOCR:
869
871
  available = False
870
872
 
871
873
  def __init__(self, config={}, lang='ja'):
874
+ import regex
872
875
  self.initial_lang = lang
873
876
  self.regex = get_regex(lang)
877
+ self.punctuation_regex = regex.compile(r'[\p{P}\p{S}]')
874
878
  if sys.platform == 'win32':
875
879
  if int(platform.release()) < 10:
876
880
  logger.warning('OneOCR is not supported on Windows older than 10!')
@@ -939,10 +943,10 @@ class OneOCR:
939
943
  if sys.platform == 'win32':
940
944
  try:
941
945
  ocr_resp = self.model.recognize_pil(img)
942
- # if os.path.exists(os.path.expanduser("~/GSM/temp")):
943
- # with open(os.path.join(os.path.expanduser("~/GSM/temp"), 'oneocr_response.json'), 'w',
944
- # encoding='utf-8') as f:
945
- # json.dump(ocr_resp, f, indent=4, ensure_ascii=False)
946
+ if os.path.exists(os.path.expanduser("~/GSM/temp")):
947
+ with open(os.path.join(os.path.expanduser("~/GSM/temp"), 'oneocr_response.json'), 'w',
948
+ encoding='utf-8') as f:
949
+ json.dump(ocr_resp, f, indent=4, ensure_ascii=False)
946
950
  # print(json.dumps(ocr_resp))
947
951
  filtered_lines = [line for line in ocr_resp['lines'] if self.regex.search(line['text'])]
948
952
  x_coords = [line['bounding_rect'][f'x{i}'] for line in filtered_lines for i in range(1, 5)]
@@ -955,17 +959,21 @@ class OneOCR:
955
959
  boxes = []
956
960
  if furigana_filter_sensitivity > 0:
957
961
  for line in filtered_lines:
958
- x1, x2, x3, x4 = line['bounding_rect']['x1'], line['bounding_rect']['x2'], \
959
- line['bounding_rect']['x3'], line['bounding_rect']['x4']
960
- y1, y2, y3, y4 = line['bounding_rect']['y1'], line['bounding_rect']['y2'], \
961
- line['bounding_rect']['y3'], line['bounding_rect']['y4']
962
- width = max(x2 - x1, x3 - x4)
963
- height = max(y3 - y1, y4 - y2)
964
- if width > furigana_filter_sensitivity and height > furigana_filter_sensitivity:
965
- res += line['text']
966
- else:
967
- skipped.extend(char for char in line['text'])
968
- continue
962
+ for char in line['words']:
963
+ if self.punctuation_regex.findall(char['text']):
964
+ res += char['text']
965
+ continue
966
+ x1, x2, x3, x4 = char['bounding_rect']['x1'], char['bounding_rect']['x2'], \
967
+ char['bounding_rect']['x3'], char['bounding_rect']['x4']
968
+ y1, y2, y3, y4 = char['bounding_rect']['y1'], char['bounding_rect']['y2'], \
969
+ char['bounding_rect']['y3'], char['bounding_rect']['y4']
970
+ width = max(x2 - x1, x3 - x4)
971
+ height = max(y3 - y1, y4 - y2)
972
+ if width > furigana_filter_sensitivity and height > furigana_filter_sensitivity:
973
+ res += char['text']
974
+ else:
975
+ skipped.extend(char for char in line['text'])
976
+ continue
969
977
  res += '\n'
970
978
  # logger.info(
971
979
  # f"Skipped {len(skipped)} chars due to furigana filter sensitivity: {furigana_filter_sensitivity}")
@@ -59,6 +59,7 @@ from GameSentenceMiner.util.configuration import get_temporary_directory, get_co
59
59
 
60
60
  config = None
61
61
  last_image = None
62
+ last_image_np = None
62
63
 
63
64
 
64
65
  class ClipboardThread(threading.Thread):
@@ -818,9 +819,10 @@ def apply_adaptive_threshold_filter(img):
818
819
 
819
820
 
820
821
  def set_last_image(image):
821
- global last_image
822
+ global last_image, last_image_np
822
823
  if image is None:
823
824
  last_image = None
825
+ last_image_np = None
824
826
  try:
825
827
  if image == last_image:
826
828
  return
@@ -833,23 +835,34 @@ def set_last_image(image):
833
835
  except Exception:
834
836
  pass
835
837
  last_image = image
838
+ last_image_np = np.array(last_image)
836
839
  # last_image = apply_adaptive_threshold_filter(image)
837
840
 
838
841
 
839
- def are_images_identical(img1, img2):
840
- if None in (img1, img2):
842
+ def are_images_identical(img1, img2, img2_np=None):
843
+ """
844
+ Compares two images for pixel-wise identity.
845
+ Optionally, pass a cached np.array for img2 as img2_np to avoid repeated conversion.
846
+
847
+ Args:
848
+ img1: PIL.Image or np.ndarray
849
+ img2: PIL.Image or np.ndarray
850
+ img2_np: Optional cached np.ndarray for img2
851
+
852
+ Returns:
853
+ bool: True if images are identical, False otherwise.
854
+ """
855
+ if any(v is None for v in (img1, img2, img2_np)):
841
856
  return False
842
857
 
843
858
  try:
844
- img1 = np.array(img1)
845
- img2 = np.array(img2)
859
+ img1_np = np.array(img1)
860
+ img2_np = img2_np if img2_np is not None else np.array(img2)
846
861
  except Exception:
847
- logger.warning(
848
- "Failed to convert images to numpy arrays for comparison.")
849
- # If conversion to numpy array fails, consider them not identical
862
+ logger.warning("Failed to convert images to numpy arrays for comparison.")
850
863
  return False
851
864
 
852
- return (img1.shape == img2.shape) and np.array_equal(img1, img2)
865
+ return (img1_np.shape == img2_np.shape) and np.array_equal(img1_np, img2_np)
853
866
 
854
867
 
855
868
  import cv2
@@ -997,7 +1010,7 @@ class OBSScreenshotThread(threading.Thread):
997
1010
 
998
1011
  def connect_obs(self):
999
1012
  import GameSentenceMiner.obs as obs
1000
- obs.connect_to_obs_sync()
1013
+ obs.connect_to_obs_sync(check_output=False)
1001
1014
 
1002
1015
  def scale_down_width_height(self, width, height):
1003
1016
  if width == 0 or height == 0:
@@ -1765,7 +1778,7 @@ def run(read_from=None,
1765
1778
  # sleep_time_to_add += .005
1766
1779
  # continue
1767
1780
  # else:
1768
- if are_images_identical(img, last_image):
1781
+ if are_images_identical(img, last_image, last_image_np):
1769
1782
  logger.info("Captured screenshot is identical to the last one, sleeping.")
1770
1783
  if time.time() - last_result_time > 10:
1771
1784
  sleep_time_to_add += .005
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: GameSentenceMiner
3
- Version: 2.14.13
3
+ Version: 2.14.15
4
4
  Summary: A tool for mining sentences from games. Update: Overlay?
5
5
  Author-email: Beangate <bpwhelan95@gmail.com>
6
6
  License: MIT License
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: GameSentenceMiner
3
- Version: 2.14.13
3
+ Version: 2.14.15
4
4
  Summary: A tool for mining sentences from games. Update: Overlay?
5
5
  Author-email: Beangate <bpwhelan95@gmail.com>
6
6
  License: MIT License
@@ -7,7 +7,7 @@ build-backend = "setuptools.build_meta"
7
7
 
8
8
  [project]
9
9
  name = "GameSentenceMiner"
10
- version = "2.14.13"
10
+ version = "2.14.15"
11
11
  description = "A tool for mining sentences from games. Update: Overlay?"
12
12
  readme = "README.md"
13
13
  requires-python = ">=3.10"