@@ -200,7 +200,7 @@ setMethod("tail", signature(x = "textstat_proxy"), function(x, n = 6L, ...) {
200200# ' @param ... unused
201201# ' @details `textstat_simil` options are: `"correlation"` (default),
202202# ' `"cosine"`, `"jaccard"`, `"ejaccard"`, `"dice"`,
203- # ' `"edice"`, `"simple matching"`, and `"hamman "`.
203+ # ' `"edice"`, `"simple matching"`, and `"hamann "`.
204204# ' @note If you want to compute similarity on a "normalized" dfm object
205205# ' (controlling for variable document lengths, for methods such as correlation
206206# ' for which different document lengths matter), then wrap the input dfm in
@@ -249,7 +249,7 @@ setMethod("tail", signature(x = "textstat_proxy"), function(x, n = 6L, ...) {
249249textstat_simil <- function (x , y = NULL , selection = NULL ,
250250 margin = c(" documents" , " features" ),
251251 method = c(" correlation" , " cosine" , " jaccard" , " ejaccard" ,
252- " dice" , " edice" , " hamman " , " simple matching" ),
252+ " dice" , " edice" , " hamann " , " simple matching" ),
253253 min_simil = NULL , ... ) {
254254 UseMethod(" textstat_simil" )
255255}
@@ -258,7 +258,7 @@ textstat_simil <- function(x, y = NULL, selection = NULL,
258258textstat_simil.default <- function (x , y = NULL , selection = NULL ,
259259 margin = c(" documents" , " features" ),
260260 method = c(" correlation" , " cosine" , " jaccard" , " ejaccard" ,
261- " dice" , " edice" , " hamman " , " simple matching" ),
261+ " dice" , " edice" , " hamann " , " simple matching" ),
262262 min_simil = NULL , ... ) {
263263 stop(friendly_class_undefined_message(class(x ), " textstat_simil" ))
264264}
@@ -267,7 +267,7 @@ textstat_simil.default <- function(x, y = NULL, selection = NULL,
267267textstat_simil.dfm <- function (x , y = NULL , selection = NULL ,
268268 margin = c(" documents" , " features" ),
269269 method = c(" correlation" , " cosine" , " jaccard" , " ejaccard" ,
270- " dice" , " edice" , " hamman " , " simple matching" ),
270+ " dice" , " edice" , " hamann " , " simple matching" ),
271271 min_simil = NULL , ... ) {
272272
273273 if (! is.null(selection ))
@@ -276,6 +276,8 @@ textstat_simil.dfm <- function(x, y = NULL, selection = NULL,
276276
277277 x <- as.dfm(x )
278278 margin <- match.arg(margin )
279+
280+ method [method == " hamman" ] <- " hamann" # trap older "hamman" spelling
279281 method <- match.arg(method )
280282
281283 if (margin == " features" ) {
@@ -608,7 +610,7 @@ setMethod("as.matrix", "textstat_simil_symm_sparse",
608610textstat_proxy <- function (x , y = NULL ,
609611 margin = c(" documents" , " features" ),
610612 method = c(" cosine" , " correlation" , " jaccard" , " ejaccard" ,
611- " dice" , " edice" , " hamman " , " simple matching" ,
613+ " dice" , " edice" , " hamann " , " simple matching" ,
612614 " euclidean" , " chisquared" , " hamming" , " kullback" ,
613615 " manhattan" , " maximum" , " canberra" , " minkowski" ),
614616 p = 2 , min_proxy = NULL , rank = NULL , use_na = FALSE ) {
@@ -622,6 +624,8 @@ textstat_proxy <- function(x, y = NULL,
622624 }
623625
624626 margin <- match.arg(margin )
627+
628+ method [method == " hamman" ] <- " hamann" # trap older "hamman" spelling
625629 method <- match.arg(method )
626630
627631 if (margin == " documents" ) {
@@ -633,7 +637,7 @@ textstat_proxy <- function(x, y = NULL,
633637 stop(" x and y must contain the same documents" )
634638 }
635639 if (method %in% c(" cosine" , " correlation" , " jaccard" , " ejaccard" , " dice" , " edice" ,
636- " hamman " , " simple matching" , " faith" )) {
640+ " hamann " , " simple matching" , " faith" )) {
637641 if (identical(x , y )) {
638642 suppressWarnings({
639643 result <- proxyC :: simil(x , NULL , 2 , method , min_simil = min_proxy , rank = rank , use_nan = use_na )
0 commit comments