summaryrefslogtreecommitdiffstats
path: root/src/plugins/custom/regmark/metaphone.h
blob: 4de3292f96e510a883becc33dfc29b2e955165e9 (plain)
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
#ifndef RSPAMD_METAPHONE_H
#define RSPAMD_METAPHONE_H

#include "../../../config.h"


#define ENCODE(c) (g_ascii_isalpha(c) ? _codes[((g_ascii_toupper(c)) - 'A')] : 0)

#define isvowel(c)	(ENCODE(c) & 1)		/* AEIOU */

/* These letters are passed through unchanged */
#define NOCHANGE(c)	(ENCODE(c) & 2) 	/* FJMNR */

/* These form dipthongs when preceding H */
#define AFFECTH(c)	(ENCODE(c) & 4) 	/* CGPST */

/* These make C and G soft */
#define MAKESOFT(c)	(ENCODE(c) & 8) 	/* EIY */

/* These prevent GH from becoming F */
#define NOGHTOF(c)	(ENCODE(c) & 16) 	/* BDH */

#undef USE_TRADITIONAL_METAPHONE

gboolean metaphone (char *word, int max_phonemes, char **phoned_word);

#endif