CWB
Functions | Variables
cwb-lexdecode.c File Reference
#include <math.h>
#include "../cl/globals.h"
#include "../cl/cl.h"
#include "../cl/corpus.h"
#include "../cl/attributes.h"
#include "../cl/macros.h"

Functions

void lexdecode_print_item_info (Attribute *attr, int id, char *fallback_s)
 Prints information about a specified item on a P-attribute. More...
 
void lexdecode_show (char *attr_name, char *rx, int rx_flags)
 Prints out the lexicon of a P-attribute. More...
 
void lexdecode_usage (void)
 Prints a message describing how to use the program to STDERR and then exits. More...
 
int main (int argc, char **argv)
 Main function for cwb-lexdecode. More...
 

Variables

char * progname
 String set to the name of this program. More...
 
int print_nr = 0
 boolean: flag whether we should print line numbers More...
 
int print_freqs = 0
 boolean: print the frequencies of the words? More...
 
int print_len = 0
 boolean: print the word length s? More...
 
int dont_pad_cols = 0
 boolean: omit padding spaces on numeric columns? More...
 
int sort = 0
 boolean: print the lexicon in a sorted order? More...
 
int input_are_numbers = 0
 boolean: read lexicon IDs from file? More...
 
int show_size_only = 0
 boolean: do_show should just print the size of the lexicon and exit? More...
 
int freq_0_if_unknown = 0
 boolean: print out unknown words with freq 0? More...
 
Corpuscorpus = NULL
 
char * corpus_id = NULL
 
char * input_filename = NULL
 

Function Documentation

void lexdecode_print_item_info ( Attribute attr,
int  id,
char *  fallback_s 
)

Prints information about a specified item on a P-attribute.

Parameters
attrThe attribute to search
idThe id number of the item (type) in question
fallback_sString to print if the item is not found (use NULL to use a default fallback string)

References CDA_OK, cl_errno, cl_error(), cl_id2all(), dont_pad_cols, print_freqs, print_len, and print_nr.

Referenced by lexdecode_show().

void lexdecode_show ( char *  attr_name,
char *  rx,
int  rx_flags 
)

Prints out the lexicon of a P-attribute.

This is the business end of the cwb-lexdecode program.

Parameters
attr_nameName of the attribute to decode.
rxA regex that items must match to be printed. NULL if no regex is to be specified.
rx_flagsIGNORE_CASE; IGNORE_DIAC; both; or neither.

References ATT_POS, CDA_OK, cl_close_stream(), cl_errno, cl_error(), cl_max_cpos(), cl_max_id(), CL_MAX_LINE_LENGTH, cl_new_attribute, cl_open_stream(), cl_regex2id(), cl_sort2id(), cl_str2id(), CL_STREAM_MAGIC, CL_STREAM_READ, corpus_id, freq_0_if_unknown, input_are_numbers, input_fd, input_filename, lexdecode_print_item_info(), progname, show_size_only, and sort.

Referenced by main().

void lexdecode_usage ( void  )

Prints a message describing how to use the program to STDERR and then exits.

References progname, and VERSION.

Referenced by main().

int main ( int  argc,
char **  argv 
)

Variable Documentation

Corpus* corpus = NULL
char* corpus_id = NULL

Referenced by lexdecode_show(), and main().

int dont_pad_cols = 0

boolean: omit padding spaces on numeric columns?

Referenced by lexdecode_print_item_info(), and main().

int freq_0_if_unknown = 0

boolean: print out unknown words with freq 0?

Referenced by lexdecode_show(), and main().

int input_are_numbers = 0

boolean: read lexicon IDs from file?

Referenced by lexdecode_show(), and main().

char* input_filename = NULL

Referenced by lexdecode_show(), and main().

int print_freqs = 0

boolean: print the frequencies of the words?

Referenced by lexdecode_print_item_info(), and main().

int print_len = 0

boolean: print the word length s?

Referenced by lexdecode_print_item_info(), and main().

int print_nr = 0

boolean: flag whether we should print line numbers

Referenced by lexdecode_print_item_info(), and main().

char* progname

String set to the name of this program.

Referenced by lexdecode_show(), lexdecode_usage(), and main().

int show_size_only = 0

boolean: do_show should just print the size of the lexicon and exit?

Referenced by lexdecode_show(), and main().

int sort = 0

boolean: print the lexicon in a sorted order?

Referenced by lexdecode_show(), and main().