ADS
Algorithms and Data Structures
Loading...
Searching...
No Matches
ApproximateMatching.h
Go to the documentation of this file.
1/*--------------------------------------------------------------------------*/
2/*----------------------- File ApproximateMatching.h -----------------------*/
3/*--------------------------------------------------------------------------*/
52/*--------------------------------------------------------------------------*/
53/*----------------------------- DEFINITIONS --------------------------------*/
54/*--------------------------------------------------------------------------*/
55
56#ifndef __ADS_ApproximateMatching
57 #define __ADS_ApproximateMatching
58/* self-identification: #endif constant */
59
60/*--------------------------------------------------------------------------*/
61/*------------------------------ INCLUDES ----------------------------------*/
62/*--------------------------------------------------------------------------*/
63
64#include <algorithm>
65#include "ADS/Contract.h"
66
67#include <cstddef>
68#include <string>
69#include <utility>
70#include <vector>
71
72/*--------------------------------------------------------------------------*/
73/*--------------------------- NAMESPACE ------------------------------------*/
74/*--------------------------------------------------------------------------*/
75
76namespace ADS
77{
78
80using Table = std::vector< std::vector< int > >;
81
103template< class S >
104Table matchingTable( const S & P , const S & T , bool edit = false );
105
125template< class S >
126std::pair< long , int > stringMatching( const S & P , const S & T );
127
153template< class S >
154std::size_t occurrence( const Table & DP , const S & P , const S & T ,
155 std::size_t j );
156
176template< class S >
177int stringMatchingSingleRow( const S & P , const S & T );
178
199template< class S >
200int editDistance( const S & P , const S & T );
201
202/*--------------------------------------------------------------------------*/
203
204} // end( namespace ADS )
205
206/*--------------------------------------------------------------------------*/
207/*-------------------------- IMPLEMENTATION --------------------------------*/
208/*--------------------------------------------------------------------------*/
209
210#include "ADS/string/impl/ApproximateMatching.tpp"
211
212/*--------------------------------------------------------------------------*/
213
214#endif /* ApproximateMatching.h included */
215
216/*--------------------------------------------------------------------------*/
217/*--------------------- End File ApproximateMatching.h ---------------------*/
218/*--------------------------------------------------------------------------*/
The contracts of ADS: the preconditions, the postconditions and the invariants of the operations,...
std::size_t occurrence(const Table &DP, const S &P, const S &T, std::size_t j)
the place where the occurrence of starts in that ends at with errors, walking back on the table
std::vector< std::vector< int > > Table
the table of the costs
Definition ApproximateMatching.h:80
int stringMatchingSingleRow(const S &P, const S &T)
the least number of errors of an occurrence of in , with two rows of the table only
std::pair< long, int > stringMatching(const S &P, const S &T)
the end of an occurrence of in with the fewest errors, the first one, and their number; if is emp...
Table matchingTable(const S &P, const S &T, bool edit=false)
the table of and , of rows and columns; with edit the first row is , that of the edit distance
int editDistance(const S &P, const S &T)
the edit distance of and , in space
Definition ADT.h:96