-
Notifications
You must be signed in to change notification settings - Fork 1
/
Utils.h
47 lines (36 loc) · 1.33 KB
/
Utils.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
/**
Project: libtpc
File name: Utils.h
@author valerio
@version 1.0 7/26/17.
*/
#ifndef LIBTPC_UTILS_H
#define LIBTPC_UTILS_H
#include <string>
#include <uima/api.hpp>
class Utils {
public:
/*!
* generate a random path name for a tmp directory
*/
static std::string get_temp_dir_path();
/*!
* write a uima descriptor for an index to file
* @param index_path the path of the index
* @param descriptor_path the path of the descriptor to be created
* @param tmp_conf_files_path the path of the directory containing the temp files for the index
*/
static void write_index_descriptor(const std::string& index_path, const std::string& descriptor_path,
const std::string& tmp_conf_files_path);
/*!
* decompress file to a new file and return file path of the latter
* @param gz_file the gx file to decompress
* @return the file path of the decompressed file
*/
static std::string decompress_gzip(const std::string & gz_file, const std::string& tmp_dir);
static std::string gettpfnvHash(uima::CAS& tcas);
static std::wstring getFulltext(uima::CAS& tcas);
static std::string remove_tags_from_text(std::string text);
static std::string remove_newlines_from_text(std::string text);
};
#endif //LIBTPC_UTILS_H