mootTokenIO.h
Go to the documentation of this file.
1 /* -*- Mode: C++; c-basic-offset: 2; -*- */
2 
3 /*
4  libmoot : moocow's part-of-speech tagging library
5  Copyright (C) 2003-2014 by Bryan Jurish <moocow@cpan.org>
6 
7  This library is free software; you can redistribute it and/or
8  modify it under the terms of the GNU Lesser General Public
9  License as published by the Free Software Foundation; either
10  version 3 of the License, or (at your option) any later version.
11 
12  This library is distributed in the hope that it will be useful,
13  but WITHOUT ANY WARRANTY; without even the implied warranty of
14  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15  Lesser General Public License for more details.
16 
17  You should have received a copy of the GNU Lesser General Public
18  License along with this library; if not, write to the Free Software
19  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 */
21 
22 /*--------------------------------------------------------------------------
23  * File: mootTokenIO.h
24  * Author: Bryan Jurish <moocow@cpan.org>
25  * Description:
26  * + moocow's PoS tagger : token I/O
27  *--------------------------------------------------------------------------*/
28 
34 #ifndef _moot_TOKEN_IO_H
35 #define _moot_TOKEN_IO_H
36 
37 #include <mootTokenLexer.h> //-- includes GenericLexer -> BufferIO -> Utils -> CIO -> IO
38 #include <mootCxxIO.h>
39 
40 #include <stdexcept>
41 
42 /*moot_BEGIN_NAMESPACE*/
43 namespace moot {
44 
45 //==========================================================================
46 // Globals
47 
50  tiofNone = 0x00000000,
51  tiofUnknown = 0x00000001,
52  tiofNull = 0x00000002,
53  tiofUser = 0x00000004,
54  tiofNative = 0x00000008,
55  tiofXML = 0x00000010,
56  tiofConserve = 0x00000020,
57  tiofPretty = 0x00000040,
58  tiofText = 0x00000080,
59  tiofAnalyzed = 0x00000100,
60  tiofTagged = 0x00000200,
61  tiofPruned = 0x00000400,
62  tiofLocation = 0x00000800,
63  tiofCost = 0x00001000,
64  tiofTrace = 0x00002000,
65  tiofPredict = 0x00004000,
66  tiofFlush = 0x00008000
67 };
69 
71 static const int tiofRare = tiofText;
72 
74 static const int tiofMediumRare = tiofText|tiofAnalyzed; //|tiofCost
75 
77 static const int tiofMedium = tiofText|tiofTagged;
78 
80 static const int tiofWellDone = tiofText|tiofAnalyzed|tiofTagged; //|tiofCost
81 
82 //==========================================================================
83 // TokenIO
84 
86 class TokenIO {
87 public:
88  //--------------------------------------------------------------------
90 
91 
99  static int parse_format_string(const std::string &fmtString);
100 
108  static int guess_filename_format(const char *filename);
109 
114  static bool is_empty_format(int fmt);
115 
119  static int sanitize_format(int fmt,
120  int fmt_implied=tiofNone,
121  int fmt_default=tiofNone);
122 
131  static int parse_format_request(const char *request,
132  const char *filename=NULL,
133  int fmt_implied=tiofNone,
134  int fmt_default=tiofNone);
135 
137  static std::string format_canonical_string(int fmt);
139 
140  //--------------------------------------------------------------------
142 
143 
148  static class TokenReader *new_reader(int fmt);
149 
155  static class TokenWriter *new_writer(int fmt);
156 
167  static class TokenReader *file_reader(const char *filename, const char *fmt_request=NULL, int fmt_implied=tiofNone, int fmt_default=tiofNone);
168 
179  static class TokenWriter *file_writer(const char *filename, const char *fmt_request=NULL, int fmt_implied=tiofNone, int fmt_default=tiofNone);
181 
182  //--------------------------------------------------------------------
184 
185 
189  static size_t pipe_tokens(class TokenReader *reader, class TokenWriter *writer);
190 
195  static size_t pipe_sentences(class TokenReader *reader, class TokenWriter *writer);
197 };
198 
199 //==========================================================================
200 // TokenReader
201 
203 class TokenReader : public TokenIO {
204 public:
206  static const size_t TR_DEFAULT_BUFSIZE = 256;
207 
208 public:
210  int tr_format;
213  std::string tr_name;
214 
216  mootio::mistream *tr_istream;
217 
219  bool tr_istream_created;
220 
229  mootToken *tr_token;
230 
239  mootSentence *tr_sentence;
240 
246  void *tr_data;
247 
248 public:
249  /*------------------------------------------------------------
250  * TokenReader: Constructors
251  */
259  TokenReader(int fmt =tiofUnknown,
260  const std::string &name ="TokenReader")
261  : tr_format(fmt),
262  tr_name(name),
263  tr_istream(NULL),
264  tr_istream_created(false),
265  tr_token(NULL),
266  tr_sentence(NULL),
267  tr_data(NULL)
268  {};
269 
271  virtual ~TokenReader(void)
272  {
274  };
275 
279  inline void tr_clear(void)
280  {
281  if (tr_token) tr_token->clear();
282  if (tr_sentence) tr_sentence->clear();
283  };
285 
286 
287  /*------------------------------------------------------------
288  * TokenReader: Input Selection
289  */
298  virtual void from_mstream(mootio::mistream *mistreamp)
299  {
300  this->close();
301  tr_istream = mistreamp;
302  byte_number(1);
303  line_number(1);
304  column_number(0);
305  tr_istream_created = false;
306  };
307 
312  virtual void from_mstream(mootio::mistream &mis)
313  {
314  this->from_mstream(&mis);
315  };
316 
323  virtual void from_filename(const char *filename)
324  {
325  this->from_mstream(new mootio::mifstream(filename,"rb"));
326  tr_istream_created = true;
327  if (!tr_istream || !tr_istream->valid()) {
328  this->carp("open failed for \"%s\": %s", filename, strerror(errno));
329  this->close();
330  }
331  };
332 
339  virtual void from_file(FILE *file)
340  {
341  this->from_mstream(new mootio::micstream(file));
342  tr_istream_created = true;
343  };
344 
351  virtual void from_fd(int fd)
352  {
353  this->close();
354  throw domain_error("from_fd(): not implemented");
355  };
356 
363  virtual void from_buffer(const void *buf, size_t len)
364  {
365  this->from_mstream(new mootio::micbuffer(buf,len));
366  tr_istream_created = true;
367  };
368 
375  virtual void from_string(const char *s)
376  {
377  from_buffer(s,strlen(s));
378  };
379 
386  virtual void from_cxxstream(std::istream &is)
387  {
388  this->from_mstream(new mootio::micxxstream(is));
389  tr_istream_created = true;
390  };
391 
400  virtual void close(void) {
401  if (tr_istream_created) {
402  tr_istream->close();
403  if (tr_istream) delete tr_istream;
404  }
405  tr_istream_created = false;
406  tr_istream = NULL;
407  };
408 
412  virtual bool opened(void)
413  {
414  return tr_istream!=NULL && tr_istream->valid();
415  };
417 
418  /*------------------------------------------------------------
419  * TokenReader: Token-Level Access
420  */
423 
431  inline mootToken *token(void) { return tr_token; };
432 
440  inline mootSentence *sentence(void) { return tr_sentence; };
441 
447  virtual mootTokenType get_token(void) {
448  throw domain_error("TokenReader: get_token() not implemented");
449  };
456  virtual mootTokenType get_sentence(void);
458 
459  /*------------------------------------------------------------
460  * TokenReader: Diagnostics
461  */
466  virtual void reader_name(const std::string &myname) { tr_name = myname; };
467 
469  virtual size_t line_number(void) { return 0; };
470 
472  virtual size_t line_number(size_t n) { return n; };
473 
475  virtual size_t column_number(void) { return 0; };
476 
478  virtual size_t column_number(size_t n) { return n; };
479 
481  virtual mootio::ByteOffset byte_number(void) { return 0; };
482 
484  virtual mootio::ByteOffset byte_number(size_t n) { return n; };
487  virtual void carp(const char *fmt, ...);
489 };
490 
491 //==========================================================================
492 // TokenReaderNative
493 
498 public:
499  /*----------------------------------------
500  * Reader: Native: Data
501  */
504 
506  mootSentence trn_sentence;
507 
508 public:
509  /*----------------------------------------
510  * Reading: Native: Methods: Constructors
511  */
518  TokenReaderNative(int fmt =tiofWellDone,
519  const std::string &name ="TokenReaderNative")
520  : TokenReader(fmt,name)
521  {
522  tr_format |= tiofNative;
523  input_is_tagged(tr_format&tiofTagged);
524  input_has_locations(tr_format&tiofLocation);
525  input_has_cost(tr_format&tiofCost);
526 
527  tr_sentence = &trn_sentence;
528  tr_token = &lexer.mtoken_default;
529 
530  lexer.to_file(stderr);
531  };
532 
534  virtual ~TokenReaderNative(void)
535  {
536  this->close();
537  };
539 
540  /*----------------------------------------
541  * Reader: Native: Methods: Input Selection
542  */
544 
545 
546  virtual void from_mstream(mootio::mistream *mis);
548 
549 
550  /*----------------------------------------
551  * Reader: Native: Methods: Input
552  */
555  virtual mootTokenType get_token(void);
556  virtual mootTokenType get_sentence(void);
558 
559 
560  /*----------------------------------------
561  * Reader: Native: Methods: Diagnostics
562  */
565 
567  virtual size_t line_number(void) { return lexer.theLine; };
568 
570  virtual size_t line_number(size_t n) { return lexer.theLine = n; };
571 
573  virtual size_t column_number(void) { return lexer.theColumn; };
574 
576  virtual size_t column_number(size_t n) { return lexer.theColumn = n; };
577 
579  virtual mootio::ByteOffset byte_number(void) { return lexer.theByte; };
580 
582  virtual mootio::ByteOffset byte_number(mootio::ByteOffset n) { return lexer.theByte = n; };
584 
585 
586  /*----------------------------------------
587  * Reader: Native: Methods: New methods
588  */
596  inline bool input_is_tagged(void)
597  {
598  return lexer.first_analysis_is_best;
599  };
606  inline bool input_is_tagged(bool is_tagged)
607  {
608  if (is_tagged) {
609  tr_format |= tiofTagged;
610  lexer.first_analysis_is_best = true;
611  lexer.ignore_first_analysis = true;
612  } else {
613  tr_format &= ~tiofTagged;
614  lexer.first_analysis_is_best = false;
615  lexer.ignore_first_analysis = false;
616  }
617  return is_tagged;
618  };
619 
624  inline bool input_has_locations(void)
625  {
626  return lexer.parse_location;
627  };
628 
633  inline bool input_has_locations(bool has_locs)
634  {
635  if (has_locs) {
636  tr_format |= tiofLocation;
637  lexer.parse_location = true;
638  } else {
639  tr_format &= ~tiofLocation;
640  lexer.parse_location = false;
641  }
642  return has_locs;
643  };
644 
649  inline bool input_has_cost(void)
650  {
651  return lexer.parse_analysis_cost;
652  };
653 
658  inline bool input_has_cost(bool has_cost)
659  {
660  if (has_cost) {
661  tr_format |= tiofCost;
662  lexer.parse_analysis_cost = true;
663  lexer.analysis_cost_details = false;
664  } else {
665  tr_format &= ~tiofCost;
666  lexer.parse_analysis_cost = false;
667  lexer.analysis_cost_details = true;
668  }
669  return has_cost;
670  };
672 };
673 
674 
675 //==========================================================================
676 // TokenWriter
677 
679 class TokenWriter : public TokenIO {
680 public:
682  int tw_format;
683 
685  std::string tw_name;
686 
688  mootio::mostream *tw_ostream;
689 
691  bool tw_ostream_created;
692 
694  bool tw_is_comment_block;
695 
701  void *tw_data;
702 
703 public:
704  /*----------------------------------------
705  * Writer: Methods
706  */
714  TokenWriter(int fmt=tiofWellDone,
715  const std::string &name="TokenWriter")
716  : tw_format(fmt),
717  tw_name(name),
718  tw_ostream(NULL),
719  tw_ostream_created(false),
720  tw_is_comment_block(false),
721  tw_data(NULL)
722  {};
723 
725  virtual ~TokenWriter(void)
726  {
727  //close();
728  };
730 
731  /*------------------------------------------------------------
732  * Writer: Methods: Output Selection
733  */
736 
742  virtual void to_mstream(mootio::mostream *mostreamp)
743  {
744  this->close();
745  tw_ostream = mostreamp;
746  if ( !(tw_format&tiofNull) && (!tw_ostream || !tw_ostream->valid())) {
747  this->carp("Warning: selecting output to invalid stream");
748  }
749  tw_ostream_created = false;
750  };
751 
756  virtual void to_mstream(mootio::mostream &mos)
757  {
758  this->to_mstream(&mos);
759  };
760 
766  virtual void to_filename(const char *filename)
767  {
768  this->to_mstream(new mootio::mofstream(filename,"wb"));
769  tw_ostream_created = true;
770  if (!tw_ostream || !tw_ostream->valid()) {
771  this->carp("open failed for \"%s\": %s", filename, strerror(errno));
772  this->close();
773  }
774  };
775 
782  virtual void to_file(FILE *file)
783  {
784  this->to_mstream(new mootio::mocstream(file));
785  tw_ostream_created = true;
786  };
787 
794  virtual void to_fd(int fd)
795  {
796  this->close();
797  throw domain_error("to_fd(): not implemented.");
798  };
799 
806  virtual void to_cxxstream(std::ostream &os)
807  {
808  this->to_mstream(new mootio::mocxxstream(os));
809  tw_ostream_created = true;
810  };
811 
820  virtual void close(void) {
821  if (tw_is_comment_block) this->put_comment_block_end();
822  if (tw_ostream && tw_ostream_created) {
823  tw_ostream->close();
824  delete tw_ostream;
825  }
826  tw_ostream_created = false;
827  tw_ostream = NULL;
828  };
829 
833  virtual bool opened(void)
834  {
835  return tw_ostream!=NULL && tw_ostream->valid();
836  };
837 
839  virtual bool flush(void)
840  {
841  return this->opened() && tw_ostream->flush();
842  };
843 
845  inline bool autoflush(mootio::mostream *os)
846  {
847  return (tw_format&tiofFlush)==0 || os->flush();
848  };
850 
851 
852  /*----------------------------------------*/
859  virtual void put_token(const mootToken &token) {
860  throw domain_error("TokenWriter: put_token() not implemented");
861  };
868  virtual void put_tokens(const mootSentence &tokens)
869  {
870  for (mootSentence::const_iterator si=tokens.begin(); si!=tokens.end(); si++)
871  this->put_token(*si);
872  };
873 
879  virtual void put_sentence(const mootSentence &sentence)
880  {
881  this->put_tokens(sentence);
882  };
884 
885  /*----------------------------------------*/
893  virtual void put_comment_block_begin(void) {
894  tw_is_comment_block = true;
895  };
896 
902  virtual void put_comment_block_end(void) {
903  tw_is_comment_block = false;
904  };
905 
910  virtual void put_comment_buffer(const char *buf, size_t len) {
911  this->put_comment_block_begin();
912  this->put_raw_buffer(buf,len);
913  this->put_comment_block_end();
914  };
915 
920  virtual void put_comment(const char *s) {
921  this->put_comment_buffer(s,strlen(s));
922  };
923 
928  virtual void put_comment_buffer(const std::string &s) {
929  this->put_comment_buffer(s.data(),s.size());
930  };
931 
936  virtual void printf_comment(const char *fmt, ...);
938 
939  /*----------------------------------------*/
946  virtual void put_raw_buffer(const char *buf, size_t len)
947  {};
952  virtual void put_raw(const char *s) {
953  this->put_raw_buffer(s,strlen(s));
954  };
959  virtual void put_raw(const std::string &s) {
960  this->put_raw_buffer(s.data(),s.size());
961  };
962 
967  virtual void printf_raw(const char *fmt, ...);
969 
970  /*----------------------------------------*/
975  virtual void writer_name(const std::string &myname) { tw_name = myname; };
976 
978  virtual void carp(const char *fmt, ...);
980 };
981 
982 //==========================================================================
983 // TokenWriterNative
984 
988 class TokenWriterNative : public TokenWriter {
989 public:
990  /*----------------------------------------
991  * Writer: Native: Data
992  */
994  mootio::mocbuffer twn_tmpbuf;
995 
996 public:
997  /*----------------------------------------
998  * Writer: Native: Methods: construction
999  */
1003  TokenWriterNative(int fmt=tiofWellDone,
1004  const std::string name="TokenWriterNative")
1005  : TokenWriter(fmt,name)
1006  {
1007  if (! (tw_format&tiofNative) ) tw_format |= tiofNative;
1008  };
1009 
1011  virtual ~TokenWriterNative(void)
1012  {
1013  //TokenWriterNative::close();
1014  };
1016 
1017  /*----------------------------------------
1018  * Writer: Native: Methods: Output Selection
1019  */
1021  // @ {
1022 
1023  /*
1024  * Finish output to currently selected sink & perform any required
1025  * cleanup operations.
1026  * Used by named-file interface.
1027  */
1028  //virtual void close(void);
1029  // @ }
1030 
1031  /*----------------------------------------
1032  * Writer: Native: Methods: Output
1033  */
1036  virtual void put_token(const mootToken &token) {
1037  _put_token(token,tw_ostream);
1038  };
1039  virtual void put_tokens(const mootSentence &tokens) {
1040  _put_tokens(tokens,tw_ostream);
1041  };
1042  virtual void put_sentence(const mootSentence &sentence) {
1043  _put_sentence(sentence,tw_ostream);
1044  };
1045 
1046  virtual void put_raw_buffer(const char *buf, size_t len) {
1047  _put_raw_buffer(buf,len,tw_ostream);
1048  };
1050 
1051  /*----------------------------------------
1052  * Writer: Native: Methods: Utilities
1053  */
1057  void _put_token(const mootToken &token, mootio::mostream *os);
1058 
1060  void _put_tokens(const mootSentence &tokens, mootio::mostream *os);
1061 
1063  void _put_sentence(const mootSentence &sentence, mootio::mostream *os);
1064 
1066  void _put_comment(const char *buf, size_t len, mootio::mostream *os);
1069  void _put_raw_buffer(const char *buf, size_t len, mootio::mostream *os);
1074  inline std::string token2string(const mootToken &token)
1075  {
1076  mostream *tw_ostream_old = tw_ostream;
1077  twn_tmpbuf.clear();
1078  tw_ostream = &twn_tmpbuf;
1079  _put_token(token,tw_ostream);
1080  std::string t2s(twn_tmpbuf.data(), twn_tmpbuf.size());
1081  tw_ostream = tw_ostream_old;
1082  return t2s;
1083  };
1084 
1088  inline std::string sentence2string(const mootSentence &sentence)
1089  {
1090  twn_tmpbuf.clear();
1091  _put_sentence(sentence,&twn_tmpbuf);
1092  return std::string(twn_tmpbuf.data(), twn_tmpbuf.size());
1093  };
1095 };
1096 
1097 
1098 //==========================================================================
1099 // TokenBuffer
1100 
1108 class TokenBuffer : public TokenReader, public TokenWriter {
1109 public:
1110  //------------------------------------------------------------
1111  // Buffer: typedefs
1112  typedef mootSentence Buffer;
1113 
1114 public:
1115  //------------------------------------------------------------
1116  // Buffer: Data
1117  Buffer tb_buffer;
1118  mootSentence tb_sentence;
1120 public:
1121  //------------------------------------------------------------
1123 
1124 
1129  TokenBuffer(int fmt=tiofUnknown, const std::string name="TokenBuffer")
1130  : TokenReader(fmt,name),
1131  TokenWriter(fmt,name)
1132  {
1133  tr_sentence = &tb_sentence;
1134  };
1135 
1137  virtual ~TokenBuffer(void);
1140  //------------------------------------------------------------
1142 
1144  virtual void from_mstream(mootio::mistream *mistreamp)
1145  {
1146  throw domain_error("from_mstream(): not implemented for class moot::TokenBuffer");
1147  };
1150  virtual void to_mstream(mootio::mostream *mostreamp)
1151  {
1152  throw domain_error("to_mstream(): not implemented for class moot::TokenBuffer");
1153  };
1154 
1156  virtual void close()
1157  {};
1158 
1160  virtual bool opened()
1161  { return true; };
1162 
1164  virtual void from_reader(TokenReader *reader);
1165 
1167  virtual void to_writer(TokenWriter *writer);
1168 
1170  virtual void clear_buffer();
1172 
1173  //------------------------------------------------------------
1176 
1181  virtual mootTokenType get_token(void);
1182 
1188  virtual mootTokenType get_sentence(void);
1190 
1191  //------------------------------------------------------------
1193 
1194 
1198  virtual void put_token(const mootToken &token);
1199 
1204  virtual void put_tokens(const mootSentence &tokens);
1205 
1210  virtual void put_sentence(const mootSentence &tokens);
1212 
1213  //------------------------------------------------------------
1215 
1216 
1220  virtual void put_raw_buffer(const char *buf, size_t len);
1222 };
1223 
1224 }; /*moot_END_NAMESPACE*/
1225 
1226 #endif /* _moot_TOKEN_IO_H */
size_t size(void) const
Definition: mootBufferIO.h:177
bool parse_analysis_cost
Definition: mootTokenLexer.h:128
Conserve raw XML.
Definition: mootTokenIO.h:55
Definition: mootAssocVector.h:39
unknown format
Definition: mootTokenIO.h:50
Class for native "cooked" text-format token input.
Definition: mootTokenIO.h:516
flex++ lexer for moot PoS tagger native text input (guts for moot::TokenReaderNative) ...
Definition: mootTokenLexer.h:71
null i/o, useful for testing
Definition: mootTokenIO.h:51
autoflush output stream after write (native i/o only)?
Definition: mootTokenIO.h:65
const char * data(void) const
Definition: mootBufferIO.h:174
static const int tiofMedium
Definition: mootTokenIO.h:76
size_t theColumn
Definition: mootGenericLexer.h:103
static class TokenWriter * file_writer(const char *filename, const char *fmt_request=__null, int fmt_implied=tiofNone, int fmt_default=tiofNone)
TokenIOFormatE
Definition: mootTokenIO.h:48
static const int tiofRare
Definition: mootTokenIO.h:70
Class for in-memory token buffers using mootSentence.
Definition: mootTokenIO.h:1139
static const int tiofWellDone
Definition: mootTokenIO.h:79
static const int tiofMediumRare
Definition: mootTokenIO.h:73
flex++ lexer for moot::TokenReaderNative guts: autogenerated headers
virtual void from_mstream(mootio::mistream &mis)
Definition: mootTokenIO.h:325
virtual void to_file(FILE *out=stdout)
static size_t pipe_sentences(class TokenReader *reader, class TokenWriter *writer)
virtual bool close(void)
Definition: mootIO.h:120
Abstract class for token input.
Definition: mootTokenIO.h:208
input is tagged ("medium" or "well done")
Definition: mootTokenIO.h:59
static std::string format_canonical_string(int fmt)
Pretty-print (XML only)
Definition: mootTokenIO.h:56
static bool is_empty_format(int fmt)
Wrapper class for named file input using C FILE*s.
Definition: mootCIO.h:286
XML format.
Definition: mootTokenIO.h:54
Abstract base class for output stream wrappers.
Definition: mootIO.h:194
Definition: mootCxxIO.h:141
High-level token information object.
Definition: mootToken.h:96
bool first_analysis_is_best
Definition: mootTokenLexer.h:128
literal token text included
Definition: mootTokenIO.h:57
no format
Definition: mootTokenIO.h:49
static int parse_format_string(const std::string &fmtString)
bool analysis_cost_details
Definition: mootTokenLexer.h:128
virtual bool flush(void)
Definition: mootIO.h:215
mootio abstraction layer for C++ streams
bool parse_location
Definition: mootTokenLexer.h:128
native text format
Definition: mootTokenIO.h:53
Class for native "cooked" text-format token output.
Definition: mootTokenIO.h:1019
TokenIOFormatE TokenIOFormat
Definition: mootTokenIO.h:67
moot::OffsetT ByteOffset
typedef for (byte) offsets (may be unsigned)
Definition: mootIO.h:55
virtual void close(void)
Definition: mootTokenIO.h:415
static class TokenWriter * new_writer(int fmt)
static int guess_filename_format(const char *filename)
list< mootToken > mootSentence
Definition: mootToken.h:630
some user-defined format
Definition: mootTokenIO.h:52
Wrapper class for named file output using C FILE*s.
Definition: mootCIO.h:327
mootTokenTypeE
Definition: mootToken.h:71
void clear(void)
Definition: mootBufferIO.h:333
Abstract class for token output.
Definition: mootTokenIO.h:700
static class TokenReader * file_reader(const char *filename, const char *fmt_request=__null, int fmt_implied=tiofNone, int fmt_default=tiofNone)
save full Viterbi trellis trace?
Definition: mootTokenIO.h:63
static size_t pipe_tokens(class TokenReader *reader, class TokenWriter *writer)
bool ignore_first_analysis
Definition: mootTokenLexer.h:128
Streambuf-like class for I/O on C char* buffers.
Definition: mootBufferIO.h:242
static int parse_format_request(const char *request, const char *filename=__null, int fmt_implied=tiofNone, int fmt_default=tiofNone)
virtual bool valid(void)
Definition: mootIO.h:99
locations appear as first non-tag analysis
Definition: mootTokenIO.h:61
moot::mootToken mtoken_default
Definition: mootTokenLexer.h:128
Wrapper class for C FILE* streams.
Definition: mootCIO.h:54
parse/output analysis &#39;prob&#39; field
Definition: mootTokenIO.h:62
void clear(void)
Definition: mootToken.h:396
size_t theLine
Definition: mootGenericLexer.h:102
Definition: mootCxxIO.h:90
input is pre-analyzed (>= "medium rare")
Definition: mootTokenIO.h:58
mootio::ByteOffset theByte
Definition: mootGenericLexer.h:104
Streambuf-like class for input from C char* buffers.
Definition: mootBufferIO.h:60
include Viterbi trellis predictions in trace?
Definition: mootTokenIO.h:64
Abstract base class for input stream wrappers.
Definition: mootIO.h:129
Abstract class for token I/O.
Definition: mootTokenIO.h:85
static int sanitize_format(int fmt, int fmt_implied=tiofNone, int fmt_default=tiofNone)
pruned output
Definition: mootTokenIO.h:60
static class TokenReader * new_reader(int fmt)