/usr/include/ticcutils/TreeHash.h is in libticcutils2-dev 0.4-5.1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 | /*
$Id: TreeHash.h 15564 2013-01-07 14:25:32Z sloot $
$URL: https://ilk.uvt.nl/svn/sources/libticcutils/trunk/include/ticcutils/TreeHash.h $
Copyright (c) 1998 - 2013
ILK - Tilburg University
CLiPS - University of Antwerp
This file is part of ticcutils
ticcutils is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
ticcutils is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, see <http://www.gnu.org/licenses/>.
For questions and suggestions, see:
http://ilk.uvt.nl/software.html
or send mail to:
timbl@uvt.nl
*/
#ifndef TICC_TREE_H
#define TICC_TREE_H
#include <vector>
#include "ticcutils/Trie.h"
namespace Hash {
using namespace Tries;
// a StringTokenizer. Stores strings and assigns unique numbers
class HashInfo {
friend std::ostream& operator<< ( std::ostream&, const HashInfo& );
public:
HashInfo( const std::string&, const unsigned int );
~HashInfo();
const std::string& Name() const { return name; };
unsigned int Index() const { return ID; };
private:
const std::string name;
unsigned int ID;
HashInfo( const HashInfo& );
HashInfo& operator=( const HashInfo& );
};
class StringHash {
friend std::ostream& operator << ( std::ostream&, const StringHash& );
public:
StringHash();
~StringHash();
unsigned int NumOfEntries() const { return NumOfTokens; };
unsigned int Hash( const std::string& );
unsigned int Lookup( const std::string& ) const;
const std::string& ReverseLookup( unsigned int ) const;
private:
unsigned int NumOfTokens;
std::vector<HashInfo*> rev_index;
Trie<HashInfo> StringTree;
StringHash( const StringHash& );
StringHash& operator=( const StringHash& );
};
// a Lexion. Stores strings and translations, assigns unique ID's as well
class LexInfo {
friend std::ostream& operator<<( std::ostream&, const LexInfo& );
public:
LexInfo( const std::string&, const std::string& );
~LexInfo();
const std::string& Name() const { return name; };
const std::string& Trans() const { return trans; };
private:
const std::string name;
const std::string trans;
LexInfo( const LexInfo& );
LexInfo& operator=( const LexInfo& );
};
class Lexicon {
friend std::ostream& operator<< ( std::ostream&, const Lexicon& );
public:
Lexicon();
~Lexicon();
LexInfo *Lookup( const std::string& ) const;
LexInfo *Store( const std::string&, const std::string& );
private:
Trie<LexInfo> LexTree;
Lexicon( const Lexicon& );
Lexicon& operator=( const Lexicon& );
};
}
#endif
|