WOLFRAM

"String" (Comparison Method)

New in 14.1[Experimental]
Compare two strings using any distance metric.

Details

Examples

open allclose all

Basic Examples  (3)Summary of the most common use cases

Create an AssessmentFunction for a string question:

Out[1]=1

Use it to assess an answer:

Out[2]=2
Out[3]=3

Define assessment for a DNA sequence with tolerance:

Out[1]=1

Any sequence within an EditDistance of two is considered correct:

Out[2]=2

Set multiple answer keys with custom scores and infer the string method:

Out[1]=1
Out[2]=2

Get more details from the result:

Out[3]=3

Scope  (2)Survey of the scope of standard use cases

Perform category assessment involving strings:

Out[1]=1
Out[2]=2

Assess each element of a list separately:

Out[1]=1

Get the full result details:

Out[2]=2

Options  (2)Common values & functionality for each option

Set a custom tolerance:

Out[1]=1
Out[2]=2
Out[3]=3

Compute equivalent comparisons directly:

Out[4]=4
Out[5]=5

Using different distance metrics might produce different results:

Out[1]=1
Out[2]=2

Applications  (1)Sample problems that can be solved with this function

Define a utility function to make BioSequenceComplement support DNA strings:

Create a QuestionObject for determining DNA complements allowing one mistake in each:

Out[2]=2

Properties & Relations  (1)Properties of the function, and connections to other functions

When an answer matches multiple values in the answer, the closest value is chosen:

Out[1]=1

Possible Issues  (2)Common pitfalls and unexpected behavior

Some metrics only work when comparing strings with equal length:

Out[1]=1

The "String" comparison method is based on distances, not patterns. Matching of string patterns is not supported:

Out[1]=1

Instead, specify StringMatchQ as a custom comparator:

Out[2]=2