Newer
Older
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
#ifndef LIBWCCL_OPS_TOUPPER_H
#define LIBWCCL_OPS_TOUPPER_H
#include <boost/shared_ptr.hpp>
#include <libwccl/values/strset.h>
#include <libwccl/ops/functions.h>
namespace Wccl {
/**
* Operator that takes a set of strings and returns a new
* set with corresponding values in upper case form
*/
class ToUpper : public Function<StrSet> {
public:
typedef boost::shared_ptr<Function<StrSet> > StrSetFunctionPtr;
ToUpper(const StrSetFunctionPtr& strset_expr)
: strset_expr_(strset_expr)
{
BOOST_ASSERT(strset_expr_);
}
/**
* String representation of the operator in form of:
* "upper(strset_expr_string)"
*/
virtual std::string to_string(const Corpus2::Tagset& tagset) const;
/**
* String representation of conditional operator in form of:
* "upper(strset_expr_raw_string)"
* This version does not require tagset, but may be inclomplete
* and/or contain internal info.
*/
virtual std::string to_raw_string() const;
virtual const std::string raw_operator_name() const {
return "upper";
}
protected:
const StrSetFunctionPtr strset_expr_;
typedef FunctionBase::BaseRetValPtr BaseRetValPtr;
/**
* Get a string set from the argument expression and return copy of the set
* with all strings in upper case form
*/
virtual BaseRetValPtr apply_internal(const SentenceContext& context) const;
};
} /* end ns Wccl */
#endif // LIBWCCL_OPS_TOUPPER_H