xapian-core
2.1.0
languages
algorithms
finnish.h
Go to the documentation of this file.
1
/* Generated from finnish.sbl by Snowball 3.1.1 - https://snowballstem.org/ */
2
3
#include <
xapian/stem.h
>
4
5
#define SNOWBALL_RUNTIME_THROW_EXCEPTIONS
6
#include "
languages/snowball_runtime.h
"
7
8
namespace
Xapian::Internal::Snowball
{
9
10
class
Finnish
:
public
Xapian::StemImplementation
{
11
public
:
12
struct
SN_local
{
13
struct
SN_env
z
;
14
symbol
*
s_x
;
15
};
16
17
private
:
18
SN_local
zlocal
= {};
19
20
void
close_env
() {
21
struct
SN_env
* z = &(
zlocal
.
z
);
22
lose_s
(((
SN_local
*)z)->s_x);
23
lose_s
(z->
p
);
24
}
25
26
static
int
stem
(
struct
SN_env
* z);
27
28
public
:
29
Finnish
() {
30
struct
SN_env
* z = &(
zlocal
.
z
);
31
z->
p
=
create_s
();
32
try
{
33
((
SN_local
*)z)->s_x =
create_s
();
34
}
catch
(...) {
35
close_env
();
36
throw
;
37
}
38
}
39
40
~Finnish
() {
41
close_env
();
42
}
43
44
std::string
operator()
(
const
std::string& word)
override
{
45
struct
SN_env
* z = &(
zlocal
.
z
);
46
const
symbol
* s =
reinterpret_cast<
const
symbol
*
>
(word.data());
47
int
s_size = word.size() > INT_MAX ? INT_MAX : word.size();
48
replace_s
(z, 0, z->
l
, s_size, s);
49
z->
c
= 0;
50
Xapian::Internal::Snowball::Finnish::stem
(z);
51
return
std::string(
reinterpret_cast<
const
char
*
>
(z->
p
),
SIZE
(z->
p
));
52
}
53
54
std::string
get_description
()
const override
{
55
return
"finnish"
;
56
}
57
};
58
59
}
symbol
unsigned char symbol
Definition:
api.h:4
Xapian::Internal::Snowball::Finnish
Definition:
finnish.h:10
Xapian::Internal::Snowball::Finnish::stem
static int stem(struct SN_env *z)
Definition:
finnish.cc:368
Xapian::Internal::Snowball::Finnish::get_description
std::string get_description() const override
Return a string describing this object.
Definition:
finnish.h:54
Xapian::Internal::Snowball::Finnish::zlocal
SN_local zlocal
Definition:
finnish.h:18
Xapian::Internal::Snowball::Finnish::Finnish
Finnish()
Definition:
finnish.h:29
Xapian::Internal::Snowball::Finnish::operator()
std::string operator()(const std::string &word) override
Stem the specified word.
Definition:
finnish.h:44
Xapian::Internal::Snowball::Finnish::~Finnish
~Finnish()
Definition:
finnish.h:40
Xapian::Internal::Snowball::Finnish::close_env
void close_env()
Definition:
finnish.h:20
Xapian::StemImplementation
Class representing a stemming algorithm implementation.
Definition:
stem.h:41
SIZE
#define SIZE(p)
Definition:
header.h:21
lose_s
void lose_s(byte *p)
Definition:
snowball_runtime.cc:47
create_s
byte * create_s(int n)
Xapian::Internal::Snowball
Definition:
arabic.h:8
replace_s
SNOWBALL_ERR replace_s(struct SN_env *z, int c_bra, int c_ket, int s_size, const symbol *s)
Definition:
snowball_runtime.cc:581
snowball_runtime.h
stem.h
stemming algorithms
SN_env
Definition:
api.h:12
SN_env::p
symbol * p
Definition:
api.h:13
SN_env::c
int c
Definition:
api.h:14
SN_env::l
int l
Definition:
api.h:14
Xapian::Internal::Snowball::Finnish::SN_local
Definition:
finnish.h:12
Xapian::Internal::Snowball::Finnish::SN_local::s_x
symbol * s_x
Definition:
finnish.h:14
Xapian::Internal::Snowball::Finnish::SN_local::z
struct SN_env z
Definition:
finnish.h:13
Generated by
Doxygen 1.9.1