Repository: nltk/nltk

Issue:
Wrong default value in aline.py
I believe the value of `C_skip` in https://github.com/nltk/nltk/blob/develop/nltk/metrics/aline.py#L51 should be negative. In particular, the value in the original paper seems to be `-10`, not `10` (see https://webdocs.cs.ualberta.ca/~kondrak/papers/thesis.pdf, p. 54).

Discussion:
tomaarsen: Resolved a merge conflict between the updated test expectations and the pytest-ifying of tests from #2743.
tomaarsen: The (what I assume to be) merge conflict that was resolved in 3761caf has reverted the test fixes from 8c9a7d55c40073ac217757fdbd640e8e36eb0490, causing the failing tests. I'm confident that the tests from 8c9a7d55c40073ac217757fdbd640e8e36eb0490 are correct, as they are taken directly from [Kondrak's thesis](https://www.cs.toronto.edu/pub/gh/Kondrak-PhD-thesis-2002.pdf) (note, not all of Kondrak's tests pass on our system, but these do).
stevenbird: Sorry, my mistake...

Patch:
diff --git a/nltk/metrics/aline.py b/nltk/metrics/aline.py
index 5e0b4f3b4..4be2b92de 100644
--- a/nltk/metrics/aline.py
+++ b/nltk/metrics/aline.py
@@ -47,7 +47,7 @@ except ImportError:
 inf = float("inf")
 
 # Default values for maximum similarity scores (Kondrak 2002: 54)
-C_skip = 10  # Indels
+C_skip = -10  # Indels
 C_sub = 35  # Substitutions
 C_exp = 45  # Expansions/compressions
 C_vwl = 5  # Vowel/consonant relative weight (decreased from 10)
@@ -1084,7 +1084,7 @@ def align(str1, str2, epsilon=0):
     :type epsilon: float (0.0 to 1.0)
     :param epsilon: Adjusts threshold similarity score for near-optimal alignments
 
-    :rtpye: list(list(tuple(str, str)))
+    :rtype: list(list(tuple(str, str)))
     :return: Alignment(s) of str1 and str2
 
     (Kondrak 2002: 51)


Test patch:
diff --git a/nltk/test/unit/test_aline.py b/nltk/test/unit/test_aline.py
index cf73f8fc8..564dd2a0d 100644
--- a/nltk/test/unit/test_aline.py
+++ b/nltk/test/unit/test_aline.py
@@ -6,9 +6,7 @@ from nltk.metrics import aline
 
 def test_aline():
     result = aline.align("θin", "tenwis")
-    expected = [
-        [("θ", "t"), ("i", "e"), ("n", "n"), ("-", "w"), ("-", "i"), ("-", "s")]
-    ]
+    expected = [[("θ", "t"), ("i", "e"), ("n", "n")]]
 
     assert result == expected
 
@@ -31,24 +29,13 @@ def test_aline():
             ("w", "w"),
             ("e", "e"),
             ("n", "n"),
-            ("i", "-"),
         ]
     ]
 
     assert result == expected
 
     result = aline.align("tuwθ", "dentis")
-    expected = [
-        [
-            ("t", "d"),
-            ("u", "e"),
-            ("w", "-"),
-            ("-", "n"),
-            ("-", "t"),
-            ("-", "i"),
-            ("θ", "s"),
-        ]
-    ]
+    expected = [[("t", "t"), ("u", "i"), ("w", "-"), ("θ", "s")]]
 
     assert result == expected