![]() |
LIMA
Libre Multilingual Analyzer — C++ API
|
This class is dedicated to the various adaptations that have to be done on texts : More...
#include <linguisticProcessing/common/misc/textFormater.h>
Public Member Functions | |
| TextFormater () | |
| virtual | ~TextFormater () |
| int | untaggingWithSpaces (std::ostream &status, std::istream &input, std::ostream &output, bool wide=false, const std::string &endSentenceTag="") const |
| This method replaces all the tags in the UTF-8 encoded input stream by spaces or underscores in the output stream. | |
This class is dedicated to the various adaptations that have to be done on texts :
Definition at line 36 of file textFormater.h.
| Lima::Common::Misc::TextFormater::TextFormater | ( | ) |
Definition at line 33 of file textFormater.cpp.
|
virtual |
Definition at line 37 of file textFormater.cpp.
| int Lima::Common::Misc::TextFormater::untaggingWithSpaces | ( | std::ostream & | status, |
| std::istream & | input, | ||
| std::ostream & | output, | ||
| bool | wide = false, |
||
| const std::string & | endSentenceTag = "" |
||
| ) | const |
This method replaces all the tags in the UTF-8 encoded input stream by spaces or underscores in the output stream.
Underscores are written when the tag is adjacent to a word (directly or by another) tag. Spaces are written otherwise.
If an unclosed tag finishes the input stream, the result is written but an error message is written in status and a non zero-value is returned. If an opening '<' is found inside a tag, it is ignored (replaced) but an error message is written in status and a non zero-value will be returned. If a closing '>' is found outside a tag, it is ignored (replaced) but an error message is written in status and a non zero-value will be returned. Currently, this method is stateless. 2 subsequent calls consider working on two different streams. By the way, it has not to store persistent information about its state and thus it does not modify its receiver. Consequently, it is constant.
| std::ostream& | status the stream where errors and warning will be written |
| std::istream& | input the input stream. Should contain a valid SGML file |
| std::ostream& | output the output stream. The result stream where un-tagged results are written |
| std::string& | endSentenceTag if set to non-empty, this will be used as a sentence separator and the first character of this tag (the <) will be replaced by a dot in the output |
Underscores are written when the tag is adjacent to a word (directly or by another) tag. Spaces are written otherwise. If an unclosed tag finishes the input stream, the result is written but an error message is written in status and a non zero-value is returned. If an opening '<' is found inside a tag, it is ignored (replaced) but an error message is written in status and a non zero-value will be returned. If a closing '>' is found outside a tag, it is ignored (replaced) but an error message is written in status and a non zero-value will be returned. This method does not modify its receiver and thus is constant. Throws a runtime_error in case of an unknown internal state It does not record the removed tags. Should be done in another method;
| std::ostream& | status the stream where errors and warning will be written |
| std::istream& | input the input stream. Should contain a valid SGML file |
| std::ostream& | output the output stream. The result stream where un-tagged results are written |
Definition at line 55 of file textFormater.cpp.