sinonym 0.2.3__tar.gz → 0.2.4__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 (59) hide show
  1. {sinonym-0.2.3 → sinonym-0.2.4}/PKG-INFO +1 -1
  2. {sinonym-0.2.3 → sinonym-0.2.4}/pyproject.toml +1 -1
  3. {sinonym-0.2.3 → sinonym-0.2.4}/sinonym/detector.py +9 -0
  4. {sinonym-0.2.3 → sinonym-0.2.4}/sinonym/services/batch_analysis.py +9 -0
  5. {sinonym-0.2.3 → sinonym-0.2.4}/.gitignore +0 -0
  6. {sinonym-0.2.3 → sinonym-0.2.4}/LICENSE +0 -0
  7. {sinonym-0.2.3 → sinonym-0.2.4}/README.md +0 -0
  8. {sinonym-0.2.3 → sinonym-0.2.4}/scripts/README.md +0 -0
  9. {sinonym-0.2.3 → sinonym-0.2.4}/sinonym/__init__.py +0 -0
  10. {sinonym-0.2.3 → sinonym-0.2.4}/sinonym/chinese_names_data.py +0 -0
  11. {sinonym-0.2.3 → sinonym-0.2.4}/sinonym/coretypes/__init__.py +0 -0
  12. {sinonym-0.2.3 → sinonym-0.2.4}/sinonym/coretypes/config.py +0 -0
  13. {sinonym-0.2.3 → sinonym-0.2.4}/sinonym/coretypes/results.py +0 -0
  14. {sinonym-0.2.3 → sinonym-0.2.4}/sinonym/data/README.md +0 -0
  15. {sinonym-0.2.3 → sinonym-0.2.4}/sinonym/data/acl_2025_authors.txt +0 -0
  16. {sinonym-0.2.3 → sinonym-0.2.4}/sinonym/data/chinese_japanese_classifier.joblib +0 -0
  17. {sinonym-0.2.3 → sinonym-0.2.4}/sinonym/data/chinese_japanese_classifier.skops +0 -0
  18. {sinonym-0.2.3 → sinonym-0.2.4}/sinonym/data/familyname_orcid.csv +0 -0
  19. {sinonym-0.2.3 → sinonym-0.2.4}/sinonym/data/givenname_orcid.csv +0 -0
  20. {sinonym-0.2.3 → sinonym-0.2.4}/sinonym/data/model_features.json +0 -0
  21. {sinonym-0.2.3 → sinonym-0.2.4}/sinonym/ml_model_components.py +0 -0
  22. {sinonym-0.2.3 → sinonym-0.2.4}/sinonym/patterns/__init__.py +0 -0
  23. {sinonym-0.2.3 → sinonym-0.2.4}/sinonym/patterns/compiled_patterns.py +0 -0
  24. {sinonym-0.2.3 → sinonym-0.2.4}/sinonym/patterns/regex_builders.py +0 -0
  25. {sinonym-0.2.3 → sinonym-0.2.4}/sinonym/resources.py +0 -0
  26. {sinonym-0.2.3 → sinonym-0.2.4}/sinonym/services/__init__.py +0 -0
  27. {sinonym-0.2.3 → sinonym-0.2.4}/sinonym/services/cache.py +0 -0
  28. {sinonym-0.2.3 → sinonym-0.2.4}/sinonym/services/ethnicity.py +0 -0
  29. {sinonym-0.2.3 → sinonym-0.2.4}/sinonym/services/formatting.py +0 -0
  30. {sinonym-0.2.3 → sinonym-0.2.4}/sinonym/services/initialization.py +0 -0
  31. {sinonym-0.2.3 → sinonym-0.2.4}/sinonym/services/normalization.py +0 -0
  32. {sinonym-0.2.3 → sinonym-0.2.4}/sinonym/services/parsing.py +0 -0
  33. {sinonym-0.2.3 → sinonym-0.2.4}/sinonym/services/process_pool.py +0 -0
  34. {sinonym-0.2.3 → sinonym-0.2.4}/sinonym/text_processing/__init__.py +0 -0
  35. {sinonym-0.2.3 → sinonym-0.2.4}/sinonym/text_processing/compound_detector.py +0 -0
  36. {sinonym-0.2.3 → sinonym-0.2.4}/sinonym/text_processing/text_normalizer.py +0 -0
  37. {sinonym-0.2.3 → sinonym-0.2.4}/sinonym/text_processing/text_preprocessor.py +0 -0
  38. {sinonym-0.2.3 → sinonym-0.2.4}/sinonym/utils/__init__.py +0 -0
  39. {sinonym-0.2.3 → sinonym-0.2.4}/sinonym/utils/string_manipulation.py +0 -0
  40. {sinonym-0.2.3 → sinonym-0.2.4}/sinonym/utils/thread_cache.py +0 -0
  41. {sinonym-0.2.3 → sinonym-0.2.4}/tests/_fail_log.py +0 -0
  42. {sinonym-0.2.3 → sinonym-0.2.4}/tests/conftest.py +0 -0
  43. {sinonym-0.2.3 → sinonym-0.2.4}/tests/test_acl.py +0 -0
  44. {sinonym-0.2.3 → sinonym-0.2.4}/tests/test_all_chinese_inputs.py +0 -0
  45. {sinonym-0.2.3 → sinonym-0.2.4}/tests/test_basic_chinese_names.py +0 -0
  46. {sinonym-0.2.3 → sinonym-0.2.4}/tests/test_batch.py +0 -0
  47. {sinonym-0.2.3 → sinonym-0.2.4}/tests/test_compound_names.py +0 -0
  48. {sinonym-0.2.3 → sinonym-0.2.4}/tests/test_compound_surname_formats.py +0 -0
  49. {sinonym-0.2.3 → sinonym-0.2.4}/tests/test_middle_names.py +0 -0
  50. {sinonym-0.2.3 → sinonym-0.2.4}/tests/test_misc.py +0 -0
  51. {sinonym-0.2.3 → sinonym-0.2.4}/tests/test_mixed_production_cases.py +0 -0
  52. {sinonym-0.2.3 → sinonym-0.2.4}/tests/test_mixed_scripts.py +0 -0
  53. {sinonym-0.2.3 → sinonym-0.2.4}/tests/test_ml_japanese_detection.py +0 -0
  54. {sinonym-0.2.3 → sinonym-0.2.4}/tests/test_multiprocess_pool.py +0 -0
  55. {sinonym-0.2.3 → sinonym-0.2.4}/tests/test_name_formatting.py +0 -0
  56. {sinonym-0.2.3 → sinonym-0.2.4}/tests/test_non_chinese_rejection.py +0 -0
  57. {sinonym-0.2.3 → sinonym-0.2.4}/tests/test_performance.py +0 -0
  58. {sinonym-0.2.3 → sinonym-0.2.4}/tests/test_regional_variants.py +0 -0
  59. {sinonym-0.2.3 → sinonym-0.2.4}/tests/test_regression_proposals.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: sinonym
3
- Version: 0.2.3
3
+ Version: 0.2.4
4
4
  Summary: Chinese Name Detection and Normalization Module
5
5
  Project-URL: Homepage, https://github.com/allenai/sinonym
6
6
  Project-URL: Repository, https://github.com/allenai/sinonym
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "sinonym"
7
- version = "0.2.3"
7
+ version = "0.2.4"
8
8
  description = "Chinese Name Detection and Normalization Module"
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.10"
@@ -495,6 +495,15 @@ class ChineseNameDetector:
495
495
  is_surname_first_in_this_order = list(order_tokens[:k]) == surname_tokens
496
496
  is_surname_last_in_this_order = list(order_tokens[-k:]) == surname_tokens
497
497
 
498
+ # Compound surname fallback: surname_tokens may be sub-tokens
499
+ # of a single original token (e.g. ['Ou','yang'] from 'Ouyang')
500
+ if not is_surname_first_in_this_order and not is_surname_last_in_this_order:
501
+ joined_surname = "".join(surname_tokens).lower()
502
+ if order_tokens[0].lower() == joined_surname:
503
+ is_surname_first_in_this_order = True
504
+ elif order_tokens[-1].lower() == joined_surname:
505
+ is_surname_last_in_this_order = True
506
+
498
507
  if used_original:
499
508
  original_is_given_first = is_surname_last_in_this_order
500
509
  else:
@@ -253,6 +253,15 @@ class BatchAnalysisService:
253
253
  if surname_tokens[-1] == original_tokens[-1]:
254
254
  return NameFormat.GIVEN_FIRST
255
255
 
256
+ # Compound surname: surname_tokens may be sub-tokens of a single
257
+ # original token (e.g. ['Ou','yang'] from 'Ouyang').
258
+ # Reconstruct and check against original tokens.
259
+ joined_surname = "".join(surname_tokens).lower()
260
+ if original_tokens[0].lower() == joined_surname:
261
+ return NameFormat.SURNAME_FIRST
262
+ if original_tokens[-1].lower() == joined_surname:
263
+ return NameFormat.GIVEN_FIRST
264
+
256
265
  # Default to surname-first for unclear cases
257
266
  return NameFormat.SURNAME_FIRST
258
267
 
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes