Closed PeterCodar closed 2 years ago
Hi @PeterCodar, thanks for the question. The error you're getting is because ICharacterSubstitution is an interface, not a class, so you need to use the Implements
keyword to implement an interface, rather than Inherits
. More on interfaces in VB.NET: https://docs.microsoft.com/en-us/dotnet/visual-basic/programming-guide/language-features/interfaces/
Let me know if that helps.
Thank you for your hint about the interface!
It seems that I have found a working solution for my VB project:
Public Class ExampleCharSub
Implements F23.StringSimilarity.ICharacterSubstitution
Private Function ICharacterSubstitution_Cost(c1 As Char, c2 As Char) As Double Implements F23.StringSimilarity.ICharacterSubstitution.Cost
If c1 = "t"c AndAlso c2 = "r"c Then Return 0.5
Return 1.0
End Function
End Class
Im not sure why I have to "duplicate" the Implements
part, but otherwise it doesn't let me compile the code.
This value reduction for special characters is really useful, because that way I can exclude some special characters like the various apostrophes or character replacements for non valid windows file name characters (Example ":"
and "ː"
). This fine tuning let me "weight" the character differences much better.
Thanks again for your library and your support!
I would like to use the variant "weighted-levenshtein" https://github.com/feature23/StringSimilarity.NET#weighted-levenshtein
If I try to use this class (converted from your example code):
I get this error: Classes can inherit only from other classes
How do I have to define
ExampleCharSub
in VB.net?