~ubuntu-branches/ubuntu/trusty/malaga/trusty-proposed

« back to all changes in this revision

Viewing changes to analysis.h

  • Committer: Bazaar Package Importer
  • Author(s): Thomas Bushnell, BSG
  • Date: 2005-01-10 11:52:04 UTC
  • mfrom: (2.1.2 hoary)
  • Revision ID: james.westby@ubuntu.com-20050110115204-hpgncw5pb0m1t8i6
Tags: 6.13-5
debian/control (malaga-doc Recommends): Suggest gv as a
postscript-viewer instead of ghostview.  (Closes: #289701).

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* Copyright (C) 1995 Bjoern Beutel. */
 
2
 
 
3
/* Description. =============================================================*/
 
4
 
 
5
/* This file contains data structures and functions used for grammatical 
 
6
 * analysis. */
 
7
 
 
8
/* Types. ===================================================================*/
 
9
 
 
10
typedef enum {MORPHOLOGY, SYNTAX} grammar_t; /* Types of grammatic analysis. */
 
11
 
 
12
typedef enum {BREAK_NODE, FINAL_NODE, UNFINAL_NODE, INTER_NODE, 
 
13
              PRUNED_NODE} tree_node_type_t;
 
14
 
 
15
typedef enum {ANALYSE_WORD, ANALYSE_ALL} analysis_mode_t;
 
16
typedef enum {NO_TREE, BUILD_TREE} tree_mode_t;
 
17
 
 
18
typedef struct /* A node of the analysis tree. */
 
19
 
20
  int_t index; /* Index of this analysis tree node. */
 
21
  tree_node_type_t type;
 
22
  int_t parent_index; /* Index of parent analysis tree node or -1. */
 
23
  string_t rule_name; /* Name of the rule that created result or NULL. */
 
24
  string_t link_surf; /* Link's surface or NULL. */
 
25
  value_t link_fs; /* Link's feature structure or NULL. */
 
26
  string_t result_surf; /* Surface of resulting state or NULL. */
 
27
  value_t result_fs; /* Feature structure of resulting state or NULL. */
 
28
  string_t rule_set; /* Successor rules of resulting state or NULL. */
 
29
} analysis_node_t;
 
30
 
 
31
typedef enum 
 
32
{ROBUST_RULE_OPTION, PRUNING_RULE_OPTION, CACHE_OPTION, 
 
33
 MOR_OUT_FILTER_OPTION, SYN_IN_FILTER_OPTION, SYN_OUT_FILTER_OPTION, 
 
34
 MOR_INCOMPLETE_OPTION, SYN_INCOMPLETE_OPTION,
 
35
 ANALYSIS_OPTION_COUNT} analysis_option_t;
 
36
 
 
37
typedef enum {STATE_SURFACE, LINK_SURFACE, RESULT_SURFACE} surface_t;
 
38
/* Kinds of surfaces that can be obtained by "get_rule_info" in "rules.h" */
 
39
 
 
40
/* Variables. ===============================================================*/
 
41
 
 
42
extern rule_sys_t *rule_system[2];
 
43
/* rule_system[ MORPHOLOGY ] and rule_system[ SYNTAX ]. Read only! */
 
44
 
 
45
extern grammar_t top_grammar; /* Grammar of last analysis. Read only! */
 
46
 
 
47
extern int_t state_count; /* Counts number of generated states. Read only! */
 
48
 
 
49
extern int_t current_state; /* Index of current state. Read only! */
 
50
 
 
51
extern bool_t recognised_by_combi_rules;
 
52
/* TRUE if last analysis was recognised by combi rules. Read only! */
 
53
 
 
54
extern bool_t recognised_by_robust_rule; 
 
55
/* TRUE if last analysis was recognised by robust rule. Read only! */
 
56
 
 
57
extern string_t last_analysis_input; 
 
58
/* Start of top level input string. Read only! */
 
59
 
 
60
extern void (*debug_state)( int_t index, bool_t enter );
 
61
/* Callback function for "analyse".
 
62
 * This is called with ENTER == TRUE when successor rules for
 
63
 * state with analysis node INDEX will be executed.
 
64
 * It is called with ENTER == FALSE when successor rules for state with 
 
65
 * analysis node INDEX have been executed. */
 
66
 
 
67
extern string_t (*get_surface)( surface_t surface_type );
 
68
/* Return surface SURFACE_TYPE for currently executed rule.
 
69
 * The result must be freed after use. */
 
70
 
 
71
/* Functions. ===============================================================*/
 
72
 
 
73
extern void init_analysis( string_t morphology_file, string_t syntax_file );
 
74
/* Initialise the analysis module.
 
75
 * MORPHOLOGY_FILE and SYNTAX_FILE are the rule files to load. 
 
76
 * SYNTAX_FILE may be NULL. */
 
77
 
 
78
extern void terminate_analysis( void );
 
79
/* Free analysis module. */
 
80
 
 
81
extern void preprocess_input( string_t input, bool_t expect_quotes);
 
82
/* Delete heading and trailing spaces in INPUT
 
83
 * and compress all whitespace sequences to a single space.
 
84
 * If EXPECT_QUOTES == TRUE, expect quoted input and remove the quotes. */
 
85
 
 
86
extern void set_analysis_option( analysis_option_t selected, bool_t setting );
 
87
/* Set analysis option SELECTED to SETTING. */
 
88
 
 
89
extern bool_t get_analysis_option( analysis_option_t selected );
 
90
/* Return the current setting of analysis option SELECTED. */
 
91
 
 
92
extern void analyse( grammar_t grammar, 
 
93
                     string_t input, 
 
94
                     tree_mode_t tree_mode,
 
95
                     analysis_mode_t mode );
 
96
/* Perform a LAG analysis of INPUT using GRAMMAR (MORPHOLOGY or SYNTAX).
 
97
 * An analysis tree will be built if TREE_MODE == BUILD_TREE.
 
98
 * The whole input will be analysed if MODE == ANALYSE_ALL. */
 
99
 
 
100
extern bool_t analysis_has_results( void );
 
101
/* Return TRUE iff the last analysis has created results. */
 
102
 
 
103
extern value_t first_analysis_result( void );
 
104
/* Return the feature structure of the first analysis result.
 
105
 * Return NULL if there are no results. */
 
106
 
 
107
extern value_t next_analysis_result( void );
 
108
/* Return the feature structure of the next analysis result.
 
109
 * Return NULL if there are no more results. */
 
110
 
 
111
extern bool_t analysis_has_nodes( void );
 
112
/* Return TRUE iff the last analysis has created tree nodes. */
 
113
 
 
114
extern analysis_node_t *get_first_analysis_node( void );
 
115
/* Return the first analysis tree node of the last analysis.
 
116
 * Return NULL if there is no node. 
 
117
 * The node must be freed with "free_analysis_node" after use. */
 
118
 
 
119
extern analysis_node_t *get_next_analysis_node( void );
 
120
/* Return the next analysis tree node of the last analysis.
 
121
 * Return NULL if there is no more node. 
 
122
 * The node must be freed with "free_analysis_node" after use. */
 
123
 
 
124
extern void free_analysis_node( analysis_node_t **node );
 
125
/* Free the memory occupied by NODE. */
 
126
 
 
127
/* End of file. =============================================================*/