forked from HIT-SCIR/ltp
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Import boost program options, rewrite Postagger frontend
- Loading branch information
Showing
82 changed files
with
9,675 additions
and
2,308 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
#ifndef __LTP_FRAMEWORK_FRONTEND_H__ | ||
#define __LTP_FRAMEWORK_FRONTEND_H__ | ||
|
||
namespace ltp { | ||
namespace framework { | ||
|
||
enum FrontendMode { | ||
kLearn, | ||
kTest, | ||
kDump | ||
}; | ||
|
||
class Frontend { | ||
protected: | ||
FrontendMode mode; | ||
|
||
public: | ||
Frontend(const FrontendMode& _mode): mode(_mode) {} | ||
}; | ||
|
||
} // namespace framework | ||
} // namespace framework | ||
|
||
#endif // end for __LTP_FRAMEWORK_FRONTEND_H__ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
#ifndef __LTP_FRAMEWORK_IO_H__ | ||
#define __LTP_FRAMEWORK_IO_H__ | ||
|
||
#include <iostream> | ||
|
||
namespace ltp { | ||
namespace framework { | ||
|
||
class Reader { | ||
protected: | ||
std::istream& is; | ||
public: | ||
Reader(std::istream& _is): is(_is) {} | ||
|
||
size_t number_of_lines() { | ||
const int size = 1024*1024; | ||
char buffer[1024*1024]; | ||
size_t retval = 0; | ||
|
||
while (true) { | ||
is.read(buffer, 1024*1024); | ||
std::streamsize cc = is.gcount(); | ||
if (0 == cc) { break; } | ||
for (std::streamsize i = 0; i < cc; ++ i) { | ||
if (buffer[i] == '\n') { ++ retval; } } | ||
} | ||
is.clear(); | ||
is.seekg(0, std::ios_base::beg); | ||
return retval; | ||
} | ||
}; | ||
|
||
} // namespace framework | ||
} // namespace ltp | ||
|
||
#endif // end for __LTP_FRAMEWORK_IO_H__ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.