00001 // -*- mode: c++; indent-tabs-mode: nil; tab-width:2 -*- 00002 #include "ug_corpus_token.h" 00003 // Simple wrapper around integer IDs for use with the Ctrack and TSA 00004 // template classes. 00005 // (c) 2007-2009 Ulrich Germann 00006 00007 namespace sapt 00008 { 00009 id_type const& 00010 SimpleWordId:: 00011 id() const 00012 { 00013 return theID; 00014 } 00015 00016 int 00017 SimpleWordId:: 00018 cmp(SimpleWordId const& other) const 00019 { 00020 return (theID < other.theID ? -1 00021 : theID == other.theID ? 0 00022 : 1); 00023 } 00024 00025 SimpleWordId:: 00026 SimpleWordId(id_type const& id) 00027 { 00028 theID = id; 00029 } 00030 00031 bool 00032 SimpleWordId:: 00033 operator==(SimpleWordId const& other) const 00034 { 00035 return theID == other.theID; 00036 } 00037 00038 id_type 00039 SimpleWordId:: 00040 remap(std::vector<id_type const*> const& m) const 00041 { 00042 if (!m[0]) return theID; 00043 return m[0][theID]; 00044 } 00045 00046 }