| 1 |
Since version 0.9.8alpha, foma allows attaching a confusion matrix specification to a network. The command "read cmatrix <filename>" read a confusion matrix and attaches is to the top network on the stack. Subsequent "apply med" commands will use this matrix in determining the minimum cost approximate match to a word. If no confusion matrix is specified, Levenshtein distance is used (insert = substitute = delete = 1). |
| 2 |
|
| 3 |
The command "print cmatrix" also prints out the confusion matrix attached to the top network in tabular format. |
| 4 |
|
| 5 |
The format of the confusion matrix should be clear from the following example confusion matrix file: |
| 6 |
|
| 7 |
--CUT HERE-- |
| 8 |
Insert 1 |
| 9 |
Substitute 2 |
| 10 |
Delete 1 |
| 11 |
Cost 1 |
| 12 |
a:b c:d |
| 13 |
Cost 3 |
| 14 |
:x x: x:y |
| 15 |
--CUT HERE-- |
| 16 |
|
| 17 |
The above snippet specifies a matrix where the default insertion cost is 1 unit, the default substitution cost is 2 units, and the default deletion cost is 1 unit. Also, substituting an "a" with a "b" costs 1 unit, as does substituting a "c" for a "d". Inserting an "x" costs 3 units, as does deleting an "x" and substituting an "x" for a "y". |
| 18 |
|
| 19 |
All costs must be positive integer values. A cost specification that involves symbols not found in the alphabet of the top network are not included in the matrix, but are warned about. |