"String" (Comparison Method)
Details
- By default, the "String" comparison method considers two strings to be equivalent if they are identical.
- The distance metric and the corresponding tolerance can be set using the DistanceFunction and Tolerance option. EditDistance is the default distance function.
- The DistanceFunction is only used for nonzero Tolerance. Other compatible distance metrics include HammingDistance and DamerauLevenshteinDistance.
- Additionally, options for the distance metrics, like IgnoreCase, are also supported in the second argument of the AssessmentFunction.
- When multiple values in the answer key are within the tolerance range of an answer, the closest value is selected.
Examples
open all close allBasic Examples (3)
Create an AssessmentFunction for a string question:
Define assessment for a DNA sequence with tolerance:
Any sequence within an EditDistance of two is considered correct:
Set multiple answer keys with custom scores and infer the string method:
Scope (2)
Options (2)
Applications (1)
Define a utility function to make BioSequenceComplement support DNA strings:
Create a QuestionObject for determining DNA complements allowing one mistake in each:
Properties & Relations (1)
Possible Issues (2)
Some metrics only work when comparing strings with equal length:

The "String" comparison method is based on distances, not patterns. Matching of string patterns is not supported:
Instead, specify StringMatchQ as a custom comparator:
See Also
AssessmentFunction ▪ QuestionObject ▪ DistanceFunction
Question Interface Types: ShortAnswer TextCompletion DragCompletion
Comparison Methods: Expression Date