Skip to content
Snippets Groups Projects
Commit fc0b36e8 authored by Alexis Nasr's avatar Alexis Nasr
Browse files

moved word.c and sentence.c to maca_common changed some file names.

parent e20a7679
No related branches found
No related tags found
No related merge requests found
......@@ -4,8 +4,8 @@
#include<unistd.h>
#include<getopt.h>
#include"context.h"
#include"movement.h"
#include"oracle.h"
#include"movement_parser.h"
#include"oracle_parser.h"
#include"feat_fct.h"
#include"config2feat_vec.h"
#include"feature_table.h"
......
......@@ -4,8 +4,8 @@
#include<unistd.h>
#include<getopt.h>
#include"context.h"
#include"movement.h"
#include"oracle.h"
#include"movement_parser.h"
#include"oracle_parser.h"
#include"feat_fct.h"
#include"config2feat_vec.h"
#include"feature_table.h"
......
......@@ -3,8 +3,8 @@
#include<string.h>
#include<unistd.h>
#include<getopt.h>
#include"movement.h"
#include"oracle.h"
#include"movement_parser.h"
#include"oracle_parser.h"
#include"feat_fct.h"
#include"feature_table.h"
#include"dico.h"
......
......@@ -3,14 +3,13 @@
#include<string.h>
#include<unistd.h>
#include<getopt.h>
#include"movement.h"
#include"oracle.h"
#include"movement_parser.h"
#include"oracle_parser.h"
#include"feat_fct.h"
#include"context.h"
#include"feat_vec.h"
#include"feature_table.h"
#include"dico_vec.h"
#include"corpus.h"
#include"beam.h"
#include"word_emb.h"
#include"config2feat_vec.h"
......
void node_print(node *root)
{
node *child = NULL;
for(child = root->last_left_child; child; child = child->prec_sibling)
print_node(child);
printf("%s ", root->string_array[1]);
for(child = root->first_right_child; child; child = child->next_sibling)
print_node(child);
}
void node_add_right_child(node *gov, int label, node *dep)
{
dep->label = label;
dep->gov = gov;
if(gov->first_right_child == NULL){
gov->first_right_child = gov->last_right_child = dep;
return;
}
dep->prec_sibling = gov->last_right_child;
gov->last_right_child->next_sibling = dep;
gov->last_right_child = dep;
}
void node_add_left_child(node *gov, int label, node *dep)
{
dep->label = label;
dep->gov = gov;
if(gov->first_left_child == NULL){
gov->first_left_child = gov->last_left_child = dep;
return;
}
dep->prec_sibling = gov->last_left_child;
gov->last_left_child->next_sibling = dep;
gov->last_left_child = dep;
}
node *node_new(word *w)
{
int i;
node *n = (node *) memalloc(sizeof(node));
n->w = w;
n->next_sibling = NULL;
n->prec_sibling = NULL;
n->first_right_child = NULL;
n->last_right_child = NULL;
n->first_left_child = NULL;
n->last_left_child = NULL;
return n;
}
#ifndef __TREE__
#define __TREE__
#include "word.h"
typedef struct _node {
word *w;
struct _word *next_sibling;
struct _word *prec_sibling;
struct _word *gov;
struct _word *first_right_child;
struct _word *last_right_child;
struct _word *first_left_child;
struct _word *last_left_child;
int label;
int index;
} node;
void print_node(word *root);
void word_add_right_child(word *gov, int label, word *dep);
void word_add_left_child(word *gov, int label, word *dep);
word *word_new(char *input);
word *word_create_dummy(mcd *mcd_struct);
word *word_copy(word *w);
void word_free(word *w);
void word_print_conll07(FILE *f, word *w, mcd *mcd_struct);
void word_print(FILE *f, word *w, mcd *mcd_struct, dico *dico_labels);
void word_set_column_value(word *w, mcd *mcd_struct, int column, char *value);
char *word_get_column_value(word *w, mcd *mcd_struct, int column);
void word_set_feature_value(word *w, int feat, int value);
int word_get_feature_value(word *w, int feat);
word *word_read(FILE *f, mcd *mcd_struct);
word *word_parse_buffer(char *buffer, mcd *mcd_struct);
#endif
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment