chinwag 0.1.5 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Rakefile +1 -1
- data/ext/chinwag/chinwag.c +46 -41
- data/ext/chinwag/chinwag.h +20 -12
- data/ext/chinwag/config.c +6 -6
- data/ext/chinwag/dict.c +211 -107
- data/ext/chinwag/dict.h +93 -41
- data/ext/chinwag/latin.h +2 -2
- data/ext/chinwag/rb_chinwag_ext.c +255 -167
- data/ext/chinwag/seuss.h +2 -2
- data/ext/chinwag/tokenize.c +7 -5
- data/ext/chinwag/tokenize.h +5 -2
- metadata +2 -2
data/ext/chinwag/seuss.h
CHANGED
data/ext/chinwag/tokenize.c
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
#include "tokenize.h"
|
2
2
|
|
3
|
-
U32 stringify_file
|
3
|
+
U32 stringify_file
|
4
|
+
(char** buffer, FILE* fp)
|
4
5
|
{
|
5
6
|
// setup
|
6
7
|
U64 sz = 0;
|
@@ -22,11 +23,12 @@ U32 stringify_file(char** buffer, FILE* fp)
|
|
22
23
|
return sz;
|
23
24
|
}
|
24
25
|
|
25
|
-
|
26
|
+
cwdict_t tokenize
|
27
|
+
(const char* const buffer, const char* delimiters)
|
26
28
|
{
|
27
29
|
char* tok;
|
28
30
|
char* mutable_buffer = (char*)malloc(strlen(buffer) + 1 * sizeof(char));
|
29
|
-
|
31
|
+
cwdict_t dict = cwdict_open();
|
30
32
|
|
31
33
|
// get mutable copy of buffer; a bit slower, but allows for const-ness
|
32
34
|
strcpy(mutable_buffer, buffer);
|
@@ -37,7 +39,7 @@ dict_t tokenize(const char* const buffer, const char* delimiters)
|
|
37
39
|
while(tok != NULL)
|
38
40
|
{
|
39
41
|
// add tok to dict
|
40
|
-
dict =
|
42
|
+
dict = cwdict_place_word_strict(dict, tok);
|
41
43
|
|
42
44
|
// get new tok (if any)
|
43
45
|
tok = strtok(NULL, delimiters);
|
@@ -47,7 +49,7 @@ dict_t tokenize(const char* const buffer, const char* delimiters)
|
|
47
49
|
free(mutable_buffer);
|
48
50
|
|
49
51
|
// clean up dict
|
50
|
-
dict =
|
52
|
+
dict = cwdict_prune(dict, true);
|
51
53
|
|
52
54
|
return dict;
|
53
55
|
}
|
data/ext/chinwag/tokenize.h
CHANGED
@@ -3,7 +3,10 @@
|
|
3
3
|
|
4
4
|
#include "chinwag.h"
|
5
5
|
|
6
|
-
U32 stringify_file
|
7
|
-
|
6
|
+
U32 stringify_file
|
7
|
+
(char** buffer, FILE* fp);
|
8
|
+
|
9
|
+
cwdict_t tokenize
|
10
|
+
(const char* const buffer, const char* delimiters);
|
8
11
|
|
9
12
|
#endif
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: chinwag
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 1.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chris Calo
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2015-01-04 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: A text-synthesis library, for use in layout testing (and more). It houses
|
14
14
|
flexible methods for generation, and a dictionary class (CWDict) allowing adequate
|