Skip to content

0.4.0

Choose a tag to compare

@iliaal iliaal released this 27 Jul 01:16
· 103 commits to master since this release
0.4.0
d63f997

Changed

  • BREAKING: BMPM_APPROX is now 10 and BMPM_EXACT is now 20 (were 1 and 2). The accuracy values are now disjoint from the name-type values (BMPM_GENERIC/BMPM_ASHKENAZI/BMPM_SEPHARDIC = 0/1/2), so a misplaced constant such as bmpm($name, BMPM_APPROX) is rejected by argument validation instead of silently running as a name type. Code that uses the constant names is unaffected; only code hard-coding the numeric values 1/2 for the $accuracy argument needs updating.
  • bmpm() / bmpm_match(): forced $language = "any" now raises ValueError; it is the default ruleset label. Pass an empty string for auto-detect.
  • double_metaphone(): stops encoding once both codes reach max_length. Same results, less work on long inputs.
  • Match helpers skip the second encode when the first operand is unencodable or the two operands are identical.
  • bmpm(): BMPM_MAX_PREFIX_DEPTH lowered from 16 to 6, bounding the prefix dual-encode fan-out. Still above realistic name nesting.
  • bmpm() MINIT hard-fails on an oversize generated language list, language bracket, or phoneme alternative list instead of silently clipping it.
  • Internal BMPM rule-type tokens renamed to BMPM_RT_APPROX / BMPM_RT_EXACT so they cannot collide with the public accuracy constants.
  • Shared PHONETIC_MAX_RULED_INPUT (4096) for BMPM and DM Soundex caps; generated DMS_CAP_* macros size DM replacement alt buffers.
  • match_rating_compare(): skip second encode when the first cleans to empty.
  • config.w32: require PHP 8.1+ (parity with config.m4).
  • Docs: forced-language API note; Double Metaphone unmapped non-ASCII fold; DM index example queries every non-000000 code; LICENSE Section 2.
  • CI: PIE smoke pins a false bmpm_match and Double Metaphone match strengths; Windows jobs assert php_phonetic.dll was produced after the builder step.
  • scripts/check_arginfo.php locks PH_BMPM_* accuracy ints to the stub; smoke no longer hardcodes the version string; regen_arginfo docs fixed.
  • scripts/regen_arginfo.sh: prefers $HOME/php-install-PHP-8.1/bin/php when PHP_BIN is unset; documents tokenizer/gen_stub requirements.

Fixed

  • double_metaphone(): JOSE/SAN J branch no longer applies the double-J advance (Commons Codec handleJ advances by 1 on that arm only).
  • double_metaphone_match(): a code counts as unencodable only when both the primary and the alternate are empty, so "-EW" (""/"F") still crosses at strength 1 in either argument order.
  • dm_soundex(): U+0085 is kept, not stripped. Java's Character.isWhitespace excludes it, so Commons Codec keeps it too.
  • bmpm() MINIT: zero-initialize ruleset/language indexes so a mid-build abort cannot free garbage pointers on unload.
  • bmpm(): overflow-safe allocation for phoneme-set growth and prefix pair buffers.
  • bmpm(): the final-rule merge sorts once instead of an O(R²) insert-sort, and hashes duplicates only when the phoneme texts are wide enough to pay for it.
  • bmpm(): rule-matching inner loops compare code points inline again; routing 1-3 element compares through memcmp() cost 5-6% of encode time.
  • nysiis(): corrected a source comment that claimed parity with Commons Codec's SoundexUtils.clean; the ASCII-only cleaning is a deliberate restriction.
  • scripts/gen_bmpm_data.php: src/bmpm_data.h is written to a temp file and renamed into place, so an interrupted run can't leave a truncated header.
  • Docs: Cyrillic lowercasing is bmpm()-only; DM "000000" dual meaning; MRA identity short-circuit; forced-language "any"; NFC vs NFD.
  • Docs/tests: empty/unencodable match contracts, BMPM validation and accuracy values, bmpm_match accuracy forwarding, and word-final J alternate space.
  • Tests: match-helper oracle pins, cleaned-empty identity pins, multi-code dm_soundex_match, dual-sentinel, MRA first3+last3, SEPHARDIC/any errors.