-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtextutils.h
42 lines (41 loc) · 1.28 KB
/
textutils.h
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
#ifndef GROUPTEXT_H
#define GROUPTEXT_H 1
#define _GNU_SOURCE
#include <string.h>
#include <stdlib.h>
#include <ctype.h>
#include <unistd.h>
#include <stdio.h>
#include <stdbool.h>
#include <math.h>
#include <Judy.h>
struct time {
int h, m, s;
};
//On 32-bit systems replace uint32_t with uint16_t in the following struct
struct __attribute__((__packed__)) wordData {
uint32_t count;
uint32_t syllables;
};
struct wordCxt {
Pvoid_t PJArray;
struct wordData * PValue;
Word_t Bytes;
};
#define ARRAY_SIZE(array) (sizeof(array) / sizeof(*array))
#define var __auto_type
void registerWord(struct wordCxt *cxt, char *w, size_t len, size_t syllaCount);
bool isVowel(int c);
struct time calcReadingTime(size_t words);
struct time calcSpeakingTime(size_t words);
bool matchesLetter(char n, char *a);
bool charEqual(char a, char b);
bool charEqualByRef(char *a, char *b);
ssize_t countSyllables(char *w, size_t s);
size_t trim(char *szWrite);
bool isWebsite(const void *, size_t);
bool isNewSentence(const void *, size_t);
void calcScores(double words, double sentences, double characters, double syllables, double pollysyllables, double * avg, double *ari, double *fleschKincaid, double *smogScore, double * colemanLiau);
size_t uniqueWords(struct wordCxt * cxt);
void freeWordJudy(struct wordCxt *cxt);
#endif