Module: VinaryTree::Liblevenshtein

Defined in:
lib/vinary_tree/liblevenshtein.rb,
lib/vinary_tree/liblevenshtein/native.rb,
lib/vinary_tree/liblevenshtein/version.rb

Defined Under Namespace

Modules: Finalizer, Native Classes: ConcurrentHandle, Error, Match, PhoneticPattern, PhoneticRuleSet, Query, Transducer

Constant Summary collapse

OK =
0
END_STATUS =
1
BYTE_DOMAIN =
1
UNICODE_DOMAIN =
2
U64_DOMAIN =
3
VERSION =
"4.0.0.rc.4"

Class Method Summary collapse

Class Method Details

.check(status) ⇒ Object

Raises:



21
22
23
# File 'lib/vinary_tree/liblevenshtein.rb', line 21

def self.check(status)
  raise Error, status unless status == OK
end

.damerau_distance(source, target) ⇒ Object



28
# File 'lib/vinary_tree/liblevenshtein.rb', line 28

def damerau_distance(source, target) = Native.llev_damerau_distance(source.b, source.bytesize, target.b, target.bytesize)

.damerau_distance_threshold(source, target, threshold) ⇒ Object



29
# File 'lib/vinary_tree/liblevenshtein.rb', line 29

def damerau_distance_threshold(source, target, threshold) = Native.llev_damerau_distance_threshold(source.b, source.bytesize, target.b, target.bytesize, threshold)

.distance(source, target) ⇒ Object



26
# File 'lib/vinary_tree/liblevenshtein.rb', line 26

def distance(source, target) = Native.llev_distance(source.b, source.bytesize, target.b, target.bytesize)

.distance_threshold(source, target, threshold) ⇒ Object



27
# File 'lib/vinary_tree/liblevenshtein.rb', line 27

def distance_threshold(source, target, threshold) = Native.llev_distance_threshold(source.b, source.bytesize, target.b, target.bytesize, threshold)

.true_damerau_distance(source, target) ⇒ Object



30
# File 'lib/vinary_tree/liblevenshtein.rb', line 30

def true_damerau_distance(source, target) = Native.llev_true_damerau_distance(source.b, source.bytesize, target.b, target.bytesize)

.true_damerau_distance_threshold(source, target, threshold) ⇒ Object



31
# File 'lib/vinary_tree/liblevenshtein.rb', line 31

def true_damerau_distance_threshold(source, target, threshold) = Native.llev_true_damerau_distance_threshold(source.b, source.bytesize, target.b, target.bytesize, threshold)