| 1 | #ifndef _EditDistanceTable_h_ |
| 2 | #define _EditDistanceTable_h_ |
| 3 | /* EditDistanceTable.h |
| 4 | * |
| 5 | * Copyright (C) 2012,2015-2017 David Weenink, 2025 Paul Boersma |
| 6 | * |
| 7 | * This code is free software; you can redistribute it and/or modify |
| 8 | * it under the terms of the GNU General Public License as published by |
| 9 | * the Free Software Foundation; either version 3 of the License, or (at |
| 10 | * your option) any later version. |
| 11 | * |
| 12 | * This code is distributed in the hope that it will be useful, but |
| 13 | * WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 15 | * General Public License for more details. |
| 16 | * |
| 17 | * You should have received a copy of the GNU General Public License |
| 18 | * along with this work. If not, see <http://www.gnu.org/licenses/>. |
| 19 | */ |
| 20 | |
| 21 | #include "Strings_extensions.h" |
| 22 | #include "TableOfReal.h" |
| 23 | |
| 24 | #define WARPING_fromLeft 1 |
| 25 | #define WARPING_fromBelow 2 |
| 26 | #define WARPING_fromDiag 4 |
| 27 | |
| 28 | #include "EditDistanceTable_def.h" |
| 29 | |
| 30 | autoEditCostsTable EditCostsTable_create (integer targetAlphabetSize, integer sourceAlphabetSize); |
| 31 | /* |
| 32 | The insertion, deletion and substitution costs are specified in this table |
| 33 | 1..n-2 target symbols (target alphabet) |
| 34 | 1..m-2 source symbols (source alphabet) |
| 35 | row n-1 and col m-1 specify no-match symbols |
| 36 | cells [n] [1..m-1] specify insertion costs |
| 37 | cells [1..n-1] [m] specify deletion costs |
| 38 | cell [n-1] [m-1] no-match target == no-match source |
| 39 | cell [n] [m] no-match target != no-match source |
| 40 | */ |
| 41 | |
| 42 | void EditCostsTable_setDefaultCosts (EditCostsTable me, double insertionCosts, double deletionCosts, double substitutionCosts); |
| 43 | |
| 44 | integer EditCostsTable_getTargetIndex (EditCostsTable me, conststring32 symbol); |
| 45 | |
| 46 | integer EditCostsTable_getSourceIndex (EditCostsTable me, conststring32 symbol); |
| 47 | |
| 48 | double EditCostsTable_getInsertionCost (EditCostsTable me, conststring32 symbol); |
| 49 | |
| 50 | void EditCostsTable_setInsertionCosts (EditCostsTable me, conststring32 targets, double cost); |
| 51 | |
| 52 | void EditCostsTable_setOthersCosts (EditCostsTable me, double insertionCosts, double deletionCost, double substitutionCost_equal, double substitutionCost_unequal); |
| 53 | |
| 54 | double EditCostsTable_getOthersCost (EditCostsTable me, int type); |
| 55 | |
| 56 | double EditCostsTable_getDeletionCost (EditCostsTable me, conststring32 symbol); |
| 57 | |
| 58 | void EditCostsTable_setDeletionCosts (EditCostsTable me, conststring32 sources, double cost); |
| 59 | |
| 60 | double EditCostsTable_getSubstitutionCost (EditCostsTable me, conststring32 symbol, conststring32 replacement); |
| 61 | |
| 62 | void EditCostsTable_setSubstitutionCosts (EditCostsTable me, conststring32 targets, conststring32 sources, double cost); |
| 63 | |
| 64 | autoTableOfReal EditCostsTable_to_TableOfReal (EditCostsTable me); |
| 65 | |
| 66 | |
| 67 | autoEditDistanceTable EditDistanceTable_create (Strings target, Strings source); |
| 68 | |
| 69 | autoEditDistanceTable EditDistanceTable_createFromCharacterStrings (const char32 chars1 [], const char32 chars2 []); |
| 70 | |
| 71 | void EditDistanceTable_draw (EditDistanceTable me, Graphics graphics, int iformat, int precision, double angle); |
| 72 | |
| 73 | void EditDistanceTable_drawEditOperations (EditDistanceTable me, Graphics graphics); |
| 74 | |
| 75 | void EditDistanceTable_setDefaultCosts (EditDistanceTable me, double insertionCosts, double deletionCosts, double substitutionCosts); |
| 76 | |
| 77 | void EditDistanceTable_findPath (EditDistanceTable me, autoTableOfReal *directions); |
| 78 | |
| 79 | void EditDistanceTable_setEditCosts (EditDistanceTable me, EditCostsTable thee); |
| 80 | |
| 81 | autoTableOfReal EditDistanceTable_to_TableOfReal_directions (EditDistanceTable me); |
| 82 | |
| 83 | autoTableOfReal EditDistanceTable_to_TableOfReal (EditDistanceTable me); |
| 84 | |
| 85 | #endif /* _EditDistanceTable_h_ */ |