nlsplit

split natural language text in chunks at reasonable language boundaries
git clone https://a3nm.net/git/nlsplit/
Log | Files | Refs | README

commit 4ef6175f70791c20d6d6e43ef60b36cd61b19dd0
parent 57e893f47c6f8fb992332604abc3fe2994ba8dd6
Author: Antoine Amarilli <a3nm@a3nm.net>
Date:   Sun,  9 Oct 2011 19:41:31 +0200

constants for return

Diffstat:
nlsplit.c | 7+++++--
1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/nlsplit.c b/nlsplit.c @@ -44,6 +44,9 @@ int size; /* non-alpha is a last-resort split */ #define NON_ALPHA_SCORE 0.5 +#define E_SYNTAX 1 +#define E_MEMORY 2 + #define MAX(a, b) (((a) > (b)) ? (a) : (b)) #define MIN(a, b) (((a) < (b)) ? (a) : (b)) #define MID(l, r, s) ((((l) + ((r) + ((l) > (r) ? (s) : 0)))/2) % (s)) @@ -58,7 +61,7 @@ void usage(char** argv) { /* show usage and exit */ fprintf(stderr, "Usage: %s SIZE [MINCONFIDENCE]\n", argv[0]); fprintf(stderr, help); - exit(1); + exit(E_SYNTAX); } float punct_score(char c) { @@ -169,7 +172,7 @@ int split() { points = malloc(size * sizeof(point)); if (!piece || !points) { perror("malloc"); - return 1; + return E_MEMORY; } /* read file, break after splitting at EOF */