minimum_edit_distance: Minimum Edit Distance

Description Usage Arguments Value Examples

View source: R/transform.R

Description

Finds the minimum cost (in terms of edit operations) to transform the source token to the target token

Usage

1
2
3
4
5
6
7
minimum_edit_distance(
  source,
  target,
  deletecost = 1,
  insertcost = 1,
  replacecost = 2
)

Arguments

source
  • the token starting point

target
  • the token to compare against

deletecost
  • the cost of deleting one letter from the target

insertcost
  • the cost of inserting one letter into the target

replacecost
  • the cost of replacing on letter from the target

Value

dist - the minimum edit distance between source and target, D - the filled in distance matrix steps ( for backtrace )

Examples

1
minimum_edit_distance('play','stay') # -> dist = 4

duncankmckinnon/ezRnlp documentation built on Aug. 6, 2020, 1:28 a.m.