reference/ocr-new/Word.h
author viric@llimona
Thu, 18 May 2006 23:12:51 +0200
changeset 0 6b8091ca909a
permissions -rw-r--r--
Init from working directory of svn repository.


#ifndef _WORD_H_
#define _WORD_H_

#include "list.h"
#include "Component.h"
#include "string.h"

class Page;

class Word {
 public:

 // Constructor scans through count components starting at first
 // to set data fields. length is the actual length of the string
 Word(ListElement * first, int count,  int charlength);
 Word(char * word, int length);
 ~Word();

  Point center() { return (Point((ul.x() + lr.x())/2, 
			         (ul.y() +lr.y())/2)); };
  char * characters;        // text string
  int charCount;            // Number of characters in the string
  int compCount;

  short mispelled;          
  // spelled correctly? only valid if the word 
  // has been spellchecked

  Confidence confid;        // The average confidence of each char in word
  Point ul;                 // upper left point of word     
  Point lr;                 // lower right point of word
  
  Component ** character;   // an array of components that 
                             // make up  this word
};


class Words:public List{

 public:
  int num_words;
  Words():List(){};
 ~Words();
  int writeWordPos(char * filename);
  int writeWordbox(char * filename, int xoffset, int yoffset,
		   Page * page, bool equationsOnly);
  int writeAscii(char * filename);
};

#endif