-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbarzer_el_pattern_token.h
More file actions
77 lines (67 loc) · 2.73 KB
/
barzer_el_pattern_token.h
File metadata and controls
77 lines (67 loc) · 2.73 KB
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
/// Copyright Barzer LLC 2012
/// Code is property Barzer for authorized use only
///
#pragma once
#include <barzer_el_pattern.h>
namespace barzer {
// Punctuation and Stop Tokens (theChar is 0 for stops)
struct BTND_Pattern_Punct : public BTND_Pattern_Base {
std::ostream& print( std::ostream&, const BELPrintContext& ) const;
int theChar; // actual punctuation character. 0 - same as stop
BTND_Pattern_Punct() : theChar(0xffffffff) {}
BTND_Pattern_Punct(char c) : theChar(c) {}
void setChar( char c ) { theChar = c; }
int getChar() const { return theChar; }
};
inline std::ostream& operator <<( std::ostream& fp, const BTND_Pattern_Punct& x )
{ return( fp << "'" << std::hex << x.theChar << "'" ); }
/// this class BTND_Pattern_CompoundedWord is currently UNUSED
struct BTND_Pattern_CompoundedWord : public BTND_Pattern_Base {
std::ostream& print( std::ostream&, const BELPrintContext& ) const;
uint32_t compWordId;
BTND_Pattern_CompoundedWord() :
compWordId(0xffffffff)
{}
BTND_Pattern_CompoundedWord(uint32_t cwi ) : compWordId(cwi) {}
};
inline std::ostream& operator <<( std::ostream& fp, const BTND_Pattern_CompoundedWord& x )
{ return( fp << "compw[" << std::hex << x.compWordId << "]");}
struct BTND_Pattern_Meaning : public BTND_Pattern_Base {
uint32_t meaningId; /// 0xffffffff - default value means any meaning is acceptable
BTND_Pattern_Meaning(): meaningId(0xffffffff) {}
std::ostream& print( std::ostream& fp, const BELPrintContext& ctxt ) const
{
return ( fp << "m:" << meaningId << std::endl );
}
};
struct BTND_Pattern_Token : public BTND_Pattern_Base {
std::ostream& print( std::ostream&, const BELPrintContext& ) const;
ay::UniqueCharPool::StrId stringId;
bool doStem;
BTND_Pattern_Token() :
stringId(0xffffffff), doStem(false)
{}
BTND_Pattern_Token(ay::UniqueCharPool::StrId id) :
stringId(id),
doStem(false)
{}
ay::UniqueCharPool::StrId getStringId() const { return stringId; }
};
/// stop token is a regular token literal except it will be ignored
/// by any tag matching algorithm
struct BTND_Pattern_StopToken : public BTND_Pattern_Token {
std::ostream& print( std::ostream& fp, const BELPrintContext& ctxt ) const
{
return BTND_Pattern_Token::print( fp, ctxt ) << "<STOP>";
}
//ay::UniqueCharPool::StrId stringId;
BTND_Pattern_StopToken() : BTND_Pattern_Token(0xffffffff) {}
BTND_Pattern_StopToken(ay::UniqueCharPool::StrId id) :
BTND_Pattern_Token(id)
{}
};
inline std::ostream& operator <<( std::ostream& fp, const BTND_Pattern_StopToken& x )
{ return( fp << "stop[" << std::hex << x.stringId << "]");}
inline std::ostream& operator <<( std::ostream& fp, const BTND_Pattern_Token& x )
{ return( fp << "string[" << std::hex << x.stringId << "]");}
} // namespace barzer