View Source Dmp.Options (diff_match_patch v0.1.0)
Adjustable parameters that control algorithm efficiency and accuracy.
:diff_timeout- Number of seconds to map a diff before giving up (0 for infinity).
:diff_edit_cost- Cost of an empty edit operation in terms of edit characters.
:match_max_bits- The number of bits in an integer (default is expected 32). This parameter controls the lengths of patterns used in matching and patch splitting. Set
:match_max_bitsto 0 to disable patch splitting. To avoid long patches in certain pathological cases, use 32. Elixir supports arbitrarily large integers, so we allow values of 64 and 128, as well as smaller values. Multiple short patches (using native ints,
:match_max_bitsof 32 or less) should be much faster than long ones.
:match_threshold- At what point is no match declared (0.0 = perfection, 1.0 = very loose).
:match_distance- How far to search for a match (0 = exact location, 1000+ = broad match). A match this many characters away from the expected location will add 1.0 to the score (0.0 is a perfect match).
:patch_delete_threshold- When deleting a large block of text (over ~64 characters), how close do the contents have to be to match the expected contents. (0.0 = perfection, 1.0 = very loose). Note that
:match_thresholdcontrols how closely the end points of a delete need to match.
:patch_margin- Chunk size for context length. 4 is a good value.
Link to this section Summary
Link to this section Types
@type t() :: [option()]
Link to this section Functions
@spec default() :: t()
Options struct with good default values:
iex> Options.default() [ diff_edit_cost: 4, diff_timeout: 1.0, match_distance: 1000, match_max_bits: 32, match_threshold: 0.5, patch_delete_threshold: 0.5, patch_margin: 4 ]
Options list, raising an
ArgumentError if it contains invalid values.
 is passed,
Options.default() will be returned.
iex> Options.valid_options!() [ diff_edit_cost: 4, diff_timeout: 1.0, match_distance: 1000, match_max_bits: 32, match_threshold: 0.5, patch_delete_threshold: 0.5, patch_margin: 4 ] iex> Options.valid_options!(match_max_bits: -1) ** (ArgumentError) Invalid options: match_max_bits (-1)