forked from UnitexGramLab/unitex-core
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCassys_io.h
144 lines (115 loc) · 3.82 KB
/
Cassys_io.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
/*
* Unitex
*
* Copyright (C) 2001-2018 Université Paris-Est Marne-la-Vallée <[email protected]>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
*
*/
/*
* Cassys_io.h
*
* Created on: 8 oct. 2012
* Author: David Nott, Nathalie Friburger ([email protected])
*/
#ifndef CASSYS_IO_H_
#define CASSYS_IO_H_
#ifndef HAS_UNITEX_NAMESPACE
#define HAS_UNITEX_NAMESPACE 1
#endif
namespace unitex {
#define CASSYS_DIRECTORY_EXTENSION "_csc"
/**
* \brief Creates the directory \path
*
* @param path the directory to be created
*
* @todo Windows version
*/
int make_cassys_directory(const char *path);
/**
* \brief Creates the cassys working directory needed before call tokenize
*
* @param[in] text the target text file
*/
int initialize_working_directory_before_tokenize(const char *text,int must_create_directory);
/**
* \brief Creates the cassys working directory and copies the target \b text and the associated \b snt directory
* into the working directory with number label
*
* The working directory is the canonical name of the the target \b text file with suffix \b _csc. A numbered suffix
* is also added to the copied \b text and to the associated \snt directory.
*
* If the \b text is \b foo.snt and the associated \b snt directory is \b foo_snt/, the function will create the
* following files and directories :
* - directory \b foo_csc/
* - file \b foo_csc/foo_0.snt (copy of \b foo.snt)
* - directory \b foo_csc/foo_0.snt/ (copy of \b foo_snt/ ant its content)
*
* @param[in] text the target text file
*/
int initialize_working_directory(const char *text, int must_create_directory);
/**
* cleanup a working directory
*/
void cleanup_work_directory_content(char*);
/**
* get the cascade work directory for a corpus
*/
void get_csc_path(const char* filename, char* result);
/**
* get the first cascade work directory for a corpus
*/
void get_csc_wd_path(const char* filename, char* result);
/**
* \brief
*
* \param[in] text
* \param[in] next_transducer_label
*/
char* create_labeled_files_and_directory(
const char *text,
int previous_transducer_label,
int next_transducer_label,
int previous_iteration,
int next_iteration,
int must_create_directory,
int must_copy_file) ;
//int copy_directory_snt_item(const char*dest_snt_dir,const char*src_snd_dir,const char*filename,int mandatory);
/**
* \brief Copies the content of a snt directory \b src in the directory \b dest
*
* @param src the source directory
* @param dest the destination directory
*
*/
int copy_directory_snt_content(const char *dest, const char *src, int contain_mandatory_files);
char* create_updated_graph_filename(const char *text,
int next_transducer_label,
int next_iteration,
const char* graph_name,
const char* ext);
char* get_file_in_current_snt(const char *text,
int next_transducer_label,
int next_iteration,
const char* file_name,
const char* ext);
/**
* copy the content of the file with stream f and return this content.
*/
unichar* read_file(U_FILE *f);
void protect_text(const char *fileName, const VersatileEncodingConfig* vec);
}
#endif /* CASSYS_IO_H_ */